[svn] / trunk / xvidcore / examples / xvid_decraw.c Repository:
ViewVC logotype

Diff of /trunk/xvidcore/examples/xvid_decraw.c

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

revision 824, Sun Feb 9 19:32:52 2003 UTC revision 1382, Mon Mar 22 22:36:25 2004 UTC
# Line 3  Line 3 
3   *  XVID MPEG-4 VIDEO CODEC   *  XVID MPEG-4 VIDEO CODEC
4   *  - Console based decoding test application  -   *  - Console based decoding test application  -
5   *   *
6   *  Copyright(C) 2002 Christoph Lampert   *  Copyright(C) 2002-2003 Christoph Lampert
7     *               2002-2003 Edouard Gomez <ed.gomez@free.fr>
8   *   *
9   *  This program is free software; you can redistribute it and/or modify   *  This program is free software; you can redistribute it and/or modify
10   *  it under the terms of the GNU General Public License as published by   *  it under the terms of the GNU General Public License as published by
# Line 19  Line 20 
20   *  along with this program; if not, write to the Free Software   *  along with this program; if not, write to the Free Software
21   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
22   *   *
23   * $Id: xvid_decraw.c,v 1.5 2003-02-09 19:32:52 edgomez Exp $   * $Id: xvid_decraw.c,v 1.10 2004-03-22 22:36:23 edgomez Exp $
24   *   *
25   ****************************************************************************/   ****************************************************************************/
26    
# Line 31  Line 32 
32   *  the speed for this is measured.   *  the speed for this is measured.
33   *   *
34   *  The program is plain C and needs no libraries except for libxvidcore,   *  The program is plain C and needs no libraries except for libxvidcore,
35   *  and maths-lib, so with UN*X you simply compile by   *  and maths-lib.
36   *   *
37   *   gcc xvid_decraw.c -lxvidcore -lm -o xvid_decraw   *  Use ./xvid_decraw -help for a list of options
  *  
  *  You have to specify the image dimensions (until the add the feature  
  *  to read this from the bitstream)  
  *  
  * Usage : xvid_decraw <-w width> <-h height> [OPTIONS]  
  * Options :  
  *  -asm           : use assembly optimizations (default=disabled)  
  *  -w integer     : frame width ([1.2048])  
  *  -h integer     : frame height ([1.2048])  
  *  -i string      : input filename (default=stdin)  
  *  -t integer     : input data type (raw=0, mp4u=1)  
  *  -d boolean     : save decoder output (0 False*, !=0 True)  
  *  -m boolean     : save mpeg4 raw stream to single files (0 False*, !=0 True)  
  *  -help          : This help message  
  * (* means default)  
38   *   *
39   ****************************************************************************/   ****************************************************************************/
40    
# Line 75  Line 61 
61  static int YDIM = 0;  static int YDIM = 0;
62  static int ARG_SAVEDECOUTPUT = 0;  static int ARG_SAVEDECOUTPUT = 0;
63  static int ARG_SAVEMPEGSTREAM = 0;  static int ARG_SAVEMPEGSTREAM = 0;
 static int ARG_STREAMTYPE = 0;  
64  static char *ARG_INPUTFILE = NULL;  static char *ARG_INPUTFILE = NULL;
65    
66    
67  static char filepath[256] = "./";  static char filepath[256] = "./";
68  static void *dec_handle = NULL;  static void *dec_handle = NULL;
69    
70  # define BUFFER_SIZE 10*XDIM*YDIM  #define BUFFER_SIZE (2*1024*1024)
   
 #define LONG_PACK(a,b,c,d) ((long) (((long)(a))<<24) | (((long)(b))<<16) | \  
                                    (((long)(c))<<8)  |((long)(d)))  
   
 #define SWAP(a) ( (((a)&0x000000ff)<<24) | (((a)&0x0000ff00)<<8) | \  
                   (((a)&0x00ff0000)>>8)  | (((a)&0xff000000)>>24) )  
71    
72  /*****************************************************************************  /*****************************************************************************
73   *               Local prototypes   *               Local prototypes
# Line 101  Line 80 
80  static int dec_main(unsigned char *istream,  static int dec_main(unsigned char *istream,
81                      unsigned char *ostream,                      unsigned char *ostream,
82                      int istream_size,                      int istream_size,
83                      int *ostream_size);                                          xvid_dec_stats_t *xvid_dec_stats);
84  static int dec_stop();  static int dec_stop();
85  static void usage();  static void usage();
86    
87    
88    const char * type2str(int type)
89    {
90        if (type==XVID_TYPE_IVOP)
91            return "I";
92        if (type==XVID_TYPE_PVOP)
93            return "P";
94        if (type==XVID_TYPE_BVOP)
95            return "B";
96        return "S";
97    }
98    
99  /*****************************************************************************  /*****************************************************************************
100   *        Main program   *        Main program
101   ****************************************************************************/   ****************************************************************************/
# Line 114  Line 105 
105          unsigned char *mp4_buffer = NULL;          unsigned char *mp4_buffer = NULL;
106          unsigned char *mp4_ptr    = NULL;          unsigned char *mp4_ptr    = NULL;
107          unsigned char *out_buffer = NULL;          unsigned char *out_buffer = NULL;
108          int bigendian = 0;          int useful_bytes;
109            xvid_dec_stats_t xvid_dec_stats;
110    
111          double totaldectime;          double totaldectime;
112    
# Line 130  Line 122 
122          int i;          int i;
123    
124          printf("xvid_decraw - raw mpeg4 bitstream decoder ");          printf("xvid_decraw - raw mpeg4 bitstream decoder ");
125          printf("written by Christoph Lampert 2002\n\n");          printf("written by Christoph Lampert 2002-2003\n\n");
126    
127  /*****************************************************************************  /*****************************************************************************
128   * Command line parsing   * Command line parsing
# Line 140  Line 132 
132    
133                  if (strcmp("-asm", argv[i]) == 0 ) {                  if (strcmp("-asm", argv[i]) == 0 ) {
134                          use_assembler = 1;                          use_assembler = 1;
135                  }                  } else if (strcmp("-d", argv[i]) == 0) {
136                  else if (strcmp("-w", argv[i]) == 0 && i < argc - 1 ) {                          ARG_SAVEDECOUTPUT = 1;
137                          i++;                  } else if (strcmp("-i", argv[i]) == 0 && i < argc - 1 ) {
                         XDIM = atoi(argv[i]);  
                 }  
                 else if (strcmp("-h", argv[i]) == 0 && i < argc - 1 ) {  
                         i++;  
                         YDIM = atoi(argv[i]);  
                 }  
                 else if (strcmp("-d", argv[i]) == 0 && i < argc - 1 ) {  
                         i++;  
                         ARG_SAVEDECOUTPUT = atoi(argv[i]);  
                 }  
                 else if (strcmp("-i", argv[i]) == 0 && i < argc - 1 ) {  
138                          i++;                          i++;
139                          ARG_INPUTFILE = argv[i];                          ARG_INPUTFILE = argv[i];
140                  }                  } else if (strcmp("-m", argv[i]) == 0) {
141                  else if (strcmp("-m", argv[i]) == 0 && i < argc - 1 ) {                          ARG_SAVEMPEGSTREAM = 1;
142                          i++;                  } else if (strcmp("-help", argv[i]) == 0) {
                         ARG_SAVEMPEGSTREAM = atoi(argv[i]);  
                 }  
                 else if (strcmp("-t", argv[i]) == 0 && i < argc - 1 ) {  
                         i++;  
                         ARG_STREAMTYPE = atoi(argv[i]);  
                 }  
                 else if (strcmp("-help", argv[i])) {  
143                          usage();                          usage();
144                          return(0);                          return(0);
145                  }                  } else {
                 else {  
146                          usage();                          usage();
147                          exit(-1);                          exit(-1);
148                  }                  }
   
149          }          }
150    
151  /*****************************************************************************  /*****************************************************************************
152   * Values checking   * Values checking
153   ****************************************************************************/   ****************************************************************************/
154    
         if(XDIM <= 0 || XDIM > 2048 || YDIM <= 0 || YDIM > 2048) {  
                 usage();  
                 return -1;  
         }  
   
155          if ( ARG_INPUTFILE == NULL || strcmp(ARG_INPUTFILE, "stdin") == 0) {          if ( ARG_INPUTFILE == NULL || strcmp(ARG_INPUTFILE, "stdin") == 0) {
156                  in_file = stdin;                  in_file = stdin;
157          }          }
# Line 193  Line 160 
160                  in_file = fopen(ARG_INPUTFILE, "rb");                  in_file = fopen(ARG_INPUTFILE, "rb");
161                  if (in_file == NULL) {                  if (in_file == NULL) {
162                          fprintf(stderr, "Error opening input file %s\n", ARG_INPUTFILE);                          fprintf(stderr, "Error opening input file %s\n", ARG_INPUTFILE);
163                          return -1;                          return(-1);
164                  }                  }
165          }          }
166    
# Line 207  Line 174 
174          if (!mp4_buffer)          if (!mp4_buffer)
175                  goto free_all_memory;                  goto free_all_memory;
176    
         /* Memory for frame output */  
         out_buffer = (unsigned char *) malloc(XDIM*YDIM*4);  
         if (!out_buffer)  
                 goto free_all_memory;  
   
   
