[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 1423, Mon Apr 12 14:05:08 2004 UTC revision 1513, Tue Jul 20 07:31:38 2004 UTC
# Line 20  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.12 2004-04-12 14:05:08 edgomez Exp $   * $Id: xvid_decraw.c,v 1.17 2004-07-20 07:31:38 chl Exp $
24   *   *
25   ****************************************************************************/   ****************************************************************************/
26    
# Line 79  Line 79 
79   ****************************************************************************/   ****************************************************************************/
80    
81  static double msecond();  static double msecond();
 static int write_pgm(char *filename,  
                                          unsigned char *image);  
82  static int dec_init(int use_assembler, int debug_level);  static int dec_init(int use_assembler, int debug_level);
83  static int dec_main(unsigned char *istream,  static int dec_main(unsigned char *istream,
84                                          unsigned char *ostream,                                          unsigned char *ostream,
# Line 88  Line 86 
86                                          xvid_dec_stats_t *xvid_dec_stats);                                          xvid_dec_stats_t *xvid_dec_stats);
87  static int dec_stop();  static int dec_stop();
88  static void usage();  static void usage();
89    static int write_image(char *prefix, unsigned char *image);
90    static int write_pnm(char *filename, unsigned char *image);
91    static int write_tga(char *filename, unsigned char *image);
92    
93  const char * type2str(int type)  const char * type2str(int type)
94  {  {
# Line 130  Line 130 
130          printf("xvid_decraw - raw mpeg4 bitstream decoder ");          printf("xvid_decraw - raw mpeg4 bitstream decoder ");
131          printf("written by Christoph Lampert 2002-2003\n\n");          printf("written by Christoph Lampert 2002-2003\n\n");
132    
133            memset(&xvid_dec_stats, 0x00, sizeof(xvid_dec_stats));
134    
135  /*****************************************************************************  /*****************************************************************************
136   * Command line parsing   * Command line parsing
137   ****************************************************************************/   ****************************************************************************/
# Line 184  Line 186 
186                  }                  }
187          }          }
188    
189    #if defined(_MSC_VER)
190            if (ARG_INPUTFILE==NULL) {
191                    fprintf(stderr, "Warning: MSVC build does not read EOF correctly from stdin. Use the -i switch.\n\n");
192            }
193    #endif
194    
195  /*****************************************************************************  /*****************************************************************************
196   * Values checking   * Values checking
197   ****************************************************************************/   ****************************************************************************/
# Line 343  Line 351 
351                          sprintf(filename, "%sdec%05d", filepath, filenr);                          sprintf(filename, "%sdec%05d", filepath, filenr);
352                          if(write_image(filename, out_buffer)) {                          if(write_image(filename, out_buffer)) {
353                                  fprintf(stderr,                                  fprintf(stderr,
354                                                  "Error writing decoded PGM frame %s\n",                                                  "Error writing decoded frame %s\n",
355                                                  filename);                                                  filename);
356                          }                          }
357                  }                  }
# Line 384  Line 392 
392                          sprintf(filename, "%sdec%05d", filepath, filenr);                          sprintf(filename, "%sdec%05d", filepath, filenr);
393                          if(write_image(filename, out_buffer)) {                          if(write_image(filename, out_buffer)) {
394                                  fprintf(stderr,                                  fprintf(stderr,
395                                                  "Error writing decoded PGM frame %s\n",                                                  "Error writing decoded frame %s\n",
396                                                  filename);                                                  filename);
397                          }                          }
398                  }                  }
# Line 397  Line 405 
405   *     Calculate totals and averages for output, print results   *     Calculate totals and averages for output, print results
406   ****************************************************************************/   ****************************************************************************/
407    
408            if (filenr>0) {
409          totalsize    /= filenr;          totalsize    /= filenr;
410          totaldectime /= filenr;          totaldectime /= filenr;
   
411          printf("Avg: dectime(ms) =%7.2f, fps =%7.2f, length(bytes) =%7d\n",          printf("Avg: dectime(ms) =%7.2f, fps =%7.2f, length(bytes) =%7d\n",
412                     totaldectime, 1000/totaldectime, (int)totalsize);                     totaldectime, 1000/totaldectime, (int)totalsize);
413            }else{
414                    printf("Nothing was decoded!\n");
415            }
416    
417  /*****************************************************************************  /*****************************************************************************
418   *      XviD PART  Stop   *      XviD PART  Stop
# Line 465  Line 476 
476   *              output functions   *              output functions
477   ****************************************************************************/   ****************************************************************************/
478    
479  int write_image(char *prefix, unsigned char *image)  static int write_image(char *prefix, unsigned char *image)
480  {  {
481          char filename[1024];          char filename[1024];
482          char *ext;          char *ext;
# Line 493  Line 504 
504          return(ret);          return(ret);
505  }  }
506    
507  int write_tga(char *filename, unsigned char *image)  static int write_tga(char *filename, unsigned char *image)
508  {  {
509          FILE * f;          FILE * f;
510          char hdr[18];          char hdr[18];
# Line 574  Line 585 
585          return(0);          return(0);
586  }  }
587    
588  int write_pnm(char *filename, unsigned char *image)  static int write_pnm(char *filename, unsigned char *image)
589  {  {
590          FILE * f;          FILE * f;
591    
# Line 613  Line 624 
624    
625          return 0;          return 0;
626  }  }
627    
628  /*****************************************************************************  /*****************************************************************************
629   * Routines for decoding: init decoder, use, and stop decoder   * Routines for decoding: init decoder, use, and stop decoder
630   ****************************************************************************/   ****************************************************************************/
# Line 626  Line 638 
638          xvid_gbl_init_t   xvid_gbl_init;          xvid_gbl_init_t   xvid_gbl_init;
639          xvid_dec_create_t xvid_dec_create;          xvid_dec_create_t xvid_dec_create;
640    
641            /* Reset the structure with zeros */
642            memset(&xvid_gbl_init, 0, sizeof(xvid_gbl_init_t));
643            memset(&xvid_dec_create, 0, sizeof(xvid_dec_create_t));
644    
645          /*------------------------------------------------------------------------          /*------------------------------------------------------------------------
646           * XviD core initialization           * XviD core initialization
647           *----------------------------------------------------------------------*/           *----------------------------------------------------------------------*/
# Line 679  Line 695 
695          int ret;          int ret;
696    
697          xvid_dec_frame_t xvid_dec_frame;          xvid_dec_frame_t xvid_dec_frame;
698            memset(&xvid_dec_frame,0x00,sizeof(xvid_dec_frame));
699    
700          /* Set version */          /* Set version */
701          xvid_dec_frame.version = XVID_VERSION;          xvid_dec_frame.version = XVID_VERSION;

Legend:
Removed from v.1423  
changed lines
  Added in v.1513

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