www.pudn.com > henclib263.rar > H263PEncode.h


/*   
* H263PEncode.h 
*  
* Interface of CH263Encoder (Version 9.18) 
*  
* 
* Copyright (c) 2002-2004 Li Chun-lin(li_chunlin@263.net) 
* 
* This program is free software; you can redistribute it and/or 
* modify it under the terms of the GNU General Public License 
* as published by the Free Software Foundation; either version 2 
* of the License, or (at your option) any later version. 
*  
* This program is distributed in the hope that it will be useful, 
* but WITHOUT ANY WARRANTY; without even the implied warranty of 
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
* GNU General Public License for more details. 
 
* You should have received a copy of the GNU General Public License 
* along with this program; if not, write to the Free Software 
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. 
*/ 
 
 
#ifndef H263PENCODE_H 
#define H263PENCODE_H 
 
 
#ifdef _USRDLL 
#ifdef DLL_EXPORT 
#define DLL_API __declspec (dllexport) 
#else 
#define DLL_API __declspec (dllimport) 
#endif 
#endif 
 
#ifdef _DEBUG 
#include  
#endif 
 
#ifndef _HENCLIB 
 
/* Source format */ 
#define _SUBQCIF      1      //!< 88x72     
#define _QCIF         2      //!< 176x144    
#define _CIF          3      //!< 352x288   
#define _4CIF         4       
#define _16CIF        5 
/* Picture coding type */  
#define INTRA        0       //!< intra picture  
#define INTER        1       //!< inter picture 
#define B_IMG        3       //!< B picture  
#define SKIP         100     //!< for rate control 
#define STORE        999     //!< for control 
//mv search method 
#define FULLSEARCH 0 
#define MVFAST     1 
 
#endif 
 
 
struct _tagH263VencStatus; 
struct _tagMCPara; 
struct _tagputstrm; 
								   
typedef struct { 
	int            m_iPicFormat;         //!< Picture Format 
	int            m_iQuantI;            //!< Quantizer of I picture 
	int            m_iQuantP;            //!< Quantizer of P picture  
	int            m_iQuantB;            //!< Quantizer of B picture 
	int            m_iPRate;             //!< The number of P frames to be encoded between 2 I frame   
    int            m_iBFrame;            //!< The number of B frames inserted;   
	int            m_iFrameRate;         //!< Frame rate 
	int            m_iRefBufSize;        //!< Reference Buffer size 
   	int            m_iMVSearchMethod;    //!< Motion search method  
	int            m_iMVSearchWin;       //!< Motion search window size 
	int            m_iUseAP;             //!< Switch of Advanced Prediction mode 
	int            m_iUseDF;             //!< Switch of Deblocking Filter mode  
	int            m_iUseRPS;            //!< Switch of Reference Picture Selection mode 
	int            m_iUseBFrame;         //!< Switch of B Frame 
	int            m_iUseGob;            //!< Switch of GOP synchronization  
	int            m_iUseVersion2;       //!< Switch of H263+  
	int            m_iUseBlock;          //!< 0: don't use block. n>0: the blocksize 
	int            m_iUseRC;             //!< 0: don't use rate control. n>0: the bitrate(kbps) requiedy 
	void*          m_pCBContext;         //!< additional infomation from outside 
	long          (*m_EncoderCallBack) (unsigned char *pData, int len, long  tmstamp, unsigned long type,  void* context );	 
                                         //!< Call back function used to write encoded data to list 
}Enc_Option,*P_EncOption; 
 
#ifdef _USRDLL 
class DLL_API CH263Encoder 
#else 
class  CH263Encoder 
#endif 
{ 
public: 
	CH263Encoder();                            //!< Constructor: set default encode options 
	virtual ~CH263Encoder();                   //!< Destructor  
 
	bool GetOption(Enc_Option &option); 
	bool EncOpen(Enc_Option &option);			//!< Initialize encoder  
 
	/*! function for encoding one frame 
	    input:    address of source image buffer, time stamp information 
	    output: 
	    return:   size of the coded picture(byte). 
		          zero when the picture is skiped 
	*/ 
        int  EncOneFrame(unsigned char *pCapture, unsigned int &nTimeStamp);  
 
	void EncClose();							//!< Close encoder		 
private: 
	struct _tagH263VencStatus	*m_pEncStatus;  //!< Encoder parameters, encoder status, and coding options 
	struct _tagMCPara			*m_pMCStatus;   //!< Motion Compensation options 
	struct _tagputstrm 	        *m_pStream;     //!< Bitstream stucture 
	                              /*!< the address of global vaiable putbitstmctrl will be assigned 
								      to the member during initializing of CH263Encoder object */ 
	Enc_Option		m_EncOption;        //!< default encode option  
#ifdef _DEBUG 
	FILE			*fdebug;            //!< for debug 
	FILE			*frecon;            //!< for test 
	FILE			*frecon_B;          //!< for test 
#endif 
}; 
 
#endif