tests/regression-funcs.sh
f94e56cf
 #!/bin/sh
 #
fcd08262
 # common regression functions for ffmpeg
f94e56cf
 #
 #
 
 test="${1#regtest-}"
 test_ref=$2
 raw_src_dir=$3
801b571e
 target_exec=$4
 target_path=$5
7851eb68
 threads=${6:-1}
018f39ef
 cpuflags=${8:-all}
bb97bcec
 target_samples=$9
f94e56cf
 
 datadir="./tests/data"
 target_datadir="${target_path}/${datadir}"
 
 this="$test.$test_ref"
cc3e2472
 outfile="$datadir/$test_ref/"
f94e56cf
 
42c1dcde
  # various files
 ffmpeg="$target_exec ${target_path}/ffmpeg${PROGSUF}"
f94e56cf
 raw_src="${target_path}/$raw_src_dir/%02d.pgm"
 raw_dst="$datadir/$this.out.yuv"
 pcm_src="$target_datadir/asynth1.sw"
c799e462
 pcm_src_1ch="$target_datadir/asynth-16000-1.wav"
58c25724
 pcm_ref_1ch="$datadir/$test_ref-16000-1.ref.wav"
f94e56cf
 crcfile="$datadir/$this.crc"
 target_crcfile="$target_datadir/$this.crc"
 
7263cd55
 cleanfiles="$raw_dst $crcfile"
a4e6fa86
 trap 'rm -f -- $cleanfiles' EXIT
 
c676895f
 mkdir -p "$datadir"
cc3e2472
 mkdir -p "$outfile"
c4795e80
 
 [ "${V-0}" -gt 0 ] && echov=echov || echov=:
16cd99bb
 
c4795e80
 echov(){
     echo "$@" >&3
 }
 
fc8cb398
 . $(dirname $0)/md5.sh
f94e56cf
 
018f39ef
 AVCONV_OPTS="-nostats -y -cpuflags $cpuflags"
0c1959b0
 COMMON_OPTS="-flags +bitexact -idct simple -sws_flags +accurate_rnd+bitexact -fflags +bitexact"
eeadaa6b
 DEC_OPTS="$COMMON_OPTS -threads $threads"
00f9e51a
 ENC_OPTS="$COMMON_OPTS -threads $threads -dct fastint"
f94e56cf
 
6291d7e4
 run_avconv()
f4b1e21a
 {
fcd08262
     $echov $ffmpeg $AVCONV_OPTS $*
     $ffmpeg $AVCONV_OPTS $*
f4b1e21a
 }
 
6291d7e4
 do_avconv()
f94e56cf
 {
     f="$1"
     shift
     set -- $* ${target_path}/$f
6291d7e4
     run_avconv $*
ea57502c
     do_md5sum $f
7263cd55
     echo $(wc -c $f)
f94e56cf
 }
 
6291d7e4
 do_avconv_nomd5()
f94e56cf
 {
     f="$1"
     shift
     set -- $* ${target_path}/$f
6291d7e4
     run_avconv $*
f94e56cf
     if [ $f = $raw_dst ] ; then
ea57502c
         $tiny_psnr $f $raw_ref
f94e56cf
     elif [ $f = $pcm_dst ] ; then
ea57502c
         $tiny_psnr $f $pcm_ref 2
f94e56cf
     else
ed7409fe
         echo $(wc -c $f)
f94e56cf
     fi
 }
 
6291d7e4
 do_avconv_crc()
f94e56cf
 {
     f="$1"
     shift
6291d7e4
     run_avconv $* -f crc "$target_crcfile"
ea57502c
     echo "$f $(cat $crcfile)"
f94e56cf
 }