⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 h264_define.h

📁 自己在wince的环境下做的一移动数字电视驱动
💻 H
📖 第 1 页 / 共 4 页
字号:
			//		5				 40:33
			//		6				 24:11
			//		7				 20:11
			//		8				 32:11
			//		9				 80:33
			//		10				 18:11
			//		11				 15:11
			//		12				 64:33
			//		13				160:99
			//		14..254			Reserved
			//		255				Extended_SAR
	unsigned short vui_sar_width;  //Extended_SAR
	unsigned short vui_sar_height; //Extended_SAR

	unsigned short vui_present_flags;
			//[0]	aspect_ratio_info_present_flag				
			//[1]	overscan_info_present_flag
			//[2]	video_signal_type_present_flag
			//[3]	chroma_loc_info_present_flag
			//[4]	timing_info_present_flag
			//[5]	nal_hrd_parameters_present_flag
			//[6]	vcl_hrd_parameters_present_flag
			//[7]	pic_struct_presnet_flag
			//[8]	bitstrream_restriction_flag
			//[9]	fixed_frame_rate_flag
			//[10]	low_delay_hrd_flag
			//[11]	motion_vectiors_over_pic_boundaries_flag
			//[12]  video_full_ragne_flag
			//[13]  colour_description_present_flag
			//[14]  Valid

	unsigned int vui_num_units_in_tick;
	unsigned int vui_time_scale;
	unsigned int vui_max_dec_frame_buffering;
	h264_hrdParam_t	vui_nal_hrd_param;
	h264_hrdParam_t	vui_vcl_hrd_param;

	#ifdef VUI_PARAMETER_COLOR_CHROMA
	unsigned char vui_colour_primaries; //U8
	unsigned char vui_transfer_characteristics; //U8
	unsigned char vui_matrix_coefficients; //U8
	unsigned char vui_chroma_sample_loc_type_fields;//[MSB 
													// 4 : chroma_sample_loc_type_top_filed; //0 ~ 5 //U4
													// 4 : chroma_sample_loc_type_bottom_field; // 0 ~ 5 //U4
													//[LSB]
	#endif //VUI_PARAMETER_COLOR_CHROMA
	/*
	unsigned char video_format; //default 5
	unsigned char video_full_range_flag; //default 0
	*/
} VuiInfo_t;

//////////////////////////////////////////////////////////////
// SEI 

#define PICTIMSEI_BITPOS_CLOCK_TIMESTAMP_FLAG		19
#define PICTIMSEI_BITPOS_CT_TYPE					17
#define PICTIMSEI_BITPOS_NUIT_FIELD_BASED_FLAG		16
#define PICTIMSEI_BITPOS_COUNTING_TYPE				11
#define PICTIMSEI_BITPOS_FULL_TIMESTAMP_FLAG		10
#define PICTIMSEI_BITPOS_DISCONTINUITY_FLAG			 9
#define PICTIMSEI_BITPOS_CNT_DROPPED_FLAG			 8
//#define PICTIMSEI_BITPOS_N_FRAMES					 0

#define PICTIMSEI_BITPOS_SEC_VALUE					11
#define PICTIMSEI_BITPOS_MIN_VALUE					 5
//#define PICTIMSEI_BITPOS_HOUR_VALUE					 0

#define PICTIMSEI_BITPOS_NUMCLOCKTS					 6
#define PICTIMSEI_BITPOS_CPBDPBDELAYPRESENT_FLAG	 5
#define PICTIMSEI_BITPOS_PIC_STRUCT_PRESENT_FLAG	 4
//#define PICTIMSEI_BITPOS_PIC_STRUCT					 0

typedef struct tab_clock_timestamp {//12 bytes
	unsigned int flagsInfo;			//[31:20](12 bits) - unspecified
									//[19:19]( 1 bits) - clock_timestamp_flag
									//[18:17]( 2 bits) - ct_type
									//[16:16]( 1 bits) - nuit_field_based_flag
									//[15:11]( 5 bits) - counting_type
									//[10:10]( 1 bits) - full_timestamp_flag
									//[ 9: 9]( 1 bits) - discontinuity_flag
									//[ 8: 8]( 1 bits) - cnt_dropped_flag
									//[ 7: 0]( 8 bits) - n_frames

	unsigned int full_time_value;	//[31:17](15 bits) - unspecified
									//[16:11]( 6 bits) - seconds_value
									//[10: 5]( 6 bits) - minutes_value
									//[ 4: 0]( 5 bits) - hours_value

	unsigned int time_offset;		//

} stclock_timestamp;

