Fix comment: gcc 2.95.3 binaries decode ac3 fine if SSE is available and
[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
9a5771e9 155 $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 156 do_md5sum ${outfile}lavf02.$1 >> $logfile
9a5771e9 157 do_ffmpeg_crc $file $3 -i $target_path/$file
1b4a516b 158 wc -c ${outfile}lavf02.$1 >> $logfile
f8aa7645
DB
159}
160
e587a0a5
DB
161do_audio_only()
162{
1b4a516b 163 file=${outfile}lavf.$1
9a5771e9
MR
164 do_ffmpeg $file -t 1 -qscale 10 -f s16le -i $pcm_src
165 do_ffmpeg_crc $file -i $target_path/$file
e587a0a5
DB
166}
167
4383ed5c
MR
168rm -f "$logfile"
169rm -f "$benchfile"
51133a7d 170
67cbe681 171# generate reference for quality check
4383ed5c 172if [ -n "$do_ref" ]; then
9a5771e9
MR
173do_ffmpeg_nocheck $raw_ref -f image2 -vcodec pgmyuv -i $raw_src -an -f rawvideo $target_path/$raw_ref
174do_ffmpeg_nocheck $pcm_ref -ab 128k -ac 2 -ar 44100 -f s16le -i $pcm_src -f wav $target_path/$pcm_ref
4383ed5c 175fi
67cbe681 176
51133a7d 177if [ -n "$do_mpeg" ] ; then
0fc3a831 178# mpeg1
5b67e4f8 179do_video_encoding mpeg1.mpg "-qscale 10" "-f mpeg1video"
1de61a18 180do_video_decoding
922bc38d
MN
181fi
182
922bc38d 183if [ -n "$do_mpeg2" ] ; then
0fc3a831 184# mpeg2
5b67e4f8 185do_video_encoding mpeg2.mpg "-qscale 10" "-vcodec mpeg2video -f mpeg1video"
1de61a18 186do_video_decoding
83dddc4a 187
49f1ac5a 188# mpeg2 encoding intra vlc qprd
dd1c8f3e 189do_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 190do_video_decoding
307eb248 191
2cce68f8 192#mpeg2 4:2:2 encoding
b91758de 193do_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
194do_video_decoding
195
0fc3a831 196# mpeg2
5b67e4f8 197do_video_encoding mpeg2.mpg "-qscale 10" "-vcodec mpeg2video -idct int -dct int -f mpeg1video"
5e5ac8e0 198do_video_decoding "-idct int"
6486ad57 199
83dddc4a 200# mpeg2 encoding interlaced
5b67e4f8 201do_video_encoding mpeg2i.mpg "-qscale 10" "-vcodec mpeg2video -f mpeg1video -flags +ildct+ilme"
1de61a18 202do_video_decoding
51133a7d
FB
203fi
204
9c3d33d6
MN
205if [ -n "$do_mpeg2thread" ] ; then
206# mpeg2 encoding interlaced
5b67e4f8 207do_video_encoding mpeg2thread.mpg "-qscale 10" "-vcodec mpeg2video -f mpeg1video -bf 2 -flags +ildct+ilme -threads 2"
1de61a18 208do_video_decoding
307eb248
BC
209
210# mpeg2 encoding interlaced using intra vlc
5b67e4f8 211do_video_encoding mpeg2threadivlc.mpg "-qscale 10" "-vcodec mpeg2video -f mpeg1video -bf 2 -flags +ildct+ilme -flags2 +ivlc -threads 2"
1de61a18 212do_video_decoding
7f8038ce
MN
213
214# mpeg2 encoding interlaced
215file=${outfile}mpeg2reuse.mpg
9a5771e9 216do_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 217do_video_decoding
9c3d33d6
MN
218fi
219
6ebd933b 220if [ -n "$do_msmpeg4v2" ] ; then
5b67e4f8 221do_video_encoding msmpeg4v2.avi "-qscale 10" "-an -vcodec msmpeg4v2"
1de61a18 222do_video_decoding
6ebd933b
MN
223fi
224
51133a7d 225if [ -n "$do_msmpeg4" ] ; then
5b67e4f8 226do_video_encoding msmpeg4.avi "-qscale 10" "-an -vcodec msmpeg4"
1de61a18 227do_video_decoding
51133a7d
FB
228fi
229
6ebd933b 230if [ -n "$do_wmv1" ] ; then
5b67e4f8 231do_video_encoding wmv1.avi "-qscale 10" "-an -vcodec wmv1"
1de61a18 232do_video_decoding
6ebd933b
MN
233fi
234
e23d5712 235if [ -n "$do_wmv2" ] ; then
5b67e4f8 236do_video_encoding wmv2.avi "-qscale 10" "-an -vcodec wmv2"
1de61a18 237do_video_decoding
e23d5712
MN
238fi
239
61b262a9 240if [ -n "$do_h261" ] ; then
5b67e4f8 241do_video_encoding h261.avi "-qscale 11" "-s 352x288 -an -vcodec h261"
1de61a18 242do_video_decoding
61b262a9
MN
243fi
244
51133a7d 245if [ -n "$do_h263" ] ; then
5b67e4f8 246do_video_encoding h263.avi "-qscale 10" "-s 352x288 -an -vcodec h263"
1de61a18 247do_video_decoding
6e2d5f1a
MN
248fi
249
6e2d5f1a 250if [ -n "$do_h263p" ] ; then
5b67e4f8 251do_video_encoding h263p.avi "-qscale 2 -flags +umv+aiv+aic" "-s 352x288 -an -vcodec h263p -ps 300"
1de61a18 252do_video_decoding
51133a7d
FB
253fi
254
51133a7d 255if [ -n "$do_mpeg4" ] ; then
5b67e4f8 256do_video_encoding odivx.mp4 "-flags +mv4 -mbd bits -qscale 10" "-an -vcodec mpeg4"
aeeb0cac 257do_video_decoding
51133a7d
FB
258fi
259
e629ab68 260if [ -n "$do_huffyuv" ] ; then
3e3c638e
MN
261do_video_encoding huffyuv.avi "" "-an -vcodec huffyuv -pix_fmt yuv422p -sws_flags neighbor+bitexact"
262do_video_decoding "" "-strict -2 -pix_fmt yuv420p -sws_flags neighbor+bitexact"
e629ab68
RD
263fi
264
1dbb6d90 265if [ -n "$do_rc" ] ; then
5b67e4f8 266do_video_encoding mpeg4-rc.avi "-b 400k -bf 2" "-an -vcodec mpeg4"
aeeb0cac 267do_video_decoding
1dbb6d90
MN
268fi
269
1dbb6d90 270if [ -n "$do_mpeg4adv" ] ; then
dd1c8f3e 271do_video_encoding mpeg4-adv.avi "-qscale 9 -flags +mv4+part+aic -trellis 1 -mbd bits -ps 200" "-an -vcodec mpeg4"
1de61a18 272do_video_decoding
2d1e5071 273
dd1c8f3e 274do_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
275do_video_decoding
276
dd1c8f3e 277do_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 278do_video_decoding
1dbb6d90 279
5b67e4f8 280do_video_encoding mpeg4-Q.avi "-qscale 7 -flags +mv4+qpel -mbd 2 -bf 2 -cmp 1 -subcmp 2" "-an -vcodec mpeg4"
1de61a18 281do_video_decoding
aab9cdcf
MN
282fi
283
45ddd8b0 284if [ -n "$do_mpeg4thread" ] ; then
dd1c8f3e 285do_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 286do_video_decoding
9c3d33d6
MN
287fi
288
7ebfc0ea 289if [ -n "$do_error" ] ; then
5b67e4f8 290do_video_encoding error-mpeg4-adv.avi "-qscale 7 -flags +mv4+part+aic -mbd rd -ps 250 -error 10" "-an -vcodec mpeg4"
1de61a18 291do_video_decoding
7ebfc0ea
MN
292fi
293
be408b67 294if [ -n "$do_mpeg4nr" ] ; then
5b67e4f8 295do_video_encoding mpeg4-nr.avi "-qscale 8 -flags +mv4 -mbd rd -nr 200" "-an -vcodec mpeg4"
1de61a18 296do_video_decoding
be408b67
MN
297fi
298
cfadadec 299if [ -n "$do_mpeg1b" ] ; then
5b67e4f8 300do_video_encoding mpeg1b.mpg "-qscale 8 -bf 3 -ps 200" "-an -vcodec mpeg1video -f mpeg1video"
1de61a18 301do_video_decoding
cfadadec
MN
302fi
303
51133a7d 304if [ -n "$do_mjpeg" ] ; then
5b67e4f8 305do_video_encoding mjpeg.avi "-qscale 10" "-an -vcodec mjpeg -pix_fmt yuvj420p"
5e5ac8e0 306do_video_decoding "" "-pix_fmt yuv420p"
51133a7d
FB
307fi
308
3b37408b 309if [ -n "$do_ljpeg" ] ; then
5b67e4f8 310do_video_encoding ljpeg.avi "" "-an -vcodec ljpeg -strict -1"
1de61a18 311do_video_decoding
3b37408b
MN
312fi
313
b4e021e8 314if [ -n "$do_jpegls" ] ; then
3e3c638e
MN
315do_video_encoding jpegls.avi "" "-an -vcodec jpegls -vtag MJPG -sws_flags neighbor+full_chroma_int+accurate_rnd+bitexact"
316do_video_decoding "" "-pix_fmt yuv420p -sws_flags area+bitexact"
b4e021e8
MN
317fi
318
51133a7d 319if [ -n "$do_rv10" ] ; then
5b67e4f8 320do_video_encoding rv10.rm "-qscale 10" "-an"
1de61a18 321do_video_decoding
51133a7d
FB
322fi
323
c50cd09d 324if [ -n "$do_rv20" ] ; then
5b67e4f8 325do_video_encoding rv20.rm "-qscale 10" "-vcodec rv20 -an"
1de61a18 326do_video_decoding
c50cd09d
MN
327fi
328
9ca9fce1 329if [ -n "$do_asv1" ] ; then
5b67e4f8 330do_video_encoding asv1.avi "-qscale 10" "-an -vcodec asv1"
1de61a18 331do_video_decoding
9ca9fce1
MN
332fi
333
8d876a43 334if [ -n "$do_asv2" ] ; then
5b67e4f8 335do_video_encoding asv2.avi "-qscale 10" "-an -vcodec asv2"
1de61a18 336do_video_decoding
8d876a43
MN
337fi
338
bbdd42d3 339if [ -n "$do_flv" ] ; then
5b67e4f8 340do_video_encoding flv.flv "-qscale 10" "-an -vcodec flv"
1de61a18 341do_video_decoding
bbdd42d3
MN
342fi
343
f3203047 344if [ -n "$do_ffv1" ] ; then
5b67e4f8 345do_video_encoding ffv1.avi "-strict -2" "-an -vcodec ffv1"
1de61a18 346do_video_decoding
d13eef3d
MN
347fi
348
d13eef3d 349if [ -n "$do_snow" ] ; then
dd1c8f3e 350do_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 351do_video_decoding "" "-s 352x288"
e03c822a 352fi
d13eef3d 353
e03c822a 354if [ -n "$do_snowll" ] ; then
5b67e4f8 355do_video_encoding snow53.avi "-strict -2" "-an -vcodec snow -qscale .001 -pred 1 -flags +mv4+qpel"
1de61a18 356do_video_decoding
f3203047
MN
357fi
358
8fce2707 359if [ -n "$do_dv" ] ; then
5b67e4f8 360do_video_encoding dv.dv "-dct int" "-s pal -an"
5e5ac8e0 361do_video_decoding "" "-s cif"
77c3fb90 362
3e3c638e
MN
363do_video_encoding dv411.dv "-dct int" "-s pal -an -pix_fmt yuv411p -sws_flags area+accurate_rnd+bitexact"
364do_video_decoding "" "-s cif -sws_flags area+accurate_rnd+bitexact"
8fce2707
MN
365fi
366
0b297700 367if [ -n "$do_dv50" ] ; then
3e3c638e
MN
368do_video_encoding dv50.dv "-dct int" "-s pal -pix_fmt yuv422p -an -sws_flags neighbor+bitexact"
369do_video_decoding "" "-s cif -pix_fmt yuv420p -sws_flags neighbor+bitexact"
0b297700
DM
370fi
371
b86bd1f1 372if [ -n "$do_svq1" ] ; then
5b67e4f8 373do_video_encoding svq1.mov "" "-an -vcodec svq1 -qscale 3 -pix_fmt yuv410p"
5e5ac8e0 374do_video_decoding "" "-pix_fmt yuv420p"
b86bd1f1
MN
375fi
376
d2f8f410 377if [ -n "$do_flashsv" ] ; then
3e3c638e
MN
378do_video_encoding flashsv.flv "" "-an -vcodec flashsv -sws_flags neighbor+full_chroma_int+accurate_rnd+bitexact"
379do_video_decoding "" "-pix_fmt yuv420p -sws_flags area+accurate_rnd+bitexact"
d2f8f410
MN
380fi
381
51133a7d 382if [ -n "$do_mp2" ] ; then
fb132953 383do_audio_encoding mp2.mp2 "-ar 44100"
fb132953 384do_audio_decoding
976709ee 385$tiny_psnr $pcm_dst $pcm_ref 2 1924 >> $logfile
51133a7d
FB
386fi
387
51133a7d 388if [ -n "$do_ac3" ] ; then
fb132953 389do_audio_encoding ac3.rm "" -vn
f77dddfc 390# binaries configured with --disable-sse decode ac3 differently
ede935a1
CEH
391#do_audio_decoding
392#$tiny_psnr $pcm_dst $pcm_ref 2 1024 >> $logfile
51133a7d
FB
393fi
394
311be1fb 395if [ -n "$do_g726" ] ; then
066a81a8 396do_audio_encoding g726.wav "-ar 44100" "-ab 32k -ac 1 -ar 8000 -acodec g726"
fb132953 397do_audio_decoding
311be1fb
MN
398fi
399
f02ab814 400if [ -n "$do_adpcm_ima_wav" ] ; then
fb132953 401do_audio_encoding adpcm_ima.wav "-ar 44100" "-acodec adpcm_ima_wav"
fb132953 402do_audio_decoding
f02ab814
MN
403fi
404
9dc92a38
KS
405if [ -n "$do_adpcm_ima_qt" ] ; then
406do_audio_encoding adpcm_qt.aiff "-ar 44100" "-acodec adpcm_ima_qt"
407do_audio_decoding
408fi
409
f02ab814 410if [ -n "$do_adpcm_ms" ] ; then
fb132953 411do_audio_encoding adpcm_ms.wav "-ar 44100" "-acodec adpcm_ms"
fb132953 412do_audio_decoding
f02ab814
MN
413fi
414
d8cbeba1 415if [ -n "$do_adpcm_yam" ] ; then
fb132953 416do_audio_encoding adpcm_yam.wav "-ar 44100" "-acodec adpcm_yamaha"
fb132953 417do_audio_decoding
d8cbeba1
MN
418fi
419
b529ab37 420if [ -n "$do_adpcm_swf" ] ; then
b529ab37
BL
421do_audio_encoding adpcm_swf.flv "-ar 44100" "-acodec adpcm_swf"
422do_audio_decoding
423fi
424
aeb2904e 425if [ -n "$do_flac" ] ; then
fb132953 426do_audio_encoding flac.flac "-ar 44100" "-acodec flac -compression_level 2"
fb132953 427do_audio_decoding
aeb2904e
MN
428fi
429
6d3d8dae
MN
430if [ -n "$do_wma" ] ; then
431# wmav1
432do_audio_encoding wmav1.asf "-ar 44100" "-acodec wmav1"
9a5771e9 433do_ffmpeg_nomd5 $pcm_dst -i $target_path/$file -f wav
6d3d8dae
MN
434$tiny_psnr $pcm_dst $pcm_ref 2 8192 >> $logfile
435# wmav2
436do_audio_encoding wmav2.asf "-ar 44100" "-acodec wmav2"
9a5771e9 437do_ffmpeg_nomd5 $pcm_dst -i $target_path/$file -f wav
6d3d8dae
MN
438$tiny_psnr $pcm_dst $pcm_ref 2 8192 >> $logfile
439fi
440
0786943a 441#if [ -n "$do_vorbis" ] ; then
3160138f 442# vorbis
90b5b51e 443#disabled because it is broken
0786943a
MN
444#do_audio_encoding vorbis.asf "-ar 44100" "-acodec vorbis"
445#do_audio_decoding
446#fi
6d3d8dae 447
4f5c72e8
PR
448do_audio_enc_dec() {
449 do_audio_encoding $3.$1 "" "$4 -sample_fmt $2 -acodec $3"
450 do_audio_decoding
451}
452
453if [ -n "$do_pcm" ] ; then
454do_audio_enc_dec wav s16 pcm_alaw
455do_audio_enc_dec wav s16 pcm_mulaw
5e8ecfde
PR
456do_audio_enc_dec mov u8 pcm_s8
457do_audio_enc_dec wav u8 pcm_u8
4f5c72e8
PR
458do_audio_enc_dec mov s16 pcm_s16be
459do_audio_enc_dec wav s16 pcm_s16le
38511b9a
AJ
460do_audio_enc_dec mkv s16 pcm_s16be
461do_audio_enc_dec mkv s16 pcm_s16le
5e8ecfde
PR
462do_audio_enc_dec mov s32 pcm_s24be
463do_audio_enc_dec wav s32 pcm_s24le
464#do_audio_enc_dec ??? s32 pcm_u24be #no compatible muxer or demuxer
465#do_audio_enc_dec ??? s32 pcm_u24le #no compatible muxer or demuxer
466do_audio_enc_dec mov s32 pcm_s32be
467do_audio_enc_dec wav s32 pcm_s32le
468#do_audio_enc_dec ??? s32 pcm_u32be #no compatible muxer or demuxer
469#do_audio_enc_dec ??? s32 pcm_u32le #no compatible muxer or demuxer
4f5c72e8 470do_audio_enc_dec au flt pcm_f32be
6f18fe8c
PR
471do_audio_enc_dec wav flt pcm_f32le
472do_audio_enc_dec au dbl pcm_f64be
473do_audio_enc_dec wav dbl pcm_f64le
4f5c72e8
PR
474do_audio_enc_dec wav s16 pcm_zork
475do_audio_enc_dec 302 s16 pcm_s24daud "-ac 6 -ar 96000"
476fi
477
2a048239 478# libavformat testing
89d5dfd5 479
2009721d 480if [ -n "$do_avi" ] ; then
0bb5f0fa 481do_lavf avi
2009721d 482fi
89d5dfd5 483
2009721d 484if [ -n "$do_asf" ] ; then
0bb5f0fa 485do_lavf asf "-acodec mp2" "-r 25"
2009721d 486fi
89d5dfd5 487
2009721d 488if [ -n "$do_rm" ] ; then
1b4a516b 489file=${outfile}lavf.rm
9a5771e9 490do_ffmpeg $file -t 1 -qscale 10 -f image2 -vcodec pgmyuv -i $raw_src -f s16le -i $pcm_src
89d5dfd5 491# broken
9a5771e9 492#do_ffmpeg_crc $file -i $target_path/$file
2009721d 493fi
89d5dfd5 494
2009721d 495if [ -n "$do_mpg" ] ; then
0bb5f0fa 496do_lavf mpg
2009721d 497fi
89d5dfd5 498
b686d0ab 499if [ -n "$do_mxf" ] ; then
0bb5f0fa
DB
500do_lavf mxf "-ar 48000 -bf 2 -timecode_frame_start 264363"
501do_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
502fi
503
2009721d 504if [ -n "$do_ts" ] ; then
0bb5f0fa 505do_lavf ts
2009721d 506fi
d05c15cb 507
2009721d 508if [ -n "$do_swf" ] ; then
0bb5f0fa 509do_lavf swf -an
2009721d 510fi
89d5dfd5 511
2009721d 512if [ -n "$do_ffm" ] ; then
0bb5f0fa 513do_lavf ffm
2009721d 514fi
89d5dfd5 515
2009721d 516if [ -n "$do_flv_fmt" ] ; then
0bb5f0fa 517do_lavf flv -an
2009721d 518fi
bbdd42d3 519
2009721d 520if [ -n "$do_mov" ] ; then
0bb5f0fa 521do_lavf mov "-acodec pcm_alaw"
2009721d 522fi
c280f2d7 523
2009721d 524if [ -n "$do_dv_fmt" ] ; then
0bb5f0fa 525do_lavf dv "-ar 48000 -r 25 -s pal -ac 2"
2009721d 526fi
a811de6e 527
2009721d 528if [ -n "$do_gxf" ] ; then
0bb5f0fa 529do_lavf gxf "-ar 48000 -r 25 -s pal -ac 1"
2009721d 530fi
a850fd18 531
2009721d 532if [ -n "$do_nut" ] ; then
0bb5f0fa 533do_lavf nut "-acodec mp2"
2009721d 534fi
f38e2b13 535
2009721d 536if [ -n "$do_mkv" ] ; then
0bb5f0fa 537do_lavf mkv
2009721d 538fi
46491f13 539
f38e2b13 540
89d5dfd5
FB
541# streamed images
542# mjpeg
1b4a516b 543#file=${outfile}lavf.mjpeg
9a5771e9
MR
544#do_ffmpeg $file -t 1 -qscale 10 -f image2 -vcodec pgmyuv -i $raw_src
545#do_ffmpeg_crc $file -i $target_path/$file
89d5dfd5 546
2009721d 547if [ -n "$do_pbmpipe" ] ; then
d449d1bc 548do_streamed_images pbm
2009721d 549fi
7481e919 550
2009721d 551if [ -n "$do_pgmpipe" ] ; then
d449d1bc 552do_streamed_images pgm
2009721d 553fi
89d5dfd5 554
2009721d 555if [ -n "$do_ppmpipe" ] ; then
d449d1bc 556do_streamed_images ppm
2009721d 557fi
89d5dfd5 558
2009721d 559if [ -n "$do_gif" ] ; then
1b4a516b 560file=${outfile}lavf.gif
9a5771e9
MR
561do_ffmpeg $file -t 1 -qscale 10 -f image2 -vcodec pgmyuv -i $raw_src -pix_fmt rgb24
562#do_ffmpeg_crc $file -i $target_path/$file
2009721d 563fi
7481e919 564
2009721d 565if [ -n "$do_yuv4mpeg" ] ; then
1b4a516b 566file=${outfile}lavf.y4m
9a5771e9
MR
567do_ffmpeg $file -t 1 -qscale 10 -f image2 -vcodec pgmyuv -i $raw_src
568#do_ffmpeg_crc $file -i $target_path/$file
2009721d 569fi
89d5dfd5 570
89d5dfd5 571# image formats
2009721d
MR
572
573if [ -n "$do_pgm" ] ; then
f8aa7645 574do_image_formats pgm
2009721d 575fi
89d5dfd5 576
2009721d 577if [ -n "$do_ppm" ] ; then
f8aa7645 578do_image_formats ppm
2009721d 579fi
89d5dfd5 580
2009721d 581if [ -n "$do_bmp" ] ; then
1e358f03 582do_image_formats bmp
2009721d 583fi
1e358f03 584
2009721d 585if [ -n "$do_tga" ] ; then
1e358f03 586do_image_formats tga
2009721d 587fi
1e358f03 588
2009721d 589if [ -n "$do_tiff" ] ; then
f4d47d6b 590do_image_formats tiff "-pix_fmt rgb24"
2009721d 591fi
90b4e393 592
2009721d 593if [ -n "$do_sgi" ] ; then
90b4e393 594do_image_formats sgi
2009721d 595fi
90b4e393 596
2009721d 597if [ -n "$do_jpg" ] ; then
f8aa7645 598do_image_formats jpg "-flags +bitexact -dct fastint -idct simple -pix_fmt yuvj420p" "-f image2"
2009721d 599fi
d0c30ca5 600
effcedf7
DV
601if [ -n "$do_pcx" ] ; then
602do_image_formats pcx
603fi
604
89d5dfd5
FB
605# audio only
606
2009721d 607if [ -n "$do_wav" ] ; then
e587a0a5 608do_audio_only wav
2009721d 609fi
89d5dfd5 610
2009721d 611if [ -n "$do_alaw" ] ; then
e587a0a5 612do_audio_only al
2009721d 613fi
89d5dfd5 614
2009721d 615if [ -n "$do_mulaw" ] ; then
e587a0a5 616do_audio_only ul
2009721d 617fi
89d5dfd5 618
2009721d 619if [ -n "$do_au" ] ; then
e587a0a5 620do_audio_only au
2009721d 621fi
89d5dfd5 622
2009721d 623if [ -n "$do_mmf" ] ; then
e587a0a5 624do_audio_only mmf
2009721d 625fi
d8cbeba1 626
2009721d 627if [ -n "$do_aiff" ] ; then
e587a0a5 628do_audio_only aif
2009721d 629fi
f11288da 630
2009721d 631if [ -n "$do_voc" ] ; then
e587a0a5 632do_audio_only voc
2009721d 633fi
ea395e8c 634
2009721d 635if [ -n "$do_ogg" ] ; then
5118cae6 636do_audio_only ogg
2009721d 637fi
5118cae6 638
affd55a1 639# pix_fmt conversions
2009721d
MR
640
641if [ -n "$do_pixfmt" ] ; then
dc8918ad
BC
642conversions="yuv420p yuv422p yuv444p yuyv422 yuv410p yuv411p yuvj420p \
643 yuvj422p yuvj444p rgb24 bgr24 rgb32 rgb565 rgb555 gray monow \
3e3c638e 644 monob yuv440p yuvj440p"
affd55a1 645for pix_fmt in $conversions ; do
1b4a516b 646 file=${outfile}lavf-${pix_fmt}.yuv
bddbd7d3 647 do_ffmpeg_nocheck $file -r 1 -t 1 -f image2 -vcodec pgmyuv -i $raw_src \
9a5771e9
MR
648 -f rawvideo -s 352x288 -pix_fmt $pix_fmt $target_path/$raw_dst
649 do_ffmpeg $file -f rawvideo -s 352x288 -pix_fmt $pix_fmt -i $target_path/$raw_dst \
650 -f rawvideo -s 352x288 -pix_fmt yuv444p
affd55a1 651done
2009721d 652fi
51133a7d 653
4383ed5c 654rm -f "$bench" "$bench2"