16 ref=${7:-"${base}/ref/fate/${test}"}
19 thread_type=${10:-frame+slice}
23 size_tolerance=${14:-0}
27 report_type=${18:-standard}
29 outdir="tests/data/fate"
30 outfile="${outdir}/${test}"
31 errfile="${outdir}/${test}.err"
32 cmpfile="${outdir}/${test}.diff"
33 repfile="${outdir}/${test}.rep"
36 test ${1} = ${1#/} && p=${target_path}/
40 # $1=value1, $2=value2, $3=threshold
41 # prints 0 if absolute difference between value1 and value2 is <= threshold
43 awk "BEGIN { v = $1 - $2; printf ((v < 0 ? -v : v) > $3) }"
47 psnr=$(tests/tiny_psnr "$1" "$2" $cmp_unit $cmp_shift 0)
48 val=$(expr "$psnr" : ".*$3: *\([0-9.]*\)")
49 size1=$(expr "$psnr" : '.*bytes: *\([0-9]*\)')
50 size2=$(expr "$psnr" : '.*bytes:[ 0-9]*/ *\([0-9]*\)')
51 val_cmp=$(compare $val $cmp_target $fuzz)
52 size_cmp=$(compare $size1 $size2 $size_tolerance)
53 if [ "$val_cmp" != 0 ] || [ "$size_cmp" != 0 ]; then
60 do_tiny_psnr "$1" "$2" MAXDIFF
64 do_tiny_psnr "$1" "$2" stddev
68 printf '%s\n' "$1" | diff -u -b - "$2"
72 test "${V:-0}" -gt 0 && echo "$target_exec" $target_path/"$@" >&3
73 $target_exec $target_path/"$@"
77 run avprobe -show_format_entry format_name -v 0 "$@"
81 run avprobe -show_stream_entry "$1" -v 0 "$2"
85 dec_opts="-hwaccel $hwaccel -threads $threads -thread_type $thread_type"
86 avconv_args="-nostats -cpuflags $cpuflags"
88 [ x${arg} = x-i ] && avconv_args="${avconv_args} ${dec_opts}"
89 avconv_args="${avconv_args} ${arg}"
91 run avconv ${avconv_args}
95 avconv "$@" -f framecrc -
99 avconv "$@" -f framemd5 -
111 avconv "$@" -vn -f s16le -
118 src_file=$(target_path $4)
120 encfile="${outdir}/${test}.${out_fmt}"
122 encfile=$(target_path ${encfile})
123 avconv -i $src_file "$@" -f $out_fmt -y ${encfile} || return
124 avconv -f $out_fmt -i ${encfile} -c:a pcm_${pcm_fmt} -f ${dec_fmt} -
127 FLAGS="-flags +bitexact -sws_flags +accurate_rnd+bitexact -fflags +bitexact"
128 DEC_OPTS="-threads $threads -idct simple $FLAGS"
129 ENC_OPTS="-threads 1 -idct simple -dct fastint"
138 encfile="${outdir}/${test}.${enc_fmt}"
139 decfile="${outdir}/${test}.out.${dec_fmt}"
140 cleanfiles="$cleanfiles $decfile"
141 test "$7" = -keep || cleanfiles="$cleanfiles $encfile"
142 tsrcfile=$(target_path $srcfile)
143 tencfile=$(target_path $encfile)
144 tdecfile=$(target_path $decfile)
145 avconv -f $src_fmt $DEC_OPTS -i $tsrcfile $ENC_OPTS $enc_opt $FLAGS \
146 -f $enc_fmt -y $tencfile || return
148 echo $(wc -c $encfile)
149 avconv $DEC_OPTS -i $tencfile $ENC_OPTS $dec_opt $FLAGS \
150 -f $dec_fmt -y $tdecfile || return
152 tests/tiny_psnr $srcfile $decfile $cmp_unit $cmp_shift
155 # FIXME: There is a certain duplication between the avconv-related helper
156 # functions above and below that should be refactored.
157 avconv2="$target_exec ${target_path}/avconv"
158 raw_src="${target_path}/tests/vsynth1/%02d.pgm"
159 crcfile="tests/data/$test.lavf.crc"
160 target_crcfile="${target_path}/$crcfile"
166 AVCONV_OPTS="-nostats -y -cpuflags $cpuflags -threads $threads"
167 DEC_OPTS="-flags +bitexact -idct simple -sws_flags +accurate_rnd+bitexact -fflags +bitexact"
168 ENC_OPTS="$DEC_OPTS -threads 1 -dct fastint"
171 $echov $avconv2 $AVCONV_OPTS $*
172 $avconv2 $AVCONV_OPTS $*
178 set -- $* ${target_path}/$f
187 run_avconv $* -f crc "$target_crcfile"
188 echo "$f $(cat $crcfile)"
194 outdir="tests/data/lavf"
195 file=${outdir}/${t}pipe.$t
196 do_avconv $file $DEC_OPTS -f image2 -c:v pgmyuv -i $raw_src -f image2pipe $ENC_OPTS -t 1 -qscale 10
197 do_avconv_crc $file $DEC_OPTS -f image2pipe -i $target_path/$file
202 ref=${base}/ref/lavf/$t
203 ${base}/lavf-regression.sh $t lavf tests/vsynth1 "$target_exec" "$target_path" "$threads" "$thread_type" "$cpuflags"
209 label=${test#filter-}
210 printf '%-20s' $label
211 avconv $DEC_OPTS -f image2 -c:v pgmyuv -i $raw_src \
212 $FLAGS $ENC_OPTS -vf "$filters" -c:v rawvideo -frames:v 5 $* -f nut md5:
216 filter=${test#filter-pixfmts-}
219 showfiltfmts="$target_exec $target_path/libavfilter/tests/filtfmts"
220 exclude_fmts=${outfile}${filter}_exclude_fmts
221 out_fmts=${outfile}${filter}_out_fmts
223 # exclude pixel formats which are not supported as input
224 avconv -pix_fmts list 2>/dev/null | awk 'NR > 8 && /^\..\./ { print $2 }' | sort >$exclude_fmts
225 $showfiltfmts scale | awk -F '[ \r]' '/^OUTPUT/{ print $3 }' | sort | comm -23 - $exclude_fmts >$out_fmts
227 pix_fmts=$($showfiltfmts $filter | awk -F '[ \r]' '/^INPUT/{ print $3 }' | sort | comm -12 - $out_fmts)
230 for pix_fmt in $pix_fmts; do
232 video_filter "format=$pix_fmt,$filter=$filter_args" -pix_fmt $pix_fmt -frames:v 1
235 rm $exclude_fmts $out_fmts
244 eval $command >"$outfile" 2>$errfile
247 if [ $err -gt 128 ]; then
248 sig=$(kill -l $err 2>/dev/null)
249 test "${sig}" = "${sig%[!A-Za-z]*}" || unset sig
252 if test -e "$ref" || test $cmp = "oneline" || test $cmp = "null" ; then
254 diff) diff -u -b "$ref" "$outfile" >$cmpfile ;;
255 oneoff) oneoff "$ref" "$outfile" >$cmpfile ;;
256 stddev) stddev "$ref" "$outfile" >$cmpfile ;;
257 oneline)oneline "$ref" "$outfile" >$cmpfile ;;
258 null) cat "$outfile" >$cmpfile ;;
261 test $err = 0 && err=$cmperr
262 if [ "$report_type" = "ignore" ]; then
263 test $err = 0 || echo "IGNORE\t${test}" && err=0 && unset sig
265 test $err = 0 || cat $cmpfile
268 echo "reference file '$ref' not found"
272 if [ $err -eq 0 ] && test $report_type = "standard" ; then
275 cmpo="$($base64 <$cmpfile)"
276 erro="$($base64 <$errfile)"
278 echo "${test}:${sig:-$err}:$cmpo:$erro" >$repfile
280 if test $err != 0 && test $gen != "no" ; then
282 cp -f "$outfile" "$ref"
286 test $err = 0 && rm -f $outfile $errfile $cmpfile $cleanfiles