[svn] / branches / dev-api-4 / xvidcore / examples / xvid_stat.c Repository:
ViewVC logotype

Diff of /branches/dev-api-4/xvidcore/examples/xvid_stat.c

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

revision 502, Sat Sep 21 09:38:17 2002 UTC revision 548, Fri Sep 27 18:35:35 2002 UTC
# Line 19  Line 19 
19   *  along with this program; if not, write to the Free Software   *  along with this program; if not, write to the Free Software
20   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
21   *   *
22   * $Id: xvid_stat.c,v 1.10 2002-09-21 09:38:17 edgomez Exp $   * $Id: xvid_stat.c,v 1.12 2002-09-27 18:35:35 edgomez Exp $
23   *   *
24   ****************************************************************************/   ****************************************************************************/
25    
# Line 44  Line 44 
44   *  -q integer     : quality ([0..5])   *  -q integer     : quality ([0..5])
45   *  -d boolean     : save decoder output (0 False*, !=0 True)   *  -d boolean     : save decoder output (0 False*, !=0 True)
46   *  -m boolean     : save mpeg4 raw stream (0 False*, !=0 True)   *  -m boolean     : save mpeg4 raw stream (0 False*, !=0 True)
47   *  -h, -help      : prints this help message   *  -help          : prints this help message
48   *  -quant integer : fixed quantizer (disables -b setting)   *  -quant integer : fixed quantizer (disables -b setting)
49   *  (* means default)   *  (* means default)
50   *   *
# Line 65  Line 65 
65  #include <stdlib.h>  #include <stdlib.h>
66  #include <string.h>  #include <string.h>
67  #include <math.h>  #include <math.h>
68    #ifndef _MSC_VER
69    #include <sys/time.h>
70    #else
71  #include <time.h>  #include <time.h>
72    #endif
73    
74  #include "../src/xvid.h"  #include "xvid.h"
75    
76  /****************************************************************************  /****************************************************************************
77   *                               Prototypes   *                               Prototypes
# Line 257  Line 261 
261                          i++;                          i++;
262                          ARG_SAVEMPEGSTREAM = atoi(argv[i]);                          ARG_SAVEMPEGSTREAM = atoi(argv[i]);
263                  }                  }
264                  else if (strcmp("-h", argv[i]) == 0 || strcmp("-help", argv[i])) {                  else if (strcmp("-help", argv[i])) {
265                          usage();                          usage();
266                          return(0);                          return(0);
267                  }                  }
# Line 502  Line 506 
506          printf("size %6d ",totalsize);          printf("size %6d ",totalsize);
507          printf("( %4d kbps ",(int)(totalsize*8*ARG_FRAMERATE/1000));          printf("( %4d kbps ",(int)(totalsize*8*ARG_FRAMERATE/1000));
508          printf("/ %.2f bpp) ",(double)totalsize*8/XDIM/YDIM);          printf("/ %.2f bpp) ",(double)totalsize*8/XDIM/YDIM);
509          printf("enc: %6.1f fps, dec: %6.1f fps \n",1/totalenctime, 1/totaldectime);          printf("enc: %6.1f fps, dec: %6.1f fps \n",1000/totalenctime, 1000/totaldectime);
510          printf("PSNR P(%d): %5.2f ( %5.2f , %5.2f ; %5.4f ) ",Pframes,Ppsnr,Pminpsnr,Pmaxpsnr,sqrt(Pvarpsnr/filenr));          printf("PSNR P(%d): %5.2f ( %5.2f , %5.2f ; %5.4f ) ",Pframes,Ppsnr,Pminpsnr,Pmaxpsnr,sqrt(Pvarpsnr/filenr));
511          printf("I(%d): %5.2f ( %5.2f , %5.2f ; %5.4f ) ",Iframes,Ipsnr,Iminpsnr,Imaxpsnr,sqrt(Ivarpsnr/filenr));          printf("I(%d): %5.2f ( %5.2f , %5.2f ; %5.4f ) ",Iframes,Ipsnr,Iminpsnr,Imaxpsnr,sqrt(Ivarpsnr/filenr));
512          printf("\n");          printf("\n");
# Line 551  Line 555 
555  /* Return time elapsed time in miliseconds since the program started */  /* Return time elapsed time in miliseconds since the program started */
556  static double msecond()  static double msecond()
557  {  {
558    #ifndef _MSC_VER
559            struct timeval  tv;
560            gettimeofday(&tv, 0);
561            return tv.tv_sec*10e3 + tv.tv_usec * 1.0e-3;
562    #else
563          clock_t clk;          clock_t clk;
   
564          clk = clock();          clk = clock();
   
565          return clk * 1000 / CLOCKS_PER_SEC;          return clk * 1000 / CLOCKS_PER_SEC;
566    #endif
567  }  }
568    
569    
# Line 628  Line 635 
635          fprintf(stderr, " -q integer     : quality ([0..5])\n");          fprintf(stderr, " -q integer     : quality ([0..5])\n");
636          fprintf(stderr, " -d boolean     : save decoder output (0 False*, !=0 True)\n");          fprintf(stderr, " -d boolean     : save decoder output (0 False*, !=0 True)\n");
637          fprintf(stderr, " -m boolean     : save mpeg4 raw stream (0 False*, !=0 True)\n");          fprintf(stderr, " -m boolean     : save mpeg4 raw stream (0 False*, !=0 True)\n");
638          fprintf(stderr, " -h, -help      : prints this help message\n");          fprintf(stderr, " -help          : prints this help message\n");
639          fprintf(stderr, " -quant integer : fixed quantizer (disables -b setting)\n");          fprintf(stderr, " -quant integer : fixed quantizer (disables -b setting)\n");
640          fprintf(stderr, " (* means default)\n");          fprintf(stderr, " (* means default)\n");
641    
# Line 701  Line 708 
708  static int read_yuvdata(FILE* handle, unsigned char *image)  static int read_yuvdata(FILE* handle, unsigned char *image)
709  {  {
710    
711          if (fread(image, 1, IMAGE_SIZE(XDIM, YDIM), handle) != IMAGE_SIZE(XDIM, YDIM))          if (fread(image, 1, IMAGE_SIZE(XDIM, YDIM), handle) != (unsigned int)IMAGE_SIZE(XDIM, YDIM))
712                  return 1;                  return 1;
713          else          else
714                  return 0;                  return 0;

Legend:
Removed from v.502  
changed lines
  Added in v.548

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