177  /*****************************************************************************  /*****************************************************************************
178   *        XviD PART  Start   *        XviD PART  Start
179   ****************************************************************************/   ****************************************************************************/
# Line 229  Line 190 
190   *                               Main loop   *                               Main loop
191   ****************************************************************************/   ****************************************************************************/
192    
193          totalsize = LONG_PACK('M','P','4','U');          /* Fill the buffer */
194          mp4_ptr = (unsigned char *)&totalsize;          useful_bytes = fread(mp4_buffer, 1, BUFFER_SIZE, in_file);
         if(*mp4_ptr == 'M')  
                 bigendian = 1;  
         else  
                 bigendian = 0;  
   
         if(ARG_STREAMTYPE) {  
   
                 unsigned char header[4];  
   
                 /* MP4U format  : read header */  
                 if(feof(in_file))  
                         goto release_all;  
                 fread(header, 4, 1, in_file);  
   
                 if(header[0] != 'M' || header[1] != 'P' ||  
                    header[2] != '4' || header[3] != 'U') {  
                         fprintf(stderr, "Error, this not a mp4u container file\n");  
                         goto release_all;  
                 }  
   
         }  
         else {  
                 fread(mp4_buffer, BUFFER_SIZE, 1, in_file);  
         }  
195    
196          totaldectime = 0;          totaldectime = 0;
197          totalsize = 0;          totalsize = 0;
# Line 262  Line 199 
199          mp4_ptr = mp4_buffer;          mp4_ptr = mp4_buffer;
200    
201          do {          do {
   
                 int mp4_size = (mp4_buffer + BUFFER_SIZE - mp4_ptr);  
202                  int used_bytes = 0;                  int used_bytes = 0;
203                  double dectime;                  double dectime;
204    
                 /* Read data from input file */  
                 if(ARG_STREAMTYPE) {  
   
                         /* MP4U container */  
   
                         /* Read stream size first */  
                         if(feof(in_file))  
                                 break;  
                         fread(&mp4_size, sizeof(long), 1, in_file);  
   
                         /* Mp4U container is big endian */  
                         if(!bigendian)  
                                 mp4_size = SWAP(mp4_size);  
   
                         /* Read mp4_size_bytes */  
                         if(feof(in_file))  
                                 break;  
                         fread(mp4_buffer, mp4_size, 1, in_file);  
   
205                          /*                          /*
206                           * When reading mp4u, we don't have to care about buffer                   * If the buffer is half empty or there are no more bytes in it
207                           * filling as we know exactly how much bytes there are in                   * then fill it.
                          * next frame  
208                           */                           */
                         mp4_ptr = mp4_buffer;  
   
                 }  
                 else {  
   
                         /* Real raw stream */  
   
                         /* buffer more than half empty -> Fill it */  
209                          if (mp4_ptr > mp4_buffer + BUFFER_SIZE/2) {                          if (mp4_ptr > mp4_buffer + BUFFER_SIZE/2) {
210                                  int rest = (mp4_buffer + BUFFER_SIZE - mp4_ptr);                          int already_in_buffer = (mp4_buffer + BUFFER_SIZE - mp4_ptr);
211    
212                                  /* Move data if needed */                                  /* Move data if needed */
213                                  if (rest)                          if (already_in_buffer > 0)
214                                          memcpy(mp4_buffer, mp4_ptr, rest);                                  memcpy(mp4_buffer, mp4_ptr, already_in_buffer);
215    
216                                  /* Update mp4_ptr */                                  /* Update mp4_ptr */
217                                  mp4_ptr = mp4_buffer;                                  mp4_ptr = mp4_buffer;
# Line 312  Line 219 
219                                  /* read new data */                                  /* read new data */
220                                  if(feof(in_file))                                  if(feof(in_file))
221                                          break;                                          break;
                                 fread(mp4_buffer + rest, BUFFER_SIZE - rest, 1, in_file);  
222    
223                          }                          useful_bytes += fread(mp4_buffer + already_in_buffer,
224                                                                      1, BUFFER_SIZE - already_in_buffer,
225                                                                      in_file);
226    
227                  }                  }
228    
229    
230                    /* This loop is needed to handle VOL/NVOP reading */
231                    do {
232    
233                  /* Decode frame */                  /* Decode frame */
234                  dectime = msecond();                  dectime = msecond();
235                  status = dec_main(mp4_ptr, out_buffer, mp4_size, &used_bytes);                          used_bytes = dec_main(mp4_ptr, out_buffer, useful_bytes, &xvid_dec_stats);
236                  dectime = msecond() - dectime;                  dectime = msecond() - dectime;
237    
238                  if (status) {                          /* Resize image buffer if needed */
239                          break;                          if(xvid_dec_stats.type == XVID_TYPE_VOL) {
240    
241                                    /* Check if old buffer is smaller */
242                                    if(XDIM*YDIM < xvid_dec_stats.data.vol.width*xvid_dec_stats.data.vol.height) {
243    
244                                            /* Copy new witdh and new height from the vol structure */
245                                            XDIM = xvid_dec_stats.data.vol.width;
246                                            YDIM = xvid_dec_stats.data.vol.height;
247    
248                                            /* Free old output buffer*/
249                                            if(out_buffer) free(out_buffer);
250    
251                                            /* Allocate the new buffer */
252                                            out_buffer = (unsigned char*)malloc(XDIM*YDIM*4);
253                                            if(out_buffer == NULL)
254                                                    goto free_all_memory;
255    
256                                            fprintf(stderr, "Resized frame buffer to %dx%d\n", XDIM, YDIM);
257                                    }
258                  }                  }
259    
260                  /*                          /* Update buffer pointers */
261                   * Only needed for real raw stream, mp4u uses                          if(used_bytes > 0) {
                  * mp4_ptr = mp4_buffer for each frame  
                  */  
262                  mp4_ptr += used_bytes;                  mp4_ptr += used_bytes;
263                                    useful_bytes -= used_bytes;
264    
265                  /* Updated data */                                  /* Total size */
266                  totalsize += used_bytes;                  totalsize += used_bytes;
267                            }
268    
269                    }while(xvid_dec_stats.type <= 0 && useful_bytes > 0);
270    
271                    /* Check if there is a negative number of useful bytes left in buffer
272                     * This means we went too far */
273            if(useful_bytes < 0)
274                break;
275    
276            /* Updated data - Count only usefull decode time */
277                  totaldectime += dectime;                  totaldectime += dectime;
278    
                 /* Prints some decoding stats */  
                 printf("Frame %5d: dectime =%6.1f ms length=%7d bytes \n",  
                        filenr, dectime, used_bytes);  
279    
280                  /* Save individual mpeg4 strean if required */          printf("Frame %5d: type = %s, dectime(ms) =%6.1f, length(bytes) =%7d\n",
281                               filenr, type2str(xvid_dec_stats.type), dectime, used_bytes);
282    
283                    /* Save individual mpeg4 stream if required */
284                  if (ARG_SAVEMPEGSTREAM) {                  if (ARG_SAVEMPEGSTREAM) {
285                          FILE *filehandle = NULL;                          FILE *filehandle = NULL;
286    
# Line 353  Line 292 
292                                          filename);                                          filename);
293                          }                          }
294                          else {                          else {
295                                  fwrite(mp4_buffer, used_bytes, 1, filehandle);                                  fwrite(mp4_ptr-used_bytes, 1, used_bytes, filehandle);
296                                  fclose(filehandle);                                  fclose(filehandle);
297                          }                          }
298                  }                  }
299    
   
300                  /* Save output frame if required */                  /* Save output frame if required */
301                  if (ARG_SAVEDECOUTPUT) {                  if (ARG_SAVEDECOUTPUT) {
302                          sprintf(filename, "%sdec%05d.pgm", filepath, filenr);                          sprintf(filename, "%sdec%05d.pgm", filepath, filenr);
# Line 373  Line 311 
311    
312          } while ( (status>=0) && (filenr<ABS_MAXFRAMENR) );          } while ( (status>=0) && (filenr<ABS_MAXFRAMENR) );
313    
314    /*****************************************************************************
315     *     Flush decoder buffers
316     ****************************************************************************/
317    
318            do {
319    
320                    /* Fake vars */
321                    int used_bytes;
322                    double dectime;
323    
324            do {
325                        dectime = msecond();
326                        used_bytes = dec_main(NULL, out_buffer, -1, &xvid_dec_stats);
327                        dectime = msecond() - dectime;
328            }while(used_bytes>=0 && xvid_dec_stats.type <= 0);
329    
330            if (used_bytes < 0) {   /* XVID_ERR_END */
331                break;
332            }
333    
334                    /* Updated data - Count only usefull decode time */
335                    totaldectime += dectime;
336    
337                    /* Prints some decoding stats */
338            printf("Frame %5d: type = %s, dectime(ms) =%6.1f, length(bytes) =%7d\n",
339                               filenr, type2str(xvid_dec_stats.type), dectime, used_bytes);
340    
341                    /* Save output frame if required */
342                    if (ARG_SAVEDECOUTPUT) {
343                            sprintf(filename, "%sdec%05d.pgm", filepath, filenr);
344                            if(write_pgm(filename, out_buffer)) {
345                                    fprintf(stderr,
346                                                    "Error writing decoded PGM frame %s\n",
347                                                    filename);
348                            }
349                    }
350    
351                    filenr++;
352    
353            }while(1);
354    
355  /*****************************************************************************  /*****************************************************************************
356   *     Calculate totals and averages for output, print results   *     Calculate totals and averages for output, print results
# Line 381  Line 359 
359          totalsize    /= filenr;          totalsize    /= filenr;
360          totaldectime /= filenr;          totaldectime /= filenr;
361    
362          printf("Avg: dectime %5.2f ms, %5.2f fps, mp4 stream size =%d\n",          printf("Avg: dectime(ms) =%7.2f, fps =%7.2f, length(bytes) =%7d\n",
363                  totaldectime, 1000/totaldectime, (int)totalsize);                  totaldectime, 1000/totaldectime, (int)totalsize);
364    
365  /*****************************************************************************  /*****************************************************************************
# Line 399  Line 377 
377          free(out_buffer);          free(out_buffer);
378          free(mp4_buffer);          free(mp4_buffer);
379    
380          return 0;          return(0);
381  }  }
382    
383  /*****************************************************************************  /*****************************************************************************
# Line 409  Line 387 
387  static void usage()  static void usage()
388  {  {
389    
390          fprintf(stderr, "Usage : xvid_decraw <-w width> <-h height> [OPTIONS]\n");          fprintf(stderr, "Usage : xvid_decraw [OPTIONS]\n");
391          fprintf(stderr, "Options :\n");          fprintf(stderr, "Options :\n");
392          fprintf(stderr, " -asm           : use assembly optimizations (default=disabled)\n");          fprintf(stderr, " -asm           : use assembly optimizations (default=disabled)\n");
         fprintf(stderr, " -w integer     : frame width ([1.2048])\n");  
         fprintf(stderr, " -h integer     : frame height ([1.2048])\n");  
393          fprintf(stderr, " -i string      : input filename (default=stdin)\n");          fprintf(stderr, " -i string      : input filename (default=stdin)\n");
394          fprintf(stderr, " -t integer     : input data type (raw=0, mp4u=1)\n");          fprintf(stderr, " -d             : save decoder output\n");
395          fprintf(stderr, " -d boolean     : save decoder output (0 False*, !=0 True)\n");          fprintf(stderr, " -m             : save mpeg4 raw stream to individual files\n");
         fprintf(stderr, " -m boolean     : save mpeg4 raw stream to individual files (0 False*, !=0 True)\n");  
396          fprintf(stderr, " -help          : This help message\n");          fprintf(stderr, " -help          : This help message\n");
397          fprintf(stderr, " (* means default)\n");          fprintf(stderr, " (* means default)\n");
398    
# Line 434  Line 409 
409  #ifndef WIN32  #ifndef WIN32
410          struct timeval  tv;          struct timeval  tv;
411          gettimeofday(&tv, 0);          gettimeofday(&tv, 0);
412          return (double)tv.tv_sec*1.0e3 + (double)tv.tv_usec*1.0e-3;          return((double)tv.tv_sec*1.0e3 + (double)tv.tv_usec*1.0e-3);
413  #else  #else
414          clock_t clk;          clock_t clk;
415          clk = clock();          clk = clock();
416          return clk * 1000 / CLOCKS_PER_SEC;          return(clk * 1000 / CLOCKS_PER_SEC);
417  #endif  #endif
418  }  }
419    
# Line 483  Line 458 
458                  /* Close file */                  /* Close file */
459                  fclose(filehandle);                  fclose(filehandle);
460    
461                  return 0;                  return(0);
462          }          }
463          else          else
464                  return 1;                  return(1);
465  }  }
466    
467  /*****************************************************************************  /*****************************************************************************
# Line 497  Line 472 
472  static int  static int
473  dec_init(int use_assembler)  dec_init(int use_assembler)
474  {  {
475          int xerr;          int ret;
476    
477          XVID_INIT_PARAM xinit;          xvid_gbl_init_t   xvid_gbl_init;
478          XVID_DEC_PARAM xparam;          xvid_dec_create_t xvid_dec_create;
479    
480            /*------------------------------------------------------------------------
481             * XviD core initialization
482             *----------------------------------------------------------------------*/
483    
484            /* Version */
485            xvid_gbl_init.version = XVID_VERSION;
486    
487            /* Assembly setting */
488                  if(use_assembler)                  if(use_assembler)
489  #ifdef ARCH_IA64  #ifdef ARCH_IS_IA64
490                          xinit.cpu_flags = XVID_CPU_FORCE | XVID_CPU_IA64;                  xvid_gbl_init.cpu_flags = XVID_CPU_FORCE | XVID_CPU_IA64;
491  #else  #else
492                          xinit.cpu_flags = 0;          xvid_gbl_init.cpu_flags = 0;
493  #endif  #endif
494                  else                  else
495                          xinit.cpu_flags = XVID_CPU_FORCE;                  xvid_gbl_init.cpu_flags = XVID_CPU_FORCE;
496    
497          xvid_init(NULL, 0, &xinit, NULL);          xvid_global(NULL, 0, &xvid_gbl_init, NULL);
         xparam.width = XDIM;  
         xparam.height = YDIM;  
