📄 globals.h
字号:
} mbState_s;typedef struct _mbAttributes_s { int blksPerLine; int8 *refIdxTable; motVec_s *motVecTable; mbState_s *mbStateArr;} mbAttributes_s;typedef struct _statSlice_s { int nFrames; double psnrY; double psnrU; double psnrV; int bitsNAL; int bitsHdr; int bitsSkipLen; int bitsMBtype; int bitsPred; int bitsVec; int bitsCBP; int bitsCoefLumaDC; int bitsCoefLuma; int bitsCoefChromaDC; int bitsCoefChroma; int bitsArithmeticStream; int interModeCtr[MAX_MODES]; int intraModeCtr1; int intraModeCtr2[MAX_MODES];} statSlice_s;// DT: check// More statistics needed?typedef struct _statNonSliceNal_s{ int bitsNAL; int bitsPPS; int bitsSPS; int bitsSEI;} statNonSliceNal_s;typedef struct _costMeasure_s{ int mse; int edgeMse; int bits; int lumaCoeffBits; int sad; int cDistortion; // channel distortion int cost;} costMeasure_s;extern const costMeasure_s initCostMeasure;// Definitions of NAL types#define UNSPECIFIED_NAL_TYPE 0#define CODED_SLICE_NAL_TYPE 1#define CODED_SLICE_P_A_NAL_TYPE 2#define CODED_SLICE_P_B_NAL_TYPE 3#define CODED_SLICE_P_C_NAL_TYPE 4#define CODED_SLICE_IDR_NAL_TYPE 5#define SEI_NAL_TYPE 6#define SPS_NAL_TYPE 7#define PPS_NAL_TYPE 8#define PIC_DELIMITER_NAL_TYPE 9#define END_SEQ_NAL_TYPE 10#define END_STREAM_NAL_TYPE 11#define FILLER_DATA_NAL_TYPE 12#define INVALID_NAL_TYPE 13// constants used in mode decision#define MODE_DECISION_HADAMARD 0 // use sad after Hadamard#define MODE_DECISION_RDO 1 // based on actual distortion & rate#define MODE_DECISION_SIMPLE 2 // the test mode, simple SAD/* * Motion modes */#define MOT_NUM_MODES 7#define MOT_COPY 0#define MOT_16x16 1#define MOT_16x8 2 #define MOT_8x16 3#define MOT_8x8 4#define MOT_8x4 5 #define MOT_4x8 6#define MOT_4x4 7/* these are the sub-MB mode as they are encoded */#define P_L0_8x8 0#define P_L0_8x4 1#define P_L0_4x8 2#define P_L0_4x4 3// Coefficient block categories#define BLK_CAT_Y_I16x16_DC 0 // block category, luma, intra16x16, DC#define BLK_CAT_Y_I16x16_AC 1 // block category, luma, intra16x16, DC#define BLK_CAT_Y 2 // block category, luma, intra16x16, DC#define BLK_CAT_C_DC 3 // block category, luma, intra16x16, DC#define BLK_CAT_C_AC 4 // block category, luma, intra16x16, DC#define COMP_LUMA 0#define COMP_CB 1#define COMP_CR 2//////LOW_COMPLEX_PROF3#define TH_QPEL 1 // threshold for qpel #define TH_HPEL_GAIN 15 // gain in half pel needed to continue qpel#define TH_QP1 40#define TH_QP2 28// for intra pred#define TH_IPR_MODE 100 #define TH_IPR_16x16 1000#define TH_IPR_4x4 2000// for multi-step search #define NUM_POS_16x16_FastMot 24#define NUM_POS_16x16 14#define NUM_POS_16x8_FastMot 8 #define NUM_POS_16x8 4 #define TH_FastMot 24 #define TH_FastMot_16x8 12#define ME_START_16x8 -12#define ME_START_16x16 -28#define SMALL_SEARCH_WIN 8#define LC3_RANGE 8//////LOW_COMPLEX_PROF3typedef struct MMCO_struct { int mmco; int diffPicNumMinus1; int longTermPicNum; int longTermFrmIdx; int maxLongTermFrmIdxPlus1; struct MMCO_struct *next;} MMCO_s;// : data structure for all LC3 variables//////LOW_COMPLEX_PROF3typedef struct _LC3_s{ // low complex profile 3 or not int low_complex_prof3; int spec_search_pos; // flag for skipping opertation int16 do_qpel_mode_2_3; int16 do_qpel_mode_4; int16 do_16x8; // macroblock counter int16 cnt; int16 old_cnt; int16 old_cnt2; int16 thre_change[MOT_8x8+1]; int16 qp; int16 mode; //16x16, 8x16, ...} LC3_s;////LOW_COMPLEX_PROF3// part of MB, contains 1 or more 4x4 blockstypedef struct _mbPart_s{ int x0, x1, y0, y1; u_int8 *orig; int width; int height; int *partSum; u_int8 *ref; int refWidth; // the width of buffer refPartSum is the same as "ref" u_int16 *refPartSum; int lambda; int lambdaCoarse; int profile; int mode; int range; const int8 *vlcMvBitsX; const int8 *vlcMvBitsY; //// LOW_COMPLEX_PROF3 // : information for low complex prof 3 LC3_s *plc3;///} mbPart_s;#define REF_NA -2 // Reference not available, because MB not available#define MAX_COST (1 << 25)// define the tools that are used mainly for performing the trade-off // between the speed and coding efficiency. typedef struct _meProfile_s{ int profile; // those values usually does not depend on macro block, may be adjusted // for running time complexity control int16 range[2][2]; // search ranges for different scenarios int pruneTreeFlag; // stop search, if it does not make sense to continue int pruneTreeTh; // threshold int pruneThUnit; // int interModeFlags; // the smallest mode supported int hadamard; // should be transfered from encParams_s // subsampling for integer search, 4, all position, > 4, subsampling int subsampling; // for running time complexity control int16 area0[2]; // search area int16 area1[2]; // mv predictor motVec_s predVec; // estimated motion vector, may not be predVec, at integer boundary int16 estVec4[2]; // search vector limit, mapped from area to block int16 vecLmt0[2]; int16 vecLmt1[2]; // motion vector nominal range, typically within this range int16 p0[2]; int16 p1[2]; // 0, pred MV, 1, pred MV for 16x16, average for other int searchCtrFlag; int16 searchCtrs[16][2]; // motion vectors to be used if the block is skipped //blkSADs[refFrameID][mode][blk_id] int16 blkSADs[FRM_MAX_REF_FRAMES][8][16]; //// LOW_COMPLEX_PROF3 // : information for low complex prof 3 LC3_s lc3;//// // These are AVC level limitations int subMbRectSizeFlag; int maxVerticalMvRange;} meProfile_s;typedef struct _vlcCode_s{ int8 code; int8 len;} vlcCode_s;/* * Fucntions and data */void staClear(statSlice_s *stat);void staNonSliceClear(statNonSliceNal_s *pstat);void staAccumulate(statSlice_s *stat1, statSlice_s *stat2);int staGetTotalBits(statSlice_s *stat);extern const int8 QP2QUANT[52];extern const int8 qpChroma[52];extern const int8 blkRasterOrder[16];void initSea(u_int8 *frmBuf, u_int16 *seaBuf, int picWidth, int picHeight, int blkSize);int CalculateSsd(u_int8 *orig, int origBufWidth, u_int8 *reco, int recoBufWidth, int width, int height);int CalculateEdgeSsd(u_int8 *orig, int origBufWidth, u_int8 *reco, int recoBufWidth, int width, int height, int rightMb, int bottomMb);int CalculateSad(u_int8 *orig, int origBufWidth, u_int8 *reco, int recoBufWidth, int width, int height);#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -