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