pix_sum16_mmx()
[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
89d5dfd5
FB
18elif [ "$1" = "libavtest" ] ; then
19 do_libav=y
5bcfd1ad 20 logfile="$datadir/libav.regression"
51133a7d
FB
21else
22 do_mpeg=y
6ebd933b 23 do_msmpeg4v2=y
51133a7d 24 do_msmpeg4=y
6ebd933b 25 do_wmv1=y
51133a7d
FB
26 do_h263=y
27 do_mpeg4=y
28 do_mjpeg=y
64a7a8af 29 do_rv10=y
51133a7d
FB
30 do_mp2=y
31 do_ac3=y
32fi
33
34
35# various files
36ffmpeg="../ffmpeg"
5bcfd1ad 37outfile="$datadir/a-"
51133a7d 38reffile="$2"
5bcfd1ad 39benchfile="$datadir/ffmpeg.bench"
51133a7d 40raw_src="vsynth1/%d.pgm"
5bcfd1ad 41raw_dst="$datadir/out.yuv"
51133a7d 42pcm_src="asynth1.sw"
5bcfd1ad
FB
43pcm_dst="$datadir/out.wav"
44
45# create the data directory if it does not exists
46mkdir -p $datadir
51133a7d 47
3f027ca7 48do_ffmpeg()
51133a7d
FB
49{
50 f="$1"
51 shift
463678ac
MN
52 echo $ffmpeg -bitexact -dct_algo 1 $*
53 $ffmpeg -bitexact -dct_algo 1 -benchmark $* > $datadir/bench.tmp
3f027ca7 54 md5sum -b $f >> $logfile
90cee0c3 55 expr "`cat $datadir/bench.tmp`" : '.*utime=\(.*s\)' > $datadir/bench2.tmp
5bcfd1ad 56 echo `cat $datadir/bench2.tmp` $f >> $benchfile
51133a7d
FB
57}
58
3f027ca7 59do_ffmpeg_crc()
89d5dfd5
FB
60{
61 f="$1"
62 shift
463678ac
MN
63 echo $ffmpeg -y -bitexact -dct_algo 1 $* -f crc $datadir/ffmpeg.crc
64 $ffmpeg -y -bitexact -dct_algo 1 $* -f crc $datadir/ffmpeg.crc
89d5dfd5 65 echo -n "$f " >> $logfile
5bcfd1ad 66 cat $datadir/ffmpeg.crc >> $logfile
89d5dfd5 67}
51133a7d
FB
68
69echo "ffmpeg regression test" > $logfile
70echo "ffmpeg benchmarks" > $benchfile
71
72###################################
73if [ -n "$do_mpeg" ] ; then
74# mpeg1 encoding
75file=${outfile}mpeg1.mpg
89d5dfd5 76do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -f mpeg1video $file
51133a7d
FB
77
78# mpeg1 decoding
89d5dfd5 79do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
51133a7d
FB
80
81# mpeg2 decoding
82#do_ffmpeg /tmp/out-mpeg2.yuv -y -f mpegvideo -i a.vob \
83# -f rawvideo /tmp/out-mpeg2.yuv
84fi
85
86###################################
6ebd933b
MN
87if [ -n "$do_msmpeg4v2" ] ; then
88# msmpeg4 encoding
89file=${outfile}msmpeg4v2.avi
90do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec msmpeg4v2 $file
91
92# msmpeg4v2 decoding
93do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
94fi
95
96###################################
51133a7d
FB
97if [ -n "$do_msmpeg4" ] ; then
98# msmpeg4 encoding
99file=${outfile}msmpeg4.avi
100do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec msmpeg4 $file
101
102# msmpeg4 decoding
103do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
104fi
105
106###################################
6ebd933b
MN
107if [ -n "$do_wmv1" ] ; then
108# wmv1 encoding
109file=${outfile}wmv1.avi
110do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec wmv1 $file
111
112# wmv1 decoding
113do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
114fi
115
116###################################
51133a7d
FB
117if [ -n "$do_h263" ] ; then
118# h263 encoding
119file=${outfile}h263.avi
120do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -s 352x288 -an -vcodec h263 $file
121
122# h263p decoding
123do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
124fi
125
126###################################
127if [ -n "$do_mpeg4" ] ; then
128# mpeg4
129file=${outfile}odivx.avi
130do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file
131
132# mpeg4 decoding
133do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
134fi
135
136###################################
137if [ -n "$do_mjpeg" ] ; then
138# mjpeg
139file=${outfile}mjpeg.avi
140do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec mjpeg $file
141
142# mjpeg decoding
143do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
144fi
145
146###################################
147if [ -n "$do_rv10" ] ; then
148# rv10 encoding
149file=${outfile}rv10.rm
150do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an $file
151
152# rv10 decoding
153do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
154fi
155
156###################################
157if [ -n "$do_mp2" ] ; then
158# mp2 encoding
159file=${outfile}mp2.mp2
160do_ffmpeg $file -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src $file
161
162# mp2 decoding
163do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
164fi
165
166###################################
167if [ -n "$do_ac3" ] ; then
168# ac3 encoding
169file=${outfile}ac3.rm
170do_ffmpeg $file -y -ab 128 -ac 2 -f s16le -i $pcm_src -vn $file
171
172# ac3 decoding
173do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
174fi
175
89d5dfd5
FB
176###################################
177# libav testing
178###################################
179
180if [ -n "$do_libav" ] ; then
181
182# avi
183file=${outfile}libav.avi
184do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
185do_ffmpeg_crc $file -i $file
186
187# asf
188file=${outfile}libav.asf
189do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
190do_ffmpeg_crc $file -i $file
191
192# rm
193file=${outfile}libav.rm
194do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
195# broken
196#do_ffmpeg_crc $file -i $file
197
198# mpegps
199file=${outfile}libav.mpg
200do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
201do_ffmpeg_crc $file -i $file
202
203# swf (decode audio only)
204file=${outfile}libav.swf
d0c30ca5
FB
205do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
206do_ffmpeg_crc $file -i $file
89d5dfd5
FB
207
208# ffm
209file=${outfile}libav.ffm
210do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
d0c30ca5 211do_ffmpeg_crc $file -i $file
89d5dfd5
FB
212
213# XXX: need mov and mpegts tests (add bitstreams or add output capability in ffmpeg)
214
215####################
216# streamed images
217# mjpeg
218file=${outfile}libav.mjpeg
219do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src $file
d0c30ca5 220do_ffmpeg_crc $file -i $file
89d5dfd5
FB
221
222# pgmpipe
223file=${outfile}libav.pgmpipe
224do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f pgmpipe $file
225do_ffmpeg_crc $file -f pgmpipe -i $file
226
227# ppmpipe
228file=${outfile}libav.ppmpipe
229do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f ppmpipe $file
230do_ffmpeg_crc $file -f ppmpipe -i $file
231
232# gif
233file=${outfile}libav.gif
234do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f ppmpipe $file
235#do_ffmpeg_crc $file -f ppmpipe -i $file
236
237####################
238# image formats
239# pgm (we do not do md5 on image files yet)
240file=${outfile}libav%d.pgm
241$ffmpeg -t 0.5 -y -qscale 10 -f pgmyuv -i $raw_src $file
242do_ffmpeg_crc $file -i $file
243
244# ppm (we do not do md5 on image files yet)
245file=${outfile}libav%d.ppm
246$ffmpeg -t 0.5 -y -qscale 10 -f pgmyuv -i $raw_src $file
247do_ffmpeg_crc $file -i $file
248
d0c30ca5
FB
249# jpeg (we do not do md5 on image files yet)
250file=${outfile}libav%d.jpg
251$ffmpeg -t 0.5 -y -qscale 10 -f pgmyuv -i $raw_src $file
252do_ffmpeg_crc $file -i $file
253
89d5dfd5
FB
254####################
255# audio only
256
257# wav
258file=${outfile}libav.wav
259do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
260do_ffmpeg_crc $file -i $file
261
262# alaw
263file=${outfile}libav.al
264do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
265do_ffmpeg_crc $file -i $file
266
267# mulaw
268file=${outfile}libav.ul
269do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
270do_ffmpeg_crc $file -i $file
271
272# au
273file=${outfile}libav.au
274do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
275do_ffmpeg_crc $file -i $file
276
277fi
278
279
51133a7d
FB
280
281if diff -u $logfile $reffile ; then
282 echo
283 echo Regression test succeeded.
284 exit 0
285else
286 echo
287 echo Regression test: Error.
288 exit 1
289fi