From 1e90317b655699a2877478e335e998fb5e4b79d8 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 24 Jul 2008 17:24:36 +0000 Subject: Fix tiny_psnr so it compares all bytes (it did skip the last block). Also display both file sizes and slightly change the output formatting. [not split in 3 patches to avoid the huge checksum files from being changed and having to be reviewed 3 times, if people want it split i can revert and split it] Originally committed as revision 14374 to svn://svn.ffmpeg.org/ffmpeg/trunk --- tests/tiny_psnr.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'tests/tiny_psnr.c') diff --git a/tests/tiny_psnr.c b/tests/tiny_psnr.c index b7b1d0848f..6327e6f9e4 100644 --- a/tests/tiny_psnr.c +++ b/tests/tiny_psnr.c @@ -23,6 +23,7 @@ #include #include +#define FFMIN(a,b) ((a) > (b) ? (b) : (a)) #define F 100 #define SIZE 2048 @@ -110,6 +111,8 @@ int main(int argc,char* argv[]){ int64_t max= (1<<(8*len))-1; int shift= argc<5 ? 0 : atoi(argv[4]); int skip_bytes = argc<6 ? 0 : atoi(argv[5]); + int size0=0; + int size1=0; if(argc<3){ printf("tiny_psnr [ [ []]]\n"); @@ -129,11 +132,11 @@ int main(int argc,char* argv[]){ fseek(f[0],skip_bytes,SEEK_CUR); fseek(f[1],skip_bytes,SEEK_CUR); - for(i=0;;){ - if( fread(buf[0], SIZE, 1, f[0]) != 1) break; - if( fread(buf[1], SIZE, 1, f[1]) != 1) break; + for(;;){ + int s0= fread(buf[0], 1, SIZE, f[0]); + int s1= fread(buf[1], 1, SIZE, f[1]); - for(j=0; j