[cvs] / xvidcore / src / xvid.h Repository:
ViewVC logotype

Diff of /xvidcore/src/xvid.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.27.2.36, Thu Sep 11 15:28:51 2003 UTC revision 1.51.2.4, Wed Nov 1 10:17:27 2006 UTC
# Line 3  Line 3 
3   * XVID MPEG-4 VIDEO CODEC   * XVID MPEG-4 VIDEO CODEC
4   * - XviD Main header file -   * - XviD Main header file -
5   *   *
6   *  Copyright(C) 2001-2003 Peter Ross <pross@xvid.org>   *  Copyright(C) 2001-2004 Peter Ross <pross@xvid.org>
7   *   *
8   *  This program is free software ; you can redistribute it and/or modify   *  This program is free software ; you can redistribute it and/or modify
9   *  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
# Line 49  Line 49 
49          */          */
50    
51  #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))
52  #define XVID_VERSION_MAJOR(a)    (((a)>>16) & 0xff)  #define XVID_VERSION_MAJOR(a)    ((char)(((a)>>16) & 0xff))
53  #define XVID_VERSION_MINOR(a)    (((a)>> 8) & 0xff)  #define XVID_VERSION_MINOR(a)    ((char)(((a)>> 8) & 0xff))
54  #define XVID_VERSION_PATCH(a)    (((a)>> 0) & 0xff)  #define XVID_VERSION_PATCH(a)    ((char)(((a)>> 0) & 0xff))
55    
56  #define XVID_MAKE_API(a,b)       ((((a)&0xff)<<16) | (((b)&0xff)<<0))  #define XVID_MAKE_API(a,b)       ((((a)&0xff)<<16) | (((b)&0xff)<<0))
57  #define XVID_API_MAJOR(a)        (((a)>>16) & 0xff)  #define XVID_API_MAJOR(a)        (((a)>>16) & 0xff)
58  #define XVID_API_MINOR(a)        (((a)>> 0) & 0xff)  #define XVID_API_MINOR(a)        (((a)>> 0) & 0xff)
59    
60  #define XVID_VERSION             XVID_MAKE_VERSION(1,-127,0)  #define XVID_VERSION             XVID_MAKE_VERSION(1,1,2)
61  #define XVID_API                 XVID_MAKE_API(4, 0)  #define XVID_API                 XVID_MAKE_API(4, 1)
   
 #define XVID_UNSTABLE  
62    
63  /* Bitstream Version  /* Bitstream Version
64   * 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
# Line 73  Line 71 
71   * 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
72   * future   * future
73   */   */
74  #define XVID_BS_VERSION "0019"  #define XVID_BS_VERSION 46
   
