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 printf '%s\n' "$1" | diff -u -b - "$2"
68 test "${V:-0}" -gt 0 && echo "$target_exec" $target_path/"$@" >&3
69 $target_exec $target_path/"$@"
73 run avprobe -show_format_entry format_name -v 0 "$@"
77 run avconv -nostats -threads $threads -thread_type $thread_type -cpuflags $cpuflags "$@"
81 avconv "$@" -f framecrc -
85 avconv "$@" -f framemd5 -
97 avconv "$@" -vn -f s16le -
104 src_file=$(target_path $4)
106 encfile="${outdir}/${test}.${out_fmt}"
108 encfile=$(target_path ${encfile})
109 avconv -i $src_file "$@" -f $out_fmt -y ${encfile} || return
110 avconv -f $out_fmt -i ${encfile} -c:a pcm_${pcm_fmt} -f ${dec_fmt} -
115 ref=${base}/ref/$2/$t
116 ${base}/${1}-regression.sh $t $2 $3 "$target_exec" "$target_path" "$threads" "$thread_type" "$cpuflags"
120 regtest codec $1 tests/$1
124 regtest lavf lavf tests/vsynth1
128 cleanfiles="tests/data/lavfi/${test#lavfi-}.nut"
129 regtest lavfi lavfi tests/vsynth1
134 ref=${base}/ref/seek/$t
136 image_*) file="tests/data/images/${t#image_}/%02d.${t#image_}" ;;
137 *) file=$(echo $t | tr _ '?')
138 for d in acodec vsynth2 lavf; do
139 test -f tests/data/$d/$file && break
141 file=$(echo tests/data/$d/$file)
144 run libavformat/seek-test $target_path/$file
150 $command > "$outfile" 2>$errfile
153 if [ $err -gt 128 ]; then
154 sig=$(kill -l $err 2>/dev/null)
155 test "${sig}" = "${sig%[!A-Za-z]*}" || unset sig
158 if test -e "$ref" || test $cmp = "oneline" ; then
160 diff) diff -u -b "$ref" "$outfile" >$cmpfile ;;
161 oneoff) oneoff "$ref" "$outfile" >$cmpfile ;;
162 stddev) stddev "$ref" "$outfile" >$cmpfile ;;
163 oneline)oneline "$ref" "$outfile" >$cmpfile ;;
164 null) cat "$outfile" >$cmpfile ;;
167 test $err = 0 && err=$cmperr
168 test $err = 0 || cat $cmpfile
170 echo "reference file '$ref' not found"
174 echo "${test}:${sig:-$err}:$($base64 <$cmpfile):$($base64 <$errfile)" >$repfile
176 test $err = 0 && rm -f $outfile $errfile $cmpfile $cleanfiles