16 ref=${7:-"${base}/ref/fate/${test}"}
19 thread_type=${10:-frame+slice}
23 size_tolerance=${14:-0}
27 outdir="tests/data/fate"
28 outfile="${outdir}/${test}"
29 errfile="${outdir}/${test}.err"
30 cmpfile="${outdir}/${test}.diff"
31 repfile="${outdir}/${test}.rep"
34 test ${1} = ${1#/} && p=${target_path}/
38 # $1=value1, $2=value2, $3=threshold
39 # prints 0 if absolute difference between value1 and value2 is <= threshold
41 echo "scale=2; v = $1 - $2; if (v < 0) v = -v; if (v > $3) r = 1; r" | bc
45 psnr=$(tests/tiny_psnr "$1" "$2" $cmp_unit $cmp_shift 0)
46 val=$(expr "$psnr" : ".*$3: *\([0-9.]*\)")
47 size1=$(expr "$psnr" : '.*bytes: *\([0-9]*\)')
48 size2=$(expr "$psnr" : '.*bytes:[ 0-9]*/ *\([0-9]*\)')
49 val_cmp=$(compare $val $cmp_target $fuzz)
50 size_cmp=$(compare $size1 $size2 $size_tolerance)
51 if [ "$val_cmp" != 0 ] || [ "$size_cmp" != 0 ]; then
58 do_tiny_psnr "$1" "$2" MAXDIFF
62 do_tiny_psnr "$1" "$2" stddev
66 printf '%s\n' "$1" | diff -u -b - "$2"
70 test "${V:-0}" -gt 0 && echo "$target_exec" $target_path/"$@" >&3
71 $target_exec $target_path/"$@"
75 run avprobe -show_format_entry format_name -v 0 "$@"
79 dec_opts="-threads $threads -thread_type $thread_type"
80 avconv_args="-nostats -cpuflags $cpuflags"
82 [ x${arg} = x-i ] && avconv_args="${avconv_args} ${dec_opts}"
83 avconv_args="${avconv_args} ${arg}"
85 run avconv ${avconv_args}
89 avconv "$@" -f framecrc -
93 avconv "$@" -f framemd5 -
105 avconv "$@" -vn -f s16le -
112 src_file=$(target_path $4)
114 encfile="${outdir}/${test}.${out_fmt}"
116 encfile=$(target_path ${encfile})
117 avconv -i $src_file "$@" -f $out_fmt -y ${encfile} || return
118 avconv -f $out_fmt -i ${encfile} -c:a pcm_${pcm_fmt} -f ${dec_fmt} -
121 FLAGS="-flags +bitexact -sws_flags +accurate_rnd+bitexact"
122 DEC_OPTS="-threads $threads -idct simple $FLAGS"
123 ENC_OPTS="-threads 1 -idct simple -dct fastint"
132 encfile="${outdir}/${test}.${enc_fmt}"
133 decfile="${outdir}/${test}.out.${dec_fmt}"
134 cleanfiles="$cleanfiles $decfile"
135 test "$7" = -keep || cleanfiles="$cleanfiles $encfile"
136 tsrcfile=$(target_path $srcfile)
137 tencfile=$(target_path $encfile)
138 tdecfile=$(target_path $decfile)
139 avconv -f $src_fmt $DEC_OPTS -i $tsrcfile $ENC_OPTS $enc_opt $FLAGS \
140 -f $enc_fmt -y $tencfile || return
142 echo $(wc -c $encfile)
143 avconv $DEC_OPTS -i $tencfile $ENC_OPTS $dec_opt $FLAGS \
144 -f $dec_fmt -y $tdecfile || return
146 tests/tiny_psnr $srcfile $decfile $cmp_unit $cmp_shift
151 ref=${base}/ref/lavf/$t
152 ${base}/lavf-regression.sh $t lavf tests/vsynth1 "$target_exec" "$target_path" "$threads" "$thread_type" "$cpuflags"
158 label=${test#filter-}
159 raw_src="${target_path}/tests/vsynth1/%02d.pgm"
160 printf '%-20s' $label
161 avconv $DEC_OPTS -f image2 -vcodec pgmyuv -i $raw_src \
162 $FLAGS $ENC_OPTS -vf "$filters" -vcodec rawvideo $* -f nut md5:
166 pix_fmts="$(avconv -pix_fmts list 2>/dev/null | awk 'NR > 8 && /^IO/ { print $2 }' | sort)"
167 for pix_fmt in $pix_fmts; do
169 video_filter "format=$pix_fmt,pixdesctest" -pix_fmt $pix_fmt
174 filter=${test#filter-pixfmts-}
177 showfiltfmts="$target_exec $target_path/libavfilter/filtfmts-test"
178 exclude_fmts=${outfile}${filter}_exclude_fmts
179 out_fmts=${outfile}${filter}_out_fmts
181 # exclude pixel formats which are not supported as input
182 avconv -pix_fmts list 2>/dev/null | awk 'NR > 8 && /^\..\./ { print $2 }' | sort >$exclude_fmts
183 $showfiltfmts scale | awk -F '[ \r]' '/^OUTPUT/{ print $3 }' | sort | comm -23 - $exclude_fmts >$out_fmts
185 pix_fmts=$($showfiltfmts $filter | awk -F '[ \r]' '/^INPUT/{ print $3 }' | sort | comm -12 - $out_fmts)
186 for pix_fmt in $pix_fmts; do
188 video_filter "format=$pix_fmt,$filter=$filter_args" -pix_fmt $pix_fmt
191 rm $exclude_fmts $out_fmts
197 eval $command >"$outfile" 2>$errfile
200 if [ $err -gt 128 ]; then
201 sig=$(kill -l $err 2>/dev/null)
202 test "${sig}" = "${sig%[!A-Za-z]*}" || unset sig
205 if test -e "$ref" || test $cmp = "oneline" ; then
207 diff) diff -u -b "$ref" "$outfile" >$cmpfile ;;
208 oneoff) oneoff "$ref" "$outfile" >$cmpfile ;;
209 stddev) stddev "$ref" "$outfile" >$cmpfile ;;
210 oneline)oneline "$ref" "$outfile" >$cmpfile ;;
211 null) cat "$outfile" >$cmpfile ;;
214 test $err = 0 && err=$cmperr
215 test $err = 0 || cat $cmpfile
217 echo "reference file '$ref' not found"
221 echo "${test}:${sig:-$err}:$($base64 <$cmpfile):$($base64 <$errfile)" >$repfile
223 if test $err != 0 && test $gen != "no" ; then
225 cp -f "$outfile" "$ref"
229 test $err = 0 && rm -f $outfile $errfile $cmpfile $cleanfiles