16 ref
=${7:-"${base}/ref/fate/${test}"}
19 thread_type
=${10:-frame+slice}
23 size_tolerance
=${14:-0}
26 outdir
="tests/data/fate"
27 outfile
="${outdir}/${test}"
28 errfile
="${outdir}/${test}.err"
29 cmpfile
="${outdir}/${test}.diff"
30 repfile
="${outdir}/${test}.rep"
33 test ${1} = ${1#/} && p=${target_path}/
37 # $1=value1, $2=value2, $3=threshold
38 # prints 0 if absolute difference between value1 and value2 is <= threshold
40 echo "scale=2; v = $1 - $2; if (v < 0) v = -v; if (v > $3) r = 1; r" |
bc
44 psnr
=$
(tests
/tiny_psnr
"$1" "$2" $cmp_unit $cmp_shift 0)
45 val
=$
(expr "$psnr" : ".*$3: *\([0-9.]*\)")
46 size1
=$
(expr "$psnr" : '.*bytes: *\([0-9]*\)')
47 size2
=$
(expr "$psnr" : '.*bytes:[ 0-9]*/ *\([0-9]*\)')
48 val_cmp
=$
(compare
$val $cmp_target $fuzz)
49 size_cmp
=$
(compare
$size1 $size2 $size_tolerance)
50 if [ "$val_cmp" != 0 ] ||
[ "$size_cmp" != 0 ]; then
57 do_tiny_psnr
"$1" "$2" MAXDIFF
61 do_tiny_psnr
"$1" "$2" stddev
65 printf '%s\n' "$1" |
diff -u -b - "$2"
69 test "${V:-0}" -gt 0 && echo "$target_exec" $target_path/"$@" >&3
70 $target_exec $target_path/"$@"
74 run avprobe
-show_format_entry format_name
-v 0 "$@"
78 dec_opts
="-threads $threads -thread_type $thread_type"
79 avconv_args
="-nostats -cpuflags $cpuflags"
81 [ x
${arg} = x-i ] && avconv_args="${avconv_args} ${dec_opts}"
82 avconv_args="${avconv_args} ${arg}"
84 run avconv ${avconv_args}
88 avconv "$@
" -f framecrc -
92 avconv "$@
" -f framemd5 -
104 avconv "$@
" -vn -f s16le -
111 src_file=$(target_path $4)
113 encfile="${outdir}/${test}.${out_fmt}"
115 encfile=$(target_path ${encfile})
116 avconv -i $src_file "$@
" -f $out_fmt -y ${encfile} || return
117 avconv -f $out_fmt -i ${encfile} -c:a pcm_${pcm_fmt} -f ${dec_fmt} -
120 FLAGS="-flags +bitexact
-sws_flags +accurate_rnd
+bitexact
"
121 DEC_OPTS="-threads $threads -idct simple
$FLAGS"
122 ENC_OPTS="-threads 1 -idct simple
-dct fastint
"
131 encfile="${outdir}/${test}.${enc_fmt}"
132 decfile="${outdir}/${test}.out.${dec_fmt}"
133 cleanfiles="$cleanfiles $decfile"
134 test "$7" = -keep || cleanfiles="$cleanfiles $encfile"
135 tsrcfile=$(target_path $srcfile)
136 tencfile=$(target_path $encfile)
137 tdecfile=$(target_path $decfile)
138 avconv -f $src_fmt $DEC_OPTS -i $tsrcfile $ENC_OPTS $enc_opt $FLAGS \
139 -f $enc_fmt -y $tencfile || return
141 echo $(wc -c $encfile)
142 avconv $DEC_OPTS -i $tencfile $ENC_OPTS $dec_opt $FLAGS \
143 -f $dec_fmt -y $tdecfile || return
145 tests/tiny_psnr $srcfile $decfile $cmp_unit $cmp_shift
150 ref=${base}/ref/$2/$t
151 ${base}/${1}-regression.sh $t $2 $3 "$target_exec" "$target_path" "$threads" "$thread_type" "$cpuflags"
155 regtest lavf lavf tests/vsynth1
159 cleanfiles="tests
/data
/lavfi
/${test#lavfi-}.nut
"
160 regtest lavfi lavfi tests/vsynth1
166 eval $command >"$outfile" 2>$errfile
169 if [ $err -gt 128 ]; then
170 sig=$(kill -l $err 2>/dev/null)
171 test "${sig}" = "${sig%[!A-Za-z]*}" || unset sig
174 if test -e "$ref" || test $cmp = "oneline
" ; then
176 diff) diff -u -b "$ref" "$outfile" >$cmpfile ;;
177 oneoff) oneoff "$ref" "$outfile" >$cmpfile ;;
178 stddev) stddev "$ref" "$outfile" >$cmpfile ;;
179 oneline)oneline "$ref" "$outfile" >$cmpfile ;;
180 null) cat "$outfile" >$cmpfile ;;
183 test $err = 0 && err=$cmperr
184 test $err = 0 || cat $cmpfile
186 echo "reference
file '$ref' not found
"
190 echo "${test}:${sig:-$err}:$
($base64 <$cmpfile):$
($base64 <$errfile)" >$repfile
192 test $err = 0 && rm -f $outfile $errfile $cmpfile $cleanfiles