regtest: print commands also for image format tests
[libav.git] / tests / codec-regression.sh
CommitLineData
51133a7d
FB
1#!/bin/sh
2#
3# automatic regression test for ffmpeg
4#
5#
6#set -x
d9d7653e 7
51133a7d
FB
8set -e
9
9a5771e9
MR
10target_exec=$5
11target_path=$6
12
4fbd52f0 13datadir="./tests/data"
9a5771e9 14target_datadir="${target_path}/${datadir}"
5bcfd1ad 15
4383ed5c
MR
16test="${1#regtest-}"
17this="$test.$2"
18logfile="$datadir/$this.regression"
2009721d 19outfile="$datadir/$4-"
89d5dfd5 20
4383ed5c
MR
21eval do_$test=y
22
51133a7d 23# various files
9a5771e9 24ffmpeg="$target_exec ${target_path}/ffmpeg_g"
4fbd52f0 25tiny_psnr="tests/tiny_psnr"
4383ed5c
MR
26benchfile="$datadir/$this.bench"
27bench="$datadir/$this.bench.tmp"
28bench2="$datadir/$this.bench2.tmp"
9a5771e9 29raw_src="${target_path}/$3/%02d.pgm"
4383ed5c
MR
30raw_dst="$datadir/$this.out.yuv"
31raw_ref="$datadir/$2.ref.yuv"
67c447a6 32pcm_src="$target_datadir/asynth1.sw"
4383ed5c
MR
33pcm_dst="$datadir/$this.out.wav"
34pcm_ref="$datadir/$2.ref.wav"
2009721d 35crcfile="$datadir/$this.crc"
9a5771e9 36target_crcfile="$target_datadir/$this.crc"
2009721d 37
853d659d
JD
38if [ X"`echo | md5sum 2> /dev/null`" != X ]; then
39 do_md5sum() { md5sum -b $1; }
de40eb8d
RD
40elif [ X"`echo | md5 2> /dev/null`" != X ]; then
41 do_md5sum() { md5 -r $1 | sed 's# \**\./# *./#'; }
853d659d
JD
42elif [ -x /sbin/md5 ]; then
43 do_md5sum() { /sbin/md5 -r $1 | sed 's# \**\./# *./#'; }
44else
45 do_md5sum() { echo No md5sum program found; }
46fi
5bcfd1ad 47
3e3c638e 48FFMPEG_OPTS="-y -flags +bitexact -dct fastint -idct simple -sws_flags +accurate_rnd+bitexact"
bcea9605 49
3f027ca7 50do_ffmpeg()
51133a7d 51{
9e32e071 52 f="$1"
51133a7d 53 shift
9a5771e9 54 set -- $* ${target_path}/$f
bcea9605 55 echo $ffmpeg $FFMPEG_OPTS $*
8deb894f 56 $ffmpeg $FFMPEG_OPTS -benchmark $* > $bench 2> /tmp/ffmpeg$$
37a00782 57 egrep -v "^(Stream|Press|Input|Output|frame| Stream| Duration|video:)" /tmp/ffmpeg$$ || true
e31c1c30 58 rm -f /tmp/ffmpeg$$
9e32e071
DB
59 do_md5sum $f >> $logfile
60 if [ $f = $raw_dst ] ; then
61 $tiny_psnr $f $raw_ref >> $logfile
62 elif [ $f = $pcm_dst ] ; then
63 $tiny_psnr $f $pcm_ref 2 >> $logfile
039e7889 64 else
9e32e071 65 wc -c $f >> $logfile
67cbe681 66 fi
8deb894f 67 expr "`cat $bench`" : '.*utime=\(.*s\)' > $bench2
9e32e071 68 echo `cat $bench2` $f >> $benchfile
51133a7d
FB
69}
70
d9076fe7
MN
71do_ffmpeg_nomd5()
72{
73 f="$1"
74 shift
9a5771e9 75 set -- $* ${target_path}/$f
d9076fe7
MN
76 echo $ffmpeg $FFMPEG_OPTS $*
77 $ffmpeg $FFMPEG_OPTS -benchmark $* > $bench 2> /tmp/ffmpeg$$
78 egrep -v "^(Stream|Press|Input|Output|frame| Stream| Duration|video:)" /tmp/ffmpeg$$ || true
79 rm -f /tmp/ffmpeg$$
80 if [ $f = $raw_dst ] ; then
81 $tiny_psnr $f $raw_ref >> $logfile
82 elif [ $f = $pcm_dst ] ; then
83 $tiny_psnr $f $pcm_ref 2 >> $logfile
84 else
85 wc -c $f >> $logfile
86 fi
87 expr "`cat $bench`" : '.*utime=\(.*s\)' > $bench2
88 echo `cat $bench2` $f >> $benchfile
89}
90
3f027ca7 91do_ffmpeg_crc()
89d5dfd5 92{
9e32e071 93 f="$1"
89d5dfd5 94 shift
9a5771e9
MR
95 echo $ffmpeg $FFMPEG_OPTS $* -f crc "$target_crcfile"
96 $ffmpeg $FFMPEG_OPTS $* -f crc "$target_crcfile" > /tmp/ffmpeg$$ 2>&1
37a00782 97 egrep -v "^(Stream|Press|Input|Output|frame| Stream| Duration|video:|ffmpeg version| configuration| built)" /tmp/ffmpeg$$ || true
115329f1 98 rm -f /tmp/ffmpeg$$
2009721d
MR
99 echo "$f `cat $crcfile`" >> $logfile
100 rm -f "$crcfile"
89d5dfd5 101}
51133a7d 102
67cbe681
MN
103do_ffmpeg_nocheck()
104{
9e32e071 105 f="$1"
67cbe681 106 shift
bcea9605 107 echo $ffmpeg $FFMPEG_OPTS $*
8deb894f 108 $ffmpeg $FFMPEG_OPTS -benchmark $* > $bench 2> /tmp/ffmpeg$$
37a00782 109 egrep -v "^(Stream|Press|Input|Output|frame| Stream| Duration|video:)" /tmp/ffmpeg$$ || true
affd55a1 110 rm -f /tmp/ffmpeg$$
8deb894f 111 expr "`cat $bench`" : '.*utime=\(.*s\)' > $bench2
9e32e071 112 echo `cat $bench2` $f >> $benchfile
67cbe681
MN
113}
114
1de61a18
DB
115do_video_decoding()
116{
9a5771e9 117 do_ffmpeg $raw_dst $1 -i $target_path/$file -f rawvideo $2
4383ed5c 118 rm -f $raw_dst
1de61a18
DB
119}
120
121do_video_encoding()
122{
1e1b182d 123 file=${outfile}$1
9a5771e9 124 do_ffmpeg $file $2 -f image2 -vcodec pgmyuv -i $raw_src $3
1de61a18
DB
125}
126
fb132953
DB
127do_audio_encoding()
128{
129 file=${outfile}$1
9a5771e9 130 do_ffmpeg $file -ab 128k -ac 2 -f s16le -i $pcm_src $3
fb132953
DB
131}
132
133do_audio_decoding()
134{
9a5771e9 135 do_ffmpeg $pcm_dst -i $target_path/$file -sample_fmt s16 -f wav
fb132953
DB
136}
137
0bb5f0fa 138do_lavf()
36aed9e5 139{
1b4a516b 140 file=${outfile}lavf.$1
9a5771e9
MR
141 do_ffmpeg $file -t 1 -qscale 10 -f image2 -vcodec pgmyuv -i $raw_src -f s16le -i $pcm_src $2
142 do_ffmpeg_crc $file -i $target_path/$file $3
36aed9e5
DB
143}
144
d449d1bc
DB
145do_streamed_images()
146{
2009721d 147 file=${outfile}${1}pipe.$1
9a5771e9
MR
148 do_ffmpeg $file -t 1 -qscale 10 -f image2 -vcodec pgmyuv -i $raw_src -f image2pipe
149 do_ffmpeg_crc $file -f image2pipe -i $target_path/$file
d449d1bc
DB
150}
151
f8aa7645
DB
152do_image_formats()
153{
1b4a516b 154 file=${outfile}lavf%02d.$1
a4ddf509 155 echo $ffmpeg -t 0.5 -y -qscale 10 -f image2 -vcodec pgmyuv -i $raw_src $2 $3 -flags +bitexact -sws_flags +accurate_rnd+bitexact $target_path/$file
9a5771e9 156 $ffmpeg -t 0.5 -y -qscale 10 -f image2 -vcodec pgmyuv -i $raw_src $2 $3 -flags +bitexact -sws_flags +accurate_rnd+bitexact $target_path/$file
1b4a516b 157 do_md5sum ${outfile}lavf02.$1 >> $logfile
9a5771e9 158 do_ffmpeg_crc $file $3 -i $target_path/$file
1b4a516b 159 wc -c ${outfile}lavf02.$1 >> $logfile
f8aa7645
DB
160}
161
e587a0a5
DB
162do_audio_only()
163{
1b4a516b 164 file=${outfile}lavf.$1
9a5771e9
MR
165 do_ffmpeg $file -t 1 -qscale 10 -f s16le -i $pcm_src
166 do_ffmpeg_crc $file -i $target_path/$file
e587a0a5
DB
167}
168
4383ed5c
MR
169rm -f "$logfile"
170rm -f "$benchfile"
51133a7d 171
67cbe681 172# generate reference for quality check
4383ed5c 173if [ -n "$do_ref" ]; then
9a5771e9
MR
174do_ffmpeg_nocheck $raw_ref -f image2 -vcodec pgmyuv -i $raw_src -an -f rawvideo $target_path/$raw_ref
175do_ffmpeg_nocheck $pcm_ref -ab 128k -ac 2 -ar 44100 -f s16le -i $pcm_src -f wav $target_path/$pcm_ref
4383ed5c 176fi
67cbe681 177
51133a7d 178if [ -n "$do_mpeg" ] ; then
0fc3a831 179# mpeg1
5b67e4f8 180do_video_encoding mpeg1.mpg "-qscale 10" "-f mpeg1video"
1de61a18 181do_video_decoding
922bc38d
MN
182fi
183
922bc38d 184if [ -n "$do_mpeg2" ] ; then
0fc3a831 185# mpeg2
5b67e4f8 186do_video_encoding mpeg2.mpg "-qscale 10" "-vcodec mpeg2video -f mpeg1video"
1de61a18 187do_video_decoding
83dddc4a 188
49f1ac5a 189# mpeg2 encoding intra vlc qprd
dd1c8f3e 190do_video_encoding mpeg2ivlc-qprd.mpg "-vb 500k -bf 2 -trellis 1 -flags +qprd+mv0 -flags2 +ivlc -cmp 2 -subcmp 2 -mbd rd" "-vcodec mpeg2video -f mpeg2video"
1de61a18 191do_video_decoding
307eb248 192
2cce68f8 193#mpeg2 4:2:2 encoding
b91758de 194do_video_encoding mpeg2_422.mpg "-vb 1000k -bf 2 -trellis 1 -flags +qprd+mv0+ildct+ilme -flags2 +ivlc -mbd rd" "-vcodec mpeg2video -pix_fmt yuv422p -f mpeg2video"
2cce68f8
BC
195do_video_decoding
196
0fc3a831 197# mpeg2
5b67e4f8 198do_video_encoding mpeg2.mpg "-qscale 10" "-vcodec mpeg2video -idct int -dct int -f mpeg1video"
5e5ac8e0 199do_video_decoding "-idct int"
6486ad57 200
83dddc4a 201# mpeg2 encoding interlaced
5b67e4f8 202do_video_encoding mpeg2i.mpg "-qscale 10" "-vcodec mpeg2video -f mpeg1video -flags +ildct+ilme"
1de61a18 203do_video_decoding
51133a7d
FB
204fi
205
9c3d33d6
MN
206if [ -n "$do_mpeg2thread" ] ; then
207# mpeg2 encoding interlaced
5b67e4f8 208do_video_encoding mpeg2thread.mpg "-qscale 10" "-vcodec mpeg2video -f mpeg1video -bf 2 -flags +ildct+ilme -threads 2"
1de61a18 209do_video_decoding
307eb248
BC
210
211# mpeg2 encoding interlaced using intra vlc
5b67e4f8 212do_video_encoding mpeg2threadivlc.mpg "-qscale 10" "-vcodec mpeg2video -f mpeg1video -bf 2 -flags +ildct+ilme -flags2 +ivlc -threads 2"
1de61a18 213do_video_decoding
7f8038ce
MN
214
215# mpeg2 encoding interlaced
216file=${outfile}mpeg2reuse.mpg
9a5771e9 217do_ffmpeg $file -sameq -me_threshold 256 -mb_threshold 1024 -i ${target_path}/${outfile}mpeg2thread.mpg -vcodec mpeg2video -f mpeg1video -bf 2 -flags +ildct+ilme -threads 4
1de61a18 218do_video_decoding
9c3d33d6
MN
219fi
220
6ebd933b 221if [ -n "$do_msmpeg4v2" ] ; then
5b67e4f8 222do_video_encoding msmpeg4v2.avi "-qscale 10" "-an -vcodec msmpeg4v2"
1de61a18 223do_video_decoding
6ebd933b
MN
224fi
225
51133a7d 226if [ -n "$do_msmpeg4" ] ; then
5b67e4f8 227do_video_encoding msmpeg4.avi "-qscale 10" "-an -vcodec msmpeg4"
1de61a18 228do_video_decoding
51133a7d
FB
229fi
230
6ebd933b 231if [ -n "$do_wmv1" ] ; then
5b67e4f8 232do_video_encoding wmv1.avi "-qscale 10" "-an -vcodec wmv1"
1de61a18 233do_video_decoding
6ebd933b
MN
234fi
235
e23d5712 236if [ -n "$do_wmv2" ] ; then
5b67e4f8 237do_video_encoding wmv2.avi "-qscale 10" "-an -vcodec wmv2"
1de61a18 238do_video_decoding
e23d5712
MN
239fi
240
61b262a9 241if [ -n "$do_h261" ] ; then
5b67e4f8 242do_video_encoding h261.avi "-qscale 11" "-s 352x288 -an -vcodec h261"
1de61a18 243do_video_decoding
61b262a9
MN
244fi
245
51133a7d 246if [ -n "$do_h263" ] ; then
5b67e4f8 247do_video_encoding h263.avi "-qscale 10" "-s 352x288 -an -vcodec h263"
1de61a18 248do_video_decoding
6e2d5f1a
MN
249fi
250
6e2d5f1a 251if [ -n "$do_h263p" ] ; then
5b67e4f8 252do_video_encoding h263p.avi "-qscale 2 -flags +umv+aiv+aic" "-s 352x288 -an -vcodec h263p -ps 300"
1de61a18 253do_video_decoding
51133a7d
FB
254fi
255
51133a7d 256if [ -n "$do_mpeg4" ] ; then
5b67e4f8 257do_video_encoding odivx.mp4 "-flags +mv4 -mbd bits -qscale 10" "-an -vcodec mpeg4"
aeeb0cac 258do_video_decoding
51133a7d
FB
259fi
260
e629ab68 261if [ -n "$do_huffyuv" ] ; then
3e3c638e
MN
262do_video_encoding huffyuv.avi "" "-an -vcodec huffyuv -pix_fmt yuv422p -sws_flags neighbor+bitexact"
263do_video_decoding "" "-strict -2 -pix_fmt yuv420p -sws_flags neighbor+bitexact"
e629ab68
RD
264fi
265
1dbb6d90 266if [ -n "$do_rc" ] ; then
5b67e4f8 267do_video_encoding mpeg4-rc.avi "-b 400k -bf 2" "-an -vcodec mpeg4"
aeeb0cac 268do_video_decoding
1dbb6d90
MN
269fi
270
1dbb6d90 271if [ -n "$do_mpeg4adv" ] ; then
dd1c8f3e 272do_video_encoding mpeg4-adv.avi "-qscale 9 -flags +mv4+part+aic -trellis 1 -mbd bits -ps 200" "-an -vcodec mpeg4"
1de61a18 273do_video_decoding
2d1e5071 274
dd1c8f3e 275do_video_encoding mpeg4-qprd.avi "-b 450k -bf 2 -trellis 1 -flags +mv4+qprd+mv0 -cmp 2 -subcmp 2 -mbd rd" "-an -vcodec mpeg4"
2d1e5071
MN
276do_video_decoding
277
dd1c8f3e 278do_video_encoding mpeg4-adap.avi "-b 550k -bf 2 -flags +mv4+mv0 -trellis 1 -cmp 1 -subcmp 2 -mbd rd -scplx_mask 0.3" "-an -vcodec mpeg4"
2d1e5071 279do_video_decoding
1dbb6d90 280
5b67e4f8 281do_video_encoding mpeg4-Q.avi "-qscale 7 -flags +mv4+qpel -mbd 2 -bf 2 -cmp 1 -subcmp 2" "-an -vcodec mpeg4"
1de61a18 282do_video_decoding
aab9cdcf
MN
283fi
284
45ddd8b0 285if [ -n "$do_mpeg4thread" ] ; then
dd1c8f3e 286do_video_encoding mpeg4-thread.avi "-b 500k -flags +mv4+part+aic -trellis 1 -mbd bits -ps 200 -bf 2" "-an -vcodec mpeg4 -threads 2"
1de61a18 287do_video_decoding
9c3d33d6
MN
288fi
289
7ebfc0ea 290if [ -n "$do_error" ] ; then
5b67e4f8 291do_video_encoding error-mpeg4-adv.avi "-qscale 7 -flags +mv4+part+aic -mbd rd -ps 250 -error 10" "-an -vcodec mpeg4"
1de61a18 292do_video_decoding
7ebfc0ea
MN
293fi
294
be408b67 295if [ -n "$do_mpeg4nr" ] ; then
5b67e4f8 296do_video_encoding mpeg4-nr.avi "-qscale 8 -flags +mv4 -mbd rd -nr 200" "-an -vcodec mpeg4"
1de61a18 297do_video_decoding
be408b67
MN
298fi
299
cfadadec 300if [ -n "$do_mpeg1b" ] ; then
5b67e4f8 301do_video_encoding mpeg1b.mpg "-qscale 8 -bf 3 -ps 200" "-an -vcodec mpeg1video -f mpeg1video"
1de61a18 302do_video_decoding
cfadadec
MN
303fi
304
51133a7d 305if [ -n "$do_mjpeg" ] ; then
5b67e4f8 306do_video_encoding mjpeg.avi "-qscale 10" "-an -vcodec mjpeg -pix_fmt yuvj420p"
5e5ac8e0 307do_video_decoding "" "-pix_fmt yuv420p"
51133a7d
FB
308fi
309
3b37408b 310if [ -n "$do_ljpeg" ] ; then
5b67e4f8 311do_video_encoding ljpeg.avi "" "-an -vcodec ljpeg -strict -1"
1de61a18 312do_video_decoding
3b37408b
MN
313fi
314
b4e021e8 315if [ -n "$do_jpegls" ] ; then
3e3c638e
MN
316do_video_encoding jpegls.avi "" "-an -vcodec jpegls -vtag MJPG -sws_flags neighbor+full_chroma_int+accurate_rnd+bitexact"
317do_video_decoding "" "-pix_fmt yuv420p -sws_flags area+bitexact"
b4e021e8
MN
318fi
319
51133a7d 320if [ -n "$do_rv10" ] ; then
5b67e4f8 321do_video_encoding rv10.rm "-qscale 10" "-an"
1de61a18 322do_video_decoding
51133a7d
FB
323fi
324
c50cd09d 325if [ -n "$do_rv20" ] ; then
5b67e4f8 326do_video_encoding rv20.rm "-qscale 10" "-vcodec rv20 -an"
1de61a18 327do_video_decoding
c50cd09d
MN
328fi
329
9ca9fce1 330if [ -n "$do_asv1" ] ; then
5b67e4f8 331do_video_encoding asv1.avi "-qscale 10" "-an -vcodec asv1"
1de61a18 332do_video_decoding
9ca9fce1
MN
333fi
334
8d876a43 335if [ -n "$do_asv2" ] ; then
5b67e4f8 336do_video_encoding asv2.avi "-qscale 10" "-an -vcodec asv2"
1de61a18 337do_video_decoding
8d876a43
MN
338fi
339
bbdd42d3 340if [ -n "$do_flv" ] ; then
5b67e4f8 341do_video_encoding flv.flv "-qscale 10" "-an -vcodec flv"
1de61a18 342do_video_decoding
bbdd42d3
MN
343fi
344
f3203047 345if [ -n "$do_ffv1" ] ; then
5b67e4f8 346do_video_encoding ffv1.avi "-strict -2" "-an -vcodec ffv1"
1de61a18 347do_video_decoding
d13eef3d
MN
348fi
349
d13eef3d 350if [ -n "$do_snow" ] ; then
dd1c8f3e 351do_video_encoding snow.avi "-strict -2" "-an -vcodec snow -qscale 2 -flags +qpel -me_method iter -dia_size 2 -cmp 12 -subcmp 12 -s 128x64"
5e5ac8e0 352do_video_decoding "" "-s 352x288"
e03c822a 353fi
d13eef3d 354
e03c822a 355if [ -n "$do_snowll" ] ; then
5b67e4f8 356do_video_encoding snow53.avi "-strict -2" "-an -vcodec snow -qscale .001 -pred 1 -flags +mv4+qpel"
1de61a18 357do_video_decoding
f3203047
MN
358fi
359
8fce2707 360if [ -n "$do_dv" ] ; then
5b67e4f8 361do_video_encoding dv.dv "-dct int" "-s pal -an"
5e5ac8e0 362do_video_decoding "" "-s cif"
77c3fb90 363
3e3c638e
MN
364do_video_encoding dv411.dv "-dct int" "-s pal -an -pix_fmt yuv411p -sws_flags area+accurate_rnd+bitexact"
365do_video_decoding "" "-s cif -sws_flags area+accurate_rnd+bitexact"
8fce2707
MN
366fi
367
0b297700 368if [ -n "$do_dv50" ] ; then
3e3c638e
MN
369do_video_encoding dv50.dv "-dct int" "-s pal -pix_fmt yuv422p -an -sws_flags neighbor+bitexact"
370do_video_decoding "" "-s cif -pix_fmt yuv420p -sws_flags neighbor+bitexact"
0b297700
DM
371fi
372
b86bd1f1 373if [ -n "$do_svq1" ] ; then
5b67e4f8 374do_video_encoding svq1.mov "" "-an -vcodec svq1 -qscale 3 -pix_fmt yuv410p"
5e5ac8e0 375do_video_decoding "" "-pix_fmt yuv420p"
b86bd1f1
MN
376fi
377
d2f8f410 378if [ -n "$do_flashsv" ] ; then
3e3c638e
MN
379do_video_encoding flashsv.flv "" "-an -vcodec flashsv -sws_flags neighbor+full_chroma_int+accurate_rnd+bitexact"
380do_video_decoding "" "-pix_fmt yuv420p -sws_flags area+accurate_rnd+bitexact"
d2f8f410
MN
381fi
382
51133a7d 383if [ -n "$do_mp2" ] ; then
fb132953 384do_audio_encoding mp2.mp2 "-ar 44100"
fb132953 385do_audio_decoding
976709ee 386$tiny_psnr $pcm_dst $pcm_ref 2 1924 >> $logfile
51133a7d
FB
387fi
388
51133a7d 389if [ -n "$do_ac3" ] ; then
fb132953 390do_audio_encoding ac3.rm "" -vn
f77dddfc 391# binaries configured with --disable-sse decode ac3 differently
ede935a1
CEH
392#do_audio_decoding
393#$tiny_psnr $pcm_dst $pcm_ref 2 1024 >> $logfile
51133a7d
FB
394fi
395
311be1fb 396if [ -n "$do_g726" ] ; then
066a81a8 397do_audio_encoding g726.wav "-ar 44100" "-ab 32k -ac 1 -ar 8000 -acodec g726"
fb132953 398do_audio_decoding
311be1fb
MN
399fi
400
f02ab814 401if [ -n "$do_adpcm_ima_wav" ] ; then
fb132953 402do_audio_encoding adpcm_ima.wav "-ar 44100" "-acodec adpcm_ima_wav"
fb132953 403do_audio_decoding
f02ab814
MN
404fi
405
9dc92a38
KS
406if [ -n "$do_adpcm_ima_qt" ] ; then
407do_audio_encoding adpcm_qt.aiff "-ar 44100" "-acodec adpcm_ima_qt"
408do_audio_decoding
409fi
410
f02ab814 411if [ -n "$do_adpcm_ms" ] ; then
fb132953 412do_audio_encoding adpcm_ms.wav "-ar 44100" "-acodec adpcm_ms"
fb132953 413do_audio_decoding
f02ab814
MN
414fi
415
d8cbeba1 416if [ -n "$do_adpcm_yam" ] ; then
fb132953 417do_audio_encoding adpcm_yam.wav "-ar 44100" "-acodec adpcm_yamaha"
fb132953 418do_audio_decoding
d8cbeba1
MN
419fi
420
b529ab37 421if [ -n "$do_adpcm_swf" ] ; then
b529ab37
BL
422do_audio_encoding adpcm_swf.flv "-ar 44100" "-acodec adpcm_swf"
423do_audio_decoding
424fi
425
aeb2904e 426if [ -n "$do_flac" ] ; then
fb132953 427do_audio_encoding flac.flac "-ar 44100" "-acodec flac -compression_level 2"
fb132953 428do_audio_decoding
aeb2904e
MN
429fi
430
6d3d8dae
MN
431if [ -n "$do_wma" ] ; then
432# wmav1
433do_audio_encoding wmav1.asf "-ar 44100" "-acodec wmav1"
9a5771e9 434do_ffmpeg_nomd5 $pcm_dst -i $target_path/$file -f wav
6d3d8dae
MN
435$tiny_psnr $pcm_dst $pcm_ref 2 8192 >> $logfile
436# wmav2
437do_audio_encoding wmav2.asf "-ar 44100" "-acodec wmav2"
9a5771e9 438do_ffmpeg_nomd5 $pcm_dst -i $target_path/$file -f wav
6d3d8dae
MN
439$tiny_psnr $pcm_dst $pcm_ref 2 8192 >> $logfile
440fi
441
0786943a 442#if [ -n "$do_vorbis" ] ; then
3160138f 443# vorbis
90b5b51e 444#disabled because it is broken
0786943a
MN
445#do_audio_encoding vorbis.asf "-ar 44100" "-acodec vorbis"
446#do_audio_decoding
447#fi
6d3d8dae 448
4f5c72e8
PR
449do_audio_enc_dec() {
450 do_audio_encoding $3.$1 "" "$4 -sample_fmt $2 -acodec $3"
451 do_audio_decoding
452}
453
454if [ -n "$do_pcm" ] ; then
455do_audio_enc_dec wav s16 pcm_alaw
456do_audio_enc_dec wav s16 pcm_mulaw
5e8ecfde
PR
457do_audio_enc_dec mov u8 pcm_s8
458do_audio_enc_dec wav u8 pcm_u8
4f5c72e8
PR
459do_audio_enc_dec mov s16 pcm_s16be
460do_audio_enc_dec wav s16 pcm_s16le
38511b9a
AJ
461do_audio_enc_dec mkv s16 pcm_s16be
462do_audio_enc_dec mkv s16 pcm_s16le
5e8ecfde
PR
463do_audio_enc_dec mov s32 pcm_s24be
464do_audio_enc_dec wav s32 pcm_s24le
465#do_audio_enc_dec ??? s32 pcm_u24be #no compatible muxer or demuxer
466#do_audio_enc_dec ??? s32 pcm_u24le #no compatible muxer or demuxer
467do_audio_enc_dec mov s32 pcm_s32be
468do_audio_enc_dec wav s32 pcm_s32le
469#do_audio_enc_dec ??? s32 pcm_u32be #no compatible muxer or demuxer
470#do_audio_enc_dec ??? s32 pcm_u32le #no compatible muxer or demuxer
4f5c72e8 471do_audio_enc_dec au flt pcm_f32be
6f18fe8c
PR
472do_audio_enc_dec wav flt pcm_f32le
473do_audio_enc_dec au dbl pcm_f64be
474do_audio_enc_dec wav dbl pcm_f64le
4f5c72e8
PR
475do_audio_enc_dec wav s16 pcm_zork
476do_audio_enc_dec 302 s16 pcm_s24daud "-ac 6 -ar 96000"
477fi
478
2a048239 479# libavformat testing
89d5dfd5 480
2009721d 481if [ -n "$do_avi" ] ; then
0bb5f0fa 482do_lavf avi
2009721d 483fi
89d5dfd5 484
2009721d 485if [ -n "$do_asf" ] ; then
0bb5f0fa 486do_lavf asf "-acodec mp2" "-r 25"
2009721d 487fi
89d5dfd5 488
2009721d 489if [ -n "$do_rm" ] ; then
1b4a516b 490file=${outfile}lavf.rm
9a5771e9 491do_ffmpeg $file -t 1 -qscale 10 -f image2 -vcodec pgmyuv -i $raw_src -f s16le -i $pcm_src
89d5dfd5 492# broken
9a5771e9 493#do_ffmpeg_crc $file -i $target_path/$file
2009721d 494fi
89d5dfd5 495
2009721d 496if [ -n "$do_mpg" ] ; then
0bb5f0fa 497do_lavf mpg
2009721d 498fi
89d5dfd5 499
b686d0ab 500if [ -n "$do_mxf" ] ; then
0bb5f0fa
DB
501do_lavf mxf "-ar 48000 -bf 2 -timecode_frame_start 264363"
502do_lavf mxf_d10 "-ar 48000 -ac 2 -r 25 -s 720x576 -padtop 32 -vcodec mpeg2video -intra -flags +ildct+low_delay -dc 10 -flags2 +ivlc+non_linear_q -qscale 1 -ps 1 -qmin 1 -rc_max_vbv_use 1 -rc_min_vbv_use 1 -pix_fmt yuv422p -minrate 30000k -maxrate 30000k -b 30000k -bufsize 1200000 -top 1 -rc_init_occupancy 1200000 -qmax 12 -f mxf_d10"
b686d0ab
BC
503fi
504
2009721d 505if [ -n "$do_ts" ] ; then
0bb5f0fa 506do_lavf ts
2009721d 507fi
d05c15cb 508
2009721d 509if [ -n "$do_swf" ] ; then
0bb5f0fa 510do_lavf swf -an
2009721d 511fi
89d5dfd5 512
2009721d 513if [ -n "$do_ffm" ] ; then
0bb5f0fa 514do_lavf ffm
2009721d 515fi
89d5dfd5 516
2009721d 517if [ -n "$do_flv_fmt" ] ; then
0bb5f0fa 518do_lavf flv -an
2009721d 519fi
bbdd42d3 520
2009721d 521if [ -n "$do_mov" ] ; then
0bb5f0fa 522do_lavf mov "-acodec pcm_alaw"
2009721d 523fi
c280f2d7 524
2009721d 525if [ -n "$do_dv_fmt" ] ; then
0bb5f0fa 526do_lavf dv "-ar 48000 -r 25 -s pal -ac 2"
2009721d 527fi
a811de6e 528
2009721d 529if [ -n "$do_gxf" ] ; then
0bb5f0fa 530do_lavf gxf "-ar 48000 -r 25 -s pal -ac 1"
2009721d 531fi
a850fd18 532
2009721d 533if [ -n "$do_nut" ] ; then
0bb5f0fa 534do_lavf nut "-acodec mp2"
2009721d 535fi
f38e2b13 536
2009721d 537if [ -n "$do_mkv" ] ; then
0bb5f0fa 538do_lavf mkv
2009721d 539fi
46491f13 540
f38e2b13 541
89d5dfd5
FB
542# streamed images
543# mjpeg
1b4a516b 544#file=${outfile}lavf.mjpeg
9a5771e9
MR
545#do_ffmpeg $file -t 1 -qscale 10 -f image2 -vcodec pgmyuv -i $raw_src
546#do_ffmpeg_crc $file -i $target_path/$file
89d5dfd5 547
2009721d 548if [ -n "$do_pbmpipe" ] ; then
d449d1bc 549do_streamed_images pbm
2009721d 550fi
7481e919 551
2009721d 552if [ -n "$do_pgmpipe" ] ; then
d449d1bc 553do_streamed_images pgm
2009721d 554fi
89d5dfd5 555
2009721d 556if [ -n "$do_ppmpipe" ] ; then
d449d1bc 557do_streamed_images ppm
2009721d 558fi
89d5dfd5 559
2009721d 560if [ -n "$do_gif" ] ; then
1b4a516b 561file=${outfile}lavf.gif
9a5771e9
MR
562do_ffmpeg $file -t 1 -qscale 10 -f image2 -vcodec pgmyuv -i $raw_src -pix_fmt rgb24
563#do_ffmpeg_crc $file -i $target_path/$file
2009721d 564fi
7481e919 565
2009721d 566if [ -n "$do_yuv4mpeg" ] ; then
1b4a516b 567file=${outfile}lavf.y4m
9a5771e9
MR
568do_ffmpeg $file -t 1 -qscale 10 -f image2 -vcodec pgmyuv -i $raw_src
569#do_ffmpeg_crc $file -i $target_path/$file
2009721d 570fi
89d5dfd5 571
89d5dfd5 572# image formats
2009721d
MR
573
574if [ -n "$do_pgm" ] ; then
f8aa7645 575do_image_formats pgm
2009721d 576fi
89d5dfd5 577
2009721d 578if [ -n "$do_ppm" ] ; then
f8aa7645 579do_image_formats ppm
2009721d 580fi
89d5dfd5 581
2009721d 582if [ -n "$do_bmp" ] ; then
1e358f03 583do_image_formats bmp
2009721d 584fi
1e358f03 585
2009721d 586if [ -n "$do_tga" ] ; then
1e358f03 587do_image_formats tga
2009721d 588fi
1e358f03 589
2009721d 590if [ -n "$do_tiff" ] ; then
f4d47d6b 591do_image_formats tiff "-pix_fmt rgb24"
2009721d 592fi
90b4e393 593
2009721d 594if [ -n "$do_sgi" ] ; then
90b4e393 595do_image_formats sgi
2009721d 596fi
90b4e393 597
2009721d 598if [ -n "$do_jpg" ] ; then
f8aa7645 599do_image_formats jpg "-flags +bitexact -dct fastint -idct simple -pix_fmt yuvj420p" "-f image2"
2009721d 600fi
d0c30ca5 601
effcedf7
DV
602if [ -n "$do_pcx" ] ; then
603do_image_formats pcx
604fi
605
89d5dfd5
FB
606# audio only
607
2009721d 608if [ -n "$do_wav" ] ; then
e587a0a5 609do_audio_only wav
2009721d 610fi
89d5dfd5 611
2009721d 612if [ -n "$do_alaw" ] ; then
e587a0a5 613do_audio_only al
2009721d 614fi
89d5dfd5 615
2009721d 616if [ -n "$do_mulaw" ] ; then
e587a0a5 617do_audio_only ul
2009721d 618fi
89d5dfd5 619
2009721d 620if [ -n "$do_au" ] ; then
e587a0a5 621do_audio_only au
2009721d 622fi
89d5dfd5 623
2009721d 624if [ -n "$do_mmf" ] ; then
e587a0a5 625do_audio_only mmf
2009721d 626fi
d8cbeba1 627
2009721d 628if [ -n "$do_aiff" ] ; then
e587a0a5 629do_audio_only aif
2009721d 630fi
f11288da 631
2009721d 632if [ -n "$do_voc" ] ; then
e587a0a5 633do_audio_only voc
2009721d 634fi
ea395e8c 635
2009721d 636if [ -n "$do_ogg" ] ; then
5118cae6 637do_audio_only ogg
2009721d 638fi
5118cae6 639
affd55a1 640# pix_fmt conversions
2009721d
MR
641
642if [ -n "$do_pixfmt" ] ; then
dc8918ad
BC
643conversions="yuv420p yuv422p yuv444p yuyv422 yuv410p yuv411p yuvj420p \
644 yuvj422p yuvj444p rgb24 bgr24 rgb32 rgb565 rgb555 gray monow \
3e3c638e 645 monob yuv440p yuvj440p"
affd55a1 646for pix_fmt in $conversions ; do
1b4a516b 647 file=${outfile}lavf-${pix_fmt}.yuv
bddbd7d3 648 do_ffmpeg_nocheck $file -r 1 -t 1 -f image2 -vcodec pgmyuv -i $raw_src \
9a5771e9
MR
649 -f rawvideo -s 352x288 -pix_fmt $pix_fmt $target_path/$raw_dst
650 do_ffmpeg $file -f rawvideo -s 352x288 -pix_fmt $pix_fmt -i $target_path/$raw_dst \
651 -f rawvideo -s 352x288 -pix_fmt yuv444p
affd55a1 652done
2009721d 653fi
51133a7d 654
4383ed5c 655rm -f "$bench" "$bench2"