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