regression-funcs.sh 1.27 KB
Newer Older
1 2
#!/bin/sh
#
3
# common regression functions for avconv
4 5 6 7 8 9
#
#

test="${1#regtest-}"
test_ref=$2
raw_src_dir=$3
10 11
target_exec=$4
target_path=$5
12
threads=${6:-1}
13
cpuflags=${8:-all}
14 15 16 17 18

datadir="./tests/data"
target_datadir="${target_path}/${datadir}"

this="$test.$test_ref"
19
outfile="$datadir/$test_ref/"
20 21

# various files
22
avconv="$target_exec ${target_path}/avconv"
23 24 25 26 27 28
raw_src="${target_path}/$raw_src_dir/%02d.pgm"
raw_dst="$datadir/$this.out.yuv"
pcm_src="$target_datadir/asynth1.sw"
crcfile="$datadir/$this.crc"
target_crcfile="$target_datadir/$this.crc"

29
cleanfiles="$raw_dst $crcfile"
30 31
trap 'rm -f -- $cleanfiles' EXIT

32
mkdir -p "$datadir"
33
mkdir -p "$outfile"
34 35

[ "${V-0}" -gt 0 ] && echov=echov || echov=:
36

37 38 39 40
echov(){
    echo "$@" >&3
}

41
. $(dirname $0)/md5.sh
42

43
AVCONV_OPTS="-nostats -y -cpuflags $cpuflags"
44
COMMON_OPTS="-flags +bitexact -idct simple -sws_flags +accurate_rnd+bitexact -fflags +bitexact"
45
DEC_OPTS="$COMMON_OPTS -threads $threads"
46
ENC_OPTS="$COMMON_OPTS -threads 1 -dct fastint"
47

48
run_avconv()
49
{
50 51
    $echov $avconv $AVCONV_OPTS $*
    $avconv $AVCONV_OPTS $*
52 53
}

54
do_avconv()
55 56 57 58
{
    f="$1"
    shift
    set -- $* ${target_path}/$f
59
    run_avconv $*
60
    do_md5sum $f
61
    echo $(wc -c $f)
62 63
}

64
do_avconv_crc()
65 66 67
{
    f="$1"
    shift
68
    run_avconv $* -f crc "$target_crcfile"
69
    echo "$f $(cat $crcfile)"
70
}