📄 global.h
字号:
struct macroblock *mb_available[3][3]; /*!< pointer to neighboring MBs in a 3x3 window of current MB, which is located at [1][1] \n
NULL pointer identifies neighboring MBs which are unavailable */
// some storage of macroblock syntax elements for global access
int mb_type;
int mb_imode;
int ref_frame;
int mvd[2][BLOCK_MULTIPLE][BLOCK_MULTIPLE][2]; //!< indices correspond to [forw,backw][block_y][block_x][x,y]
int intra_pred_modes[BLOCK_MULTIPLE*BLOCK_MULTIPLE];
int cbp ;
int cbp_blk ; //!< 1 bit set for every 4x4 block with coefs (not implemented for INTRA)
} Macroblock;
//! Bitstream
typedef struct
{
int byte_pos; //!< current position in bitstream;
int bits_to_go; //!< current bitcounter
byte byte_buf; //!< current buffer for last written byte
int stored_byte_pos; //!< storage for position in bitstream;
int stored_bits_to_go; //!< storage for bitcounter
int header_len;
byte header_byte_buffer;
byte stored_byte_buf; //!< storage for buffer of last written byte
byte byte_buf_skip; //!< current buffer for last written byte
int byte_pos_skip; //!< storage for position in bitstream;
int bits_to_go_skip; //!< storage for bitcounter
byte *streamBuffer; //!< actual buffer for written bytes
} Bitstream;
//! DataPartition
typedef struct datapartition
{
Bitstream *bitstream;
EncodingEnvironment ee_cabac;
int (*writeSyntaxElement)(SyntaxElement *, struct datapartition *);
/*!< virtual function;
actual method depends on chosen data partition and
entropy coding method */
} DataPartition;
//! Slice
typedef struct
{
int picture_id;
int slice_nr; //!< not necessary but o.k.
int qp;
int picture_type; //!< picture type
int start_mb_nr;
int dp_mode; //!< data partioning mode
int max_part_nr; //!< number of different partitions
DataPartition *partArr; //!< array of partitions
MotionInfoContexts *mot_ctx; //!< pointer to struct of context models for use in CABAC
TextureInfoContexts *tex_ctx; //!< pointer to struct of context models for use in CABAC
Boolean (*slice_too_big)(int bits_slice); //!< for use of callback functions
} Slice;
// GH: global picture format dependend buffers, mem allocation in image.c
byte **imgY; //!< Encoded luma images
byte ***imgUV; //!< Encoded croma images
byte **imgY_org; //!< Reference luma image
byte ***imgUV_org; //!< Reference croma image
byte **imgY_pf; //!< Post filter luma image
byte ***imgUV_pf; //!< Post filter croma image
byte ***mref; //!< 1/4 pix luma
byte ****mcef; //!< pix chroma
int **img4Y_tmp; //!< for quarter pel interpolation
byte **imgY_tmp; //!< for loop filter
byte ***imgUV_tmp;
int ***tmp_mv; //!< motion vector buffer
int **refFrArr; //!< Array for reference frames of each block
// B pictures
// motion vector : forward, backward, direct
int ***tmp_fwMV;
int ***tmp_bwMV;
int ***dfMV;
int ***dbMV;
int **fw_refFrArr;
int **bw_refFrArr;
byte **mref_P; //!< for B-frames: 1/4 pix luma for next P picture
byte ***mcef_P; //!< for B-frames: pix chroma for next P picture
byte **nextP_imgY;
byte ***nextP_imgUV;
pel_t **Refbuf11; //!< 1/1th pel (full pel) reference frame buffer
pel_t *Refbuf11_P; //!< 1/1th pel P picture buffer
// Buffers for rd optimization with packet losses, Dim. Kontopodis
int **resY; //!< Residue of Luminance
byte ***decY; //!< Decoded values at the simulated decoders
byte ****decref; //!< Reference frames of the simulated decoders
byte ***decY_best; //!< Decoded frames for the best mode for all decoders
byte **RefBlock;
byte **status_map;
int intras; //!< Counts the intra updates in each frame.
int Bframe_ctr, frame_no, nextP_tr;
int tot_time;
#define ET_SIZE 300 //!< size of error text buffer
char errortext[ET_SIZE]; //!< buffer for error message for exit with error()
//! SNRParameters
typedef struct
{
float snr_y; //!< current Y SNR
float snr_u; //!< current U SNR
float snr_v; //!< current V SNR
float snr_y1; //!< SNR Y(dB) first frame
float snr_u1; //!< SNR U(dB) first frame
float snr_v1; //!< SNR V(dB) first frame
float snr_ya; //!< Average SNR Y(dB) remaining frames
float snr_ua; //!< Average SNR U(dB) remaining frames
float snr_va; //!< Average SNR V(dB) remaining frames
} SNRParameters;
//! all input parameters
typedef struct
{
int no_frames; //!< number of frames to be encoded
int qp0; //!< QP of first frame
int qpN; //!< QP of remaining frames
int jumpd; //!< number of frames to skip in input sequence (e.g 2 takes frame 0,3,6,9...)
int mv_res; //!< motion vector resolution: 0: 1/4-pel, 1: 1/8-pel
int hadamard; /*!< 0: 'normal' SAD in 1/3 pixel search. 1: use 4x4 Haphazard transform and '
Sum of absolute transform difference' in 1/3 pixel search */
int search_range; /*!< search range - integer pel search and 16x16 blocks. The search window is
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;
//! ImageParameters
typedef 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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -