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