498    
499          xerr = xvid_decore(NULL, XVID_DEC_CREATE, &xparam, NULL);          /*------------------------------------------------------------------------
500          dec_handle = xparam.handle;           * XviD encoder initialization
501             *----------------------------------------------------------------------*/
502    
503          return xerr;          /* Version */
504            xvid_dec_create.version = XVID_VERSION;
505    
506            /*
507             * Image dimensions -- set to 0, xvidcore will resize when ever it is
508             * needed
509             */
510            xvid_dec_create.width = 0;
511            xvid_dec_create.height = 0;
512    
513            ret = xvid_decore(NULL, XVID_DEC_CREATE, &xvid_dec_create, NULL);
514    
515            dec_handle = xvid_dec_create.handle;
516    
517            return(ret);
518  }  }
519    
520  /* decode one frame  */  /* decode one frame  */
# Line 526  Line 522 
522  dec_main(unsigned char *istream,  dec_main(unsigned char *istream,
523           unsigned char *ostream,           unsigned char *ostream,
524           int istream_size,           int istream_size,
525           int *ostream_size)                   xvid_dec_stats_t *xvid_dec_stats)
526  {  {
527    
528          int xerr;          int ret;
529          XVID_DEC_FRAME xframe;  
530            xvid_dec_frame_t xvid_dec_frame;
531    
532            /* Set version */
533            xvid_dec_frame.version = XVID_VERSION;
534            xvid_dec_stats->version = XVID_VERSION;
535    
536            /* No general flags to set */
537            xvid_dec_frame.general          = 0;
538    
539          xframe.bitstream = istream;          /* Input stream */
540          xframe.length = istream_size;          xvid_dec_frame.bitstream        = istream;
541          xframe.image = ostream;          xvid_dec_frame.length           = istream_size;
         xframe.stride = XDIM;  
         xframe.colorspace = XVID_CSP_YV12;  
542    
543          xerr = xvid_decore(dec_handle, XVID_DEC_DECODE, &xframe, NULL);          /* Output frame structure */
544            xvid_dec_frame.output.plane[0]  = ostream;
545            xvid_dec_frame.output.stride[0] = XDIM;
546            xvid_dec_frame.output.csp       = XVID_CSP_I420;
547    
548          *ostream_size = xframe.length;          ret = xvid_decore(dec_handle, XVID_DEC_DECODE, &xvid_dec_frame, xvid_dec_stats);
549    
550          return xerr;          return(ret);
551  }  }
552    
553  /* close decoder to release resources */  /* close decoder to release resources */
554  static int  static int
555  dec_stop()  dec_stop()
556  {  {
557          int xerr;          int ret;
558    
559          xerr = xvid_decore(dec_handle, XVID_DEC_DESTROY, NULL, NULL);          ret = xvid_decore(dec_handle, XVID_DEC_DESTROY, NULL, NULL);
560    
561          return xerr;          return(ret);
562  }  }

Legend:
Removed from v.824  
changed lines
  Added in v.1382

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