]> git.sesse.net Git - ffmpeg/blob - tests/regression-funcs.sh
tests: Unify output directory creation
[ffmpeg] / tests / regression-funcs.sh
1 #!/bin/sh
2 #
3 # common regression functions for avconv
4 #
5 #
6
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}
14
15 datadir="./tests/data"
16 target_datadir="${target_path}/${datadir}"
17
18 this="$test.$test_ref"
19 outfile="$datadir/$test_ref/"
20
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"
28
29 cleanfiles="$raw_dst $crcfile"
30 trap 'rm -f -- $cleanfiles' EXIT
31
32 [ "${V-0}" -gt 0 ] && echov=echov || echov=:
33
34 echov(){
35     echo "$@" >&3
36 }
37
38 . $(dirname $0)/md5.sh
39
40 AVCONV_OPTS="-nostats -y -cpuflags $cpuflags"
41 COMMON_OPTS="-flags +bitexact -idct simple -sws_flags +accurate_rnd+bitexact -fflags +bitexact"
42 DEC_OPTS="$COMMON_OPTS -threads $threads"
43 ENC_OPTS="$COMMON_OPTS -threads 1 -dct fastint"
44
45 run_avconv()
46 {
47     $echov $avconv $AVCONV_OPTS $*
48     $avconv $AVCONV_OPTS $*
49 }
50
51 do_avconv()
52 {
53     f="$1"
54     shift
55     set -- $* ${target_path}/$f
56     run_avconv $*
57     do_md5sum $f
58     echo $(wc -c $f)
59 }
60
61 do_avconv_crc()
62 {
63     f="$1"
64     shift
65     run_avconv $* -f crc "$target_crcfile"
66     echo "$f $(cat $crcfile)"
67 }