Use a function for image formats.
[libav.git] / tests / regression.sh
CommitLineData
51133a7d
FB
1#!/bin/sh
2#
3# automatic regression test for ffmpeg
4#
5#
6#set -x
6e023978 7# Even in the 21st century some diffs are not supporting -u.
281a74da 8diff -u "$0" "$0" > /dev/null 2>&1
6e023978
RS
9if [ $? -eq 0 ]; then
10 diff_cmd="diff -u"
11else
12 diff_cmd="diff"
13fi
14
281a74da 15diff -w "$0" "$0" > /dev/null 2>&1
d9d7653e
MN
16if [ $? -eq 0 ]; then
17 diff_cmd="$diff_cmd -w"
18fi
19
51133a7d
FB
20set -e
21
5bcfd1ad
FB
22datadir="./data"
23
24logfile="$datadir/ffmpeg.regression"
a12eea30 25outfile="$datadir/a-"
89d5dfd5 26
51133a7d
FB
27# tests to do
28if [ "$1" = "mpeg4" ] ; then
29 do_mpeg4=y
30elif [ "$1" = "mpeg" ] ; then
31 do_mpeg=y
853d659d 32 do_mpeg2=y
7481e919
FB
33elif [ "$1" = "ac3" ] ; then
34 do_ac3=y
87c5fbc3
MN
35elif [ "$1" = "huffyuv" ] ; then
36 do_huffyuv=y
7f8038ce
MN
37elif [ "$1" = "mpeg2thread" ] ; then
38 do_mpeg2thread=y
d13eef3d
MN
39elif [ "$1" = "snow" ] ; then
40 do_snow=y
e03c822a
MN
41elif [ "$1" = "snowll" ] ; then
42 do_snowll=y
89d5dfd5
FB
43elif [ "$1" = "libavtest" ] ; then
44 do_libav=y
5bcfd1ad 45 logfile="$datadir/libav.regression"
a12eea30 46 outfile="$datadir/b-"
51133a7d
FB
47else
48 do_mpeg=y
922bc38d 49 do_mpeg2=y
9c3d33d6 50 do_mpeg2thread=y
6ebd933b 51 do_msmpeg4v2=y
51133a7d 52 do_msmpeg4=y
6ebd933b 53 do_wmv1=y
e23d5712 54 do_wmv2=y
61b262a9 55 do_h261=y
51133a7d 56 do_h263=y
6e2d5f1a 57 do_h263p=y
51133a7d 58 do_mpeg4=y
dcfdb046 59 do_mp4psp=y
e23d5712 60 do_huffyuv=y
51133a7d 61 do_mjpeg=y
3b37408b 62 do_ljpeg=y
b4e021e8 63 do_jpegls=y
64a7a8af 64 do_rv10=y
c50cd09d 65 do_rv20=y
51133a7d
FB
66 do_mp2=y
67 do_ac3=y
311be1fb 68 do_g726=y
f02ab814
MN
69 do_adpcm_ima_wav=y
70 do_adpcm_ms=y
aeb2904e 71 do_flac=y
1dbb6d90
MN
72 do_rc=y
73 do_mpeg4adv=y
9c3d33d6 74 do_mpeg4thread=y
be408b67 75 do_mpeg4nr=y
cfadadec 76 do_mpeg1b=y
9ca9fce1 77 do_asv1=y
8d876a43 78 do_asv2=y
bbdd42d3 79 do_flv=y
f3203047 80 do_ffv1=y
7ebfc0ea 81 do_error=y
b86bd1f1 82 do_svq1=y
d13eef3d 83 do_snow=y
e03c822a 84 do_snowll=y
d8cbeba1 85 do_adpcm_yam=y
8fce2707 86 do_dv=y
0b297700 87 do_dv50=y
51133a7d
FB
88fi
89
90
91# various files
3aca208a 92ffmpeg="../ffmpeg_g"
67cbe681 93tiny_psnr="./tiny_psnr"
51133a7d 94reffile="$2"
5bcfd1ad 95benchfile="$datadir/ffmpeg.bench"
528bbdde 96raw_src="$3/%02d.pgm"
5bcfd1ad 97raw_dst="$datadir/out.yuv"
67cbe681 98raw_ref="$datadir/ref.yuv"
51133a7d 99pcm_src="asynth1.sw"
5bcfd1ad 100pcm_dst="$datadir/out.wav"
16dd93ab 101pcm_ref="$datadir/ref.wav"
853d659d
JD
102if [ X"`echo | md5sum 2> /dev/null`" != X ]; then
103 do_md5sum() { md5sum -b $1; }
104elif [ -x /sbin/md5 ]; then
105 do_md5sum() { /sbin/md5 -r $1 | sed 's# \**\./# *./#'; }
106else
107 do_md5sum() { echo No md5sum program found; }
108fi
5bcfd1ad
FB
109
110# create the data directory if it does not exists
111mkdir -p $datadir
51133a7d 112
bcea9605
DB
113FFMPEG_OPTS="-y -flags +bitexact -dct fastint -idct simple"
114
3f027ca7 115do_ffmpeg()
51133a7d
FB
116{
117 f="$1"
118 shift
bcea9605
DB
119 echo $ffmpeg $FFMPEG_OPTS $*
120 $ffmpeg $FFMPEG_OPTS -benchmark $* > $datadir/bench.tmp 2> /tmp/ffmpeg$$
37a00782 121 egrep -v "^(Stream|Press|Input|Output|frame| Stream| Duration|video:)" /tmp/ffmpeg$$ || true
e31c1c30 122 rm -f /tmp/ffmpeg$$
853d659d 123 do_md5sum $f >> $logfile
67cbe681
MN
124 if [ $f = $raw_dst ] ; then
125 $tiny_psnr $f $raw_ref >> $logfile
16dd93ab 126 elif [ $f = $pcm_dst ] ; then
976709ee 127 $tiny_psnr $f $pcm_ref 2 >> $logfile
039e7889
MN
128 else
129 wc -c $f >> $logfile
67cbe681 130 fi
90cee0c3 131 expr "`cat $datadir/bench.tmp`" : '.*utime=\(.*s\)' > $datadir/bench2.tmp
5bcfd1ad 132 echo `cat $datadir/bench2.tmp` $f >> $benchfile
51133a7d
FB
133}
134
3f027ca7 135do_ffmpeg_crc()
89d5dfd5
FB
136{
137 f="$1"
138 shift
bcea9605
DB
139 echo $ffmpeg $FFMPEG_OPTS $* -f crc $datadir/ffmpeg.crc
140 $ffmpeg $FFMPEG_OPTS $* -f crc $datadir/ffmpeg.crc > /tmp/ffmpeg$$ 2>&1
37a00782 141 egrep -v "^(Stream|Press|Input|Output|frame| Stream| Duration|video:|ffmpeg version| configuration| built)" /tmp/ffmpeg$$ || true
115329f1 142 rm -f /tmp/ffmpeg$$
affd55a1 143 echo "$f `cat $datadir/ffmpeg.crc`" >> $logfile
89d5dfd5 144}
51133a7d 145
67cbe681
MN
146do_ffmpeg_nocheck()
147{
148 f="$1"
149 shift
bcea9605
DB
150 echo $ffmpeg $FFMPEG_OPTS $*
151 $ffmpeg $FFMPEG_OPTS -benchmark $* > $datadir/bench.tmp 2> /tmp/ffmpeg$$
37a00782 152 egrep -v "^(Stream|Press|Input|Output|frame| Stream| Duration|video:)" /tmp/ffmpeg$$ || true
affd55a1 153 rm -f /tmp/ffmpeg$$
67cbe681
MN
154 expr "`cat $datadir/bench.tmp`" : '.*utime=\(.*s\)' > $datadir/bench2.tmp
155 echo `cat $datadir/bench2.tmp` $f >> $benchfile
156}
157
1de61a18
DB
158do_video_decoding()
159{
160 do_ffmpeg $raw_dst -y -i $file -f rawvideo $@ $raw_dst
161}
162
163do_video_encoding()
164{
165 do_ffmpeg $file -y $1 -f pgmyuv -i $raw_src $2 $file
166}
167
d449d1bc
DB
168do_streamed_images()
169{
170 file=${outfile}libav.$1
171 do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f image2pipe $file
172 do_ffmpeg_crc $file -f image2pipe -i $file
173}
174
f8aa7645
DB
175do_image_formats()
176{
177 file=${outfile}libav%02d.$1
178 $ffmpeg -t 0.5 -y -qscale 10 -f pgmyuv -i $raw_src $2 $3 $file
179 do_ffmpeg_crc $file $3 -i $file
180
181}
182
e587a0a5
DB
183do_audio_only()
184{
185 file=${outfile}libav.$1
186 do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
187 do_ffmpeg_crc $file -i $file
188}
189
51133a7d
FB
190echo "ffmpeg regression test" > $logfile
191echo "ffmpeg benchmarks" > $benchfile
192
193###################################
67cbe681
MN
194# generate reference for quality check
195do_ffmpeg_nocheck $raw_ref -y -f pgmyuv -i $raw_src -an -f rawvideo $raw_ref
16dd93ab 196do_ffmpeg_nocheck $pcm_ref -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src -f wav $pcm_ref
67cbe681
MN
197
198###################################
51133a7d
FB
199if [ -n "$do_mpeg" ] ; then
200# mpeg1 encoding
201file=${outfile}mpeg1.mpg
1de61a18 202do_video_encoding "-qscale 10" "-f mpeg1video"
51133a7d
FB
203
204# mpeg1 decoding
1de61a18 205do_video_decoding
922bc38d
MN
206fi
207
208###################################
209if [ -n "$do_mpeg2" ] ; then
210# mpeg2 encoding
83dddc4a 211file=${outfile}mpeg2.mpg
1de61a18 212do_video_encoding "-qscale 10" "-vcodec mpeg2video -f mpeg1video"
83dddc4a
FB
213
214# mpeg2 decoding
1de61a18 215do_video_decoding
83dddc4a 216
307eb248
BC
217# mpeg2 encoding using intra vlc
218file=${outfile}mpeg2ivlc.mpg
1de61a18 219do_video_encoding "-qscale 10" "-vcodec mpeg2video -f mpeg1video -flags2 +ivlc"
307eb248
BC
220
221# mpeg2 decoding
1de61a18 222do_video_decoding
307eb248 223
6486ad57
MN
224# mpeg2 encoding
225file=${outfile}mpeg2.mpg
1de61a18 226do_video_encoding "-qscale 10" "-vcodec mpeg2video -idct int -dct int -f mpeg1video"
6486ad57
MN
227
228# mpeg2 decoding
fac862c6 229do_ffmpeg $raw_dst -y -idct int -i $file -f rawvideo $raw_dst
6486ad57 230
83dddc4a
FB
231# mpeg2 encoding interlaced
232file=${outfile}mpeg2i.mpg
1de61a18 233do_video_encoding "-qscale 10" "-vcodec mpeg2video -f mpeg1video -flags +ildct+ilme"
51133a7d
FB
234
235# mpeg2 decoding
1de61a18 236do_video_decoding
51133a7d
FB
237fi
238
239###################################
9c3d33d6
MN
240if [ -n "$do_mpeg2thread" ] ; then
241# mpeg2 encoding interlaced
242file=${outfile}mpeg2thread.mpg
1de61a18 243do_video_encoding "-qscale 10" "-vcodec mpeg2video -f mpeg1video -bf 2 -flags +ildct+ilme -threads 2"
307eb248
BC
244
245# mpeg2 decoding
1de61a18 246do_video_decoding
307eb248
BC
247
248# mpeg2 encoding interlaced using intra vlc
249file=${outfile}mpeg2threadivlc.mpg
1de61a18 250do_video_encoding "-qscale 10" "-vcodec mpeg2video -f mpeg1video -bf 2 -flags +ildct+ilme -flags2 +ivlc -threads 2"
9c3d33d6
MN
251
252# mpeg2 decoding
1de61a18 253do_video_decoding
7f8038ce
MN
254
255# mpeg2 encoding interlaced
256file=${outfile}mpeg2reuse.mpg
115329f1 257do_ffmpeg $file -y -sameq -me_threshold 256 -mb_threshold 1024 -i ${outfile}mpeg2thread.mpg -vcodec mpeg2video -f mpeg1video -bf 2 -flags +ildct+ilme -threads 4 $file
7f8038ce
MN
258
259# mpeg2 decoding
1de61a18 260do_video_decoding
9c3d33d6
MN
261fi
262
263###################################
6ebd933b
MN
264if [ -n "$do_msmpeg4v2" ] ; then
265# msmpeg4 encoding
266file=${outfile}msmpeg4v2.avi
1de61a18 267do_video_encoding "-qscale 10" "-an -vcodec msmpeg4v2"
6ebd933b
MN
268
269# msmpeg4v2 decoding
1de61a18 270do_video_decoding
6ebd933b
MN
271fi
272
273###################################
51133a7d
FB
274if [ -n "$do_msmpeg4" ] ; then
275# msmpeg4 encoding
276file=${outfile}msmpeg4.avi
1de61a18 277do_video_encoding "-qscale 10" "-an -vcodec msmpeg4"
51133a7d
FB
278
279# msmpeg4 decoding
1de61a18 280do_video_decoding
51133a7d
FB
281fi
282
283###################################
6ebd933b
MN
284if [ -n "$do_wmv1" ] ; then
285# wmv1 encoding
286file=${outfile}wmv1.avi
1de61a18 287do_video_encoding "-qscale 10" "-an -vcodec wmv1"
6ebd933b
MN
288
289# wmv1 decoding
1de61a18 290do_video_decoding
6ebd933b
MN
291fi
292
293###################################
e23d5712
MN
294if [ -n "$do_wmv2" ] ; then
295# wmv2 encoding
296file=${outfile}wmv2.avi
1de61a18 297do_video_encoding "-qscale 10" "-an -vcodec wmv2"
e23d5712
MN
298
299# wmv2 decoding
1de61a18 300do_video_decoding
e23d5712
MN
301fi
302
303###################################
61b262a9
MN
304if [ -n "$do_h261" ] ; then
305# h261 encoding
306file=${outfile}h261.avi
1de61a18 307do_video_encoding "-qscale 11" "-s 352x288 -an -vcodec h261"
61b262a9
MN
308
309# h261 decoding
1de61a18 310do_video_decoding
61b262a9
MN
311fi
312
313###################################
51133a7d
FB
314if [ -n "$do_h263" ] ; then
315# h263 encoding
316file=${outfile}h263.avi
1de61a18 317do_video_encoding "-qscale 10" "-s 352x288 -an -vcodec h263"
51133a7d 318
6e2d5f1a 319# h263 decoding
1de61a18 320do_video_decoding
6e2d5f1a
MN
321fi
322
323###################################
324if [ -n "$do_h263p" ] ; then
325# h263p encoding
326file=${outfile}h263p.avi
1de61a18 327do_video_encoding "-qscale 2 -flags +umv+aiv+aic" "-s 352x288 -an -vcodec h263p -ps 300"
6e2d5f1a 328
51133a7d 329# h263p decoding
1de61a18 330do_video_decoding
51133a7d
FB
331fi
332
333###################################
334if [ -n "$do_mpeg4" ] ; then
335# mpeg4
28c70622 336file=${outfile}odivx.mp4
1de61a18 337do_video_encoding "-flags +mv4 -mbd bits -qscale 10" "-an -vcodec mpeg4"
51133a7d
FB
338
339# mpeg4 decoding
1de61a18 340do_video_decoding
51133a7d
FB
341fi
342
343###################################
e629ab68
RD
344if [ -n "$do_huffyuv" ] ; then
345# huffyuv
346file=${outfile}huffyuv.avi
1de61a18 347do_video_encoding "" "-an -vcodec huffyuv -pix_fmt yuv422p"
e629ab68
RD
348
349# huffyuv decoding
1de61a18 350do_video_decoding -strict -2 -pix_fmt yuv420p
e629ab68
RD
351fi
352
353###################################
1dbb6d90
MN
354if [ -n "$do_rc" ] ; then
355# mpeg4 rate control
356file=${outfile}mpeg4-rc.avi
1de61a18 357do_video_encoding "-b 400k -bf 2" "-an -vcodec mpeg4"
1dbb6d90
MN
358
359# mpeg4 rate control decoding
1de61a18 360do_video_decoding
1dbb6d90
MN
361fi
362
363###################################
364if [ -n "$do_mpeg4adv" ] ; then
365# mpeg4
366file=${outfile}mpeg4-adv.avi
1de61a18 367do_video_encoding "-qscale 9 -flags +mv4+part+aic+trell -mbd bits -ps 200" "-an -vcodec mpeg4"
1dbb6d90
MN
368
369# mpeg4 decoding
1de61a18 370do_video_decoding
1dbb6d90
MN
371fi
372
373###################################
9c3d33d6
MN
374if [ -n "$do_mpeg4thread" ] ; then
375# mpeg4
376file=${outfile}mpeg4-thread.avi
1de61a18 377do_video_encoding "-b 500k -flags +mv4+part+aic+trell -mbd bits -ps 200 -bf 2" "-an -vcodec mpeg4 -threads 2"
9c3d33d6
MN
378
379# mpeg4 decoding
1de61a18 380do_video_decoding
aab9cdcf
MN
381fi
382
383###################################
384if [ -n "$do_mpeg4adv" ] ; then
385# mpeg4
386file=${outfile}mpeg4-Q.avi
1de61a18 387do_video_encoding "-qscale 7 -flags +mv4+qpel -mbd 2 -bf 2 -cmp 1 -subcmp 2" "-an -vcodec mpeg4"
aab9cdcf
MN
388
389# mpeg4 decoding
1de61a18 390do_video_decoding
9c3d33d6
MN
391fi
392
393###################################
dcfdb046
BL
394if [ -n "$do_mp4psp" ] ; then
395# mp4 PSP style
396file=${outfile}mpeg4-PSP.mp4
3c0ba870 397do_ffmpeg $file -y -b 768k -s 320x240 -f psp -ar 24000 -ab 32 -i $raw_src $file
dcfdb046
BL
398fi
399
400###################################
7ebfc0ea
MN
401if [ -n "$do_error" ] ; then
402# damaged mpeg4
403file=${outfile}error-mpeg4-adv.avi
1de61a18 404do_video_encoding "-qscale 7 -flags +mv4+part+aic -mbd rd -ps 250 -error 10" "-an -vcodec mpeg4"
7ebfc0ea
MN
405
406# damaged mpeg4 decoding
1de61a18 407do_video_decoding
7ebfc0ea
MN
408fi
409
410###################################
be408b67
MN
411if [ -n "$do_mpeg4nr" ] ; then
412# noise reduction
9c3d33d6 413file=${outfile}mpeg4-nr.avi
1de61a18 414do_video_encoding "-qscale 8 -flags +mv4 -mbd rd -nr 200" "-an -vcodec mpeg4"
be408b67
MN
415
416# mpeg4 decoding
1de61a18 417do_video_decoding
be408b67
MN
418fi
419
420###################################
cfadadec
MN
421if [ -n "$do_mpeg1b" ] ; then
422# mpeg1
423file=${outfile}mpeg1b.mpg
1de61a18 424do_video_encoding "-qscale 8 -bf 3 -ps 200" "-an -vcodec mpeg1video -f mpeg1video"
cfadadec
MN
425
426# mpeg1 decoding
1de61a18 427do_video_decoding
cfadadec
MN
428fi
429
430###################################
51133a7d
FB
431if [ -n "$do_mjpeg" ] ; then
432# mjpeg
433file=${outfile}mjpeg.avi
1de61a18 434do_video_encoding "-qscale 10" "-an -vcodec mjpeg -pix_fmt yuvj420p"
51133a7d
FB
435
436# mjpeg decoding
1de61a18 437do_video_decoding -pix_fmt yuv420p
51133a7d
FB
438fi
439
440###################################
3b37408b
MN
441if [ -n "$do_ljpeg" ] ; then
442# ljpeg
443file=${outfile}ljpeg.avi
1de61a18 444do_video_encoding "" "-an -vcodec ljpeg -strict -1"
3b37408b
MN
445
446# ljpeg decoding
1de61a18 447do_video_decoding
3b37408b
MN
448fi
449
450###################################
b4e021e8
MN
451if [ -n "$do_jpegls" ] ; then
452# jpeg ls
453file=${outfile}jpegls.avi
1de61a18 454do_video_encoding "" "-an -vcodec jpegls -vtag MJPG"
b4e021e8
MN
455
456# jpeg ls decoding
1de61a18 457do_video_decoding -pix_fmt yuv420p
b4e021e8
MN
458fi
459
460###################################
51133a7d
FB
461if [ -n "$do_rv10" ] ; then
462# rv10 encoding
463file=${outfile}rv10.rm
1de61a18 464do_video_encoding "-qscale 10" "-an"
51133a7d
FB
465
466# rv10 decoding
1de61a18 467do_video_decoding
51133a7d
FB
468fi
469
470###################################
c50cd09d
MN
471if [ -n "$do_rv20" ] ; then
472# rv20 encoding
473file=${outfile}rv20.rm
1de61a18 474do_video_encoding "-qscale 10" "-vcodec rv20 -an"
c50cd09d
MN
475
476# rv20 decoding
1de61a18 477do_video_decoding
c50cd09d
MN
478fi
479
480###################################
9ca9fce1
MN
481if [ -n "$do_asv1" ] ; then
482# asv1 encoding
483file=${outfile}asv1.avi
1de61a18 484do_video_encoding "-qscale 10" "-an -vcodec asv1"
9ca9fce1
MN
485
486# asv1 decoding
1de61a18 487do_video_decoding
9ca9fce1
MN
488fi
489
490###################################
8d876a43
MN
491if [ -n "$do_asv2" ] ; then
492# asv2 encoding
493file=${outfile}asv2.avi
1de61a18 494do_video_encoding "-qscale 10" "-an -vcodec asv2"
8d876a43
MN
495
496# asv2 decoding
1de61a18 497do_video_decoding
8d876a43
MN
498fi
499
500###################################
bbdd42d3
MN
501if [ -n "$do_flv" ] ; then
502# flv encoding
503file=${outfile}flv.flv
1de61a18 504do_video_encoding "-qscale 10" "-an -vcodec flv"
bbdd42d3
MN
505
506# flv decoding
1de61a18 507do_video_decoding
bbdd42d3
MN
508fi
509
510###################################
f3203047
MN
511if [ -n "$do_ffv1" ] ; then
512# ffv1 encoding
513file=${outfile}ffv1.avi
1de61a18 514do_video_encoding "-strict -2" "-an -vcodec ffv1"
f3203047
MN
515
516# ffv1 decoding
1de61a18 517do_video_decoding
d13eef3d
MN
518fi
519
520###################################
521if [ -n "$do_snow" ] ; then
522# snow encoding
523file=${outfile}snow.avi
1de61a18 524do_video_encoding "-strict -2" "-an -vcodec snow -qscale 2 -flags +qpel -me iter -dia_size 2 -cmp 12 -subcmp 12 -s 128x64"
d13eef3d
MN
525
526# snow decoding
1de61a18 527do_video_decoding -s 352x288
e03c822a 528fi
d13eef3d 529
e03c822a
MN
530###################################
531if [ -n "$do_snowll" ] ; then
d13eef3d
MN
532# snow encoding
533file=${outfile}snow53.avi
1de61a18 534do_video_encoding "-strict -2" "-an -vcodec snow -qscale .001 -pred 1 -flags +mv4+qpel"
d13eef3d
MN
535
536# snow decoding
1de61a18 537do_video_decoding
f3203047
MN
538fi
539
540###################################
8fce2707
MN
541if [ -n "$do_dv" ] ; then
542# dv encoding
543file=${outfile}dv.dv
1de61a18 544do_video_encoding "-dct int" "-s pal -an"
8fce2707
MN
545
546# dv decoding
1de61a18 547do_video_decoding -s cif
8fce2707
MN
548fi
549
550###################################
0b297700
DM
551if [ -n "$do_dv50" ] ; then
552# dv50 encoding
553file=${outfile}dv.dv
1de61a18 554do_video_encoding "-dct int" "-s pal -pix_fmt yuv422p -an"
0b297700
DM
555
556# dv50 decoding
1de61a18 557do_video_decoding -s cif -pix_fmt yuv420p
0b297700
DM
558fi
559
560
561###################################
b86bd1f1
MN
562if [ -n "$do_svq1" ] ; then
563# svq1 encoding
564file=${outfile}svq1.mov
1de61a18 565do_video_encoding "" "-an -vcodec svq1 -qscale 3 -pix_fmt yuv410p"
b86bd1f1
MN
566
567# svq1 decoding
1de61a18 568do_video_decoding -pix_fmt yuv420p
b86bd1f1
MN
569fi
570
571###################################
51133a7d
FB
572if [ -n "$do_mp2" ] ; then
573# mp2 encoding
574file=${outfile}mp2.mp2
115329f1 575do_ffmpeg $file -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src $file
51133a7d
FB
576
577# mp2 decoding
115329f1 578do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
976709ee 579$tiny_psnr $pcm_dst $pcm_ref 2 1924 >> $logfile
51133a7d
FB
580fi
581
582###################################
583if [ -n "$do_ac3" ] ; then
584# ac3 encoding
585file=${outfile}ac3.rm
115329f1 586do_ffmpeg $file -y -ab 128 -ac 2 -f s16le -i $pcm_src -vn $file
51133a7d
FB
587
588# ac3 decoding
115329f1 589#do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
51133a7d
FB
590fi
591
89d5dfd5 592###################################
311be1fb
MN
593if [ -n "$do_g726" ] ; then
594# g726 encoding
595file=${outfile}g726.wav
115329f1 596do_ffmpeg $file -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src -ab 32 -ac 1 -ar 8000 -acodec g726 $file
311be1fb
MN
597
598# g726 decoding
115329f1 599do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
311be1fb
MN
600fi
601
602###################################
f02ab814
MN
603if [ -n "$do_adpcm_ima_wav" ] ; then
604# encoding
605file=${outfile}adpcm_ima.wav
115329f1 606do_ffmpeg $file -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src -acodec adpcm_ima_wav $file
f02ab814
MN
607
608# decoding
115329f1 609do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
f02ab814
MN
610fi
611
612###################################
613if [ -n "$do_adpcm_ms" ] ; then
614# encoding
615file=${outfile}adpcm_ms.wav
115329f1 616do_ffmpeg $file -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src -acodec adpcm_ms $file
f02ab814
MN
617
618# decoding
115329f1 619do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
f02ab814
MN
620fi
621
622###################################
d8cbeba1
MN
623if [ -n "$do_adpcm_yam" ] ; then
624# encoding
625file=${outfile}adpcm_yam.wav
115329f1 626do_ffmpeg $file -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src -acodec adpcm_yamaha $file
d8cbeba1
MN
627
628# decoding
115329f1 629do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
d8cbeba1
MN
630fi
631
632###################################
aeb2904e
MN
633if [ -n "$do_flac" ] ; then
634# encoding
635file=${outfile}flac.flac
a403fc03 636do_ffmpeg $file -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src -acodec flac -compression_level 2 $file
aeb2904e
MN
637
638# decoding
639do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
640fi
641
642###################################
89d5dfd5
FB
643# libav testing
644###################################
645
646if [ -n "$do_libav" ] ; then
647
648# avi
649file=${outfile}libav.avi
650do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
651do_ffmpeg_crc $file -i $file
652
653# asf
654file=${outfile}libav.asf
ba30abcb 655do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src -acodec mp2 $file
e928649b 656do_ffmpeg_crc $file -i $file -r 25
89d5dfd5
FB
657
658# rm
659file=${outfile}libav.rm
660do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
661# broken
662#do_ffmpeg_crc $file -i $file
663
664# mpegps
665file=${outfile}libav.mpg
666do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
667do_ffmpeg_crc $file -i $file
668
d05c15cb
MN
669# mpegts
670file=${outfile}libav.ts
671do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
672do_ffmpeg_crc $file -i $file
673
89d5dfd5
FB
674# swf (decode audio only)
675file=${outfile}libav.swf
2dd59ebd 676do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src -acodec mp2 $file
d0c30ca5 677do_ffmpeg_crc $file -i $file
89d5dfd5
FB
678
679# ffm
74d69c07
MN
680file=${outfile}libav.ffm
681do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
682do_ffmpeg_crc $file -i $file
89d5dfd5 683
bbdd42d3
MN
684# flv
685file=${outfile}libav.flv
ba30abcb 686do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src -an $file
bbdd42d3
MN
687do_ffmpeg_crc $file -i $file
688
c280f2d7 689# mov
2dd59ebd
MN
690file=${outfile}libav.mov
691do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src -acodec pcm_alaw $file
692do_ffmpeg_crc $file -i $file
c280f2d7
MN
693
694# nut
568ad81b
MN
695#file=${outfile}libav.nut
696#do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src -acodec mp2 $file
697#do_ffmpeg_crc $file -i $file
c280f2d7 698
a811de6e 699# dv
3ea1ce21
RS
700file=${outfile}libav.dv
701do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src -ar 48000 -r 25 -s pal -ac 2 $file
702do_ffmpeg_crc $file -i $file
a811de6e 703
a850fd18
BC
704# gxf
705file=${outfile}libav.gxf
706do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src -ar 48000 -r 25 -s pal -ac 1 $file
707do_ffmpeg_crc $file -i $file
708
89d5dfd5
FB
709####################
710# streamed images
711# mjpeg
affd55a1
RS
712#file=${outfile}libav.mjpeg
713#do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src $file
714#do_ffmpeg_crc $file -i $file
89d5dfd5 715
7481e919 716# pbmpipe
d449d1bc 717do_streamed_images pbm
7481e919 718
89d5dfd5 719# pgmpipe
d449d1bc 720do_streamed_images pgm
89d5dfd5
FB
721
722# ppmpipe
d449d1bc 723do_streamed_images ppm
89d5dfd5
FB
724
725# gif
726file=${outfile}libav.gif
20dd25ad 727do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -pix_fmt rgb24 $file
7481e919
FB
728#do_ffmpeg_crc $file -i $file
729
730# yuv4mpeg
8cf71ead 731file=${outfile}libav.y4m
7481e919
FB
732do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src $file
733#do_ffmpeg_crc $file -i $file
89d5dfd5
FB
734
735####################
736# image formats
737# pgm (we do not do md5 on image files yet)
f8aa7645 738do_image_formats pgm
89d5dfd5
FB
739
740# ppm (we do not do md5 on image files yet)
f8aa7645 741do_image_formats ppm
89d5dfd5 742
d0c30ca5 743# jpeg (we do not do md5 on image files yet)
f8aa7645 744do_image_formats jpg "-flags +bitexact -dct fastint -idct simple -pix_fmt yuvj420p" "-f image2"
d0c30ca5 745
89d5dfd5
FB
746####################
747# audio only
748
749# wav
e587a0a5 750do_audio_only wav
89d5dfd5
FB
751
752# alaw
e587a0a5 753do_audio_only al
89d5dfd5
FB
754
755# mulaw
e587a0a5 756do_audio_only ul
89d5dfd5
FB
757
758# au
e587a0a5 759do_audio_only au
89d5dfd5 760
d8cbeba1 761# mmf
e587a0a5 762do_audio_only mmf
d8cbeba1 763
f11288da 764# aiff
e587a0a5 765do_audio_only aif
f11288da 766
ea395e8c 767# voc
e587a0a5 768do_audio_only voc
ea395e8c 769
affd55a1
RS
770####################
771# pix_fmt conversions
772conversions="yuv420p yuv422p yuv444p yuv422 yuv410p yuv411p yuvj420p \
773 yuvj422p yuvj444p rgb24 bgr24 rgba32 rgb565 rgb555 gray monow \
bb270c08 774 monob pal8"
affd55a1
RS
775for pix_fmt in $conversions ; do
776 file=${outfile}libav-${pix_fmt}.yuv
777 do_ffmpeg_nocheck $file -r 1 -t 1 -y -f pgmyuv -i $raw_src \
778 -f rawvideo -s 352x288 -pix_fmt $pix_fmt $raw_dst
779 do_ffmpeg $file -f rawvideo -s 352x288 -pix_fmt $pix_fmt -i $raw_dst \
780 -f rawvideo -s 352x288 -pix_fmt yuv444p $file
781done
782
89d5dfd5
FB
783fi
784
785
51133a7d 786
281a74da 787if $diff_cmd "$logfile" "$reffile" ; then
115329f1 788 echo
51133a7d
FB
789 echo Regression test succeeded.
790 exit 0
791else
115329f1 792 echo
51133a7d
FB
793 echo Regression test: Error.
794 exit 1
795fi