Statistics
| Branch: | Revision:

ffmpeg / tests / codec-regression.sh @ e935fa9e

History | View | Annotate | Download (17.8 KB)

1
#!/bin/sh
2
#
3
# automatic regression test for ffmpeg
4
#
5
#
6
#set -x
7

    
8
set -e
9

    
10
target_exec=$5
11
target_path=$6
12

    
13
datadir="./tests/data"
14
target_datadir="${target_path}/${datadir}"
15

    
16
test="${1#regtest-}"
17
this="$test.$2"
18
logfile="$datadir/$this.regression"
19
outfile="$datadir/$4-"
20

    
21
eval do_$test=y
22

    
23
# various files
24
ffmpeg="$target_exec ${target_path}/ffmpeg_g"
25
tiny_psnr="tests/tiny_psnr"
26
benchfile="$datadir/$this.bench"
27
bench="$datadir/$this.bench.tmp"
28
bench2="$datadir/$this.bench2.tmp"
29
raw_src="${target_path}/$3/%02d.pgm"
30
raw_dst="$datadir/$this.out.yuv"
31
raw_ref="$datadir/$2.ref.yuv"
32
pcm_src="$target_datadir/asynth1.sw"
33
pcm_dst="$datadir/$this.out.wav"
34
pcm_ref="$datadir/$2.ref.wav"
35
crcfile="$datadir/$this.crc"
36
target_crcfile="$target_datadir/$this.crc"
37

    
38
if [ X"`echo | md5sum 2> /dev/null`" != X ]; then
39
    do_md5sum() { md5sum -b $1; }
40
elif [ X"`echo | md5 2> /dev/null`" != X ]; then
41
    do_md5sum() { md5 $1 | sed 's#MD5 (\(.*\)) = \(.*\)#\2 *\1#'; }
42
elif [ -x /sbin/md5 ]; then
43
    do_md5sum() { /sbin/md5 -r $1 | sed 's# \**\./# *./#'; }
44
else
45
    do_md5sum() { echo No md5sum program found; }
46
fi
47

    
48
FFMPEG_OPTS="-v 0 -y -flags +bitexact -dct fastint -idct simple -sws_flags +accurate_rnd+bitexact"
49

    
50
do_ffmpeg()
51
{
52
    f="$1"
53
    shift
54
    set -- $* ${target_path}/$f
55
    echo $ffmpeg $FFMPEG_OPTS $*
56
    $ffmpeg $FFMPEG_OPTS -benchmark $* > $bench
57
    do_md5sum $f >> $logfile
58
    if [ $f = $raw_dst ] ; then
59
        $tiny_psnr $f $raw_ref >> $logfile
60
    elif [ $f = $pcm_dst ] ; then
61
        $tiny_psnr $f $pcm_ref 2 >> $logfile
62
    else
63
        wc -c $f >> $logfile
64
    fi
65
    expr "`cat $bench`" : '.*utime=\(.*s\)' > $bench2
66
    echo `cat $bench2` $f >> $benchfile
67
}
68

    
69
do_ffmpeg_nomd5()
70
{
71
    f="$1"
72
    shift
73
    set -- $* ${target_path}/$f
74
    echo $ffmpeg $FFMPEG_OPTS $*
75
    $ffmpeg $FFMPEG_OPTS -benchmark $* > $bench
76
    if [ $f = $raw_dst ] ; then
77
        $tiny_psnr $f $raw_ref >> $logfile
78
    elif [ $f = $pcm_dst ] ; then
79
        $tiny_psnr $f $pcm_ref 2 >> $logfile
80
    else
81
        wc -c $f >> $logfile
82
    fi
83
    expr "`cat $bench`" : '.*utime=\(.*s\)' > $bench2
84
    echo `cat $bench2` $f >> $benchfile
85
}
86

    
87
do_ffmpeg_crc()
88
{
89
    f="$1"
90
    shift
91
    echo $ffmpeg $FFMPEG_OPTS $* -f crc "$target_crcfile"
92
    $ffmpeg $FFMPEG_OPTS $* -f crc "$target_crcfile"
93
    echo "$f `cat $crcfile`" >> $logfile
94
    rm -f "$crcfile"
95
}
96

    
97
do_ffmpeg_nocheck()
98
{
99
    f="$1"
100
    shift
101
    echo $ffmpeg $FFMPEG_OPTS $*
102
    $ffmpeg $FFMPEG_OPTS -benchmark $* > $bench
103
    expr "`cat $bench`" : '.*utime=\(.*s\)' > $bench2
104
    echo `cat $bench2` $f >> $benchfile
105
}
106

    
107
do_video_decoding()
108
{
109
    do_ffmpeg $raw_dst $1 -i $target_path/$file -f rawvideo $2
110
    rm -f $raw_dst
111
}
112

    
113
do_video_encoding()
114
{
115
    file=${outfile}$1
116
    do_ffmpeg $file $2 -f image2 -vcodec pgmyuv -i $raw_src $3
117
}
118

    
119
do_audio_encoding()
120
{
121
    file=${outfile}$1
122
    do_ffmpeg $file -ab 128k -ac 2 -f s16le -i $pcm_src $3
123
}
124

    
125
do_audio_decoding()
126
{
127
    do_ffmpeg $pcm_dst -i $target_path/$file -sample_fmt s16 -f wav
128
}
129

    
130
do_lavf()
131
{
132
    file=${outfile}lavf.$1
133
    do_ffmpeg $file -t 1 -qscale 10 -f image2 -vcodec pgmyuv -i $raw_src -f s16le -i $pcm_src $2
134
    do_ffmpeg_crc $file -i $target_path/$file $3
135
}
136

    
137
do_streamed_images()
138
{
139
    file=${outfile}${1}pipe.$1
140
    do_ffmpeg $file -t 1 -qscale 10 -f image2 -vcodec pgmyuv -i $raw_src -f image2pipe
141
    do_ffmpeg_crc $file -f image2pipe -i $target_path/$file
142
}
143

    
144
do_image_formats()
145
{
146
    file=${outfile}lavf%02d.$1
147
    echo $ffmpeg -t 0.5 -y -qscale 10 -f image2 -vcodec pgmyuv -i $raw_src $2 $3 -flags +bitexact -sws_flags +accurate_rnd+bitexact $target_path/$file
148
    $ffmpeg -t 0.5 -y -qscale 10 -f image2 -vcodec pgmyuv -i $raw_src $2 $3 -flags +bitexact -sws_flags +accurate_rnd+bitexact $target_path/$file
149
    do_md5sum ${outfile}lavf02.$1 >> $logfile
150
    do_ffmpeg_crc $file $3 -i $target_path/$file
151
    wc -c ${outfile}lavf02.$1 >> $logfile
152
}
153

    
154
do_audio_only()
155
{
156
    file=${outfile}lavf.$1
157
    do_ffmpeg $file -t 1 -qscale 10 -f s16le -i $pcm_src
158
    do_ffmpeg_crc $file -i $target_path/$file
159
}
160

    
161
rm -f "$logfile"
162
rm -f "$benchfile"
163

    
164
# generate reference for quality check
165
if [ -n "$do_ref" ]; then
166
do_ffmpeg_nocheck $raw_ref -f image2 -vcodec pgmyuv -i $raw_src -an -f rawvideo $target_path/$raw_ref
167
do_ffmpeg_nocheck $pcm_ref -ab 128k -ac 2 -ar 44100 -f s16le -i $pcm_src -f wav $target_path/$pcm_ref
168
fi
169

    
170
if [ -n "$do_mpeg" ] ; then
171
# mpeg1
172
do_video_encoding mpeg1.mpg "-qscale 10" "-f mpeg1video"
173
do_video_decoding
174
fi
175

    
176
if [ -n "$do_mpeg2" ] ; then
177
# mpeg2
178
do_video_encoding mpeg2.mpg "-qscale 10" "-vcodec mpeg2video -f mpeg1video"
179
do_video_decoding
180

    
181
# mpeg2 encoding intra vlc qprd
182
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"
183
do_video_decoding
184

    
185
#mpeg2 4:2:2 encoding
186
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"
187
do_video_decoding
188

    
189
# mpeg2
190
do_video_encoding mpeg2.mpg "-qscale 10" "-vcodec mpeg2video -idct int -dct int -f mpeg1video"
191
do_video_decoding "-idct int"
192

    
193
# mpeg2 encoding interlaced
194
do_video_encoding mpeg2i.mpg "-qscale 10" "-vcodec mpeg2video -f mpeg1video -flags +ildct+ilme"
195
do_video_decoding
196
fi
197

    
198
if [ -n "$do_mpeg2thread" ] ; then
199
# mpeg2 encoding interlaced
200
do_video_encoding mpeg2thread.mpg "-qscale 10" "-vcodec mpeg2video -f mpeg1video -bf 2 -flags +ildct+ilme -threads 2"
201
do_video_decoding
202

    
203
# mpeg2 encoding interlaced using intra vlc
204
do_video_encoding mpeg2threadivlc.mpg "-qscale 10" "-vcodec mpeg2video -f mpeg1video -bf 2 -flags +ildct+ilme -flags2 +ivlc -threads 2"
205
do_video_decoding
206

    
207
# mpeg2 encoding interlaced
208
file=${outfile}mpeg2reuse.mpg
209
do_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
210
do_video_decoding
211
fi
212

    
213
if [ -n "$do_msmpeg4v2" ] ; then
214
do_video_encoding msmpeg4v2.avi "-qscale 10" "-an -vcodec msmpeg4v2"
215
do_video_decoding
216
fi
217

    
218
if [ -n "$do_msmpeg4" ] ; then
219
do_video_encoding msmpeg4.avi "-qscale 10" "-an -vcodec msmpeg4"
220
do_video_decoding
221
fi
222

    
223
if [ -n "$do_wmv1" ] ; then
224
do_video_encoding wmv1.avi "-qscale 10" "-an -vcodec wmv1"
225
do_video_decoding
226
fi
227

    
228
if [ -n "$do_wmv2" ] ; then
229
do_video_encoding wmv2.avi "-qscale 10" "-an -vcodec wmv2"
230
do_video_decoding
231
fi
232

    
233
if [ -n "$do_h261" ] ; then
234
do_video_encoding h261.avi "-qscale 11" "-s 352x288 -an -vcodec h261"
235
do_video_decoding
236
fi
237

    
238
if [ -n "$do_h263" ] ; then
239
do_video_encoding h263.avi "-qscale 10" "-s 352x288 -an -vcodec h263"
240
do_video_decoding
241
fi
242

    
243
if [ -n "$do_h263p" ] ; then
244
do_video_encoding h263p.avi "-qscale 2 -flags +umv+aiv+aic" "-s 352x288 -an -vcodec h263p -ps 300"
245
do_video_decoding
246
fi
247

    
248
if [ -n "$do_mpeg4" ] ; then
249
do_video_encoding odivx.mp4 "-flags +mv4 -mbd bits -qscale 10" "-an -vcodec mpeg4"
250
do_video_decoding
251
fi
252

    
253
if [ -n "$do_huffyuv" ] ; then
254
do_video_encoding huffyuv.avi "" "-an -vcodec huffyuv -pix_fmt yuv422p -sws_flags neighbor+bitexact"
255
do_video_decoding "" "-strict -2 -pix_fmt yuv420p -sws_flags neighbor+bitexact"
256
fi
257

    
258
if [ -n "$do_rc" ] ; then
259
do_video_encoding mpeg4-rc.avi "-b 400k -bf 2" "-an -vcodec mpeg4"
260
do_video_decoding
261
fi
262

    
263
if [ -n "$do_mpeg4adv" ] ; then
264
do_video_encoding mpeg4-adv.avi "-qscale 9 -flags +mv4+part+aic -trellis 1 -mbd bits -ps 200" "-an -vcodec mpeg4"
265
do_video_decoding
266

    
267
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"
268
do_video_decoding
269

    
270
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"
271
do_video_decoding
272

    
273
do_video_encoding mpeg4-Q.avi "-qscale 7 -flags +mv4+qpel -mbd 2 -bf 2 -cmp 1 -subcmp 2" "-an -vcodec mpeg4"
274
do_video_decoding
275
fi
276

    
277
if [ -n "$do_mpeg4thread" ] ; then
278
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"
279
do_video_decoding
280
fi
281

    
282
if [ -n "$do_error" ] ; then
283
do_video_encoding error-mpeg4-adv.avi "-qscale 7 -flags +mv4+part+aic -mbd rd -ps 250 -error 10" "-an -vcodec mpeg4"
284
do_video_decoding
285
fi
286

    
287
if [ -n "$do_mpeg4nr" ] ; then
288
do_video_encoding mpeg4-nr.avi "-qscale 8 -flags +mv4 -mbd rd -nr 200" "-an -vcodec mpeg4"
289
do_video_decoding
290
fi
291

    
292
if [ -n "$do_mpeg1b" ] ; then
293
do_video_encoding mpeg1b.mpg "-qscale 8 -bf 3 -ps 200" "-an -vcodec mpeg1video -f mpeg1video"
294
do_video_decoding
295
fi
296

    
297
if [ -n "$do_mjpeg" ] ; then
298
do_video_encoding mjpeg.avi "-qscale 10" "-an -vcodec mjpeg -pix_fmt yuvj420p"
299
do_video_decoding "" "-pix_fmt yuv420p"
300
fi
301

    
302
if [ -n "$do_ljpeg" ] ; then
303
do_video_encoding ljpeg.avi "" "-an -vcodec ljpeg -strict -1"
304
do_video_decoding
305
fi
306

    
307
if [ -n "$do_jpegls" ] ; then
308
do_video_encoding jpegls.avi "" "-an -vcodec jpegls -vtag MJPG -sws_flags neighbor+full_chroma_int+accurate_rnd+bitexact"
309
do_video_decoding "" "-pix_fmt yuv420p  -sws_flags area+bitexact"
310
fi
311

    
312
if [ -n "$do_rv10" ] ; then
313
do_video_encoding rv10.rm "-qscale 10" "-an"
314
do_video_decoding
315
fi
316

    
317
if [ -n "$do_rv20" ] ; then
318
do_video_encoding rv20.rm "-qscale 10" "-vcodec rv20 -an"
319
do_video_decoding
320
fi
321

    
322
if [ -n "$do_asv1" ] ; then
323
do_video_encoding asv1.avi "-qscale 10" "-an -vcodec asv1"
324
do_video_decoding
325
fi
326

    
327
if [ -n "$do_asv2" ] ; then
328
do_video_encoding asv2.avi "-qscale 10" "-an -vcodec asv2"
329
do_video_decoding
330
fi
331

    
332
if [ -n "$do_flv" ] ; then
333
do_video_encoding flv.flv "-qscale 10" "-an -vcodec flv"
334
do_video_decoding
335
fi
336

    
337
if [ -n "$do_ffv1" ] ; then
338
do_video_encoding ffv1.avi "-strict -2" "-an -vcodec ffv1"
339
do_video_decoding
340
fi
341

    
342
if [ -n "$do_snow" ] ; then
343
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"
344
do_video_decoding "" "-s 352x288"
345
fi
346

    
347
if [ -n "$do_snowll" ] ; then
348
do_video_encoding snow53.avi "-strict -2" "-an -vcodec snow -qscale .001 -pred 1 -flags +mv4+qpel"
349
do_video_decoding
350
fi
351

    
352
if [ -n "$do_dv" ] ; then
353
do_video_encoding dv.dv "-dct int" "-s pal -an"
354
do_video_decoding "" "-s cif"
355

    
356
do_video_encoding dv411.dv "-dct int" "-s pal -an -pix_fmt yuv411p -sws_flags area+accurate_rnd+bitexact"
357
do_video_decoding "" "-s cif -sws_flags area+accurate_rnd+bitexact"
358
fi
359

    
360
if [ -n "$do_dv50" ] ; then
361
do_video_encoding dv50.dv "-dct int" "-s pal -pix_fmt yuv422p -an -sws_flags neighbor+bitexact"
362
do_video_decoding "" "-s cif -pix_fmt yuv420p -sws_flags neighbor+bitexact"
363
fi
364

    
365
if [ -n "$do_dnxhd_1080i" ] ; then
366
# FIXME: interlaced raw DNxHD decoding is broken
367
do_video_encoding dnxhd-1080i.mov "" "-vcodec dnxhd -flags +ildct -s hd1080 -b 120Mb -pix_fmt yuv422p -an"
368
do_video_decoding "-r 25" "-s cif -pix_fmt yuv420p"
369
fi
370

    
371
if [ -n "$do_dnxhd_720p" ] ; then
372
do_video_encoding dnxhd-720p.dnxhd "" "-s hd720 -b 90Mb -pix_fmt yuv422p -an"
373
do_video_decoding "-r 25" "-s cif -pix_fmt yuv420p"
374
fi
375

    
376
if [ -n "$do_dnxhd_720p_rd" ] ; then
377
do_video_encoding dnxhd-720p-rd.dnxhd "" "-mbd rd -s hd720 -b 90Mb -pix_fmt yuv422p -an"
378
do_video_decoding "-r 25" "-s cif -pix_fmt yuv420p"
379
fi
380

    
381
if [ -n "$do_svq1" ] ; then
382
do_video_encoding svq1.mov "" "-an -vcodec svq1 -qscale 3 -pix_fmt yuv410p"
383
do_video_decoding "" "-pix_fmt yuv420p"
384
fi
385

    
386
if [ -n "$do_flashsv" ] ; then
387
do_video_encoding flashsv.flv "" "-an -vcodec flashsv -sws_flags neighbor+full_chroma_int+accurate_rnd+bitexact"
388
do_video_decoding "" "-pix_fmt yuv420p -sws_flags area+accurate_rnd+bitexact"
389
fi
390

    
391
if [ -n "$do_mp2" ] ; then
392
do_audio_encoding mp2.mp2 "-ar 44100"
393
do_audio_decoding
394
$tiny_psnr $pcm_dst $pcm_ref 2 1924 >> $logfile
395
fi
396

    
397
if [ -n "$do_ac3" ] ; then
398
do_audio_encoding ac3.rm "" -vn
399
# binaries configured with --disable-sse decode ac3 differently
400
#do_audio_decoding
401
#$tiny_psnr $pcm_dst $pcm_ref 2 1024 >> $logfile
402
fi
403

    
404
if [ -n "$do_g726" ] ; then
405
do_audio_encoding g726.wav "-ar 44100" "-ab 32k -ac 1 -ar 8000 -acodec g726"
406
do_audio_decoding
407
fi
408

    
409
if [ -n "$do_adpcm_ima_wav" ] ; then
410
do_audio_encoding adpcm_ima.wav "-ar 44100" "-acodec adpcm_ima_wav"
411
do_audio_decoding
412
fi
413

    
414
if [ -n "$do_adpcm_ima_qt" ] ; then
415
do_audio_encoding adpcm_qt.aiff "-ar 44100" "-acodec adpcm_ima_qt"
416
do_audio_decoding
417
fi
418

    
419
if [ -n "$do_adpcm_ms" ] ; then
420
do_audio_encoding adpcm_ms.wav "-ar 44100" "-acodec adpcm_ms"
421
do_audio_decoding
422
fi
423

    
424
if [ -n "$do_adpcm_yam" ] ; then
425
do_audio_encoding adpcm_yam.wav "-ar 44100" "-acodec adpcm_yamaha"
426
do_audio_decoding
427
fi
428

    
429
if [ -n "$do_adpcm_swf" ] ; then
430
do_audio_encoding adpcm_swf.flv "-ar 44100" "-acodec adpcm_swf"
431
do_audio_decoding
432
fi
433

    
434
if [ -n "$do_flac" ] ; then
435
do_audio_encoding flac.flac "-ar 44100" "-acodec flac -compression_level 2"
436
do_audio_decoding
437
fi
438

    
439
if [ -n "$do_wma" ] ; then
440
# wmav1
441
do_audio_encoding wmav1.asf "-ar 44100" "-acodec wmav1"
442
do_ffmpeg_nomd5 $pcm_dst -i $target_path/$file -f wav
443
$tiny_psnr $pcm_dst $pcm_ref 2 8192 >> $logfile
444
# wmav2
445
do_audio_encoding wmav2.asf "-ar 44100" "-acodec wmav2"
446
do_ffmpeg_nomd5 $pcm_dst -i $target_path/$file -f wav
447
$tiny_psnr $pcm_dst $pcm_ref 2 8192 >> $logfile
448
fi
449

    
450
#if [ -n "$do_vorbis" ] ; then
451
# vorbis
452
#disabled because it is broken
453
#do_audio_encoding vorbis.asf "-ar 44100" "-acodec vorbis"
454
#do_audio_decoding
455
#fi
456

    
457
do_audio_enc_dec() {
458
    do_audio_encoding $3.$1 "" "$4 -sample_fmt $2 -acodec $3"
459
    do_audio_decoding
460
}
461

    
462
if [ -n "$do_pcm" ] ; then
463
do_audio_enc_dec wav s16 pcm_alaw
464
do_audio_enc_dec wav s16 pcm_mulaw
465
do_audio_enc_dec mov u8 pcm_s8
466
do_audio_enc_dec wav u8 pcm_u8
467
do_audio_enc_dec mov s16 pcm_s16be
468
do_audio_enc_dec wav s16 pcm_s16le
469
do_audio_enc_dec mkv s16 pcm_s16be
470
do_audio_enc_dec mkv s16 pcm_s16le
471
do_audio_enc_dec mov s32 pcm_s24be
472
do_audio_enc_dec wav s32 pcm_s24le
473
#do_audio_enc_dec ??? s32 pcm_u24be #no compatible muxer or demuxer
474
#do_audio_enc_dec ??? s32 pcm_u24le #no compatible muxer or demuxer
475
do_audio_enc_dec mov s32 pcm_s32be
476
do_audio_enc_dec wav s32 pcm_s32le
477
#do_audio_enc_dec ??? s32 pcm_u32be #no compatible muxer or demuxer
478
#do_audio_enc_dec ??? s32 pcm_u32le #no compatible muxer or demuxer
479
do_audio_enc_dec au  flt pcm_f32be
480
do_audio_enc_dec wav flt pcm_f32le
481
do_audio_enc_dec au  dbl pcm_f64be
482
do_audio_enc_dec wav dbl pcm_f64le
483
do_audio_enc_dec wav s16 pcm_zork
484
do_audio_enc_dec 302 s16 pcm_s24daud "-ac 6 -ar 96000"
485
fi
486

    
487
# libavformat testing
488

    
489
if [ -n "$do_avi" ] ; then
490
do_lavf avi
491
fi
492

    
493
if [ -n "$do_asf" ] ; then
494
do_lavf asf "-acodec mp2" "-r 25"
495
fi
496

    
497
if [ -n "$do_rm" ] ; then
498
file=${outfile}lavf.rm
499
do_ffmpeg $file -t 1 -qscale 10 -f image2 -vcodec pgmyuv -i $raw_src -f s16le -i $pcm_src
500
# broken
501
#do_ffmpeg_crc $file -i $target_path/$file
502
fi
503

    
504
if [ -n "$do_mpg" ] ; then
505
do_lavf mpg
506
fi
507

    
508
if [ -n "$do_mxf" ] ; then
509
do_lavf mxf "-ar 48000 -bf 2 -timecode_frame_start 264363"
510
do_lavf mxf_d10 "-ar 48000 -ac 2 -r 25 -s 720x576 -padtop 32 -vcodec mpeg2video -intra -flags +ildct+low_delay -dc 10 -flags2 +ivlc+non_linear_q -qscale 1 -ps 1 -qmin 1 -rc_max_vbv_use 1 -rc_min_vbv_use 1 -pix_fmt yuv422p -minrate 30000k -maxrate 30000k -b 30000k -bufsize 1200000 -top 1 -rc_init_occupancy 1200000 -qmax 12 -f mxf_d10"
511
fi
512

    
513
if [ -n "$do_ts" ] ; then
514
do_lavf ts
515
fi
516

    
517
if [ -n "$do_swf" ] ; then
518
do_lavf swf -an
519
fi
520

    
521
if [ -n "$do_ffm" ] ; then
522
do_lavf ffm
523
fi
524

    
525
if [ -n "$do_flv_fmt" ] ; then
526
do_lavf flv -an
527
fi
528

    
529
if [ -n "$do_mov" ] ; then
530
do_lavf mov "-acodec pcm_alaw"
531
fi
532

    
533
if [ -n "$do_dv_fmt" ] ; then
534
do_lavf dv "-ar 48000 -r 25 -s pal -ac 2"
535
fi
536

    
537
if [ -n "$do_gxf" ] ; then
538
do_lavf gxf "-ar 48000 -r 25 -s pal -ac 1"
539
fi
540

    
541
if [ -n "$do_nut" ] ; then
542
do_lavf nut "-acodec mp2"
543
fi
544

    
545
if [ -n "$do_mkv" ] ; then
546
do_lavf mkv
547
fi
548

    
549

    
550
# streamed images
551
# mjpeg
552
#file=${outfile}lavf.mjpeg
553
#do_ffmpeg $file -t 1 -qscale 10 -f image2 -vcodec pgmyuv -i $raw_src
554
#do_ffmpeg_crc $file -i $target_path/$file
555

    
556
if [ -n "$do_pbmpipe" ] ; then
557
do_streamed_images pbm
558
fi
559

    
560
if [ -n "$do_pgmpipe" ] ; then
561
do_streamed_images pgm
562
fi
563

    
564
if [ -n "$do_ppmpipe" ] ; then
565
do_streamed_images ppm
566
fi
567

    
568
if [ -n "$do_gif" ] ; then
569
file=${outfile}lavf.gif
570
do_ffmpeg $file -t 1 -qscale 10 -f image2 -vcodec pgmyuv -i $raw_src -pix_fmt rgb24
571
#do_ffmpeg_crc $file -i $target_path/$file
572
fi
573

    
574
if [ -n "$do_yuv4mpeg" ] ; then
575
file=${outfile}lavf.y4m
576
do_ffmpeg $file -t 1 -qscale 10 -f image2 -vcodec pgmyuv -i $raw_src
577
#do_ffmpeg_crc $file -i $target_path/$file
578
fi
579

    
580
# image formats
581

    
582
if [ -n "$do_pgm" ] ; then
583
do_image_formats pgm
584
fi
585

    
586
if [ -n "$do_ppm" ] ; then
587
do_image_formats ppm
588
fi
589

    
590
if [ -n "$do_bmp" ] ; then
591
do_image_formats bmp
592
fi
593

    
594
if [ -n "$do_tga" ] ; then
595
do_image_formats tga
596
fi
597

    
598
if [ -n "$do_tiff" ] ; then
599
do_image_formats tiff "-pix_fmt rgb24"
600
fi
601

    
602
if [ -n "$do_sgi" ] ; then
603
do_image_formats sgi
604
fi
605

    
606
if [ -n "$do_jpg" ] ; then
607
do_image_formats jpg "-flags +bitexact -dct fastint -idct simple -pix_fmt yuvj420p" "-f image2"
608
fi
609

    
610
if [ -n "$do_pcx" ] ; then
611
do_image_formats pcx
612
fi
613

    
614
# audio only
615

    
616
if [ -n "$do_wav" ] ; then
617
do_audio_only wav
618
fi
619

    
620
if [ -n "$do_alaw" ] ; then
621
do_audio_only al
622
fi
623

    
624
if [ -n "$do_mulaw" ] ; then
625
do_audio_only ul
626
fi
627

    
628
if [ -n "$do_au" ] ; then
629
do_audio_only au
630
fi
631

    
632
if [ -n "$do_mmf" ] ; then
633
do_audio_only mmf
634
fi
635

    
636
if [ -n "$do_aiff" ] ; then
637
do_audio_only aif
638
fi
639

    
640
if [ -n "$do_voc" ] ; then
641
do_audio_only voc
642
fi
643

    
644
if [ -n "$do_ogg" ] ; then
645
do_audio_only ogg
646
fi
647

    
648
# pix_fmt conversions
649

    
650
if [ -n "$do_pixfmt" ] ; then
651
conversions="yuv420p yuv422p yuv444p yuyv422 yuv410p yuv411p yuvj420p \
652
             yuvj422p yuvj444p rgb24 bgr24 rgb32 rgb565 rgb555 gray monow \
