📄 mpeg4.h
字号:
/*
*
*
*
*
*
*/
#ifndef _MPEG4_H_
#define _MPEG4_H_
# include <stdio.h>
#define MB_PREDICT 15
/* frame type */
#define I_VOP 0
#define P_VOP 1
#define B_VOP 2
#define S_VOP 3
#define N_VOP 4
/* macroblock type(not b frame) */
#define MB_INTER 0
#define MB_INTER_Q 1
#define MB_INTER_4V 2
#define MB_INTER_4V_Q 5
#define MB_INTRA 3
#define MB_INTRA_Q 4
#define MB_SKIP 16
/* vos */
#define visual_object_sequence_start_code 0x000001B0
#define visual_object_sequence_end_code 0x000001B1
/* vo */
#define visual_object_start_code 0x000001B5
#define video_object_start_code 0x00000100
#define video_object_start_code_mask 0x0000001f //该标志用来和video_object_start_code 一起进行判断
/* user data */
#define user_data_start_code 0x000001B2
/* vol */
#define video_object_layer_start_code 0x00000120
#define video_object_layer_start_code_mask 0x0000000f //该标志用来和video_object_layer_start_code 一起进行判断
/* gov */
#define group_of_vop_start_code 0x000001B3
/* vop */
#define vop_start_code 0x000001b6
/* visual object type */
#define Visual_Object_Type_Video 1
#define Visual_Object_Type_StillTexture 2
#define Visual_Object_Type_Mesh 3
#define Visual_Object_Type_FBA 4
#define Visual_Object_Type_3Dmesh 5
#define Video_Object_Type_Simple 1
#define Video_Object_Type_Simple_Scalable 2
#define Video_Object_Type_Core_Object 3
#define Video_Object_Type_Main_Object 4
#define Video_Object_Type_Nbit_Object 5
#define Video_Object_Type_Basic_Anim2D_Texture 6
#define Video_Object_Type_Anim2D_Mesh 7
#define Video_Object_Type_Simple_Face 8
#define Video_Object_Type_Still_Scalable_Texture 9
#define Video_Object_Type_Advance_Real_Time_Simple 10
#define Video_Object_Type_Core_Scalable 11
#define Video_Object_Type_Advanced_Coding_Efficiency 12
#define Video_Object_Type_Advanced_Scalable_Texture 13
#define Video_Object_Type_Simple_FBA 14
/* visual object layer type */
#define Video_Object_Layer_Sharp_Rectangular 0
#define Video_Object_Layer_Sharp_Binary 1
#define Video_Object_Layer_Sharp_Binary_Only 2
#define Video_Object_Layer_Sharp_Grayscale 3
#define Pixel_Aspect_Ratio_Extended_PAR 15
/* sprite coding */
#define Sprite_Coding_Mode_Forbidden 0
#define Sprite_Coding_Mode_Static 1
#define Sprite_Coding_Mode_GMC 2
typedef struct{
short x;
short y;
}VECTOR;
typedef struct{
short not_code;
short mcbpc;
short not_coded;
short mcsel;
short ac_pred_flag; /* flag for ac predict */
short pred_mode; /* macroblock predict mode */
short cbpy;
short cbp;
short dquant;
short quant;
short modb;
short mb_type;
short cbpb;
short dbquant;
short coda_i;
short ac_pred_flag_alpha;
short cbpa;
short coda_pb;
VECTOR PredMv[4];
VECTOR Mv[4]; /* inter macroblock MV or forward macroblock MV */
VECTOR DMV[4];
short PredictDirection[6];
short PredictValue[6][MB_PREDICT];
/* used in ME */
int LumBlockSad[4];
int LumMBlockSad;
}MacroBlock;
typedef struct{
MacroBlock *pMB;
long length;
long iTextBits;
int IntraMbNum, InterMbNum, SkipMbNum;
short vop_coding_type;
short modulo_time_base;
short vop_time_increment;
short vop_coded;
short vop_id;
short vop_id_for_prediction_indication;
short vop_id_for_prediction;
short vop_rounding_type;
short vop_reduced_resolution;
short vop_width; /* picture width and height */
short vop_height;
short vop_extwidth; /* picture extwidth and extheight */
short vop_extheight;
short vop_horizontal_mc_spatial_ref;
short vop_vertical_mc_spatial_ref;
short background_compostion;
short change_conv_ratio_disable;
short vop_constant_alpha;
short vop_constant_alpha_value;
short intra_dc_vlc_thr;
short top_field_first;
short alternate_vertical_scan_flag;
short sprite_transmit_mode;
short vop_quant;
short vop_alpha_quant[6];
short vop_fcode_forward;
short vop_fcode_backward;
short vop_shape_coding_type;
short load_backward_shape;
short backward_shape_width;
short backward_shape_height;
short backward_shape_horizontial_mc_spatial_ref;
short backward_shape_vertical_mc_spatial_ref;
short load_forward_shape;
short forward_shape_width;
short forward_shape_height;
short forward_shape_horizontial_mc_spatial_ref;
short forward_shapr_vertical_mc_spatial_ref;
short ref_select_code;
long iCurDisplayTime;
long iCurEncodeTime;
double dCurEncodeTime;
}FrameInfo;
typedef struct{
short profile_and_level_indication;
short is_visual_object_identifier;
short visual_object_verid;
short visual_object_priority;
short visual_object_type;
short random_accessible_vol;
short video_object_type_indication;
short is_object_layer_identifier;
short video_object_layer_verid;
short video_object_layer_priority;
short aspect_ratio_info;
short par_width;
short par_height;
short vol_control_parameters;
short chroma_format;
short low_delay;
short vbv_parameters;
short first_half_bit_rate;
short latter_half_bit_rate;
short first_half_vbv_buffer_size;
short latter_half_vbv_buffer_size;
short first_half_vbv_occupancy;
short latter_half_vbv_occupancy;
short video_object_layer_shape_extension;
short vop_time_increment_resolution;
short fixed_vop_rate;
short fixed_vop_time_increment;
/* picture width and height */
short video_object_layer_width;
short video_object_layer_height;
/* picture extwidth and extheight */
short iExtWidth;
short iExtHeight;
short interlaced;
short obmc_disable;
short sprite_enable;
short sprite_width;
short sprite_height;
short sprite_left_coordinate;
short sprite_top_coordinate;
short no_of_sprite_warping_points;
short sprite_warping_accuracy;
short sprite_brightness_change;
short sadct_disable;
short not_8_bit;
short quant_precion;
short bits_per_pixel;
short no_gray_quant_update;
short compositon_method;
short linear_composition;
short quant_type;
short load_intra_quant_mat;
short load_inter_quant_mat;
unsigned char intra_quant_mate[64];
unsigned char inter_quant_mate[64];
short load_intra_quant_mat_grayscale;
short load_inter_quant_mat_grayscale;
unsigned char intra_quant_mat_grayscale[64];
unsigned char inter_quant_mat_grayscale[64];
short quarter_sample;
short complexity_estimation_disable;
short resync_marker_disable;
short data_partitioned;
short reversible_vlc;
short newpred_enable;
short requested_upstream_message_type;
short newpred_segment_type;
short reduced_resolution_vop_enable;
short scalability;
short hierarchy_type;
short rec_layer_id;
short ref_layer_samping_direc;
short hor_sampling_factor_n;
short hor_sampling_factor_m;
short vert_sampling_factor_n;
short vert_sampling_factor_m;
short enhancement_type;
short use_ref_shape;
short use_ref_textutr;
short shape_hor_sampling_factor_n;
short shape_hor_sampling_factor_m;
short shape_vert_sampling_factor_n;
short shape_vert_sampling_factor_m;
}VolInfo;
typedef struct{
short *Y;
short *Cb;
short *Cr;
}Image;
typedef struct{
unsigned char *Y;
unsigned char *Cb;
unsigned char *Cr;
}Image8;
typedef struct{
/* frame number */
short iFrameNo;
/* frame rate */
short iFrameRate;
/* BitRate */
int iBitsPerSecoder;
/* GOP */
short iKeyFrameInterval;
short quant_type;
short iWidth;
short iHeight;
/* VOL information */
VolInfo* pVol;
VolInfo vol;
/* 3 frames information */
FrameInfo frameinfo[2];
FrameInfo *pCurFrameInfo;
FrameInfo *pForFrameInfo;
Image8 image8[2];
Image8 *pCurImage8;
Image8 *pForImage8;
/* time information */
long iOldRefDisplayTimeBase;
long iNewRefDisplayTimeBase;
long iOldRefDisplayTime;
long iNewRefDisplayTime;
long iLastRefEncodeTime;
long iCurEncodeTime;
}Encoder;
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -