Commit a56fba50 authored by Mans Rullgard's avatar Mans Rullgard

fate: make compare() function compatible with POSIX bc

Signed-off-by: 's avatarMans Rullgard <mans@mansr.com>
parent f36d5c14
...@@ -31,8 +31,7 @@ repfile="${outdir}/${test}.rep" ...@@ -31,8 +31,7 @@ repfile="${outdir}/${test}.rep"
# $1=value1, $2=value2, $3=threshold # $1=value1, $2=value2, $3=threshold
# prints 0 if absolute difference between value1 and value2 is <= threshold # prints 0 if absolute difference between value1 and value2 is <= threshold
compare(){ compare(){
v=$(echo "scale=2; if ($1 >= $2) { $1 - $2 } else { $2 - $1 }" | bc) echo "scale=2; v = $1 - $2; if (v < 0) v = -v; if (v > $3) r = 1; r" | bc
echo "if ($v <= $3) { 0 } else { 1 }" | bc
} }
do_tiny_psnr(){ do_tiny_psnr(){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment