summaryrefslogtreecommitdiffstats
path: root/tests/tiny_psnr.c
diff options
context:
space:
mode:
authorNicolas George <nicolas.george@normalesup.org>2012-04-15 14:20:42 +0200
committerNicolas George <nicolas.george@normalesup.org>2012-04-15 15:28:52 +0200
commite6f7e22d18601a1cafc870c52b5e6dbc4660e604 (patch)
tree3593cf22637bfb0beb4838e6f7cb2dd50502b669 /tests/tiny_psnr.c
parent93927eb334dce961603645dd4ed9772bb2400cc4 (diff)
downloadffmpeg-streaming-e6f7e22d18601a1cafc870c52b5e6dbc4660e604.zip
ffmpeg-streaming-e6f7e22d18601a1cafc870c52b5e6dbc4660e604.tar.gz
tiny_psnr: support unseekable raw files.
If either one of the files if not seekable, do not try to read headers. It allows to use it with pipes on whole rawvideo data.
Diffstat (limited to 'tests/tiny_psnr.c')
-rw-r--r--tests/tiny_psnr.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/tiny_psnr.c b/tests/tiny_psnr.c
index 8e1f338..a9db98e 100644
--- a/tests/tiny_psnr.c
+++ b/tests/tiny_psnr.c
@@ -114,10 +114,13 @@ static int run_psnr(FILE *f[2], int len, int shift, int skip_bytes)
int size0 = 0;
int size1 = 0;
int maxdist = 0;
+ int noseek;
- rewind(f[0]);
- rewind(f[1]);
+ noseek = fseek(f[0], 0, SEEK_SET) ||
+ fseek(f[1], 0, SEEK_SET);
+ if (!noseek) {
+ /* TODO reindent */
for (i = 0; i < 2; i++) {
uint8_t *p = buf[i];
if (fread(p, 1, 12, f[i]) != 12)
@@ -141,6 +144,7 @@ static int run_psnr(FILE *f[2], int len, int shift, int skip_bytes)
fseek(f[0], skip_bytes, SEEK_CUR);
fseek(f[1], skip_bytes, SEEK_CUR);
+ }
for (;;) {
int s0 = fread(buf[0], 1, SIZE, f[0]);
OpenPOWER on IntegriCloud