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