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