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>
This commit is contained in:
Michael Niedermayer 2012-03-17 04:43:12 +01:00
commit 8a91da9575
4 changed files with 2427 additions and 2065 deletions

File diff suppressed because it is too large Load Diff

View File

@ -24,6 +24,8 @@
#include <stdint.h>
#include "bytestream.h"
#define FF_S3TC_DXT1 0x31545844
#define FF_S3TC_DXT3 0x33545844

View File

@ -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))

View File

@ -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=$?