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

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

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