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