📄 global.h
字号:
generally around the predicted vector. Max vector is 2xmcrange. For 8x8 and 4x4 block sizes the search range is 1/2 of that for 16x16 blocks. */ int no_multpred; /*!< 1: prediction from the last frame only. 2: prediction from the last or second last frame etc. Maximum 5 frames */ int img_width; //!< GH: if CUSTOM image format is chosen, use this size int img_height; //!< GH: width and height must be a multiple of 16 pels int yuv_format; //!< GH: YUV format (0=4:0:0, 1=4:2:0, 2=4:2:2, 3=4:4:4,currently only 4:2:0 is supported) int color_depth; //!< GH: YUV color depth per component in bit/pel (currently only 8 bit/pel is supported) int intra_upd; /*!< For error robustness. 0: no special action. 1: One GOB/frame is intra coded as regular 'update'. 2: One GOB every 2 frames is intra coded etc. In connection with this intra update, restrictions is put on motion vectors to prevent errors to propagate from the past */ int blc_size[8][2]; //!< array for different block sizes int slice_mode; //!< Indicate what algorithm to use for setting slices int slice_argument; //!< Argument to the specified slice algorithm int UseConstrainedIntraPred; //!< 0: Inter MB pixels are allowed for intra prediction 1: Not allowed int infile_header; //!< If input file has a header set this to the length of the header char infile[100]; //!< YUV 4:2:0 input format 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 // 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 // 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 LossRate; int NoOfDecoders;} InputParameters;//! ImageParameterstypedef struct{ int number; //!< current image number to be encoded int nb_references; int current_mb_nr; int total_number_mb; int current_slice_nr; int type; 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 multframe_no; int qp; //!< quant for the current frame int qpsp; //!< quant for the prediction frame of SP-frame int frame_cycle; 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 height_err; //!< For y vector limitation for error robustness 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 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 mb_mode; //!< MB mode relevant for inter images, for intra images are all MB intra int imod; //!< new/old intra modes + inter 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 blc_size_h; //!< block size for motion search, horizontal int blc_size_v; //!< block size for motion search, vertical int kac; //!< any AC coeffs 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 // some temporal buffers int mprr[6][4][4]; //!< all 5 prediction modes int mprr_2[5][16][16]; //!< all 4 new intra prediction modes int***** mv; //!< motion vectors for all block types and all reference frames int mpr[16][16]; //!< current best prediction mode int m7[16][16]; //!< the diff pixel values between orginal image and prediction int cof[4][6][18][2][2]; //!< coefficients int cofu[5][2][2]; //!< coefficients chroma byte tmp_loop_Y[BLOCK_MULTIPLE+2][BLOCK_MULTIPLE+2]; //!< temporal storage for LUMA loop-filter strength byte tmp_loop_UV[BLOCK_MULTIPLE/2+2][BLOCK_MULTIPLE/2+2]; //!< temporal storage for CHROMA loop-filter strength 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[256]; //!< Array containing square values,used for snr computation */ /* Values are limited to 5000 for pixel differences over 70 (sqr(5000)). int mv_bituse[512]; int *slice_numbers; int *intra_mb; // UMV support int mhor; int mvert; int tr; int refPicID; //<! temporal reference for reference frames (non-B frames), added by WYK // B pictures int b_interval; int p_interval; int b_frame_to_code; int fw_mb_mode; int fw_multframe_no; int fw_blc_size_h; int fw_blc_size_v; int bw_mb_mode; int bw_multframe_no; int bw_blc_size_h; int bw_blc_size_v; int***** p_fwMV; //!< for MVDFW int***** p_bwMV; //!< for MVDBW int blk_bituse[10]; //!< it is included when getting bid_sad int***** all_mv; //!< replaces local all_mv int***** all_bmv; //!< replaces local all_mv int buf_cycle;} 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[33]; //!< statistics of bit usage int mode_use_intra[25]; //!< Macroblock mode usage for Intra frames int mode_use_inter[33]; // 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; int bit_use_mb_type[3]; int bit_use_header[3]; int tmp_bit_use_cbp[3]; int bit_use_coeffY[3]; int bit_use_coeffC[3]; int bit_use_delta_quant[3];} StatParameters;extern InputParameters *input;extern ImageParameters *img;extern StatParameters *h26lstat;extern SNRParameters *snr;#ifdef H26L_LIBextern byte* memout;extern int memoutlength;#endif// filesFILE *p_dec,*p_dec_u,*p_dec_v; //!< internal decoded image for debuggingFILE *p_stat; //!< status file for the last encoding sessionFILE *p_log; //!< SNR fileFILE *p_in; //!< YUVFILE *p_datpart; //!< file to write bitlength and id of all partitionsFILE *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);void init();void find_snr();void oneforthpix();void oneforthpix_2();int encode_oneIorP_Frame();int encode_oneB_Frame();int find_sad(int hadamard, int m7[16][16]);int dct_luma(int pos_mb1,int pos_mb2,int *cnt_nonz);int dct_luma_sp(int pos_mb1,int pos_mb2,int *cnt_nonz);int 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);void levrun_linfo_c2x2(int level,int run,int *len,int *info);void levrun_linfo_intra(int level,int run,int *len,int *info);void levrun_linfo_inter(int level,int run,int *len,int *info);int sign(int a,int b);void intrapred_chroma(int,int,int uv);#ifndef NO_RDQUANTvoid rd_quant(int no_coeff,int *coeff);#endifvoid intrapred_luma_2();int find_sad2(int *intra_mode);void dct_luma2(int);void init_img();void init_stat();void report();void information_init();void init_frame();void select_picture_type(SyntaxElement *symbol);void read_one_new_frame();void write_reconstructed_image();void DeblockMb(ImageParameters *img, byte **, byte ***) ;// dynamic mem allocationint get_mem4global_buffers();void free_mem4global_buffers();int get_mem2D (byte ***array2D, int rows, int columns);int get_mem2Dint (int ***array2D, int rows, int columns);int get_mem3D (byte ****array2D, int frames, int rows, int columns);int get_mem3Dint (int ****array3D, int frames, int rows, int columns);void no_mem_exit (char *where);int get_mem_mv (int******);void free_mem_mv (int*****);void free_img ();// Added for (re-) structuring the TML softint encode_one_frame();void encode_one_slice(SyntaxElement *sym);void malloc_slice();void free_slice();void init_slice();void encode_one_macroblock();void start_macroblock();void terminate_macroblock(Boolean *end_of_slice, Boolean *recode_macroblock);int slice_too_big(int rlc_bits);void write_one_macroblock();void proceed2nextMacroblock();void LumaResidualCoding_P();void ChromaCoding_P(int *cr_cbp);void SetRefFrameInfo_P();int MakeIntraPrediction(int *intra_pred_mode_2);void CheckAvailabilityOfNeighbors();int writeMotionInfo2NAL_Pframe();void writeCBPandCoeffs2NAL();int writeSyntaxElement_UVLC(SyntaxElement *se, DataPartition *this_dataPart);void writeUVLC2buffer(SyntaxElement *se, Bitstream *currStream);int symbol2uvlc(SyntaxElement *se);void n_linfo(int n, int *len,int *info);void n_linfo2(int n, int dummy, int *len,int *info);void intrapred_linfo(int ipred1, int ipred2, int *len,int *info);void mvd_linfo2(int mvd, int dummy, int *len,int *info);void dquant_linfo(int mvd, int dummy, int *len,int *info);void cbp_linfo_intra(int cbp, int dummy, int *len,int *info);void cbp_linfo_inter(int cbp, int dummy, int *len,int *info);#if TRACEvoid trace2out(SyntaxElement *se);#endifBoolean dummy_slice_too_big(int bits_slice);// CABACvoid arienco_start_encoding(EncodingEnvironmentPtr eep, unsigned char *code_buffer, int *code_len );int arienco_bits_written(EncodingEnvironmentPtr eep);void arienco_done_encoding(EncodingEnvironmentPtr eep);void biari_init_context( BiContextTypePtr ctx, int ini_count_0, int ini_count_1, int max_cum_freq );void biari_copy_context( BiContextTypePtr ctx_orig, BiContextTypePtr ctx_dest );void biari_print_context( BiContextTypePtr ctx );void rescale_cum_freq(BiContextTypePtr bi_ct);void biari_encode_symbol(EncodingEnvironmentPtr eep, signed short symbol, BiContextTypePtr bi_ct );MotionInfoContexts* create_contexts_MotionInfo(void);TextureInfoContexts* create_contexts_TextureInfo(void);void init_contexts_MotionInfo(MotionInfoContexts *enco_ctx, int ini_flag);void init_contexts_TextureInfo(TextureInfoContexts *enco_ctx, int ini_flag);void delete_contexts_MotionInfo(MotionInfoContexts *enco_ctx);void delete_contexts_TextureInfo(TextureInfoContexts *enco_ctx);void writeHeaderToBuffer();void writeEOSToBuffer();int writeSyntaxElement_CABAC(SyntaxElement *se, DataPartition *this_dataPart);void writeMB_typeInfo2Buffer_CABAC(SyntaxElement *se, EncodingEnvironmentPtr eep_dp);void writeIntraPredMode2Buffer_CABAC(SyntaxElement *se, EncodingEnvironmentPtr eep_dp);void writeRefFrame2Buffer_CABAC(SyntaxElement *se, EncodingEnvironmentPtr eep_dp);void writeMVD2Buffer_CABAC(SyntaxElement *se, EncodingEnvironmentPtr eep_dp);void writeCBP2Buffer_CABAC(SyntaxElement *se, EncodingEnvironmentPtr eep_dp);void writeDquant_CABAC(SyntaxElement *se, EncodingEnvironmentPtr eep_dp);void writeRunLevel2Buffer_CABAC(SyntaxElement *se, EncodingEnvironmentPtr eep_dp);void writeBiDirBlkSize2Buffer_CABAC(SyntaxElement *se, EncodingEnvironmentPtr eep_dp);void writeBiMVD2Buffer_CABAC(SyntaxElement *se, EncodingEnvironmentPtr eep_dp);void error(char *text, int code);int start_sequence();int terminate_sequence();int start_slice(SyntaxElement *sym);int terminate_slice();void DP_SliceHeader(FILE *out, int bytes_written, int part_nr);void DP_PartHeader(FILE *out, int bytes_written, int part_nr);// B picturesvoid copy2mref();int 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);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);// Introduced for 1/8-pelvoid interpolate_frame();void interpolate_frame_2();void oneeighthpix(int prior_B_frame);void InitRefbuf ();void InitMotionVectorSearchModule();#endifint 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 writeMB_bits_for_Dquant ();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 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 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);//============= fast full integer search =======================#ifdef _FAST_FULL_ME_void InitializeFastFullIntegerSearch (int);void ClearFastFullIntegerSearch ();void ResetFastFullIntegerSearch ();#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -