summaryrefslogtreecommitdiff
path: root/tests/fate-run.sh
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2012-03-10 19:33:34 -0500
committerJustin Ruggles <justin.ruggles@gmail.com>2012-03-15 14:40:31 -0400
commitbb6842966e8b2c942a1853ade3d9bc7817dfc2ee (patch)
tree89b592a1592588b0ded7196b204f4202acbcbaa4 /tests/fate-run.sh
parent5ecadc662042f3d005a1a01618f448c9b1c44afc (diff)
FATE: use absolute difference from a target value in do_tiny_psnr()
This will allow comparison to original pre-encoded content instead of comparing to expected decoded output.
Diffstat (limited to 'tests/fate-run.sh')
-rwxr-xr-xtests/fate-run.sh16
1 files changed, 12 insertions, 4 deletions
diff --git a/tests/fate-run.sh b/tests/fate-run.sh
index 94d7cf8a0c..07065c3f30 100755
--- a/tests/fate-run.sh
+++ b/tests/fate-run.sh
@@ -19,6 +19,7 @@ threads=${9:-1}
thread_type=${10:-frame+slice}
cpuflags=${11:-all}
cmp_shift=${12:-0}
+cmp_target=${13:-0}
outdir="tests/data/fate"
outfile="${outdir}/${test}"
@@ -26,24 +27,31 @@ errfile="${outdir}/${test}.err"
cmpfile="${outdir}/${test}.diff"
repfile="${outdir}/${test}.rep"
+# $1=value1, $2=value2, $3=threshold
+# prints 0 if absolute difference between value1 and value2 is <= threshold
+compare(){
+ v=$(echo "scale=2; if ($1 >= $2) { $1 - $2 } else { $2 - $1 }" | bc)
+ echo "if ($v <= $3) { 0 } else { 1 }" | bc
+}
+
do_tiny_psnr(){
psnr=$(tests/tiny_psnr "$1" "$2" 2 $cmp_shift 0)
val=$(expr "$psnr" : ".*$3: *\([0-9.]*\)")
size1=$(expr "$psnr" : '.*bytes: *\([0-9]*\)')
size2=$(expr "$psnr" : '.*bytes:[ 0-9]*/ *\([0-9]*\)')
- res=$(echo "if ($val $4 $fuzz) 1" | bc)
- if [ "$res" != 1 ] || [ $size1 != $size2 ]; then
+ val_cmp=$(compare $val $cmp_target $fuzz)
+ if [ "$val_cmp" != 0 ] || [ $size1 != $size2 ]; then
echo "$psnr"
return 1
fi
}
oneoff(){
- do_tiny_psnr "$1" "$2" MAXDIFF '<='
+ do_tiny_psnr "$1" "$2" MAXDIFF
}
stddev(){
- do_tiny_psnr "$1" "$2" stddev '<='
+ do_tiny_psnr "$1" "$2" stddev
}
run(){