75    
76  /*****************************************************************************  /*****************************************************************************
77   * error codes   * error codes
# Line 96  Line 93 
93    
94  /* colorspace values */  /* colorspace values */
95    
96  #define XVID_CSP_USER     (1<< 0) /* 4:2:0 planar */  #define XVID_CSP_PLANAR   (1<< 0) /* 4:2:0 planar (==I420, except for pointers/strides) */
97  #define XVID_CSP_I420     (1<< 1) /* 4:2:0 packed(planar win32) */  #define XVID_CSP_USER     XVID_CSP_PLANAR
98  #define XVID_CSP_YV12     (1<< 2) /* 4:2:0 packed(planar win32) */  #define XVID_CSP_I420     (1<< 1) /* 4:2:0 planar */
99    #define XVID_CSP_YV12     (1<< 2) /* 4:2:0 planar */
100  #define XVID_CSP_YUY2     (1<< 3) /* 4:2:2 packed */  #define XVID_CSP_YUY2     (1<< 3) /* 4:2:2 packed */
101  #define XVID_CSP_UYVY     (1<< 4) /* 4:2:2 packed */  #define XVID_CSP_UYVY     (1<< 4) /* 4:2:2 packed */
102  #define XVID_CSP_YVYU     (1<< 5) /* 4:2:2 packed */  #define XVID_CSP_YVYU     (1<< 5) /* 4:2:2 packed */
103  #define XVID_CSP_BGRA     (1<< 6) /* 32-bit bgra packed */  #define XVID_CSP_BGRA     (1<< 6) /* 32-bit bgra packed */
104  #define XVID_CSP_ABGR     (1<< 7) /* 32-bit abgr packed */  #define XVID_CSP_ABGR     (1<< 7) /* 32-bit abgr packed */
105  #define XVID_CSP_RGBA     (1<< 8) /* 32-bit rgba packed */  #define XVID_CSP_RGBA     (1<< 8) /* 32-bit rgba packed */
106    #define XVID_CSP_ARGB     (1<<15) /* 32-bit argb packed */
107  #define XVID_CSP_BGR      (1<< 9) /* 24-bit bgr packed */  #define XVID_CSP_BGR      (1<< 9) /* 24-bit bgr packed */
108  #define XVID_CSP_RGB555   (1<<10) /* 16-bit rgb555 packed */  #define XVID_CSP_RGB555   (1<<10) /* 16-bit rgb555 packed */
109  #define XVID_CSP_RGB565   (1<<11) /* 16-bit rgb565 packed */  #define XVID_CSP_RGB565   (1<<11) /* 16-bit rgb565 packed */
# Line 138  Line 137 
137  #define XVID_PROFILE_AS_L4   0xf4  #define XVID_PROFILE_AS_L4   0xf4
138    
139  /* aspect ratios */  /* aspect ratios */
140  #define XVID_PAR_11_VGA    1 /* 1:1 vga (square), default if AR is not precised (ie: ==0) */  #define XVID_PAR_11_VGA    1 /* 1:1 vga (square), default if supplied PAR is not a valid value */
141  #define XVID_PAR_43_PAL    2 /* 4:3 pal (12:11 625-line) */  #define XVID_PAR_43_PAL    2 /* 4:3 pal (12:11 625-line) */
142  #define XVID_PAR_43_NTSC   3 /* 4:3 ntsc (10:11 525-line) */  #define XVID_PAR_43_NTSC   3 /* 4:3 ntsc (10:11 525-line) */
143  #define XVID_PAR_169_PAL   4 /* 16:9 pal (16:11 625-line) */  #define XVID_PAR_169_PAL   4 /* 16:9 pal (16:11 625-line) */
# Line 159  Line 158 
158   * xvid_global()   * xvid_global()
159   ****************************************************************************/   ****************************************************************************/
160    
161  /* cpu_flags definitions */  /* cpu_flags definitions (make sure to sync this with cpuid.asm for ia32) */
162    
163  #define XVID_CPU_FORCE    (1<<31) /* force passed cpu flags */  #define XVID_CPU_FORCE    (1<<31) /* force passed cpu flags */
164  #define XVID_CPU_ASM      (1<< 7) /* native assembly */  #define XVID_CPU_ASM      (1<< 7) /* native assembly */
# Line 217  Line 216 
216  #define XVID_GBL_INIT    0 /* initialize xvidcore; must be called before using xvid_decore, or xvid_encore) */  #define XVID_GBL_INIT    0 /* initialize xvidcore; must be called before using xvid_decore, or xvid_encore) */
217  #define XVID_GBL_INFO    1 /* return some info about xvidcore, and the host computer */  #define XVID_GBL_INFO    1 /* return some info about xvidcore, and the host computer */
218  #define XVID_GBL_CONVERT 2 /* colorspace conversion utility */  #define XVID_GBL_CONVERT 2 /* colorspace conversion utility */
 #define XVID_GBL_TEST    3 /* testing.. */  
219    
220  int xvid_global(void *handle, int opt, void *param1, void *param2);  extern int xvid_global(void *handle, int opt, void *param1, void *param2);
221    
222    
223  /*****************************************************************************  /*****************************************************************************
# Line 230  Line 228 
228  #define XVID_DEC_DESTROY 1 /* destroy decore instance: return 0 on success */  #define XVID_DEC_DESTROY 1 /* destroy decore instance: return 0 on success */
229  #define XVID_DEC_DECODE  2 /* decode a frame: returns number of bytes consumed >= 0 */  #define XVID_DEC_DECODE  2 /* decode a frame: returns number of bytes consumed >= 0 */
230    
231  int xvid_decore(void *handle, int opt, void *param1, void *param2);  extern int xvid_decore(void *handle, int opt, void *param1, void *param2);
232    
233  /* XVID_DEC_CREATE param 1  /* XVID_DEC_CREATE param 1
234          image width & height may be specified here when the dimensions are          image width & height may be specified here when the dimensions are
# Line 247  Line 245 
245  /* general flags */  /* general flags */
246  #define XVID_LOWDELAY      (1<<0) /* lowdelay mode  */  #define XVID_LOWDELAY      (1<<0) /* lowdelay mode  */
247  #define XVID_DISCONTINUITY (1<<1) /* indicates break in stream */  #define XVID_DISCONTINUITY (1<<1) /* indicates break in stream */
248    #define XVID_DEBLOCKY      (1<<2) /* perform luma deblocking */
249    #define XVID_DEBLOCKUV     (1<<3) /* perform chroma deblocking */
250    #define XVID_FILMEFFECT    (1<<4) /* adds film grain */
251    #define XVID_DERINGUV      (1<<5) /* perform chroma deringing, requires deblocking to work */
252    #define XVID_DERINGY       (1<<6) /* perform luma deringing, requires deblocking to work */
253    
254    #define XVID_DEC_FAST      (1<<29) /* disable postprocessing to decrease cpu usage *todo* */
255    #define XVID_DEC_DROP      (1<<30) /* drop bframes to decrease cpu usage *todo* */
256    #define XVID_DEC_PREROLL   (1<<31) /* decode as fast as you can, don't even show output *todo* */
257    
258  typedef struct {  typedef struct {
259          int version;          int version;
# Line 254  Line 261 
261          void *bitstream;     /* [in]     bitstream (read from)*/          void *bitstream;     /* [in]     bitstream (read from)*/
262          int length;          /* [in]     bitstream length */          int length;          /* [in]     bitstream length */
263          xvid_image_t output; /* [in]     output image (written to) */          xvid_image_t output; /* [in]     output image (written to) */
264    /* ------- v1.1.x ------- */
265            int brightness;          /* [in]         brightness offset (0=none) */
266  } xvid_dec_frame_t;  } xvid_dec_frame_t;
267    
268    
# Line 278  Line 287 
287                          int general;        /* [out] flags */                          int general;        /* [out] flags */
288                          int width;          /* [out] width */                          int width;          /* [out] width */
289                          int height;         /* [out] height */                          int height;         /* [out] height */
290                          int par;            /* [out] picture aspect ratio (refer to XVID_PAR_xxx above) */                          int par;            /* [out] pixel aspect ratio (refer to XVID_PAR_xxx above) */
291                          int par_width;      /* [out] aspect ratio width */                          int par_width;      /* [out] aspect ratio width  [1..255] */
292                          int par_height;     /* [out] aspect ratio height */                          int par_height;     /* [out] aspect ratio height [1..255] */
293                  } vol;                  } vol;
294          } data;          } data;
295  } xvid_dec_stats_t;  } xvid_dec_stats_t;
296    
   
   
297  #define XVID_ZONE_QUANT  (1<<0)  #define XVID_ZONE_QUANT  (1<<0)
298  #define XVID_ZONE_WEIGHT (1<<1)  #define XVID_ZONE_WEIGHT (1<<1)
299    
# Line 299  Line 306 
306  } xvid_enc_zone_t;  } xvid_enc_zone_t;
307    
308    
309    /*----------------------------------------------------------------------------
310     * xvid_enc_stats_t structure
311     *
312     * Used in:
313     *  - xvid_plg_data_t structure
314     *  - optional parameter in xvid_encore() function
315     *
316     * .coding_type = XVID_TYPE_NOTHING if the stats are not given
317     *--------------------------------------------------------------------------*/
318    
319    typedef struct {
320            int version;
321    
322            /* encoding parameters */
323            int type;      /* [out] coding type */
324            int quant;     /* [out] frame quantizer */
325            int vol_flags; /* [out] vol flags (see above) */
326            int vop_flags; /* [out] vop flags (see above) */
327    
328            /* bitrate */
329            int length;    /* [out] frame length */
330    
331            int hlength;   /* [out] header length (bytes) */
332            int kblks;     /* [out] number of blocks compressed as Intra */
333            int mblks;     /* [out] number of blocks compressed as Inter */
334            int ublks;     /* [out] number of blocks marked as not_coded */
335    
336            int sse_y;     /* [out] Y plane's sse */
337            int sse_u;     /* [out] U plane's sse */
338            int sse_v;     /* [out] V plane's sse */
339    } xvid_enc_stats_t;
340    
341  /*****************************************************************************  /*****************************************************************************
342    xvid plugin system -- internals    xvid plugin system -- internals
# Line 314  Line 352 
352  #define XVID_PLG_DESTROY (1<<1)  #define XVID_PLG_DESTROY (1<<1)
353  #define XVID_PLG_INFO    (1<<2)  #define XVID_PLG_INFO    (1<<2)
354  #define XVID_PLG_BEFORE  (1<<3)  #define XVID_PLG_BEFORE  (1<<3)
355  #define XVID_PLG_AFTER   (1<<4)  #define XVID_PLG_FRAME   (1<<4)
356    #define XVID_PLG_AFTER   (1<<5)
357    
358  /* xvid_plg_info_t.flags */  /* xvid_plg_info_t.flags */
359  #define XVID_REQORIGINAL (1<<0) /* plugin requires a copy of the original (uncompressed) image */  #define XVID_REQORIGINAL (1<<0) /* plugin requires a copy of the original (uncompressed) image */
# Line 354  Line 393 
393          int num_frames; /* [out] total frame encoded */          int num_frames; /* [out] total frame encoded */
394  } xvid_plg_destroy_t;  } xvid_plg_destroy_t;
395    
   
396  typedef struct  typedef struct
397  {  {
398          int version;          int version;
# Line 386  Line 424 
424          int vol_flags;          /* [in,out] */          int vol_flags;          /* [in,out] */
425          int motion_flags;       /* [in,out] */          int motion_flags;       /* [in,out] */
426    
427    /* Deprecated, use the stats field instead.
428     * Will disapear before 1.0 */
429          int length;             /* [out] after: length of encoded frame */          int length;             /* [out] after: length of encoded frame */
430          int kblks;              /* [out] number of blocks compressed as Intra */          int kblks;              /* [out] number of blocks compressed as Intra */
431          int mblks;              /* [out] number of blocks compressed as Inter */          int mblks;              /* [out] number of blocks compressed as Inter */
# Line 393  Line 433 
433          int sse_y;              /* [out] Y plane's sse */          int sse_y;              /* [out] Y plane's sse */
434          int sse_u;              /* [out] U plane's sse */          int sse_u;              /* [out] U plane's sse */
435          int sse_v;              /* [out] V plane's sse */          int sse_v;              /* [out] V plane's sse */
436  } xvid_plg_data_t;  /* End of duplicated data, kept only for binary compatibility */
437    
438            int bquant_ratio;       /* [in] */
439            int bquant_offset;      /* [in] */
440    
441            xvid_enc_stats_t stats; /* [out] frame statistics */
442    } xvid_plg_data_t;
443    
444  /*****************************************************************************  /*****************************************************************************
445    xvid plugin system -- external    xvid plugin system -- external
# Line 425  Line 470 
470  } xvid_enc_plugin_t;  } xvid_enc_plugin_t;
471    
472    
473  xvid_plugin_func xvid_plugin_single;   /* single-pass rate control */  extern xvid_plugin_func xvid_plugin_single;   /* single-pass rate control */
474  xvid_plugin_func xvid_plugin_2pass1;   /* two-pass rate control: first pass */  extern xvid_plugin_func xvid_plugin_2pass1;   /* two-pass rate control: first pass */
475  xvid_plugin_func xvid_plugin_2pass2;   /* two-pass rate control: second pass */  extern xvid_plugin_func xvid_plugin_2pass2;   /* two-pass rate control: second pass */
476    
477  xvid_plugin_func xvid_plugin_lumimasking;  /* lumimasking */  extern xvid_plugin_func xvid_plugin_lumimasking;  /* lumimasking */
478    
479  xvid_plugin_func xvid_plugin_psnr;      /* write psnr values to stdout */  extern xvid_plugin_func xvid_plugin_psnr;       /* write psnr values to stdout */
480  xvid_plugin_func xvid_plugin_dump;      /* dump before and after yuvpgms */  extern xvid_plugin_func xvid_plugin_dump;       /* dump before and after yuvpgms */
481    
482    
483  /* single pass rate control  /* single pass rate control
# Line 461  Line 506 
506  typedef struct {  typedef struct {
507          int version;          int version;
508    
509          int bitrate;                  /* [in] bits per second */          int bitrate;                  /* [in] target bitrate (bits per second) */
510          char * filename;              /* [in] first pass stats filename */          char * filename;              /* [in] first pass stats filename */
511    
512          int keyframe_boost;           /* [in] keyframe boost percentage: [0..100] */          int keyframe_boost;           /* [in] keyframe boost percentage: [0..100] */
         int payback_method;           /* [in] Payback method: see XVID_PAYBACK flags */  
         int bitrate_payback_delay;    /* [in] Payback delay expressed in number of frames */  
513          int curve_compression_high;   /* [in] percentage of compression performed on the high part of the curve (above average) */          int curve_compression_high;   /* [in] percentage of compression performed on the high part of the curve (above average) */
514          int curve_compression_low;    /* [in] percentage of compression performed on the low  part of the curve (below average) */          int curve_compression_low;    /* [in] percentage of compression performed on the low  part of the curve (below average) */
515          int max_overflow_improvement; /* [in] */          int overflow_control_strength;/* [in] Payback delay expressed in number of frames */
516          int max_overflow_degradation; /* [in] */          int max_overflow_improvement; /* [in] percentage of allowed range for a frame that gets bigger because of overflow bonus */
517            int max_overflow_degradation; /* [in] percentage of allowed range for a frame that gets smaller because of overflow penalty */
518          int kftreshold;               /* [in] */  
519          int kfreduction;              /* [in] */          int kfreduction;              /* [in] maximum bitrate reduction applied to an iframe under the kfthreshold distance limit */
520          int min_key_interval;         /* [in] Minimum interval of frames between two IFrames */          int kfthreshold;              /* [in] if an iframe is closer to the next iframe than this distance, a quantity of bits
521                                                                       *      is substracted from its bit allocation. The reduction is computed as multiples of
522                                                                       *      kfreduction/kthreshold. It reaches kfreduction when the distance == kfthreshold,
523                                                                       *      0 for 1<distance<kfthreshold */
524    
525          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 */
 }xvid_plugin_2pass2_t;  
526    
527    /* ------- v1.1.x ------- */
528            int vbv_size;                 /* [in] buffer size (bits) */
529            int vbv_initial;              /* [in] initial buffer occupancy (bits) */
530            int vbv_maxrate;              /* [in] max processing bitrate (bits per second) */
531            int vbv_peakrate;             /* [in:opt] max average bitrate over 3 seconds (bits per second) */
532    
533    }xvid_plugin_2pass2_t;
534    
535  /*****************************************************************************  /*****************************************************************************
536   * xvid_encore()   *                             ENCODER API
537   ****************************************************************************/   ****************************************************************************/
538    
539  /* Encoder options */  /*----------------------------------------------------------------------------
540     * Encoder operations
541     *--------------------------------------------------------------------------*/
542    
543  #define XVID_ENC_CREATE  0 /* create encoder instance; returns 0 on success */  #define XVID_ENC_CREATE  0 /* create encoder instance; returns 0 on success */
544  #define XVID_ENC_DESTROY 1 /* destroy encoder instance; returns 0 on success */  #define XVID_ENC_DESTROY 1 /* destroy encoder instance; returns 0 on success */
545  #define XVID_ENC_ENCODE  2 /* encode a frame: returns number of ouput bytes  #define XVID_ENC_ENCODE  2 /* encode a frame: returns number of ouput bytes
546                              * 0 means this frame should not be written (ie. encoder lag) */                              * 0 means this frame should not be written (ie. encoder lag) */
547    
 int xvid_encore(void *handle, int opt, void *param1, void *param2);  
548    
549    /*----------------------------------------------------------------------------
550     * Encoder entry point
551     *--------------------------------------------------------------------------*/
552    
553    extern int xvid_encore(void *handle, int opt, void *param1, void *param2);
554    
555    /* Quick API reference
556     *
557     * XVID_ENC_CREATE operation
558     *  - handle: ignored
559     *  - opt: XVID_ENC_CREATE
560     *  - param1: address of a xvid_enc_create_t structure
561     *  - param2: ignored
562     *
563     * XVID_ENC_ENCODE operation
564     *  - handle: an instance returned by a CREATE op
565     *  - opt: XVID_ENC_ENCODE
566     *  - param1: address of a xvid_enc_frame_t structure
567     *  - param2: address of a xvid_enc_stats_t structure (optional)
568     *            its return value is asynchronous to what is written to the buffer
569     *            depending on the delay introduced by bvop use. It's display
570     *            ordered.
571     *
572     * XVID_ENC_DESTROY operation
573     *  - handle: an instance returned by a CREATE op
574     *  - opt: XVID_ENC_DESTROY
575     *  - param1: ignored
576     *  - param2: ignored
577     */
578    
579    
580    /*----------------------------------------------------------------------------
581     * "Global" flags
582     *
583     * These flags are used for xvid_enc_create_t->global field during instance
584     * creation (operation XVID_ENC_CREATE)
585     *--------------------------------------------------------------------------*/
586    
 /* Global Flags */  
587  #define XVID_GLOBAL_PACKED            (1<<0) /* packed bitstream */  #define XVID_GLOBAL_PACKED            (1<<0) /* packed bitstream */
588  #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 */
589  #define XVID_GLOBAL_EXTRASTATS_ENABLE (1<<2)  #define XVID_GLOBAL_EXTRASTATS_ENABLE (1<<2)
# Line 502  Line 591 
591  #define XVID_GLOBAL_VOL_AT_IVOP       (1<<3) /* write vol at every ivop: WIN32/divx compatibility */  #define XVID_GLOBAL_VOL_AT_IVOP       (1<<3) /* write vol at every ivop: WIN32/divx compatibility */
592  #define XVID_GLOBAL_FORCE_VOL         (1<<4) /* when vol-based parameters are changed, insert an ivop NOT recommended */  #define XVID_GLOBAL_FORCE_VOL         (1<<4) /* when vol-based parameters are changed, insert an ivop NOT recommended */
593  #endif  #endif
594    #define XVID_GLOBAL_DIVX5_USERDATA    (1<<5) /* write divx5 userdata string
595                                                    this is implied if XVID_GLOBAL_PACKED is set */
596    
597    /*----------------------------------------------------------------------------
598     * "VOL" flags
599     *
600     * These flags are used for xvid_enc_frame_t->vol_flags field during frame
601     * encoding (operation XVID_ENC_ENCODE)
602     *--------------------------------------------------------------------------*/
603    
 /* XVID_ENC_ENCODE param1 */  
 /* vol-based flags */  
604  #define XVID_VOL_MPEGQUANT      (1<<0) /* enable MPEG type quantization */  #define XVID_VOL_MPEGQUANT      (1<<0) /* enable MPEG type quantization */
605  #define XVID_VOL_EXTRASTATS     (1<<1) /* enable plane sse stats */  #define XVID_VOL_EXTRASTATS     (1<<1) /* enable plane sse stats */
606  #define XVID_VOL_QUARTERPEL     (1<<2) /* enable quarterpel: frames will encoded as quarterpel */  #define XVID_VOL_QUARTERPEL     (1<<2) /* enable quarterpel: frames will encoded as quarterpel */
607  #define XVID_VOL_GMC            (1<<3) /* enable GMC; frames will be checked for gmc suitability */  #define XVID_VOL_GMC            (1<<3) /* enable GMC; frames will be checked for gmc suitability */
608  #define XVID_VOL_REDUCED_ENABLE (1<<4) /* enable reduced resolution vops: frames will be checked for rrv suitability */  #define XVID_VOL_REDUCED_ENABLE (1<<4) /* enable reduced resolution vops: frames will be checked for rrv suitability */
609                                                                               /* NOTE:  the reduced resolution feature is not supported anymore. This flag will have no effect! */
610  #define XVID_VOL_INTERLACING    (1<<5) /* enable interlaced encoding */  #define XVID_VOL_INTERLACING    (1<<5) /* enable interlaced encoding */
611    
612    
613    /*----------------------------------------------------------------------------
614     * "VOP" flags
615     *
616     * These flags are used for xvid_enc_frame_t->vop_flags field during frame
617     * encoding (operation XVID_ENC_ENCODE)
618     *--------------------------------------------------------------------------*/
619    
620  /* vop based flags */  /* Always valid */
621  #define XVID_VOP_DEBUG           (1<< 0)  #define XVID_VOP_DEBUG                (1<< 0) /* print debug messages in frames */
622  #define XVID_VOP_HALFPEL         (1<< 1) /* use halfpel interpolation */  #define XVID_VOP_HALFPEL         (1<< 1) /* use halfpel interpolation */
623  #define XVID_VOP_INTER4V         (1<< 2)  #define XVID_VOP_INTER4V              (1<< 2) /* use 4 motion vectors per MB */
624  #define XVID_VOP_TRELLISQUANT    (1<< 3) /* use trellis based R-D "optimal" quantization */  #define XVID_VOP_TRELLISQUANT    (1<< 3) /* use trellis based R-D "optimal" quantization */
625  #define XVID_VOP_CHROMAOPT       (1<< 4) /* enable chroma optimization pre-filter */  #define XVID_VOP_CHROMAOPT       (1<< 4) /* enable chroma optimization pre-filter */
626  #define XVID_VOP_CARTOON         (1<< 5) /* use 'cartoon mode' */  #define XVID_VOP_CARTOON         (1<< 5) /* use 'cartoon mode' */
627  #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) */
628  #define XVID_VOP_HQACPRED        (1<< 7) /* high quality ac prediction */  #define XVID_VOP_HQACPRED        (1<< 7) /* high quality ac prediction */
629  #define XVID_VOP_MODEDECISION_RD (1<< 8) /* enable DCT-ME and use it for mode decision */  #define XVID_VOP_MODEDECISION_RD (1<< 8) /* enable DCT-ME and use it for mode decision */
630  /* only valid for vol_flags|=XVID_VOL_INTERLACING */  #define XVID_VOP_FAST_MODEDECISION_RD (1<<12) /* use simplified R-D mode decision */
631    #define XVID_VOP_RD_BVOP              (1<<13) /* enable rate-distortion mode decision in b-frames */
632    
633    /* Only valid for vol_flags|=XVID_VOL_INTERLACING */
634  #define XVID_VOP_TOPFIELDFIRST   (1<< 9) /* set top-field-first flag  */  #define XVID_VOP_TOPFIELDFIRST   (1<< 9) /* set top-field-first flag  */
635  #define XVID_VOP_ALTERNATESCAN   (1<<10) /* set alternate vertical scan flag */  #define XVID_VOP_ALTERNATESCAN   (1<<10) /* set alternate vertical scan flag */
636    
637  /* only valid for vol_flags|=XVID_VOL_REDUCED_ENABLED */  /* only valid for vol_flags|=XVID_VOL_REDUCED_ENABLED */
638  #define XVID_VOP_REDUCED         (1<<11) /* reduced resolution vop */  #define XVID_VOP_REDUCED         (1<<11) /* reduced resolution vop */
639                                                                                              /* NOTE: reduced resolution feature is not supported anymore. This flag will have no effect! */
640    
641  #define XVID_VOP_FAST_MODEDECISION_RD (1<< 12) /* use simplified R-D mode decision */  /*----------------------------------------------------------------------------
642     * "Motion" flags
643     *
644     * These flags are used for xvid_enc_frame_t->motion field during frame
645     * encoding (operation XVID_ENC_ENCODE)
646     *--------------------------------------------------------------------------*/
647    
648  /* Motion based flags */  /* Motion Estimation Search Patterns */
649  #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 */
650  #define XVID_ME_ADVANCEDDIAMOND8      (1<< 1) /* use advdiamond for XVID_ME_EXTSEARCH8 */  #define XVID_ME_ADVANCEDDIAMOND8      (1<< 1) /* use advdiamond for XVID_ME_EXTSEARCH8 */
651  #define XVID_ME_USESQUARES16          (1<< 2) /* use squares instead of diamonds as search pattern */  #define XVID_ME_USESQUARES16          (1<< 2) /* use squares instead of diamonds as search pattern */
652  #define XVID_ME_USESQUARES8           (1<< 3) /* use square for XVID_ME_EXTSEARCH8 */  #define XVID_ME_USESQUARES8           (1<< 3) /* use square for XVID_ME_EXTSEARCH8 */
653    
654    /* SAD operator based flags */
655  #define XVID_ME_HALFPELREFINE16       (1<< 4)  #define XVID_ME_HALFPELREFINE16       (1<< 4)
656  #define XVID_ME_HALFPELREFINE8        (1<< 6)  #define XVID_ME_HALFPELREFINE8        (1<< 6)
657  #define XVID_ME_QUARTERPELREFINE16    (1<< 7)  #define XVID_ME_QUARTERPELREFINE16    (1<< 7)
# Line 549  Line 661 
661  #define XVID_ME_EXTSEARCH8            (1<<11) /* use diamond/square for extended 8x8 search */  #define XVID_ME_EXTSEARCH8            (1<<11) /* use diamond/square for extended 8x8 search */
662  #define XVID_ME_CHROMA_PVOP           (1<<12) /* also use chroma for P_VOP/S_VOP ME */  #define XVID_ME_CHROMA_PVOP           (1<<12) /* also use chroma for P_VOP/S_VOP ME */
663  #define XVID_ME_CHROMA_BVOP           (1<<13) /* also use chroma for B_VOP ME */  #define XVID_ME_CHROMA_BVOP           (1<<13) /* also use chroma for B_VOP ME */
664    #define XVID_ME_FASTREFINE16          (1<<25) /* use low-complexity refinement functions */
665    #define XVID_ME_FASTREFINE8           (1<<29) /* low-complexity 8x8 sub-block refinement */
666    
667  /* Motion search using DCT. use XVID_VOP_MODEDECISION_BITS to enable */  /* Rate Distortion based flags
668     * Valid when XVID_VOP_MODEDECISION_RD is enabled */
669  #define XVID_ME_HALFPELREFINE16_RD    (1<<14) /* perform RD-based halfpel refinement */  #define XVID_ME_HALFPELREFINE16_RD    (1<<14) /* perform RD-based halfpel refinement */
670  #define XVID_ME_HALFPELREFINE8_RD     (1<<15) /* perform RD-based halfpel refinement for 8x8 mode */  #define XVID_ME_HALFPELREFINE8_RD     (1<<15) /* perform RD-based halfpel refinement for 8x8 mode */
671  #define XVID_ME_QUARTERPELREFINE16_RD (1<<16) /* perform RD-based qpel refinement */  #define XVID_ME_QUARTERPELREFINE16_RD (1<<16) /* perform RD-based qpel refinement */
# Line 558  Line 673 
673  #define XVID_ME_EXTSEARCH_RD          (1<<18) /* perform RD-based search using square pattern enable XVID_ME_EXTSEARCH8 to do this in 8x8 search as well */  #define XVID_ME_EXTSEARCH_RD          (1<<18) /* perform RD-based search using square pattern enable XVID_ME_EXTSEARCH8 to do this in 8x8 search as well */
674  #define XVID_ME_CHECKPREDICTION_RD    (1<<19) /* always check vector equal to prediction */  #define XVID_ME_CHECKPREDICTION_RD    (1<<19) /* always check vector equal to prediction */
675    
676    /* Other */
677    #define XVID_ME_DETECT_STATIC_MOTION  (1<<24) /* speed-up ME by detecting stationary scenes */
678    #define XVID_ME_SKIP_DELTASEARCH      (1<<26) /* speed-up by skipping b-frame delta search */
679    #define XVID_ME_FAST_MODEINTERPOLATE  (1<<27) /* speed-up by partly skipping interpolate mode */
680    #define XVID_ME_BFRAME_EARLYSTOP      (1<<28) /* speed-up by early exiting b-search */
681    
682    /* Unused */
683  #define XVID_ME_UNRESTRICTED16        (1<<20) /* unrestricted ME, not implemented */  #define XVID_ME_UNRESTRICTED16        (1<<20) /* unrestricted ME, not implemented */
684  #define XVID_ME_OVERLAPPING16         (1<<21) /* overlapping ME, not implemented */  #define XVID_ME_OVERLAPPING16         (1<<21) /* overlapping ME, not implemented */
685  #define XVID_ME_UNRESTRICTED8         (1<<22) /* unrestricted ME, not implemented */  #define XVID_ME_UNRESTRICTED8         (1<<22) /* unrestricted ME, not implemented */
686  #define XVID_ME_OVERLAPPING8          (1<<23) /* overlapping ME, not implemented */  #define XVID_ME_OVERLAPPING8          (1<<23) /* overlapping ME, not implemented */
687    
 #define XVID_ME_DETECT_STATIC_MOTION  (1<<24) /* speed-up ME by detecting stationary scenes */  
 #define XVID_ME_FASTREFINE16              (1<<25) /* use low-complexity refinement functions */  
688    
689  /* XVID_ENC_CREATE param1 */  /*----------------------------------------------------------------------------
690     * xvid_enc_create_t structure definition
691     *
692     * This structure is passed as param1 during an instance creation (operation
693     * XVID_ENC_CREATE)
694     *--------------------------------------------------------------------------*/
695    
696  typedef struct {  typedef struct {
697          int version;          int version;
698    
# Line 603  Line 729 
729          /* ---------------------------------------------- */          /* ---------------------------------------------- */
730    
731          void *handle;                /* [out] encoder instance handle */          void *handle;                /* [out] encoder instance handle */
732  }  } xvid_enc_create_t;
 xvid_enc_create_t;  
733    
734    
735    /*----------------------------------------------------------------------------
736     * xvid_enc_frame_t structure definition
737     *
738     * This structure is passed as param1 during a frame encoding (operation
739     * XVID_ENC_ENCODE)
740     *--------------------------------------------------------------------------*/
741    
742    /* out value for the frame structure->type field
743     * unlike stats output in param2, this field is not asynchronous and tells
744     * the client app, if the frame written into the stream buffer is an ivop
745     * usually used for indexing purpose in the container */
746  #define XVID_KEYFRAME (1<<1)  #define XVID_KEYFRAME (1<<1)
747    
748    /* The structure */
749  typedef struct {  typedef struct {
750          int version;          int version;
751    
752          /* --- VOL related stuff; unless XVID_FORCEVOL is set, the encoder will not react to any changes here until the next VOL (keyframe). */          /* VOL related stuff
753             * unless XVID_FORCEVOL is set, the encoder will not react to any changes
754             * here until the next VOL (keyframe). */
755    
756          int vol_flags;                     /* [in] vol flags */          int vol_flags;                     /* [in] vol flags */
757          unsigned char *quant_intra_matrix; /* [in:opt] custom intra qmatrix */          unsigned char *quant_intra_matrix; /* [in:opt] custom intra qmatrix */
758          unsigned char *quant_inter_matrix; /* [in:opt] custom inter qmatrix */          unsigned char *quant_inter_matrix; /* [in:opt] custom inter qmatrix */
759    
760          int par;                           /* [in:opt] picture aspect ratio (refer to XVID_PAR_xxx above) */          int par;                           /* [in:opt] pixel aspect ratio (refer to XVID_PAR_xxx above) */
761          int par_width;                     /* [in:opt] aspect ratio width */          int par_width;                     /* [in:opt] aspect ratio width */
762          int par_height;                    /* [in:opt] aspect ratio height */          int par_height;                    /* [in:opt] aspect ratio height */
763          /* ---------------------------------------------- */  
764            /* Other fields that can change on a frame base */
765    
766          int fincr;                         /* [in:opt] framerate increment, for variable framerate only */          int fincr;                         /* [in:opt] framerate increment, for variable framerate only */
767          int vop_flags;                     /* [in] (general)vop-based flags */          int vop_flags;                     /* [in] (general)vop-based flags */
# Line 638  Line 779 
779          int out_flags;                     /* [out] bitstream output flags */          int out_flags;                     /* [out] bitstream output flags */
780  } xvid_enc_frame_t;  } xvid_enc_frame_t;
781    
   
 /* XVID_ENC_ENCODE param2 (optional)  
         xvid_enc_stats_t describes individual frame details  
   
         coding_type==XVID_TYPE_NOTHING if the stats are not given  
 */  
 typedef struct {  
         int version;  
   
         /* encoding parameters */  
         int type;      /* [out] coding type */  
         int quant;     /* [out] frame quantizer */  
         int vol_flags; /* [out] vol flags (see above) */  
         int vop_flags; /* [out] vop flags (see above) */  
   
         /* bitrate */  
         int length;    /* [out] frame length */  
   
         int hlength;   /* [out] header length (bytes) */  
         int kblks;     /* [out] number of blocks compressed as Intra */  
         int mblks;     /* [out] number of blocks compressed as Inter */  
         int ublks;     /* [out] number of blocks marked as not_coded */  
   
         int sse_y;     /* [out] Y plane's sse */  
         int sse_u;     /* [out] U plane's sse */  
         int sse_v;     /* [out] V plane's sse */  
 } xvid_enc_stats_t;  
   
782  #ifdef __cplusplus  #ifdef __cplusplus
783  }  }
784  #endif  #endif
785    
   
786  #endif  #endif

Legend:
Removed from v.1.27.2.36  
changed lines
  Added in v.1.51.2.4

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.4