blob: 3a0929868f12fb719663ed3b9897cf0039700e69 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
Introduction
------------
lava-png is a tool for comparing png files with each other in the frequency
domain and arriving at a "Figure of Merit" describing how similar they are.
If you compare the same png to itself, the FoM is a perfect 0.0. Any
differences between the images will tend to increase the FoM result.
The FoM is issued as a single float on stdout, which is the worst (highest)
result from any of the individual colour channel results.
A 16-byte hash of the capture frame spectra is also given on stdout before the
FoM. This can be used with very high probability to identify duplicated frames.
Restrictions
------------
The two pngs being compared must have the same dimensions and number of
colour channels. Otherwise it supports any dimensions, 8 and 16 bits/channel
pngs, and number of channels.
Usage
-----
$ cat captured.png | lava-png reference.png
cbf5f5bf547bc0b044b3d35cb4c65835 0.886
$
Extract single frames for h.264 mov
-----------------------------------
$ mkdir -p capture
$ ffmpeg -i $INPUT_FILE -frames $NUM_FRAMES -sameq -f image2 capture/sent-%05d.png
Considerations about media sources
----------------------------------
Eg, h.264 decode from different codecs may give slightly different results. In
a digital-digital capture like HDMI the FoM can potentially be always exactly
0.000... to acheive that you'll need to use a "golden capture" as the reference
instead of the original file. That already has the acceptable set of codec
artifacts stored in the reference.
The other alternative is to use a pristine source as the reference, a different
(ffmpeg) PC-side codec to extract frames and store a golden error number that
represents "correct" delta between the codecs.
Some tests (3D unit synthetic tests, composed desktop) don't exist as a source
file. For those you'll need a golden capture as the reference.
Fault simulation
----------------
There's an optional --fault / -f switch which takes a fault index, and
messes with the captured png before comparing it.
--fault 1 - simulates image capture off by 1 pixel to the right
--fault 2 - simulates low probability random noise pixels
Performance
-----------
Compares using frame 360 of big buck bunny 1080p h.264
0.000 same file
0.022 -t 2 (simulated two noise pixels in the frame)
0.098 -t 1 (simulated shifted right by one pixel)
0.451 compare against frame 359 instead
0.589 png -> JPG in gimp -> png
1.000 compare against frame 1 instead (all black frame)
|