File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -72,6 +72,38 @@ do_tiny_psnr(){
7272 fi
7373}
7474
75+ # $1 is the reference image
76+ # $2 is the test image
77+ # $3 is the maximum MSE allowed across components
78+ # $4 is the maximum peak error allowed across components
79+ mse_peak_error (){
80+ stats=$( run ffmpeg${PROGSUF}${EXECSUF} -i " $1 " -i " $2 " -filter_complex " psnr=stats_version=3:output_max=1:f=-" -f null - -hide_banner -loglevel error)
81+ for item in y u v r g b a; do
82+ mse=$( echo $stats | sed -nE " s/.*mse_$item :([0-9.]+).*/\1/p" )
83+ if [ -z " $mse " ]; then
84+ continue
85+ fi
86+ mse_exceeded=$( echo " $mse > $3 " | bc -l)
87+ if [ " $mse_exceeded " != 0 ]; then
88+ echo " MSE value $mse exceeded the specified maximum $3 "
89+ echo $stats
90+ return 1
91+ fi
92+ peak=$( echo $stats | sed -nE " s/.*peak_$item :([0-9.]+).*/\1/p" )
93+ if [ -z " $peak " ]; then
94+ echo " peak_$item value missing when mse_$item was present"
95+ fi
96+ peak_exceeded=$( echo " $peak > $4 " | bc -l)
97+ if [ " $peak_exceeded " != 0 ]; then
98+ echo " Peak value $peak exceeded the specified maximum $4 "
99+ echo $stats
100+ return 1
101+ fi
102+ done
103+ echo " Passed"
104+ return 0
105+ }
106+
75107oneoff (){
76108 do_tiny_psnr " $1 " " $2 " MAXDIFF
77109}
You can’t perform that action at this time.
0 commit comments