global.h

来自「H.264编码实现」· C头文件 代码 · 共 1,550 行 · 第 1/4 页

H
1,550
字号
  int RDPictureIntra;                //!< Enabled RD pic decision for intra as well.
  int RDPSliceWeightOnly;            //!< If enabled, does not check QP variations for P slices.
  int RDPSliceBTest;                 //!< Tests B slice replacement for P.
  int RDBSliceWeightOnly;            //!< If enabled, does not check QP variations for B slices.
  int SkipIntraInInterSlices;        //!< Skip intra type checking in inter slices if best_mode is skip/direct
  int BRefPictures;                  //!< B coded reference pictures replace P pictures (0: not used, 1: used)
  int HierarchicalCoding;
  int HierarchyLevelQPEnable;
  char ExplicitHierarchyFormat[1024];//!< Explicit GOP format (HierarchicalCoding==3).
  int ReferenceReorder;              //!< Reordering based on Poc distances
  int PocMemoryManagement;           //!< Memory management based on Poc distances for hierarchical coding

  int symbol_mode;                   //!< Specifies the mode the symbols are mapped on bits
  int of_mode;                       //!< Specifies the mode of the output file
  int partition_mode;                //!< Specifies the mode of data partitioning

  int InterSearch[2][8];

  int DisableIntra4x4;
  int DisableIntra16x16;
  int FastMDEnable; 
  int FastIntraMD; 
  int FastIntra4x4;
  int FastIntra16x16;
  int FastIntra8x8;
  int FastIntraChroma;
  int DisableIntraInInter;
  int IntraDisableInterOnly;
  int Intra4x4ParDisable;
  int Intra4x4DiagDisable;
  int Intra4x4DirDisable;
  int Intra16x16ParDisable;
  int Intra16x16PlaneDisable;
  int ChromaIntraDisable;

  int EnableIPCM;

  double FrameRate;

  int EPZSPattern;
  int EPZSDual;
  int EPZSFixed;
  int EPZSTemporal;
  int EPZSSpatialMem;
  int EPZSBlockType;
  int EPZSMinThresScale;
  int EPZSMaxThresScale;
  int EPZSMedThresScale;
  int EPZSSubPelGrid;
  int EPZSGrid;
  int EPZSSubPelME;
  int EPZSSubPelMEBiPred;
  int EPZSSubPelThresScale;

  int chroma_qp_index_offset;
#ifdef _FULL_SEARCH_RANGE_
  int full_search;
#endif
#ifdef _ADAPT_LAST_GROUP_
  int last_frame;
#endif
#ifdef _CHANGE_QP_
  int qpN2, qpB2, qp2start;
  int qp02, qpBRS2Offset;
#endif
  int rdopt;
  int Distortion[TOTAL_DIST_TYPES];
  double VisualResWavPSNR;
  int SSIMOverlapSize;
  int DistortionYUVtoRGB;
  int CtxAdptLagrangeMult;    //!< context adaptive lagrangian multiplier
  int FastCrIntraDecision;
  int disthres;
  int nobskip;

#ifdef _LEAKYBUCKET_
  int NumberLeakyBuckets;
  char LeakyBucketRateFile[FILE_NAME_SIZE];
  char LeakyBucketParamFile[FILE_NAME_SIZE];