typedef struct tag_PicTimingSei { // 48 bytes
	unsigned int flags;				//[31: 8](24 bits) - unspecified
									//[ 7: 6]( 2 bits) - NumClockTs	
									//[ 5: 5]( 1 bits) - CpbDpbDelayPresentFlag
									//[ 4: 4]( 1 bits) - pic_struct_present_flag
									//[ 3: 0]( 4 bits) - pic_struct
	unsigned int cpb_removal_delay;	//
	unsigned int dpb_output_delay;	//

	stclock_timestamp clock_timestamp[3]; //36 bytes
} sPicTimingSei;

typedef	struct tag_PanScanRectSei { // 56 bytes(=14*4) // 56B[U32]
		unsigned int pan_scan_rect_id;								//U32
		unsigned int pan_scan_cnt_minus1_repetition_period;			//U32
		//		INT08(MSB 24   ) pan_scan_rect_cancel_flag			( 1 bit )
		//		INT16(    17:16) pan_scan_cnt_minus1				( 2 bits)
		//		INT16(LSB 15: 0) pan_scan_rect_repetition_period	(16 bits)
		unsigned int pan_scan_rect_left_offset[3];					//S32 [3]
		unsigned int pan_scan_rect_right_offset[3];					//S32 [3]
		unsigned int pan_scan_rect_top_offset[3];					//S32 [3]
		unsigned int pan_scan_rect_bottom_offset[3];				//S32 [3]
} sPanScanRectSei;

