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

Diff of /xvidcore/src/divx4.c

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

revision 1.4, Sat Mar 9 16:24:21 2002 UTC revision 1.9, Sun Apr 28 16:15:51 2002 UTC
# Line 1  Line 1 
1  /**************************************************************************  /**************************************************************************
2   *   *
3   *      XVID MPEG-4 VIDEO CODEC   *      XVID MPEG-4 VIDEO CODEC
4   *      opendivx api wrapper   *      OpenDivx API wrapper
5   *   *
6   *      This program is an implementation of a part of one or more MPEG-4   *      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   *      Video tools as specified in ISO/IEC 14496-2 standard.  Those intending
# Line 39  Line 39 
39   *   *
40   *************************************************************************/   *************************************************************************/
41    
42    #include <stdlib.h>
43  #include <malloc.h>  #include <string.h>
 #include <string.h>     // memset  
44    
45  #include "xvid.h"  #include "xvid.h"
46  #include "divx4.h"  #include "divx4.h"
# Line 50  Line 49 
49    
50  #define EMULATED_DIVX_VERSION 20011001  #define EMULATED_DIVX_VERSION 20011001
51    
52  // decore  /**************************************************************************
53     * Divx Instance Structure
54     *
55     * This chain list datatype allows XviD do instanciate multiples divx4
56     * sessions.
57     *
58     * ToDo : The way this chain list is used does not guarantee reentrance
59     *        because they are not protected by any kind of mutex to allow
60     *        only one modifier. We should add a mutex for each element in
61     *        the chainlist.
62     *************************************************************************/
63    
64    
65  typedef struct DINST  typedef struct DINST
# Line 63  Line 72 
72    
73  } DINST;  } DINST;
74    
75    /**************************************************************************
76     * Global data (needed to emulate correctly exported symbols from divx4)
77     *************************************************************************/
78    
79  static DINST * dhead = NULL;  /* This is not used in this module but is required by some divx4 encoders*/
80    int quiet_encore = 1;
81    
82    /**************************************************************************
83     * Local data
84     *************************************************************************/
85    
86  DINST * dinst_find(unsigned long key)  /* The Divx4 instance chainlist */
87  {  static DINST * dhead = NULL;
         DINST * dcur = dhead;  
88    
89          while (dcur)  /* Divx4 quality to XviD encoder motion flag presets */
90          {  static int const divx4_motion_presets[7] = {
91                  if (dcur->key == key)          0,
                 {  
                         return dcur;  
                 }  
                 dcur = dcur->next;  
         }  
92    
93          return NULL;          PMV_QUICKSTOP16,
 }  
94    
95            PMV_EARLYSTOP16,
96    
97  DINST * dinst_add(unsigned long key)          PMV_EARLYSTOP16 | PMV_HALFPELREFINE16,
 {  
         DINST * dnext = dhead;  
98    
99          dhead = malloc(sizeof(DINST));          PMV_EARLYSTOP16 | PMV_HALFPELREFINE16 |
100          if (dhead == NULL)          PMV_EARLYSTOP8  | PMV_HALFPELDIAMOND8,
         {  
                 dhead = dnext;  
                 return NULL;  
         }  
101    
102          dhead->key = key;          PMV_EARLYSTOP16 | PMV_HALFPELREFINE16 |
103          dhead->next = dnext;          PMV_EARLYSTOP8  | PMV_HALFPELDIAMOND8,
104    
105          return dhead;          PMV_EARLYSTOP16    | PMV_HALFPELREFINE16 |
106  }          PMV_EXTSEARCH16    | PMV_EARLYSTOP8 |
107            PMV_HALFPELREFINE8 | PMV_HALFPELDIAMOND8
108    };
109    
110    
111  void dinst_remove(unsigned long key)  /* Divx4 quality to general encoder flag presets */
112  {  static int const divx4_general_presets[7] = {
113          DINST * dcur = dhead;          0,
114            XVID_H263QUANT,
115            XVID_H263QUANT,
116            XVID_H263QUANT | XVID_HALFPEL,
117            XVID_H263QUANT | XVID_INTER4V | XVID_HALFPEL,
118            XVID_H263QUANT | XVID_INTER4V | XVID_HALFPEL,
119            XVID_H263QUANT | XVID_INTER4V | XVID_HALFPEL
120    };
121    
122          if (dhead == NULL)  /*
123          {   * Current divx4 encoder quality
124                  return;   * ToDo : this data should not be shared between encoder instances
125          }   */
126    static int quality;
127    
128          if (dcur->key == key)  /**************************************************************************
129          {   * Local Prototypes
130                  dhead = dcur->next;   *************************************************************************/
                 free(dcur);  
                 return;  
         }  