#endif

  int PicInterlace;           //!< picture adaptive frame/field
  int MbInterlace;            //!< macroblock adaptive frame/field

  int IntraBottom;            //!< Force Intra Bottom at GOP periods.

  int LossRateA;              //!< assumed loss probablility of partition A (or full slice), in per cent, used for loss-aware R/D optimization
  int LossRateB;              //!< assumed loss probablility of partition B, in per cent, used for loss-aware R/D
  int LossRateC;              //!< assumed loss probablility of partition C, in per cent, used for loss-aware R/D
  int NoOfDecoders;
  int ErrorConcealment;       //!< Error concealment method used for loss-aware RDO (0: Copy Concealment)
  int RestrictRef;
  int NumFramesInELSubSeq;

  int RandomIntraMBRefresh;     //!< Number of pseudo-random intra-MBs per picture

  int DFSendParameters;
  int DFDisableIdc[2][NUM_SLICE_TYPES];
  int DFAlpha     [2][NUM_SLICE_TYPES];
  int DFBeta      [2][NUM_SLICE_TYPES];

  int SparePictureOption;
  int SPDetectionThreshold;
  int SPPercentageThreshold;

  // FMO
  char SliceGroupConfigFileName[FILE_NAME_SIZE];    //!< Filename for config info fot type 0, 2, 6
  int num_slice_groups_minus1;           //!< "FmoNumSliceGroups" in encoder.cfg, same as FmoNumSliceGroups, which should be erased later
  int slice_group_map_type;

  int *top_left;                         //!< top_left and bottom_right store values indicating foregrounds
  int *bottom_right;
  byte *slice_group_id;                   //!< slice_group_id is for slice group type being 6
  int *run_length_minus1;                //!< run_length_minus1 is for slice group type being 0

  int slice_group_change_direction_flag;
  int slice_group_change_rate_minus1;
  int slice_group_change_cycle;

  int redundant_pic_flag;   //! encoding of redundant pictures
  int pic_order_cnt_type;   //! POC type

  int context_init_method;
  int model_number;
  int Transform8x8Mode;
  int ReportFrameStats;
  int DisplayEncParams;
  int Verbose;

  //! Rate Control on JVT standard
  int RCEnable;
  int bit_rate;
  int SeinitialQP;
  unsigned int basicunit;
  int channel_type;
  int RCUpdateMode;
  double RCIoverPRatio;
  double RCBoverPRatio;
  double RCISliceBitRatio;
  double RCBSliceBitRatio[RC_MAX_TEMPORAL_LEVELS];
  int    RCMinQP[NUM_SLICE_TYPES];
  int    RCMaxQP[NUM_SLICE_TYPES];
  int    RCMaxQPChange;

  // Search Algorithm
  SearchType SearchMode;
  int UMHexDSR;//!< Dynamic Search Range
  int UMHexScale;

//////////////////////////////////////////////////////////////////////////
  // Fidelity Range Extensions
  int ScalingMatrixPresentFlag;
  int ScalingListPresentFlag[12];

  int cb_qp_index_offset;
  int cr_qp_index_offset;
  // Lossless Coding
  int lossless_qpprime_y_zero_flag;

  // Lambda Params
  int UseExplicitLambdaParams;
  int UpdateLambdaChromaME;
  double LambdaWeight[6];
  double FixedLambda[6];

  char QOffsetMatrixFile[FILE_NAME_SIZE];        //!< Quantization Offset matrix cfg file
  int  OffsetMatrixPresentFlag;                  //!< Enable Explicit Quantization Offset Matrices

  int AdaptiveRounding;                          //!< Adaptive Rounding parameter based on JVT-N011
  int AdaptRoundingFixed;                        //!< Global rounding for all qps
  int AdaptRndPeriod;                            //!< Set period for adaptive rounding of JVT-N011 in MBs
  int AdaptRndChroma;
  int AdaptRndWFactor  [2][NUM_SLICE_TYPES];     //!< Weighting factors for luma component based on reference indicator and slice type
  int AdaptRndCrWFactor[2][NUM_SLICE_TYPES];     //!< Weighting factors for chroma components based on reference indicator and slice type
  // Fast Mode Decision
  int EarlySkipEnable;
  int SelectiveIntraEnable;
  int DisposableP;
  int DispPQPOffset;

  //Redundant picture
  int NumRedundantHierarchy;   //!< number of entries to allocate redundant pictures in a GOP
  int PrimaryGOPLength;        //!< GOP length of primary pictures
  int NumRefPrimary;           //!< number of reference frames for primary picture

  // Chroma interpolation and buffering
  int ChromaMCBuffer;
  int ChromaMEEnable;
  int ChromaMEWeight;
  int MEErrorMetric[3];
  int ModeDecisionMetric;
  int SkipDeBlockNonRef;

  // tone mapping SEI message
  int ToneMappingSEIPresentFlag;
  char ToneMappingFile[FILE_NAME_SIZE];    //!< ToneMapping SEI message cfg file

  int separate_colour_plane_flag;
  double WeightY;
  double WeightCb;
  double WeightCr;
  

  int UseRDOQuant;
  int RDOQ_DC;
  int RDOQ_CR;
  int RDOQ_QP_Num;
  int RDOQ_CP_Mode;
  int RDOQ_CP_MV;
  int RDOQ_Fast;

  int EnableVUISupport;
  // VUI parameters
  VUIParameters VUI;
  // end of VUI parameters

} InputParameters;

