📄 mode.h
字号:
/*************************************************************************This software module was originally developed by Ming-Chieh Lee (mingcl@microsoft.com), Microsoft Corporation Wei-ge Chen (wchen@microsoft.com), Microsoft Corporation Bruce Lin (blin@microsoft.com), Microsoft Corporation Chuang Gu (chuanggu@microsoft.com), Microsoft Corporation Simon Winder (swinder@microsoft.com), Microsoft Corporation (date: March, 1996)and edited by Wei Wu (weiwu@stallion.risc.rockwell.com) Rockwell Science Centerand also edited by Yoshihiro Kikuchi (TOSHIBA CORPORATION) Takeshi Nagai (TOSHIBA CORPORATION) Toshiaki Watanabe (TOSHIBA CORPORATION) Noboru Yamaguchi (TOSHIBA CORPORATION) Marc Mongenet (Marc.Mongenet@epfl.ch), Swiss Federal Institute of Technology, Lausanne (EPFL) and also edited by Mathias Wien (wien@ient.rwth-aachen.de) RWTH Aachen / Robert BOSCH GmbHand also edited by Yoshinori Suzuki (Hitachi, Ltd.)and also edited by Hideaki Kimata (NTT)and also edited by Fujitsu Laboratories Ltd. (contact: Eishi Morimatsu)and also edited by Takefumi Nagumo (nagumo@av.crl.sony.co.jp) SONY corporation Sehoon Son (shson@unitel.co.kr) Samsung AITin the course of development of the MPEG-4 Video (ISO/IEC 14496-2). This software module is an implementation of a part of one or more MPEG-4 Video tools as specified by the MPEG-4 Video. ISO/IEC gives users of the MPEG-4 Video free license to this software module or modifications thereof for use in hardware or software products claiming conformance to the MPEG-4 Video. Those intending to use this software module in hardware or software products are advised that its use may infringe existing patents. The original developer of this software module and his/her company, the subsequent editors and their companies, and ISO/IEC have no liability for use of this software module or modifications thereof in an implementation. Copyright is not released for non MPEG-4 Video conforming products. Microsoft retains full right to use the code for his/her own purpose, assign or donate the code to a third party and to inhibit third parties from using the code for non <MPEG standard> conforming products. This copyright notice must be included in all copies or derivative works. Copyright (c) 1996, 1997.Module Name: mode.hAbstract: basic coding modes for VO, VOL, VOP, MB and RDRevision History: Sept. 29, 1997: add Video Packet, data partition, RVLC by Toshiba Nov. 27, 1997: add horizontal & vertical sampling factor by Takefumi Nagumo (nagumo@av.crl.sony.co.jp) SONY Dec.12 1997 : add interlace tools by NextLevel Systems (General Instrucment), X. Chen (xchen@nlvl.com) and B. Eifrig (beifrig@nlvl.com) May. 9 1998 : add boundary by Hyundai Electronics Cheol-Soo Park (cspark@super5.hyundai.co.kr) May. 9 1998 : add field based MC padding by Hyundai Electronics Cheol-Soo Park (cspark@super5.hyundai.co.kr) Jun.15 1998 : add Complexity Estimation syntax support Marc Mongenet (Marc.Mongenet@epfl.ch) - EPFL Feb.16 1999 : add Quarter Sample Mathias Wien (wien@ient.rwth-aachen.de) Feb.23 1999 : GMC added by Yoshinori Suzuki (Hitachi, Ltd.) May 9, 1999 : tm5 rate control by DemoGraFX, duhoff@mediaone.net, (added by mwi) Aug.24, 1999 : NEWPRED added by Hideaki Kimata (NTT) Sep.06 1999 : RRV added by Eishi Morimatsu (Fujitsu Laboratories Ltd.) Feb.01 2000 : Added bBGComposition flag by Takefumi Nagumo (Sony Corporation) Mar.22 2000 : Added bResyncMarkerDisable by Takefumi Nagumo (Sony Corporation)*************************************************************************/#ifndef __MODE_H_#define __MODE_H_typedef enum {BASE_LAYER, ENHN_LAYER} VOLtype; // will be generlized latertypedef enum {INTRA, INTRAQ, INTER, INTERQ} DCTMode; // define pixel componenttypedef enum {DIRECT, INTERPOLATE, BACKWARD, FORWARD} MBType; // define MB typetypedef enum {UNKNOWN_DIR, HORIZONTAL, VERTICAL, DIAGONAL} Direction; typedef enum {ALL_TRANSP, ALL_OPAQUE, INTRA_CAE, INTER_CAE_MVDZ, INTER_CAE_MVDNZ, MVDZ_NOUPDT, MVDNZ_NOUPDT, UNKNOWN} ShapeMode;//OBSS_SAIT_991015typedef enum {INTRA_NOT_CODED, INTRA_CODED, INTER_NOT_CODED, INTER_CODED, UNDEFINED} ShapeSSMode; //for OBSS shape modetypedef enum {V_SCANNING, H_SCANNING} SIDirection; //for OBSS shape coding//~OBSS_SAIT_991015typedef enum {UNTRANSMITTED, TRANSMITTED, UPDATED, FINISHED} MBSptMode; // MB sprite modetypedef enum {ALPHA_CODED, ALPHA_SKIPPED, ALPHA_ALL255} CODAlpha;typedef Direction IntraPredDirection; //for readabilitytypedef Direction CAEScanDirection; //for readability#ifndef NOT_IN_TABLE#define NOT_IN_TABLE -1#endif#ifndef TCOEF_ESCAPE#define TCOEF_ESCAPE 102 // see table.13/H.263#endif// Added for error resilience mode By Toshiba(1998-1-16:DP+RVLC)#define TCOEF_RVLC_ESCAPE 169 // see table.// End Toshiba(1998-1-16:DP+RVLC)// VM 5.1 Rate Control#define RC_MAX_SLIDING_WINDOW 20#define RC_PAST_PERCENT 0.05#define RC_SAFETY_MARGIN 0.10#define RC_SKIP_MARGIN 80#define RC_MAX_Q_INCREASE 0.25#define RC_MAX_QUANT 31#define RC_MIN_QUANT 1#define MAX_MAC 10#ifdef UNDER_CE#define __attribute__(x) /*NOTHING*/#endiftypedef struct MVInfo // for motion vector coding{ UInt uiRange; // search range UInt uiFCode; // f-code UInt uiScaleFactor; // scale factor} MVInfo __attribute__ ((aligned (32)));#define PVOP_MV_PER_REF_PER_MB 9#define BVOP_MV_PER_REF_PER_MB 5typedef struct VOLMode // VideoObjectLayer Mode{ UInt uiVerID; // Version identification // GMC // type of VOL VOLtype volType; // what type of VOL // NBIT: nbit information Bool bNot8Bit; UInt uiQuantPrecision; UInt nBits; // time info Int iClockRate; //rate of clock used to count vops in Hz // shape info AlphaUsage fAUsage; //binary or gray level alpha; or no alpha (rectangle VO) Int iAuxCompCount; Bool bShapeOnly; // code only the shape // motion info Bool bAdvPredDisable; // No OBMC, (8x8 in the future). Bool bQuarterSample; // Quarter sample Bool bRoundingControlDisable; Int iInitialRoundingType;// NEWPRED Bool bNewpredEnable;// ~NEWPRED//RESYNC_MARKER_FIX Bool bResyncMarkerDisable; // resync marker Disable*///~RESYNC_MARKER_FIX Bool bVPBitTh; // Bit threshold for video packet spacing control Bool bDataPartitioning; // data partitioning Bool bReversibleVlc; // reversible VLC // texture coding info Quantizer fQuantizer; // either H.263 or MPEG Bool bLoadIntraMatrix; // flag indicating whether to load intra Q-matrix Int rgiIntraQuantizerMatrix [BLOCK_SQUARE_SIZE]; // Intra Q-Matrix Bool bLoadInterMatrix; // flag indicating whether to load inter Q-matrix Int rgiInterQuantizerMatrix [BLOCK_SQUARE_SIZE]; // Inter Q-Matrix Bool bLoadIntraMatrixAlpha; // flag indicating whether to load intra Q-matrix Int rgiIntraQuantizerMatrixAlpha[MAX_MAC][BLOCK_SQUARE_SIZE]; Bool bLoadInterMatrixAlpha; // flag indicating whether to load inter Q-matrix Int rgiInterQuantizerMatrixAlpha[MAX_MAC][BLOCK_SQUARE_SIZE]; Bool bDeblockFilterDisable; // apply deblocking filter or not. Bool bNoGrayQuantUpdate; // decouple gray quant and dquant EntropyCodeType fEntropyType; // Entropy code type // HHI Klaas Schueuer sadct flag Bool bSadctDisable; // end HHI // START: Complexity Estimation syntax support - Marc Mongenet (EPFL) - 15 Jun 1998 Bool bComplexityEstimationDisable; // START: Vol Control Parameters UInt uiVolControlParameters; UInt uiChromaFormat; UInt uiLowDelay; UInt uiVBVParams; UInt uiBitRate; UInt uiVbvBufferSize; UInt uiVbvBufferOccupany; // END: Vol Control Parameters Int ihor_sampling_factor_m ; Int ihor_sampling_factor_n ; Int iver_sampling_factor_m ; Int iver_sampling_factor_n ; // object based spatial scalability Int ihor_sampling_factor_m_shape ; Int ihor_sampling_factor_n_shape ; Int iver_sampling_factor_m_shape ; Int iver_sampling_factor_n_shape ;// RRV insertion Bool breduced_resolution_vop_enable;// ~RRV } VOLMode __attribute__ ((aligned (32)));typedef struct VOPMode // VideoObjectPlane Mode{ // user specify, per VOP Int intStepI; // I-VOP stepsize for DCT Int intStep; // P-VOP stepsize for DCT Int intStepB; // B-VOP stepsize for DCT VOPpredType vopPredType; //whether IVOP, PVOP, BVOP, or Sprite Int iIntraDcSwitchThr; //threshold to code intraDC as with AC VLCs Int iRoundingControl; //rounding control Int iVopConstantAlphaValue; // for binary or grayscale shape pk val // motion search info MVInfo mvInfoForward; // motion search info MVInfo mvInfoBackward; // motion search info Bool bInterlace; // interlace coding flag Bool bAlternateScan; // Alternate Scan // for scalability Int iRefSelectCode; Bool bShapeCodingType; // vop_shape_coding_type (0:intra, 1:inter): Added for error resilient mode by Toshiba(1997-11-14) SptXmitMode SpriteXmitMode; // sprite transmit mode } VOPMode __attribute__ ((aligned (32)));typedef struct CMBMode // MacroBlock Mode{ Bool m_bSkip; // is the Macroblock skiped. = COD in H.263 Bool m_bMCSEL; // whether the MB is the GMC macroblock MBType m_mbType; // macroblock type, DIRECT, FORWARD, BACKWARD, or INTERPOLATE DCTMode m_dctMd; // is the Macroblock inter- or intra- coded Int m_intStepDelta; // change of quantization stepsize = DQUANT in h.263 Bool m_bhas4MVForward; //whether the MB has four motion vectors (for forward vectors) Bool m_bhas4MVBackward; //whether the MB has four motion vectors (for backward vectors) Bool m_bFieldMV; // whether the MB is compensated by field motion vectors (for forward vectors) : yes=1#ifdef ENABLE_INTERLACING Bool m_bForwardTop; // TRUE iff Current Forward Top field MV references the BOTTOM field Bool m_bForwardBottom; // TRUE iff Current Forward Bottom field MV references the BOTTOM field Bool m_bBackwardTop; // TRUE iff Current Backward Top field MV references the BOTTOM field Bool m_bBackwardBottom; // TRUE iff Current Backward Bottom field MV references the BOTTOM field#endif Bool m_bFieldDCT; // use field DCT or not : yes=1 Int m_stepSize; //qp for texture IntraPredDirection* m_preddir; // horizonal or vertical Bool m_bACPrediction; // use AC prediction or not Bool m_bCodeDcAsAc; //code Intra DC with Ac VLC Bool m_bColocatedMBSkip; // for B-VOP, colocated MB skipped or not Bool m_bColocatedMBMCSEL; // for B-VOP, colocated MB is a GMC macroblock or not Int m_iVideoPacketNumber; // Video Packet Number; added by Toshiba#ifdef ENABLE_INTERLACING CVector m_vctDirectDeltaMV; // delta vector for direct mode#endif Bool* m_rgbCodedBlockPattern; //for each block, 1 = some non-DC components are coded UInt m_uiNumBlks;}CMBMode __attribute__ ((aligned (32)));// ~MacroBlock ModeVoid CMBMode_Init (CMBMode *); #endif //__MODE_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -