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