Commit 8a91da95 authored by Michael Niedermayer's avatar Michael Niedermayer

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: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 4c1da0d1 e5d40372
This diff is collapsed.
...@@ -24,6 +24,8 @@ ...@@ -24,6 +24,8 @@
#include <stdint.h> #include <stdint.h>
#include "bytestream.h"
#define FF_S3TC_DXT1 0x31545844 #define FF_S3TC_DXT1 0x31545844
#define FF_S3TC_DXT3 0x33545844 #define FF_S3TC_DXT3 0x33545844
......
...@@ -142,7 +142,7 @@ fate:: $(FATE) ...@@ -142,7 +142,7 @@ fate:: $(FATE)
$(FATE): $(TOOL)$(EXESUF) $(FATE_UTILS:%=tests/%$(HOSTEXESUF)) $(FATE): $(TOOL)$(EXESUF) $(FATE_UTILS:%=tests/%$(HOSTEXESUF))
@echo "TEST $(@:fate-%=%)" @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: fate-list:
@printf '%s\n' $(sort $(FATE)) @printf '%s\n' $(sort $(FATE))
......
...@@ -14,10 +14,13 @@ target_path=$4 ...@@ -14,10 +14,13 @@ target_path=$4
command=$5 command=$5
cmp=${6:-diff} cmp=${6:-diff}
ref=${7:-"${base}/ref/fate/${test}"} ref=${7:-"${base}/ref/fate/${test}"}
fuzz=$8 fuzz=${8:-1}
threads=${9:-1} threads=${9:-1}
thread_type=${10:-frame+slice} thread_type=${10:-frame+slice}
cpuflags=${11:-all} cpuflags=${11:-all}
cmp_shift=${12:-0}
cmp_target=${13:-0}
size_tolerance=${14:-0}
outdir="tests/data/fate" outdir="tests/data/fate"
outfile="${outdir}/${test}" outfile="${outdir}/${test}"
...@@ -25,24 +28,32 @@ errfile="${outdir}/${test}.err" ...@@ -25,24 +28,32 @@ errfile="${outdir}/${test}.err"
cmpfile="${outdir}/${test}.diff" cmpfile="${outdir}/${test}.diff"
repfile="${outdir}/${test}.rep" 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(){ 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.]*\)") val=$(expr "$psnr" : ".*$3: *\([0-9.]*\)")
size1=$(expr "$psnr" : '.*bytes: *\([0-9]*\)') size1=$(expr "$psnr" : '.*bytes: *\([0-9]*\)')
size2=$(expr "$psnr" : '.*bytes:[ 0-9]*/ *\([0-9]*\)') size2=$(expr "$psnr" : '.*bytes:[ 0-9]*/ *\([0-9]*\)')
res=$(echo "if ($val $4 $5) 1" | bc) val_cmp=$(compare $val $cmp_target $fuzz)
if [ "$res" != 1 ] || [ $size1 != $size2 ]; then size_cmp=$(compare $size1 $size2 $size_tolerance)
if [ "$val_cmp" != 0 ] || [ "$size_cmp" != 0 ]; then
echo "$psnr" echo "$psnr"
return 1 return 1
fi fi
} }
oneoff(){ oneoff(){
do_tiny_psnr "$1" "$2" MAXDIFF '<=' ${fuzz:-1} do_tiny_psnr "$1" "$2" MAXDIFF
} }
stddev(){ stddev(){
do_tiny_psnr "$1" "$2" stddev '<=' ${fuzz:-1} do_tiny_psnr "$1" "$2" stddev
} }
run(){ run(){
...@@ -74,6 +85,16 @@ pcm(){ ...@@ -74,6 +85,16 @@ pcm(){
avconv "$@" -vn -f s16le - 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(){ regtest(){
t="${test#$2-}" t="${test#$2-}"
ref=${base}/ref/$2/$t ref=${base}/ref/$2/$t
...@@ -126,8 +147,8 @@ fi ...@@ -126,8 +147,8 @@ fi
if test -e "$ref"; then if test -e "$ref"; then
case $cmp in case $cmp in
diff) diff -u -w "$ref" "$outfile" >$cmpfile ;; diff) diff -u -w "$ref" "$outfile" >$cmpfile ;;
oneoff) oneoff "$ref" "$outfile" "$fuzz" >$cmpfile ;; oneoff) oneoff "$ref" "$outfile" >$cmpfile ;;
stddev) stddev "$ref" "$outfile" "$fuzz" >$cmpfile ;; stddev) stddev "$ref" "$outfile" >$cmpfile ;;
null) cat "$outfile" >$cmpfile ;; null) cat "$outfile" >$cmpfile ;;
esac esac
cmperr=$? cmperr=$?
......
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