typedef union tagTCC_H264DEC_Info {
	int nInfoDat[50/*64*//*128*/];
	struct { // 12 bytes
		//frame cropping information
		struct {
			unsigned int  	frameCropping_flag;				//nInfoDat[0] 0: not used, 1: used
			unsigned short 	frameCropping_left_offset2; 	//nInfoDat[1] frameCropping_left_offset2 		= 2*frameCropping_left_offset 
			unsigned short 	frameCropping_right_offset2; 	//nInfoDat[1] frameCropping_right_offset2 		= 2*frameCropping_right_offset
			unsigned short 	frameCropping_top_offset2; 		//nInfoDat[2] frameCropping_top_offset2 		= 2*frameCropping_top_offset
			unsigned short 	frameCropping_bottom_offset2;  	//nInfoDat[2] frameCropping_bottom_offset2 	= 2*frameCropping_bottom_offset
			//refer to H.264 specification			
			//luma samples of a frame within a rectangle as follows
			// - horizontal coordinates 	: (2*frameCropping_left_offset) ~ (16*PicWidthInMbs   - (2*frameCropping_right_offset +1))
			// - vertical coordinates 	: (2*frameCropping_top_offset ) ~ (16*FrameWidthInMbs - (2*frameCropping_bottom_offset+1))
		} frameCropping;

		struct { //16 bytes
			unsigned short	profile;						//nInfoDat[3]  [SPS]  66: baseline, 77: main, 88: extended
			unsigned short	level;							//nInfoDat[3]  [SPS]
			unsigned int		num_ref_frames;				//nInfoDat[4]  [SPS] specifies the maximum number of reference frames
			unsigned int		frame_num;					//nInfoDat[5]  [slice header]
			unsigned int		first_mb_in_slice;			//nInfoDat[6]  [slice header]
		} frameInfo;
		
	#if 0 //VUI 0
		VuiInfo_t VuiInfo;
	#else //VUI 0
		struct { //28 bytes
			unsigned short vui_aspect_ratio_idc;			//nInfoDat[7]
			unsigned short vui_sar_width;					//nInfoDat[7] //indicates the horizontal size of the sample aspect ratio 	//Extended_SAR 
			unsigned short vui_sar_height;					//nInfoDat[8] //indicates the vertical size of the sample aspect ration 	//Extended_SAR
			unsigned short vui_present_flags;				//nInfoDat[8]
				//[0]	aspect_ratio_info_present_flag				
				//[1]	overscan_info_present_flag
				//[2]	video_signal_type_present_flag
				//[3]	chroma_loc_info_present_flag
				//[4]	timing_info_present_flag
				//[5]	nal_hrd_parameters_present_flag
				//[6]	vcl_hrd_parameters_present_flag
				//[7]	pic_struct_presnet_flag
				//[8]	bitstrream_restriction_flag
				//[9]	fixed_frame_rate_flag
				//[10]	low_delay_hrd_flag
				//[11]	motion_vectiors_over_pic_boundaries_flag
				//[12]  video_full_ragne_flag
				//[13]  colour_description_present_flag
				//[14]  Valid
			unsigned int vui_num_units_in_tick;				//nInfoDat[9]
			unsigned int vui_time_scale;					//nInfoDat[10]
			unsigned int reserved1;							//nInfoDat[11] unsigned int vui_max_dec_frame_buffering;
			unsigned short reserved2;						//nInfoDat[12] h264_hrdParam_t	vui_nal_hrd_param;	
			unsigned short reserved3;						//nInfoDat[12] h264_hrdParam_t	vui_vcl_hrd_param;
		#ifdef VUI_PARAMETER_COLOR_CHROMA
			unsigned char vui_colour_primaries; //U8
			unsigned char vui_transfer_characteristics; //U8
			unsigned char vui_matrix_coefficients; //U8
			unsigned char vui_chroma_sample_loc_type_fields;	//[MSB 
															// 4 : chroma_sample_loc_type_top_filed; //0 ~ 5 //U4
															// 4 : chroma_sample_loc_type_bottom_field; // 0 ~ 5 //U4
															//[LSB]
		#endif //VUI_PARAMETER_COLOR_CHROMA
		} VuiInfo;
	#endif //VUI 0

		//SEI

		sPicTimingSei seiPictureTiming; //PictureTimingSEI ( 48 bytes ) //nInfoDat[13 ~ 24]
																		//nInfoDat[14 ~ 25] when VUI_PARAMETER_COLOR_CHROMA
		sPanScanRectSei seiPanScanRect; // 56 bytes //nInfoDat[26 ~ 39]
		
		#ifdef DBG_SOO_DEBUG_INFO_TOMAIN //debug inform added by soo 20070328
		// need 60 bytes in shared region for debugging
		struct {
			int bitstream_bits; 			//nInfoDat[BASE+  1]
			int used_bits;					//nInfoDat[BASE+  2]
			int current_MB_nr;				//nInfoDat[BASE+  3]
			
			int controlflag_PP_LIST2; 		//nInfoDat[BASE+  4]: (PostProcessingOn<<4)|(h264ConfigControlListControl)
			int nNumRefFrames; 				//nInfoDat[BASE+  5]
			int nIdxRefFrames; 				//nInfoDat[BASE+  6]
			int refFramesAddr;				//nInfoDat[BASE+  7]
			int listXSize;					//nInfoDat[BASE+  8]
			short listX_STR_size;			//nInfoDat[BASE+  9] MSB16
			short listX_LTR_size;			//nInfoDat[BASE+  9] LSB16

			//int listX[16];				//nInfoDat[BASE+ 10 ~ 25]  (MSB16:listX, LSB16:used_for_reference)
			int listX[14];					//nInfoDat[BASE+ 10 ~ 25]  (MSB16:listX, LSB16:used_for_reference)			
		} debug_info;
		#endif //DBG_SOO_DEBUG_INFO_TOMAIN

	} sInfo;
		
} TCC_H264DEC_Info;

#define H264API_MEMSTRUCT_MAX_SIZE 16

typedef struct h264API_memInfoStruct_tag // 8 bytes
{
		short							used_flag;		//used(1) or not used(0) in H.264 dec.
		short							idx;			//index
		unsigned char					* StartAddress;	//start address of the image buffer
} h264API_memInfoStruct_tag_t ;