131    
132          while (dcur->next)  /* Chain list helper functions */
133          {  static DINST * dinst_find(unsigned long key);
134                  if (dcur->next->key == key)  static DINST * dinst_add(unsigned long key);
135                  {  static void    dinst_remove(unsigned long key);
136                          DINST * tmp = dcur->next;  
137                          dcur->next = tmp->next;  /* Converts divx4 colorspaces codes to xvid codes */
138                          free(tmp);  static int xvid_to_opendivx_dec_csp(int csp);
139                          return;  static int xvid_to_opendivx_enc_csp(int csp);
                 }  
                 dcur = dcur->next;  
         }  
 }  
140    
141    /**************************************************************************
142     * decore part
143     *
144     * decore is the divx4 entry point used to decompress the mpeg4 bitstream
145     * into a user defined image format.
146     *************************************************************************/
147    
148  int xvid_to_opendivx_dec_csp(int csp)  int
149    decore(unsigned long key, unsigned long opt, void * param1, void * param2)
150  {  {
         switch(csp)  
         {  
         case DEC_YV12 :  
                 return XVID_CSP_YV12;  
         case DEC_420 :  
                 return XVID_CSP_I420;  
         case DEC_YUY2 :  
                 return XVID_CSP_YUY2;  
         case DEC_UYVY :  
                 return XVID_CSP_UYVY;  
         case DEC_RGB32 :  
                 return XVID_CSP_VFLIP | XVID_CSP_RGB32;  
         case DEC_RGB24 :  
                 return XVID_CSP_VFLIP | XVID_CSP_RGB24;  
         case DEC_RGB565 :  
                 return XVID_CSP_VFLIP | XVID_CSP_RGB565;  
         case DEC_RGB555 :  
                 return XVID_CSP_VFLIP | XVID_CSP_RGB555;  
         case DEC_RGB32_INV :  
                 return XVID_CSP_RGB32;  
         case DEC_RGB24_INV :  
                 return XVID_CSP_RGB24;  
         case DEC_RGB565_INV :  
                 return XVID_CSP_RGB565;  
         case DEC_RGB555_INV :  
                 return XVID_CSP_RGB555;  
         case DEC_USER :  
                 return XVID_CSP_USER;  
         default :  
                 return -1;  
         }  
 }  
   
151    
 int decore(unsigned long key, unsigned long opt,  
                                         void * param1, void * param2)  
 {  
152          int xerr;          int xerr;
153    
154          switch (opt)          switch (opt) {
155          {  
156          case DEC_OPT_MEMORY_REQS :          case DEC_OPT_MEMORY_REQS :
157                  {                  {
158                          memset(param2, 0, sizeof(DEC_MEM_REQS));                          memset(param2, 0, sizeof(DEC_MEM_REQS));
# Line 183  Line 161 
161    
162          case DEC_OPT_INIT :          case DEC_OPT_INIT :
163                  {                  {
                         DEC_PARAM * dparam = (DEC_PARAM *)param1;  
164                          XVID_INIT_PARAM xinit;                          XVID_INIT_PARAM xinit;
165                          XVID_DEC_PARAM xparam;                          XVID_DEC_PARAM xparam;
166                          DINST * dcur = dinst_find(key);                  DINST * dcur;
167                          if (dcur == NULL)                  DEC_PARAM * dparam = (DEC_PARAM *)param1;
168    
169                    /* Find the divx4 instance */
170                    if ((dcur = dinst_find(key)) == NULL)
171                          {                          {
172                                  dcur = dinst_add(key);                                  dcur = dinst_add(key);
173                          }                          }
174    
175                    /*
176                     * XviD initialization
177                     * XviD will detect the host cpu type and activate optimized
178                     * functions according to the host cpu features.
179                     */
180                          xinit.cpu_flags = 0;                          xinit.cpu_flags = 0;
181                          xvid_init(NULL, 0, &xinit, NULL);                          xvid_init(NULL, 0, &xinit, NULL);
182    
183                    /* XviD decoder initialization for this instance */
184                          xparam.width = dparam->x_dim;                          xparam.width = dparam->x_dim;
185                          xparam.height = dparam->y_dim;                          xparam.height = dparam->y_dim;
186                          dcur->xframe.colorspace = xvid_to_opendivx_dec_csp(dparam->output_format);                  dcur->xframe.colorspace =
187                            xvid_to_opendivx_dec_csp(dparam->output_format);
188    
189                          xerr = decoder_create(&xparam);                          xerr = decoder_create(&xparam);
190    
191                    /* Store the xvid handle into the divx4 instance chainlist */
192                          dcur->handle = xparam.handle;                          dcur->handle = xparam.handle;
193    
194                          break;                          break;
# Line 208  Line 196 
196    
197          case DEC_OPT_RELEASE :          case DEC_OPT_RELEASE :
198                  {                  {
199                          DINST * dcur = dinst_find(key);                  DINST * dcur;
200                          if (dcur == NULL)  
201                    /* Find the divx4 instance into the chain list */
202                    if ((dcur = dinst_find(key)) == NULL)
203                          {                          {
204                                  return DEC_EXIT;                                  return DEC_EXIT;
205                          }                          }
206    
207                    /* Destroy the XviD decoder attached to this divx4 instance */
208                          xerr = decoder_destroy(dcur->handle);                          xerr = decoder_destroy(dcur->handle);
209    
210                    /* Remove the divx4 instance from the chainlist */
211                          dinst_remove(key);                          dinst_remove(key);
212    
213                          break;                          break;
# Line 223  Line 215 
215    
216          case DEC_OPT_SETPP :          case DEC_OPT_SETPP :
217                  {                  {
218                          // DEC_SET * dset = (DEC_SET *)param1;                  DINST * dcur;
219                          DINST * dcur = dinst_find(key);  
220                          if (dcur == NULL)                  /* Find the divx4 instance into the chain list */
221                    if ((dcur = dinst_find(key)) == NULL)
222                          {                          {
223                                  return DEC_EXIT;                                  return DEC_EXIT;
224                          }                          }
225    
226                          // dcur->xframe.pp = dset->postproc_level;                  /*
227                     * We return DEC_OK but XviD has no postprocessing implemented
228                     * in core.
229                     */
230                          return DEC_OK;                          return DEC_OK;
231                  }                  }
232    
233          case DEC_OPT_SETOUT :          case DEC_OPT_SETOUT :
234                  {                  {
235                    DINST * dcur;
236                          DEC_PARAM * dparam = (DEC_PARAM *)param1;                          DEC_PARAM * dparam = (DEC_PARAM *)param1;
237                          DINST * dcur = dinst_find(key);  
238                          if (dcur == NULL)                  if ((dcur = dinst_find(key)) == NULL)
239                          {                          {
240                                  return DEC_EXIT;                                  return DEC_EXIT;
241                          }                          }
242    
243                          dcur->xframe.colorspace = xvid_to_opendivx_dec_csp(dparam->output_format);                  /* Change the output colorspace */
244                    dcur->xframe.colorspace =
245                            xvid_to_opendivx_dec_csp(dparam->output_format);
246    
247                          return DEC_OK;                          return DEC_OK;
248                  }                  }
# Line 252  Line 250 
250          case DEC_OPT_FRAME:          case DEC_OPT_FRAME:
251                  {                  {
252                          int csp_tmp = 0;                          int csp_tmp = 0;
253                    DINST * dcur;
254                          DEC_FRAME * dframe = (DEC_FRAME *)param1;                          DEC_FRAME * dframe = (DEC_FRAME *)param1;
255                          DINST * dcur = dinst_find(key);  
256                          if (dcur == NULL)                  if ((dcur = dinst_find(key)) == NULL)
257                          {                          {
258                                  return DEC_EXIT;                                  return DEC_EXIT;
259                          }                          }
260    
261                    /* Copy the divx4 fields to the XviD decoder structure */
262                          dcur->xframe.bitstream = dframe->bitstream;                          dcur->xframe.bitstream = dframe->bitstream;
263                          dcur->xframe.length = dframe->length;                          dcur->xframe.length = dframe->length;
264                          dcur->xframe.image = dframe->bmp;                          dcur->xframe.image = dframe->bmp;
265                          dcur->xframe.stride = dframe->stride;                          dcur->xframe.stride = dframe->stride;
266    
267                    /* Does the frame need to be skipped ? */
268                          if (!dframe->render_flag)                          if (!dframe->render_flag)
269                          {                          {
270                            /*
271                             * Then we use the null colorspace to force XviD to
272                             * skip the frame. The original colorspace will be
273                             * restored after the decoder call
274                             */
275                                  csp_tmp = dcur->xframe.colorspace;                                  csp_tmp = dcur->xframe.colorspace;
276                                  dcur->xframe.colorspace = XVID_CSP_NULL;                                  dcur->xframe.colorspace = XVID_CSP_NULL;
277                          }                          }
278    
279                    /* Decode the bitstream */
280                          xerr = decoder_decode(dcur->handle, &dcur->xframe);                          xerr = decoder_decode(dcur->handle, &dcur->xframe);
281    
282                    /* Restore the real colorspace for this instance */
283                          if (!dframe->render_flag)                          if (!dframe->render_flag)
284                          {                          {
285                                  dcur->xframe.colorspace = csp_tmp;                                  dcur->xframe.colorspace = csp_tmp;
# Line 281  Line 288 
288                          break;                          break;
289                  }                  }
290    
   
291          case DEC_OPT_FRAME_311 :          case DEC_OPT_FRAME_311 :
292                    /* XviD does not handle Divx ;-) 3.11 yet */
293                  return DEC_EXIT;                  return DEC_EXIT;
294    
   
295          case DEC_OPT_VERSION:          case DEC_OPT_VERSION:
296                  return EMULATED_DIVX_VERSION;                  return EMULATED_DIVX_VERSION;
297    
298          default :          default :
299                  return DEC_EXIT;                  return DEC_EXIT;
300          }          }
301    
302    
303            /* XviD error code -> Divx4 */
304          switch(xerr)          switch(xerr)
305          {          {
306          case XVID_ERR_OK : return DEC_OK;          case XVID_ERR_OK :
307          case XVID_ERR_MEMORY : return DEC_MEMORY;                  return DEC_OK;
308          case XVID_ERR_FORMAT : return DEC_BAD_FORMAT;          case XVID_ERR_MEMORY :
309          default : // case XVID_ERR_FAIL :                  return DEC_MEMORY;
310            case XVID_ERR_FORMAT :
311                    return DEC_BAD_FORMAT;
312            default :
313                  return DEC_EXIT;                  return DEC_EXIT;
314          }          }
315  }  }
316    
317    /**************************************************************************
318     * Encore Part
319     *
320  // encore   * encore is the divx4 entry point used to compress a frame to a mpeg4
321     * bitstream.
322     *************************************************************************/
323    
324  #define FRAMERATE_INCR          1001  #define FRAMERATE_INCR          1001
325    
326  int divx4_motion_presets[7] = {  int
327          0, PMV_QUICKSTOP16, PMV_EARLYSTOP16, PMV_EARLYSTOP16 | PMV_EARLYSTOP8,  encore(void * handle, int opt, void * param1, void * param2)
         PMV_EARLYSTOP16 | PMV_HALFPELREFINE16 | PMV_EARLYSTOP8 | PMV_HALFPELDIAMOND8,  
         PMV_EARLYSTOP16 | PMV_HALFPELREFINE16 | PMV_EARLYSTOP8 | PMV_HALFPELDIAMOND8,  
         PMV_EARLYSTOP16 | PMV_HALFPELREFINE16 | PMV_EXTSEARCH16 |  
         PMV_EARLYSTOP8 | PMV_HALFPELREFINE8 | PMV_HALFPELDIAMOND8  
 };  
   
 int quality;  
   
 int encore(void * handle, int opt, void * param1, void * param2)  
328  {  {
329    
330          int xerr;          int xerr;
331    
332          switch(opt)          switch(opt) {
         {  
333          case ENC_OPT_INIT :          case ENC_OPT_INIT :
334                  {                  {
335                          ENC_PARAM * eparam = (ENC_PARAM *)param1;                          ENC_PARAM * eparam = (ENC_PARAM *)param1;
336                          XVID_INIT_PARAM xinit;                          XVID_INIT_PARAM xinit;
337                          XVID_ENC_PARAM xparam;                          XVID_ENC_PARAM xparam;
338    
339                    /* Init XviD which will detect host cpu features */
340                          xinit.cpu_flags = 0;                          xinit.cpu_flags = 0;
341                          xvid_init(NULL, 0, &xinit, NULL);                          xvid_init(NULL, 0, &xinit, NULL);
342    
343                    /* Settings are copied to the XviD encoder structure */
344                          xparam.width = eparam->x_dim;                          xparam.width = eparam->x_dim;
345                          xparam.height = eparam->y_dim;                          xparam.height = eparam->y_dim;
346                          if ((eparam->framerate - (int)eparam->framerate) == 0)                          if ((eparam->framerate - (int)eparam->framerate) == 0)
# Line 347  Line 353 
353                                  xparam.fincr = FRAMERATE_INCR;                                  xparam.fincr = FRAMERATE_INCR;
354                                  xparam.fbase = (int)(FRAMERATE_INCR * eparam->framerate);                                  xparam.fbase = (int)(FRAMERATE_INCR * eparam->framerate);
355                          }                          }
356                          xparam.bitrate = eparam->bitrate;                  xparam.rc_bitrate = eparam->bitrate;
357                          xparam.rc_buffersize = 10 * eparam->bitrate;                  xparam.rc_reaction_delay_factor = 16;
358                    xparam.rc_averaging_period = 100;
359                    xparam.rc_buffer = 100;
360                          xparam.min_quantizer = eparam->min_quantizer;                          xparam.min_quantizer = eparam->min_quantizer;
361                          xparam.max_quantizer = eparam->max_quantizer;                          xparam.max_quantizer = eparam->max_quantizer;
362                          xparam.max_key_interval = eparam->max_key_interval;                          xparam.max_key_interval = eparam->max_key_interval;
363                          quality = eparam->quality;                          quality = eparam->quality;
364    
365                    /* Create the encoder session */
366                          xerr = encoder_create(&xparam);                          xerr = encoder_create(&xparam);
367    
368                          eparam->handle = xparam.handle;                          eparam->handle = xparam.handle;
# Line 375  Line 384 
384                          XVID_ENC_FRAME xframe;                          XVID_ENC_FRAME xframe;
385                          XVID_ENC_STATS xstats;                          XVID_ENC_STATS xstats;
386    
387                    /* Copy the divx4 info into the xvid structure */
388                          xframe.bitstream = eframe->bitstream;                          xframe.bitstream = eframe->bitstream;
389                          xframe.length = eframe->length;                          xframe.length = eframe->length;
390    
                         xframe.general = XVID_HALFPEL | XVID_H263QUANT;  
   
                         if(quality > 3)  
                                 xframe.general |= XVID_INTER4V;  
   
391                          xframe.motion = divx4_motion_presets[quality];                          xframe.motion = divx4_motion_presets[quality];
392                    xframe.general = divx4_general_presets[quality];
393    
394                          xframe.image = eframe->image;                          xframe.image = eframe->image;
395                          switch (eframe->colorspace)                  xframe.colorspace =
396                          {                          xvid_to_opendivx_enc_csp(eframe->colorspace);
                         case ENC_CSP_RGB24 :  
                                 xframe.colorspace = XVID_CSP_VFLIP | XVID_CSP_RGB24;  
                                 break;  
                         case ENC_CSP_YV12 :  
                                 xframe.colorspace = XVID_CSP_YV12;  
                                 break;  
                         case ENC_CSP_YUY2 :  
                                 xframe.colorspace = XVID_CSP_YUY2;  
                                 break;  
                         case ENC_CSP_UYVY :  
                                 xframe.colorspace = XVID_CSP_UYVY;  
                                 break;  
                         case ENC_CSP_I420 :  
                                 xframe.colorspace = XVID_CSP_I420;  
                                 break;  
                         }  
397    
398                          if (opt == ENC_OPT_ENCODE_VBR)                          if (opt == ENC_OPT_ENCODE_VBR)
399                          {                          {
# Line 416  Line 406 
406                                  xframe.quant = 0;                                  xframe.quant = 0;
407                          }                          }
408    
409                    /* Encode the frame */
410                          xerr = encoder_encode((Encoder *) handle, &xframe, (eresult ? &xstats : NULL) );                          xerr = encoder_encode((Encoder *) handle, &xframe, (eresult ? &xstats : NULL) );
411    
412                    /* Copy back the xvid structure to the divx4 one */
413                          if (eresult)                          if (eresult)
414                          {                          {
415                                  eresult->is_key_frame = xframe.intra;                                  eresult->is_key_frame = xframe.intra;
# Line 436  Line 428 
428                  return ENC_FAIL;                  return ENC_FAIL;
429          }          }
430    
431            /* XviD Error code  -> Divx4 error code */
432          switch(xerr)          switch(xerr)
433          {          {
434          case XVID_ERR_OK : return ENC_OK;          case XVID_ERR_OK :
435          case XVID_ERR_MEMORY : return ENC_MEMORY;                  return ENC_OK;
436          case XVID_ERR_FORMAT : return ENC_BAD_FORMAT;          case XVID_ERR_MEMORY :
437          default : // case XVID_ERR_FAIL :                  return ENC_MEMORY;
438            case XVID_ERR_FORMAT :
439                    return ENC_BAD_FORMAT;
440            default :
441                  return ENC_FAIL;                  return ENC_FAIL;
442          }          }
443  }  }
444    
445    /**************************************************************************
446     * Local Functions
447     *************************************************************************/
448    
449    /***************************************
450     * DINST chainlist helper functions    *
451     ***************************************/
452    
453    /* Find an element in the chainlist according to its key value */
454    static DINST * dinst_find(unsigned long key)
455    {
456            DINST * dcur = dhead;
457    
458            while (dcur)
459            {
460                    if (dcur->key == key)
461                    {
462                            return dcur;
463                    }
464                    dcur = dcur->next;
465            }
466    
467            return NULL;
468    }
469    
470    
471    /* Add an element to the chainlist */
472    static DINST * dinst_add(unsigned long key)
473    {
474            DINST * dnext = dhead;
475    
476            dhead = malloc(sizeof(DINST));
477            if (dhead == NULL)
478            {
479                    dhead = dnext;
480                    return NULL;
481            }
482    
483            dhead->key = key;
484            dhead->next = dnext;
485    
486            return dhead;
487    }
488    
489    
490    /* Remove an elmement from the chainlist */
491    static void dinst_remove(unsigned long key)
492    {
493            DINST * dcur = dhead;
494    
495            if (dhead == NULL)
496            {
497                    return;
498            }
499    
500            if (dcur->key == key)
501            {
502                    dhead = dcur->next;
503                    free(dcur);
504                    return;
505            }
506    
507            while (dcur->next)
508            {
509                    if (dcur->next->key == key)
510                    {
511                            DINST * tmp = dcur->next;
512                            dcur->next = tmp->next;
513                            free(tmp);
514                            return;
515                    }
516                    dcur = dcur->next;
517            }
518    }
519    
520    /***************************************
521     * Colorspace code converter           *
522     ***************************************/
523    
524    static int xvid_to_opendivx_dec_csp(int csp)
525    {
526    
527            switch(csp)
528            {
529            case DEC_YV12 :
530                    return XVID_CSP_YV12;
531            case DEC_420 :
532                    return XVID_CSP_I420;
533            case DEC_YUY2 :
534                    return XVID_CSP_YUY2;
535            case DEC_UYVY :
536                    return XVID_CSP_UYVY;
537            case DEC_RGB32 :
538                    return XVID_CSP_VFLIP | XVID_CSP_RGB32;
539            case DEC_RGB24 :
540                    return XVID_CSP_VFLIP | XVID_CSP_RGB24;
541            case DEC_RGB565 :
542                    return XVID_CSP_VFLIP | XVID_CSP_RGB565;
543            case DEC_RGB555 :
544                    return XVID_CSP_VFLIP | XVID_CSP_RGB555;
545            case DEC_RGB32_INV :
546                    return XVID_CSP_RGB32;
547            case DEC_RGB24_INV :
548                    return XVID_CSP_RGB24;
549            case DEC_RGB565_INV :
550                    return XVID_CSP_RGB565;
551            case DEC_RGB555_INV :
552                    return XVID_CSP_RGB555;
553            case DEC_USER :
554                    return XVID_CSP_USER;
555            default :
556                    return -1;
557            }
558    }
559    
560    static int xvid_to_opendivx_enc_csp(int csp)
561    {
562    
563            switch (csp)
564            {
565            case ENC_CSP_RGB24 :
566                    return XVID_CSP_VFLIP | XVID_CSP_RGB24;
567            case ENC_CSP_YV12 :
568                    return XVID_CSP_YV12;
569            case ENC_CSP_YUY2 :
570                    return XVID_CSP_YUY2;
571            case ENC_CSP_UYVY :
572                    return XVID_CSP_UYVY;
573            case ENC_CSP_I420 :
574                    return XVID_CSP_I420;
575            default :
576                    return -1;
577            }
578    }

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.9

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