summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-03-17 04:43:12 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-03-17 04:43:12 +0100
commit8a91da9575dd54fca6f411f28b5f0847a39d0bff (patch)
tree7e570ecd134fcb5dd4b49fb54f14c597e9ca0ee3 /tests
parent4c1da0d11e03ba0612a596cc62566321ad088319 (diff)
parente5d403720ec4914169f55913a5a5555d908500b6 (diff)
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')
-rw-r--r--tests/Makefile2
-rwxr-xr-xtests/fate-run.sh37
2 files changed, 30 insertions, 9 deletions
diff --git a/tests/Makefile b/tests/Makefile
index d9856dcd65..b5e0568b10 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -142,7 +142,7 @@ fate:: $(FATE)
$(FATE): $(TOOL)$(EXESUF) $(FATE_UTILS:%=tests/%$(HOSTEXESUF))
@echo "TEST $(@:fate-%=%)"
- $(Q)$(SRC_PATH)/tests/fate-run.sh $@ "$(SAMPLES)" "$(TARGET_EXEC)" "$(TARGET_PATH)" '$(CMD)' '$(CMP)' '$(REF)' '$(FUZZ)' '$(THREADS)' '$(THREAD_TYPE)' '$(CPUFLAGS)'
+ $(Q)$(SRC_PATH)/tests/fate-run.sh $@ "$(SAMPLES)" "$(TARGET_EXEC)" "$(TARGET_PATH)" '$(CMD)' '$(CMP)' '$(REF)' '$(FUZZ)' '$(THREADS)' '$(THREAD_TYPE)' '$(CPUFLAGS)' '$(CMP_SHIFT)' '$(CMP_TARGET)' '$(SIZE_TOLERANCE)'
fate-list:
@printf '%s\n' $(sort $(FATE))
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=$?