diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-03-17 04:43:12 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-03-17 04:43:12 +0100 |
commit | 8a91da9575dd54fca6f411f28b5f0847a39d0bff (patch) | |
tree | 7e570ecd134fcb5dd4b49fb54f14c597e9ca0ee3 /tests/fate-run.sh | |
parent | 4c1da0d11e03ba0612a596cc62566321ad088319 (diff) | |
parent | e5d403720ec4914169f55913a5a5555d908500b6 (diff) | |
download | ffmpeg-8a91da9575dd54fca6f411f28b5f0847a39d0bff.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master:
h264: K&R formatting cosmetics
s3tc.h: Add missing #include to fix standalone header compilation.
FATE: add capability for audio encode/decode tests with fuzzy psnr comparison
FATE: allow a tolerance in the size comparison in do_tiny_psnr()
FATE: use absolute difference from a target value in do_tiny_psnr()
FATE: allow tests to set CMP_SHIFT to pass to tiny_psnr
FATE: use $fuzz directly in do_tiny_psnr() instead of passing it around
Conflicts:
libavcodec/h264.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'tests/fate-run.sh')
-rwxr-xr-x | tests/fate-run.sh | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/tests/fate-run.sh b/tests/fate-run.sh index f7a51ad2b8..991cea4b1f 100755 --- a/tests/fate-run.sh +++ b/tests/fate-run.sh @@ -14,10 +14,13 @@ target_path=$4 command=$5 cmp=${6:-diff} ref=${7:-"${base}/ref/fate/${test}"} -fuzz=$8 +fuzz=${8:-1} threads=${9:-1} thread_type=${10:-frame+slice} cpuflags=${11:-all} +cmp_shift=${12:-0} +cmp_target=${13:-0} +size_tolerance=${14:-0} outdir="tests/data/fate" outfile="${outdir}/${test}" @@ -25,24 +28,32 @@ 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 0 0) + 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 $5) 1" | bc) - if [ "$res" != 1 ] || [ $size1 != $size2 ]; then + val_cmp=$(compare $val $cmp_target $fuzz) + size_cmp=$(compare $size1 $size2 $size_tolerance) + if [ "$val_cmp" != 0 ] || [ "$size_cmp" != 0 ]; then echo "$psnr" return 1 fi } oneoff(){ - do_tiny_psnr "$1" "$2" MAXDIFF '<=' ${fuzz:-1} + do_tiny_psnr "$1" "$2" MAXDIFF } stddev(){ - do_tiny_psnr "$1" "$2" stddev '<=' ${fuzz:-1} + do_tiny_psnr "$1" "$2" stddev } run(){ @@ -74,6 +85,16 @@ pcm(){ avconv "$@" -vn -f s16le - } +enc_dec_pcm(){ + out_fmt=$1 + pcm_fmt=$2 + shift 2 + encfile="${outdir}/${test}.${out_fmt}" + cleanfiles=$encfile + avconv -i $ref "$@" -f $out_fmt -y $encfile || return + avconv -i $encfile -c:a pcm_${pcm_fmt} -f wav - +} + regtest(){ t="${test#$2-}" ref=${base}/ref/$2/$t @@ -126,8 +147,8 @@ fi if test -e "$ref"; then case $cmp in diff) diff -u -w "$ref" "$outfile" >$cmpfile ;; - oneoff) oneoff "$ref" "$outfile" "$fuzz" >$cmpfile ;; - stddev) stddev "$ref" "$outfile" "$fuzz" >$cmpfile ;; + oneoff) oneoff "$ref" "$outfile" >$cmpfile ;; + stddev) stddev "$ref" "$outfile" >$cmpfile ;; null) cat "$outfile" >$cmpfile ;; esac cmperr=$? |