Split codec-regression.sh, and create the lavf-regression.sh script.
[libav.git] / tests / codec-regression.sh
CommitLineData
51133a7d
FB
1#!/bin/sh
2#
3# automatic regression test for ffmpeg
4#
5#
6#set -x
d9d7653e 7
51133a7d
FB
8set -e
9
2189dbc4 10. $(dirname $0)/regression-funcs.sh
89d5dfd5 11
4383ed5c
MR
12eval do_$test=y
13
4383ed5c
MR
14rm -f "$logfile"
15rm -f "$benchfile"
51133a7d 16
67cbe681 17# generate reference for quality check
4383ed5c 18if [ -n "$do_ref" ]; then
9a5771e9
MR
19do_ffmpeg_nocheck $raw_ref -f image2 -vcodec pgmyuv -i $raw_src -an -f rawvideo $target_path/$raw_ref
20do_ffmpeg_nocheck $pcm_ref -ab 128k -ac 2 -ar 44100 -f s16le -i $pcm_src -f wav $target_path/$pcm_ref
4383ed5c 21fi
67cbe681 22
51133a7d 23if [ -n "$do_mpeg" ] ; then
0fc3a831 24# mpeg1
5b67e4f8 25do_video_encoding mpeg1.mpg "-qscale 10" "-f mpeg1video"
1de61a18 26do_video_decoding
922bc38d
MN
27fi
28
922bc38d 29if [ -n "$do_mpeg2" ] ; then
0fc3a831 30# mpeg2
5b67e4f8 31do_video_encoding mpeg2.mpg "-qscale 10" "-vcodec mpeg2video -f mpeg1video"
1de61a18 32do_video_decoding
83dddc4a 33
49f1ac5a 34# mpeg2 encoding intra vlc qprd
dd1c8f3e 35do_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"
1de61a18 36do_video_decoding
307eb248 37
2cce68f8 38#mpeg2 4:2:2 encoding
b91758de 39do_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"
2cce68f8
BC
40do_video_decoding
41
0fc3a831 42# mpeg2
5b67e4f8 43do_video_encoding mpeg2.mpg "-qscale 10" "-vcodec mpeg2video -idct int -dct int -f mpeg1video"
5e5ac8e0 44do_video_decoding "-idct int"
6486ad57 45
83dddc4a 46# mpeg2 encoding interlaced
5b67e4f8 47do_video_encoding mpeg2i.mpg "-qscale 10" "-vcodec mpeg2video -f mpeg1video -flags +ildct+ilme"
1de61a18 48do_video_decoding
51133a7d
FB
49fi
50
9c3d33d6
MN
51if [ -n "$do_mpeg2thread" ] ; then
52# mpeg2 encoding interlaced
5b67e4f8 53do_video_encoding mpeg2thread.mpg "-qscale 10" "-vcodec mpeg2video -f mpeg1video -bf 2 -flags +ildct+ilme -threads 2"
1de61a18 54do_video_decoding
307eb248
BC
55
56# mpeg2 encoding interlaced using intra vlc
5b67e4f8 57do_video_encoding mpeg2threadivlc.mpg "-qscale 10" "-vcodec mpeg2video -f mpeg1video -bf 2 -flags +ildct+ilme -flags2 +ivlc -threads 2"
1de61a18 58do_video_decoding
7f8038ce
MN
59
60# mpeg2 encoding interlaced
61file=${outfile}mpeg2reuse.mpg
9a5771e9 62do_ffmpeg $file -sameq -me_threshold 256 -mb_threshold 1024 -i ${target_path}/${outfile}mpeg2thread.mpg -vcodec mpeg2video -f mpeg1video -bf 2 -flags +ildct+ilme -threads 4
1de61a18 63do_video_decoding
9c3d33d6
MN
64fi
65
6ebd933b 66if [ -n "$do_msmpeg4v2" ] ; then
5b67e4f8 67do_video_encoding msmpeg4v2.avi "-qscale 10" "-an -vcodec msmpeg4v2"
1de61a18 68do_video_decoding
6ebd933b
MN
69fi
70
51133a7d 71if [ -n "$do_msmpeg4" ] ; then
5b67e4f8 72do_video_encoding msmpeg4.avi "-qscale 10" "-an -vcodec msmpeg4"
1de61a18 73do_video_decoding
51133a7d
FB
74fi
75
6ebd933b 76if [ -n "$do_wmv1" ] ; then
5b67e4f8 77do_video_encoding wmv1.avi "-qscale 10" "-an -vcodec wmv1"
1de61a18 78do_video_decoding
6ebd933b
MN
79fi
80
e23d5712 81if [ -n "$do_wmv2" ] ; then
5b67e4f8 82do_video_encoding wmv2.avi "-qscale 10" "-an -vcodec wmv2"
1de61a18 83do_video_decoding
e23d5712
MN
84fi
85
61b262a9 86if [ -n "$do_h261" ] ; then
5b67e4f8 87do_video_encoding h261.avi "-qscale 11" "-s 352x288 -an -vcodec h261"
1de61a18 88do_video_decoding
61b262a9
MN
89fi
90
51133a7d 91if [ -n "$do_h263" ] ; then
5b67e4f8 92do_video_encoding h263.avi "-qscale 10" "-s 352x288 -an -vcodec h263"
1de61a18 93do_video_decoding
6e2d5f1a
MN
94fi
95
6e2d5f1a 96if [ -n "$do_h263p" ] ; then
5b67e4f8 97do_video_encoding h263p.avi "-qscale 2 -flags +umv+aiv+aic" "-s 352x288 -an -vcodec h263p -ps 300"
1de61a18 98do_video_decoding
51133a7d
FB
99fi
100
51133a7d 101if [ -n "$do_mpeg4" ] ; then
5b67e4f8 102do_video_encoding odivx.mp4 "-flags +mv4 -mbd bits -qscale 10" "-an -vcodec mpeg4"
aeeb0cac 103do_video_decoding
51133a7d
FB
104fi
105
e629ab68 106if [ -n "$do_huffyuv" ] ; then
3e3c638e
MN
107do_video_encoding huffyuv.avi "" "-an -vcodec huffyuv -pix_fmt yuv422p -sws_flags neighbor+bitexact"
108do_video_decoding "" "-strict -2 -pix_fmt yuv420p -sws_flags neighbor+bitexact"
e629ab68
RD
109fi
110
1dbb6d90 111if [ -n "$do_rc" ] ; then
5b67e4f8 112do_video_encoding mpeg4-rc.avi "-b 400k -bf 2" "-an -vcodec mpeg4"
aeeb0cac 113do_video_decoding
1dbb6d90
MN
114fi
115
1dbb6d90 116if [ -n "$do_mpeg4adv" ] ; then
dd1c8f3e 117do_video_encoding mpeg4-adv.avi "-qscale 9 -flags +mv4+part+aic -trellis 1 -mbd bits -ps 200" "-an -vcodec mpeg4"
1de61a18 118do_video_decoding
2d1e5071 119
dd1c8f3e 120do_video_encoding mpeg4-qprd.avi "-b 450k -bf 2 -trellis 1 -flags +mv4+qprd+mv0 -cmp 2 -subcmp 2 -mbd rd" "-an -vcodec mpeg4"
2d1e5071
MN
121do_video_decoding
122
dd1c8f3e 123do_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"
2d1e5071 124do_video_decoding
1dbb6d90 125
5b67e4f8 126do_video_encoding mpeg4-Q.avi "-qscale 7 -flags +mv4+qpel -mbd 2 -bf 2 -cmp 1 -subcmp 2" "-an -vcodec mpeg4"
1de61a18 127do_video_decoding
aab9cdcf
MN
128fi
129
45ddd8b0 130if [ -n "$do_mpeg4thread" ] ; then
dd1c8f3e 131do_video_encoding mpeg4-thread.avi "-b 500k -flags +mv4+part+aic -trellis 1 -mbd bits -ps 200 -bf 2" "-an -vcodec mpeg4 -threads 2"
1de61a18 132do_video_decoding
9c3d33d6
MN
133fi
134
7ebfc0ea 135if [ -n "$do_error" ] ; then
5b67e4f8 136do_video_encoding error-mpeg4-adv.avi "-qscale 7 -flags +mv4+part+aic -mbd rd -ps 250 -error 10" "-an -vcodec mpeg4"
1de61a18 137do_video_decoding
7ebfc0ea
MN
138fi
139
be408b67 140if [ -n "$do_mpeg4nr" ] ; then
5b67e4f8 141do_video_encoding mpeg4-nr.avi "-qscale 8 -flags +mv4 -mbd rd -nr 200" "-an -vcodec mpeg4"
1de61a18 142do_video_decoding
be408b67
MN
143fi
144
cfadadec 145if [ -n "$do_mpeg1b" ] ; then
5b67e4f8 146do_video_encoding mpeg1b.mpg "-qscale 8 -bf 3 -ps 200" "-an -vcodec mpeg1video -f mpeg1video"
1de61a18 147do_video_decoding
cfadadec
MN
148fi
149
51133a7d 150if [ -n "$do_mjpeg" ] ; then
5b67e4f8 151do_video_encoding mjpeg.avi "-qscale 10" "-an -vcodec mjpeg -pix_fmt yuvj420p"
5e5ac8e0 152do_video_decoding "" "-pix_fmt yuv420p"
51133a7d
FB
153fi
154
3b37408b 155if [ -n "$do_ljpeg" ] ; then
5b67e4f8 156do_video_encoding ljpeg.avi "" "-an -vcodec ljpeg -strict -1"
1de61a18 157do_video_decoding
3b37408b
MN
158fi
159
b4e021e8 160if [ -n "$do_jpegls" ] ; then
3e3c638e
MN
161do_video_encoding jpegls.avi "" "-an -vcodec jpegls -vtag MJPG -sws_flags neighbor+full_chroma_int+accurate_rnd+bitexact"
162do_video_decoding "" "-pix_fmt yuv420p -sws_flags area+bitexact"
b4e021e8
MN
163fi
164
51133a7d 165if [ -n "$do_rv10" ] ; then
5b67e4f8 166do_video_encoding rv10.rm "-qscale 10" "-an"
1de61a18 167do_video_decoding
51133a7d
FB
168fi
169
c50cd09d 170if [ -n "$do_rv20" ] ; then
5b67e4f8 171do_video_encoding rv20.rm "-qscale 10" "-vcodec rv20 -an"
1de61a18 172do_video_decoding
c50cd09d
MN
173fi
174
9ca9fce1 175if [ -n "$do_asv1" ] ; then
5b67e4f8 176do_video_encoding asv1.avi "-qscale 10" "-an -vcodec asv1"
1de61a18 177do_video_decoding
9ca9fce1
MN
178fi
179
8d876a43 180if [ -n "$do_asv2" ] ; then
5b67e4f8 181do_video_encoding asv2.avi "-qscale 10" "-an -vcodec asv2"
1de61a18 182do_video_decoding
8d876a43
MN
183fi
184
bbdd42d3 185if [ -n "$do_flv" ] ; then
5b67e4f8 186do_video_encoding flv.flv "-qscale 10" "-an -vcodec flv"
1de61a18 187do_video_decoding
bbdd42d3
MN
188fi
189
f3203047 190if [ -n "$do_ffv1" ] ; then
5b67e4f8 191do_video_encoding ffv1.avi "-strict -2" "-an -vcodec ffv1"
1de61a18 192do_video_decoding
d13eef3d
MN
193fi
194
d13eef3d 195if [ -n "$do_snow" ] ; then
dd1c8f3e 196do_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"
5e5ac8e0 197do_video_decoding "" "-s 352x288"
e03c822a 198fi
d13eef3d 199
e03c822a 200if [ -n "$do_snowll" ] ; then
5b67e4f8 201do_video_encoding snow53.avi "-strict -2" "-an -vcodec snow -qscale .001 -pred 1 -flags +mv4+qpel"
1de61a18 202do_video_decoding
f3203047
MN
203fi
204
8fce2707 205if [ -n "$do_dv" ] ; then
5b67e4f8 206do_video_encoding dv.dv "-dct int" "-s pal -an"
5e5ac8e0 207do_video_decoding "" "-s cif"
77c3fb90 208
3e3c638e
MN
209do_video_encoding dv411.dv "-dct int" "-s pal -an -pix_fmt yuv411p -sws_flags area+accurate_rnd+bitexact"
210do_video_decoding "" "-s cif -sws_flags area+accurate_rnd+bitexact"
8fce2707
MN
211fi
212
0b297700 213if [ -n "$do_dv50" ] ; then
3e3c638e
MN
214do_video_encoding dv50.dv "-dct int" "-s pal -pix_fmt yuv422p -an -sws_flags neighbor+bitexact"
215do_video_decoding "" "-s cif -pix_fmt yuv420p -sws_flags neighbor+bitexact"
0b297700
DM
216fi
217
96fdb624 218if [ -n "$do_dnxhd_1080i" ] ; then
60820866 219# FIXME: interlaced raw DNxHD decoding is broken
3fdd8276
RD
220do_video_encoding dnxhd-1080i.mov "" "-vcodec dnxhd -flags +ildct -s hd1080 -b 120Mb -pix_fmt yuv422p -an"
221do_video_decoding "-r 25" "-s cif -pix_fmt yuv420p"
96fdb624 222fi
60820866 223
96fdb624 224if [ -n "$do_dnxhd_720p" ] ; then
3fdd8276
RD
225do_video_encoding dnxhd-720p.dnxhd "" "-s hd720 -b 90Mb -pix_fmt yuv422p -an"
226do_video_decoding "-r 25" "-s cif -pix_fmt yuv420p"
96fdb624 227fi
3fdd8276 228
96fdb624 229if [ -n "$do_dnxhd_720p_rd" ] ; then
a9b02043 230do_video_encoding dnxhd-720p-rd.dnxhd "" "-threads 4 -mbd rd -s hd720 -b 90Mb -pix_fmt yuv422p -an"
3fdd8276 231do_video_decoding "-r 25" "-s cif -pix_fmt yuv420p"
a5083f66
RD
232fi
233
b86bd1f1 234if [ -n "$do_svq1" ] ; then
5b67e4f8 235do_video_encoding svq1.mov "" "-an -vcodec svq1 -qscale 3 -pix_fmt yuv410p"
5e5ac8e0 236do_video_decoding "" "-pix_fmt yuv420p"
b86bd1f1
MN
237fi
238
d2f8f410 239if [ -n "$do_flashsv" ] ; then
3e3c638e
MN
240do_video_encoding flashsv.flv "" "-an -vcodec flashsv -sws_flags neighbor+full_chroma_int+accurate_rnd+bitexact"
241do_video_decoding "" "-pix_fmt yuv420p -sws_flags area+accurate_rnd+bitexact"
d2f8f410
MN
242fi
243
51133a7d 244if [ -n "$do_mp2" ] ; then
fb132953 245do_audio_encoding mp2.mp2 "-ar 44100"
fb132953 246do_audio_decoding
976709ee 247$tiny_psnr $pcm_dst $pcm_ref 2 1924 >> $logfile
51133a7d
FB
248fi
249
51133a7d 250if [ -n "$do_ac3" ] ; then
fb132953 251do_audio_encoding ac3.rm "" -vn
f77dddfc 252# binaries configured with --disable-sse decode ac3 differently
ede935a1
CEH
253#do_audio_decoding
254#$tiny_psnr $pcm_dst $pcm_ref 2 1024 >> $logfile
51133a7d
FB
255fi
256
311be1fb 257if [ -n "$do_g726" ] ; then
066a81a8 258do_audio_encoding g726.wav "-ar 44100" "-ab 32k -ac 1 -ar 8000 -acodec g726"
fb132953 259do_audio_decoding
311be1fb
MN
260fi
261
f02ab814 262if [ -n "$do_adpcm_ima_wav" ] ; then
fb132953 263do_audio_encoding adpcm_ima.wav "-ar 44100" "-acodec adpcm_ima_wav"
fb132953 264do_audio_decoding
f02ab814
MN
265fi
266
9dc92a38
KS
267if [ -n "$do_adpcm_ima_qt" ] ; then
268do_audio_encoding adpcm_qt.aiff "-ar 44100" "-acodec adpcm_ima_qt"
269do_audio_decoding
270fi
271
f02ab814 272if [ -n "$do_adpcm_ms" ] ; then
fb132953 273do_audio_encoding adpcm_ms.wav "-ar 44100" "-acodec adpcm_ms"
fb132953 274do_audio_decoding
f02ab814
MN
275fi
276
d8cbeba1 277if [ -n "$do_adpcm_yam" ] ; then
fb132953 278do_audio_encoding adpcm_yam.wav "-ar 44100" "-acodec adpcm_yamaha"
fb132953 279do_audio_decoding
d8cbeba1
MN
280fi
281
b529ab37 282if [ -n "$do_adpcm_swf" ] ; then
b529ab37
BL
283do_audio_encoding adpcm_swf.flv "-ar 44100" "-acodec adpcm_swf"
284do_audio_decoding
285fi
286
9797ce58
JR
287if [ -n "$do_alac" ] ; then
288do_audio_encoding alac.m4a "-ar 44100" "-acodec alac -compression_level 1"
289do_audio_decoding
290fi
291
aeb2904e 292if [ -n "$do_flac" ] ; then
fb132953 293do_audio_encoding flac.flac "-ar 44100" "-acodec flac -compression_level 2"
fb132953 294do_audio_decoding
aeb2904e
MN
295fi
296
6d3d8dae
MN
297if [ -n "$do_wma" ] ; then
298# wmav1
299do_audio_encoding wmav1.asf "-ar 44100" "-acodec wmav1"
9a5771e9 300do_ffmpeg_nomd5 $pcm_dst -i $target_path/$file -f wav
6d3d8dae
MN
301$tiny_psnr $pcm_dst $pcm_ref 2 8192 >> $logfile
302# wmav2
303do_audio_encoding wmav2.asf "-ar 44100" "-acodec wmav2"
9a5771e9 304do_ffmpeg_nomd5 $pcm_dst -i $target_path/$file -f wav
6d3d8dae
MN
305$tiny_psnr $pcm_dst $pcm_ref 2 8192 >> $logfile
306fi
307
0786943a 308#if [ -n "$do_vorbis" ] ; then
3160138f 309# vorbis
90b5b51e 310#disabled because it is broken
0786943a
MN
311#do_audio_encoding vorbis.asf "-ar 44100" "-acodec vorbis"
312#do_audio_decoding
313#fi
6d3d8dae 314
4f5c72e8
PR
315do_audio_enc_dec() {
316 do_audio_encoding $3.$1 "" "$4 -sample_fmt $2 -acodec $3"
317 do_audio_decoding
318}
319
320if [ -n "$do_pcm" ] ; then
321do_audio_enc_dec wav s16 pcm_alaw
322do_audio_enc_dec wav s16 pcm_mulaw
5e8ecfde
PR
323do_audio_enc_dec mov u8 pcm_s8
324do_audio_enc_dec wav u8 pcm_u8
4f5c72e8
PR
325do_audio_enc_dec mov s16 pcm_s16be
326do_audio_enc_dec wav s16 pcm_s16le
38511b9a
AJ
327do_audio_enc_dec mkv s16 pcm_s16be
328do_audio_enc_dec mkv s16 pcm_s16le
5e8ecfde
PR
329do_audio_enc_dec mov s32 pcm_s24be
330do_audio_enc_dec wav s32 pcm_s24le
331#do_audio_enc_dec ??? s32 pcm_u24be #no compatible muxer or demuxer
332#do_audio_enc_dec ??? s32 pcm_u24le #no compatible muxer or demuxer
333do_audio_enc_dec mov s32 pcm_s32be
334do_audio_enc_dec wav s32 pcm_s32le
335#do_audio_enc_dec ??? s32 pcm_u32be #no compatible muxer or demuxer
336#do_audio_enc_dec ??? s32 pcm_u32le #no compatible muxer or demuxer
4f5c72e8 337do_audio_enc_dec au flt pcm_f32be
6f18fe8c
PR
338do_audio_enc_dec wav flt pcm_f32le
339do_audio_enc_dec au dbl pcm_f64be
340do_audio_enc_dec wav dbl pcm_f64le
4f5c72e8
PR
341do_audio_enc_dec wav s16 pcm_zork
342do_audio_enc_dec 302 s16 pcm_s24daud "-ac 6 -ar 96000"
343fi
344
40e02409
SS
345# libavfilter testing
346
06d7f30a 347do_lavfi() {
40e02409
SS
348 test_name=$1
349 eval test=\$do_$test_name
350 vfilters=$2
351
352 if [ -n "$test" ] ; then
e935fa9e 353 do_video_encoding ${test_name}.avi "" "-vcodec rawvideo -vfilters $vfilters"
40e02409
SS
354 fi
355}
356
40e02409
SS
357# example tests:
358# do_lavfi "crop" "crop=100:100:-1:-1"
359# do_lavfi "crop_scale" "crop=100:100,scale=200:-1"
360# do_lavfi "scale" "scale=200:200"
361
362# TODO: add tests for
363# direct rendering,
364# slices
365# chains with feedback loops
366
4383ed5c 367rm -f "$bench" "$bench2"