📄 global.h
字号:
int list_offset;
int mbAddrA, mbAddrB, mbAddrC, mbAddrD;
int mbAvailA, mbAvailB, mbAvailC, mbAvailD;
int all_blk_8x8;
int luma_transform_size_8x8_flag;
int NoMbPartLessThan8x8Flag;
short bi_pred_me;
// rate control
double actj; // macroblock activity measure for macroblock j
int prev_qp;
int prev_delta_qp;
int prev_cbp;
int predict_qp;
int predict_error;
int LFDisableIdc;
int LFAlphaC0Offset;
int LFBetaOffset;
int skip_flag;
} 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
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
int write_flag; //!< Bitstream contains data and needs to be written
} 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 qp;
int picture_type; //!< picture type
int start_mb_nr;
int max_part_nr; //!< number of different partitions
int num_mb; //!< number of MBs in the slice
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
// !KS: RMPNI buffer should be retired. just do some sore simple stuff
RMPNIbuffer_t *rmpni_buffer; //!< stores the slice temporary buffer remapping commands
int ref_pic_list_reordering_flag_l0;
int *reordering_of_pic_nums_idc_l0;
int *abs_diff_pic_num_minus1_l0;
int *long_term_pic_idx_l0;
int ref_pic_list_reordering_flag_l1;
int *reordering_of_pic_nums_idc_l1;
int *abs_diff_pic_num_minus1_l1;
int *long_term_pic_idx_l1;
Boolean (*slice_too_big)(int bits_slice); //!< for use of callback functions
int field_ctx[3][2]; //GB
} Slice;
#define MAXSLICEPERPICTURE 100
typedef struct
{
int no_slices;
int idr_flag;
Slice *slices[MAXSLICEPERPICTURE];
int bits_per_picture;
float distortion_y;
float distortion_u;
float distortion_v;
} Picture;
Picture *top_pic;
Picture *bottom_pic;
Picture *frame_pic;
Picture *frame_pic_1;
Picture *frame_pic_2;
Picture *frame_pic_3;
// global picture format dependend buffers, mem allocation in image.c
imgpel **imgY_org; //!< Reference luma image
imgpel ***imgUV_org; //!< Reference chroma image
int **img4Y_tmp; //!< for quarter pel interpolation
unsigned int *yPicPos;
unsigned int *xPicPos;
unsigned int log2_max_frame_num_minus4;
unsigned int log2_max_pic_order_cnt_lsb_minus4;
int me_tot_time,me_time;
pic_parameter_set_rbsp_t *active_pps;
seq_parameter_set_rbsp_t *active_sps;
// B pictures
// motion vector : forward, backward, direct
int mb_adaptive; //!< For MB level field/frame coding tools
int MBPairIsField; //!< For MB level field/frame coding tools
//Weighted prediction
int ***wp_weight; // weight in [list][index][component] order
int ***wp_offset; // offset in [list][index][component] order
int ****wbp_weight; // weight in [list][fwd_index][bwd_idx][component] order
int luma_log_weight_denom;
int chroma_log_weight_denom;
int wp_luma_round;
int wp_chroma_round;
// global picture format dependend buffers, mem allocation in image.c (field picture)
imgpel **imgY_org_top;
imgpel **imgY_org_bot;
imgpel ***imgUV_org_top;
imgpel ***imgUV_org_bot;
imgpel **imgY_org_frm;
imgpel ***imgUV_org_frm;
imgpel **imgY_com; //!< Encoded luma images
imgpel ***imgUV_com; //!< Encoded croma images
char ***direct_ref_idx; //!< direct mode reference index buffer
short **direct_pdir; //!< direct mode reference index buffer
// Buffers for rd optimization with packet losses, Dim. Kontopodis
byte **pixel_map; //!< Shows the latest reference frame that is reliable for each pixel
byte **refresh_map; //!< Stores the new values for pixel_map
int intras; //!< Counts the intra updates in each frame.
int frame_ctr[5];
int frame_no, nextP_tr_fld, nextP_tr_frm;
int tot_time;
#define ET_SIZE 300 //!< size of error text buffer
char errortext[ET_SIZE]; //!< buffer for error message for exit with error()
// Residue Color Transform
int resTrans_R[16][16], resTrans_G[16][16], resTrans_B[16][16];
int rec_resR[16][16], rec_resG[16][16], rec_resB[16][16];
int mprRGB[3][16][16];
int dc_level[2][4][4], dc_level_temp[2][4][4];
int cbp_chroma_block[2][4][4], cbp_chroma_block_temp[2][4][4];
char b8_ipredmode8x8[4][4], b8_intra_pred_modes8x8[16];
//! Info for the "decoders-in-the-encoder" used for rdoptimization with packet losses
typedef struct
{
int **resY; //!< Residue of Luminance
imgpel ***decY; //!< Decoded values at the simulated decoders
imgpel ****decref; //!< Reference frames of the simulated decoders
imgpel ***decY_best; //!< Decoded frames for the best mode for all decoders
imgpel **RefBlock;
byte **status_map;
byte **dec_mb_mode;
} Decoders;
extern Decoders *decs;
//! 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_yt[5]; //!< SNR Y(dB) based on frame type
float snr_ut[5]; //!< SNR U(dB) based on frame type
float snr_vt[5]; //!< SNR V(dB) based on frame type
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
float sse_y; //!< SSE Y
float sse_u; //!< SSE U
float sse_v; //!< SSE V
float msse_y; //!< Average SSE Y
float msse_u; //!< Average SSE U
float msse_v; //!< Average SSE V
int frame_ctr; //!< number of coded frames
} SNRParameters;
#define FILE_NAME_SIZE 200
//! all input parameters
typedef struct
{
int ProfileIDC; //!< profile idc
int LevelIDC; //!< level idc
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 hadamard; /*!< 0: 'normal' SAD in sub pixel search. 1: use 4x4 Hadamard transform and '
Sum of absolute transform difference' in sub pixel search */
int DisableSubpelME; //!< Disable Subpixel Motion Estimation
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 num_ref_frames; //!< number of reference frames to be used
int P_List0_refs;
int B_List0_refs;
int B_List1_refs;
int Log2MaxFNumMinus4;
int Log2MaxPOCLsbMinus4;
int ResendPPS;
int GenerateMultiplePPS;
int img_width; //!< image width (must be a multiple of 16 pels)
int img_height; //!< image height (must be a multiple of 16 pels)
int yuv_format; //!< YUV format (0=4:0:0, 1=4:2:0, 2=4:2:2, 3=4:4:4)
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 part_size[8][2]; //!< array for different partition 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[FILE_NAME_SIZE]; //!< YUV 4:2:0 input format
char outfile[FILE_NAME_SIZE]; //!< H.264 compressed output bitstream
char ReconFile[FILE_NAME_SIZE]; //!< Reconstructed Pictures
char TraceFile[FILE_NAME_SIZE]; //!< Trace Outputs
char QmatrixFile[FILE_NAME_SIZE]; //!< Q matrix cfg file
int intra_period; //!< Random Access period though intra
int EnableOpenGOP; //!< support for open gops.
int idr_enable; //!< Encode intra slices as IDR
int start_frame; //!< Encode sequence starting from Frame start_frame
// B pictures
int successive_Bframe; //!< number of B frames that will be used
int qpB; //!< QP for non-reference B slice coded pictures
int qpBRSOffset; //!< QP for reference B slice coded pictures
int direct_spatial_mv_pred_flag; //!< Direct Mode type to be used (0: Temporal, 1: Spatial)
int directInferenceFlag; //!< Direct Inference Flag
int BiPredMotionEstimation;
int BiPredMERefinements;
int BiPredMESearchRange;
int BiPredMESubPel;
// 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 si_frame_indicator; //!< Flag indicating whether SI frames should be encoded rather than SP frames (0: not used, 1: used)
int sp2_frame_indicator; //!< Flag indicating whether switching SP frames should be encoded rather than SP frames (0: not used, 1: used)
int sp_output_indicator; //!< Flag indicating whether coefficients are output to allow future encoding of switchin SP frames (0: not used, 1: used)
char sp_output_filename[FILE_NAME_SIZE]; //!<Filename where SP coefficients are output
char sp2_input_filename1[FILE_NAME_SIZE]; //!<Filename of coefficients of the first bitstream when encoding SP frames to switch bitstreams
char sp2_input_filename2[FILE_NAME_SIZE]; //!<Filenames of coefficients of the second bitstream when encoding SP frames to switch bitstreams
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 UseWeightedReferenceME; //!< Use Weighted Reference for ME.
int RDPictureDecision; //!< Perform RD optimal decision between various coded versions of same picture
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 PyramidCoding;
int PyramidLevelQPEnable;
char ExplicitPyramidFormat[1024]; //!< Explicit GOP format (PyramidCoding==3).
int PyramidRefReorder; //!< Reordering based on Poc distances for PyramidCoding
int PocMemoryManagement; //!< Memory management based on Poc distances for PyramidCoding
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 InterSearch16x16;
int InterSearch16x8;
int InterSearch8x16;
int InterSearch8x8;
int InterSearch8x4;
int InterSearch4x8;
int InterSearch4x4;
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 EPZSMinThresScale;
int EPZSMaxThresScale;
int EPZSMedThresScale;
int EPZSSubPelME;
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 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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -