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

Diff of /trunk/xvidcore/src/xvid.h

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

revision 199, Thu Jun 13 12:42:18 2002 UTC revision 629, Mon Nov 4 12:50:24 2002 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     *  This program is an implementation of a part of one or more MPEG-4
7     *  Video tools as specified in ISO/IEC 14496-2 standard.  Those intending
8     *  to use this software module in hardware or software products are
9     *  advised that its use may infringe existing patents or copyrights, and
10     *  any such use would be at such party's own risk.  The original
11     *  developer of this software module and his/her company, and subsequent
12     *  editors and their companies, will have no liability for use of this
13     *  software or modifications or derivatives thereof.
14     *
15  *  This program is free software ; you can redistribute it and/or modify  *  This program is free software ; you can redistribute it and/or modify
16  *  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
17  *  the Free Software Foundation ; either version 2 of the License, or  *  the Free Software Foundation ; either version 2 of the License, or
# Line 17  Line 26 
26  *  along with this program ; if not, write to the Free Software  *  along with this program ; if not, write to the Free Software
27  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
28  *  *
29     * $Id: xvid.h,v 1.22 2002-11-04 12:50:24 suxen_drol Exp $
30     *
31  *****************************************************************************/  *****************************************************************************/
32    
33    #ifndef _XVID_H_
34    #define _XVID_H_
35    
36    #ifdef __cplusplus
37    extern "C" {
38    #endif
39    
40    
41    /**
42     * \defgroup global_grp   Global constants used in both encoder and decoder.
43     *
44     * This module describe all constants used in both the encoder and the decoder.
45     * @{
46     */
47    
48  /*****************************************************************************  /*****************************************************************************
49     *  API version number
50     ****************************************************************************/
51    
52    /**
53     * \defgroup api_grp API version
54     * @{
55     */
56    
57    #define API_VERSION ((2 << 16) | (1))/**< This constant tells you what XviD's
58                                          *   version this header defines.
59  *  *
60  *  History   * You can use it to check if the host XviD library API is the same as the one
61     * you used to build you client program. If versions mismatch, then it is
62     * highly possible that your application will segfault because the host XviD
63     * library and your application use different structures.
64  *  *
65  *  - 2002/06/13 Added legal header, ANSI C comment style (only for this header   */
66  *               as it can be included in a ANSI C project).  
67    /** @} */
68    
69    
70    /*****************************************************************************
71     *  Error codes
72     ****************************************************************************/
73    
74    
75    /**
76     * \defgroup error_grp Error codes returned by XviD API entry points.
77     * @{
78     */
79    
80    #define XVID_ERR_FAIL   -1 /**< Operation failed.
81  *  *
82  *               ToDo ? : when BFRAMES is defined, the API_VERSION should not   * The requested XviD operation failed. If this error code is returned from :
83  *                        be the same (3.0 ?)   * <ul>
84     * <li>the xvid_init function : you must not try to use an XviD's instance from
85     *                              this point of the code. Clean all instances you
86     *                              already created and exit the program cleanly.
87     * <li>xvid_encore or xvid_decore : something was wrong and en/decoding
88     *                                  operation was not completed sucessfully.
89     *                                  you can stop the en/decoding process or just
90     *                                                                      ignore and go on.
91     * <li>xvid_stop : you can safely ignore it if you call this function at the
92     *                 end of your program.
93     * </ul>
94     */
95    
96    #define XVID_ERR_OK      0 /**< Operation succeed.
97  *  *
98  *  $Id: xvid.h,v 1.10 2002-06-13 12:42:18 edgomez Exp $   * The requested XviD operation succeed, you can continue to use XviD's
99     * functions.
100     */
101    
102    #define XVID_ERR_MEMORY  1 /**< Operation failed.
103  *  *
104  *****************************************************************************/   * Insufficent memory was available on the host system.
105     */
106    
107    #define XVID_ERR_FORMAT  2 /**< Operation failed.
108                                *
109     * The format of the parameters or input stream were incorrect.
110     */
111    
112  #ifndef _XVID_H_  /** @} */
 #define _XVID_H_  
113    
 #ifdef __cplusplus  
 *  $Id: xvid.h,v 1.10 2002-06-13 12:42:18 edgomez Exp $  
 #endif  
114    
115  /*****************************************************************************  /*****************************************************************************
116   * Global constants   *  Color space constants
117   ****************************************************************************/   ****************************************************************************/
118    
 /* API Version : 2.1 */  
 #define API_VERSION ((2 << 16) | (1))  
119    
120    /**
121     * \defgroup csp_grp Colorspaces constants.
122     * @{
123     */
124    
125    #define XVID_CSP_RGB24  0  /**< 24-bit RGB colorspace (b,g,r packed) */
126    #define XVID_CSP_YV12   1  /**< YV12 colorspace (y,v,u planar) */
127    #define XVID_CSP_YUY2   2  /**< YUY2 colorspace (y,u,y,v packed) */
128    #define XVID_CSP_UYVY   3  /**< UYVY colorspace (u,y,v,y packed) */
129    #define XVID_CSP_I420   4  /**< I420 colorsapce (y,u,v planar) */
130    #define XVID_CSP_RGB555 10 /**< 16-bit RGB555 colorspace */
131    #define XVID_CSP_RGB565 11 /**< 16-bit RGB565 colorspace */
132    #define XVID_CSP_USER   12 /**< user colorspace format, where the image buffer points
133                                *   to a DEC_PICTURE (y,u,v planar) structure.
134                                                            *
135                                                            *   For encoding, image is read from the DEC_PICTURE
136                                                            *   parameter values. For decoding, the DEC_PICTURE
137                                *   parameters are set, pointing to the internal XviD
138                                *   image buffer. */
139    #define XVID_CSP_EXTERN 1004 /**< Special colorspace used for slice rendering
140                                  *
141                                  * The application provides an external buffer to XviD.
142                                  * This way, XviD works directly into the final rendering
143                                  * buffer, no need to specify this is a speed boost feature.
144                                  * This feature is only used by mplayer at the moment, refer
145                                  * to mplayer code to see how it can be used. */
146    #define XVID_CSP_YVYU   1002 /**< YVYU colorspace (y,v,y,u packed) */
147    #define XVID_CSP_RGB32  1000 /**< 32-bit RGB colorspace (b,g,r,a packed) */
148    #define XVID_CSP_NULL   9999 /**< NULL colorspace; no conversion is performed */
149    
150  /* Error codes */  #define XVID_CSP_VFLIP  0x80000000 /**< (flag) Flip frame vertically during conversion */
 #define XVID_ERR_FAIL           -1  
 #define XVID_ERR_OK                     0  
 #define XVID_ERR_MEMORY         1  
 #define XVID_ERR_FORMAT         2  
151    
152    /** @} */
153    
154  /* Colorspaces */  /** @} */
 #define XVID_CSP_RGB24  0  
 #define XVID_CSP_YV12   1  
 #define XVID_CSP_YUY2   2  
 #define XVID_CSP_UYVY   3  
 #define XVID_CSP_I420   4  
 #define XVID_CSP_RGB555 10  
 #define XVID_CSP_RGB565 11  
 #define XVID_CSP_USER   12  
 #define XVID_CSP_EXTERN      1004  // per slice rendering  
 #define XVID_CSP_YVYU   1002  
 #define XVID_CSP_RGB32  1000  
 #define XVID_CSP_NULL   9999  
155    
156  #define XVID_CSP_VFLIP  0x80000000      // flip mask  /**
157     * \defgroup init_grp Initialization constants, structures and functions.
158     *
159     * This section describes all the constants, structures and functions used to
160     * initialize the XviD core library
161     *
162     * @{
163     */
164    
165    
166  /*****************************************************************************  /*****************************************************************************
167     *  CPU flags
168   ****************************************************************************/   ****************************************************************************/
169    
 /* CPU flags for XVID_INIT_PARAM.cpu_flags */  
170    
171  #define XVID_CPU_MMX            0x00000001  /**
172  #define XVID_CPU_MMXEXT         0x00000002   * \defgroup cpu_grp Flags for XVID_INIT_PARAM.cpu_flags.
173  #define XVID_CPU_SSE            0x00000004   *
174  #define XVID_CPU_SSE2           0x00000008   * This section describes all constants that show host cpu available features,
175  #define XVID_CPU_3DNOW          0x00000010   * and allow a client application to force usage of some cpu instructions sets.
176  #define XVID_CPU_3DNOWEXT       0x00000020   * @{
177     */
178    
179    
180    /**
181     * \defgroup x86_grp x86 specific cpu flags
182     * @{
183     */
184    
185    #define XVID_CPU_MMX      0x00000001 /**< use/has MMX instruction set */
186    #define XVID_CPU_MMXEXT   0x00000002 /**< use/has MMX-ext (pentium3) instruction set */
187    #define XVID_CPU_SSE      0x00000004 /**< use/has SSE (pentium3) instruction set */
188    #define XVID_CPU_SSE2     0x00000008 /**< use/has SSE2 (pentium4) instruction set */
189    #define XVID_CPU_3DNOW    0x00000010 /**< use/has 3dNOW (k6-2) instruction set */
190    #define XVID_CPU_3DNOWEXT 0x00000020 /**< use/has 3dNOW-ext (athlon) instruction set */
191    #define XVID_CPU_TSC      0x00000040 /**< has TimeStampCounter instruction */
192    
193    /** @} */
194    
195    /**
196     * \defgroup ia64_grp ia64 specific cpu flags.
197     * @{
198     */
199    
200    #define XVID_CPU_IA64     0x00000080 /**< Forces ia64 optimized code usage
201     *
202     * This flags allow client applications to force IA64 optimized functions.
203     * This feature is considered exeperimental and should be treated as is.
204     */
205    
206    /** @} */
207    
208    /**
209     * \defgroup iniflags_grp Initialization commands.
210     *
211     * @{
212     */
213    
214    #define XVID_CPU_CHKONLY  0x40000000 /**< Check cpu features
215                                          *
216     * When this flag is set, the xvid_init function performs just a cpu feature
217     * checking and then fills the cpu field. This flag is usefull when client
218     * applications want to know what instruction sets the host cpu supports.
219     */
220    
221  #define XVID_CPU_TSC            0x00000040  #define XVID_CPU_FORCE    0x80000000 /**< Force input flags to be used
222  #define XVID_CPU_IA64           0x00000080                                        *
223     * When this flag is set, client application forces XviD to use other flags
224     * set in cpu_flags. \b Use this at your own risk.
225     */
226    
227  #define XVID_CPU_CHKONLY        0x40000000              /* check cpu only; dont init globals */  /** @} */
 #define XVID_CPU_FORCE          0x80000000  
228    
229    /** @} */
230    
231    /*****************************************************************************
232   *  Initialization structures   *  Initialization structures
233                  int cpu_flags;   ****************************************************************************/
234                  int api_version;  
235                  int core_build;  /** Structure used in xvid_init function. */
236            typedef struct
237            {
238                    int cpu_flags;   /**< [in/out]
239                                      *
240                                      * Filled with desired[in] or available[out]
241                                      * cpu instruction sets.
242                                      */
243                    int api_version; /**< [out]
244                                      *
245                                      * xvid_init will initialize this field with
246                                      * the API_VERSION used in this XviD core
247                                      * library
248                                      */
249                    int core_build;  /**< [out]
250                                      * \todo Unused.
251                                      */
252          }          }
253          XVID_INIT_PARAM;          XVID_INIT_PARAM;
254    
# Line 102  Line 256 
256   *  Initialization entry point   *  Initialization entry point
257   ****************************************************************************/   ****************************************************************************/
258    
259    /**
260     * \defgroup inientry_grp Initialization entry point.
261     * @{
262     */
263    
264    /**
265     * \brief Initialization entry point.
266     *
267     * This is the XviD's initialization entry point, it is only used to initialize
268     * the XviD internal data (function pointers, vector length code tables,
269     * rgb2yuv lookup tables).
270     *
271     * \param handle Reserved for future use.
272     * \param opt Reserved for future use (set it to 0).
273     * \param param1 Used to pass an XVID_INIT_PARAM parameter.
274     * \param param2 Reserved for future use.
275     */
276          int xvid_init(void *handle,          int xvid_init(void *handle,
277                                    int opt,                                    int opt,
278                                    void *param1,                                    void *param1,
279                                    void *param2);                                    void *param2);
280    
281    /** @} */
282    
283    /** @} */
284    
285  /*****************************************************************************  /*****************************************************************************
286   * Decoder constants   * Decoder constant
287   ****************************************************************************/   ****************************************************************************/
288    
289  /* Flags for XVID_DEC_FRAME.general */  /**
290     * \defgroup decoder_grp Decoder related functions and structures.
291     *
292     *  This part describes all the structures/functions from XviD's API needed for
293     *  decoding a MPEG4 compliant streams.
294     *  @{
295     */
296    
297    /**
298     * \defgroup decframe_grp Flags for XVID_DEC_FRAME.general
299     *
300     * Flags' description for the XVID_DEC_FRAME.general member.
301     *
302     * @{
303     */
304    
305    /** Not used at the moment */
306  #define XVID_QUICK_DECODE               0x00000010  #define XVID_QUICK_DECODE               0x00000010
307    
308    
309    /**
310     * @}
311     */
312    
313  /*****************************************************************************  /*****************************************************************************
314   * Decoder structures   * Decoder structures
315   ****************************************************************************/   ****************************************************************************/
# Line 148  Line 343 
343                  int stride_y, stride_u,stride_v;                  int stride_y, stride_u,stride_v;
344          } XVID_DEC_PICTURE;          } XVID_DEC_PICTURE;
345    
346  #define XVID_DEC_DESTROY        2  
347    /*****************************************************************************
348     * Decoder entry point
349     ****************************************************************************/
350    
351    /**
352     * \defgroup  decops_grp Decoder operations
353     *
354     * These are all the operations XviD's decoder can perform.
355     *
356     * @{
357     */
358    
359    #define XVID_DEC_DECODE         0 /**< Decodes a frame
360                                       *
361     * This operation constant is used when client application wants to decode a
362     * frame. Client application must also fill XVID_DEC_FRAME appropriately.
363     */
364    
365    #define XVID_DEC_CREATE         1 /**< Creates a decoder instance
366                                       *
367     * This operation constant is used by a client application in order to create
368     * a decoder instance. Decoder instances are independant from each other, and
369     * can be safely threaded.
370     */
371    
372    #define XVID_DEC_DESTROY        2 /**< Destroys a decoder instance
373                                       *
374     * This operation constant is used by the client application to destroy a
375     * previously created decoder instance.
376     */
377    
378    /**
379     * @}
380     */
381    
382    /**
383     * \defgroup  decentry_grp Decoder entry point
384     *
385     * @{
386     */
387    
388    /**
389     * \brief Decoder entry point.
390     *
391     * This is the XviD's decoder entry point. The possible operations are
392     * described in the \ref decops_grp section.
393     *
394     * \param handle Decoder instance handle.
395     * \param opt Decoder option constant
396     * \param param1 Used to pass a XVID_DEC_PARAM or XVID_DEC_FRAME structure
397     * \param param2 Reserved for future use.
398     */
399    
400          int xvid_decore(void *handle,          int xvid_decore(void *handle,
401                                          int opt,                                          int opt,
402                                          void *param1,                                          void *param1,
403                                          void *param2);                                          void *param2);
404    
405    /** @} */
406    
407    /** @} */
408    
409    /**
410     * \defgroup encoder_grp Encoder related functions and structures.
411     *
412     * @{
413     */
414    
415  /*****************************************************************************  /*****************************************************************************
416   * Encoder constants   * Encoder constants
417   ****************************************************************************/   ****************************************************************************/
418    
419  /* Flags for XVID_ENC_PARAM.global */  /**
420  #define XVID_GLOBAL_PACKED              0x00000001      /* packed bitstream */   * \defgroup encgenflags_grp  Flags for XVID_ENC_FRAME.general
421  #define XVID_GLOBAL_DX50BVOP    0x00000002      /* dx50 bvop compatibility */   * @{
422  #define XVID_GLOBAL_DEBUG               0x00000004      /* print debug info on each frame */   */
423    
424  /* Flags for XVID_ENC_FRAME.general */  #define XVID_VALID_FLAGS                0x80000000 /**< Reserved for future use */
425  #define XVID_VALID_FLAGS                0x80000000  
426    #define XVID_CUSTOM_QMATRIX             0x00000004 /**< Use custom quantization matrices
427  #define XVID_CUSTOM_QMATRIX             0x00000004      /* use custom quant matrix */                                                                                          *
428  #define XVID_LATEINTRA                  0x00000200   * This flag forces XviD to use custom matrices passed to encoder in
429     * XVID_ENC_FRAME structure (members quant_intra_matrix and quant_inter_matrix) */
430  #define XVID_INTERLACING                0x00000400      /* enable interlaced encoding */  #define XVID_H263QUANT                  0x00000010 /**< Use H263 quantization
431  #define XVID_TOPFIELDFIRST              0x00000800      /* set top-field-first flag  */                                                                                          *
432  #define XVID_ALTERNATESCAN              0x00001000      /* set alternate vertical scan flag */   * This flag forces XviD to use H263  quantization type */
433    #define XVID_MPEGQUANT                  0x00000020 /**< Use MPEG4 quantization.
434  #define XVID_HINTEDME_GET               0x00002000      /* receive mv hint data from core (1st pass) */                                                                                          *
435  #define XVID_HINTEDME_SET               0x00004000      /* send mv hint data to core (2nd pass) */   * This flag forces XviD to use MPEG4 quantization type */
436    #define XVID_HALFPEL                    0x00000040 /**< Halfpel motion estimation
437  #define XVID_INTER4V                    0x00008000                                                                                          *
438    * informs xvid to perform a half pixel  motion estimation. */
439  #define XVID_ME_ZERO                    0x00010000  #define XVID_ADAPTIVEQUANT              0x00000080/**< Adaptive quantization
440  #define XVID_ME_LOGARITHMIC             0x00020000                                                                                          *
441  #define XVID_ME_FULLSEARCH              0x00040000  * informs xvid to perform an adaptative quantization using a Luminance
442  #define XVID_ME_PMVFAST                 0x00080000  * masking algorithm */
443  #define XVID_ME_EPZS                    0x00100000  #define XVID_LUMIMASKING                0x00000100/**< Lumimasking flag
444                                                                                            *
445                                                                                            * \deprecated This flag is no longer used. */
446  #define XVID_GREYSCALE                  0x01000000      /* enable greyscale only mode (even for */  #define XVID_LATEINTRA                  0x00000200/**< Unknown
447  #define XVID_GRAYSCALE                  0x01000000      /* color input material chroma is ignored) */                                                                                          *
448                                                                                            * \deprecated This flag is no longer used. */
449    #define XVID_INTERLACING                0x00000400/**< MPEG4 interlacing mode.
450  /* Flags for XVID_ENC_FRAME.motion */                                                                                          *
451  #define PMV_ADVANCEDDIAMOND8    0x00004000                                                                                          * Enables interlacing encoding mode */
452  #define PMV_ADVANCEDDIAMOND16   0x00008000  #define XVID_TOPFIELDFIRST              0x00000800/**< Unknown
453  #define PMV_EARLYSTOP16                 0x00080000                                              *
454  #define PMV_QUICKSTOP16                 0x00100000      /* like early, but without any more refinement */                                                                                          * \deprecated This flag is no longer used. */
455  #define PMV_UNRESTRICTED16      0x00200000      /* unrestricted ME, not implemented */  #define XVID_ALTERNATESCAN              0x00001000/**<
456  #define PMV_OVERLAPPING16       0x00400000      /* overlapping ME, not implemented */                                                                                          *
457  #define PMV_USESQUARES16                0x00800000                                                                                          * \deprecated This flag is no longer used. */
458    #define XVID_HINTEDME_GET               0x00002000/**< Gets Motion vector data from ME system.
459  #define PMV_HALFPELDIAMOND8     0x01000000                                                                                          *
460  #define PMV_HALFPELREFINE8              0x02000000  * informs  xvid to  return  Motion Estimation vectors from the ME encoder
461  #define PMV_EXTSEARCH8                  0x04000000      /* extend PMV by more searches */  * algorithm. Used during a first pass. */
462  #define PMV_EARLYSTOP8                  0x08000000  #define XVID_HINTEDME_SET               0x00004000/**< Gives Motion vectors hint to ME system.
463  #define PMV_QUICKSTOP8                  0x10000000      /* like early, but without any more refinement */                                                                                          *
464  #define PMV_UNRESTRICTED8       0x20000000      /* unrestricted ME, not implemented */  * informs xvid to  use the user  given motion estimation vectors as hints
465  #define PMV_OVERLAPPING8                0x40000000      /* overlapping ME, not implemented */  * for the encoder ME algorithms. Used during a 2nd pass. */
466  #define PMV_USESQUARES8                 0x80000000  #define XVID_INTER4V                    0x00008000/**< Inter4V mode.
467                                                                                            *
468    * forces XviD to search a vector for each 8x8 block within the 16x16  Macro
469    * Block. This mode should  be used only if the XVID_HALFPEL mode is  activated
470    * (this  could change  in the future). */
471    #define XVID_ME_ZERO                    0x00010000/**< Unused
472                                                                                            *
473    * Do not use this flag (reserved for future use) */
474    #define XVID_ME_LOGARITHMIC             0x00020000/**< Unused
475                                                                                            *
476    * Do not use this flag (reserved for future use) */
477    #define XVID_ME_FULLSEARCH              0x00040000/**< Unused
478                                                                                            *
479    * Do not use this flag (reserved for future use) */
480    #define XVID_ME_PMVFAST                 0x00080000/**< Use PMVfast ME algorithm.
481                                                                                            *
482    * Switches XviD ME algorithm to PMVfast */
483    #define XVID_ME_EPZS                    0x00100000/**< Use EPZS ME algorithm.
484                                                                                            *
485    * Switches XviD ME algorithm to EPZS */
486    #define XVID_GREYSCALE                  0x01000000/**< Discard chroma data.
487                                                                                            *
488    * This flags forces XviD to discard chroma data, this is not mpeg4 greyscale
489    * mode, it simply drops chroma MBs using cbp == 0 for these blocks */
490    #define XVID_GRAYSCALE                  XVID_GREYSCALE /**< XVID_GREYSCALE alias
491                                                                                            *
492    * United States locale support. */
493    
494    /** @} */
495    
496    /**
497     * \defgroup encmotionflags_grp  Flags for XVID_ENC_FRAME.motion
498     * @{
499     */
500    
501    #define PMV_ADVANCEDDIAMOND8    0x00004000/**< Uses advanced diamonds for 8x8 blocks
502                                                                                            *
503    * Same as its 16x16 companion option
504    */
505    #define PMV_ADVANCEDDIAMOND16   0x00008000/**< Uses advanced diamonds for 16x16 blocks
506                                                                                            *
507    * */
508    #define PMV_HALFPELDIAMOND16    0x00010000/**< Turns on halfpel precision for 16x16 blocks
509                                                                                            *
510    * switches the search algorithm from 1 or 2 full pixels precision to 1 or 2 half pixel precision.
511    */
512    #define PMV_HALFPELREFINE16     0x00020000/**< Turns on halfpel refinement step
513                                                                                            *
514    * After normal diamond search, an extra halfpel refinement step is  performed. Should always be used if
515    * XVID_HALFPEL is on, because it gives a rather big increase in quality.
516    */
517    #define PMV_EXTSEARCH16                 0x00040000/**< Extends search for 16x16 blocks
518                                                                                            *
519    * Normal PMVfast predicts one  start vector and  does diamond search around this position. EXTSEARCH means that 2
520    * more  start vectors  are used:  (0,0) and  median  predictor and diamond search  is done for  those, too.  Makes
521    * search slightly slower, but quality sometimes gets better.
522    */
523    #define PMV_EARLYSTOP16                 0x00080000/**< Dynamic ME thresholding
524                                                                                            *
525    * PMVfast and EPZS stop search  if current best is  below some dynamic  threshhold. No  diamond search  is done,
526    * only halfpel  refinement (if active).  Without EARLYSTOP diamond search is always done. That would be much slower,
527    * but not really lead to better quality.
528    */
529    #define PMV_QUICKSTOP16                 0x00100000/**< Dynamic ME thresholding
530                                                                                            *
531    * like  EARLYSTOP, but not even halfpel refinement is  done. Normally worse quality, so it defaults to
532    * off. Might be removed, too.
533    */
534    #define PMV_UNRESTRICTED16      0x00200000/**< Not implemented
535                                                                                            *
536    * "unrestricted  ME"   is  a   feature  of MPEG4. It's not  implemented, so this flag is  ignored (not even
537    * checked).
538    */
539    #define PMV_OVERLAPPING16       0x00400000/**< Not implemented
540                                                                                            *
541    * Same as above
542    */
543    #define PMV_USESQUARES16                0x00800000/**< Use square pattern
544                                                                                            *
545    * Replace  the  diamond search  with a  square search.
546    */
547    #define PMV_HALFPELDIAMOND8     0x01000000/**< see 16x16 equivalent
548                                                                                            *
549    * Same as its 16x16 companion option */
550    #define PMV_HALFPELREFINE8              0x02000000/**< see 16x16 equivalent
551                                                                                            *
552    * Same as its 16x16 companion option */
553    #define PMV_EXTSEARCH8                  0x04000000/**< see 16x16 equivalent
554                                                                                            *
555    * Same as its 16x16 companion option */
556    #define PMV_EARLYSTOP8                  0x08000000/**< see 16x16 equivalent
557                                                                                            *
558    * Same as its 16x16 companion option */
559    #define PMV_QUICKSTOP8                  0x10000000/**< see 16x16 equivalent
560                                                                                            *
561    * Same as its 16x16 companion option */
562    #define PMV_UNRESTRICTED8       0x20000000/**< see 16x16 equivalent
563                                                                                            *
564    * Same as its 16x16 companion option */
565    #define PMV_OVERLAPPING8                0x40000000/**< see 16x16 equivalent
566                                                                                            *
567    * Same as its 16x16 companion option */
568    #define PMV_USESQUARES8                 0x80000000/**< see 16x16 equivalent
569                                                                                            *
570    * Same as its 16x16 companion option */
571    
572    /** @} */
573    
574  /*****************************************************************************  /*****************************************************************************
575   * Encoder structures   * Encoder structures
576   ****************************************************************************/   ****************************************************************************/
577    
578            /** Structure used for encoder instance creation */
579          typedef struct          typedef struct
580          {          {
581                  int width, height;                  int width;                    /**< [in]
582                  int fincr, fbase;               /* frame increment, fbase. each frame = "fincr/fbase" seconds */                                                                             *
583                  int rc_bitrate;                 /* the bitrate of the target encoded stream, in bits/second */                                                                             * Input frame width. */
584                  int rc_reaction_delay_factor;   /* how fast the rate control reacts - lower values are faster */                  int height;                   /**< [in]
585                  int rc_averaging_period;        /* as above */                                                                             *
586                  int rc_buffer;                  /* as above */                                                                             * Input frame height. */
587                  int max_quantizer;              /* the upper limit of the quantizer */                  int fincr;                    /**< [in]
588                  int min_quantizer;              /* the lower limit of the quantizer */                                                                             *
589                  int max_key_interval;   /* the maximum interval between key frames */                                                                             * Time increment (fps = increment/base). */
590  #ifdef _SMP                  int fbase;                    /**< [in]
591                  int num_threads;                /* number of threads */                                                                             *
592  #endif                                                                             * Time base (fps = increment/base). */
593  #ifdef BFRAMES                  int rc_bitrate;               /**< [in]
594                  int global;                             /* global/debug options */                                                                             *
595                  int max_bframes;                /* max sequential bframes (0=disable bframes) */                                                                             * Sets the target bitrate of the encoded stream, in bits/second. **/
596                  int bquant_ratio;               /* bframe quantizer multipier (percentage).                  int rc_reaction_delay_factor; /**< [in]
597                                                                   * used only when bquant < 1                                                                             *
598                                                                   * eg. 200 = x2 multiplier                                                                             * Tunes how fast the rate control reacts - lower values are faster. */
599  #endif                  int rc_averaging_period;      /**< [in]
600                                                                               *
601                                                                               * Tunes how fast the rate control reacts - lower values are faster. */
602                    int rc_buffer;                /**< [in]
603                                                                               *
604                                                                               * Tunes how fast the rate control reacts - lower values are faster. */
605                    int max_quantizer;            /**< [in]
606                                                                               *
607                                                                               * Sets the upper limit of the quantizer. */
608                    int min_quantizer;            /**< [in]
609                                                                               *
610                                                                               * Sets the lower limit of the quantizer. */
611                    int max_key_interval;         /**< [in]
612                                                                               *
613                                                                               * Sets the maximum interval between key frames. */
614                    void *handle;                 /**< [out]
615                                                                               *
616                                                                               * XviD core lib will set this with the creater encoder instance. */
617          }          }
618          XVID_ENC_PARAM;          XVID_ENC_PARAM;
619    
620          typedef struct          typedef struct
621          {          {
622                  int x;                  int x;
623                    int y;
624          }          }
625          VECTOR;          VECTOR;
626    
# Line 269  Line 649 
649          }          }
650          HINTINFO;          HINTINFO;
651    
652            /** Structure used to pass a frame to the encoder */
653          typedef struct          typedef struct
654          {          {
655                  int general;                    /* [in] general options */                  int general;                       /**< [in]
656                  int motion;                             /* [in] ME options */                                                                                          *
657                  void *bitstream;                /* [in] bitstream ptr */                                                                                          * Sets general options flag (See \ref encgenflags_grp) */
658                  int length;                             /* [out] bitstream length (bytes) */                  int motion;                        /**< [in]
659                                                                                            *
660                  void *image;                    /* [in] image ptr */                                                                                          * Sets Motion Estimation options */
661                  int colorspace;                 /* [in] source colorspace */                  void *bitstream;                   /**< [out]
662                                                                                            *
663                  unsigned char *quant_intra_matrix;      // [in] custom intra qmatrix */                                                                                          * Output MPEG4 bitstream buffer pointer */
664                  unsigned char *quant_inter_matrix;      // [in] custom inter qmatrix */                  int length;                        /**< [out]
665                  int quant;                              /* [in] frame quantizer (vbr) */                                                                                          *
666                  int intra;                              /* [in] force intra frame (vbr only)                                                                                          * Output MPEG4 bitstream length (bytes) */
667                                                                   * [out] intra state                  void *image;                       /**< [in]
668                                                                                            *
669                                                                                            * Input frame */
670                    int colorspace;                    /**< [in]
671                                                                                            *
672                                                                                            * input frame colorspace */
673                    unsigned char *quant_intra_matrix; /**< [in]
674                                                                                            *
675                                                                                            * Custom intra quantization matrix */
676                    unsigned char *quant_inter_matrix; /**< [in]
677                                                                                            *
678                                                                                            * Custom inter quantization matrix */
679                    int quant;                         /**< [in]
680                                                                                            *
681                                                                                            * Frame quantizer :
682                                                                                            * <ul>
683                                                                                            * <li> 0 (zero) : Then the  rate controler chooses the right quantizer
684                                                                                            *                 for you.  Typically used in ABR encoding, or first pass of a VBR
685                                                                                            *                 encoding session.
686                                                                                            * <li> !=  0  :  Then you  force  the  encoder  to use  this  specific
687                                                                                            *                  quantizer   value.     It   is   clamped    in   the   interval
688                                                                                            *                  [1..31]. Tipically used  during the 2nd pass of  a VBR encoding
689                                                                                            *                  session.
690                                                                                            * </ul> */
691                    int intra;                         /**< [in/out]
692                                                                                            *
693                                                                                            * <ul>
694                                                                                            * <li> [in] : tells XviD if the frame must be encoded as an intra frame
695                                                                                            *     <ul>
696                                                                                            *     <li> 1: forces the encoder  to create a keyframe. Mainly used during
697                                                                                            *              a VBR 2nd pass.
698                                                                                            *     <li> 0:  forces the  encoder not to  create a keyframe.  Minaly used
699                                                                                            *               during a VBR second pass
700                                                                                            *     <li> -1: let   the  encoder   decide  (based   on   contents  and
701                                                                                            *              max_key_interval). Mainly  used in ABR  mode and during  a 1st
702                                                                                            *              VBR pass.
703                                                                                            *     </ul>
704                                                                                            * <li> [out] : When first set to -1, the encoder returns the effective keyframe state
705                                                                                            *              of the frame.
706                                                                                            * </ul>
707                                                                   */                                                                   */
708                  HINTINFO hint;                  /* [in/out] mv hint information */                  HINTINFO hint;                     /**< [in/out]
709                                                                                            *
710  #ifdef BFRAMES                                                                                          * mv hint information */
                 int bquant;                             /* [in] bframe quantizer */  
 #endif  
711    
712          }          }
713          XVID_ENC_FRAME;          XVID_ENC_FRAME;
714    
715    
716            /** Encoding statistics */
717          typedef struct          typedef struct
718          {          {
719                  int quant;                              /* [out] frame quantizer */                  int quant;               /**< [out]
720                  int input_consumed;             /* [out] */                                                                    *
721                  int hlength;                    /* [out] header length (bytes) */                                                                    * Frame quantizer used during encoding */
722                  int kblks, mblks, ublks;        /* [out] */                  int hlength;             /**< [out]
723                                                                      *
724                                                                      * Header bytes in the resulting MPEG4 stream */
725                    int kblks;               /**< [out]
726                                                                      *
727                                                                      * Number of intra macro blocks  */
728                    int mblks;               /**< [out]
729                                                                      *
730                                                                      * Number of inter macro blocks */
731                    int ublks;               /**< [out]
732                                                                      *
733                                                                      * Number of skipped macro blocks */
734          }          }
735          XVID_ENC_STATS;          XVID_ENC_STATS;
736    
# Line 310  Line 739 
739   * Encoder entry point   * Encoder entry point
740   ****************************************************************************/   ****************************************************************************/
741    
742  /* Encoder options */  /**
743  #define XVID_ENC_ENCODE         0   * \defgroup  encops_grp Encoder operations
744  #define XVID_ENC_CREATE         1   *
745  #define XVID_ENC_DESTROY        2   * These are all the operations XviD's encoder can perform.
746     *
747     * @{
748     */
749    
750    #define XVID_ENC_ENCODE         0 /**< Encodes a frame
751                                       *
752     * This operation constant is used when client application wants to encode a
753     * frame. Client application must also fill XVID_ENC_FRAME appropriately.
754     */
755    
756    #define XVID_ENC_CREATE         1 /**< Creates a decoder instance
757                                       *
758     * This operation constant is used by a client application in order to create
759     * an encoder instance. Encoder instances are independant from each other.
760     */
761    
762    #define XVID_ENC_DESTROY        2 /**< Destroys a encoder instance
763                                       *
764     * This operation constant is used by the client application to destroy a
765     * previously created encoder instance.
766     */
767    
768    
769    /** @} */
770    
771    /**
772     * \defgroup  encentry_grp Encoder entry point
773     *
774     * @{
775     */
776    
777    /**
778     * \brief Encoder entry point.
779     *
780     * This is the XviD's encoder entry point. The possible operations are
781     * described in the \ref encops_grp section.
782     *
783     * \param handle Encoder instance handle
784     * \param opt Encoder option constant
785     * \param param1 Used to pass XVID_ENC_PARAM or XVID_ENC_FRAME structures.
786     * \param param2 Optionally used to pass the XVID_ENC_STATS structure.
787     */
788          int xvid_encore(void *handle,          int xvid_encore(void *handle,
789                                          int opt,                                          int opt,
790                                          void *param1,                                          void *param1,
791                                          void *param2);                                          void *param2);
792    
793    /** @} */
794    
795    /** @} */
796    
797  #ifdef __cplusplus  #ifdef __cplusplus
798  }  }

Legend:
Removed from v.199  
changed lines
  Added in v.629

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