16 ref=${7:-"${base}/ref/fate/${test}"}
19 thread_type=${10:-frame+slice}
23 size_tolerance=${14:-0}
25 outdir="tests/data/fate"
26 outfile="${outdir}/${test}"
27 errfile="${outdir}/${test}.err"
28 cmpfile="${outdir}/${test}.diff"
29 repfile="${outdir}/${test}.rep"
32 test ${1} = ${1#/} && p=${target_path}/
36 # $1=value1, $2=value2, $3=threshold
37 # prints 0 if absolute difference between value1 and value2 is <= threshold
39 echo "scale=2; v = $1 - $2; if (v < 0) v = -v; if (v > $3) r = 1; r" | bc
43 psnr=$(tests/tiny_psnr "$1" "$2" 2 $cmp_shift 0)
44 val=$(expr "$psnr" : ".*$3: *\([0-9.]*\)")
45 size1=$(expr "$psnr" : '.*bytes: *\([0-9]*\)')
46 size2=$(expr "$psnr" : '.*bytes:[ 0-9]*/ *\([0-9]*\)')
47 val_cmp=$(compare $val $cmp_target $fuzz)
48 size_cmp=$(compare $size1 $size2 $size_tolerance)
49 if [ "$val_cmp" != 0 ] || [ "$size_cmp" != 0 ]; then
56 do_tiny_psnr "$1" "$2" MAXDIFF
60 do_tiny_psnr "$1" "$2" stddev
64 test "${V:-0}" -gt 0 && echo "$target_exec" $target_path/"$@" >&3
65 $target_exec $target_path/"$@"
69 run avconv -nostats -threads $threads -thread_type $thread_type -cpuflags $cpuflags "$@"
73 avconv "$@" -f framecrc -
77 avconv "$@" -f framemd5 -
89 avconv "$@" -vn -f s16le -
96 src_file=$(target_path $4)
98 encfile="${outdir}/${test}.${out_fmt}"
100 encfile=$(target_path ${encfile})
101 avconv -i $src_file "$@" -f $out_fmt -y ${encfile} || return
102 avconv -f $out_fmt -i ${encfile} -c:a pcm_${pcm_fmt} -f ${dec_fmt} -
107 ref=${base}/ref/$2/$t
108 ${base}/${1}-regression.sh $t $2 $3 "$target_exec" "$target_path" "$threads" "$thread_type" "$cpuflags"
112 regtest codec $1 tests/$1
116 regtest lavf lavf tests/vsynth1
120 cleanfiles="tests/data/lavfi/${test#lavfi-}.nut"
121 regtest lavfi lavfi tests/vsynth1
126 ref=${base}/ref/seek/$t
128 image_*) file="tests/data/images/${t#image_}/%02d.${t#image_}" ;;
129 *) file=$(echo $t | tr _ '?')
130 for d in acodec vsynth2 lavf; do
131 test -f tests/data/$d/$file && break
133 file=$(echo tests/data/$d/$file)
136 run libavformat/seek-test $target_path/$file
142 $command > "$outfile" 2>$errfile
145 if [ $err -gt 128 ]; then
146 sig=$(kill -l $err 2>/dev/null)
147 test "${sig}" = "${sig%[!A-Za-z]*}" || unset sig
150 if test -e "$ref"; then
152 diff) diff -u -w "$ref" "$outfile" >$cmpfile ;;
153 oneoff) oneoff "$ref" "$outfile" >$cmpfile ;;
154 stddev) stddev "$ref" "$outfile" >$cmpfile ;;
155 null) cat "$outfile" >$cmpfile ;;
158 test $err = 0 && err=$cmperr
159 test $err = 0 || cat $cmpfile
161 echo "reference file '$ref' not found"
165 echo "${test}:${sig:-$err}:$($base64 <$cmpfile):$($base64 <$errfile)" >$repfile
167 test $err = 0 && rm -f $outfile $errfile $cmpfile $cleanfiles