16 ref=${7:-"${base}/ref/fate/${test}"}
19 thread_type=${10:-frame+slice}
23 size_tolerance=${14:-0}
28 outdir="tests/data/fate"
29 outfile="${outdir}/${test}"
30 errfile="${outdir}/${test}.err"
31 cmpfile="${outdir}/${test}.diff"
32 repfile="${outdir}/${test}.rep"
35 test ${1} = ${1#/} && p=${target_path}/
39 # $1=value1, $2=value2, $3=threshold
40 # prints 0 if absolute difference between value1 and value2 is <= threshold
42 awk "BEGIN { v = $1 - $2; printf ((v < 0 ? -v : v) > $3) }"
46 psnr=$(tests/tiny_psnr "$1" "$2" $cmp_unit $cmp_shift 0)
47 val=$(expr "$psnr" : ".*$3: *\([0-9.]*\)")
48 size1=$(expr "$psnr" : '.*bytes: *\([0-9]*\)')
49 size2=$(expr "$psnr" : '.*bytes:[ 0-9]*/ *\([0-9]*\)')
50 val_cmp=$(compare $val $cmp_target $fuzz)
51 size_cmp=$(compare $size1 $size2 $size_tolerance)
52 if [ "$val_cmp" != 0 ] || [ "$size_cmp" != 0 ]; then
59 do_tiny_psnr "$1" "$2" MAXDIFF
63 do_tiny_psnr "$1" "$2" stddev
67 printf '%s\n' "$1" | diff -u -b - "$2"
71 test "${V:-0}" -gt 0 && echo "$target_exec" $target_path/"$@" >&3
72 $target_exec $target_path/"$@"
76 run avprobe -show_format_entry format_name -v 0 "$@"
80 dec_opts="-hwaccel $hwaccel -threads $threads -thread_type $thread_type"
81 avconv_args="-nostats -cpuflags $cpuflags"
83 [ x${arg} = x-i ] && avconv_args="${avconv_args} ${dec_opts}"
84 avconv_args="${avconv_args} ${arg}"
86 run avconv ${avconv_args}
90 avconv "$@" -f framecrc -
94 avconv "$@" -f framemd5 -
106 avconv "$@" -vn -f s16le -
113 src_file=$(target_path $4)
115 encfile="${outdir}/${test}.${out_fmt}"
117 encfile=$(target_path ${encfile})
118 avconv -i $src_file "$@" -f $out_fmt -y ${encfile} || return
119 avconv -f $out_fmt -i ${encfile} -c:a pcm_${pcm_fmt} -f ${dec_fmt} -
122 FLAGS="-flags +bitexact -sws_flags +accurate_rnd+bitexact -fflags +bitexact"
123 DEC_OPTS="-threads $threads -idct simple $FLAGS"
124 ENC_OPTS="-threads 1 -idct simple -dct fastint"
133 encfile="${outdir}/${test}.${enc_fmt}"
134 decfile="${outdir}/${test}.out.${dec_fmt}"
135 cleanfiles="$cleanfiles $decfile"
136 test "$7" = -keep || cleanfiles="$cleanfiles $encfile"
137 tsrcfile=$(target_path $srcfile)
138 tencfile=$(target_path $encfile)
139 tdecfile=$(target_path $decfile)
140 avconv -f $src_fmt $DEC_OPTS -i $tsrcfile $ENC_OPTS $enc_opt $FLAGS \
141 -f $enc_fmt -y $tencfile || return
143 echo $(wc -c $encfile)
144 avconv $DEC_OPTS -i $tencfile $ENC_OPTS $dec_opt $FLAGS \
145 -f $dec_fmt -y $tdecfile || return
147 tests/tiny_psnr $srcfile $decfile $cmp_unit $cmp_shift
152 ref=${base}/ref/lavf/$t
153 ${base}/lavf-regression.sh $t lavf tests/vsynth1 "$target_exec" "$target_path" "$threads" "$thread_type" "$cpuflags"
159 label=${test#filter-}
160 raw_src="${target_path}/tests/vsynth1/%02d.pgm"
161 printf '%-20s' $label
162 avconv $DEC_OPTS -f image2 -vcodec pgmyuv -i $raw_src \
163 $FLAGS $ENC_OPTS -vf "$filters" -vcodec rawvideo -frames:v 5 $* -f nut md5:
167 filter=${test#filter-pixfmts-}
170 showfiltfmts="$target_exec $target_path/libavfilter/filtfmts-test"
171 exclude_fmts=${outfile}${filter}_exclude_fmts
172 out_fmts=${outfile}${filter}_out_fmts
174 # exclude pixel formats which are not supported as input
175 avconv -pix_fmts list 2>/dev/null | awk 'NR > 8 && /^\..\./ { print $2 }' | sort >$exclude_fmts
176 $showfiltfmts scale | awk -F '[ \r]' '/^OUTPUT/{ print $3 }' | sort | comm -23 - $exclude_fmts >$out_fmts
178 pix_fmts=$($showfiltfmts $filter | awk -F '[ \r]' '/^INPUT/{ print $3 }' | sort | comm -12 - $out_fmts)
181 for pix_fmt in $pix_fmts; do
183 video_filter "format=$pix_fmt,$filter=$filter_args" -pix_fmt $pix_fmt -frames:v 1
186 rm $exclude_fmts $out_fmts
193 eval $command >"$outfile" 2>$errfile
196 if [ $err -gt 128 ]; then
197 sig=$(kill -l $err 2>/dev/null)
198 test "${sig}" = "${sig%[!A-Za-z]*}" || unset sig
201 if test -e "$ref" || test $cmp = "oneline" ; then
203 diff) diff -u -b "$ref" "$outfile" >$cmpfile ;;
204 oneoff) oneoff "$ref" "$outfile" >$cmpfile ;;
205 stddev) stddev "$ref" "$outfile" >$cmpfile ;;
206 oneline)oneline "$ref" "$outfile" >$cmpfile ;;
207 null) cat "$outfile" >$cmpfile ;;
210 test $err = 0 && err=$cmperr
211 test $err = 0 || cat $cmpfile
213 echo "reference file '$ref' not found"
217 if [ $err -eq 0 ]; then
220 cmpo="$($base64 <$cmpfile)"
221 erro="$($base64 <$errfile)"
223 echo "${test}:${sig:-$err}:$cmpo:$erro" >$repfile
225 if test $err != 0 && test $gen != "no" ; then
227 cp -f "$outfile" "$ref"
231 test $err = 0 && rm -f $outfile $errfile $cmpfile $cleanfiles