Commit bb684296 authored by Justin Ruggles's avatar Justin Ruggles

FATE: use absolute difference from a target value in do_tiny_psnr()

This will allow comparison to original pre-encoded content instead of
comparing to expected decoded output.
parent 5ecadc66
...@@ -116,7 +116,7 @@ fate: $(FATE) ...@@ -116,7 +116,7 @@ fate: $(FATE)
$(FATE): avconv$(EXESUF) $(FATE_UTILS:%=tests/%$(HOSTEXESUF)) $(FATE): avconv$(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)' '$(CMP_SHIFT)' $(Q)$(SRC_PATH)/tests/fate-run.sh $@ "$(SAMPLES)" "$(TARGET_EXEC)" "$(TARGET_PATH)" '$(CMD)' '$(CMP)' '$(REF)' '$(FUZZ)' '$(THREADS)' '$(THREAD_TYPE)' '$(CPUFLAGS)' '$(CMP_SHIFT)' '$(CMP_TARGET)'
fate-list: fate-list:
@printf '%s\n' $(sort $(FATE)) @printf '%s\n' $(sort $(FATE))
......
...@@ -19,6 +19,7 @@ threads=${9:-1} ...@@ -19,6 +19,7 @@ threads=${9:-1}
thread_type=${10:-frame+slice} thread_type=${10:-frame+slice}
cpuflags=${11:-all} cpuflags=${11:-all}
cmp_shift=${12:-0} cmp_shift=${12:-0}
cmp_target=${13:-0}
outdir="tests/data/fate" outdir="tests/data/fate"
outfile="${outdir}/${test}" outfile="${outdir}/${test}"
...@@ -26,24 +27,31 @@ errfile="${outdir}/${test}.err" ...@@ -26,24 +27,31 @@ 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 $cmp_shift 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 $fuzz) 1" | bc) val_cmp=$(compare $val $cmp_target $fuzz)
if [ "$res" != 1 ] || [ $size1 != $size2 ]; then if [ "$val_cmp" != 0 ] || [ $size1 != $size2 ]; then
echo "$psnr" echo "$psnr"
return 1 return 1
fi fi
} }
oneoff(){ oneoff(){
do_tiny_psnr "$1" "$2" MAXDIFF '<=' do_tiny_psnr "$1" "$2" MAXDIFF
} }
stddev(){ stddev(){
do_tiny_psnr "$1" "$2" stddev '<=' do_tiny_psnr "$1" "$2" stddev
} }
run(){ run(){
......
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