xvid.h | xvid.h | |||
---|---|---|---|---|
/************************************************************************** *** | /************************************************************************** *** | |||
* | * | |||
* XVID MPEG-4 VIDEO CODEC | * XVID MPEG-4 VIDEO CODEC | |||
* - XviD Main header file - | * - XviD Main header file - | |||
* | * | |||
* Copyright(C) 2001-2003 Peter Ross <pross@xvid.org> | * Copyright(C) 2001-2004 Peter Ross <pross@xvid.org> | |||
* | * | |||
* This program is free software ; you can redistribute it and/or modify | * 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 | * it under the terms of the GNU General Public License as published by | |||
* the Free Software Foundation ; either version 2 of the License, or | * the Free Software Foundation ; either version 2 of the License, or | |||
* (at your option) any later version. | * (at your option) any later version. | |||
* | * | |||
* This program is distributed in the hope that it will be useful, | * This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY ; without even the implied warranty of | * but WITHOUT ANY WARRANTY ; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU General Public License for more details. | * GNU General Public License for more details. | |||
* | * | |||
* You should have received a copy of the GNU General Public License | * You should have received a copy of the GNU General Public License | |||
* along with this program ; if not, write to the Free Software | * along with this program ; if not, write to the Free Software | |||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A | |||
* | * | |||
* $Id$ | * $Id: xvid.h,v 1.51.2.2 2005/11/22 21:01:33 edgomez Exp $ | |||
* | * | |||
************************************************************************** **/ | ************************************************************************** **/ | |||
#ifndef _XVID_H_ | #ifndef _XVID_H_ | |||
#define _XVID_H_ | #define _XVID_H_ | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" { | extern "C" { | |||
#endif | #endif | |||
skipping to change at line 59 | skipping to change at line 59 | |||
#define XVID_MAKE_VERSION(a,b,c) ((((a)&0xff)<<16) | (((b)&0xff)<<8) | ((c) &0xff)) | #define XVID_MAKE_VERSION(a,b,c) ((((a)&0xff)<<16) | (((b)&0xff)<<8) | ((c) &0xff)) | |||
#define XVID_VERSION_MAJOR(a) ((char)(((a)>>16) & 0xff)) | #define XVID_VERSION_MAJOR(a) ((char)(((a)>>16) & 0xff)) | |||
#define XVID_VERSION_MINOR(a) ((char)(((a)>> 8) & 0xff)) | #define XVID_VERSION_MINOR(a) ((char)(((a)>> 8) & 0xff)) | |||
#define XVID_VERSION_PATCH(a) ((char)(((a)>> 0) & 0xff)) | #define XVID_VERSION_PATCH(a) ((char)(((a)>> 0) & 0xff)) | |||
#define XVID_MAKE_API(a,b) ((((a)&0xff)<<16) | (((b)&0xff)<<0)) | #define XVID_MAKE_API(a,b) ((((a)&0xff)<<16) | (((b)&0xff)<<0)) | |||
#define XVID_API_MAJOR(a) (((a)>>16) & 0xff) | #define XVID_API_MAJOR(a) (((a)>>16) & 0xff) | |||
#define XVID_API_MINOR(a) (((a)>> 0) & 0xff) | #define XVID_API_MINOR(a) (((a)>> 0) & 0xff) | |||
#define XVID_VERSION XVID_MAKE_VERSION(1,0,3) | #define XVID_VERSION XVID_MAKE_VERSION(1,1,0) | |||
#define XVID_API XVID_MAKE_API(4, 0) | #define XVID_API XVID_MAKE_API(4, 1) | |||
/* Bitstream Version | /* Bitstream Version | |||
* this will be writen into the bitstream to allow easy detection of xvid | * this will be writen into the bitstream to allow easy detection of xvid | |||
* encoder bugs in the decoder, without this it might not possible to | * encoder bugs in the decoder, without this it might not possible to | |||
* automatically distinquish between a file which has been encoded with an | * automatically distinquish between a file which has been encoded with an | |||
* old & buggy XVID from a file which has been encoded with a bugfree versi on | * old & buggy XVID from a file which has been encoded with a bugfree versi on | |||
* see the infamous interlacing bug ... | * see the infamous interlacing bug ... | |||
* | * | |||
* this MUST be increased if an encoder bug is fixed, increasing it too oft en | * this MUST be increased if an encoder bug is fixed, increasing it too oft en | |||
* doesnt hurt but not increasing it could cause difficulty for decoders in the | * doesnt hurt but not increasing it could cause difficulty for decoders in the | |||
* future | * future | |||
*/ | */ | |||
#define XVID_BS_VERSION 37 | #define XVID_BS_VERSION 41 | |||
/************************************************************************** *** | /************************************************************************** *** | |||
* error codes | * error codes | |||
************************************************************************** **/ | ************************************************************************** **/ | |||
/* all functions return values <0 indicate error */ | /* all functions return values <0 indicate error */ | |||
#define XVID_ERR_FAIL -1 /* general fault */ | #define XVID_ERR_FAIL -1 /* general fault */ | |||
#define XVID_ERR_MEMORY -2 /* memory allocation error */ | #define XVID_ERR_MEMORY -2 /* memory allocation error */ | |||
#define XVID_ERR_FORMAT -3 /* file format error */ | #define XVID_ERR_FORMAT -3 /* file format error */ | |||
skipping to change at line 241 | skipping to change at line 241 | |||
void * handle; /* [out] decore context handle */ | void * handle; /* [out] decore context handle */ | |||
} xvid_dec_create_t; | } xvid_dec_create_t; | |||
/* XVID_DEC_DECODE param1 */ | /* XVID_DEC_DECODE param1 */ | |||
/* general flags */ | /* general flags */ | |||
#define XVID_LOWDELAY (1<<0) /* lowdelay mode */ | #define XVID_LOWDELAY (1<<0) /* lowdelay mode */ | |||
#define XVID_DISCONTINUITY (1<<1) /* indicates break in stream */ | #define XVID_DISCONTINUITY (1<<1) /* indicates break in stream */ | |||
#define XVID_DEBLOCKY (1<<2) /* perform luma deblocking */ | #define XVID_DEBLOCKY (1<<2) /* perform luma deblocking */ | |||
#define XVID_DEBLOCKUV (1<<3) /* perform chroma deblocking */ | #define XVID_DEBLOCKUV (1<<3) /* perform chroma deblocking */ | |||
#define XVID_FILMEFFECT (1<<4) /* adds film grain */ | #define XVID_FILMEFFECT (1<<4) /* adds film grain */ | |||
#define XVID_DERINGUV (1<<5) /* perform chroma deringing, requires deb | ||||
locking to work */ | ||||
#define XVID_DERINGY (1<<6) /* perform luma deringing, requires deblo | ||||
cking to work */ | ||||
#define XVID_DEC_FAST (1<<29) /* disable postprocessing to decrease cp | ||||
u usage *todo* */ | ||||
#define XVID_DEC_DROP (1<<30) /* drop bframes to decrease cpu usage *t | ||||
odo* */ | ||||
#define XVID_DEC_PREROLL (1<<31) /* decode as fast as you can, don't even | ||||
show output *todo* */ | ||||
typedef struct { | typedef struct { | |||
int version; | int version; | |||
int general; /* [in:opt] general flags */ | int general; /* [in:opt] general flags */ | |||
void *bitstream; /* [in] bitstream (read from)*/ | void *bitstream; /* [in] bitstream (read from)*/ | |||
int length; /* [in] bitstream length */ | int length; /* [in] bitstream length */ | |||
xvid_image_t output; /* [in] output image (written to) */ | xvid_image_t output; /* [in] output image (written to) */ | |||
/* ------- v1.1.x ------- */ | ||||
int brightness; /* [in] brightness offset (0=none) | ||||
*/ | ||||
} xvid_dec_frame_t; | } xvid_dec_frame_t; | |||
/* XVID_DEC_DECODE param2 :: optional */ | /* XVID_DEC_DECODE param2 :: optional */ | |||
typedef struct | typedef struct | |||
{ | { | |||
int version; | int version; | |||
int type; /* [out] output data type */ | int type; /* [out] output data type */ | |||
union { | union { | |||
struct { /* type>0 {XVID_TYPE_IVOP,XVID_TYPE_PVOP,XVID_TYPE_ BVOP,XVID_TYPE_SVOP} */ | struct { /* type>0 {XVID_TYPE_IVOP,XVID_TYPE_PVOP,XVID_TYPE_ BVOP,XVID_TYPE_SVOP} */ | |||
skipping to change at line 481 | skipping to change at line 489 | |||
char * filename; | char * filename; | |||
} xvid_plugin_2pass1_t; | } xvid_plugin_2pass1_t; | |||
#define XVID_PAYBACK_BIAS 0 /* payback with bias */ | #define XVID_PAYBACK_BIAS 0 /* payback with bias */ | |||
#define XVID_PAYBACK_PROP 1 /* payback proportionally */ | #define XVID_PAYBACK_PROP 1 /* payback proportionally */ | |||
typedef struct { | typedef struct { | |||
int version; | int version; | |||
int bitrate; /* [in] bits per second */ | int bitrate; /* [in] target bitrate (bits per secon d) */ | |||
char * filename; /* [in] first pass stats filename */ | char * filename; /* [in] first pass stats filename */ | |||
int keyframe_boost; /* [in] keyframe boost percentage: [0. .100] */ | int keyframe_boost; /* [in] keyframe boost percentage: [0. .100] */ | |||
int curve_compression_high; /* [in] percentage of compression perf ormed on the high part of the curve (above average) */ | int curve_compression_high; /* [in] percentage of compression perf ormed on the high part of the curve (above average) */ | |||
int curve_compression_low; /* [in] percentage of compression perf ormed on the low part of the curve (below average) */ | int curve_compression_low; /* [in] percentage of compression perf ormed on the low part of the curve (below average) */ | |||
int overflow_control_strength;/* [in] Payback delay expressed in num ber of frames */ | int overflow_control_strength;/* [in] Payback delay expressed in num ber of frames */ | |||
int max_overflow_improvement; /* [in] percentage of allowed range fo r a frame that gets bigger because of overflow bonus */ | int max_overflow_improvement; /* [in] percentage of allowed range fo r a frame that gets bigger because of overflow bonus */ | |||
int max_overflow_degradation; /* [in] percentage of allowed range fo r a frame that gets smaller because of overflow penalty */ | int max_overflow_degradation; /* [in] percentage of allowed range fo r a frame that gets smaller because of overflow penalty */ | |||
int kfreduction; /* [in] maximum bitrate reduction appl ied to an iframe under the kfthreshold distance limit */ | int kfreduction; /* [in] maximum bitrate reduction appl ied to an iframe under the kfthreshold distance limit */ | |||
int kfthreshold; /* [in] if an iframe is closer to the next iframe than this distance, a quantity of bits | int kfthreshold; /* [in] if an iframe is closer to the next iframe than this distance, a quantity of bits | |||
* is substracted from its bit allocation. The reduction is computed as multiple s of | * is substracted from its bit allocation. The reduction is computed as multiple s of | |||
* kf reduction/kthreshold. It reaches kfreduction when the distance == kfthresho ld, | * kf reduction/kthreshold. It reaches kfreduction when the distance == kfthresho ld, | |||
* 0 for 1<distance<kfthreshold */ | * 0 for 1<distance<kfthreshold */ | |||
int container_frame_overhead; /* [in] How many bytes the controller has to compensate per frame due to container format overhead */ | int container_frame_overhead; /* [in] How many bytes the controller has to compensate per frame due to container format overhead */ | |||
/* ------- v1.1.x ------- */ | ||||
int vbv_size; /* [in] buffer size (bits) */ | ||||
int vbv_initial; /* [in] initial buffer occupancy (bits | ||||
) */ | ||||
int vbv_maxrate; /* [in] max processing bitrate (bits p | ||||
er second) */ | ||||
int vbv_peakrate; /* [in:opt] max average bitrate over 3 | ||||
seconds (bits per second) */ | ||||
}xvid_plugin_2pass2_t; | }xvid_plugin_2pass2_t; | |||
/************************************************************************** *** | /************************************************************************** *** | |||
* ENCODER API | * ENCODER API | |||
************************************************************************** **/ | ************************************************************************** **/ | |||
/*------------------------------------------------------------------------- --- | /*------------------------------------------------------------------------- --- | |||
* Encoder operations | * Encoder operations | |||
*------------------------------------------------------------------------- -*/ | *------------------------------------------------------------------------- -*/ | |||
skipping to change at line 557 | skipping to change at line 572 | |||
* creation (operation XVID_ENC_CREATE) | * creation (operation XVID_ENC_CREATE) | |||
*------------------------------------------------------------------------- -*/ | *------------------------------------------------------------------------- -*/ | |||
#define XVID_GLOBAL_PACKED (1<<0) /* packed bitstream */ | #define XVID_GLOBAL_PACKED (1<<0) /* packed bitstream */ | |||
#define XVID_GLOBAL_CLOSED_GOP (1<<1) /* closed_gop: was DX50BVOP dx50 bvop compatibility */ | #define XVID_GLOBAL_CLOSED_GOP (1<<1) /* closed_gop: was DX50BVOP dx50 bvop compatibility */ | |||
#define XVID_GLOBAL_EXTRASTATS_ENABLE (1<<2) | #define XVID_GLOBAL_EXTRASTATS_ENABLE (1<<2) | |||
#if 0 | #if 0 | |||
#define XVID_GLOBAL_VOL_AT_IVOP (1<<3) /* write vol at every ivop: WI N32/divx compatibility */ | #define XVID_GLOBAL_VOL_AT_IVOP (1<<3) /* write vol at every ivop: WI N32/divx compatibility */ | |||
#define XVID_GLOBAL_FORCE_VOL (1<<4) /* when vol-based parameters a re changed, insert an ivop NOT recommended */ | #define XVID_GLOBAL_FORCE_VOL (1<<4) /* when vol-based parameters a re changed, insert an ivop NOT recommended */ | |||
#endif | #endif | |||
#define XVID_GLOBAL_DIVX5_USERDATA (1<<5) /* write divx5 userdata string | ||||
this is implied if XVID_GLO | ||||
BAL_PACKED is set */ | ||||
/*------------------------------------------------------------------------- --- | /*------------------------------------------------------------------------- --- | |||
* "VOL" flags | * "VOL" flags | |||
* | * | |||
* These flags are used for xvid_enc_frame_t->vol_flags field during frame | * These flags are used for xvid_enc_frame_t->vol_flags field during frame | |||
* encoding (operation XVID_ENC_ENCODE) | * encoding (operation XVID_ENC_ENCODE) | |||
*------------------------------------------------------------------------- -*/ | *------------------------------------------------------------------------- -*/ | |||
#define XVID_VOL_MPEGQUANT (1<<0) /* enable MPEG type quantization */ | #define XVID_VOL_MPEGQUANT (1<<0) /* enable MPEG type quantization */ | |||
#define XVID_VOL_EXTRASTATS (1<<1) /* enable plane sse stats */ | #define XVID_VOL_EXTRASTATS (1<<1) /* enable plane sse stats */ | |||
#define XVID_VOL_QUARTERPEL (1<<2) /* enable quarterpel: frames will en coded as quarterpel */ | #define XVID_VOL_QUARTERPEL (1<<2) /* enable quarterpel: frames will en coded as quarterpel */ | |||
#define XVID_VOL_GMC (1<<3) /* enable GMC; frames will be checke d for gmc suitability */ | #define XVID_VOL_GMC (1<<3) /* enable GMC; frames will be checke d for gmc suitability */ | |||
#define XVID_VOL_REDUCED_ENABLE (1<<4) /* enable reduced resolution vops: f rames will be checked for rrv suitability */ | #define XVID_VOL_REDUCED_ENABLE (1<<4) /* enable reduced resolution vops: f rames will be checked for rrv suitability */ | |||
/ * NOTE: the reduced resolution feature is not supported anymore. This flag will have no effect! */ | ||||
#define XVID_VOL_INTERLACING (1<<5) /* enable interlaced encoding */ | #define XVID_VOL_INTERLACING (1<<5) /* enable interlaced encoding */ | |||
/*------------------------------------------------------------------------- --- | /*------------------------------------------------------------------------- --- | |||
* "VOP" flags | * "VOP" flags | |||
* | * | |||
* These flags are used for xvid_enc_frame_t->vop_flags field during frame | * These flags are used for xvid_enc_frame_t->vop_flags field during frame | |||
* encoding (operation XVID_ENC_ENCODE) | * encoding (operation XVID_ENC_ENCODE) | |||
*------------------------------------------------------------------------- -*/ | *------------------------------------------------------------------------- -*/ | |||
/* Always valid */ | /* Always valid */ | |||
#define XVID_VOP_DEBUG (1<< 0) /* print debug messages in fr ames */ | #define XVID_VOP_DEBUG (1<< 0) /* print debug messages in fr ames */ | |||
#define XVID_VOP_HALFPEL (1<< 1) /* use halfpel interpolation */ | #define XVID_VOP_HALFPEL (1<< 1) /* use halfpel interpolation */ | |||
#define XVID_VOP_INTER4V (1<< 2) /* use 4 motion vectors per M B */ | #define XVID_VOP_INTER4V (1<< 2) /* use 4 motion vectors per M B */ | |||
#define XVID_VOP_TRELLISQUANT (1<< 3) /* use trellis based R-D "opt imal" quantization */ | #define XVID_VOP_TRELLISQUANT (1<< 3) /* use trellis based R-D "opt imal" quantization */ | |||
#define XVID_VOP_CHROMAOPT (1<< 4) /* enable chroma optimization pre-filter */ | #define XVID_VOP_CHROMAOPT (1<< 4) /* enable chroma optimization pre-filter */ | |||
#define XVID_VOP_CARTOON (1<< 5) /* use 'cartoon mode' */ | #define XVID_VOP_CARTOON (1<< 5) /* use 'cartoon mode' */ | |||
#define XVID_VOP_GREYSCALE (1<< 6) /* enable greyscale only mode (even for color input material chroma is ignored) */ | #define XVID_VOP_GREYSCALE (1<< 6) /* enable greyscale only mode (even for color input material chroma is ignored) */ | |||
#define XVID_VOP_HQACPRED (1<< 7) /* high quality ac prediction */ | #define XVID_VOP_HQACPRED (1<< 7) /* high quality ac prediction */ | |||
#define XVID_VOP_MODEDECISION_RD (1<< 8) /* enable DCT-ME and use it f or mode decision */ | #define XVID_VOP_MODEDECISION_RD (1<< 8) /* enable DCT-ME and use it f or mode decision */ | |||
#define XVID_VOP_FAST_MODEDECISION_RD (1<<12) /* use simplified R-D mode de cision */ | #define XVID_VOP_FAST_MODEDECISION_RD (1<<12) /* use simplified R-D mode de cision */ | |||
#define XVID_VOP_RD_BVOP (1<<13) /* enable rate-distortion mod e decision in b-frames */ | ||||
/* Only valid for vol_flags|=XVID_VOL_INTERLACING */ | /* Only valid for vol_flags|=XVID_VOL_INTERLACING */ | |||
#define XVID_VOP_TOPFIELDFIRST (1<< 9) /* set top-field-first flag */ | #define XVID_VOP_TOPFIELDFIRST (1<< 9) /* set top-field-first flag */ | |||
#define XVID_VOP_ALTERNATESCAN (1<<10) /* set alternate vertical sca n flag */ | #define XVID_VOP_ALTERNATESCAN (1<<10) /* set alternate vertical sca n flag */ | |||
/* only valid for vol_flags|=XVID_VOL_REDUCED_ENABLED */ | /* only valid for vol_flags|=XVID_VOL_REDUCED_ENABLED */ | |||
#define XVID_VOP_REDUCED (1<<11) /* reduced resolution vop */ | #define XVID_VOP_REDUCED (1<<11) /* reduced resolution vop */ | |||
/* NOTE: reduced resolution feature is not supported anymore. This flag will have no effect! */ | ||||
/*------------------------------------------------------------------------- --- | /*------------------------------------------------------------------------- --- | |||
* "Motion" flags | * "Motion" flags | |||
* | * | |||
* These flags are used for xvid_enc_frame_t->motion field during frame | * These flags are used for xvid_enc_frame_t->motion field during frame | |||
* encoding (operation XVID_ENC_ENCODE) | * encoding (operation XVID_ENC_ENCODE) | |||
*------------------------------------------------------------------------- -*/ | *------------------------------------------------------------------------- -*/ | |||
/* Motion Estimation Search Patterns */ | /* Motion Estimation Search Patterns */ | |||
#define XVID_ME_ADVANCEDDIAMOND16 (1<< 0) /* use advdiamonds instead of diamonds as search pattern */ | #define XVID_ME_ADVANCEDDIAMOND16 (1<< 0) /* use advdiamonds instead of diamonds as search pattern */ | |||
End of changes. 12 change blocks. | ||||
6 lines changed or deleted | 36 lines changed or added | |||