Imported Debian version 2.5.3~trusty1
[deb_ffmpeg.git] / ffmpeg / tests / regression-funcs.sh
CommitLineData
2ba45a60
DM
1#!/bin/sh
2#
3# common regression functions for ffmpeg
4#
5#
6
7test="${1#regtest-}"
8test_ref=$2
9raw_src_dir=$3
10target_exec=$4
11target_path=$5
12threads=${6:-1}
13cpuflags=${8:-all}
14target_samples=$9
15
16datadir="./tests/data"
17target_datadir="${target_path}/${datadir}"
18
19this="$test.$test_ref"
20outfile="$datadir/$test_ref/"
21
22# various files
23ffmpeg="$target_exec ${target_path}/ffmpeg"
24raw_src="${target_path}/$raw_src_dir/%02d.pgm"
25raw_dst="$datadir/$this.out.yuv"
26pcm_src="$target_datadir/asynth1.sw"
27pcm_src_1ch="$target_datadir/asynth-16000-1.wav"
28pcm_ref_1ch="$datadir/$test_ref-16000-1.ref.wav"
29crcfile="$datadir/$this.crc"
30target_crcfile="$target_datadir/$this.crc"
31
32cleanfiles="$raw_dst $crcfile"
33trap 'rm -f -- $cleanfiles' EXIT
34
35mkdir -p "$datadir"
36mkdir -p "$outfile"
37
38[ "${V-0}" -gt 0 ] && echov=echov || echov=:
39
40echov(){
41 echo "$@" >&3
42}
43
44. $(dirname $0)/md5.sh
45
46AVCONV_OPTS="-nostats -y -cpuflags $cpuflags"
47COMMON_OPTS="-flags +bitexact -idct simple -sws_flags +accurate_rnd+bitexact -fflags +bitexact"
48DEC_OPTS="$COMMON_OPTS -threads $threads"
49ENC_OPTS="$COMMON_OPTS -threads 1 -dct fastint"
50
51run_avconv()
52{
53 $echov $ffmpeg $AVCONV_OPTS $*
54 $ffmpeg $AVCONV_OPTS $*
55}
56
57do_avconv()
58{
59 f="$1"
60 shift
61 set -- $* ${target_path}/$f
62 run_avconv $*
63 do_md5sum $f
64 echo $(wc -c $f)
65}
66
67do_avconv_nomd5()
68{
69 f="$1"
70 shift
71 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 fi
80}
81
82do_avconv_crc()
83{
84 f="$1"
85 shift
86 run_avconv $* -f crc "$target_crcfile"
87 echo "$f $(cat $crcfile)"
88}