Revision c43d77c1

View differences:

tests/ref/acodec/adpcm_ima_qt
1 1
3c06fd2f7831e3e8735b936e23ca220c *./tests/data/acodec/adpcm_qt.aiff
2 2
281252 ./tests/data/acodec/adpcm_qt.aiff
3 3
9580492803ba1c1a3746367b24b751c8 *./tests/data/adpcm_ima_qt.acodec.out.wav
4
stddev:  914.63 PSNR: 37.10 MAXDIFF:34026 bytes:  1058604/  1058444
4
stddev:  914.65 PSNR: 37.10 MAXDIFF:34026 bytes:  1058560/  1058400
tests/ref/acodec/adpcm_ima_wav
1 1
56b75c3a6dacedcf2ce7b0586aa33594 *./tests/data/acodec/adpcm_ima.wav
2 2
267324 ./tests/data/acodec/adpcm_ima.wav
3 3
78a2af1c895792d0c221d127bdd48ece *./tests/data/adpcm_ima_wav.acodec.out.wav
4
stddev:  903.51 PSNR: 37.21 MAXDIFF:34026 bytes:  1061792/  1058444
4
stddev:  903.51 PSNR: 37.21 MAXDIFF:34026 bytes:  1061748/  1058400
tests/ref/acodec/adpcm_ms
1 1
a407b87daeef5b25dfb6c5b3f519e9c1 *./tests/data/acodec/adpcm_ms.wav
2 2
268378 ./tests/data/acodec/adpcm_ms.wav
3 3
7be370f937c51e8a967e6a3d08d5156a *./tests/data/adpcm_ms.acodec.out.wav
4
stddev: 1050.00 PSNR: 35.91 MAXDIFF:29806 bytes:  1060620/  1058444
4
stddev: 1050.01 PSNR: 35.91 MAXDIFF:29806 bytes:  1060576/  1058400
tests/ref/acodec/adpcm_swf
1 1
42d4639866ed4d692eaf126228a4fa2a *./tests/data/acodec/adpcm_swf.flv
2 2
269166 ./tests/data/acodec/adpcm_swf.flv
3 3
628089745a7059ae4055c2515b6d668b *./tests/data/adpcm_swf.acodec.out.wav
4
stddev:  933.65 PSNR: 36.93 MAXDIFF:51119 bytes:  1065004/  1058444
4
stddev:  933.58 PSNR: 36.93 MAXDIFF:51119 bytes:  1064960/  1058400
tests/ref/acodec/adpcm_yam
1 1
2546d72df736b5ffa1557e8c9c9ef788 *./tests/data/acodec/adpcm_yam.wav
2 2
266296 ./tests/data/acodec/adpcm_yam.wav
3 3
c80c847a53a0fee17a88fa889ec34a4e *./tests/data/adpcm_yam.acodec.out.wav
4
stddev: 1247.64 PSNR: 34.41 MAXDIFF:39895 bytes:  1065004/  1058444
4
stddev: 1247.60 PSNR: 34.41 MAXDIFF:39895 bytes:  1064960/  1058400
tests/ref/acodec/alac
1 1
c68f649777ab8e7c9a0f1f221451d3ad *./tests/data/acodec/alac.m4a
2 2
389386 ./tests/data/acodec/alac.m4a
3 3
95e54b261530a1bcf6de6fe3b21dc5f6 *./tests/data/alac.acodec.out.wav
4
stddev:    0.00 PSNR:999.99 MAXDIFF:    0 bytes:  1058444/  1058444
4
stddev:    0.00 PSNR:999.99 MAXDIFF:    0 bytes:  1058400/  1058400
tests/ref/acodec/flac
1 1
151eef9097f944726968bec48649f00a *./tests/data/acodec/flac.flac
2 2
361582 ./tests/data/acodec/flac.flac
3 3
95e54b261530a1bcf6de6fe3b21dc5f6 *./tests/data/flac.acodec.out.wav
4
stddev:    0.00 PSNR:999.99 MAXDIFF:    0 bytes:  1058444/  1058444
4
stddev:    0.00 PSNR:999.99 MAXDIFF:    0 bytes:  1058400/  1058400
tests/ref/acodec/g726
1 1
5d8cce28f83dd33c3c7eaf43a5db5294 *./tests/data/acodec/g726.wav
2 2
24082 ./tests/data/acodec/g726.wav
3 3
4f1ba1af75dee64625a1c852e6cd01d3 *./tests/data/g726.acodec.out.wav
4
stddev: 8506.46 PSNR: 17.73 MAXDIFF:36208 bytes:    96148/  1058444
4
stddev: 8504.69 PSNR: 17.74 MAXDIFF:31645 bytes:    96104/  1058400
tests/ref/acodec/mp2
1 1
f6eb0a205350bbd7fb1028a01c7ae8aa *./tests/data/acodec/mp2.mp2
2 2
96130 ./tests/data/acodec/mp2.mp2
3 3
74c7b6b15a001add199619fafe4059a1 *./tests/data/mp2.acodec.out.wav
4
stddev: 9315.80 PSNR: 16.94 MAXDIFF:65388 bytes:  1059884/  1058444
5
stddev: 4385.25 PSNR: 23.49 MAXDIFF:52631 bytes:  1057960/  1058444
4
stddev: 9315.99 PSNR: 16.94 MAXDIFF:65388 bytes:  1059840/  1058400
5
stddev: 4384.33 PSNR: 23.49 MAXDIFF:52631 bytes:  1057916/  1058400
tests/ref/acodec/pcm
1 1
89f5b8dd97e0dddbe59af0d44fd229f3 *./tests/data/acodec/pcm_alaw.wav
2 2
529256 ./tests/data/acodec/pcm_alaw.wav
3 3
0568b0b9a72e31559e150e7e09d301cd *./tests/data/pcm.acodec.out.wav
4
stddev:  101.67 PSNR: 56.19 MAXDIFF:  515 bytes:  1058444/  1058444
4
stddev:  101.67 PSNR: 56.19 MAXDIFF:  515 bytes:  1058400/  1058400
5 5
f443a8eeb1647ec1eeb8370c939e52d4 *./tests/data/acodec/pcm_mulaw.wav
6 6
529256 ./tests/data/acodec/pcm_mulaw.wav
7 7
1c3eeaa8814ebd4916780dff80ed6dc5 *./tests/data/pcm.acodec.out.wav
8
stddev:  103.38 PSNR: 56.04 MAXDIFF:  644 bytes:  1058444/  1058444
8
stddev:  103.38 PSNR: 56.04 MAXDIFF:  644 bytes:  1058400/  1058400
9 9
b7936d7170e0efefb379349d81aed360 *./tests/data/acodec/pcm_s8.mov
10 10
530837 ./tests/data/acodec/pcm_s8.mov
11 11
652edf30f35ad89bf27bcc9d2f9c7b53 *./tests/data/pcm.acodec.out.wav
12
stddev:  147.89 PSNR: 52.93 MAXDIFF:  255 bytes:  1058444/  1058444
12
stddev:  147.89 PSNR: 52.93 MAXDIFF:  255 bytes:  1058400/  1058400
13 13
98cadb3502dbdc99e6e077c28b1a036c *./tests/data/acodec/pcm_u8.wav
14 14
529244 ./tests/data/acodec/pcm_u8.wav
15 15
652edf30f35ad89bf27bcc9d2f9c7b53 *./tests/data/pcm.acodec.out.wav
16
stddev:  147.89 PSNR: 52.93 MAXDIFF:  255 bytes:  1058444/  1058444
16
stddev:  147.89 PSNR: 52.93 MAXDIFF:  255 bytes:  1058400/  1058400
17 17
c42b9c04305455250366c84e17c1023f *./tests/data/acodec/pcm_s16be.mov
18 18
1060037 ./tests/data/acodec/pcm_s16be.mov
19 19
95e54b261530a1bcf6de6fe3b21dc5f6 *./tests/data/pcm.acodec.out.wav
20
stddev:    0.00 PSNR:999.99 MAXDIFF:    0 bytes:  1058444/  1058444
20
stddev:    0.00 PSNR:999.99 MAXDIFF:    0 bytes:  1058400/  1058400
21 21
95e54b261530a1bcf6de6fe3b21dc5f6 *./tests/data/acodec/pcm_s16le.wav
22 22
1058444 ./tests/data/acodec/pcm_s16le.wav
23 23
95e54b261530a1bcf6de6fe3b21dc5f6 *./tests/data/pcm.acodec.out.wav
24
stddev:    0.00 PSNR:999.99 MAXDIFF:    0 bytes:  1058444/  1058444
24
stddev:    0.00 PSNR:999.99 MAXDIFF:    0 bytes:  1058400/  1058400
25 25
352a6bcf51d0f3ca4bf27c423a3d4d14 *./tests/data/acodec/pcm_s16be.mkv
26 26
 1060650 ./tests/data/acodec/pcm_s16be.mkv
27 27
95e54b261530a1bcf6de6fe3b21dc5f6 *./tests/data/pcm.acodec.out.wav
28
stddev:    0.00 PSNR:999.99 MAXDIFF:    0 bytes:  1058444/  1058444
28
stddev:    0.00 PSNR:999.99 MAXDIFF:    0 bytes:  1058400/  1058400
29 29
2c089d83b2699c02c9358415e00a9707 *./tests/data/acodec/pcm_s16le.mkv
30 30
 1060650 ./tests/data/acodec/pcm_s16le.mkv
31 31
95e54b261530a1bcf6de6fe3b21dc5f6 *./tests/data/pcm.acodec.out.wav
32
stddev:    0.00 PSNR:999.99 MAXDIFF:    0 bytes:  1058444/  1058444
32
stddev:    0.00 PSNR:999.99 MAXDIFF:    0 bytes:  1058400/  1058400
33 33
07ffe7ffb78f3648b6524debdde5aec1 *./tests/data/acodec/pcm_s24be.mov
34 34
1589237 ./tests/data/acodec/pcm_s24be.mov
35 35
95e54b261530a1bcf6de6fe3b21dc5f6 *./tests/data/pcm.acodec.out.wav
36
stddev:    0.00 PSNR:999.99 MAXDIFF:    0 bytes:  1058444/  1058444
36
stddev:    0.00 PSNR:999.99 MAXDIFF:    0 bytes:  1058400/  1058400
37 37
a85380fb79b0d4fff38e24ac1e34bb94 *./tests/data/acodec/pcm_s24le.wav
38 38
1587668 ./tests/data/acodec/pcm_s24le.wav
39 39
95e54b261530a1bcf6de6fe3b21dc5f6 *./tests/data/pcm.acodec.out.wav
40
stddev:    0.00 PSNR:999.99 MAXDIFF:    0 bytes:  1058444/  1058444
40
stddev:    0.00 PSNR:999.99 MAXDIFF:    0 bytes:  1058400/  1058400
41 41
d7792f0343cd66fda8b50b569e2bcc48 *./tests/data/acodec/pcm_s32be.mov
42 42
2118437 ./tests/data/acodec/pcm_s32be.mov
43 43
95e54b261530a1bcf6de6fe3b21dc5f6 *./tests/data/pcm.acodec.out.wav
44
stddev:    0.00 PSNR:999.99 MAXDIFF:    0 bytes:  1058444/  1058444
44
stddev:    0.00 PSNR:999.99 MAXDIFF:    0 bytes:  1058400/  1058400
45 45
da6ed80f4f40f0082577dea80827e014 *./tests/data/acodec/pcm_s32le.wav
46 46
2116868 ./tests/data/acodec/pcm_s32le.wav
47 47
95e54b261530a1bcf6de6fe3b21dc5f6 *./tests/data/pcm.acodec.out.wav
48
stddev:    0.00 PSNR:999.99 MAXDIFF:    0 bytes:  1058444/  1058444
48
stddev:    0.00 PSNR:999.99 MAXDIFF:    0 bytes:  1058400/  1058400
49 49
118ff3dc83c62ce9ce669eef57e55bb2 *./tests/data/acodec/pcm_f32be.au
50 50
2116824 ./tests/data/acodec/pcm_f32be.au
51 51
95e54b261530a1bcf6de6fe3b21dc5f6 *./tests/data/pcm.acodec.out.wav
52
stddev:    0.00 PSNR:999.99 MAXDIFF:    0 bytes:  1058444/  1058444
52
stddev:    0.00 PSNR:999.99 MAXDIFF:    0 bytes:  1058400/  1058400
53 53
46f44f86a18984a832206ab9e29a79f2 *./tests/data/acodec/pcm_f32le.wav
54 54
2116880 ./tests/data/acodec/pcm_f32le.wav
55 55
95e54b261530a1bcf6de6fe3b21dc5f6 *./tests/data/pcm.acodec.out.wav
56
stddev:    0.00 PSNR:999.99 MAXDIFF:    0 bytes:  1058444/  1058444
56
stddev:    0.00 PSNR:999.99 MAXDIFF:    0 bytes:  1058400/  1058400
57 57
8112296b1ed94f72f20d04b1a54850a7 *./tests/data/acodec/pcm_f64be.au
58 58
4233624 ./tests/data/acodec/pcm_f64be.au
59 59
95e54b261530a1bcf6de6fe3b21dc5f6 *./tests/data/pcm.acodec.out.wav
60
stddev:    0.00 PSNR:999.99 MAXDIFF:    0 bytes:  1058444/  1058444
60
stddev:    0.00 PSNR:999.99 MAXDIFF:    0 bytes:  1058400/  1058400
61 61
ba17c6d1a270e1333e981f239bf7eb45 *./tests/data/acodec/pcm_f64le.wav
62 62
4233680 ./tests/data/acodec/pcm_f64le.wav
63 63
95e54b261530a1bcf6de6fe3b21dc5f6 *./tests/data/pcm.acodec.out.wav
64
stddev:    0.00 PSNR:999.99 MAXDIFF:    0 bytes:  1058444/  1058444
64
stddev:    0.00 PSNR:999.99 MAXDIFF:    0 bytes:  1058400/  1058400
65 65
8c74234928ed425b1171211a89f67ead *./tests/data/acodec/pcm_zork.wav
66 66
529256 ./tests/data/acodec/pcm_zork.wav
67 67
864c8c866ac25642c29a13b122c70709 *./tests/data/pcm.acodec.out.wav
68
stddev:  633.10 PSNR: 40.30 MAXDIFF:32768 bytes:  1058444/  1058444
68
stddev:  633.11 PSNR: 40.30 MAXDIFF:32768 bytes:  1058400/  1058400
69 69
8168a5c1343553ef027541830f2cb879 *./tests/data/acodec/pcm_s24daud.302
70 70
10368730 ./tests/data/acodec/pcm_s24daud.302
71 71
f552afadfdfcd6348a07095da6382de5 *./tests/data/pcm.acodec.out.wav
72
stddev: 9415.16 PSNR: 16.85 MAXDIFF:51900 bytes:  6911864/  1058444
72
stddev: 9416.28 PSNR: 16.85 MAXDIFF:42744 bytes:  6911796/  1058400
tests/ref/acodec/wmav1
1 1
26a7f6b0f0b7181df8df3fa589f6bf81 *./tests/data/acodec/wmav1.asf
2 2
106004 ./tests/data/acodec/wmav1.asf
3
stddev:12245.27 PSNR: 14.57 MAXDIFF:65521 bytes:  1065004/  1058444
4
stddev: 2097.78 PSNR: 29.89 MAXDIFF:27658 bytes:  1056812/  1058444
3
stddev:12245.52 PSNR: 14.57 MAXDIFF:65521 bytes:  1064960/  1058400
4
stddev: 2095.89 PSNR: 29.90 MAXDIFF:27658 bytes:  1056768/  1058400
tests/ref/acodec/wmav2
1 1
7c6c0cb692af01b312ae345723674b5f *./tests/data/acodec/wmav2.asf
2 2
106044 ./tests/data/acodec/wmav2.asf
3
stddev:12249.69 PSNR: 14.57 MAXDIFF:65521 bytes:  1065004/  1058444
4
stddev: 2091.12 PSNR: 29.92 MAXDIFF:27650 bytes:  1056812/  1058444
3
stddev:12249.93 PSNR: 14.57 MAXDIFF:65521 bytes:  1064960/  1058400
4
stddev: 2089.21 PSNR: 29.93 MAXDIFF:27650 bytes:  1056768/  1058400
tests/tiny_psnr.c
20 20

  
21 21
#include <stdio.h>
22 22
#include <stdlib.h>
23
#include <string.h>
23 24
#include <inttypes.h>
24 25
#include <assert.h>
25 26

  
......
117 118

  
118 119
    if(argc<3){
119 120
        printf("tiny_psnr <file1> <file2> [<elem size> [<shift> [<skip bytes>]]]\n");
120
        printf("For WAV files use the following:\n");
121
        printf("./tiny_psnr file1.wav file2.wav 2 0 44 to skip the header.\n");
121
        printf("WAV headers are skipped automatically.\n");
122 122
        return -1;
123 123
    }
124 124

  
......
128 128
        fprintf(stderr, "Could not open input files.\n");
129 129
        return -1;
130 130
    }
131
    fseek(f[shift<0], shift < 0 ? -shift : shift, SEEK_SET);
131

  
132
    for (i = 0; i < 2; i++) {
133
        uint8_t *p = buf[i];
134
        fread(p, 1, 12, f[i]);
135
        if (!memcmp(p,   "RIFF", 4) &&
136
            !memcmp(p+8, "WAVE", 4)) {
137
            fread(p, 1, 8, f[i]);
138
            while (memcmp(p, "data", 4)) {
139
                int s = p[4] | p[5]<<8 | p[6]<<16 | p[7]<<24;
140
                fseek(f[i], s, SEEK_CUR);
141
                fread(p, 1, 8, f[i]);
142
            }
143
        } else {
144
            fseek(f[i], -12, SEEK_CUR);
145
        }
146
    }
147

  
148
    fseek(f[shift<0], shift < 0 ? -shift : shift, SEEK_CUR);
132 149

  
133 150
    fseek(f[0],skip_bytes,SEEK_CUR);
134 151
    fseek(f[1],skip_bytes,SEEK_CUR);

Also available in: Unified diff