regression-funcs.sh 1.66 KB
Newer Older
1 2
#!/bin/sh
#
3
# common regression functions for ffmpeg
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
target_samples=$9
15 16 17 18 19

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

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

22 23
 # various files
ffmpeg="$target_exec ${target_path}/ffmpeg${PROGSUF}"
24 25 26
raw_src="${target_path}/$raw_src_dir/%02d.pgm"
raw_dst="$datadir/$this.out.yuv"
pcm_src="$target_datadir/asynth1.sw"
27
pcm_src_1ch="$target_datadir/asynth-16000-1.wav"
28
pcm_ref_1ch="$datadir/$test_ref-16000-1.ref.wav"
29 30 31
crcfile="$datadir/$this.crc"
target_crcfile="$target_datadir/$this.crc"

32
cleanfiles="$raw_dst $crcfile"
33 34
trap 'rm -f -- $cleanfiles' EXIT

35
mkdir -p "$datadir"
36
mkdir -p "$outfile"
37 38

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

40 41 42 43
echov(){
    echo "$@" >&3
}

44
. $(dirname $0)/md5.sh
45

46
AVCONV_OPTS="-nostats -y -cpuflags $cpuflags"
47
COMMON_OPTS="-flags +bitexact -idct simple -sws_flags +accurate_rnd+bitexact -fflags +bitexact"
48
DEC_OPTS="$COMMON_OPTS -threads $threads"
49
ENC_OPTS="$COMMON_OPTS -threads $threads -dct fastint"
50

51
run_avconv()
52
{
53 54
    $echov $ffmpeg $AVCONV_OPTS $*
    $ffmpeg $AVCONV_OPTS $*
55 56
}

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

67
do_avconv_nomd5()
68 69 70 71
{
    f="$1"
    shift
    set -- $* ${target_path}/$f
72
    run_avconv $*
73
    if [ $f = $raw_dst ] ; then
74
        $tiny_psnr $f $raw_ref
75
    elif [ $f = $pcm_dst ] ; then
76
        $tiny_psnr $f $pcm_ref 2
77
    else
78
        echo $(wc -c $f)
79 80 81
    fi
}

82
do_avconv_crc()
83 84 85
{
    f="$1"
    shift
86
    run_avconv $* -f crc "$target_crcfile"
87
    echo "$f $(cat $crcfile)"
88
}