⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 global.h

📁 包含了从MPEG4的视频解码到H.264的视频编码部分的源代码
💻 H
📖 第 1 页 / 共 4 页
字号:
  char outfile[100];            //!< H.26L compressed output bitstream
  char ReconFile[100];          //!< Reconstructed Pictures
  char TraceFile[100];          //!< Trace Outputs
  int intra_period;             //!< Random Access period though intra

  // B pictures
  int successive_Bframe;        //!< number of B frames that will be used
  int qpB;                      //!< QP of B frames
  int direct_type;              //!< Direct Mode type to be used (1: Temporal, 0: Spatial)

  // SP Pictures
  int sp_periodicity;           //!< The periodicity of SP-pictures
  int qpsp;                     //!< SP Picture QP for prediction error
  int qpsp_pred;                //!< SP Picture QP for predicted block

  int WeightedPrediction;        //!< Weighted prediciton for P frames (0: not used, 1: explicit)
  int WeightedBiprediction;      //!< Weighted prediciton for B frames (0: not used, 1: explicit, 2: implicit)
  int StoredBPictures;           //!< Stored (Reference) B pictures replace P pictures (0: not used, 1: used)
  int explicit_B_prediction;     //!< explicite B prediction  // Jill get rid of eventually
  // Introduced by TOM
  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 SequenceHeaderType;
  int TRModulus;
  int PicIdModulus;

  int InterSearch16x16;
  int InterSearch16x8;
  int InterSearch8x16;
  int InterSearch8x8;
  int InterSearch8x4;
  int InterSearch4x8;
  int InterSearch4x4;

  char PictureTypeSequence[MAXPICTURETYPESEQUENCELEN];

#ifdef _FULL_SEARCH_RANGE_
  int full_search;
#endif
#ifdef _ADAPT_LAST_GROUP_
  int last_frame;
#endif
#ifdef _CHANGE_QP_
  int qpN2, qpB2, qp2start;
#endif
  int rdopt;
#ifdef _ADDITIONAL_REFERENCE_FRAME_
  int add_ref_frame;
#endif
#ifdef _LEAKYBUCKET_
  int NumberLeakyBuckets;
  char LeakyBucketRateFile[100];
  char LeakyBucketParamFile[100];
#endif

  int InterlaceCodingOption;

  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 RestrictRef;
  int NumFramesInELSubSeq;
  int NumFrameIn2ndIGOP;

  int RandomIntraMBRefresh;     //! Number of pseudo-random intra-MBs per picture
  int FmoType;                  //! Type pf FMO MBAmap description, see CD doc
  char FmoConfigFileName[100];  //! Filename for config info fot type 0, 2

  int LFSendParameters;
  int LFDisableIdc;
  int LFAlphaC0Offset;
  int LFBetaOffset;

  int SparePictureOption;
  int SPDetectionThreshold;
  int SPPercentageThreshold;

  // JVT-D095, JVT-D097
  int num_slice_groups_minus1; //! "FmoNumSliceGroups" in encoder.cfg, same as FmoNumSliceGroups, which should be erased later
  int mb_allocation_map_type; //! "FmoType" in encoder.cfg, same as FmoType, FmoType should be erased latter
  int top_left_mb; //! "FmoTopLeftMB"  in encoder.cfg
  int bottom_right_mb; //! "FmoBottomRightMB" in encoder.cfg
  int slice_group_change_direction; //! "FmoChangeDirection" in encoder.cfg
  int slice_group_change_rate_minus1; //! "FmoChangeRate" in encoder.cfg
  // End JVT-D095, JVT-D097

  int redundant_slice_flag; //! whether redundant slices exist,  JVT-D101
  int pic_order_cnt_type;   // POC200301

  int context_init_method;
  int model_number;

} InputParameters;

//! ImageParameters
typedef struct
{
  int number;                  //!< current image number to be encoded
  int pn;                      //!< picture number
  int lindex;                  //!< next long term index to be used
  int max_lindex;              //!< max long term index 
  int nb_references;
  int current_mb_nr;
  int total_number_mb;
  int current_slice_nr;
  int type;
  int pstruct;                 //!< picture structure
  int types;                   /*!< This is for SP-Pictures, since all the syntax elements for SP-Pictures
                                    are the same as P-pictures, we keep the img->type as P_IMG but indicate
                                    SP-Pictures by img->types */
  int no_multpred;             /*!< 1: prediction from the last frame only.
                                    2: prediction from the last or second last frame etc. */
  int qp;                      //!< quant for the current frame
  int qpsp;                    //!< quant for the prediction frame of SP-frame
  int framerate;
  int width;                   //!< Number of pels
  int width_cr;                //!< Number of pels chroma
  int height;                  //!< Number of lines
  int height_cr;               //!< Number of lines  chroma
  int mb_y;                    //!< current MB vertical
  int mb_x;                    //!< current MB horizontal
  int mb_x_save;               //!< horizontal position of the last written MB
  int mb_y_save;               //!< vertical position of the last written MB
  int block_y;                 //!< current block vertical
  int block_x;                 //!< current block horizontal
  int subblock_y;              //!< current subblock vertical
  int subblock_x;              //!< current subblock horizontal
  int is_intra_block;
  int is_v_block;
  int pix_y;                   //!< current pixel vertical
  int pix_x;                   //!< current pixel horizontal
  int mb_y_upd;
  int mb_y_intra;              //!< which GOB to intra code
  int pix_c_y;                 //!< current pixel chroma vertical
  int block_c_x;               //!< current block chroma vertical
  int pix_c_x;                 //!< current pixel chroma horizontal
  int **ipredmode;             //!< GH ipredmode[90][74];prediction mode for inter frames */ /* fix from ver 4.1
  int cod_counter;             //!< Current count of number of skipped macroblocks in a row
  int ****nz_coeff;            //!< number of coefficients per block (CAVLC)


  // some temporal buffers
  int mprr[9][16][16];         //!< all 9 prediction modes? // enlarged from 4 to 16 for ABT (is that neccessary?)

  int mprr_2[5][16][16];       //!< all 4 new intra prediction modes
  int mprr_c[2][4][8][8];      //!< new chroma 8x8 intra prediction modes
  int***** mv;                 //!< motion vectors for all block types and all reference frames
  _int16 mpr[16][16];             //!< current best prediction mode
  _int16 m7[16][16];              //!< the diff pixel values between orginal image and prediction

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

  Picture     *currentPicture; //!< The coded picture currently in the works (typically frame_pic, top_pic, or bottom_pic)
  Slice       *currentSlice;                                //!< pointer to current Slice data struct
  Macroblock    *mb_data;                                   //!< array containing all MBs of a whole frame
  SyntaxElement   MB_SyntaxElements[MAX_SYMBOLS_PER_MB];    //!< temporal storage for all chosen syntax elements of one MB

  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 refPicID;                        //!< temporal reference for reference frames (non-B frames)
  int refPicID_fld;
  int refPicID_frm; 
  int fld_type;                        //!< top or bottom field
  unsigned int fld_flag;                                
  int direct_intraP_ref[4][4];
  int pstruct_next_P;
  int imgtr_next_P_frm;
  int imgtr_last_P_frm;
  int imgtr_next_P_fld;
  int imgtr_last_P_fld;

  // B pictures
  int b_interval;
  int p_interval;
  int b_frame_to_code;
  int fw_mb_mode;
  int bw_mb_mode;
  int***** p_fwMV;       //!< for MVDFW
  int***** p_bwMV;       //!< for MVDBW

  int***** all_mv;       //!< replaces local all_mv
  int***** all_bmv;      //!< replaces local all_mv

  int***** abp_all_dmv;        //!< replaces local all_dmv for forward interpolative prediction
  int***** abp_all_dmv_top;
  int***** abp_all_dmv_bot;
  int num_ref_pic_active_fwd_minus1;
  int num_ref_pic_active_bwd_minus1;


  int field_mb_y;   // Macroblock number of a field MB
  int field_block_y;  // Vertical block number for the first block of a field MB
  int field_pix_y;    // Co-ordinates of current macroblock in terms of field pixels (luma)
  int field_pix_c_y;  // Co-ordinates of current macroblock in terms of field pixels (chroma)
  int *****mv_top;    //!< For MB level field/frame coding tools
  int *****mv_bot;    //!< For MB level field/frame coding tools
  int *****p_fwMV_top;    //!< For MB level field/frame coding tools
  int *****p_fwMV_bot;    //!< For MB level field/frame coding tools
  int *****p_bwMV_top;    //!< For MB level field/frame coding tools
  int *****p_bwMV_bot;    //!< For MB level field/frame coding tools
  int *****all_mv_top;    //!< For MB level field/frame coding tools
  int *****all_mv_bot;    //!< For MB level field/frame coding tools
  int *****all_bmv_top;   //!< For MB level field/frame coding tools
  int *****all_bmv_bot;   //!< For MB level field/frame coding tools
  int **ipredmode_top;    //!< For MB level field/frame coding tools
  int **ipredmode_bot;    //!< For MB level field/frame coding tools
//  int update_stats;     //!< For MB level field/frame -- update stats flag
  int field_mode;     //!< For MB level field/frame -- field mode on flag
  int top_field;      //!< For MB level field/frame -- top field flag

  int buf_cycle;
  int i16offset;

  int layer;             //!< which layer this picture belonged to
  int old_layer;         //!< old layer number
  int NoResidueDirect;

  int redundant_pic_cnt; // JVT-D101

  int **field_anchor;

  //the following should probably go in sequence parameters
  // unsigned int log2_max_frame_num_minus4;
  unsigned int pic_order_cnt_type;
  // for poc mode 0, POC200301
  // unsigned int log2_max_pic_order_cnt_lsb_minus4;  
  // for poc mode 1, POC200301
  unsigned int 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];  // MAX_LENGTH_POC_CYCLE in decoder

  // POC200301
  //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];




  // POC200301
  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)
  unsigned int frame_num;   //frame_num for this frame
  

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

  //the following are sent in the slice header