//! ImageParameters
typedef struct
{
  int number;                  //!< current image number to be encoded (in first layer)  
  int frm_number;
  int cur_frm_number;          //!< current image number to be encoded (in all layers)
  int idr_gop_number;          //!< current idr image number to be encoded
  int rewind_frame;                  //!< current image number to be encoded
  int pn;                      //!< picture number
  int LevelIndex;              //!< mapped level idc
  int MaxVmvR[6];              //!< maximum vertical motion vector
  int current_mb_nr;
  int current_slice_nr;
  int type;
  int structure;               //!< picture structure
  int base_dist;
  int num_ref_frames;          //!< number of reference frames to be used
  int max_num_references;      //!< maximum number of reference pictures that may occur
  int qp;                      //!< quant for the current frame
  int qpsp;                    //!< quant for the prediction frame of SP-frame

  int RCMinQP;
  int RCMaxQP;

  float framerate;
  int width;                   //!< Number of pels
  int width_padded;            //!< Width in pels of padded picture
  int width_blk;               //!< Number of columns in blocks
  int width_cr;                //!< Number of pels chroma
  int height;                  //!< Number of lines
  int height_padded;           //!< Number in lines of padded picture
  int height_blk;              //!< Number of lines in blocks
  int height_cr;               //!< Number of lines  chroma
  int height_cr_frame;         //!< Number of lines  chroma frame
  int size;                    //!< Luma Picture size in pels
  int size_cr;                 //!< Chroma Picture size in pels
  int subblock_x;              //!< current subblock horizontal
  int subblock_y;              //!< current subblock vertical
  int is_intra_block;
  int is_v_block;
  int mb_y_upd;
  int mb_y_intra;              //!< which GOB to intra code
  int block_c_x;               //!< current block chroma vertical
  char **ipredmode;             //!< intra prediction mode
  char **ipredmode8x8;          //!< help storage for 8x8 modes, inserted by YV

  int cod_counter;             //!< Current count of number of skipped macroblocks in a row
  int ***nz_coeff;             //!< number of coefficients per block (CAVLC)

  int mb_x;                    //!< current MB horizontal
  int mb_y;                    //!< current MB vertical
  int block_x;                 //!< current block horizontal
  int block_y;                 //!< current block vertical
  int pix_x;                   //!< current pixel horizontal
  int pix_y;                   //!< current pixel vertical
  int pix_c_x;                 //!< current pixel chroma horizontal
  int pix_c_y;                 //!< current pixel chroma vertical

  int opix_x;                   //!< current original picture pixel horizontal
  int opix_y;                   //!< current original picture pixel vertical
  int opix_c_x;                 //!< current original picture pixel chroma horizontal
  int opix_c_y;                 //!< current original picture pixel chroma vertical


  // prediction/residual buffers   
  imgpel mpr_4x4  [MAX_PLANE][9][16][16]; //!< prediction samples for   4x4 intra prediction modes
  imgpel mpr_8x8  [MAX_PLANE][9][16][16]; //!< prediction samples for   8x8 intra prediction modes
  imgpel mpr_16x16[MAX_PLANE][5][16][16]; //!< prediction samples for 16x16 intra prediction modes (and chroma)
  imgpel mb_pred  [MAX_PLANE][16][16];    //!< current best prediction mode
  int    mb_rres  [MAX_PLANE][16][16];    //!< the diff pixel values between the original macroblock/block and its prediction (reconstructed)
  int    mb_ores  [MAX_PLANE][16][16];    //!< the diff pixel values between the original macroblock/block and its prediction (original)

  int    (*curr_res)[16];                 //!< pointer to current residual
  imgpel (*curr_prd)[16];                 //!< pointer to current prediction

  int ****cofAC;               //!< AC coefficients [8x8block][4x4block][level/run][scan_pos]
  int *** cofDC;               //!< DC coefficients [yuv][level/run][scan_pos]

  int ***fadjust4x4;           //!< Transform coefficients for 4x4 luma. Excludes DC for I16x16
  int ***fadjust8x8;           //!< Transform coefficients for 8x8 luma
  int ****fadjust4x4Cr;        //!< Transform coefficients for 4x4 chroma. Excludes DC chroma.
  int ****fadjust8x8Cr;        //!< Transform coefficients for 4x4 chroma within 8x8 inter blocks.

  Picture       *currentPicture; //!< The coded picture currently in the works (typically p_frame_pic, field_pic[0], or field_pic[1])
  Slice         *currentSlice;                                //!< pointer to current Slice data struct
  Macroblock    *mb_data;                                   //!< array containing all MBs of a whole frame
  Block8x8Info  *b8x8info;                                  //!< block 8x8 information for RDopt
  int *quad;               //!< Array containing square values,used for snr computation  */                                         /* Values are limited to 5000 for pixel differences over 70 (sqr(5000)).
  int *intra_block;

  int tr;
  int fld_type;                        //!< top or bottom field
  byte fld_flag;
  unsigned int rd_pass;

  // B pictures
  double b_interval;
  int p_interval;
  int b_frame_to_code;
  int fw_mb_mode;
  int bw_mb_mode;

  short****** pred_mv;                 //!< motion vector predictors for all block types and all reference frames
  short****** all_mv;                  //!< replaces local all_mv
  short******* bipred_mv;             //!<Biprediction MVs  
  
  int DFDisableIdc;
  int DFAlphaC0Offset;
  int DFBetaOffset;

  int direct_spatial_mv_pred_flag;              //!< Direct Mode type to be used (0: Temporal, 1: Spatial)

  int num_ref_idx_active_list[2];
  int num_ref_idx_l0_active;
  int num_ref_idx_l1_active;

  byte field_mode;     //!< For MB level field/frame -- field mode on flag
  byte top_field;      //!< For MB level field/frame -- top field flag
  int mvscale[6][MAX_REFERENCE_PICTURES];
  int buf_cycle;
  int i16offset;

  int layer;             //!< which layer this picture belonged to

  int NoResidueDirect;
  int AdaptiveRounding;                          //!< Adaptive Rounding parameter based on JVT-N011

  int redundant_pic_cnt; // JVT-D101

  int MbaffFrameFlag;    //!< indicates frame with mb aff coding

  //the following should probably go in sequence parameters
  unsigned int pic_order_cnt_type;

  // for poc mode 1
  Boolean      delta_pic_order_always_zero_flag;
  int          offset_for_non_ref_pic;
  int          offset_for_top_to_bottom_field;
  unsigned int num_ref_frames_in_pic_order_cnt_cycle;
  int          offset_for_ref_frame[1];

  //the following is for slice header syntax elements of poc
  // for poc mode 0.
  unsigned int pic_order_cnt_lsb;
  int          delta_pic_order_cnt_bottom;
  // for poc mode 1.
  int          delta_pic_order_cnt[2];

  int          frm_iter;   // frame variations to create (useful for multiple coding passes)

  unsigned int field_picture;
    signed int toppoc;      //!< poc for this frame or field
    signed int bottompoc;   //!< for completeness - poc of bottom field of a frame (always = poc+1)
    signed int framepoc;    //!< min (toppoc, bottompoc)
    signed int ThisPOC;     //!< current picture POC
  unsigned int frame_num;   //!< frame_num for this frame

  unsigned int PicWidthInMbs;
  unsigned int PicHeightInMapUnits;
  unsigned int FrameHeightInMbs;
  unsigned int PicSizeInMbs;
  unsigned int FrameSizeInMbs;

  //the following should probably go in picture parameters
  Boolean pic_order_present_flag; // ????????

  //the following are sent in the slice header
//  int delta_pic_order_cnt[2];
  int nal_reference_idc;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?