fate: qtrle: disable audio in all tests
[libav.git] / tests / regression-funcs.sh
CommitLineData
f94e56cf
SS
1#!/bin/sh
2#
6291d7e4 3# common regression functions for avconv
f94e56cf
SS
4#
5#
6
7test="${1#regtest-}"
8test_ref=$2
9raw_src_dir=$3
801b571e
MR
10target_exec=$4
11target_path=$5
7851eb68 12threads=${6:-1}
018f39ef 13cpuflags=${8:-all}
f94e56cf
SS
14
15datadir="./tests/data"
16target_datadir="${target_path}/${datadir}"
17
18this="$test.$test_ref"
cc3e2472 19outfile="$datadir/$test_ref/"
f94e56cf
SS
20
21# various files
6291d7e4 22avconv="$target_exec ${target_path}/avconv"
f94e56cf 23tiny_psnr="tests/tiny_psnr"
f94e56cf
SS
24raw_src="${target_path}/$raw_src_dir/%02d.pgm"
25raw_dst="$datadir/$this.out.yuv"
26raw_ref="$datadir/$test_ref.ref.yuv"
27pcm_src="$target_datadir/asynth1.sw"
28pcm_dst="$datadir/$this.out.wav"
29pcm_ref="$datadir/$test_ref.ref.wav"
30crcfile="$datadir/$this.crc"
31target_crcfile="$target_datadir/$this.crc"
32
d4a7df42 33cleanfiles="$raw_dst $pcm_dst $crcfile"
a4e6fa86
MR
34trap 'rm -f -- $cleanfiles' EXIT
35
c676895f 36mkdir -p "$datadir"
cc3e2472 37mkdir -p "$outfile"
c4795e80
MR
38
39[ "${V-0}" -gt 0 ] && echov=echov || echov=:
16cd99bb 40
c4795e80
MR
41echov(){
42 echo "$@" >&3
43}
44
fc8cb398 45. $(dirname $0)/md5.sh
f94e56cf 46
018f39ef 47AVCONV_OPTS="-nostats -y -cpuflags $cpuflags"
eeadaa6b
MR
48COMMON_OPTS="-flags +bitexact -idct simple -sws_flags +accurate_rnd+bitexact"
49DEC_OPTS="$COMMON_OPTS -threads $threads"
6da57043 50ENC_OPTS="$COMMON_OPTS -threads 1 -dct fastint"
f94e56cf 51
6291d7e4 52run_avconv()
f4b1e21a 53{
6291d7e4
AK
54 $echov $avconv $AVCONV_OPTS $*
55 $avconv $AVCONV_OPTS $*
f4b1e21a
MR
56}
57
6291d7e4 58do_avconv()
f94e56cf
SS
59{
60 f="$1"
61 shift
62 set -- $* ${target_path}/$f
6291d7e4 63 run_avconv $*
ea57502c 64 do_md5sum $f
f94e56cf 65 if [ $f = $raw_dst ] ; then
ea57502c 66 $tiny_psnr $f $raw_ref
f94e56cf 67 elif [ $f = $pcm_dst ] ; then
ea57502c 68 $tiny_psnr $f $pcm_ref 2
f94e56cf 69 else
ea57502c 70 wc -c $f
f94e56cf 71 fi
f94e56cf
SS
72}
73
6291d7e4 74do_avconv_nomd5()
f94e56cf
SS
75{
76 f="$1"
77 shift
78 set -- $* ${target_path}/$f
6291d7e4 79 run_avconv $*
f94e56cf 80 if [ $f = $raw_dst ] ; then
ea57502c 81 $tiny_psnr $f $raw_ref
f94e56cf 82 elif [ $f = $pcm_dst ] ; then
ea57502c 83 $tiny_psnr $f $pcm_ref 2
f94e56cf 84 else
ea57502c 85 wc -c $f
f94e56cf 86 fi
f94e56cf
SS
87}
88
6291d7e4 89do_avconv_crc()
f94e56cf
SS
90{
91 f="$1"
92 shift
6291d7e4 93 run_avconv $* -f crc "$target_crcfile"
ea57502c 94 echo "$f $(cat $crcfile)"
f94e56cf
SS
95}
96
f94e56cf
SS
97do_video_decoding()
98{
493a86e2 99 do_avconv $raw_dst $DEC_OPTS $1 -i $target_path/$file -f rawvideo $ENC_OPTS $2
f94e56cf
SS
100}
101
102do_video_encoding()
103{
104 file=${outfile}$1
6291d7e4 105 do_avconv $file $DEC_OPTS -f image2 -vcodec pgmyuv -i $raw_src $ENC_OPTS $2
f94e56cf
SS
106}
107
108do_audio_encoding()
109{
110 file=${outfile}$1
6291d7e4 111 do_avconv $file $DEC_OPTS -ac 2 -ar 44100 -f s16le -i $pcm_src -ab 128k $ENC_OPTS $2
f94e56cf
SS
112}
113
114do_audio_decoding()
115{
6cd9d0f7 116 do_avconv $pcm_dst $DEC_OPTS -i $target_path/$file -sample_fmt s16 -f wav
f94e56cf 117}