📄 global.h
字号:
int DFDisableIdc;
int DFAlphaC0Offset;
int DFBetaOffset;
int skip_flag;
char intra_pred_modes[MB_BLOCK_PARTITIONS];
char intra_pred_modes8x8[MB_BLOCK_PARTITIONS]; //!< four 8x8 blocks in a macroblock
int64 cbp_blk ; //!< 1 bit set for every 4x4 block with coefs (not implemented for INTRA)
int64 cbp_bits[3];
int64 cbp_bits_8x8[3];
short bipred_me[4]; //!< bi prediction ME type for a 8x8 block (0 : not used, 1: type 1, 2: type 2)
// rate control
double actj; // macroblock activity measure for macroblock j
int prev_qp;
int prev_dqp;
int prev_cbp;
struct macroblock *mb_available_up; //!< pointer to neighboring MB (CABAC)
struct macroblock *mb_available_left; //!< pointer to neighboring MB (CABAC)
} Macroblock;
//! Bitstream
typedef struct
{
int byte_pos; //!< current position in bitstream;
int bits_to_go; //!< current bitcounter
int stored_byte_pos; //!< storage for position in bitstream;
int stored_bits_to_go; //!< storage for bitcounter
int byte_pos_skip; //!< storage for position in bitstream;
int bits_to_go_skip; //!< storage for bitcounter
int write_flag; //!< Bitstream contains data and needs to be written
byte byte_buf; //!< current buffer for last written byte
byte stored_byte_buf; //!< storage for buffer of last written byte
byte byte_buf_skip; //!< current buffer for last written byte
byte *streamBuffer; //!< actual buffer for written bytes
#if TRACE
Boolean trace_enabled;
#endif
} Bitstream;
//! DataPartition
typedef struct datapartition
{
Bitstream *bitstream;
NALU_t *nal_unit;
EncodingEnvironment ee_cabac;
EncodingEnvironment ee_recode;
} DataPartition;
//! Slice
typedef struct
{
int picture_id;
int qp;
int qs;
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
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;
int field_ctx[3][2]; //GB
int symbol_mode;
Boolean (*slice_too_big)(int bits_slice); //!< for use of callback functions
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
} Slice;
#define MAXSLICEPERPICTURE 100
enum {
SSE = 0,
SSE_RGB = 1,
PSNR = 2,
PSNR_RGB = 3,
SSIM = 4,
SSIM_RGB = 5,
MS_SSIM = 6,
MS_SSIM_RGB = 7,
TOTAL_DIST_TYPES = 8
} distortion_types;
//! DistortionParams
typedef struct
{
float value[3]; //!< current frame distortion
float average[3]; //!< average frame distortion
float avslice[NUM_SLICE_TYPES][3]; //!< average frame type distortion
} DistMetric;
typedef struct
{
int frame_ctr; //!< number of coded frames
DistMetric metric[TOTAL_DIST_TYPES]; //!< Distortion metrics
} DistortionParams;
typedef struct
{
int no_slices;
int bits_per_picture;
Slice *slices[MAXSLICEPERPICTURE];
DistMetric distortion;
byte idr_flag;
} Picture;
Picture *p_frame_pic;
Picture **frame_pic;
Picture **field_pic;
Picture *frame_pic_si;
#ifdef _LEAKYBUCKET_
long *Bit_Buffer;
#endif
// global picture format dependend buffers, mem allocation in image.c
imgpel **pImgOrg[MAX_PLANE];
imgpel **pCurImg; //!< Reference image. Luma for other profiles, can be any component for 4:4:4
int **imgY_sub_tmp; //!< Y picture temporary component (Quarter pel)
int **PicPos;
unsigned int log2_max_frame_num_minus4;
unsigned int log2_max_pic_order_cnt_lsb_minus4;
unsigned int max_frame_num;
unsigned int max_pic_order_cnt_lsb;
time_t me_tot_time,me_time;
pic_parameter_set_rbsp_t *active_pps;
seq_parameter_set_rbsp_t *active_sps;
int dsr_new_search_range; //!<Dynamic Search Range.
//////////////////////////////////////////////////////////////////////////
// B pictures
// motion vector : forward, backward, direct
byte 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 **img_org_top[MAX_PLANE];
imgpel **img_org_bot[MAX_PLANE];
imgpel **img_org_frm[MAX_PLANE];
imgpel **imgY_com; //!< Encoded luma images
imgpel ***imgUV_com; //!< Encoded croma images
char ***direct_ref_idx; //!< direct mode reference index buffer
char **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_no, nextP_tr_fld, nextP_tr_frm;
int64 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
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
{
imgpel ***dec_mbY; //!< Best decoded macroblock pixel values in RDO
imgpel ***dec_mbY8x8; //!< Best decoded 8x8 mode pixel values in RDO
int res_img[MAX_PLANE][16][16]; //Residual values for macroblock
} Decoders;
extern Decoders *decs;
#define FILE_NAME_SIZE 200
typedef struct
{
double md; //!< Mode decision Lambda
double me[3]; //!< Motion Estimation Lambda
int mf[3]; //!< Integer formatted Motion Estimation Lambda
} LambdaParams;
// VUI Parameters
typedef struct
{
int aspect_ratio_info_present_flag;
int aspect_ratio_idc;
int sar_width;
int sar_height;
int overscan_info_present_flag;
int overscan_appropriate_flag;
int video_signal_type_present_flag;
int video_format;
int video_full_range_flag;
int colour_description_present_flag;
int colour_primaries;
int transfer_characteristics;
int matrix_coefficients;
int chroma_location_info_present_flag;
int chroma_sample_loc_type_top_field;
int chroma_sample_loc_type_bottom_field;
int timing_info_present_flag;
int num_units_in_tick;
int time_scale;
int fixed_frame_rate_flag;
int nal_hrd_parameters_present_flag;
int nal_cpb_cnt_minus1;
int nal_bit_rate_scale;
int nal_cpb_size_scale;
int nal_bit_rate_value_minus1;
int nal_cpb_size_value_minus1;
int nal_vbr_cbr_flag;
int nal_initial_cpb_removal_delay_length_minus1;
int nal_cpb_removal_delay_length_minus1;
int nal_dpb_output_delay_length_minus1;
int nal_time_offset_length;
int vcl_hrd_parameters_present_flag;
int vcl_cpb_cnt_minus1;
int vcl_bit_rate_scale;
int vcl_cpb_size_scale;
int vcl_bit_rate_value_minus1;
int vcl_cpb_size_value_minus1;
int vcl_vbr_cbr_flag;
int vcl_initial_cpb_removal_delay_length_minus1;
int vcl_cpb_removal_delay_length_minus1;
int vcl_dpb_output_delay_length_minus1;
int vcl_time_offset_length;
int low_delay_hrd_flag;
int pic_struct_present_flag;
int bitstream_restriction_flag;
int motion_vectors_over_pic_boundaries_flag;
int max_bytes_per_pic_denom;
int max_bits_per_mb_denom;
int log2_max_mv_length_vertical;
int log2_max_mv_length_horizontal;
int num_reorder_frames;
int max_dec_frame_buffering;
} VUIParameters;
//! block 8x8 temporary RD info
typedef struct
{
short best8x8mode [4];
char best8x8pdir [MAXMODE][4];
char best8x8l0ref [MAXMODE][4];
char best8x8l1ref [MAXMODE][4];
short bipred8x8me [MAXMODE][4];
} Block8x8Info;
//! all input parameters
typedef struct
{
int ProfileIDC; //!< value of syntax element profile_idc
int LevelIDC; //!< value of syntax element level_idc
int IntraProfile; //!< Enable Intra profiles
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 DisableSubpelME; //!< Disable sub-pixel 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; //!< number of reference picture in list 0 in P pictures
int B_List0_refs; //!< number of reference picture in list 0 in B pictures
int B_List1_refs; //!< number of reference picture in list 1 in B pictures
int Log2MaxFNumMinus4; //!< value of syntax element log2_max_frame_num
int Log2MaxPOCLsbMinus4; //!< value of syntax element log2_max_pic_order_cnt_lsb_minus4
// Input/output sequence format related variables
FrameFormat source; //!< source related information
FrameFormat output; //!< output related information
int rgb_input_flag;
int src_resize; //!< Control if input sequence will be resized (currently only cropping is supported)
int src_BitDepthRescale; //!< Control if input sequence bitdepth should be adjusted
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 StatsFile [FILE_NAME_SIZE]; //!< Stats File
char QmatrixFile[FILE_NAME_SIZE]; //!< Q matrix cfg file
int EnableOpenGOP; //!< support for open gops.
int EnableIDRGOP; //!< support for open gops.
int idr_period; //!< IDR picture period
int intra_period; //!< intra picture period
int intra_delay; //!< IDR picture delay
int adaptive_idr_period;
int adaptive_intra_period; //!< reinitialize start of intra period
int start_frame; //!< Encode sequence starting from Frame start_frame
int GenerateMultiplePPS;
int GenerateSEIMessage;
char SEIMessageText[500];
int ResendSPS;
int ResendPPS;
// B pictures
int successive_Bframe; //!< number of B frames that will be used
int PReplaceBSlice;
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 Mode Inference Flag
int BiPredMotionEstimation;
int BiPredSearch[4]; //!< Use Bi prediction for modes 16x16, 16x8, 8x16, and 8x8
int BiPredMERefinements; //!< Number of bipred refinements
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 prediction for P frames (0: not used, 1: explicit)
int WeightedBiprediction; //!< Weighted prediction for B frames (0: not used, 1: explicit, 2: implicit)
int WPMethod; //!< WP method (0: DC, 1: LMS)
int WPMCPrecision;
int WPMCPrecFullRef;
int WPMCPrecBSlice;
int EnhancedBWeightSupport;
int ChromaWeightSupport; //!< Weighted prediction support for chroma (0: disabled, 1: enabled)
int UseWeightedReferenceME; //!< Use Weighted Reference for ME.
int RDPictureDecision; //!< Perform RD optimal decision between various coded versions of same picture
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -