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

📄 global.h

📁 H.264编码解码器源码(c语言).zip
💻 H
📖 第 1 页 / 共 3 页
字号:
  int layer;             //!< which layer this picture belonged to  int old_layer;         //!< old layer number  int NoResidueDirect;  int redundant_pic_cnt; // JVT-D101  int MbaffFrameFlag;    //!< indicates frame with mb aff coding  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)    signed int framepoc;    //!< min (toppoc, bottompoc)    signed int ThisPOC;     //!< current picture POC  unsigned int frame_num;   //!< frame_num for this frame    unsigned PicWidthInMbs;  unsigned PicHeightInMapUnits;  unsigned FrameHeightInMbs;  unsigned PicHeightInMbs;  unsigned PicSizeInMbs;  unsigned FrameSizeInMbs;  //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 nal_reference_idc;  int adaptive_ref_pic_buffering_flag;  int no_output_of_prior_pics_flag;  int long_term_reference_flag;  DecRefPicMarking_t *dec_ref_pic_marking_buffer;  int model_number;} ImageParameters;                                //!< statisticstypedef 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 codingtypedef 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  int    rec_mbY[16][16];       // hold the Y component of reconstructed MB  int    rec_mbU[8][8], rec_mbV[8][8];   int    ****cofAC;  int    ***cofDC;  int    mb_type;  int    b8mode[4], b8pdir[4];  int    frefar[4][4], brefar[4][4];  int    **ipredmode;  int    intra_pred_modes[16];  int    cbp, cbp_blk;  int    mode;  int    *****mv, *****p_fwMV, *****p_bwMV ;  int    *****all_mv;  int    *****all_bmv;  int    i16offset;  int    c_ipred_mode;} RD_DATA;RD_DATA *rdopt; RD_DATA rddata_top_frame_mb, rddata_bot_frame_mb; //!< For MB level field/frame coding toolsRD_DATA rddata_top_field_mb, rddata_bot_field_mb; //!< For MB level field/frame coding toolsextern InputParameters *input;extern ImageParameters *img;extern StatParameters *stat;extern SNRParameters *snr;// filesFILE *p_dec;                     //!< internal decoded image for debuggingFILE *p_stat;                    //!< status file for the last encoding sessionFILE *p_log;                     //!< SNR fileFILE *p_in;                      //!< YUVFILE *p_trace;                   //!< Trace file/*********************************************************************** * P r o t o t y p e s   f o r    T M L *********************************************************************** */void intrapred_luma(int CurrPixX,int CurrPixY, int *left_available, int *up_available, int *all_available);void init();int  find_sad(int hadamard, int m7[16][16]);int  dct_luma(int pos_mb1,int pos_mb2,int *cnt_nonz,int);int  dct_luma_sp(int pos_mb1,int pos_mb2,int *cnt_nonz);void  copyblock_sp(int pos_mb1,int pos_mb2);int  dct_chroma(int uv,int i11);int  dct_chroma_sp(int uv,int i11);int  motion_search(int isi);int  sign(int a,int b);void intrapred_chroma(int,int,int uv);void intrapred_luma_16x16();int  find_sad_16x16(int *intra_mode);int dct_luma_16x16(int);void init_poc();void push_poc(unsigned int topvalue, unsigned int bottomvalue, unsigned int ref_frame_ind );void init_img();void report();void information_init();int  get_picture_type();void DeblockFrame(ImageParameters *img, byte **, byte ***) ;void  LumaPrediction4x4 (int, int, int, int, int, int);int   SATD (int*, int);pel_t* FastLineX (int, pel_t*, int, int);pel_t* UMVLineX  (int, pel_t*, int, int);void LumaResidualCoding ();void ChromaResidualCoding (int*);void IntraChromaPrediction8x8 (int*, int*, int*);void SetRefFrameInfo (int, int);int  writeMBHeader   (int rdopt); extern int*   refbits;extern int**** motion_cost;void  Get_Direct_Motion_Vectors ();void  PartitionMotionSearch     (int, int, double);int   BIDPartitionCost          (int, int, int, int);int   LumaResidualCoding8x8     (int*, int*, int, int, int, int, int);int   writeLumaCoeff8x8         (int, int);int   writeMotionVector8x8      (int, int, int, int, int, int, int, int);int   writeReferenceFrame       (int, int, int, int, int);int   ABIDPartitionCost         (int, int, int*, int*, int, int*);int   BBIDPartitionCost         (int, int, int* , int* , int, int* , int);int   writeAbpCoeffIndex        (int, int, int, int);int   writeIntra4x4Modes        (int);int   writeChromaIntraPredMode  ();int Get_Direct_Cost8x8 (int, double);int Get_Direct_CostMB  (double);int B8Mode2Value (int b8mode, int b8pdir);void writeCBP_BIT_CABAC (int b8, int bit, int cbp, Macroblock* currMB, int inter, EncodingEnvironmentPtr eep_dp);int GetSkipCostMB (double lambda);void FindSkipModeMotionVector ();// dynamic mem allocationint  init_global_buffers();void free_global_buffers();void no_mem_exit  (char *where);int  get_mem_mv  (int******);void free_mem_mv (int*****);void free_img    ();int  get_mem_ACcoeff  (int*****);int  get_mem_DCcoeff  (int****);void free_mem_ACcoeff (int****);void free_mem_DCcoeff (int***);int  decide_fld_frame(float snr_frame_Y, float snr_field_Y, int bit_field, int bit_frame, double lambda_picture);int  get_mem4global_buffers_field();void free_mem4global_buffers_field();// void read_one_new_field();void combine_field();// Added for (re-) structuring the TML softPicture *malloc_picture();void free_picture (Picture *pic);int   encode_one_slice(int SLiceGroupId, Picture *pic);   //! returns the number of MBs in the slicevoid  encode_one_macroblock();void  start_macroblock();void  set_MB_parameters (int mb);           //! sets up img-> according to input-> and currSlice->int   writeMotionInfo2NAL ();void  terminate_macroblock(Boolean *end_of_slice, Boolean *recode_macroblock);int   slice_too_big(int rlc_bits);void  write_one_macroblock(int eos_bit);void  proceed2nextMacroblock();void  proceed2nextSuperMacroblock();    //!< For MB level field/frame coding toolsvoid  back2topmb();             //!< For MB level field/frame coding toolsvoid proceed2lowermb();           //!< For MB level field/frame coding toolsvoid  LumaResidualCoding_P();void  ChromaCoding_P(int *cr_cbp);void  SetRefFrameInfo_P();int   MakeIntraPrediction(int *intra_pred_mode_2);void  CheckAvailabilityOfNeighbors();void free_slice_list(Picture *currPic);#if TRACEvoid  trace2out(SyntaxElement *se);#endif// CABACvoid arienco_start_encoding(EncodingEnvironmentPtr eep, unsigned char *code_buffer, int *code_len, /* int *last_startcode, */int slice_type);int  arienco_bits_written(EncodingEnvironmentPtr eep);void arienco_done_encoding(EncodingEnvironmentPtr eep);void biari_init_context (BiContextTypePtr ctx, const int* ini);void rescale_cum_freq(BiContextTypePtr bi_ct);void biari_encode_symbol(EncodingEnvironmentPtr eep, signed short symbol, BiContextTypePtr bi_ct );void biari_encode_symbol_eq_prob(EncodingEnvironmentPtr eep, signed short symbol);void biari_encode_symbol_final(EncodingEnvironmentPtr eep, signed short symbol);MotionInfoContexts* create_contexts_MotionInfo(void);TextureInfoContexts* create_contexts_TextureInfo(void);void init_contexts_MotionInfo (MotionInfoContexts  *enco_ctx);void init_contexts_TextureInfo(TextureInfoContexts *enco_ctx);void delete_contexts_MotionInfo(MotionInfoContexts *enco_ctx);void delete_contexts_TextureInfo(TextureInfoContexts *enco_ctx);void writeHeaderToBuffer();int  writeSyntaxElement_CABAC(SyntaxElement *se, DataPartition *this_dataPart);void writeMB_typeInfo_CABAC(SyntaxElement *se, EncodingEnvironmentPtr eep_dp);void writeIntraPredMode_CABAC(SyntaxElement *se, EncodingEnvironmentPtr eep_dp);void writeB8_typeInfo_CABAC(SyntaxElement *se, EncodingEnvironmentPtr eep_dp);void writeRefFrame2Buffer_CABAC(SyntaxElement *se, EncodingEnvironmentPtr eep_dp);void writeRefFrame_CABAC(SyntaxElement *se, EncodingEnvironmentPtr eep_dp);void writeMVD_CABAC(SyntaxElement *se, EncodingEnvironmentPtr eep_dp);void writeCBP_CABAC(SyntaxElement *se, EncodingEnvironmentPtr eep_dp);void writeDquant_CABAC(SyntaxElement *se, EncodingEnvironmentPtr eep_dp);void writeRunLevel_CABAC(SyntaxElement *se, EncodingEnvironmentPtr eep_dp);void writeBiDirBlkSize_CABAC(SyntaxElement *se, EncodingEnvironmentPtr eep_dp);void writeCIPredMode_CABAC(SyntaxElement *se, EncodingEnvironmentPtr eep_dp);void print_ctx_TextureInfo(TextureInfoContexts *enco_ctx);void writeMB_skip_flagInfo_CABAC(SyntaxElement *se, EncodingEnvironmentPtr eep_dp);void writeFieldModeInfo_CABAC(SyntaxElement *se, EncodingEnvironmentPtr eep_dp); //GBvoid error(char *text, int code);int  start_sequence();int  terminate_sequence();int  start_slice();int  terminate_slice();// B picturesint  motion_search_Bframe(int tot_intra_sad);int  get_fwMV(int *min_fw_sad, int tot_intra_sad);void get_bwMV(int *min_bw_sad);void get_bid(int *bid_sad, int fw_predframe_no);void get_dir(int *dir_sad);void compare_sad(int tot_intra_sad, int fw_sad, int bw_sad, int bid_sad, int dir_sad, int);void LumaResidualCoding_B();void ChromaCoding_B(int *cr_cbp);void SetRefFrameInfo_B();int  writeMotionInfo2NAL_Bframe();int  BlkSize2CodeNumber(int blc_size_h, int blc_size_v);void InitRefbuf ();void InitMotionVectorSearchModule();void InitRefbuf_fld ();void copy2mref_fld();void  SetRefFrameInfo (int, int);void set_ref_field(int *k);void set_mbaff_parameters();  // For MB AFFvoid writeVlcByteAlign(Bitstream* currStream);int   writeLumaCoeff4x4_CABAC     (int, int, int);int   writeCBPandLumaCoeff  ();int   writeChromaCoeff      ();int   writeMB_bits_for_4x4_luma   (int, int, int);int   writeMB_bits_for_16x16_luma ();int   writeMB_bits_for_luma       (int);int   writeMB_bits_for_DC_chroma  (int);int   writeMB_bits_for_AC_chroma  (int);int   writeMB_bits_for_CBP        ();int   SingleUnifiedMotionSearch   (int, int, int**, int***, int*****, int, int*****, double);//============= rate-distortion optimization ===================void  clear_rdopt      ();void  init_rdopt       ();void  RD_Mode_Decision ();//============= rate-distortion opt with packet losses ===========void decode_one_macroblock();void decode_one_mb (int, Macroblock*);void decode_one_b8block (int, int, int, int, int);void Get_Reference_Block(byte **imY, int block_y, int block_x, int mvhor, int mvver, byte **out);byte Get_Reference_Pixel(byte **imY, int y, int x);int Half_Upsample(byte **imY, int j, int i);void DecOneForthPix(byte **dY, byte ***dref);void compute_residue(int mode);void compute_residue_b8block (int, int);void compute_residue_mb (int);void UpdateDecoders();void Build_Status_Map(byte **s_map);void Error_Concealment(byte **inY, byte **s_map, byte ***refY);void Conceal_Error(byte **inY, int mb_y, int mb_x, byte ***refY, byte **s_map);//============= restriction of reference frames based on the latest intra-refreshes==========int CheckReliabilityOfRefFrame(int ref_frame, int);void UpdatePixelMap();//============= fast full integer search =======================#ifdef _FAST_FULL_ME_void  ClearFastFullIntegerSearch    ();void  ResetFastFullIntegerSearch    ();#endifvoid process_2nd_IGOP();void SetImgType();// Tian Dong: for IGOPsextern Boolean In2ndIGOP;extern int start_frame_no_in_this_IGOP;extern int start_tr_in_this_IGOP;extern int FirstFrameIn2ndIGOP;#define IMG_NUMBER (img->number-start_frame_no_in_this_IGOP)#define PAYLOAD_TYPE_IDERP 8void AllocNalPayloadBuffer();void FreeNalPayloadBuffer();void SODBtoRBSP(Bitstream *currStream);int RBSPtoEBSP(byte *streamBuffer, int begin_bytepos, int end_bytepos, int min_num_bytes);int Bytes_After_Header;// JVT-D101: the bit for redundant_pic_cnt in slice header may be changed, // therefore the bit position in the bitstream must be stored.int rpc_bytes_to_go;int rpc_bits_to_go;void modify_redundant_pic_cnt(unsigned char *streamBuffer);// End JVT-D101int poc_distance( int refa, int refb);#endif#include "context_ini.h"

⌨️ 快捷键说明

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