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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 629 - (view) (download)

1 : edgomez 199 /*****************************************************************************
2 : edgomez 411 *
3 :     * XVID MPEG-4 VIDEO CODEC
4 :     * - 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
16 :     * 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
18 :     * (at your option) any later version.
19 :     *
20 :     * This program is distributed in the hope that it will be useful,
21 :     * but WITHOUT ANY WARRANTY ; without even the implied warranty of
22 :     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 :     * GNU General Public License for more details.
24 :     *
25 :     * You should have received a copy of the GNU General Public License
26 :     * along with this program ; if not, write to the Free Software
27 :     * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 :     *
29 : suxen_drol 629 * $Id: xvid.h,v 1.22 2002-11-04 12:50:24 suxen_drol Exp $
30 : edgomez 411 *
31 :     *****************************************************************************/
32 : edgomez 199
33 :     #ifndef _XVID_H_
34 :     #define _XVID_H_
35 :    
36 :     #ifdef __cplusplus
37 : chl 352 extern "C" {
38 : edgomez 199 #endif
39 :    
40 : edgomez 608
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 : edgomez 199 /*****************************************************************************
49 : edgomez 608 * API version number
50 : edgomez 199 ****************************************************************************/
51 :    
52 : edgomez 608 /**
53 :     * \defgroup api_grp API version
54 :     * @{
55 :     */
56 : edgomez 199
57 : edgomez 608 #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 : suxen_drol 629 * library and your application use different structures.
64 : edgomez 608 *
65 :     */
66 : edgomez 199
67 : edgomez 608 /** @} */
68 : edgomez 199
69 :    
70 : edgomez 608 /*****************************************************************************
71 :     * Error codes
72 :     ****************************************************************************/
73 : edgomez 199
74 :    
75 : edgomez 608 /**
76 : suxen_drol 629 * \defgroup error_grp Error codes returned by XviD API entry points.
77 : edgomez 608 * @{
78 :     */
79 : edgomez 199
80 : edgomez 608 #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 : suxen_drol 629 * operation was not completed sucessfully.
89 :     * you can stop the en/decoding process or just
90 :     * ignore and go on.
91 : edgomez 608 * <li>xvid_stop : you can safely ignore it if you call this function at the
92 :     * end of your program.
93 :     * </ul>
94 :     */
95 :    
96 :     #define XVID_ERR_OK 0 /**< Operation succeed.
97 :     *
98 :     * The requested XviD operation succeed, you can continue to use XviD's
99 :     * functions.
100 :     */
101 :    
102 :     #define XVID_ERR_MEMORY 1 /**< Operation failed.
103 :     *
104 : suxen_drol 629 * Insufficent memory was available on the host system.
105 : edgomez 608 */
106 :    
107 :     #define XVID_ERR_FORMAT 2 /**< Operation failed.
108 :     *
109 : suxen_drol 629 * The format of the parameters or input stream were incorrect.
110 : edgomez 608 */
111 :    
112 :     /** @} */
113 :    
114 :    
115 : edgomez 199 /*****************************************************************************
116 : edgomez 608 * Color space constants
117 : edgomez 199 ****************************************************************************/
118 :    
119 :    
120 : edgomez 608 /**
121 :     * \defgroup csp_grp Colorspaces constants.
122 :     * @{
123 :     */
124 : edgomez 199
125 : suxen_drol 629 #define XVID_CSP_RGB24 0 /**< 24-bit RGB colorspace (b,g,r packed) */
126 :     #define XVID_CSP_YV12 1 /**< YV12 colorspace (y,v,u planar) */
127 :     #define XVID_CSP_YUY2 2 /**< YUY2 colorspace (y,u,y,v packed) */
128 :     #define XVID_CSP_UYVY 3 /**< UYVY colorspace (u,y,v,y packed) */
129 :     #define XVID_CSP_I420 4 /**< I420 colorsapce (y,u,v planar) */
130 :     #define XVID_CSP_RGB555 10 /**< 16-bit RGB555 colorspace */
131 :     #define XVID_CSP_RGB565 11 /**< 16-bit RGB565 colorspace */
132 :     #define XVID_CSP_USER 12 /**< user colorspace format, where the image buffer points
133 :     * to a DEC_PICTURE (y,u,v planar) structure.
134 :     *
135 :     * For encoding, image is read from the DEC_PICTURE
136 :     * parameter values. For decoding, the DEC_PICTURE
137 :     * parameters are set, pointing to the internal XviD
138 :     * image buffer. */
139 : edgomez 608 #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 : suxen_drol 629 #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 : Isibaar 209
150 : suxen_drol 629 #define XVID_CSP_VFLIP 0x80000000 /**< (flag) Flip frame vertically during conversion */
151 : edgomez 199
152 : edgomez 608 /** @} */
153 : edgomez 199
154 : edgomez 608 /** @} */
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 :    
166 : Isibaar 209 /*****************************************************************************
167 : edgomez 608 * 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 : suxen_drol 629 #define XVID_CPU_3DNOWEXT 0x00000020 /**< use/has 3dNOW-ext (athlon) instruction set */
191 : edgomez 608 #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 : suxen_drol 629 *
202 : edgomez 608 * 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 : edgomez 199 * Initialization structures
233 : Isibaar 209 ****************************************************************************/
234 :    
235 : edgomez 608 /** Structure used in xvid_init function. */
236 : Isibaar 209 typedef struct
237 : suxen_drol 234 {
238 : edgomez 608 int cpu_flags; /**< [in/out]
239 :     *
240 :     * Filled with desired[in] or available[out]
241 :     * cpu instruction sets.
242 :     */
243 :     int api_version; /**< [out]
244 :     *
245 :     * xvid_init will initialize this field with
246 :     * the API_VERSION used in this XviD core
247 :     * library
248 :     */
249 :     int core_build; /**< [out]
250 : suxen_drol 629 * \todo Unused.
251 : edgomez 608 */
252 : edgomez 199 }
253 :     XVID_INIT_PARAM;
254 :    
255 :     /*****************************************************************************
256 :     * Initialization entry point
257 :     ****************************************************************************/
258 :    
259 : edgomez 608 /**
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 : edgomez 199 int xvid_init(void *handle,
277 : edgomez 608 int opt,
278 :     void *param1,
279 :     void *param2);
280 : edgomez 199
281 : edgomez 608 /** @} */
282 : edgomez 199
283 : edgomez 608 /** @} */
284 :    
285 : edgomez 199 /*****************************************************************************
286 : edgomez 608 * Decoder constant
287 : edgomez 199 ****************************************************************************/
288 :    
289 : edgomez 608 /**
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 : suxen_drol 629 * decoding a MPEG4 compliant streams.
294 : edgomez 608 * @{
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 : edgomez 199 #define XVID_QUICK_DECODE 0x00000010
307 :    
308 : edgomez 608
309 :     /**
310 :     * @}
311 :     */
312 :    
313 : edgomez 199 /*****************************************************************************
314 :     * Decoder structures
315 :     ****************************************************************************/
316 :    
317 :     typedef struct
318 :     {
319 :     int width;
320 :     int height;
321 :     void *handle;
322 :     }
323 :     XVID_DEC_PARAM;
324 :    
325 :    
326 :     typedef struct
327 :     {
328 :     int general;
329 :     void *bitstream;
330 :     int length;
331 :    
332 :     void *image;
333 :     int stride;
334 :     int colorspace;
335 :     }
336 :     XVID_DEC_FRAME;
337 :    
338 :    
339 :     // This struct is used for per slice rendering
340 :     typedef struct
341 :     {
342 :     void *y,*u,*v;
343 :     int stride_y, stride_u,stride_v;
344 :     } XVID_DEC_PICTURE;
345 :    
346 : albeu 315
347 :     /*****************************************************************************
348 :     * Decoder entry point
349 :     ****************************************************************************/
350 :    
351 : edgomez 608 /**
352 :     * \defgroup decops_grp Decoder operations
353 :     *
354 :     * These are all the operations XviD's decoder can perform.
355 :     *
356 :     * @{
357 :     */
358 : edgomez 199
359 : edgomez 608 #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 : edgomez 199
365 : edgomez 608 #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 : suxen_drol 629 * a decoder instance. Decoder instances are independant from each other, and
369 :     * can be safely threaded.
370 : edgomez 608 */
371 : edgomez 199
372 : edgomez 608 #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 : edgomez 199
378 : edgomez 608 /**
379 :     * @}
380 : edgomez 412 */
381 : edgomez 199
382 : edgomez 608 /**
383 :     * \defgroup decentry_grp Decoder entry point
384 :     *
385 :     * @{
386 :     */
387 : edgomez 199
388 : edgomez 608 /**
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 : suxen_drol 629 * \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 : edgomez 608 */
399 : edgomez 199
400 : edgomez 608 int xvid_decore(void *handle,
401 :     int opt,
402 :     void *param1,
403 :     void *param2);
404 : edgomez 199
405 : edgomez 608 /** @} */
406 : edgomez 199
407 : edgomez 608 /** @} */
408 : edgomez 199
409 : edgomez 608 /**
410 :     * \defgroup encoder_grp Encoder related functions and structures.
411 :     *
412 :     * @{
413 :     */
414 : edgomez 199
415 : edgomez 608 /*****************************************************************************
416 :     * Encoder constants
417 :     ****************************************************************************/
418 : edgomez 199
419 : edgomez 608 /**
420 :     * \defgroup encgenflags_grp Flags for XVID_ENC_FRAME.general
421 :     * @{
422 :     */
423 : edgomez 199
424 : edgomez 608 #define XVID_VALID_FLAGS 0x80000000 /**< Reserved for future use */
425 : edgomez 199
426 : edgomez 608 #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 : suxen_drol 629 * informs xvid to perform a half pixel motion estimation. */
439 : edgomez 608 #define XVID_ADAPTIVEQUANT 0x00000080/**< Adaptive quantization
440 :     *
441 : suxen_drol 629 * informs xvid to perform an adaptative quantization using a Luminance
442 : edgomez 608 * masking algorithm */
443 : suxen_drol 629 #define XVID_LUMIMASKING 0x00000100/**< Lumimasking flag
444 : edgomez 608 *
445 : suxen_drol 629 * \deprecated This flag is no longer used. */
446 : edgomez 608 #define XVID_LATEINTRA 0x00000200/**< Unknown
447 :     *
448 : suxen_drol 629 * \deprecated This flag is no longer used. */
449 : edgomez 608 #define XVID_INTERLACING 0x00000400/**< MPEG4 interlacing mode.
450 :     *
451 : suxen_drol 629 * Enables interlacing encoding mode */
452 :     #define XVID_TOPFIELDFIRST 0x00000800/**< Unknown
453 :     *
454 :     * \deprecated This flag is no longer used. */
455 : edgomez 608 #define XVID_ALTERNATESCAN 0x00001000/**<
456 :     *
457 : suxen_drol 629 * \deprecated This flag is no longer used. */
458 : edgomez 608 #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 : suxen_drol 629 #define XVID_GRAYSCALE XVID_GREYSCALE /**< XVID_GREYSCALE alias
491 : edgomez 608 *
492 : suxen_drol 629 * United States locale support. */
493 : chl 352
494 : edgomez 608 /** @} */
495 : edgomez 199
496 : edgomez 608 /**
497 :     * \defgroup encmotionflags_grp Flags for XVID_ENC_FRAME.motion
498 :     * @{
499 :     */
500 : edgomez 199
501 : edgomez 608 #define PMV_ADVANCEDDIAMOND8 0x00004000/**< Uses advanced diamonds for 8x8 blocks
502 :     *
503 :     * Same as its 16x16 companion option
504 :     */
505 :     #define PMV_ADVANCEDDIAMOND16 0x00008000/**< Uses advanced diamonds for 16x16 blocks
506 :     *
507 :     * */
508 :     #define PMV_HALFPELDIAMOND16 0x00010000/**< Turns on halfpel precision for 16x16 blocks
509 :     *
510 :     * switches the search algorithm from 1 or 2 full pixels precision to 1 or 2 half pixel precision.
511 :     */
512 :     #define PMV_HALFPELREFINE16 0x00020000/**< Turns on halfpel refinement step
513 :     *
514 : suxen_drol 629 * After normal diamond search, an extra halfpel refinement step is performed. Should always be used if
515 :     * XVID_HALFPEL is on, because it gives a rather big increase in quality.
516 : edgomez 608 */
517 :     #define PMV_EXTSEARCH16 0x00040000/**< Extends search for 16x16 blocks
518 :     *
519 :     * Normal PMVfast predicts one start vector and does diamond search around this position. EXTSEARCH means that 2
520 :     * more start vectors are used: (0,0) and median predictor and diamond search is done for those, too. Makes
521 :     * search slightly slower, but quality sometimes gets better.
522 :     */
523 :     #define PMV_EARLYSTOP16 0x00080000/**< Dynamic ME thresholding
524 :     *
525 :     * PMVfast and EPZS stop search if current best is below some dynamic threshhold. No diamond search is done,
526 :     * only halfpel refinement (if active). Without EARLYSTOP diamond search is always done. That would be much slower,
527 :     * but not really lead to better quality.
528 :     */
529 :     #define PMV_QUICKSTOP16 0x00100000/**< Dynamic ME thresholding
530 :     *
531 : suxen_drol 629 * like EARLYSTOP, but not even halfpel refinement is done. Normally worse quality, so it defaults to
532 : edgomez 608 * off. Might be removed, too.
533 :     */
534 :     #define PMV_UNRESTRICTED16 0x00200000/**< Not implemented
535 :     *
536 :     * "unrestricted ME" is a feature of MPEG4. It's not implemented, so this flag is ignored (not even
537 :     * checked).
538 :     */
539 :     #define PMV_OVERLAPPING16 0x00400000/**< Not implemented
540 :     *
541 :     * Same as above
542 :     */
543 :     #define PMV_USESQUARES16 0x00800000/**< Use square pattern
544 :     *
545 :     * Replace the diamond search with a square search.
546 :     */
547 :     #define PMV_HALFPELDIAMOND8 0x01000000/**< see 16x16 equivalent
548 :     *
549 :     * Same as its 16x16 companion option */
550 :     #define PMV_HALFPELREFINE8 0x02000000/**< see 16x16 equivalent
551 :     *
552 :     * Same as its 16x16 companion option */
553 :     #define PMV_EXTSEARCH8 0x04000000/**< see 16x16 equivalent
554 :     *
555 :     * Same as its 16x16 companion option */
556 :     #define PMV_EARLYSTOP8 0x08000000/**< see 16x16 equivalent
557 :     *
558 :     * Same as its 16x16 companion option */
559 :     #define PMV_QUICKSTOP8 0x10000000/**< see 16x16 equivalent
560 :     *
561 :     * Same as its 16x16 companion option */
562 :     #define PMV_UNRESTRICTED8 0x20000000/**< see 16x16 equivalent
563 :     *
564 :     * Same as its 16x16 companion option */
565 :     #define PMV_OVERLAPPING8 0x40000000/**< see 16x16 equivalent
566 :     *
567 :     * Same as its 16x16 companion option */
568 :     #define PMV_USESQUARES8 0x80000000/**< see 16x16 equivalent
569 :     *
570 :     * Same as its 16x16 companion option */
571 : edgomez 199
572 : edgomez 608 /** @} */
573 :    
574 : edgomez 199 /*****************************************************************************
575 :     * Encoder structures
576 :     ****************************************************************************/
577 :    
578 : edgomez 608 /** Structure used for encoder instance creation */
579 : edgomez 199 typedef struct
580 :     {
581 : edgomez 608 int width; /**< [in]
582 :     *
583 :     * Input frame width. */
584 :     int height; /**< [in]
585 :     *
586 :     * Input frame height. */
587 :     int fincr; /**< [in]
588 :     *
589 :     * Time increment (fps = increment/base). */
590 :     int fbase; /**< [in]
591 :     *
592 :     * Time base (fps = increment/base). */
593 :     int rc_bitrate; /**< [in]
594 :     *
595 :     * 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 : edgomez 199 }
618 :     XVID_ENC_PARAM;
619 :    
620 :     typedef struct
621 :     {
622 :     int x;
623 : suxen_drol 324 int y;
624 : edgomez 199 }
625 :     VECTOR;
626 :    
627 :     typedef struct
628 :     {
629 :     int mode; /* macroblock mode */
630 :     VECTOR mvs[4];
631 :     }
632 :     MVBLOCKHINT;
633 :    
634 :     typedef struct
635 :     {
636 :     int intra; /* frame intra choice */
637 :     int fcode; /* frame fcode */
638 :     MVBLOCKHINT *block; /* caller-allocated array of block hints (mb_width * mb_height) */
639 :     }
640 :     MVFRAMEHINT;
641 :    
642 :     typedef struct
643 :     {
644 :     int rawhints; /* if set, use MVFRAMEHINT, else use compressed buffer */
645 :    
646 :     MVFRAMEHINT mvhint;
647 :     void *hintstream; /* compressed hint buffer */
648 :     int hintlength; /* length of buffer (bytes) */
649 :     }
650 :     HINTINFO;
651 :    
652 : edgomez 608 /** Structure used to pass a frame to the encoder */
653 : edgomez 199 typedef struct
654 :     {
655 : edgomez 608 int general; /**< [in]
656 :     *
657 :     * Sets general options flag (See \ref encgenflags_grp) */
658 :     int motion; /**< [in]
659 :     *
660 :     * Sets Motion Estimation options */
661 :     void *bitstream; /**< [out]
662 :     *
663 :     * Output MPEG4 bitstream buffer pointer */
664 :     int length; /**< [out]
665 :     *
666 :     * Output MPEG4 bitstream length (bytes) */
667 :     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 : suxen_drol 629 * for you. Typically used in ABR encoding, or first pass of a VBR
685 : edgomez 608 * 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]
709 :     *
710 :     * mv hint information */
711 : edgomez 199
712 :     }
713 :     XVID_ENC_FRAME;
714 :    
715 :    
716 : edgomez 608 /** Encoding statistics */
717 : edgomez 199 typedef struct
718 :     {
719 : edgomez 608 int quant; /**< [out]
720 :     *
721 :     * Frame quantizer used during encoding */
722 :     int hlength; /**< [out]
723 :     *
724 :     * Header bytes in the resulting MPEG4 stream */
725 :     int kblks; /**< [out]
726 :     *
727 : suxen_drol 629 * Number of intra macro blocks */
728 : edgomez 608 int mblks; /**< [out]
729 :     *
730 : suxen_drol 629 * Number of inter macro blocks */
731 : edgomez 608 int ublks; /**< [out]
732 :     *
733 : suxen_drol 629 * Number of skipped macro blocks */
734 : edgomez 199 }
735 :     XVID_ENC_STATS;
736 :    
737 :    
738 :     /*****************************************************************************
739 :     * Encoder entry point
740 :     ****************************************************************************/
741 :    
742 : edgomez 608 /**
743 :     * \defgroup encops_grp Encoder operations
744 :     *
745 :     * These are all the operations XviD's encoder can perform.
746 :     *
747 :     * @{
748 :     */
749 : edgomez 199
750 : suxen_drol 610 #define XVID_ENC_ENCODE 0 /**< Encodes a frame
751 : edgomez 608 *
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 : suxen_drol 629 * an encoder instance. Encoder instances are independant from each other.
760 : edgomez 608 */
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 : suxen_drol 629 * \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 : edgomez 608 */
788 : edgomez 199 int xvid_encore(void *handle,
789 :     int opt,
790 :     void *param1,
791 :     void *param2);
792 :    
793 : edgomez 608 /** @} */
794 : edgomez 199
795 : edgomez 608 /** @} */
796 :    
797 : edgomez 199 #ifdef __cplusplus
798 :     }
799 :     #endif
800 :    
801 :     #endif

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