--- xvid.h 2003/02/22 08:49:44 1.27.2.1 +++ xvid.h 2003/03/15 14:32:56 1.27.2.6 @@ -19,13 +19,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id: xvid.h,v 1.27.2.1 2003/02/22 08:49:44 suxen_drol Exp $ + * $Id: xvid.h,v 1.27.2.6 2003/03/15 14:32:56 suxen_drol Exp $ * ****************************************************************************/ #ifndef _XVID_H_ #define _XVID_H_ + #ifdef __cplusplus extern "C" { #endif @@ -176,8 +177,8 @@ int version; xvid_image_t input; /* [in] input image & colorspace */ xvid_image_t output; /* [in] output image & colorspace */ - int width; /* [in] width */ - int height; /* [in] height */ + int width; /* [in] width */ + int height; /* [in] height */ int interlacing; /* [in] interlacing */ } xvid_gbl_convert_t; @@ -254,6 +255,104 @@ } xvid_dec_stats_t; +/***************************************************************************** + xvid plugin system -- internals + + xvidcore will call XVID_PLG_INFO and XVID_PLG_CREATE during XVID_ENC_CREATE + before encoding each frame xvidcore will call XVID_PLG_BEFORE + after encoding each frame xvidcore will call XVID_PLG_AFTER + xvidcore will call XVID_PLG_DESTROY during XVID_ENC_DESTROY + ****************************************************************************/ + +#define XVID_PLG_CREATE 0 +#define XVID_PLG_DESTROY 1 +#define XVID_PLG_INFO 2 +#define XVID_PLG_BEFORE 3 +#define XVID_PLG_AFTER 4 + +/* xvid_plg_info_t.flags */ +#define XVID_REQORIGINAL 1 /* plugin requires a copy of the original (uncompressed) image */ + + +typedef struct +{ + int version; + int flags; /* plugin flags */ +} xvid_plg_info_t; + + +typedef struct +{ + int version; + + int width, height; + int fincr, fbase; + + void * param; +} xvid_plg_create_t; + + +typedef struct +{ + int version; + + int width; /* [out] */ + int height; /* [out] */ + int fincr; /* [out] */ + int fbase; /* [out] */ + + xvid_image_t reference; /* [out] -> [out] */ + xvid_image_t current; /* [out] -> [in,out] */ + xvid_image_t original; /* [out] after: points the original (uncompressed) copy of the current frame */ + int frame_num; /* [out] frame number */ + + int type; /* [in,out] */ + int quant; /* [in,out] */ + + unsigned char * qscale; /* [in,out] pointer to quantizer table */ + int qscale_stride; /* [in,out] quantizer scale stride */ + + int vop_flags; /* [in,out] */ + int vol_flags; /* [in,out] */ + int motion_flags; /* [in,out] */ + + int length; /* [out] after: length of encoded frame */ + int kblks, mblks, ublks; /* [out] after: */ +} xvid_plg_data_t; + + +/***************************************************************************** + xvid plugin system -- external + + the application passes xvid an array of "xvid_plugin_t" at XVID_ENC_CREATE. the array + indicates the plugin function pointer and plugin-specific data. + xvidcore handles the rest. example: + + xvid_enc_create_t create; + xvid_enc_plugin_t plugins[2]; + + plugins[0].func = xvid_psnr_func; + plugins[0].param = NULL; + plugins[1].func = xvid_cbr_func; + plugins[1].param = &cbr_data; + + create.num_plugins = 2; + create.plugins = plugins; + + ****************************************************************************/ + +typedef int (xvid_plugin_func)(void * handle, int opt, void * param1, void * param2); + +typedef struct +{ + xvid_plugin_func * func; + void * param; +} xvid_enc_plugin_t; + +xvid_plugin_func xvid_plugin_psnr; /* stdout psnr calculator */ +xvid_plugin_func xvid_plugin_dump; /* dump before and after yuvpgms */ + + /***************************************************************************** * xvid_encore() @@ -273,7 +372,6 @@ { XVID_PACKED = 0x00000001, /* packed bitstream */ XVID_CLOSED_GOP = 0x00000002, /* closed_gop: was DX50BVOP dx50 bvop compatibility */ - XVID_EXTRASTATS_ENABLE = 0x00000004 /*define XVID_VOL_AT_IVOP 0x00000008 write vol at every ivop: WIN32/divx compatibility */ /*define XVID_FORCE_VOL 0x00000008 XXX: when vol-based parameters are changed, insert an ivop NOT recommended */ } xvid_global_t; @@ -293,7 +391,7 @@ /* vop-based flags */ typedef enum { XVID_DEBUG = 0x00000001, - XVID_EXTRASTATS = 0x00000002, + XVID_HALFPEL = 0x00000004, /* use halfpel interpolation */ XVID_INTER4V = 0x00000008, XVID_LUMIMASKING = 0x00000010, @@ -356,6 +454,9 @@ int width; /* [in] frame dimensions; width, pixel units */ int height; /* [in] frame dimensions; height, pixel units */ + int num_plugins; /* [in:opt] number of plugins */ + xvid_enc_plugin_t * plugins; /* ^^ plugin array */ + int num_threads; /* [in:opt] number of threads */ int max_bframes; /* [in:opt] max sequential bframes (0=disable bframes) */ @@ -449,8 +550,6 @@ /* XVID_ENC_ENCODE param2 (optional) xvid_enc_stats_t describes individual frame details - when bframes>0, you must pass _two_ of these to xvid_encore() - ie. xstats[2]; xvid_encore(..., xstats) coding_type==XVID_TYPE_NOTHING if the stats are not given */ typedef struct { @@ -475,4 +574,5 @@ } #endif + #endif