[svn] / trunk / xvidcore / src / divx4.c Repository:
ViewVC logotype

Annotation of /trunk/xvidcore/src/divx4.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 193 - (view) (download)

1 : Isibaar 3 /**************************************************************************
2 :     *
3 : edgomez 193 * XVID MPEG-4 VIDEO CODEC
4 :     * - OpenDivx API wrapper -
5 : Isibaar 3 *
6 : edgomez 193 * 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 : Isibaar 3 *
15 : edgomez 193 * 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 : Isibaar 3 *
20 : edgomez 193 * 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 : Isibaar 3 *
25 : edgomez 193 * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
28 : Isibaar 3 *
29 :     *************************************************************************/
30 :    
31 :     /**************************************************************************
32 :     *
33 : edgomez 193 * History:
34 : Isibaar 3 *
35 : edgomez 193 * 26.02.2001 fixed dec_csp bugs
36 :     * 26.12.2001 xvid_init() support
37 :     * 22.12.2001 removed some compiler warnings
38 :     * 16.12.2001 inital version; (c)2001 peter ross <pross@cs.rmit.edu.au>
39 : Isibaar 3 *
40 : edgomez 193 * $Id: divx4.c,v 1.13 2002-06-09 23:05:35 edgomez Exp $
41 : edgomez 144 *
42 : Isibaar 3 *************************************************************************/
43 :    
44 : knhor 129 #include <stdlib.h>
45 : edgomez 143 #include <string.h>
46 : edgomez 159 #include <stdio.h>
47 : Isibaar 3
48 :     #include "xvid.h"
49 :     #include "divx4.h"
50 :     #include "decoder.h"
51 :     #include "encoder.h"
52 :    
53 :     #define EMULATED_DIVX_VERSION 20011001
54 :    
55 : edgomez 143 /**************************************************************************
56 :     * Divx Instance Structure
57 :     *
58 :     * This chain list datatype allows XviD do instanciate multiples divx4
59 :     * sessions.
60 :     *
61 :     * ToDo : The way this chain list is used does not guarantee reentrance
62 :     * because they are not protected by any kind of mutex to allow
63 :     * only one modifier. We should add a mutex for each element in
64 :     * the chainlist.
65 :     *************************************************************************/
66 : Isibaar 3
67 :    
68 :     typedef struct DINST
69 :     {
70 :     unsigned long key;
71 :     struct DINST * next;
72 :    
73 :     void * handle;
74 :     XVID_DEC_FRAME xframe;
75 :    
76 :     } DINST;
77 :    
78 : edgomez 159 typedef struct EINST
79 :     {
80 :     struct EINST * next;
81 :    
82 :     void * handle;
83 :     int quality;
84 :    
85 :     } EINST;
86 :    
87 : edgomez 143 /**************************************************************************
88 :     * Global data (needed to emulate correctly exported symbols from divx4)
89 :     *************************************************************************/
90 : Isibaar 3
91 : edgomez 143 /* This is not used in this module but is required by some divx4 encoders*/
92 :     int quiet_encore = 1;
93 : Isibaar 3
94 : edgomez 143 /**************************************************************************
95 :     * Local data
96 :     *************************************************************************/
97 : Isibaar 3
98 : edgomez 143 /* The Divx4 instance chainlist */
99 :     static DINST * dhead = NULL;
100 : edgomez 159 static EINST * ehead = NULL;
101 : Isibaar 3
102 : edgomez 143 /* Divx4 quality to XviD encoder motion flag presets */
103 :     static int const divx4_motion_presets[7] = {
104 :     0,
105 : Isibaar 3
106 : edgomez 143 PMV_EARLYSTOP16,
107 : Isibaar 3
108 : chl 180 PMV_EARLYSTOP16 | PMV_ADVANCEDDIAMOND16,
109 :    
110 : edgomez 143 PMV_EARLYSTOP16 | PMV_HALFPELREFINE16,
111 : Isibaar 3
112 : edgomez 143 PMV_EARLYSTOP16 | PMV_HALFPELREFINE16 |
113 : chl 180 PMV_EARLYSTOP8 | PMV_HALFPELREFINE8,
114 : Isibaar 3
115 : edgomez 143 PMV_EARLYSTOP16 | PMV_HALFPELREFINE16 |
116 : chl 180 PMV_EARLYSTOP8 | PMV_HALFPELREFINE8,
117 : Isibaar 3
118 : chl 180 PMV_EARLYSTOP16 | PMV_HALFPELREFINE16 | PMV_EXTSEARCH16 |
119 :     PMV_EARLYSTOP8 | PMV_HALFPELREFINE8
120 : edgomez 143 };
121 : Isibaar 3
122 :    
123 : edgomez 143 /* Divx4 quality to general encoder flag presets */
124 :     static int const divx4_general_presets[7] = {
125 :     0,
126 :     XVID_H263QUANT,
127 :     XVID_H263QUANT,
128 :     XVID_H263QUANT | XVID_HALFPEL,
129 :     XVID_H263QUANT | XVID_INTER4V | XVID_HALFPEL,
130 : chl 180 XVID_H263QUANT | XVID_INTER4V | XVID_HALFPEL,
131 : edgomez 143 XVID_H263QUANT | XVID_INTER4V | XVID_HALFPEL
132 :     };
133 : Isibaar 3
134 : edgomez 143 /**************************************************************************
135 :     * Local Prototypes
136 :     *************************************************************************/
137 : Isibaar 3
138 : edgomez 143 /* Chain list helper functions */
139 :     static DINST * dinst_find(unsigned long key);
140 :     static DINST * dinst_add(unsigned long key);
141 :     static void dinst_remove(unsigned long key);
142 : Isibaar 3
143 : edgomez 159 static EINST * einst_find(void *handle);
144 :     static EINST * einst_add(void *handle);
145 :     static void einst_remove(void *handle);
146 :    
147 : edgomez 143 /* Converts divx4 colorspaces codes to xvid codes */
148 :     static int xvid_to_opendivx_dec_csp(int csp);
149 :     static int xvid_to_opendivx_enc_csp(int csp);
150 : Isibaar 3
151 : edgomez 143 /**************************************************************************
152 :     * decore part
153 :     *
154 :     * decore is the divx4 entry point used to decompress the mpeg4 bitstream
155 :     * into a user defined image format.
156 :     *************************************************************************/
157 : Isibaar 3
158 : edgomez 143 int
159 :     decore(unsigned long key, unsigned long opt, void * param1, void * param2)
160 : Isibaar 3 {
161 : edgomez 143
162 : Isibaar 3 int xerr;
163 :    
164 : edgomez 143 switch (opt) {
165 :    
166 :     case DEC_OPT_MEMORY_REQS :
167 : Isibaar 3 {
168 : edgomez 143 memset(param2, 0, sizeof(DEC_MEM_REQS));
169 :     return DEC_OK;
170 :     }
171 :    
172 :     case DEC_OPT_INIT :
173 :     {
174 :     XVID_INIT_PARAM xinit;
175 :     XVID_DEC_PARAM xparam;
176 :     DINST * dcur;
177 :     DEC_PARAM * dparam = (DEC_PARAM *)param1;
178 :    
179 :     /* Find the divx4 instance */
180 :     if ((dcur = dinst_find(key)) == NULL)
181 : Isibaar 3 {
182 : edgomez 143 dcur = dinst_add(key);
183 : Isibaar 3 }
184 :    
185 : edgomez 143 /*
186 :     * XviD initialization
187 :     * XviD will detect the host cpu type and activate optimized
188 :     * functions according to the host cpu features.
189 :     */
190 :     xinit.cpu_flags = 0;
191 :     xvid_init(NULL, 0, &xinit, NULL);
192 : Isibaar 3
193 : edgomez 143 /* XviD decoder initialization for this instance */
194 :     xparam.width = dparam->x_dim;
195 :     xparam.height = dparam->y_dim;
196 :     dcur->xframe.colorspace =
197 :     xvid_to_opendivx_dec_csp(dparam->output_format);
198 : Isibaar 3
199 : edgomez 143 xerr = decoder_create(&xparam);
200 : Isibaar 3
201 : edgomez 143 /* Store the xvid handle into the divx4 instance chainlist */
202 :     dcur->handle = xparam.handle;
203 : Isibaar 3
204 : edgomez 143 break;
205 :     }
206 : Isibaar 3
207 :     case DEC_OPT_RELEASE :
208 : edgomez 143 {
209 :     DINST * dcur;
210 :    
211 :     /* Find the divx4 instance into the chain list */
212 :     if ((dcur = dinst_find(key)) == NULL)
213 : Isibaar 3 {
214 : edgomez 143 return DEC_EXIT;
215 :     }
216 : Isibaar 3
217 : edgomez 143 /* Destroy the XviD decoder attached to this divx4 instance */
218 :     xerr = decoder_destroy(dcur->handle);
219 : Isibaar 3
220 : edgomez 143 /* Remove the divx4 instance from the chainlist */
221 :     dinst_remove(key);
222 : Isibaar 3
223 : edgomez 143 break;
224 :     }
225 : Isibaar 3
226 :     case DEC_OPT_SETPP :
227 : edgomez 143 {
228 :     DINST * dcur;
229 :    
230 :     /* Find the divx4 instance into the chain list */
231 :     if ((dcur = dinst_find(key)) == NULL)
232 : Isibaar 3 {
233 : edgomez 143 return DEC_EXIT;
234 :     }
235 : Isibaar 3
236 : edgomez 143 /*
237 :     * We return DEC_OK but XviD has no postprocessing implemented
238 :     * in core.
239 :     */
240 :     return DEC_OK;
241 :     }
242 : Isibaar 3
243 : edgomez 143 case DEC_OPT_SETOUT :
244 :     {
245 :     DINST * dcur;
246 :     DEC_PARAM * dparam = (DEC_PARAM *)param1;
247 : Isibaar 3
248 : edgomez 143 if ((dcur = dinst_find(key)) == NULL)
249 : Isibaar 3 {
250 : edgomez 143 return DEC_EXIT;
251 :     }
252 : Isibaar 3
253 : edgomez 143 /* Change the output colorspace */
254 :     dcur->xframe.colorspace =
255 :     xvid_to_opendivx_dec_csp(dparam->output_format);
256 : Isibaar 3
257 : edgomez 143 return DEC_OK;
258 :     }
259 : Isibaar 3
260 :     case DEC_OPT_FRAME:
261 : edgomez 143 {
262 :     int csp_tmp = 0;
263 :     DINST * dcur;
264 :     DEC_FRAME * dframe = (DEC_FRAME *)param1;
265 :    
266 :     if ((dcur = dinst_find(key)) == NULL)
267 : Isibaar 3 {
268 : edgomez 143 return DEC_EXIT;
269 :     }
270 : edgomez 19
271 : edgomez 143 /* Copy the divx4 fields to the XviD decoder structure */
272 :     dcur->xframe.bitstream = dframe->bitstream;
273 :     dcur->xframe.length = dframe->length;
274 :     dcur->xframe.image = dframe->bmp;
275 :     dcur->xframe.stride = dframe->stride;
276 : Isibaar 3
277 : edgomez 143 /* Does the frame need to be skipped ? */
278 :     if (!dframe->render_flag)
279 :     {
280 :     /*
281 :     * Then we use the null colorspace to force XviD to
282 :     * skip the frame. The original colorspace will be
283 :     * restored after the decoder call
284 :     */
285 :     csp_tmp = dcur->xframe.colorspace;
286 :     dcur->xframe.colorspace = XVID_CSP_NULL;
287 :     }
288 : Isibaar 3
289 : edgomez 143 /* Decode the bitstream */
290 :     xerr = decoder_decode(dcur->handle, &dcur->xframe);
291 : Isibaar 3
292 : edgomez 143 /* Restore the real colorspace for this instance */
293 :     if (!dframe->render_flag)
294 :     {
295 :     dcur->xframe.colorspace = csp_tmp;
296 : Isibaar 3 }
297 :    
298 : edgomez 143 break;
299 :     }
300 : Isibaar 3
301 :     case DEC_OPT_FRAME_311 :
302 : edgomez 143 /* XviD does not handle Divx ;-) 3.11 yet */
303 : Isibaar 3 return DEC_EXIT;
304 :    
305 :     case DEC_OPT_VERSION:
306 :     return EMULATED_DIVX_VERSION;
307 : edgomez 143
308 : Isibaar 3 default :
309 :     return DEC_EXIT;
310 :     }
311 :    
312 :    
313 : edgomez 143 /* XviD error code -> Divx4 */
314 : Isibaar 3 switch(xerr)
315 :     {
316 : edgomez 143 case XVID_ERR_OK :
317 :     return DEC_OK;
318 :     case XVID_ERR_MEMORY :
319 :     return DEC_MEMORY;
320 :     case XVID_ERR_FORMAT :
321 :     return DEC_BAD_FORMAT;
322 :     default :
323 : Isibaar 3 return DEC_EXIT;
324 :     }
325 :     }
326 :    
327 : edgomez 143 /**************************************************************************
328 :     * Encore Part
329 :     *
330 :     * encore is the divx4 entry point used to compress a frame to a mpeg4
331 :     * bitstream.
332 :     *************************************************************************/
333 : Isibaar 3
334 :     #define FRAMERATE_INCR 1001
335 :    
336 : edgomez 143 int
337 :     encore(void * handle, int opt, void * param1, void * param2)
338 :     {
339 : Isibaar 9
340 : Isibaar 3 int xerr;
341 :    
342 : edgomez 143 switch(opt) {
343 :     case ENC_OPT_INIT :
344 : Isibaar 3 {
345 : edgomez 159 EINST *ecur;
346 : edgomez 143 ENC_PARAM * eparam = (ENC_PARAM *)param1;
347 :     XVID_INIT_PARAM xinit;
348 :     XVID_ENC_PARAM xparam;
349 : Isibaar 3
350 : edgomez 143 /* Init XviD which will detect host cpu features */
351 :     xinit.cpu_flags = 0;
352 :     xvid_init(NULL, 0, &xinit, NULL);
353 : Isibaar 3
354 : edgomez 143 /* Settings are copied to the XviD encoder structure */
355 :     xparam.width = eparam->x_dim;
356 :     xparam.height = eparam->y_dim;
357 :     if ((eparam->framerate - (int)eparam->framerate) == 0)
358 :     {
359 :     xparam.fincr = 1;
360 :     xparam.fbase = (int)eparam->framerate;
361 :     }
362 :     else
363 :     {
364 :     xparam.fincr = FRAMERATE_INCR;
365 :     xparam.fbase = (int)(FRAMERATE_INCR * eparam->framerate);
366 :     }
367 :     xparam.rc_bitrate = eparam->bitrate;
368 :     xparam.rc_reaction_delay_factor = 16;
369 :     xparam.rc_averaging_period = 100;
370 :     xparam.rc_buffer = 100;
371 :     xparam.min_quantizer = eparam->min_quantizer;
372 :     xparam.max_quantizer = eparam->max_quantizer;
373 :     xparam.max_key_interval = eparam->max_key_interval;
374 : Isibaar 3
375 : edgomez 143 /* Create the encoder session */
376 :     xerr = encoder_create(&xparam);
377 : Isibaar 3
378 : edgomez 143 eparam->handle = xparam.handle;
379 : Isibaar 3
380 : edgomez 159 /* Create an encoder instance in the chainlist */
381 :     if ((ecur = einst_find(xparam.handle)) == NULL)
382 :     {
383 :     ecur = einst_add(xparam.handle);
384 :    
385 :     if(ecur == NULL) {
386 :     encoder_destroy((Encoder*)xparam.handle);
387 :     return ENC_MEMORY;
388 :     }
389 :    
390 :     }
391 :    
392 :     ecur->quality = eparam->quality;
393 :     if(ecur->quality < 0) ecur->quality = 0;
394 :     if(ecur->quality > 6) ecur->quality = 6;
395 :    
396 : edgomez 143 break;
397 :     }
398 : Isibaar 3
399 :     case ENC_OPT_RELEASE :
400 : edgomez 143 {
401 : edgomez 159 EINST *ecur;
402 :    
403 :     if ((ecur = einst_find(handle)) == NULL)
404 :     {
405 :     return ENC_FAIL;
406 :     }
407 : edgomez 193
408 :     einst_remove(handle);
409 :     xerr = encoder_destroy((Encoder *) handle);
410 : edgomez 159
411 : edgomez 143 break;
412 :     }
413 : Isibaar 3
414 :     case ENC_OPT_ENCODE :
415 :     case ENC_OPT_ENCODE_VBR :
416 : edgomez 143 {
417 : edgomez 159 EINST *ecur;
418 :    
419 : edgomez 143 ENC_FRAME * eframe = (ENC_FRAME *)param1;
420 :     ENC_RESULT * eresult = (ENC_RESULT *)param2;
421 :     XVID_ENC_FRAME xframe;
422 :     XVID_ENC_STATS xstats;
423 : Isibaar 3
424 : edgomez 159 if ((ecur = einst_find(handle)) == NULL)
425 :     {
426 :     return ENC_FAIL;
427 :     }
428 :    
429 : edgomez 143 /* Copy the divx4 info into the xvid structure */
430 :     xframe.bitstream = eframe->bitstream;
431 :     xframe.length = eframe->length;
432 : edgomez 159 xframe.motion = divx4_motion_presets[ecur->quality];
433 :     xframe.general = divx4_general_presets[ecur->quality];
434 : Isibaar 3
435 : edgomez 143 xframe.image = eframe->image;
436 :     xframe.colorspace =
437 :     xvid_to_opendivx_enc_csp(eframe->colorspace);
438 : Isibaar 3
439 : edgomez 143 if (opt == ENC_OPT_ENCODE_VBR)
440 :     {
441 :     xframe.intra = eframe->intra;
442 :     xframe.quant = eframe->quant;
443 :     }
444 :     else
445 :     {
446 :     xframe.intra = -1;
447 :     xframe.quant = 0;
448 :     }
449 : Isibaar 3
450 : edgomez 143 /* Encode the frame */
451 :     xerr = encoder_encode((Encoder *) handle, &xframe, (eresult ? &xstats : NULL) );
452 : Isibaar 3
453 : edgomez 143 /* Copy back the xvid structure to the divx4 one */
454 :     if (eresult)
455 :     {
456 :     eresult->is_key_frame = xframe.intra;
457 :     eresult->quantizer = xstats.quant;
458 :     eresult->total_bits = xframe.length * 8;
459 :     eresult->motion_bits = xstats.hlength * 8;
460 :     eresult->texture_bits = eresult->total_bits - eresult->motion_bits;
461 :     }
462 : Isibaar 3
463 : edgomez 143 eframe->length = xframe.length;
464 : Isibaar 3
465 : edgomez 143 break;
466 :     }
467 : Isibaar 3
468 :     default:
469 :     return ENC_FAIL;
470 :     }
471 :    
472 : edgomez 143 /* XviD Error code -> Divx4 error code */
473 : Isibaar 3 switch(xerr)
474 :     {
475 : edgomez 143 case XVID_ERR_OK :
476 :     return ENC_OK;
477 :     case XVID_ERR_MEMORY :
478 :     return ENC_MEMORY;
479 :     case XVID_ERR_FORMAT :
480 :     return ENC_BAD_FORMAT;
481 :     default :
482 : Isibaar 3 return ENC_FAIL;
483 :     }
484 :     }
485 :    
486 : edgomez 143 /**************************************************************************
487 :     * Local Functions
488 :     *************************************************************************/
489 :    
490 :     /***************************************
491 :     * DINST chainlist helper functions *
492 :     ***************************************/
493 :    
494 :     /* Find an element in the chainlist according to its key value */
495 :     static DINST * dinst_find(unsigned long key)
496 :     {
497 :     DINST * dcur = dhead;
498 :    
499 :     while (dcur)
500 :     {
501 :     if (dcur->key == key)
502 :     {
503 :     return dcur;
504 :     }
505 :     dcur = dcur->next;
506 :     }
507 :    
508 :     return NULL;
509 :     }
510 :    
511 :    
512 :     /* Add an element to the chainlist */
513 :     static DINST * dinst_add(unsigned long key)
514 :     {
515 :     DINST * dnext = dhead;
516 :    
517 :     dhead = malloc(sizeof(DINST));
518 :     if (dhead == NULL)
519 :     {
520 :     dhead = dnext;
521 :     return NULL;
522 :     }
523 :    
524 :     dhead->key = key;
525 :     dhead->next = dnext;
526 :    
527 :     return dhead;
528 :     }
529 :    
530 :    
531 :     /* Remove an elmement from the chainlist */
532 :     static void dinst_remove(unsigned long key)
533 :     {
534 :     DINST * dcur = dhead;
535 :    
536 :     if (dhead == NULL)
537 :     {
538 :     return;
539 :     }
540 :    
541 :     if (dcur->key == key)
542 :     {
543 :     dhead = dcur->next;
544 :     free(dcur);
545 :     return;
546 :     }
547 :    
548 :     while (dcur->next)
549 :     {
550 :     if (dcur->next->key == key)
551 :     {
552 :     DINST * tmp = dcur->next;
553 :     dcur->next = tmp->next;
554 :     free(tmp);
555 :     return;
556 :     }
557 :     dcur = dcur->next;
558 :     }
559 :     }
560 :    
561 : edgomez 159
562 : edgomez 143 /***************************************
563 : edgomez 159 * EINST chainlist helper functions *
564 :     ***************************************/
565 :    
566 :     /* Find an element in the chainlist according to its handle */
567 :     static EINST * einst_find(void *handle)
568 :     {
569 :     EINST * ecur = ehead;
570 :    
571 :     while (ecur)
572 :     {
573 :     if (ecur->handle == handle)
574 :     {
575 :     return ecur;
576 :     }
577 :     ecur = ecur->next;
578 :     }
579 :    
580 :     return NULL;
581 :     }
582 :    
583 :    
584 :     /* Add an element to the chainlist */
585 :     static EINST * einst_add(void *handle)
586 :     {
587 :     EINST * enext = ehead;
588 :    
589 :     ehead = malloc(sizeof(EINST));
590 :     if (ehead == NULL)
591 :     {
592 :     ehead = enext;
593 :     return NULL;
594 :     }
595 :    
596 :     ehead->handle = handle;
597 :     ehead->next = enext;
598 :    
599 :     return ehead;
600 :     }
601 :    
602 :    
603 :     /* Remove an elmement from the chainlist */
604 :     static void einst_remove(void *handle)
605 :     {
606 :     EINST * ecur = ehead;
607 :    
608 :     if (ehead == NULL)
609 :     {
610 :     return;
611 :     }
612 :    
613 :     if (ecur->handle == handle)
614 :     {
615 :     ehead = ecur->next;
616 :     free(ecur);
617 :     return;
618 :     }
619 :    
620 :     while (ecur->next)
621 :     {
622 :     if (ecur->next->handle == handle)
623 :     {
624 :     EINST * tmp = ecur->next;
625 :     ecur->next = tmp->next;
626 :     free(tmp);
627 :     return;
628 :     }
629 :     ecur = ecur->next;
630 :     }
631 :     }
632 :     /***************************************
633 : edgomez 143 * Colorspace code converter *
634 :     ***************************************/
635 :    
636 :     static int xvid_to_opendivx_dec_csp(int csp)
637 :     {
638 :    
639 :     switch(csp)
640 :     {
641 :     case DEC_YV12 :
642 :     return XVID_CSP_YV12;
643 :     case DEC_420 :
644 :     return XVID_CSP_I420;
645 :     case DEC_YUY2 :
646 :     return XVID_CSP_YUY2;
647 :     case DEC_UYVY :
648 :     return XVID_CSP_UYVY;
649 :     case DEC_RGB32 :
650 :     return XVID_CSP_VFLIP | XVID_CSP_RGB32;
651 :     case DEC_RGB24 :
652 :     return XVID_CSP_VFLIP | XVID_CSP_RGB24;
653 :     case DEC_RGB565 :
654 :     return XVID_CSP_VFLIP | XVID_CSP_RGB565;
655 :     case DEC_RGB555 :
656 :     return XVID_CSP_VFLIP | XVID_CSP_RGB555;
657 :     case DEC_RGB32_INV :
658 :     return XVID_CSP_RGB32;
659 :     case DEC_RGB24_INV :
660 :     return XVID_CSP_RGB24;
661 :     case DEC_RGB565_INV :
662 :     return XVID_CSP_RGB565;
663 :     case DEC_RGB555_INV :
664 :     return XVID_CSP_RGB555;
665 :     case DEC_USER :
666 :     return XVID_CSP_USER;
667 :     default :
668 :     return -1;
669 :     }
670 :     }
671 :    
672 :     static int xvid_to_opendivx_enc_csp(int csp)
673 :     {
674 :    
675 :     switch (csp)
676 :     {
677 :     case ENC_CSP_RGB24 :
678 :     return XVID_CSP_VFLIP | XVID_CSP_RGB24;
679 :     case ENC_CSP_YV12 :
680 :     return XVID_CSP_YV12;
681 :     case ENC_CSP_YUY2 :
682 :     return XVID_CSP_YUY2;
683 :     case ENC_CSP_UYVY :
684 :     return XVID_CSP_UYVY;
685 :     case ENC_CSP_I420 :
686 :     return XVID_CSP_I420;
687 :     default :
688 :     return -1;
689 :     }
690 :     }

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