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