2010-03-15 19:23:24 +00:00
|
|
|
#! /bin/sh
|
|
|
|
|
2010-08-23 17:34:08 +00:00
|
|
|
export LC_ALL=C
|
|
|
|
|
2010-03-15 19:23:24 +00:00
|
|
|
base=$(dirname $0)
|
|
|
|
. "${base}/md5.sh"
|
|
|
|
|
2010-07-26 23:44:06 +00:00
|
|
|
base64=tests/base64
|
|
|
|
|
2010-03-15 19:23:24 +00:00
|
|
|
test="${1#fate-}"
|
2014-03-18 00:29:50 +00:00
|
|
|
target_samples=$2
|
2010-03-15 19:23:24 +00:00
|
|
|
target_exec=$3
|
2010-07-18 20:19:16 +00:00
|
|
|
target_path=$4
|
2010-03-15 19:23:24 +00:00
|
|
|
command=$5
|
2010-07-09 00:40:45 +00:00
|
|
|
cmp=${6:-diff}
|
|
|
|
ref=${7:-"${base}/ref/fate/${test}"}
|
2012-03-10 23:50:45 +00:00
|
|
|
fuzz=${8:-1}
|
2011-03-21 23:07:54 +00:00
|
|
|
threads=${9:-1}
|
2011-09-04 08:01:59 +00:00
|
|
|
thread_type=${10:-frame+slice}
|
2012-03-05 07:05:56 +00:00
|
|
|
cpuflags=${11:-all}
|
2012-03-10 23:53:19 +00:00
|
|
|
cmp_shift=${12:-0}
|
2012-03-11 00:33:34 +00:00
|
|
|
cmp_target=${13:-0}
|
2012-03-11 00:52:05 +00:00
|
|
|
size_tolerance=${14:-0}
|
2012-05-17 18:14:17 +00:00
|
|
|
cmp_unit=${15:-2}
|
2013-03-18 22:45:58 +00:00
|
|
|
gen=${16:-no}
|
2015-03-09 09:56:54 +00:00
|
|
|
hwaccel=${17:-none}
|
2016-12-27 22:19:49 +00:00
|
|
|
report_type=${18:-standard}
|
2010-07-17 15:02:32 +00:00
|
|
|
|
2010-03-15 19:23:24 +00:00
|
|
|
outdir="tests/data/fate"
|
|
|
|
outfile="${outdir}/${test}"
|
2010-07-21 20:49:34 +00:00
|
|
|
errfile="${outdir}/${test}.err"
|
2010-07-26 23:44:06 +00:00
|
|
|
cmpfile="${outdir}/${test}.diff"
|
|
|
|
repfile="${outdir}/${test}.rep"
|
2010-03-15 19:23:24 +00:00
|
|
|
|
2012-04-17 15:47:57 +00:00
|
|
|
target_path(){
|
|
|
|
test ${1} = ${1#/} && p=${target_path}/
|
|
|
|
echo ${p}${1}
|
|
|
|
}
|
|
|
|
|
2012-03-11 00:33:34 +00:00
|
|
|
# $1=value1, $2=value2, $3=threshold
|
|
|
|
# prints 0 if absolute difference between value1 and value2 is <= threshold
|
|
|
|
compare(){
|
2015-01-19 21:56:59 +00:00
|
|
|
awk "BEGIN { v = $1 - $2; printf ((v < 0 ? -v : v) > $3) }"
|
2012-03-11 00:33:34 +00:00
|
|
|
}
|
|
|
|
|
2010-07-17 15:02:34 +00:00
|
|
|
do_tiny_psnr(){
|
2015-04-23 02:27:56 +00:00
|
|
|
psnr=$(tests/tiny_psnr "$1" "$2" $cmp_unit $cmp_shift 0) || return 1
|
2010-07-17 15:02:34 +00:00
|
|
|
val=$(expr "$psnr" : ".*$3: *\([0-9.]*\)")
|
2010-07-10 16:58:00 +00:00
|
|
|
size1=$(expr "$psnr" : '.*bytes: *\([0-9]*\)')
|
|
|
|
size2=$(expr "$psnr" : '.*bytes:[ 0-9]*/ *\([0-9]*\)')
|
2012-03-11 00:33:34 +00:00
|
|
|
val_cmp=$(compare $val $cmp_target $fuzz)
|
2012-03-11 00:52:05 +00:00
|
|
|
size_cmp=$(compare $size1 $size2 $size_tolerance)
|
|
|
|
if [ "$val_cmp" != 0 ] || [ "$size_cmp" != 0 ]; then
|
2010-07-09 00:40:51 +00:00
|
|
|
echo "$psnr"
|
2015-03-08 06:53:22 +00:00
|
|
|
if [ "$val_cmp" != 0 ]; then
|
|
|
|
echo "$3: |$val - $cmp_target| >= $fuzz"
|
|
|
|
fi
|
|
|
|
if [ "$size_cmp" != 0 ]; then
|
|
|
|
echo "size: |$size1 - $size2| >= $size_tolerance"
|
|
|
|
fi
|
2010-07-09 00:40:51 +00:00
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2010-07-17 15:02:34 +00:00
|
|
|
oneoff(){
|
2012-03-11 00:33:34 +00:00
|
|
|
do_tiny_psnr "$1" "$2" MAXDIFF
|
2010-07-17 15:02:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
stddev(){
|
2012-03-11 00:33:34 +00:00
|
|
|
do_tiny_psnr "$1" "$2" stddev
|
2010-07-17 15:02:34 +00:00
|
|
|
}
|
|
|
|
|
2012-05-03 22:43:11 +00:00
|
|
|
oneline(){
|
2012-05-15 10:52:28 +00:00
|
|
|
printf '%s\n' "$1" | diff -u -b - "$2"
|
2012-05-03 22:43:11 +00:00
|
|
|
}
|
|
|
|
|
2010-08-04 06:56:59 +00:00
|
|
|
run(){
|
2010-09-23 09:55:31 +00:00
|
|
|
test "${V:-0}" -gt 0 && echo "$target_exec" $target_path/"$@" >&3
|
2010-08-04 06:56:59 +00:00
|
|
|
$target_exec $target_path/"$@"
|
|
|
|
}
|
|
|
|
|
2014-05-13 16:16:44 +00:00
|
|
|
runecho(){
|
|
|
|
test "${V:-0}" -gt 0 && echo "$target_exec" $target_path/"$@" >&3
|
|
|
|
$target_exec $target_path/"$@" >&3
|
|
|
|
}
|
|
|
|
|
2012-05-03 18:01:00 +00:00
|
|
|
probefmt(){
|
2015-10-14 17:18:27 +00:00
|
|
|
run ffprobe${PROGSUF} -show_entries format=format_name -print_format default=nw=1:nk=1 -v 0 "$@"
|
2013-08-20 13:53:42 +00:00
|
|
|
}
|
|
|
|
|
2015-09-27 12:06:54 +00:00
|
|
|
runlocal(){
|
|
|
|
test "${V:-0}" -gt 0 && echo ${base}/"$@" ${base} >&3
|
|
|
|
${base}/"$@" ${base}
|
|
|
|
}
|
|
|
|
|
2013-08-20 13:53:42 +00:00
|
|
|
probeframes(){
|
2015-10-14 17:18:27 +00:00
|
|
|
run ffprobe${PROGSUF} -show_frames -v 0 "$@"
|
2012-05-03 18:01:00 +00:00
|
|
|
}
|
|
|
|
|
2016-04-15 00:30:12 +00:00
|
|
|
probechapters(){
|
|
|
|
run ffprobe${PROGSUF} -show_chapters -v 0 "$@"
|
|
|
|
}
|
|
|
|
|
2016-03-07 21:57:51 +00:00
|
|
|
probegaplessinfo(){
|
|
|
|
filename="$1"
|
|
|
|
shift
|
|
|
|
run ffprobe${PROGSUF} -bitexact -select_streams a -show_entries format=start_time,duration:stream=index,start_pts,duration_ts -v 0 "$filename" "$@"
|
|
|
|
pktfile1="${outdir}/${test}.pkts"
|
|
|
|
framefile1="${outdir}/${test}.frames"
|
|
|
|
cleanfiles="$cleanfiles $pktfile1 $framefile1"
|
2016-09-26 18:42:52 +00:00
|
|
|
run ffprobe${PROGSUF} -bitexact -select_streams a -of compact -count_packets -show_entries packet=pts,dts,duration,flags:stream=nb_read_packets -v 0 "$filename" "$@" > "$pktfile1"
|
2016-03-07 21:57:51 +00:00
|
|
|
head -n 8 "$pktfile1"
|
|
|
|
tail -n 9 "$pktfile1"
|
|
|
|
run ffprobe${PROGSUF} -bitexact -select_streams a -of compact -count_frames -show_entries frame=pkt_pts,pkt_dts,best_effort_timestamp,pkt_duration,nb_samples:stream=nb_read_frames -v 0 "$filename" "$@" > "$framefile1"
|
|
|
|
head -n 8 "$framefile1"
|
|
|
|
tail -n 9 "$framefile1"
|
|
|
|
}
|
|
|
|
|
2012-05-27 13:34:47 +00:00
|
|
|
ffmpeg(){
|
2015-03-09 09:56:54 +00:00
|
|
|
dec_opts="-hwaccel $hwaccel -threads $threads -thread_type $thread_type"
|
2015-07-31 12:39:00 +00:00
|
|
|
ffmpeg_args="-nostdin -nostats -cpuflags $cpuflags"
|
2012-05-29 09:41:55 +00:00
|
|
|
for arg in $@; do
|
2012-12-05 16:33:12 +00:00
|
|
|
[ x${arg} = x-i ] && ffmpeg_args="${ffmpeg_args} ${dec_opts}"
|
2012-07-09 20:10:38 +00:00
|
|
|
ffmpeg_args="${ffmpeg_args} ${arg}"
|
2012-05-29 09:41:55 +00:00
|
|
|
done
|
2015-10-17 10:59:08 +00:00
|
|
|
run ffmpeg${PROGSUF} ${ffmpeg_args}
|
2010-07-18 20:19:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
framecrc(){
|
2017-10-21 23:19:59 +00:00
|
|
|
ffmpeg "$@" -bitexact -f framecrc -
|
2010-07-18 20:19:30 +00:00
|
|
|
}
|
|
|
|
|
2016-11-08 11:27:21 +00:00
|
|
|
ffmetadata(){
|
2017-10-21 23:19:59 +00:00
|
|
|
ffmpeg "$@" -bitexact -f ffmetadata -
|
2016-11-08 11:27:21 +00:00
|
|
|
}
|
|
|
|
|
2010-07-18 20:19:30 +00:00
|
|
|
framemd5(){
|
2017-10-21 23:19:59 +00:00
|
|
|
ffmpeg "$@" -bitexact -f framemd5 -
|
2010-07-18 20:19:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
crc(){
|
2015-10-17 10:25:48 +00:00
|
|
|
ffmpeg "$@" -f crc -
|
2010-07-18 20:19:30 +00:00
|
|
|
}
|
|
|
|
|
2017-06-16 20:08:02 +00:00
|
|
|
md5pipe(){
|
2015-10-17 10:25:48 +00:00
|
|
|
ffmpeg "$@" md5:
|
2010-07-18 20:19:30 +00:00
|
|
|
}
|
|
|
|
|
2017-06-16 20:08:02 +00:00
|
|
|
md5(){
|
|
|
|
encfile="${outdir}/${test}.out"
|
|
|
|
cleanfiles="$cleanfiles $encfile"
|
|
|
|
ffmpeg "$@" $encfile
|
|
|
|
do_md5sum $encfile | awk '{print $1}'
|
|
|
|
}
|
|
|
|
|
2010-07-18 20:19:30 +00:00
|
|
|
pcm(){
|
2015-10-17 10:25:48 +00:00
|
|
|
ffmpeg "$@" -vn -f s16le -
|
2010-07-18 20:19:30 +00:00
|
|
|
}
|
|
|
|
|
2014-10-11 11:55:55 +00:00
|
|
|
fmtstdout(){
|
|
|
|
fmt=$1
|
|
|
|
shift 1
|
2017-10-21 23:19:59 +00:00
|
|
|
ffmpeg -bitexact "$@" -f $fmt -
|
2014-10-11 11:55:55 +00:00
|
|
|
}
|
|
|
|
|
2012-03-10 21:37:41 +00:00
|
|
|
enc_dec_pcm(){
|
|
|
|
out_fmt=$1
|
2012-04-17 15:47:57 +00:00
|
|
|
dec_fmt=$2
|
|
|
|
pcm_fmt=$3
|
|
|
|
src_file=$(target_path $4)
|
|
|
|
shift 4
|
2012-03-10 21:37:41 +00:00
|
|
|
encfile="${outdir}/${test}.${out_fmt}"
|
|
|
|
cleanfiles=$encfile
|
2012-04-17 15:47:57 +00:00
|
|
|
encfile=$(target_path ${encfile})
|
2015-10-17 10:25:48 +00:00
|
|
|
ffmpeg -i $src_file "$@" -f $out_fmt -y ${encfile} || return
|
2017-10-21 23:19:59 +00:00
|
|
|
ffmpeg -bitexact -i ${encfile} -c:a pcm_${pcm_fmt} -fflags +bitexact -f ${dec_fmt} -
|
2012-03-10 21:37:41 +00:00
|
|
|
}
|
|
|
|
|
2014-05-01 08:43:10 +00:00
|
|
|
FLAGS="-flags +bitexact -sws_flags +accurate_rnd+bitexact -fflags +bitexact"
|
2012-05-18 09:33:28 +00:00
|
|
|
DEC_OPTS="-threads $threads -idct simple $FLAGS"
|
|
|
|
ENC_OPTS="-threads 1 -idct simple -dct fastint"
|
|
|
|
|
|
|
|
enc_dec(){
|
|
|
|
src_fmt=$1
|
|
|
|
srcfile=$2
|
|
|
|
enc_fmt=$3
|
|
|
|
enc_opt=$4
|
|
|
|
dec_fmt=$5
|
|
|
|
dec_opt=$6
|
|
|
|
encfile="${outdir}/${test}.${enc_fmt}"
|
|
|
|
decfile="${outdir}/${test}.out.${dec_fmt}"
|
|
|
|
cleanfiles="$cleanfiles $decfile"
|
|
|
|
test "$7" = -keep || cleanfiles="$cleanfiles $encfile"
|
|
|
|
tsrcfile=$(target_path $srcfile)
|
|
|
|
tencfile=$(target_path $encfile)
|
|
|
|
tdecfile=$(target_path $decfile)
|
2015-10-17 10:25:48 +00:00
|
|
|
ffmpeg -f $src_fmt $DEC_OPTS -i $tsrcfile $ENC_OPTS $enc_opt $FLAGS \
|
2012-05-18 09:33:28 +00:00
|
|
|
-f $enc_fmt -y $tencfile || return
|
|
|
|
do_md5sum $encfile
|
|
|
|
echo $(wc -c $encfile)
|
2015-10-17 10:25:48 +00:00
|
|
|
ffmpeg $8 $DEC_OPTS -i $tencfile $ENC_OPTS $dec_opt $FLAGS \
|
2012-05-18 09:33:28 +00:00
|
|
|
-f $dec_fmt -y $tdecfile || return
|
|
|
|
do_md5sum $decfile
|
|
|
|
tests/tiny_psnr $srcfile $decfile $cmp_unit $cmp_shift
|
|
|
|
}
|
|
|
|
|
2016-09-05 16:46:16 +00:00
|
|
|
transcode(){
|
|
|
|
src_fmt=$1
|
|
|
|
srcfile=$2
|
|
|
|
enc_fmt=$3
|
|
|
|
enc_opt=$4
|
2016-09-20 13:26:03 +00:00
|
|
|
final_decode=$5
|
2016-09-05 16:46:16 +00:00
|
|
|
encfile="${outdir}/${test}.${enc_fmt}"
|
|
|
|
test "$7" = -keep || cleanfiles="$cleanfiles $encfile"
|
|
|
|
tsrcfile=$(target_path $srcfile)
|
|
|
|
tencfile=$(target_path $encfile)
|
|
|
|
ffmpeg -f $src_fmt $DEC_OPTS -i $tsrcfile $ENC_OPTS $enc_opt $FLAGS \
|
|
|
|
-f $enc_fmt -y $tencfile || return
|
|
|
|
do_md5sum $encfile
|
|
|
|
echo $(wc -c $encfile)
|
2016-09-20 13:26:03 +00:00
|
|
|
ffmpeg $DEC_OPTS -i $encfile $ENC_OPTS $FLAGS $final_decode \
|
2016-09-09 21:17:02 +00:00
|
|
|
-f framecrc - || return
|
2016-09-05 16:46:16 +00:00
|
|
|
}
|
|
|
|
|
2012-02-12 10:52:10 +00:00
|
|
|
lavffatetest(){
|
2013-05-08 12:21:39 +00:00
|
|
|
t="${test#lavf-fate-}"
|
|
|
|
ref=${base}/ref/lavf-fate/$t
|
2014-03-18 00:29:50 +00:00
|
|
|
${base}/lavf-regression.sh $t lavf-fate tests/vsynth1 "$target_exec" "$target_path" "$threads" "$thread_type" "$cpuflags" "$target_samples"
|
2012-02-12 10:52:10 +00:00
|
|
|
}
|
|
|
|
|
2010-07-20 10:19:28 +00:00
|
|
|
lavftest(){
|
2013-05-06 16:35:34 +00:00
|
|
|
t="${test#lavf-}"
|
|
|
|
ref=${base}/ref/lavf/$t
|
2014-03-18 00:29:50 +00:00
|
|
|
${base}/lavf-regression.sh $t lavf tests/vsynth1 "$target_exec" "$target_path" "$threads" "$thread_type" "$cpuflags" "$target_samples"
|
2010-07-20 10:19:28 +00:00
|
|
|
}
|
|
|
|
|
2017-08-29 12:45:13 +00:00
|
|
|
refcmp_metadata(){
|
|
|
|
refcmp=$1
|
|
|
|
pixfmt=$2
|
|
|
|
fuzz=${3:-0.001}
|
|
|
|
ffmpeg $FLAGS $ENC_OPTS \
|
|
|
|
-lavfi "testsrc2=size=300x200:rate=1:duration=5,format=${pixfmt},split[ref][tmp];[tmp]avgblur=4[enc];[enc][ref]${refcmp},metadata=print:file=-" \
|
|
|
|
-f null /dev/null | awk -v ref=${ref} -v fuzz=${fuzz} -f ${base}/refcmp-metadata.awk -
|
|
|
|
}
|
|
|
|
|
2013-04-15 21:39:08 +00:00
|
|
|
video_filter(){
|
|
|
|
filters=$1
|
|
|
|
shift
|
|
|
|
label=${test#filter-}
|
|
|
|
raw_src="${target_path}/tests/vsynth1/%02d.pgm"
|
|
|
|
printf '%-20s' $label
|
2015-10-17 10:25:48 +00:00
|
|
|
ffmpeg $DEC_OPTS -f image2 -vcodec pgmyuv -i $raw_src \
|
2015-05-09 21:44:30 +00:00
|
|
|
$FLAGS $ENC_OPTS -vf "$filters" -vcodec rawvideo -frames:v 5 $* -f nut md5:
|
2013-04-15 21:39:08 +00:00
|
|
|
}
|
|
|
|
|
2013-04-15 23:42:38 +00:00
|
|
|
pixfmts(){
|
|
|
|
filter=${test#filter-pixfmts-}
|
2013-04-30 00:08:48 +00:00
|
|
|
filter=${filter%_*}
|
2013-04-15 23:42:38 +00:00
|
|
|
filter_args=$1
|
2013-04-29 23:45:08 +00:00
|
|
|
prefilter_chain=$2
|
2015-05-10 22:44:14 +00:00
|
|
|
nframes=${3:-1}
|
2013-04-15 23:42:38 +00:00
|
|
|
|
2016-04-20 09:40:40 +00:00
|
|
|
showfiltfmts="$target_exec $target_path/libavfilter/tests/filtfmts"
|
2013-05-01 11:13:49 +00:00
|
|
|
scale_exclude_fmts=${outfile}_scale_exclude_fmts
|
|
|
|
scale_in_fmts=${outfile}_scale_in_fmts
|
|
|
|
scale_out_fmts=${outfile}_scale_out_fmts
|
|
|
|
in_fmts=${outfile}_in_fmts
|
2013-04-15 23:42:38 +00:00
|
|
|
|
|
|
|
# exclude pixel formats which are not supported as input
|
2013-04-29 23:32:49 +00:00
|
|
|
$showfiltfmts scale | awk -F '[ \r]' '/^INPUT/{ fmt=substr($3, 5); print fmt }' | sort >$scale_in_fmts
|
|
|
|
$showfiltfmts scale | awk -F '[ \r]' '/^OUTPUT/{ fmt=substr($3, 5); print fmt }' | sort >$scale_out_fmts
|
|
|
|
comm -12 $scale_in_fmts $scale_out_fmts >$scale_exclude_fmts
|
|
|
|
|
|
|
|
$showfiltfmts $filter | awk -F '[ \r]' '/^INPUT/{ fmt=substr($3, 5); print fmt }' | sort >$in_fmts
|
|
|
|
pix_fmts=$(comm -12 $scale_exclude_fmts $in_fmts)
|
2013-04-15 23:42:38 +00:00
|
|
|
|
2014-11-10 05:37:18 +00:00
|
|
|
outertest=$test
|
2013-04-15 23:42:38 +00:00
|
|
|
for pix_fmt in $pix_fmts; do
|
|
|
|
test=$pix_fmt
|
2015-05-10 22:44:14 +00:00
|
|
|
video_filter "${prefilter_chain}format=$pix_fmt,$filter=$filter_args" -pix_fmt $pix_fmt -frames:v $nframes
|
2013-04-15 23:42:38 +00:00
|
|
|
done
|
|
|
|
|
2013-04-29 23:32:49 +00:00
|
|
|
rm $in_fmts $scale_in_fmts $scale_out_fmts $scale_exclude_fmts
|
2014-11-10 05:37:18 +00:00
|
|
|
test=$outertest
|
2013-04-15 23:42:38 +00:00
|
|
|
}
|
|
|
|
|
2015-04-15 19:10:49 +00:00
|
|
|
gapless(){
|
|
|
|
sample=$(target_path $1)
|
|
|
|
extra_args=$2
|
|
|
|
|
|
|
|
decfile1="${outdir}/${test}.out-1"
|
|
|
|
decfile2="${outdir}/${test}.out-2"
|
2015-04-17 15:27:02 +00:00
|
|
|
decfile3="${outdir}/${test}.out-3"
|
|
|
|
cleanfiles="$cleanfiles $decfile1 $decfile2 $decfile3"
|
2015-04-15 19:10:49 +00:00
|
|
|
|
|
|
|
# test packet data
|
2017-10-21 23:19:59 +00:00
|
|
|
ffmpeg $extra_args -i "$sample" -bitexact -c:a copy -f framecrc -y $decfile1
|
2015-04-15 19:10:49 +00:00
|
|
|
do_md5sum $decfile1
|
|
|
|
# test decoded (and cut) data
|
2017-10-21 23:19:59 +00:00
|
|
|
ffmpeg $extra_args -i "$sample" -bitexact -f wav md5:
|
2015-04-17 15:27:01 +00:00
|
|
|
# the same as above again, with seeking to the start
|
2017-10-21 23:19:59 +00:00
|
|
|
ffmpeg $extra_args -ss 0 -seek_timestamp 1 -i "$sample" -bitexact -c:a copy -f framecrc -y $decfile2
|
2015-04-15 19:10:49 +00:00
|
|
|
do_md5sum $decfile2
|
2017-10-21 23:19:59 +00:00
|
|
|
ffmpeg $extra_args -ss 0 -seek_timestamp 1 -i "$sample" -bitexact -f wav md5:
|
2015-04-17 15:27:02 +00:00
|
|
|
# test packet data, with seeking to a specific position
|
2017-10-21 23:19:59 +00:00
|
|
|
ffmpeg $extra_args -ss 5 -seek_timestamp 1 -i "$sample" -bitexact -c:a copy -f framecrc -y $decfile3
|
2015-04-17 15:27:02 +00:00
|
|
|
do_md5sum $decfile3
|
2015-04-15 19:10:49 +00:00
|
|
|
}
|
|
|
|
|
2016-03-07 21:57:51 +00:00
|
|
|
gaplessenc(){
|
|
|
|
sample=$(target_path $1)
|
|
|
|
format=$2
|
|
|
|
codec=$3
|
|
|
|
|
|
|
|
file1="${outdir}/${test}.out-1"
|
|
|
|
cleanfiles="$cleanfiles $file1"
|
|
|
|
|
|
|
|
# test data after reencoding
|
2017-10-21 23:19:59 +00:00
|
|
|
ffmpeg -i "$sample" -bitexact -map 0:a -c:a $codec -f $format -y "$file1"
|
2016-03-07 21:57:51 +00:00
|
|
|
probegaplessinfo "$file1"
|
|
|
|
}
|
|
|
|
|
2016-03-21 03:18:48 +00:00
|
|
|
audio_match(){
|
|
|
|
sample=$(target_path $1)
|
|
|
|
trefile=$(target_path $2)
|
|
|
|
extra_args=$3
|
|
|
|
|
|
|
|
decfile="${outdir}/${test}.wav"
|
|
|
|
cleanfiles="$cleanfiles $decfile"
|
|
|
|
|
2017-10-21 23:19:59 +00:00
|
|
|
ffmpeg -i "$sample" -bitexact $extra_args -y $decfile
|
2016-03-21 03:18:48 +00:00
|
|
|
tests/audiomatch $decfile $trefile
|
|
|
|
}
|
|
|
|
|
2015-10-24 13:39:18 +00:00
|
|
|
concat(){
|
|
|
|
template=$1
|
2015-11-16 00:25:18 +00:00
|
|
|
sample=$2
|
2015-10-24 13:39:18 +00:00
|
|
|
mode=$3
|
|
|
|
extra_args=$4
|
|
|
|
|
|
|
|
concatfile="${outdir}/${test}.ffconcat"
|
|
|
|
packetfile="${outdir}/${test}.ffprobe"
|
|
|
|
cleanfiles="$concatfile $packetfile"
|
|
|
|
|
|
|
|
awk "{gsub(/%SRCFILE%/, \"$sample\"); print}" $template > $concatfile
|
|
|
|
|
|
|
|
if [ "$mode" = "md5" ]; then
|
2015-11-27 22:33:03 +00:00
|
|
|
run ffprobe${PROGSUF} -bitexact -show_streams -show_packets -v 0 -fflags keepside -safe 0 $extra_args $concatfile | tr -d '\r' > $packetfile
|
2015-11-26 05:03:14 +00:00
|
|
|
do_md5sum $packetfile
|
2015-10-24 13:39:18 +00:00
|
|
|
else
|
2015-11-27 22:33:03 +00:00
|
|
|
run ffprobe${PROGSUF} -bitexact -show_streams -show_packets -v 0 -of compact=p=0:nk=1 -fflags keepside -safe 0 $extra_args $concatfile
|
2015-10-24 13:39:18 +00:00
|
|
|
fi
|
2017-10-11 22:35:56 +00:00
|
|
|
}
|
2017-10-11 22:02:04 +00:00
|
|
|
|
2012-10-05 12:46:38 +00:00
|
|
|
null(){
|
|
|
|
:
|
2015-10-24 13:39:18 +00:00
|
|
|
}
|
|
|
|
|
2010-03-15 19:23:24 +00:00
|
|
|
mkdir -p "$outdir"
|
|
|
|
|
2013-01-02 22:22:46 +00:00
|
|
|
# Disable globbing: command arguments may contain globbing characters and
|
|
|
|
# must be kept verbatim
|
|
|
|
set -f
|
|
|
|
|
2010-09-23 09:55:31 +00:00
|
|
|
exec 3>&2
|
2012-05-18 09:33:28 +00:00
|
|
|
eval $command >"$outfile" 2>$errfile
|
2010-07-20 12:54:43 +00:00
|
|
|
err=$?
|
2010-07-09 00:40:45 +00:00
|
|
|
|
2010-07-31 16:53:09 +00:00
|
|
|
if [ $err -gt 128 ]; then
|
|
|
|
sig=$(kill -l $err 2>/dev/null)
|
2010-08-01 12:29:03 +00:00
|
|
|
test "${sig}" = "${sig%[!A-Za-z]*}" || unset sig
|
2010-07-31 16:53:09 +00:00
|
|
|
fi
|
|
|
|
|
2017-10-04 01:59:08 +00:00
|
|
|
if test -e "$ref" || test $cmp = "oneline" || test $cmp = "null" || test $cmp = "grep" ; then
|
2010-07-26 23:44:06 +00:00
|
|
|
case $cmp in
|
2013-09-24 18:53:41 +00:00
|
|
|
diff) diff -u -b "$ref" "$outfile" >$cmpfile ;;
|
2014-10-11 17:17:33 +00:00
|
|
|
rawdiff)diff -u "$ref" "$outfile" >$cmpfile ;;
|
2012-03-10 23:50:45 +00:00
|
|
|
oneoff) oneoff "$ref" "$outfile" >$cmpfile ;;
|
|
|
|
stddev) stddev "$ref" "$outfile" >$cmpfile ;;
|
2012-05-03 22:43:11 +00:00
|
|
|
oneline)oneline "$ref" "$outfile" >$cmpfile ;;
|
2016-07-14 17:54:34 +00:00
|
|
|
grep) grep "$ref" "$errfile" >$cmpfile ;;
|
2011-07-03 23:56:38 +00:00
|
|
|
null) cat "$outfile" >$cmpfile ;;
|
2010-07-26 23:44:06 +00:00
|
|
|
esac
|
|
|
|
cmperr=$?
|
|
|
|
test $err = 0 && err=$cmperr
|
2016-12-27 22:19:49 +00:00
|
|
|
if [ "$report_type" = "ignore" ]; then
|
2016-12-29 12:20:51 +00:00
|
|
|
test $err = 0 || echo "IGNORE\t${test}" && err=0 && unset sig
|
2016-12-27 22:19:49 +00:00
|
|
|
else
|
|
|
|
test $err = 0 || cat $cmpfile
|
|
|
|
fi
|
2010-07-26 23:44:06 +00:00
|
|
|
else
|
2010-07-20 10:19:28 +00:00
|
|
|
echo "reference file '$ref' not found"
|
2010-07-26 23:44:06 +00:00
|
|
|
err=1
|
2010-07-20 10:19:28 +00:00
|
|
|
fi
|
|
|
|
|
2016-12-27 22:19:49 +00:00
|
|
|
if [ $err -eq 0 ] && test $report_type = "standard" ; then
|
2015-04-10 17:51:11 +00:00
|
|
|
unset cmpo erro
|
|
|
|
else
|
|
|
|
cmpo="$($base64 <$cmpfile)"
|
|
|
|
erro="$($base64 <$errfile)"
|
|
|
|
fi
|
|
|
|
echo "${test}:${sig:-$err}:$cmpo:$erro" >$repfile
|
2010-07-09 23:36:04 +00:00
|
|
|
|
2013-03-18 22:45:58 +00:00
|
|
|
if test $err != 0 && test $gen != "no" ; then
|
|
|
|
echo "GEN $ref"
|
|
|
|
cp -f "$outfile" "$ref"
|
|
|
|
err=$?
|
|
|
|
fi
|
|
|
|
|
2011-12-22 17:17:13 +00:00
|
|
|
if test $err = 0; then
|
|
|
|
rm -f $outfile $errfile $cmpfile $cleanfiles
|
2013-03-30 10:41:58 +00:00
|
|
|
elif test $gen = "no"; then
|
2011-12-22 17:17:13 +00:00
|
|
|
echo "Test $test failed. Look at $errfile for details."
|
2014-09-23 21:38:29 +00:00
|
|
|
test "${V:-0}" -gt 0 && cat $errfile
|
2013-03-30 10:41:58 +00:00
|
|
|
else
|
|
|
|
echo "Updating reference failed, possibly no output file was generated."
|
2011-12-22 17:17:13 +00:00
|
|
|
fi
|
2010-07-26 23:44:06 +00:00
|
|
|
exit $err
|