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