Merge remote-tracking branch 'libav/master'
[FFMpeg-mirror/mplayer-patches.git] / tests / regression-funcs.sh
blobce5aee835a689d3af15bb172a314691ebf465a65
1 #!/bin/sh
3 # common regression functions for avconv
7 test="${1#regtest-}"
8 test_ref=$2
9 raw_src_dir=$3
10 target_exec=$4
11 target_path=$5
12 threads=${6:-1}
13 cpuflags=${8:-all}
15 datadir="./tests/data"
16 target_datadir="${target_path}/${datadir}"
18 this="$test.$test_ref"
19 outfile="$datadir/$test_ref/"
21 # various files
22 avconv="$target_exec ${target_path}/avconv"
23 raw_src="${target_path}/$raw_src_dir/%02d.pgm"
24 raw_dst="$datadir/$this.out.yuv"
25 pcm_src="$target_datadir/asynth1.sw"
26 crcfile="$datadir/$this.crc"
27 target_crcfile="$target_datadir/$this.crc"
29 cleanfiles="$raw_dst $crcfile"
30 trap 'rm -f -- $cleanfiles' EXIT
32 mkdir -p "$datadir"
33 mkdir -p "$outfile"
35 [ "${V-0}" -gt 0 ] && echov=echov || echov=:
37 echov(){
38 echo "$@" >&3
41 . $(dirname $0)/md5.sh
43 AVCONV_OPTS="-nostats -y -cpuflags $cpuflags"
44 COMMON_OPTS="-flags +bitexact -idct simple -sws_flags +accurate_rnd+bitexact"
45 DEC_OPTS="$COMMON_OPTS -threads $threads"
46 ENC_OPTS="$COMMON_OPTS -threads 1 -dct fastint"
48 run_avconv()
50 $echov $avconv $AVCONV_OPTS $*
51 $avconv $AVCONV_OPTS $*
54 do_avconv()
56 f="$1"
57 shift
58 set -- $* ${target_path}/$f
59 run_avconv $*
60 do_md5sum $f
61 echo $(wc -c $f)
64 do_avconv_crc()
66 f="$1"
67 shift
68 run_avconv $* -f crc "$target_crcfile"
69 echo "$f $(cat $crcfile)"