Simplify regression test execution.
[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
51133a7d
FB
168echo "ffmpeg regression test" > $logfile
169echo "ffmpeg benchmarks" > $benchfile
170
171###################################
67cbe681
MN
172# generate reference for quality check
173do_ffmpeg_nocheck $raw_ref -y -f pgmyuv -i $raw_src -an -f rawvideo $raw_ref
16dd93ab 174do_ffmpeg_nocheck $pcm_ref -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src -f wav $pcm_ref
67cbe681
MN
175
176###################################
51133a7d
FB
177if [ -n "$do_mpeg" ] ; then
178# mpeg1 encoding
179file=${outfile}mpeg1.mpg
1de61a18 180do_video_encoding "-qscale 10" "-f mpeg1video"
51133a7d
FB
181
182# mpeg1 decoding
1de61a18 183do_video_decoding
922bc38d
MN
184fi
185
186###################################
187if [ -n "$do_mpeg2" ] ; then
188# mpeg2 encoding
83dddc4a 189file=${outfile}mpeg2.mpg
1de61a18 190do_video_encoding "-qscale 10" "-vcodec mpeg2video -f mpeg1video"
83dddc4a
FB
191
192# mpeg2 decoding
1de61a18 193do_video_decoding
83dddc4a 194
307eb248
BC
195# mpeg2 encoding using intra vlc
196file=${outfile}mpeg2ivlc.mpg
1de61a18 197do_video_encoding "-qscale 10" "-vcodec mpeg2video -f mpeg1video -flags2 +ivlc"
307eb248
BC
198
199# mpeg2 decoding
1de61a18 200do_video_decoding
307eb248 201
6486ad57
MN
202# mpeg2 encoding
203file=${outfile}mpeg2.mpg
1de61a18 204do_video_encoding "-qscale 10" "-vcodec mpeg2video -idct int -dct int -f mpeg1video"
6486ad57
MN
205
206# mpeg2 decoding
fac862c6 207do_ffmpeg $raw_dst -y -idct int -i $file -f rawvideo $raw_dst
6486ad57 208
83dddc4a
FB
209# mpeg2 encoding interlaced
210file=${outfile}mpeg2i.mpg
1de61a18 211do_video_encoding "-qscale 10" "-vcodec mpeg2video -f mpeg1video -flags +ildct+ilme"
51133a7d
FB
212
213# mpeg2 decoding
1de61a18 214do_video_decoding
51133a7d
FB
215fi
216
217###################################
9c3d33d6
MN
218if [ -n "$do_mpeg2thread" ] ; then
219# mpeg2 encoding interlaced
220file=${outfile}mpeg2thread.mpg
1de61a18 221do_video_encoding "-qscale 10" "-vcodec mpeg2video -f mpeg1video -bf 2 -flags +ildct+ilme -threads 2"
307eb248
BC
222
223# mpeg2 decoding
1de61a18 224do_video_decoding
307eb248
BC
225
226# mpeg2 encoding interlaced using intra vlc
227file=${outfile}mpeg2threadivlc.mpg
1de61a18 228do_video_encoding "-qscale 10" "-vcodec mpeg2video -f mpeg1video -bf 2 -flags +ildct+ilme -flags2 +ivlc -threads 2"
9c3d33d6
MN
229
230# mpeg2 decoding
1de61a18 231do_video_decoding
7f8038ce
MN
232
233# mpeg2 encoding interlaced
234file=${outfile}mpeg2reuse.mpg
115329f1 235do_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
236
237# mpeg2 decoding
1de61a18 238do_video_decoding
9c3d33d6
MN
239fi
240
241###################################
6ebd933b
MN
242if [ -n "$do_msmpeg4v2" ] ; then
243# msmpeg4 encoding
244file=${outfile}msmpeg4v2.avi
1de61a18 245do_video_encoding "-qscale 10" "-an -vcodec msmpeg4v2"
6ebd933b
MN
246
247# msmpeg4v2 decoding
1de61a18 248do_video_decoding
6ebd933b
MN
249fi
250
251###################################
51133a7d
FB
252if [ -n "$do_msmpeg4" ] ; then
253# msmpeg4 encoding
254file=${outfile}msmpeg4.avi
1de61a18 255do_video_encoding "-qscale 10" "-an -vcodec msmpeg4"
51133a7d
FB
256
257# msmpeg4 decoding
1de61a18 258do_video_decoding
51133a7d
FB
259fi
260
261###################################
6ebd933b
MN
262if [ -n "$do_wmv1" ] ; then
263# wmv1 encoding
264file=${outfile}wmv1.avi
1de61a18 265do_video_encoding "-qscale 10" "-an -vcodec wmv1"
6ebd933b
MN
266
267# wmv1 decoding
1de61a18 268do_video_decoding
6ebd933b
MN
269fi
270
271###################################
e23d5712
MN
272if [ -n "$do_wmv2" ] ; then
273# wmv2 encoding
274file=${outfile}wmv2.avi
1de61a18 275do_video_encoding "-qscale 10" "-an -vcodec wmv2"
e23d5712
MN
276
277# wmv2 decoding
1de61a18 278do_video_decoding
e23d5712
MN
279fi
280
281###################################
61b262a9
MN
282if [ -n "$do_h261" ] ; then
283# h261 encoding
284file=${outfile}h261.avi
1de61a18 285do_video_encoding "-qscale 11" "-s 352x288 -an -vcodec h261"
61b262a9
MN
286
287# h261 decoding
1de61a18 288do_video_decoding
61b262a9
MN
289fi
290
291###################################
51133a7d
FB
292if [ -n "$do_h263" ] ; then
293# h263 encoding
294file=${outfile}h263.avi
1de61a18 295do_video_encoding "-qscale 10" "-s 352x288 -an -vcodec h263"
51133a7d 296
6e2d5f1a 297# h263 decoding
1de61a18 298do_video_decoding
6e2d5f1a
MN
299fi
300
301###################################
302if [ -n "$do_h263p" ] ; then
303# h263p encoding
304file=${outfile}h263p.avi
1de61a18 305do_video_encoding "-qscale 2 -flags +umv+aiv+aic" "-s 352x288 -an -vcodec h263p -ps 300"
6e2d5f1a 306
51133a7d 307# h263p decoding
1de61a18 308do_video_decoding
51133a7d
FB
309fi
310
311###################################
312if [ -n "$do_mpeg4" ] ; then
313# mpeg4
28c70622 314file=${outfile}odivx.mp4
1de61a18 315do_video_encoding "-flags +mv4 -mbd bits -qscale 10" "-an -vcodec mpeg4"
51133a7d
FB
316
317# mpeg4 decoding
1de61a18 318do_video_decoding
51133a7d
FB
319fi
320
321###################################
e629ab68
RD
322if [ -n "$do_huffyuv" ] ; then
323# huffyuv
324file=${outfile}huffyuv.avi
1de61a18 325do_video_encoding "" "-an -vcodec huffyuv -pix_fmt yuv422p"
e629ab68
RD
326
327# huffyuv decoding
1de61a18 328do_video_decoding -strict -2 -pix_fmt yuv420p
e629ab68
RD
329fi
330
331###################################
1dbb6d90
MN
332if [ -n "$do_rc" ] ; then
333# mpeg4 rate control
334file=${outfile}mpeg4-rc.avi
1de61a18 335do_video_encoding "-b 400k -bf 2" "-an -vcodec mpeg4"
1dbb6d90
MN
336
337# mpeg4 rate control decoding
1de61a18 338do_video_decoding
1dbb6d90
MN
339fi
340
341###################################
342if [ -n "$do_mpeg4adv" ] ; then
343# mpeg4
344file=${outfile}mpeg4-adv.avi
1de61a18 345do_video_encoding "-qscale 9 -flags +mv4+part+aic+trell -mbd bits -ps 200" "-an -vcodec mpeg4"
1dbb6d90
MN
346
347# mpeg4 decoding
1de61a18 348do_video_decoding
1dbb6d90
MN
349fi
350
351###################################
9c3d33d6
MN
352if [ -n "$do_mpeg4thread" ] ; then
353# mpeg4
354file=${outfile}mpeg4-thread.avi
1de61a18 355do_video_encoding "-b 500k -flags +mv4+part+aic+trell -mbd bits -ps 200 -bf 2" "-an -vcodec mpeg4 -threads 2"
9c3d33d6
MN
356
357# mpeg4 decoding
1de61a18 358do_video_decoding
aab9cdcf
MN
359fi
360
361###################################
362if [ -n "$do_mpeg4adv" ] ; then
363# mpeg4
364file=${outfile}mpeg4-Q.avi
1de61a18 365do_video_encoding "-qscale 7 -flags +mv4+qpel -mbd 2 -bf 2 -cmp 1 -subcmp 2" "-an -vcodec mpeg4"
aab9cdcf
MN
366
367# mpeg4 decoding
1de61a18 368do_video_decoding
9c3d33d6
MN
369fi
370
371###################################
dcfdb046
BL
372if [ -n "$do_mp4psp" ] ; then
373# mp4 PSP style
374file=${outfile}mpeg4-PSP.mp4
3c0ba870 375do_ffmpeg $file -y -b 768k -s 320x240 -f psp -ar 24000 -ab 32 -i $raw_src $file
dcfdb046
BL
376fi
377
378###################################
7ebfc0ea
MN
379if [ -n "$do_error" ] ; then
380# damaged mpeg4
381file=${outfile}error-mpeg4-adv.avi
1de61a18 382do_video_encoding "-qscale 7 -flags +mv4+part+aic -mbd rd -ps 250 -error 10" "-an -vcodec mpeg4"
7ebfc0ea
MN
383
384# damaged mpeg4 decoding
1de61a18 385do_video_decoding
7ebfc0ea
MN
386fi
387
388###################################
be408b67
MN
389if [ -n "$do_mpeg4nr" ] ; then
390# noise reduction
9c3d33d6 391file=${outfile}mpeg4-nr.avi
1de61a18 392do_video_encoding "-qscale 8 -flags +mv4 -mbd rd -nr 200" "-an -vcodec mpeg4"
be408b67
MN
393
394# mpeg4 decoding
1de61a18 395do_video_decoding
be408b67
MN
396fi
397
398###################################
cfadadec
MN
399if [ -n "$do_mpeg1b" ] ; then
400# mpeg1
401file=${outfile}mpeg1b.mpg
1de61a18 402do_video_encoding "-qscale 8 -bf 3 -ps 200" "-an -vcodec mpeg1video -f mpeg1video"
cfadadec
MN
403
404# mpeg1 decoding
1de61a18 405do_video_decoding
cfadadec
MN
406fi
407
408###################################
51133a7d
FB
409if [ -n "$do_mjpeg" ] ; then
410# mjpeg
411file=${outfile}mjpeg.avi
1de61a18 412do_video_encoding "-qscale 10" "-an -vcodec mjpeg -pix_fmt yuvj420p"
51133a7d
FB
413
414# mjpeg decoding
1de61a18 415do_video_decoding -pix_fmt yuv420p
51133a7d
FB
416fi
417
418###################################
3b37408b
MN
419if [ -n "$do_ljpeg" ] ; then
420# ljpeg
421file=${outfile}ljpeg.avi
1de61a18 422do_video_encoding "" "-an -vcodec ljpeg -strict -1"
3b37408b
MN
423
424# ljpeg decoding
1de61a18 425do_video_decoding
3b37408b
MN
426fi
427
428###################################
b4e021e8
MN
429if [ -n "$do_jpegls" ] ; then
430# jpeg ls
431file=${outfile}jpegls.avi
1de61a18 432do_video_encoding "" "-an -vcodec jpegls -vtag MJPG"
b4e021e8
MN
433
434# jpeg ls decoding
1de61a18 435do_video_decoding -pix_fmt yuv420p
b4e021e8
MN
436fi
437
438###################################
51133a7d
FB
439if [ -n "$do_rv10" ] ; then
440# rv10 encoding
441file=${outfile}rv10.rm
1de61a18 442do_video_encoding "-qscale 10" "-an"
51133a7d
FB
443
444# rv10 decoding
1de61a18 445do_video_decoding
51133a7d
FB
446fi
447
448###################################
c50cd09d
MN
449if [ -n "$do_rv20" ] ; then
450# rv20 encoding
451file=${outfile}rv20.rm
1de61a18 452do_video_encoding "-qscale 10" "-vcodec rv20 -an"
c50cd09d
MN
453
454# rv20 decoding
1de61a18 455do_video_decoding
c50cd09d
MN
456fi
457
458###################################
9ca9fce1
MN
459if [ -n "$do_asv1" ] ; then
460# asv1 encoding
461file=${outfile}asv1.avi
1de61a18 462do_video_encoding "-qscale 10" "-an -vcodec asv1"
9ca9fce1
MN
463
464# asv1 decoding
1de61a18 465do_video_decoding
9ca9fce1
MN
466fi
467
468###################################
8d876a43
MN
469if [ -n "$do_asv2" ] ; then
470# asv2 encoding
471file=${outfile}asv2.avi
1de61a18 472do_video_encoding "-qscale 10" "-an -vcodec asv2"
8d876a43
MN
473
474# asv2 decoding
1de61a18 475do_video_decoding
8d876a43
MN
476fi
477
478###################################
bbdd42d3
MN
479if [ -n "$do_flv" ] ; then
480# flv encoding
481file=${outfile}flv.flv
1de61a18 482do_video_encoding "-qscale 10" "-an -vcodec flv"
bbdd42d3
MN
483
484# flv decoding
1de61a18 485do_video_decoding
bbdd42d3
MN
486fi
487
488###################################
f3203047
MN
489if [ -n "$do_ffv1" ] ; then
490# ffv1 encoding
491file=${outfile}ffv1.avi
1de61a18 492do_video_encoding "-strict -2" "-an -vcodec ffv1"
f3203047
MN
493
494# ffv1 decoding
1de61a18 495do_video_decoding
d13eef3d
MN
496fi
497
498###################################
499if [ -n "$do_snow" ] ; then
500# snow encoding
501file=${outfile}snow.avi
1de61a18 502do_video_encoding "-strict -2" "-an -vcodec snow -qscale 2 -flags +qpel -me iter -dia_size 2 -cmp 12 -subcmp 12 -s 128x64"
d13eef3d
MN
503
504# snow decoding
1de61a18 505do_video_decoding -s 352x288
e03c822a 506fi
d13eef3d 507
e03c822a
MN
508###################################
509if [ -n "$do_snowll" ] ; then
d13eef3d
MN
510# snow encoding
511file=${outfile}snow53.avi
1de61a18 512do_video_encoding "-strict -2" "-an -vcodec snow -qscale .001 -pred 1 -flags +mv4+qpel"
d13eef3d
MN
513
514# snow decoding
1de61a18 515do_video_decoding
f3203047
MN
516fi
517
518###################################
8fce2707
MN
519if [ -n "$do_dv" ] ; then
520# dv encoding
521file=${outfile}dv.dv
1de61a18 522do_video_encoding "-dct int" "-s pal -an"
8fce2707
MN
523
524# dv decoding
1de61a18 525do_video_decoding -s cif
8fce2707
MN
526fi
527
528###################################
0b297700
DM
529if [ -n "$do_dv50" ] ; then
530# dv50 encoding
531file=${outfile}dv.dv
1de61a18 532do_video_encoding "-dct int" "-s pal -pix_fmt yuv422p -an"
0b297700
DM
533
534# dv50 decoding
1de61a18 535do_video_decoding -s cif -pix_fmt yuv420p
0b297700
DM
536fi
537
538
539###################################
b86bd1f1
MN
540if [ -n "$do_svq1" ] ; then
541# svq1 encoding
542file=${outfile}svq1.mov
1de61a18 543do_video_encoding "" "-an -vcodec svq1 -qscale 3 -pix_fmt yuv410p"
b86bd1f1
MN
544
545# svq1 decoding
1de61a18 546do_video_decoding -pix_fmt yuv420p
b86bd1f1
MN
547fi
548
549###################################
51133a7d
FB
550if [ -n "$do_mp2" ] ; then
551# mp2 encoding
552file=${outfile}mp2.mp2
115329f1 553do_ffmpeg $file -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src $file
51133a7d
FB
554
555# mp2 decoding
115329f1 556do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
976709ee 557$tiny_psnr $pcm_dst $pcm_ref 2 1924 >> $logfile
51133a7d
FB
558fi
559
560###################################
561if [ -n "$do_ac3" ] ; then
562# ac3 encoding
563file=${outfile}ac3.rm
115329f1 564do_ffmpeg $file -y -ab 128 -ac 2 -f s16le -i $pcm_src -vn $file
51133a7d
FB
565
566# ac3 decoding
115329f1 567#do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
51133a7d
FB
568fi
569
89d5dfd5 570###################################
311be1fb
MN
571if [ -n "$do_g726" ] ; then
572# g726 encoding
573file=${outfile}g726.wav
115329f1 574do_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
575
576# g726 decoding
115329f1 577do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
311be1fb
MN
578fi
579
580###################################
f02ab814
MN
581if [ -n "$do_adpcm_ima_wav" ] ; then
582# encoding
583file=${outfile}adpcm_ima.wav
115329f1 584do_ffmpeg $file -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src -acodec adpcm_ima_wav $file
f02ab814
MN
585
586# decoding
115329f1 587do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
f02ab814
MN
588fi
589
590###################################
591if [ -n "$do_adpcm_ms" ] ; then
592# encoding
593file=${outfile}adpcm_ms.wav
115329f1 594do_ffmpeg $file -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src -acodec adpcm_ms $file
f02ab814
MN
595
596# decoding
115329f1 597do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
f02ab814
MN
598fi
599
600###################################
d8cbeba1
MN
601if [ -n "$do_adpcm_yam" ] ; then
602# encoding
603file=${outfile}adpcm_yam.wav
115329f1 604do_ffmpeg $file -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src -acodec adpcm_yamaha $file
d8cbeba1
MN
605
606# decoding
115329f1 607do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
d8cbeba1
MN
608fi
609
610###################################
aeb2904e
MN
611if [ -n "$do_flac" ] ; then
612# encoding
613file=${outfile}flac.flac
a403fc03 614do_ffmpeg $file -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src -acodec flac -compression_level 2 $file
aeb2904e
MN
615
616# decoding
617do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
618fi
619
620###################################
89d5dfd5
FB
621# libav testing
622###################################
623
624if [ -n "$do_libav" ] ; then
625
626# avi
627file=${outfile}libav.avi
628do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
629do_ffmpeg_crc $file -i $file
630
631# asf
632file=${outfile}libav.asf
ba30abcb 633do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src -acodec mp2 $file
e928649b 634do_ffmpeg_crc $file -i $file -r 25
89d5dfd5
FB
635
636# rm
637file=${outfile}libav.rm
638do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
639# broken
640#do_ffmpeg_crc $file -i $file
641
642# mpegps
643file=${outfile}libav.mpg
644do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
645do_ffmpeg_crc $file -i $file
646
d05c15cb
MN
647# mpegts
648file=${outfile}libav.ts
649do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
650do_ffmpeg_crc $file -i $file
651
89d5dfd5
FB
652# swf (decode audio only)
653file=${outfile}libav.swf
2dd59ebd 654do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src -acodec mp2 $file
d0c30ca5 655do_ffmpeg_crc $file -i $file
89d5dfd5
FB
656
657# ffm
74d69c07
MN
658file=${outfile}libav.ffm
659do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
660do_ffmpeg_crc $file -i $file
89d5dfd5 661
bbdd42d3
MN
662# flv
663file=${outfile}libav.flv
ba30abcb 664do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src -an $file
bbdd42d3
MN
665do_ffmpeg_crc $file -i $file
666
c280f2d7 667# mov
2dd59ebd
MN
668file=${outfile}libav.mov
669do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src -acodec pcm_alaw $file
670do_ffmpeg_crc $file -i $file
c280f2d7
MN
671
672# nut
b0e6636b
DB
673file=${outfile}libav.nut
674do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src -acodec mp2 $file
675do_ffmpeg_crc $file -i $file
c280f2d7 676
a811de6e 677# dv
3ea1ce21
RS
678file=${outfile}libav.dv
679do_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
680do_ffmpeg_crc $file -i $file
a811de6e 681
a850fd18
BC
682# gxf
683file=${outfile}libav.gxf
684do_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
685do_ffmpeg_crc $file -i $file
686
89d5dfd5
FB
687####################
688# streamed images
689# mjpeg
affd55a1
RS
690#file=${outfile}libav.mjpeg
691#do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src $file
692#do_ffmpeg_crc $file -i $file
89d5dfd5 693
7481e919
FB
694# pbmpipe
695file=${outfile}libav.pbm
87c5fbc3
MN
696do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f image2pipe $file
697do_ffmpeg_crc $file -f image2pipe -i $file
7481e919 698
89d5dfd5 699# pgmpipe
7481e919 700file=${outfile}libav.pgm
87c5fbc3
MN
701do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f image2pipe $file
702do_ffmpeg_crc $file -f image2pipe -i $file
89d5dfd5
FB
703
704# ppmpipe
7481e919 705file=${outfile}libav.ppm
87c5fbc3
MN
706do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f image2pipe $file
707do_ffmpeg_crc $file -f image2pipe -i $file
89d5dfd5
FB
708
709# gif
710file=${outfile}libav.gif
20dd25ad 711do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -pix_fmt rgb24 $file
7481e919
FB
712#do_ffmpeg_crc $file -i $file
713
714# yuv4mpeg
8cf71ead 715file=${outfile}libav.y4m
7481e919
FB
716do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src $file
717#do_ffmpeg_crc $file -i $file
89d5dfd5
FB
718
719####################
720# image formats
721# pgm (we do not do md5 on image files yet)
528bbdde 722file=${outfile}libav%02d.pgm
89d5dfd5
FB
723$ffmpeg -t 0.5 -y -qscale 10 -f pgmyuv -i $raw_src $file
724do_ffmpeg_crc $file -i $file
725
726# ppm (we do not do md5 on image files yet)
528bbdde 727file=${outfile}libav%02d.ppm
89d5dfd5
FB
728$ffmpeg -t 0.5 -y -qscale 10 -f pgmyuv -i $raw_src $file
729do_ffmpeg_crc $file -i $file
730
d0c30ca5 731# jpeg (we do not do md5 on image files yet)
528bbdde 732file=${outfile}libav%02d.jpg
fac862c6 733$ffmpeg -t 0.5 -y -qscale 10 -f pgmyuv -i $raw_src -flags +bitexact -dct fastint -idct simple -pix_fmt yuvj420p -f image2 $file
72f89c4c 734do_ffmpeg_crc $file -f image2 -i $file
d0c30ca5 735
89d5dfd5
FB
736####################
737# audio only
738
739# wav
740file=${outfile}libav.wav
741do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
742do_ffmpeg_crc $file -i $file
743
744# alaw
745file=${outfile}libav.al
746do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
747do_ffmpeg_crc $file -i $file
748
749# mulaw
750file=${outfile}libav.ul
751do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
752do_ffmpeg_crc $file -i $file
753
754# au
755file=${outfile}libav.au
756do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
757do_ffmpeg_crc $file -i $file
758
d8cbeba1
MN
759# mmf
760file=${outfile}libav.mmf
761do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
762do_ffmpeg_crc $file -i $file
763
f11288da
MN
764# aiff
765file=${outfile}libav.aif
766do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
767do_ffmpeg_crc $file -i $file
768
ea395e8c
AJ
769# voc
770file=${outfile}libav.voc
771do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
772do_ffmpeg_crc $file -i $file
773
affd55a1
RS
774####################
775# pix_fmt conversions
776conversions="yuv420p yuv422p yuv444p yuv422 yuv410p yuv411p yuvj420p \
777 yuvj422p yuvj444p rgb24 bgr24 rgba32 rgb565 rgb555 gray monow \
bb270c08 778 monob pal8"
affd55a1
RS
779for pix_fmt in $conversions ; do
780 file=${outfile}libav-${pix_fmt}.yuv
781 do_ffmpeg_nocheck $file -r 1 -t 1 -y -f pgmyuv -i $raw_src \
782 -f rawvideo -s 352x288 -pix_fmt $pix_fmt $raw_dst
783 do_ffmpeg $file -f rawvideo -s 352x288 -pix_fmt $pix_fmt -i $raw_dst \
784 -f rawvideo -s 352x288 -pix_fmt yuv444p $file
785done
786
89d5dfd5
FB
787fi
788
789
51133a7d 790
281a74da 791if $diff_cmd "$logfile" "$reffile" ; then
115329f1 792 echo
51133a7d
FB
793 echo Regression test succeeded.
794 exit 0
795else
115329f1 796 echo
51133a7d
FB
797 echo Regression test: Error.
798 exit 1
799fi