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