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