finished integrating rotozoom test in ffmpeg
[libav.git] / tests / regression.sh
CommitLineData
51133a7d
FB
1#!/bin/sh
2#
3# automatic regression test for ffmpeg
4#
5#
6#set -x
7set -e
8
5bcfd1ad
FB
9datadir="./data"
10
11logfile="$datadir/ffmpeg.regression"
89d5dfd5 12
51133a7d
FB
13# tests to do
14if [ "$1" = "mpeg4" ] ; then
15 do_mpeg4=y
16elif [ "$1" = "mpeg" ] ; then
17 do_mpeg=y
7481e919
FB
18elif [ "$1" = "ac3" ] ; then
19 do_ac3=y
89d5dfd5
FB
20elif [ "$1" = "libavtest" ] ; then
21 do_libav=y
5bcfd1ad 22 logfile="$datadir/libav.regression"
51133a7d
FB
23else
24 do_mpeg=y
6ebd933b 25 do_msmpeg4v2=y
51133a7d 26 do_msmpeg4=y
6ebd933b 27 do_wmv1=y
e23d5712 28 do_wmv2=y
51133a7d 29 do_h263=y
6e2d5f1a 30 do_h263p=y
51133a7d 31 do_mpeg4=y
e23d5712 32 do_huffyuv=y
51133a7d 33 do_mjpeg=y
64a7a8af 34 do_rv10=y
51133a7d
FB
35 do_mp2=y
36 do_ac3=y
1dbb6d90
MN
37 do_rc=y
38 do_mpeg4adv=y
cfadadec 39 do_mpeg1b=y
51133a7d
FB
40fi
41
42
43# various files
3aca208a 44ffmpeg="../ffmpeg_g"
67cbe681 45tiny_psnr="./tiny_psnr"
5bcfd1ad 46outfile="$datadir/a-"
51133a7d 47reffile="$2"
5bcfd1ad 48benchfile="$datadir/ffmpeg.bench"
6afd3b92 49raw_src="$3/%d.pgm"
5bcfd1ad 50raw_dst="$datadir/out.yuv"
67cbe681 51raw_ref="$datadir/ref.yuv"
51133a7d 52pcm_src="asynth1.sw"
5bcfd1ad
FB
53pcm_dst="$datadir/out.wav"
54
55# create the data directory if it does not exists
56mkdir -p $datadir
51133a7d 57
3f027ca7 58do_ffmpeg()
51133a7d
FB
59{
60 f="$1"
61 shift
2ad1516a
MN
62 echo $ffmpeg -bitexact -dct_algo 1 -idct_algo 2 $*
63 $ffmpeg -bitexact -dct_algo 1 -idct_algo 2 -benchmark $* > $datadir/bench.tmp
3f027ca7 64 md5sum -b $f >> $logfile
67cbe681
MN
65 if [ $f = $raw_dst ] ; then
66 $tiny_psnr $f $raw_ref >> $logfile
67 fi
90cee0c3 68 expr "`cat $datadir/bench.tmp`" : '.*utime=\(.*s\)' > $datadir/bench2.tmp
5bcfd1ad 69 echo `cat $datadir/bench2.tmp` $f >> $benchfile
51133a7d
FB
70}
71
3f027ca7 72do_ffmpeg_crc()
89d5dfd5
FB
73{
74 f="$1"
75 shift
2ad1516a
MN
76 echo $ffmpeg -y -bitexact -dct_algo 1 -idct_algo 2 $* -f crc $datadir/ffmpeg.crc
77 $ffmpeg -y -bitexact -dct_algo 1 -idct_algo 2 $* -f crc $datadir/ffmpeg.crc
89d5dfd5 78 echo -n "$f " >> $logfile
5bcfd1ad 79 cat $datadir/ffmpeg.crc >> $logfile
89d5dfd5 80}
51133a7d 81
67cbe681
MN
82do_ffmpeg_nocheck()
83{
84 f="$1"
85 shift
86 echo $ffmpeg -bitexact -dct_algo 1 -idct_algo 2 $*
87 $ffmpeg -bitexact -dct_algo 1 -idct_algo 2 -benchmark $* > $datadir/bench.tmp
88 expr "`cat $datadir/bench.tmp`" : '.*utime=\(.*s\)' > $datadir/bench2.tmp
89 echo `cat $datadir/bench2.tmp` $f >> $benchfile
90}
91
51133a7d
FB
92echo "ffmpeg regression test" > $logfile
93echo "ffmpeg benchmarks" > $benchfile
94
95###################################
67cbe681
MN
96# generate reference for quality check
97do_ffmpeg_nocheck $raw_ref -y -f pgmyuv -i $raw_src -an -f rawvideo $raw_ref
98
99###################################
51133a7d
FB
100if [ -n "$do_mpeg" ] ; then
101# mpeg1 encoding
102file=${outfile}mpeg1.mpg
89d5dfd5 103do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -f mpeg1video $file
51133a7d
FB
104
105# mpeg1 decoding
89d5dfd5 106do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
51133a7d
FB
107
108# mpeg2 decoding
109#do_ffmpeg /tmp/out-mpeg2.yuv -y -f mpegvideo -i a.vob \
110# -f rawvideo /tmp/out-mpeg2.yuv
111fi
112
113###################################
6ebd933b
MN
114if [ -n "$do_msmpeg4v2" ] ; then
115# msmpeg4 encoding
116file=${outfile}msmpeg4v2.avi
117do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec msmpeg4v2 $file
118
119# msmpeg4v2 decoding
120do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
121fi
122
123###################################
51133a7d
FB
124if [ -n "$do_msmpeg4" ] ; then
125# msmpeg4 encoding
126file=${outfile}msmpeg4.avi
127do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec msmpeg4 $file
128
129# msmpeg4 decoding
130do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
131fi
132
133###################################
6ebd933b
MN
134if [ -n "$do_wmv1" ] ; then
135# wmv1 encoding
136file=${outfile}wmv1.avi
137do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec wmv1 $file
138
139# wmv1 decoding
140do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
141fi
142
143###################################
e23d5712
MN
144if [ -n "$do_wmv2" ] ; then
145# wmv2 encoding
146file=${outfile}wmv2.avi
147do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec wmv2 $file
148
149# wmv2 decoding
150do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
151fi
152
153###################################
51133a7d
FB
154if [ -n "$do_h263" ] ; then
155# h263 encoding
156file=${outfile}h263.avi
157do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -s 352x288 -an -vcodec h263 $file
158
6e2d5f1a
MN
159# h263 decoding
160do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
161fi
162
163###################################
164if [ -n "$do_h263p" ] ; then
165# h263p encoding
166file=${outfile}h263p.avi
67cbe681 167do_ffmpeg $file -y -qscale 2 -umv -f pgmyuv -i $raw_src -s 352x288 -an -vcodec h263p -ps 300 $file
6e2d5f1a 168
51133a7d
FB
169# h263p decoding
170do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
171fi
172
173###################################
174if [ -n "$do_mpeg4" ] ; then
175# mpeg4
176file=${outfile}odivx.avi
67cbe681 177do_ffmpeg $file -y -4mv -qscale 10 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file
51133a7d
FB
178
179# mpeg4 decoding
180do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
181fi
182
183###################################
e629ab68
RD
184if [ -n "$do_huffyuv" ] ; then
185# huffyuv
186file=${outfile}huffyuv.avi
187do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec huffyuv -strict -1 $file
188
189# huffyuv decoding
190do_ffmpeg $raw_dst -y -i $file -f rawvideo -strict -1 $raw_dst
191fi
192
193###################################
1dbb6d90
MN
194if [ -n "$do_rc" ] ; then
195# mpeg4 rate control
196file=${outfile}mpeg4-rc.avi
197do_ffmpeg $file -y -b 400 -bf 2 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file
198
199# mpeg4 rate control decoding
200do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
201fi
202
203###################################
204if [ -n "$do_mpeg4adv" ] ; then
205# mpeg4
206file=${outfile}mpeg4-adv.avi
ba57a3ff 207do_ffmpeg $file -y -qscale 9 -4mv -hq -part -ps 200 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file
1dbb6d90
MN
208
209# mpeg4 decoding
210do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
211fi
212
213###################################
cfadadec
MN
214if [ -n "$do_mpeg1b" ] ; then
215# mpeg1
216file=${outfile}mpeg1b.mpg
ba57a3ff 217do_ffmpeg $file -y -qscale 8 -bf 3 -ps 200 -f pgmyuv -i $raw_src -an -vcodec mpeg1video $file
cfadadec
MN
218
219# mpeg1 decoding
220do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
221fi
222
223###################################
51133a7d
FB
224if [ -n "$do_mjpeg" ] ; then
225# mjpeg
226file=${outfile}mjpeg.avi
227do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec mjpeg $file
228
229# mjpeg decoding
230do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
231fi
232
233###################################
234if [ -n "$do_rv10" ] ; then
235# rv10 encoding
236file=${outfile}rv10.rm
237do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an $file
238
239# rv10 decoding
240do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
241fi
242
243###################################
244if [ -n "$do_mp2" ] ; then
245# mp2 encoding
246file=${outfile}mp2.mp2
247do_ffmpeg $file -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src $file
248
249# mp2 decoding
250do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
251fi
252
253###################################
254if [ -n "$do_ac3" ] ; then
255# ac3 encoding
256file=${outfile}ac3.rm
257do_ffmpeg $file -y -ab 128 -ac 2 -f s16le -i $pcm_src -vn $file
258
259# ac3 decoding
3c300082 260#do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
51133a7d
FB
261fi
262
89d5dfd5
FB
263###################################
264# libav testing
265###################################
266
267if [ -n "$do_libav" ] ; then
268
269# avi
270file=${outfile}libav.avi
271do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
272do_ffmpeg_crc $file -i $file
273
274# asf
275file=${outfile}libav.asf
276do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
277do_ffmpeg_crc $file -i $file
278
279# rm
280file=${outfile}libav.rm
281do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
282# broken
283#do_ffmpeg_crc $file -i $file
284
285# mpegps
286file=${outfile}libav.mpg
287do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
288do_ffmpeg_crc $file -i $file
289
290# swf (decode audio only)
291file=${outfile}libav.swf
d0c30ca5
FB
292do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
293do_ffmpeg_crc $file -i $file
89d5dfd5
FB
294
295# ffm
296file=${outfile}libav.ffm
297do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
d0c30ca5 298do_ffmpeg_crc $file -i $file
89d5dfd5
FB
299
300# XXX: need mov and mpegts tests (add bitstreams or add output capability in ffmpeg)
301
302####################
303# streamed images
304# mjpeg
305file=${outfile}libav.mjpeg
306do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src $file
d0c30ca5 307do_ffmpeg_crc $file -i $file
89d5dfd5 308
7481e919
FB
309# pbmpipe
310file=${outfile}libav.pbm
311do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f imagepipe $file
312do_ffmpeg_crc $file -f imagepipe -i $file
313
89d5dfd5 314# pgmpipe
7481e919
FB
315file=${outfile}libav.pgm
316do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f imagepipe $file
317do_ffmpeg_crc $file -f imagepipe -i $file
89d5dfd5
FB
318
319# ppmpipe
7481e919
FB
320file=${outfile}libav.ppm
321do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f imagepipe $file
322do_ffmpeg_crc $file -f imagepipe -i $file
89d5dfd5
FB
323
324# gif
325file=${outfile}libav.gif
7481e919
FB
326do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src $file
327#do_ffmpeg_crc $file -i $file
328
329# yuv4mpeg
330file=${outfile}libav.yuv4mpeg
331do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src $file
332#do_ffmpeg_crc $file -i $file
89d5dfd5
FB
333
334####################
335# image formats
336# pgm (we do not do md5 on image files yet)
337file=${outfile}libav%d.pgm
338$ffmpeg -t 0.5 -y -qscale 10 -f pgmyuv -i $raw_src $file
339do_ffmpeg_crc $file -i $file
340
341# ppm (we do not do md5 on image files yet)
342file=${outfile}libav%d.ppm
343$ffmpeg -t 0.5 -y -qscale 10 -f pgmyuv -i $raw_src $file
344do_ffmpeg_crc $file -i $file
345
d0c30ca5
FB
346# jpeg (we do not do md5 on image files yet)
347file=${outfile}libav%d.jpg
348$ffmpeg -t 0.5 -y -qscale 10 -f pgmyuv -i $raw_src $file
349do_ffmpeg_crc $file -i $file
350
89d5dfd5
FB
351####################
352# audio only
353
354# wav
355file=${outfile}libav.wav
356do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
357do_ffmpeg_crc $file -i $file
358
359# alaw
360file=${outfile}libav.al
361do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
362do_ffmpeg_crc $file -i $file
363
364# mulaw
365file=${outfile}libav.ul
366do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
367do_ffmpeg_crc $file -i $file
368
369# au
370file=${outfile}libav.au
371do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
372do_ffmpeg_crc $file -i $file
373
374fi
375
376
51133a7d
FB
377
378if diff -u $logfile $reffile ; then
379 echo
380 echo Regression test succeeded.
381 exit 0
382else
383 echo
384 echo Regression test: Error.
385 exit 1
386fi