653
             monob yuv440p yuvj440p"
654
for pix_fmt in $conversions ; do
655
    file=${outfile}lavf-${pix_fmt}.yuv
656
    do_ffmpeg_nocheck $file -r 1 -t 1 -f image2 -vcodec pgmyuv -i $raw_src \
657
                            -f rawvideo -s 352x288 -pix_fmt $pix_fmt $target_path/$raw_dst
658
    do_ffmpeg $file -f rawvideo -s 352x288 -pix_fmt $pix_fmt -i $target_path/$raw_dst \
659
                    -f rawvideo -s 352x288 -pix_fmt yuv444p
660
done
661
fi
662

    
663
# libavfilter testing
664

    
665
do_lavfi() {
666
    test_name=$1
667
    eval test=\$do_$test_name
668
    vfilters=$2
669

    
670
    if [ -n "$test" ] ; then
671
        do_video_encoding ${test_name}.avi "" "-vcodec rawvideo -vfilters $vfilters"
672
    fi
673
}
674

    
675
# example tests:
676
# do_lavfi "crop" "crop=100:100:-1:-1"
677
# do_lavfi "crop_scale" "crop=100:100,scale=200:-1"
678
# do_lavfi "scale" "scale=200:200"
679

    
680
# TODO: add tests for
681
# direct rendering,
682
# slices
683
# chains with feedback loops
684

    
685
rm -f "$bench" "$bench2"