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