a858250e2f97193de563c059e9ab85e850d98af9
[libav.git] / tests / codec-regression.sh
1 #!/bin/sh
2 #
3 # automatic regression test for ffmpeg
4 #
5 #
6 #set -x
7
8 set -e
9
10 . $(dirname $0)/regression-funcs.sh
11
12 eval do_$test=y
13
14 rm -f "$logfile"
15
16 # generate reference for quality check
17 if [ -n "$do_vref" ]; then
18 do_ffmpeg $raw_ref -f image2 -vcodec pgmyuv -i $raw_src -an -f rawvideo
19 fi
20 if [ -n "$do_aref" ]; then
21 do_ffmpeg $pcm_ref -ab 128k -ac 2 -ar 44100 -f s16le -i $pcm_src -f wav
22 fi
23
24 if [ -n "$do_mpeg" ] ; then
25 # mpeg1
26 do_video_encoding mpeg1.mpg "-qscale 10 -f mpeg1video"
27 do_video_decoding
28 fi
29
30 if [ -n "$do_mpeg2" ] ; then
31 # mpeg2
32 do_video_encoding mpeg2.mpg "-qscale 10 -vcodec mpeg2video -f mpeg1video"
33 do_video_decoding
34
35 # mpeg2 encoding intra vlc qprd
36 do_video_encoding mpeg2ivlc-qprd.mpg "-vb 500k -bf 2 -trellis 1 -flags +qprd+mv0 -flags2 +ivlc -cmp 2 -subcmp 2 -mbd rd -vcodec mpeg2video -f mpeg2video"
37 do_video_decoding
38
39 #mpeg2 4:2:2 encoding
40 do_video_encoding mpeg2_422.mpg "-vb 1000k -bf 2 -trellis 1 -flags +qprd+mv0+ildct+ilme -flags2 +ivlc -mbd rd -vcodec mpeg2video -pix_fmt yuv422p -f mpeg2video"
41 do_video_decoding
42
43 # mpeg2
44 do_video_encoding mpeg2.mpg "-qscale 10 -vcodec mpeg2video -idct int -dct int -f mpeg1video"
45 do_video_decoding "-idct int"
46
47 # mpeg2 encoding interlaced
48 do_video_encoding mpeg2i.mpg "-qscale 10 -vcodec mpeg2video -f mpeg1video -flags +ildct+ilme"
49 do_video_decoding
50 fi
51
52 if [ -n "$do_mpeg2thread" ] ; then
53 # mpeg2 encoding interlaced
54 do_video_encoding mpeg2thread.mpg "-qscale 10 -vcodec mpeg2video -f mpeg1video -bf 2 -flags +ildct+ilme -threads 2"
55 do_video_decoding
56
57 # mpeg2 encoding interlaced using intra vlc
58 do_video_encoding mpeg2threadivlc.mpg "-qscale 10 -vcodec mpeg2video -f mpeg1video -bf 2 -flags +ildct+ilme -flags2 +ivlc -threads 2"
59 do_video_decoding
60
61 # mpeg2 encoding interlaced
62 file=${outfile}mpeg2reuse.mpg
63 do_ffmpeg $file $DEC_OPTS -me_threshold 256 -i ${target_path}/${outfile}mpeg2thread.mpg $ENC_OPTS -sameq -me_threshold 256 -mb_threshold 1024 -vcodec mpeg2video -f mpeg1video -bf 2 -flags +ildct+ilme -threads 4
64 do_video_decoding
65 fi
66
67 if [ -n "$do_msmpeg4v2" ] ; then
68 do_video_encoding msmpeg4v2.avi "-qscale 10 -an -vcodec msmpeg4v2"
69 do_video_decoding
70 fi
71
72 if [ -n "$do_msmpeg4" ] ; then
73 do_video_encoding msmpeg4.avi "-qscale 10 -an -vcodec msmpeg4"
74 do_video_decoding
75 fi
76
77 if [ -n "$do_wmv1" ] ; then
78 do_video_encoding wmv1.avi "-qscale 10 -an -vcodec wmv1"
79 do_video_decoding
80 fi
81
82 if [ -n "$do_wmv2" ] ; then
83 do_video_encoding wmv2.avi "-qscale 10 -an -vcodec wmv2"
84 do_video_decoding
85 fi
86
87 if [ -n "$do_h261" ] ; then
88 do_video_encoding h261.avi "-qscale 11 -s 352x288 -an -vcodec h261"
89 do_video_decoding
90 fi
91
92 if [ -n "$do_h263" ] ; then
93 do_video_encoding h263.avi "-qscale 10 -s 352x288 -an -vcodec h263"
94 do_video_decoding
95 fi
96
97 if [ -n "$do_h263p" ] ; then
98 do_video_encoding h263p.avi "-qscale 2 -flags +umv+aiv+aic -s 352x288 -an -vcodec h263p -ps 300"
99 do_video_decoding
100 fi
101
102 if [ -n "$do_mpeg4" ] ; then
103 do_video_encoding odivx.mp4 "-flags +mv4 -mbd bits -qscale 10 -an -vcodec mpeg4"
104 do_video_decoding
105 fi
106
107 if [ -n "$do_huffyuv" ] ; then
108 do_video_encoding huffyuv.avi "-an -vcodec huffyuv -pix_fmt yuv422p -sws_flags neighbor+bitexact"
109 do_video_decoding "" "-strict -2 -pix_fmt yuv420p -sws_flags neighbor+bitexact"
110 fi
111
112 if [ -n "$do_rc" ] ; then
113 do_video_encoding mpeg4-rc.avi "-b 400k -bf 2 -an -vcodec mpeg4"
114 do_video_decoding
115 fi
116
117 if [ -n "$do_mpeg4adv" ] ; then
118 do_video_encoding mpeg4-adv.avi "-qscale 9 -flags +mv4+part+aic -trellis 1 -mbd bits -ps 200 -an -vcodec mpeg4"
119 do_video_decoding
120
121 do_video_encoding mpeg4-qprd.avi "-b 450k -bf 2 -trellis 1 -flags +mv4+qprd+mv0 -cmp 2 -subcmp 2 -mbd rd -an -vcodec mpeg4"
122 do_video_decoding
123
124 do_video_encoding mpeg4-adap.avi "-b 550k -bf 2 -flags +mv4+mv0 -trellis 1 -cmp 1 -subcmp 2 -mbd rd -scplx_mask 0.3 -an -vcodec mpeg4"
125 do_video_decoding
126
127 do_video_encoding mpeg4-Q.avi "-qscale 7 -flags +mv4+qpel -mbd 2 -bf 2 -cmp 1 -subcmp 2 -an -vcodec mpeg4"
128 do_video_decoding
129 fi
130
131 if [ -n "$do_mpeg4thread" ] ; then
132 do_video_encoding mpeg4-thread.avi "-b 500k -flags +mv4+part+aic -trellis 1 -mbd bits -ps 200 -bf 2 -an -vcodec mpeg4 -threads 2"
133 do_video_decoding
134 fi
135
136 if [ -n "$do_error" ] ; then
137 do_video_encoding error-mpeg4-adv.avi "-qscale 7 -flags +mv4+part+aic -mbd rd -ps 250 -error 10 -an -vcodec mpeg4"
138 do_video_decoding
139 fi
140
141 if [ -n "$do_mpeg4nr" ] ; then
142 do_video_encoding mpeg4-nr.avi "-qscale 8 -flags +mv4 -mbd rd -nr 200 -an -vcodec mpeg4"
143 do_video_decoding
144 fi
145
146 if [ -n "$do_mpeg1b" ] ; then
147 do_video_encoding mpeg1b.mpg "-qscale 8 -bf 3 -ps 200 -an -vcodec mpeg1video -f mpeg1video"
148 do_video_decoding
149 fi
150
151 if [ -n "$do_mjpeg" ] ; then
152 do_video_encoding mjpeg.avi "-qscale 9 -an -vcodec mjpeg -pix_fmt yuvj420p"
153 do_video_decoding "" "-pix_fmt yuv420p"
154 fi
155
156 if [ -n "$do_ljpeg" ] ; then
157 do_video_encoding ljpeg.avi "-an -vcodec ljpeg -strict -1"
158 do_video_decoding
159 fi
160
161 if [ -n "$do_jpegls" ] ; then
162 do_video_encoding jpegls.avi "-an -vcodec jpegls -vtag MJPG -sws_flags neighbor+full_chroma_int+accurate_rnd+bitexact"
163 do_video_decoding "" "-pix_fmt yuv420p -sws_flags area+bitexact"
164 fi
165
166 if [ -n "$do_rv10" ] ; then
167 do_video_encoding rv10.rm "-qscale 10 -an"
168 do_video_decoding
169 fi
170
171 if [ -n "$do_rv20" ] ; then
172 do_video_encoding rv20.rm "-qscale 10 -vcodec rv20 -an"
173 do_video_decoding
174 fi
175
176 if [ -n "$do_asv1" ] ; then
177 do_video_encoding asv1.avi "-qscale 10 -an -vcodec asv1"
178 do_video_decoding
179 fi
180
181 if [ -n "$do_asv2" ] ; then
182 do_video_encoding asv2.avi "-qscale 10 -an -vcodec asv2"
183 do_video_decoding
184 fi
185
186 if [ -n "$do_flv" ] ; then
187 do_video_encoding flv.flv "-qscale 10 -an -vcodec flv"
188 do_video_decoding
189 fi
190
191 if [ -n "$do_ffv1" ] ; then
192 do_video_encoding ffv1.avi "-strict -2 -an -vcodec ffv1"
193 do_video_decoding
194 fi
195
196 if [ -n "$do_snow" ] ; then
197 do_video_encoding snow.avi "-strict -2 -an -vcodec snow -qscale 2 -flags +qpel -me_method iter -dia_size 2 -cmp 12 -subcmp 12 -s 128x64"
198 do_video_decoding "" "-s 352x288"
199 fi
200
201 if [ -n "$do_snowll" ] ; then
202 do_video_encoding snow53.avi "-strict -2 -an -vcodec snow -qscale .001 -pred 1 -flags +mv4+qpel"
203 do_video_decoding
204 fi
205
206 if [ -n "$do_dv" ] ; then
207 do_video_encoding dv.dv "-dct int -s pal -an"
208 do_video_decoding "" "-s cif"
209
210 do_video_encoding dv411.dv "-dct int -s pal -an -pix_fmt yuv411p -sws_flags area+accurate_rnd+bitexact"
211 do_video_decoding "" "-s cif -sws_flags area+accurate_rnd+bitexact"
212 fi
213
214 if [ -n "$do_dv50" ] ; then
215 do_video_encoding dv50.dv "-dct int -s pal -pix_fmt yuv422p -an -sws_flags neighbor+bitexact"
216 do_video_decoding "" "-s cif -pix_fmt yuv420p -sws_flags neighbor+bitexact"
217 fi
218
219 if [ -n "$do_dnxhd_1080i" ] ; then
220 # FIXME: interlaced raw DNxHD decoding is broken
221 do_video_encoding dnxhd-1080i.mov "-vcodec dnxhd -flags +ildct -s hd1080 -b 120M -pix_fmt yuv422p -vframes 5 -an"
222 do_video_decoding "" "-s cif -pix_fmt yuv420p"
223 fi
224
225 if [ -n "$do_dnxhd_720p" ] ; then
226 do_video_encoding dnxhd-720p.dnxhd "-s hd720 -b 90M -pix_fmt yuv422p -vframes 5 -an"
227 do_video_decoding "" "-s cif -pix_fmt yuv420p"
228 fi
229
230 if [ -n "$do_dnxhd_720p_rd" ] ; then
231 do_video_encoding dnxhd-720p-rd.dnxhd "-threads 4 -mbd rd -s hd720 -b 90M -pix_fmt yuv422p -vframes 5 -an"
232 do_video_decoding "" "-s cif -pix_fmt yuv420p"
233 fi
234
235 if [ -n "$do_svq1" ] ; then
236 do_video_encoding svq1.mov "-an -vcodec svq1 -qscale 3 -pix_fmt yuv410p"
237 do_video_decoding "" "-pix_fmt yuv420p"
238 fi
239
240 if [ -n "$do_flashsv" ] ; then
241 do_video_encoding flashsv.flv "-an -vcodec flashsv -sws_flags neighbor+full_chroma_int+accurate_rnd+bitexact"
242 do_video_decoding "" "-pix_fmt yuv420p -sws_flags area+accurate_rnd+bitexact"
243 fi
244
245 if [ -n "$do_roq" ] ; then
246 do_video_encoding roqav.roq "-vframes 5"
247 do_video_decoding "" "-pix_fmt yuv420p"
248 fi
249
250 if [ -n "$do_qtrle" ] ; then
251 do_video_encoding qtrle.mov "-an -vcodec qtrle"
252 do_video_decoding "" "-pix_fmt yuv420p"
253 fi
254
255 if [ -n "$do_rgb" ] ; then
256 do_video_encoding rgb.avi "-an -vcodec rawvideo -pix_fmt bgr24"
257 do_video_decoding "" "-pix_fmt yuv420p"
258 fi
259
260 if [ -n "$do_yuv" ] ; then
261 do_video_encoding yuv.avi "-an -vcodec rawvideo -pix_fmt yuv420p"
262 do_video_decoding "" "-pix_fmt yuv420p"
263 fi
264
265 if [ -n "$do_mp2" ] ; then
266 do_audio_encoding mp2.mp2
267 do_audio_decoding
268 $tiny_psnr $pcm_dst $pcm_ref 2 1924 >> $logfile
269 fi
270
271 if [ -n "$do_ac3_fixed" ] ; then
272 do_audio_encoding ac3.rm "-vn -acodec ac3_fixed"
273 # binaries configured with --disable-sse decode ac3 differently
274 #do_audio_decoding
275 #$tiny_psnr $pcm_dst $pcm_ref 2 1024 >> $logfile
276 fi
277
278 if [ -n "$do_g726" ] ; then
279 do_audio_encoding g726.wav "-ab 32k -ac 1 -ar 8000 -acodec g726"
280 do_audio_decoding
281 fi
282
283 if [ -n "$do_adpcm_ima_wav" ] ; then
284 do_audio_encoding adpcm_ima.wav "-acodec adpcm_ima_wav"
285 do_audio_decoding
286 fi
287
288 if [ -n "$do_adpcm_ima_qt" ] ; then
289 do_audio_encoding adpcm_qt.aiff "-acodec adpcm_ima_qt"
290 do_audio_decoding
291 fi
292
293 if [ -n "$do_adpcm_ms" ] ; then
294 do_audio_encoding adpcm_ms.wav "-acodec adpcm_ms"
295 do_audio_decoding
296 fi
297
298 if [ -n "$do_adpcm_yam" ] ; then
299 do_audio_encoding adpcm_yam.wav "-acodec adpcm_yamaha"
300 do_audio_decoding
301 fi
302
303 if [ -n "$do_adpcm_swf" ] ; then
304 do_audio_encoding adpcm_swf.flv "-acodec adpcm_swf"
305 do_audio_decoding
306 fi
307
308 if [ -n "$do_alac" ] ; then
309 do_audio_encoding alac.m4a "-acodec alac -compression_level 1"
310 do_audio_decoding
311 fi
312
313 if [ -n "$do_flac" ] ; then
314 do_audio_encoding flac.flac "-acodec flac -compression_level 2"
315 do_audio_decoding
316 fi
317
318 if [ -n "$do_wmav1" ] ; then
319 do_audio_encoding wmav1.asf "-acodec wmav1"
320 do_ffmpeg_nomd5 $pcm_dst $DEC_OPTS -i $target_path/$file -f wav
321 $tiny_psnr $pcm_dst $pcm_ref 2 8192 >> $logfile
322 fi
323 if [ -n "$do_wmav2" ] ; then
324 do_audio_encoding wmav2.asf "-acodec wmav2"
325 do_ffmpeg_nomd5 $pcm_dst $DEC_OPTS -i $target_path/$file -f wav
326 $tiny_psnr $pcm_dst $pcm_ref 2 8192 >> $logfile
327 fi
328
329 #if [ -n "$do_vorbis" ] ; then
330 # vorbis
331 #disabled because it is broken
332 #do_audio_encoding vorbis.asf "-acodec vorbis"
333 #do_audio_decoding
334 #fi
335
336 do_audio_enc_dec() {
337 do_audio_encoding $3.$1 "$4 -sample_fmt $2 -acodec $3"
338 do_audio_decoding
339 }
340
341 if [ -n "$do_pcm" ] ; then
342 do_audio_enc_dec wav s16 pcm_alaw
343 do_audio_enc_dec wav s16 pcm_mulaw
344 do_audio_enc_dec mov u8 pcm_s8
345 do_audio_enc_dec wav u8 pcm_u8
346 do_audio_enc_dec mov s16 pcm_s16be
347 do_audio_enc_dec wav s16 pcm_s16le
348 do_audio_enc_dec mkv s16 pcm_s16be
349 do_audio_enc_dec mkv s16 pcm_s16le
350 do_audio_enc_dec mov s32 pcm_s24be
351 do_audio_enc_dec wav s32 pcm_s24le
352 #do_audio_enc_dec ??? s32 pcm_u24be #no compatible muxer or demuxer
353 #do_audio_enc_dec ??? s32 pcm_u24le #no compatible muxer or demuxer
354 do_audio_enc_dec mov s32 pcm_s32be
355 do_audio_enc_dec wav s32 pcm_s32le
356 #do_audio_enc_dec ??? s32 pcm_u32be #no compatible muxer or demuxer
357 #do_audio_enc_dec ??? s32 pcm_u32le #no compatible muxer or demuxer
358 do_audio_enc_dec au flt pcm_f32be
359 do_audio_enc_dec wav flt pcm_f32le
360 do_audio_enc_dec au dbl pcm_f64be
361 do_audio_enc_dec wav dbl pcm_f64le
362 do_audio_enc_dec wav s16 pcm_zork
363 do_audio_enc_dec 302 s16 pcm_s24daud "-ac 6 -ar 96000"
364 fi