//  int delta_pic_order_cnt[2];
  int idr_flag;
  int disposable_flag;
  
  int adaptive_ref_pic_buffering_flag;
  int no_output_of_prior_pics_flag;
  int long_term_reference_flag;

  MMCObuffer_t *mmco_buffer;

  int model_number;

} ImageParameters;

                                //!< statistics
typedef struct
{
  int   quant0;                 //!< quant for the first frame
  int   quant1;                 //!< average quant for the remaining frames
  float bitr;                   //!< bit rate for current frame, used only for output til terminal
  float bitr0;                  //!< stored bit rate for the first frame
  float bitrate;                //!< average bit rate for the sequence except first frame
  int   bit_ctr;                //!< counter for bit usage
  int   bit_ctr_0;              //!< stored bit use for the first frame
  int   bit_ctr_n;              //!< bit usage for the current frame
  int   bit_slice;              //!< number of bits in current slice
  int   bit_use_mode_inter[2][MAXMODE]; //!< statistics of bit usage
  int   bit_ctr_emulationprevention; //!< stored bits needed to prevent start code emulation
  int   mode_use_intra[25];     //!< Macroblock mode usage for Intra frames
  int   mode_use_inter[2][MAXMODE];

  // B pictures
  int   *mode_use_Bframe;
  int   *bit_use_mode_Bframe;
  int   bit_ctr_P;
  int   bit_ctr_B;
  float bitrate_P;
  float bitrate_B;

#define NUM_PIC_TYPE 5
  int   bit_use_stuffingBits[NUM_PIC_TYPE];
  int   bit_use_mb_type[NUM_PIC_TYPE];
  int   bit_use_header[NUM_PIC_TYPE];
  int   tmp_bit_use_cbp[NUM_PIC_TYPE];
  int   bit_use_coeffY[NUM_PIC_TYPE];
  int   bit_use_coeffC[NUM_PIC_TYPE];
  int   bit_use_delta_quant[NUM_PIC_TYPE];

  int   em_prev_bits_frm;
  int   em_prev_bits_fld;
  int  *em_prev_bits;
  int   bit_ctr_parametersets;
} StatParameters;

//!< For MB level field/frame coding tools
//!< temporary structure to store MB data for field/frame coding
typedef struct
{
  double min_rdcost;
  int tmp_mv[2][4][4];        // to hold the motion vectors for each block
  int tmp_fwMV[2][4][4];      // to hold forward motion vectors for B MB's
  int tmp_bwMV[2][4][4];      // to hold backward motion vectors for B MBs
  int dfMV[2][4][4], dbMV[2][4][4]; // to hold direct motion vectors for B MB's

⌨️ 快捷键说明

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