diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-04-23 04:25:40 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-04-23 15:39:36 +0200 |
commit | 06747f8484aa449f9be363ce4bf897991d61cd79 (patch) | |
tree | fbcf43008a311d1035976a3e38243817bf6f7f39 | |
parent | 32da94fa7f73ac749e0a1e2f20499fad2f6f57fe (diff) | |
download | ffmpeg-06747f8484aa449f9be363ce4bf897991d61cd79.tar.gz |
tests/tiny_psnr: do not ignore errors from run_psnr
failure to calculate psnr should not result in tiny_psnr returning success
Reviewed-by: Timothy Gu <timothygu99@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | tests/tiny_psnr.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/tests/tiny_psnr.c b/tests/tiny_psnr.c index e09f394f0e..5f791c168b 100644 --- a/tests/tiny_psnr.c +++ b/tests/tiny_psnr.c @@ -150,16 +150,16 @@ static int run_psnr(FILE *f[2], int len, int shift, int skip_bytes) for (i = 0; i < 2; i++) { uint8_t *p = buf[i]; if (fread(p, 1, 12, f[i]) != 12) - return 1; + return -1; if (!memcmp(p, "RIFF", 4) && !memcmp(p + 8, "WAVE", 4)) { if (fread(p, 1, 8, f[i]) != 8) - return 1; + return -1; while (memcmp(p, "data", 4)) { int s = p[4] | p[5] << 8 | p[6] << 16 | p[7] << 24; fseek(f[i], s, SEEK_CUR); if (fread(p, 1, 8, f[i]) != 8) - return 1; + return -1; } } else { fseek(f[i], -12, SEEK_CUR); @@ -315,6 +315,9 @@ int main(int argc, char *argv[]) max_psnr_shift = shift; } } + if (max_psnr < 0) + return 2; + if (shift_last > shift_first) printf("Best PSNR is %3d.%02d for shift %i\n", (int)(max_psnr / F), (int)(max_psnr % F), max_psnr_shift); return 0; |