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

📄 dhcodec.h

📁 The library contain AVC H.264 baseline codec,which can process video less than 12 minutes.
💻 H
字号:
#ifndef _DHCODEC_H_
#define _DHCODEC_H_

/*!
 ************************************************************************
 * 
 *
 * The library contain AVC H.264 baseline codec,which can process video
 * less than 12 minutes. 
 * 
 *
 * Date: 2007-05-05
 * Version: 070505A
 * Contact Personal: Tonald DL
 * Email: dhcodec@hotmail.com
 * 
 ************************************************************************
 */

enum{
FALSE,
TRUE
};

//The status for Decoder
enum{
DEC_GOON=0, //decoding keep going without error.
DEC_END=1, //end of getting syntax for frame, normally happen in end of stream.
DEC_ERROR=2, //there is some decoding error, normal case won't cause decoding stop.
			//decoder will wait for next frame's data to keep going.
DEC_NOT_VALID=3 //The encoded stream sytanx is not support. It may happen while encoded stream have 
			//certain features that decoder do not support.
};

//The FrameType Flag for Encoder
enum{
NEW_SEQ=0, //Set to this flag will generate a new stream.
INTRA_FRAM=1, //Set to this flag will make encoding current frame as intra frame no matter what's the value of IntraPeriod.
INTER_FRAME=2,//Set to this flag will make encoding current frame as inter frame no matter what's the value of IntraPeriod.
AUTO_FRAME=3 //Set to this flag Encoder will generate intra or inter frame depend on value of IntraPeriod.
};

//the encoder control parameters
typedef struct	_ENCFRAME_PROP
{
	int Version;		//input parameter
						//Version of Release

	int CodeLength;	//output parameter
						// the value will indicate the length of encoded stream in output buffer, counted as bytes.
	
	int ImageHeight;	//input parameter
						//image height, should be times of 16.
	int ImageWidth;		//input parameter
						// image width, should be times of 16.
	int IntraPeriod;	//input parameter
						// encoder will generate intra frame every IntraPeriod num frames. 
	int BSPreset;		//input parameter
						// the mode preset, mode can be 1 to 5. higher number will get high encoding speed. lower number will get higher compress ratio.
	int VideoQuality;	//input parameter
						// the video quality parameter, 
						//while value between [1 50], lower number will get better quality, higher number will get higher compress ratio.
						//While value bigger than 100, this parameter will become rate-control target kbs.
	int FrameType;		//input parameter
						// set to NEW_SEQ will make encoder flush and generate new stream.
						// set to INTRA_FRAM will make encoder encoding current frame as intra frame.
						// set to INTER_FRAME will make encoder encoding current frame as inter frame.
						// set to AUTO_FRAME will make encoder generate inter and intra frame depend on IntraPeriod.
	int Reserved[56];	
}ENCFRAME_PROP;


//the output of the decoder
typedef struct	_DECFRAME_PROP
{
	int ImageHeight;	//output parameter
						// it will show the image height
	int ImageWidth;		// output parameter
						// it will show the image width
	int FrameType;		//output parameter
						// it will show the current image type.
} DECFRAME_PROP;


#ifdef __cplusplus 
extern "C"{ 
#endif

/*!
 ************************************************************************
 * \brief
 * Encoder function.Implemented in DHCODEC.lib
 * Call this function for initial setting.
 * Parameter:
 *		void *_ENCPARA:	The Encoder Parameters
 *
 ************************************************************************
 */
void DHENC_SETUP(void *_ENCPARA);


/*!
 ************************************************************************
 * \brief
 * Encoder function.Implemented in DHCODEC.lib
 * Parameter:
 *		void *_DataIn:	The original YUV 420 data
 *		void *_DataOut:	The encoded and decoded image.
 *		void *_input:		Input parameters, see define of ENCFRAME_PROP
 *
 ************************************************************************
 */
void DHENC_FRAME(void *_DataIn,void *_DataOut,void* _input);

/*!
 ************************************************************************
 * \brief
 * Decoder function.Implemented in DHCODEC.lib
 * Parameter:
 *		void *_DataOut:	The decoded yuv image will copy to this buffer.
 * 						This buffer should be allocated by user
 *		void *_input:		This will pass out the image width, height and frame type.
 *Function return value:
 *		
 *		DEC_GOON=0, 	decoding keep going without error.
 *		DEC_END=1, 		end of getting syntax for frame, normally happen in end of stream.
 *		DEC_ERROR=2 	there is some decoding error, normal case won't cause decoding stop.
 *						decoder will wait for next frame's data to keep going.
 *
 ************************************************************************
 */
int DHDEC_FRAME(void *_DataOut,void *_input);


/*!
 ************************************************************************
 * \brief
 * Caution !!!!!!
 * Decoder read stream function, this should implemented by user.
 * Not implemented in DHCODEC.lib
 *    Read syntax, this function is called by decoder. 
 *	This function should be implemented by user.
 *	Input:
 *		void* _OutDat	 	data should fill into this buffer
 *		int 	len 			counted as byte.
 *	Output:
 *	 	TRUE 			Return TRUE  if data is available
 *		FALSE 			Return FALSE if data is not available
 *
 ************************************************************************
 */
int GetNewData(void* _OutDat,int len);


#ifdef __cplusplus 
} 
#endif







#endif

⌨️ 快捷键说明

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