// 200 bytes (= 176 + 8 + 16) 200 bytes available
typedef struct h264API_memStructInterface_tag
{
	// 176 bytes (=12*4 + 128)
	//
	uint32_t			h264Param_Config; 			//Config. param.
	
	uint16_t			Width;						//0: unknown, Positive integer: width (pixel)
	uint16_t			Height;						//0: unknown, Positive integer: width (pixel)						
	short			si_Message;					//command	
	short			si_Status;					//status
	
	short			FrameType;					//0: unknown, 1: I-frame, 2: P-frame	
	short			nal_unit_type; 				//NAL unit header	
	short			nal_ref_idc; 				//NAL unit header
	short			h264_init_status; 			//Parsing status
	
	uint32_t			nSizeBitstreamBuffer;		//the size of the input RBSP(remove an emulation code)		
	uint8_t 			*pBitstreamBuffer;				//A pointer to input RBSP(remove an emulation code)buffer 
	
	uint8_t 			*pCurrentFrameBuffer; 			//A pointer to output image buffer : uint8_t *
	
	uint8_t 			*pInstanceBuffer;				//A pointer to instance buffer
													//  include : 	ph264DecInfo,
													//			poffset_for_ref_frame_dataA,
													//			pPicParSetA,
													//			pSeqParSetA

	uint8_t 			*pRefFrames; //A pointer to reference frames added by soo 20060626
	
	uint16_t			nNumRefFrames; 
	short			size; 						//reference frame

	uint32_t			nDecodedOption;
		

	struct			h264API_memInfoStruct_tag	memInfo[H264API_MEMSTRUCT_MAX_SIZE]; //reference frame 128 bytes (=8*16)


	// 8 bytes for debugging or profiling
	//
	uint32_t			h264VcoreProfile;
	int16_t			h264VcoreDebug1;
	int16_t			h264VcoreDebug2;


	// 16 bytes for post processing
	//
	uint32_t			flagPostProcess; 
	int16_t			ppA0;
	int16_t			ppB0;
	int16_t			ppA1;
	int16_t			ppB1;
	int16_t			ppA2;
	int16_t			ppB2;
	
	union tagTCC_H264DEC_Info	tccH264streamInfo; //added by soo 20070605
	
	
} h264API_memStructInterface_t;


//24 bytes
typedef struct {
	uint8_t 			*stream;
  	uint8_t 			str_buf;
  	int8_t 			bitptr; 			//modified by soo 20050629 uint8_t bitptr;
  	short 			dummy; 		//for 4-byte align.. added by soo 20060220
  	unsigned long 		byte_len;		//size of stream buffer
  	unsigned long 		read_byte_len;  	//reading size of stream buffer
} buffer_io_t;

// Total mem.
// 384 pixels(WDF) 	: 5056 = 4*(384)+R , when R = 3520 = 256+128+640+384+576+1536
// 480 pixels(WQVGA): 5440 = 4*(480)+R 
// 640 pixels(VGA) 	: 6080 = 4*(640)+R 
typedef struct {

	uint8_t		i4x4_hor_neighboring_samples[2][MAXPICPICELWIDTH];				//  768 bytes
	uint8_t		i_hor_neighboring_samples_chroma[2][2][MAXPICPICELWIDTH / 2];	//  768 bytes
																				// 1536 bytes(=4*Width) for 384 pixels (width)
																				// 1920 bytes(=4*Width) for 480 pixels (width)
																				// 2560 bytes(=4*Width) for 640 pixels (width)

	uint8_t		prediction_samples_l[4][8][8];									//  256 bytes
	uint8_t		prediction_samples_c[2][8][8];									//  128 bytes
	
	uint8_t		reconstructed_mb_l[2][16][20];									//  640 bytes
	uint8_t		reconstructed_mb_c[2][2][8][12];								//  384 bytes
	
	mb_lbuf_t	mb_lbuf[2][4];													//  576 bytes(= 18*4(w) * 8)

	int16_t		ResidualOut[2][24 * 16];										// 1536 bytes
} hwio_data;


typedef	int8_t (*p_int8_4x4_lbuf_t)[LBLKSIZE*MAXPICWIDTHINMBS];

typedef	int8_t (*p_int8_8x8_lbuf_t)[MBPARTSIZE*MAXPICWIDTHINMBS];

typedef	mv_t (*p_mv_4x4_lbuf_t)[LBLKSIZE*MAXPICWIDTHINMBS];

#ifdef USE_VIDEO_ACCEL
#include "video_define.h"
#endif


#endif //__H264_DEFINITION__

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -