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

Diff of /xvidcore/src/xvid.h

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

revision 1.19, Wed Sep 4 22:26:04 2002 UTC revision 1.22, Mon Nov 4 12:50:24 2002 UTC
# Line 37  Line 37 
37  extern "C" {  extern "C" {
38  #endif  #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   * Global constants   *  API version number
50   ****************************************************************************/   ****************************************************************************/
51    
52  /* API Version : 2.1 */  /**
53  #define API_VERSION ((2 << 16) | (1))   * \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     * 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     */
66    
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     * The requested XviD operation failed. If this error code is returned from :
83     * <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  /* Error codes */  #define XVID_ERR_OK      0 /**< Operation succeed.
97  #define XVID_ERR_FAIL   -1                              *
98  #define XVID_ERR_OK      0   * The requested XviD operation succeed, you can continue to use XviD's
99  #define XVID_ERR_MEMORY  1   * functions.
100  #define XVID_ERR_FORMAT  2   */
101    
102    #define XVID_ERR_MEMORY  1 /**< Operation failed.
103                                *
104     * Insufficent memory was available on the host system.
105     */
106    
107  /* Colorspaces */  #define XVID_ERR_FORMAT  2 /**< Operation failed.
108  #define XVID_CSP_RGB24  0                              *
109  #define XVID_CSP_YV12   1   * The format of the parameters or input stream were incorrect.
110  #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  
111    
112  #define XVID_CSP_VFLIP  0x80000000 // flip mask  /** @} */
113    
114    
115  /*****************************************************************************  /*****************************************************************************
116   *  Initialization constants   *  Color space constants
117   ****************************************************************************/   ****************************************************************************/
118    
 /* CPU flags for XVID_INIT_PARAM.cpu_flags */  
119    
120          /* x86 cpu flags */  /**
121  #define XVID_CPU_MMX      0x00000001   * \defgroup csp_grp Colorspaces constants.
122  #define XVID_CPU_MMXEXT   0x00000002   * @{
123  #define XVID_CPU_SSE      0x00000004   */
 #define XVID_CPU_SSE2     0x00000008  
 #define XVID_CPU_3DNOW    0x00000010  
 #define XVID_CPU_3DNOWEXT 0x00000020  
 #define XVID_CPU_TSC      0x00000040  
124    
125          /* ia64 cpu flags */  #define XVID_CSP_RGB24  0  /**< 24-bit RGB colorspace (b,g,r packed) */
126  #define XVID_CPU_IA64     0x00000080  #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    #define XVID_CSP_VFLIP  0x80000000 /**< (flag) Flip frame vertically during conversion */
151    
152    /** @} */
153    
154    /** @} */
155    
156    /**
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  #define XVID_CPU_CHKONLY  0x40000000 /* check cpu only; dont init globals */  
166  #define XVID_CPU_FORCE    0x80000000  /*****************************************************************************
167     *  CPU flags
168     ****************************************************************************/
169    
170    
171    /**
172     * \defgroup cpu_grp Flags for XVID_INIT_PARAM.cpu_flags.
173     *
174     * This section describes all constants that show host cpu available features,
175     * and allow a client application to force usage of some cpu instructions sets.
176     * @{
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_FORCE    0x80000000 /**< Force input flags to be used
222                                          *
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    /** @} */
228    
229    /** @} */
230    
231  /*****************************************************************************  /*****************************************************************************
232   *  Initialization structures   *  Initialization structures
233   ****************************************************************************/   ****************************************************************************/
234    
235    /** Structure used in xvid_init function. */
236          typedef struct          typedef struct
237          {          {
238                  int cpu_flags;                  int cpu_flags;   /**< [in/out]
239                  int api_version;                                    *
240                  int core_build;                                    * 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 107  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 158  Line 348 
348   * Decoder entry point   * Decoder entry point
349   ****************************************************************************/   ****************************************************************************/
350    
351  /* decoder options */  /**
352  #define XVID_DEC_DECODE         0   * \defgroup  decops_grp Decoder operations
353  #define XVID_DEC_CREATE         1   *
354  #define XVID_DEC_DESTROY        2   * 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   * ToDo : Remove this part when BFRAMES stuff will be out of XviD stable tree   * \defgroup encgenflags_grp  Flags for XVID_ENC_FRAME.general
421     * @{
422     */
423    
424    #define XVID_VALID_FLAGS                0x80000000 /**< Reserved for future use */
425    
426    #define XVID_CUSTOM_QMATRIX             0x00000004 /**< Use custom quantization matrices
427                                                                                            *
428     * 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_H263QUANT                  0x00000010 /**< Use H263 quantization
431                                                                                            *
432     * This flag forces XviD to use H263  quantization type */
433    #define XVID_MPEGQUANT                  0x00000020 /**< Use MPEG4 quantization.
434                                                                                            *
435     * This flag forces XviD to use MPEG4 quantization type */
436    #define XVID_HALFPEL                    0x00000040 /**< Halfpel motion estimation
437                                                                                            *
438    * informs xvid to perform a half pixel  motion estimation. */
439    #define XVID_ADAPTIVEQUANT              0x00000080/**< Adaptive quantization
440                                                                                            *
441    * informs xvid to perform an adaptative quantization using a Luminance
442    * masking algorithm */
443    #define XVID_LUMIMASKING                0x00000100/**< Lumimasking flag
444                                                                                            *
445                                                                                            * \deprecated This flag is no longer used. */
446    #define XVID_LATEINTRA                  0x00000200/**< Unknown
447                                                                                            *
448                                                                                            * \deprecated This flag is no longer used. */
449    #define XVID_INTERLACING                0x00000400/**< MPEG4 interlacing mode.
450                                                                                            *
451                                                                                            * Enables interlacing encoding mode */
452    #define XVID_TOPFIELDFIRST              0x00000800/**< Unknown
453                                                *
454                                                                                            * \deprecated This flag is no longer used. */
455    #define XVID_ALTERNATESCAN              0x00001000/**<
456                                                                                            *
457                                                                                            * \deprecated This flag is no longer used. */
458    #define XVID_HINTEDME_GET               0x00002000/**< Gets Motion vector data from ME system.
459                                                                                            *
460    * informs  xvid to  return  Motion Estimation vectors from the ME encoder
461    * algorithm. Used during a first pass. */
462    #define XVID_HINTEDME_SET               0x00004000/**< Gives Motion vectors hint to ME system.
463                                                                                            *
464    * informs xvid to  use the user  given motion estimation vectors as hints
465    * for the encoder ME algorithms. Used during a 2nd pass. */
466    #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 XVID_GLOBAL_PACKED   0x00000001 /* packed bitstream */  #define PMV_ADVANCEDDIAMOND16   0x00008000/**< Uses advanced diamonds for 16x16 blocks
506  #define XVID_GLOBAL_DX50BVOP 0x00000002 /* dx50 bvop compatibility */                                                                                          *
507  #define XVID_GLOBAL_DEBUG    0x00000004 /* print debug info on each frame */  * */
508    #define PMV_HALFPELDIAMOND16    0x00010000/**< Turns on halfpel precision for 16x16 blocks
509  /* Flags for XVID_ENC_FRAME.general */                                                                                          *
510  #define XVID_VALID_FLAGS                0x80000000  * switches the search algorithm from 1 or 2 full pixels precision to 1 or 2 half pixel precision.
511    */
512  #define XVID_CUSTOM_QMATRIX             0x00000004      /* use custom quant matrix */  #define PMV_HALFPELREFINE16     0x00020000/**< Turns on halfpel refinement step
513  #define XVID_H263QUANT                  0x00000010                                                                                          *
514  #define XVID_MPEGQUANT                  0x00000020  * After normal diamond search, an extra halfpel refinement step is  performed. Should always be used if
515  #define XVID_HALFPEL                    0x00000040      /* use halfpel interpolation */  * XVID_HALFPEL is on, because it gives a rather big increase in quality.
516  #define XVID_ADAPTIVEQUANT              0x00000080  */
517  #define XVID_LUMIMASKING                0x00000100  #define PMV_EXTSEARCH16                 0x00040000/**< Extends search for 16x16 blocks
518  #define XVID_LATEINTRA                  0x00000200                                                                                          *
519    * Normal PMVfast predicts one  start vector and  does diamond search around this position. EXTSEARCH means that 2
520  #define XVID_INTERLACING                0x00000400      /* enable interlaced encoding */  * more  start vectors  are used:  (0,0) and  median  predictor and diamond search  is done for  those, too.  Makes
521  #define XVID_TOPFIELDFIRST              0x00000800      /* set top-field-first flag  */  * search slightly slower, but quality sometimes gets better.
522  #define XVID_ALTERNATESCAN              0x00001000      /* set alternate vertical scan flag */  */
523    #define PMV_EARLYSTOP16                 0x00080000/**< Dynamic ME thresholding
524  #define XVID_HINTEDME_GET               0x00002000      /* receive mv hint data from core (1st pass) */                                                                                          *
525  #define XVID_HINTEDME_SET               0x00004000      /* send mv hint data to core (2nd pass) */  * 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  #define XVID_INTER4V                    0x00008000  * but not really lead to better quality.
528    */
529  #define XVID_ME_ZERO                    0x00010000  #define PMV_QUICKSTOP16                 0x00100000/**< Dynamic ME thresholding
530  #define XVID_ME_LOGARITHMIC             0x00020000                                                                                          *
531  #define XVID_ME_FULLSEARCH              0x00040000  * like  EARLYSTOP, but not even halfpel refinement is  done. Normally worse quality, so it defaults to
532  #define XVID_ME_PMVFAST                 0x00080000  * off. Might be removed, too.
533  #define XVID_ME_EPZS                    0x00100000  */
534    #define PMV_UNRESTRICTED16      0x00200000/**< Not implemented
535                                                                                            *
536  #define XVID_GREYSCALE                  0x01000000         /* enable greyscale only mode (even for */  * "unrestricted  ME"   is  a   feature  of MPEG4. It's not  implemented, so this flag is  ignored (not even
537  #define XVID_GRAYSCALE                  XVID_GREYSCALE /* color input material chroma is ignored) */  * checked).
538    */
539    #define PMV_OVERLAPPING16       0x00400000/**< Not implemented
540  /* Flags for XVID_ENC_FRAME.motion */                                                                                          *
541  #define PMV_ADVANCEDDIAMOND8    0x00004000  * Same as above
542  #define PMV_ADVANCEDDIAMOND16   0x00008000  */
543    #define PMV_USESQUARES16                0x00800000/**< Use square pattern
544  #define PMV_HALFPELDIAMOND16    0x00010000                                                                                          *
545  #define PMV_HALFPELREFINE16     0x00020000  * Replace  the  diamond search  with a  square search.
546  #define PMV_EXTSEARCH16                 0x00040000      /* extend PMV by more searches */  */
547  #define PMV_EARLYSTOP16                 0x00080000  #define PMV_HALFPELDIAMOND8     0x01000000/**< see 16x16 equivalent
548  #define PMV_QUICKSTOP16                 0x00100000      /* like early, but without any more refinement */                                                                                          *
549  #define PMV_UNRESTRICTED16      0x00200000      /* unrestricted ME, not implemented */  * Same as its 16x16 companion option */
550  #define PMV_OVERLAPPING16       0x00400000      /* overlapping ME, not implemented */  #define PMV_HALFPELREFINE8              0x02000000/**< see 16x16 equivalent
551  #define PMV_USESQUARES16                0x00800000                                                                                          *
552    * Same as its 16x16 companion option */
553  #define PMV_HALFPELDIAMOND8     0x01000000  #define PMV_EXTSEARCH8                  0x04000000/**< see 16x16 equivalent
554  #define PMV_HALFPELREFINE8              0x02000000                                                                                          *
555  #define PMV_EXTSEARCH8                  0x04000000      /* extend PMV by more searches */  * Same as its 16x16 companion option */
556  #define PMV_EARLYSTOP8                  0x08000000  #define PMV_EARLYSTOP8                  0x08000000/**< see 16x16 equivalent
557  #define PMV_QUICKSTOP8                  0x10000000      /* like early, but without any more refinement */                                                                                          *
558  #define PMV_UNRESTRICTED8       0x20000000      /* unrestricted ME, not implemented */  * Same as its 16x16 companion option */
559  #define PMV_OVERLAPPING8                0x40000000      /* overlapping ME, not implemented */  #define PMV_QUICKSTOP8                  0x10000000/**< see 16x16 equivalent
560  #define PMV_USESQUARES8                 0x80000000                                                                                          *
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;                  int width;                    /**< [in]
582                  int height;                                                                             *
583                  int fincr;                                                                             * Input frame width. */
584                  int fbase;                    /* frame increment, fbase. each frame = "fincr/fbase" seconds */                  int height;                   /**< [in]
585                  int rc_bitrate;               /* the bitrate of the target encoded stream, in bits/second */                                                                             *
586                  int rc_reaction_delay_factor; /* how fast the rate control reacts - lower values are faster */                                                                             * Input frame height. */
587                  int rc_averaging_period;      /* as above */                  int fincr;                    /**< [in]
588                  int rc_buffer;                /* as above */                                                                             *
589                  int max_quantizer;            /* the upper limit of the quantizer */                                                                             * Time increment (fps = increment/base). */
590                  int min_quantizer;            /* the lower limit of the quantizer */                  int fbase;                    /**< [in]
591                  int max_key_interval;         /* the maximum interval between key frames */                                                                             *
592  #ifdef _SMP                                                                             * Time base (fps = increment/base). */
593                  int num_threads;              /* number of threads */                  int rc_bitrate;               /**< [in]
594  #endif                                                                             *
595                  void *handle;                 /* [out] encoder instance handle */                                                                             * Sets the target bitrate of the encoded stream, in bits/second. **/
596                    int rc_reaction_delay_factor; /**< [in]
597                                                                               *
598                                                                               * Tunes how fast the rate control reacts - lower values are faster. */
599                    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    
# Line 290  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                                                                                            * mv hint information */
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 hlength;                    /* [out] header length (bytes) */                                                                    *
721                  int kblks, mblks, ublks;        /* [out] */                                                                    * Frame quantizer used during encoding */
722                    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 326  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.1.19  
changed lines
  Added in v.1.22

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