codec-regression.sh 17.3 KB
Newer Older
1
2
3
4
5
6
#!/bin/sh
#
# automatic regression test for ffmpeg
#
#
#set -x
Michael Niedermayer's avatar
diff -w    
Michael Niedermayer committed
7

8
9
set -e

10
11
12
target_exec=$5
target_path=$6

13
datadir="./tests/data"
14
target_datadir="${target_path}/${datadir}"
Fabrice Bellard's avatar
Fabrice Bellard committed
15

16
17
18
test="${1#regtest-}"
this="$test.$2"
logfile="$datadir/$this.regression"
Måns Rullgård's avatar
Måns Rullgård committed
19
outfile="$datadir/$4-"
Fabrice Bellard's avatar
Fabrice Bellard committed
20

21
22
eval do_$test=y

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

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

Diego Biurrun's avatar
Diego Biurrun committed
48
# create the data directory if it does not exist
Fabrice Bellard's avatar
Fabrice Bellard committed
49
mkdir -p $datadir
50

51
FFMPEG_OPTS="-y -flags +bitexact -dct fastint -idct simple -sws_flags +accurate_rnd+bitexact"
52

53
do_ffmpeg()
54
{
55
    f="$1"
56
    shift
57
    set -- $* ${target_path}/$f
58
    echo $ffmpeg $FFMPEG_OPTS $*
59
    $ffmpeg $FFMPEG_OPTS -benchmark $* > $bench 2> /tmp/ffmpeg$$
60
    egrep -v "^(Stream|Press|Input|Output|frame|  Stream|  Duration|video:)" /tmp/ffmpeg$$ || true
61
    rm -f /tmp/ffmpeg$$
62
63
64
65
66
    do_md5sum $f >> $logfile
    if [ $f = $raw_dst ] ; then
        $tiny_psnr $f $raw_ref >> $logfile
    elif [ $f = $pcm_dst ] ; then
        $tiny_psnr $f $pcm_ref 2 >> $logfile
67
    else
68
        wc -c $f >> $logfile
69
    fi
70
    expr "`cat $bench`" : '.*utime=\(.*s\)' > $bench2
71
    echo `cat $bench2` $f >> $benchfile
72
73
}

74
75
76
77
do_ffmpeg_nomd5()
{
    f="$1"
    shift
78
    set -- $* ${target_path}/$f
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
    echo $ffmpeg $FFMPEG_OPTS $*
    $ffmpeg $FFMPEG_OPTS -benchmark $* > $bench 2> /tmp/ffmpeg$$
    egrep -v "^(Stream|Press|Input|Output|frame|  Stream|  Duration|video:)" /tmp/ffmpeg$$ || true
    rm -f /tmp/ffmpeg$$
    if [ $f = $raw_dst ] ; then
        $tiny_psnr $f $raw_ref >> $logfile
    elif [ $f = $pcm_dst ] ; then
        $tiny_psnr $f $pcm_ref 2 >> $logfile
    else
        wc -c $f >> $logfile
    fi
    expr "`cat $bench`" : '.*utime=\(.*s\)' > $bench2
    echo `cat $bench2` $f >> $benchfile
}

94
do_ffmpeg_crc()
Fabrice Bellard's avatar
Fabrice Bellard committed
95
{
96
    f="$1"
Fabrice Bellard's avatar
Fabrice Bellard committed
97
    shift
98
99
    echo $ffmpeg $FFMPEG_OPTS $* -f crc "$target_crcfile"
    $ffmpeg $FFMPEG_OPTS $* -f crc "$target_crcfile" > /tmp/ffmpeg$$ 2>&1
100
    egrep -v "^(Stream|Press|Input|Output|frame|  Stream|  Duration|video:|ffmpeg version|  configuration|  built)" /tmp/ffmpeg$$ || true
101
    rm -f /tmp/ffmpeg$$
Måns Rullgård's avatar
Måns Rullgård committed
102
103
    echo "$f `cat $crcfile`" >> $logfile
    rm -f "$crcfile"
Fabrice Bellard's avatar
Fabrice Bellard committed
104
}
105

106
107
do_ffmpeg_nocheck()
{
108
    f="$1"
109
    shift
110
    echo $ffmpeg $FFMPEG_OPTS $*
111
    $ffmpeg $FFMPEG_OPTS -benchmark $* > $bench 2> /tmp/ffmpeg$$
112
    egrep -v "^(Stream|Press|Input|Output|frame|  Stream|  Duration|video:)" /tmp/ffmpeg$$ || true
113
    rm -f /tmp/ffmpeg$$
114
    expr "`cat $bench`" : '.*utime=\(.*s\)' > $bench2
115
    echo `cat $bench2` $f >> $benchfile
116
117
}

118
119
do_video_decoding()
{
120
    do_ffmpeg $raw_dst $1 -i $target_path/$file -f rawvideo $2
121
    rm -f $raw_dst
122
123
124
125
}

do_video_encoding()
{
126
    file=${outfile}$1
127
    do_ffmpeg $file $2 -f image2 -vcodec pgmyuv -i $raw_src $3
128
129
}

130
131
132
do_audio_encoding()
{
    file=${outfile}$1
133
    do_ffmpeg $file -ab 128k -ac 2 -f s16le -i $pcm_src $3
134
135
136
137
}

do_audio_decoding()
{
138
    do_ffmpeg $pcm_dst -i $target_path/$file -sample_fmt s16 -f wav
139
140
}

141
do_lavf()
Diego Biurrun's avatar
Diego Biurrun committed
142
143
{
    file=${outfile}libav.$1
144
145
    do_ffmpeg $file -t 1 -qscale 10 -f image2 -vcodec pgmyuv -i $raw_src -f s16le -i $pcm_src $2
    do_ffmpeg_crc $file -i $target_path/$file $3
Diego Biurrun's avatar
Diego Biurrun committed
146
147
}

148
149
do_streamed_images()
{
Måns Rullgård's avatar
Måns Rullgård committed
150
    file=${outfile}${1}pipe.$1
151
152
    do_ffmpeg $file -t 1 -qscale 10 -f image2 -vcodec pgmyuv -i $raw_src -f image2pipe
    do_ffmpeg_crc $file -f image2pipe -i $target_path/$file
153
154
}

155
156
157
do_image_formats()
{
    file=${outfile}libav%02d.$1
158
    $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
159
    do_md5sum ${outfile}libav02.$1 >> $logfile
160
    do_ffmpeg_crc $file $3 -i $target_path/$file
161
    wc -c ${outfile}libav02.$1 >> $logfile
162
163
}

164
165
166
do_audio_only()
{
    file=${outfile}libav.$1
167
168
    do_ffmpeg $file -t 1 -qscale 10 -f s16le -i $pcm_src
    do_ffmpeg_crc $file -i $target_path/$file
169
170
}

171
172
rm -f "$logfile"
rm -f "$benchfile"
173

174
# generate reference for quality check
175
if [ -n "$do_ref" ]; then
176
177
do_ffmpeg_nocheck $raw_ref -f image2 -vcodec pgmyuv -i $raw_src -an -f rawvideo $target_path/$raw_ref
do_ffmpeg_nocheck $pcm_ref -ab 128k -ac 2 -ar 44100 -f s16le -i $pcm_src -f wav $target_path/$pcm_ref
178
fi
179

180
if [ -n "$do_mpeg" ] ; then
Diego Biurrun's avatar
Diego Biurrun committed
181
# mpeg1
182
do_video_encoding mpeg1.mpg "-qscale 10" "-f mpeg1video"
183
do_video_decoding
Michael Niedermayer's avatar
Michael Niedermayer committed
184
185
186
fi

if [ -n "$do_mpeg2" ] ; then
Diego Biurrun's avatar
Diego Biurrun committed
187
# mpeg2
188
do_video_encoding mpeg2.mpg "-qscale 10" "-vcodec mpeg2video -f mpeg1video"
189
do_video_decoding
190

191
# mpeg2 encoding intra vlc qprd
192
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"
193
do_video_decoding
194

195
#mpeg2 4:2:2 encoding
196
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"
197
198
do_video_decoding

Diego Biurrun's avatar
Diego Biurrun committed
199
# mpeg2
200
do_video_encoding mpeg2.mpg "-qscale 10" "-vcodec mpeg2video -idct int -dct int -f mpeg1video"
201
do_video_decoding "-idct int"
Michael Niedermayer's avatar
Michael Niedermayer committed
202

203
# mpeg2 encoding interlaced
204
do_video_encoding mpeg2i.mpg "-qscale 10" "-vcodec mpeg2video -f mpeg1video -flags +ildct+ilme"
205
do_video_decoding
206
207
fi

208
209
if [ -n "$do_mpeg2thread" ] ; then
# mpeg2 encoding interlaced
210
do_video_encoding mpeg2thread.mpg "-qscale 10" "-vcodec mpeg2video -f mpeg1video -bf 2 -flags +ildct+ilme -threads 2"
211
do_video_decoding
212
213

# mpeg2 encoding interlaced using intra vlc
214
do_video_encoding mpeg2threadivlc.mpg "-qscale 10" "-vcodec mpeg2video -f mpeg1video -bf 2 -flags +ildct+ilme -flags2 +ivlc -threads 2"
215
do_video_decoding
216
217
218

# mpeg2 encoding interlaced
file=${outfile}mpeg2reuse.mpg
219
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
220
do_video_decoding
221
222
fi

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

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

233
if [ -n "$do_wmv1" ] ; then
234
do_video_encoding wmv1.avi "-qscale 10" "-an -vcodec wmv1"
235
do_video_decoding
236
237
fi

238
if [ -n "$do_wmv2" ] ; then
239
do_video_encoding wmv2.avi "-qscale 10" "-an -vcodec wmv2"
240
do_video_decoding
241
242
fi

Michael Niedermayer's avatar
Michael Niedermayer committed
243
if [ -n "$do_h261" ] ; then
244
do_video_encoding h261.avi "-qscale 11" "-s 352x288 -an -vcodec h261"
245
do_video_decoding
Michael Niedermayer's avatar
Michael Niedermayer committed
246
247
fi

248
if [ -n "$do_h263" ] ; then
249
do_video_encoding h263.avi "-qscale 10" "-s 352x288 -an -vcodec h263"
250
do_video_decoding
251
252
253
fi

if [ -n "$do_h263p" ] ; then
254
do_video_encoding h263p.avi "-qscale 2 -flags +umv+aiv+aic" "-s 352x288 -an -vcodec h263p -ps 300"
255
do_video_decoding
256
257
258
fi

if [ -n "$do_mpeg4" ] ; then
259
do_video_encoding odivx.mp4 "-flags +mv4 -mbd bits -qscale 10" "-an -vcodec mpeg4"
260
do_video_decoding
261
262
fi

263
if [ -n "$do_huffyuv" ] ; then
264
265
do_video_encoding huffyuv.avi "" "-an -vcodec huffyuv -pix_fmt yuv422p -sws_flags neighbor+bitexact"
do_video_decoding "" "-strict -2 -pix_fmt yuv420p -sws_flags neighbor+bitexact"
266
267
fi

268
if [ -n "$do_rc" ] ; then
269
do_video_encoding mpeg4-rc.avi "-b 400k -bf 2" "-an -vcodec mpeg4"
270
do_video_decoding
271
272
273
fi

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

277
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"
278
279
do_video_decoding

280
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"
281
do_video_decoding
282

283
do_video_encoding mpeg4-Q.avi "-qscale 7 -flags +mv4+qpel -mbd 2 -bf 2 -cmp 1 -subcmp 2" "-an -vcodec mpeg4"
284
do_video_decoding
285
286
fi

287
if [ -n "$do_mpeg4thread" ] ; then
288
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"
289
do_video_decoding
290
291
fi

292
if [ -n "$do_error" ] ; then
293
do_video_encoding error-mpeg4-adv.avi "-qscale 7 -flags +mv4+part+aic -mbd rd -ps 250 -error 10" "-an -vcodec mpeg4"
294
do_video_decoding
295
296
fi

297
if [ -n "$do_mpeg4nr" ] ; then
298
do_video_encoding mpeg4-nr.avi "-qscale 8 -flags +mv4 -mbd rd -nr 200" "-an -vcodec mpeg4"
299
do_video_decoding
300
301
fi

302
if [ -n "$do_mpeg1b" ] ; then
303
do_video_encoding mpeg1b.mpg "-qscale 8 -bf 3 -ps 200" "-an -vcodec mpeg1video -f mpeg1video"
304
do_video_decoding
305
306
fi

307
if [ -n "$do_mjpeg" ] ; then
308
do_video_encoding mjpeg.avi "-qscale 10" "-an -vcodec mjpeg -pix_fmt yuvj420p"
309
do_video_decoding "" "-pix_fmt yuv420p"
310
311
fi

312
if [ -n "$do_ljpeg" ] ; then
313
do_video_encoding ljpeg.avi "" "-an -vcodec ljpeg -strict -1"
314
do_video_decoding
315
316
fi

Michael Niedermayer's avatar
Michael Niedermayer committed
317
if [ -n "$do_jpegls" ] ; then
318
319
do_video_encoding jpegls.avi "" "-an -vcodec jpegls -vtag MJPG -sws_flags neighbor+full_chroma_int+accurate_rnd+bitexact"
do_video_decoding "" "-pix_fmt yuv420p  -sws_flags area+bitexact"
Michael Niedermayer's avatar
Michael Niedermayer committed
320
321
fi

322
if [ -n "$do_rv10" ] ; then
323
do_video_encoding rv10.rm "-qscale 10" "-an"
324
do_video_decoding
325
326
fi

Michael Niedermayer's avatar
Michael Niedermayer committed
327
if [ -n "$do_rv20" ] ; then
328
do_video_encoding rv20.rm "-qscale 10" "-vcodec rv20 -an"
329
do_video_decoding
Michael Niedermayer's avatar
Michael Niedermayer committed
330
331
fi

Michael Niedermayer's avatar
Michael Niedermayer committed
332
if [ -n "$do_asv1" ] ; then
333
do_video_encoding asv1.avi "-qscale 10" "-an -vcodec asv1"
334
do_video_decoding
Michael Niedermayer's avatar
Michael Niedermayer committed
335
336
fi

Michael Niedermayer's avatar
Michael Niedermayer committed
337
if [ -n "$do_asv2" ] ; then
338
do_video_encoding asv2.avi "-qscale 10" "-an -vcodec asv2"
339
do_video_decoding
Michael Niedermayer's avatar
Michael Niedermayer committed
340
341
fi

Michael Niedermayer's avatar
Michael Niedermayer committed
342
if [ -n "$do_flv" ] ; then
343
do_video_encoding flv.flv "-qscale 10" "-an -vcodec flv"
344
do_video_decoding
Michael Niedermayer's avatar
Michael Niedermayer committed
345
346
fi

Michael Niedermayer's avatar
Michael Niedermayer committed
347
if [ -n "$do_ffv1" ] ; then
348
do_video_encoding ffv1.avi "-strict -2" "-an -vcodec ffv1"
349
do_video_decoding
Michael Niedermayer's avatar
Michael Niedermayer committed
350
351
352
fi

if [ -n "$do_snow" ] ; then
353
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"
354
do_video_decoding "" "-s 352x288"
Michael Niedermayer's avatar
Michael Niedermayer committed
355
fi
Michael Niedermayer's avatar
Michael Niedermayer committed
356

Michael Niedermayer's avatar
Michael Niedermayer committed
357
if [ -n "$do_snowll" ] ; then
358
do_video_encoding snow53.avi "-strict -2" "-an -vcodec snow -qscale .001 -pred 1 -flags +mv4+qpel"
359
do_video_decoding
Michael Niedermayer's avatar
Michael Niedermayer committed
360
361
fi

Michael Niedermayer's avatar
Michael Niedermayer committed
362
if [ -n "$do_dv" ] ; then
363
do_video_encoding dv.dv "-dct int" "-s pal -an"
364
do_video_decoding "" "-s cif"
365

366
367
do_video_encoding dv411.dv "-dct int" "-s pal -an -pix_fmt yuv411p -sws_flags area+accurate_rnd+bitexact"
do_video_decoding "" "-s cif -sws_flags area+accurate_rnd+bitexact"
Michael Niedermayer's avatar
Michael Niedermayer committed
368
369
fi

Daniel Maas's avatar
Daniel Maas committed
370
if [ -n "$do_dv50" ] ; then
371
372
do_video_encoding dv50.dv "-dct int" "-s pal -pix_fmt yuv422p -an -sws_flags neighbor+bitexact"
do_video_decoding "" "-s cif -pix_fmt yuv420p -sws_flags neighbor+bitexact"
Daniel Maas's avatar
Daniel Maas committed
373
374
fi

Michael Niedermayer's avatar
Michael Niedermayer committed
375
if [ -n "$do_svq1" ] ; then
376
do_video_encoding svq1.mov "" "-an -vcodec svq1 -qscale 3 -pix_fmt yuv410p"
377
do_video_decoding "" "-pix_fmt yuv420p"
Michael Niedermayer's avatar
Michael Niedermayer committed
378
379
fi

Michael Niedermayer's avatar
Michael Niedermayer committed
380
if [ -n "$do_flashsv" ] ; then
381
382
do_video_encoding flashsv.flv "" "-an -vcodec flashsv -sws_flags neighbor+full_chroma_int+accurate_rnd+bitexact"
do_video_decoding "" "-pix_fmt yuv420p -sws_flags area+accurate_rnd+bitexact"
Michael Niedermayer's avatar
Michael Niedermayer committed
383
384
fi

385
if [ -n "$do_mp2" ] ; then
386
387
do_audio_encoding mp2.mp2 "-ar 44100"
do_audio_decoding
388
$tiny_psnr $pcm_dst $pcm_ref 2 1924 >> $logfile
389
390
391
fi

if [ -n "$do_ac3" ] ; then
392
do_audio_encoding ac3.rm "" -vn
393
394
395
# gcc 2.95.3 compiled binaries decode ac3 differently because of missing SSE support
#do_audio_decoding
#$tiny_psnr $pcm_dst $pcm_ref 2 1024 >> $logfile
396
397
fi

Michael Niedermayer's avatar
Michael Niedermayer committed
398
if [ -n "$do_g726" ] ; then
399
do_audio_encoding g726.wav "-ar 44100" "-ab 32k -ac 1 -ar 8000 -acodec g726"
400
do_audio_decoding
Michael Niedermayer's avatar
Michael Niedermayer committed
401
402
fi

403
if [ -n "$do_adpcm_ima_wav" ] ; then
404
405
do_audio_encoding adpcm_ima.wav "-ar 44100" "-acodec adpcm_ima_wav"
do_audio_decoding
406
407
fi

408
409
410
411
412
if [ -n "$do_adpcm_ima_qt" ] ; then
do_audio_encoding adpcm_qt.aiff "-ar 44100" "-acodec adpcm_ima_qt"
do_audio_decoding
fi

413
if [ -n "$do_adpcm_ms" ] ; then
414
415
do_audio_encoding adpcm_ms.wav "-ar 44100" "-acodec adpcm_ms"
do_audio_decoding
416
417
fi

418
if [ -n "$do_adpcm_yam" ] ; then
419
420
do_audio_encoding adpcm_yam.wav "-ar 44100" "-acodec adpcm_yamaha"
do_audio_decoding
421
422
fi

423
424
425
426
427
if [ -n "$do_adpcm_swf" ] ; then
do_audio_encoding adpcm_swf.flv "-ar 44100" "-acodec adpcm_swf"
do_audio_decoding
fi

Michael Niedermayer's avatar
Michael Niedermayer committed
428
if [ -n "$do_flac" ] ; then
429
430
do_audio_encoding flac.flac "-ar 44100" "-acodec flac -compression_level 2"
do_audio_decoding
Michael Niedermayer's avatar
Michael Niedermayer committed
431
432
fi

Michael Niedermayer's avatar
Michael Niedermayer committed
433
434
435
if [ -n "$do_wma" ] ; then
# wmav1
do_audio_encoding wmav1.asf "-ar 44100" "-acodec wmav1"
436
do_ffmpeg_nomd5 $pcm_dst -i $target_path/$file -f wav
Michael Niedermayer's avatar
Michael Niedermayer committed
437
438
439
$tiny_psnr $pcm_dst $pcm_ref 2 8192 >> $logfile
# wmav2
do_audio_encoding wmav2.asf "-ar 44100" "-acodec wmav2"
440
do_ffmpeg_nomd5 $pcm_dst -i $target_path/$file -f wav
Michael Niedermayer's avatar
Michael Niedermayer committed
441
442
443
$tiny_psnr $pcm_dst $pcm_ref 2 8192 >> $logfile
fi

444
#if [ -n "$do_vorbis" ] ; then
Michael Niedermayer's avatar
Michael Niedermayer committed
445
# vorbis
Diego Biurrun's avatar
Diego Biurrun committed
446
#disabled because it is broken
447
448
449
#do_audio_encoding vorbis.asf "-ar 44100" "-acodec vorbis"
#do_audio_decoding
#fi
Michael Niedermayer's avatar
Michael Niedermayer committed
450

Peter Ross's avatar
Peter Ross committed
451
452
453
454
455
456
457
458
do_audio_enc_dec() {
    do_audio_encoding $3.$1 "" "$4 -sample_fmt $2 -acodec $3"
    do_audio_decoding
}

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

Diego Biurrun's avatar
Diego Biurrun committed
481
# libavformat testing
Fabrice Bellard's avatar
Fabrice Bellard committed
482

Måns Rullgård's avatar
Måns Rullgård committed
483
if [ -n "$do_avi" ] ; then
484
do_lavf avi
Måns Rullgård's avatar
Måns Rullgård committed
485
fi
Fabrice Bellard's avatar
Fabrice Bellard committed
486

Måns Rullgård's avatar
Måns Rullgård committed
487
if [ -n "$do_asf" ] ; then
488
do_lavf asf "-acodec mp2" "-r 25"
Måns Rullgård's avatar
Måns Rullgård committed
489
fi
Fabrice Bellard's avatar
Fabrice Bellard committed
490

Måns Rullgård's avatar
Måns Rullgård committed
491
if [ -n "$do_rm" ] ; then
Fabrice Bellard's avatar
Fabrice Bellard committed
492
file=${outfile}libav.rm
493
do_ffmpeg $file -t 1 -qscale 10 -f image2 -vcodec pgmyuv -i $raw_src -f s16le -i $pcm_src
Fabrice Bellard's avatar
Fabrice Bellard committed
494
# broken
495
#do_ffmpeg_crc $file -i $target_path/$file
Måns Rullgård's avatar
Måns Rullgård committed
496
fi
Fabrice Bellard's avatar
Fabrice Bellard committed
497

Måns Rullgård's avatar
Måns Rullgård committed
498
if [ -n "$do_mpg" ] ; then
499
do_lavf mpg
Måns Rullgård's avatar
Måns Rullgård committed
500
fi
Fabrice Bellard's avatar
Fabrice Bellard committed
501

502
if [ -n "$do_mxf" ] ; then
503
504
do_lavf mxf "-ar 48000 -bf 2 -timecode_frame_start 264363"
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"
505
506
fi

Måns Rullgård's avatar
Måns Rullgård committed
507
if [ -n "$do_ts" ] ; then
508
do_lavf ts
Måns Rullgård's avatar
Måns Rullgård committed
509
fi
Michael Niedermayer's avatar
Michael Niedermayer committed
510

Måns Rullgård's avatar
Måns Rullgård committed
511
if [ -n "$do_swf" ] ; then
512
do_lavf swf -an
Måns Rullgård's avatar
Måns Rullgård committed
513
fi
Fabrice Bellard's avatar
Fabrice Bellard committed
514

Måns Rullgård's avatar
Måns Rullgård committed
515
if [ -n "$do_ffm" ] ; then
516
do_lavf ffm
Måns Rullgård's avatar
Måns Rullgård committed
517
fi
Fabrice Bellard's avatar
Fabrice Bellard committed
518

Måns Rullgård's avatar
Måns Rullgård committed
519
if [ -n "$do_flv_fmt" ] ; then
520
do_lavf flv -an
Måns Rullgård's avatar
Måns Rullgård committed
521
fi
Michael Niedermayer's avatar
Michael Niedermayer committed
522

Måns Rullgård's avatar
Måns Rullgård committed
523
if [ -n "$do_mov" ] ; then
524
do_lavf mov "-acodec pcm_alaw"
Måns Rullgård's avatar
Måns Rullgård committed
525
fi
Michael Niedermayer's avatar
Michael Niedermayer committed
526

Måns Rullgård's avatar
Måns Rullgård committed
527
if [ -n "$do_dv_fmt" ] ; then
528
do_lavf dv "-ar 48000 -r 25 -s pal -ac 2"
Måns Rullgård's avatar
Måns Rullgård committed
529
fi
Michael Niedermayer's avatar
Michael Niedermayer committed
530

Måns Rullgård's avatar
Måns Rullgård committed
531
if [ -n "$do_gxf" ] ; then
532
do_lavf gxf "-ar 48000 -r 25 -s pal -ac 1"
Måns Rullgård's avatar
Måns Rullgård committed
533
fi
Baptiste Coudurier's avatar
Baptiste Coudurier committed
534

Måns Rullgård's avatar
Måns Rullgård committed
535
if [ -n "$do_nut" ] ; then
536
do_lavf nut "-acodec mp2"
Måns Rullgård's avatar
Måns Rullgård committed
537
fi
Michael Niedermayer's avatar
Michael Niedermayer committed
538

Måns Rullgård's avatar
Måns Rullgård committed
539
if [ -n "$do_mkv" ] ; then
540
do_lavf mkv
Måns Rullgård's avatar
Måns Rullgård committed
541
fi
David Conrad's avatar
David Conrad committed
542

Michael Niedermayer's avatar
Michael Niedermayer committed
543

Fabrice Bellard's avatar
Fabrice Bellard committed
544
545
# streamed images
# mjpeg
546
#file=${outfile}libav.mjpeg
547
548
#do_ffmpeg $file -t 1 -qscale 10 -f image2 -vcodec pgmyuv -i $raw_src
#do_ffmpeg_crc $file -i $target_path/$file
Fabrice Bellard's avatar
Fabrice Bellard committed
549

Måns Rullgård's avatar
Måns Rullgård committed
550
if [ -n "$do_pbmpipe" ] ; then
551
do_streamed_images pbm
Måns Rullgård's avatar
Måns Rullgård committed
552
fi
Fabrice Bellard's avatar
Fabrice Bellard committed
553

Måns Rullgård's avatar
Måns Rullgård committed
554
if [ -n "$do_pgmpipe" ] ; then
555
do_streamed_images pgm
Måns Rullgård's avatar
Måns Rullgård committed
556
fi
Fabrice Bellard's avatar
Fabrice Bellard committed
557

Måns Rullgård's avatar
Måns Rullgård committed
558
if [ -n "$do_ppmpipe" ] ; then
559
do_streamed_images ppm
Måns Rullgård's avatar
Måns Rullgård committed
560
fi
Fabrice Bellard's avatar
Fabrice Bellard committed
561

Måns Rullgård's avatar
Måns Rullgård committed
562
if [ -n "$do_gif" ] ; then
Fabrice Bellard's avatar
Fabrice Bellard committed
563
file=${outfile}libav.gif
564
565
do_ffmpeg $file -t 1 -qscale 10 -f image2 -vcodec pgmyuv -i $raw_src -pix_fmt rgb24
#do_ffmpeg_crc $file -i $target_path/$file
Måns Rullgård's avatar
Måns Rullgård committed
566
fi
Fabrice Bellard's avatar
Fabrice Bellard committed
567

Måns Rullgård's avatar
Måns Rullgård committed
568
if [ -n "$do_yuv4mpeg" ] ; then
569
file=${outfile}libav.y4m
570
571
do_ffmpeg $file -t 1 -qscale 10 -f image2 -vcodec pgmyuv -i $raw_src
#do_ffmpeg_crc $file -i $target_path/$file
Måns Rullgård's avatar
Måns Rullgård committed
572
fi
Fabrice Bellard's avatar
Fabrice Bellard committed
573
574

# image formats
Måns Rullgård's avatar
Måns Rullgård committed
575
576

if [ -n "$do_pgm" ] ; then
577
do_image_formats pgm
Måns Rullgård's avatar
Måns Rullgård committed
578
fi
Fabrice Bellard's avatar
Fabrice Bellard committed
579

Måns Rullgård's avatar
Måns Rullgård committed
580
if [ -n "$do_ppm" ] ; then
581
do_image_formats ppm
Måns Rullgård's avatar
Måns Rullgård committed
582
fi
Fabrice Bellard's avatar
Fabrice Bellard committed
583

Måns Rullgård's avatar
Måns Rullgård committed
584
if [ -n "$do_bmp" ] ; then
585
do_image_formats bmp
Måns Rullgård's avatar
Måns Rullgård committed
586
fi
587

Måns Rullgård's avatar
Måns Rullgård committed
588
if [ -n "$do_tga" ] ; then
589
do_image_formats tga
Måns Rullgård's avatar
Måns Rullgård committed
590
fi
591

Måns Rullgård's avatar
Måns Rullgård committed
592
if [ -n "$do_tiff" ] ; then
593
do_image_formats tiff "-pix_fmt rgb24"
Måns Rullgård's avatar
Måns Rullgård committed
594
fi
595

Måns Rullgård's avatar
Måns Rullgård committed
596
if [ -n "$do_sgi" ] ; then
597
do_image_formats sgi
Måns Rullgård's avatar
Måns Rullgård committed
598
fi
599

Måns Rullgård's avatar
Måns Rullgård committed
600
if [ -n "$do_jpg" ] ; then
601
do_image_formats jpg "-flags +bitexact -dct fastint -idct simple -pix_fmt yuvj420p" "-f image2"
Måns Rullgård's avatar
Måns Rullgård committed
602
fi
603

604
605
606
607
if [ -n "$do_pcx" ] ; then
do_image_formats pcx
fi

Fabrice Bellard's avatar
Fabrice Bellard committed
608
609
# audio only

Måns Rullgård's avatar
Måns Rullgård committed
610
if [ -n "$do_wav" ] ; then
611
do_audio_only wav
Måns Rullgård's avatar
Måns Rullgård committed
612
fi
Fabrice Bellard's avatar
Fabrice Bellard committed
613

Måns Rullgård's avatar
Måns Rullgård committed
614
if [ -n "$do_alaw" ] ; then
615
do_audio_only al
Måns Rullgård's avatar
Måns Rullgård committed
616
fi
Fabrice Bellard's avatar
Fabrice Bellard committed
617

Måns Rullgård's avatar
Måns Rullgård committed
618
if [ -n "$do_mulaw" ] ; then
619
do_audio_only ul
Måns Rullgård's avatar
Måns Rullgård committed
620
fi
Fabrice Bellard's avatar
Fabrice Bellard committed
621

Måns Rullgård's avatar
Måns Rullgård committed
622
if [ -n "$do_au" ] ; then
623
do_audio_only au
Måns Rullgård's avatar
Måns Rullgård committed
624
fi
Fabrice Bellard's avatar
Fabrice Bellard committed
625

Måns Rullgård's avatar
Måns Rullgård committed
626
if [ -n "$do_mmf" ] ; then
627
do_audio_only mmf
Måns Rullgård's avatar
Måns Rullgård committed
628
fi
629

Måns Rullgård's avatar
Måns Rullgård committed
630
if [ -n "$do_aiff" ] ; then
631
do_audio_only aif
Måns Rullgård's avatar
Måns Rullgård committed
632
fi
633

Måns Rullgård's avatar
Måns Rullgård committed
634
if [ -n "$do_voc" ] ; then
635
do_audio_only voc
Måns Rullgård's avatar
Måns Rullgård committed
636
fi
Aurelien Jacobs's avatar
Aurelien Jacobs committed
637

Måns Rullgård's avatar
Måns Rullgård committed
638
if [ -n "$do_ogg" ] ; then
Baptiste Coudurier's avatar
Baptiste Coudurier committed
639
do_audio_only ogg
Måns Rullgård's avatar
Måns Rullgård committed
640
fi
Baptiste Coudurier's avatar
Baptiste Coudurier committed
641

642
# pix_fmt conversions
Måns Rullgård's avatar
Måns Rullgård committed
643
644

if [ -n "$do_pixfmt" ] ; then
645
646
conversions="yuv420p yuv422p yuv444p yuyv422 yuv410p yuv411p yuvj420p \
             yuvj422p yuvj444p rgb24 bgr24 rgb32 rgb565 rgb555 gray monow \
647
             monob yuv440p yuvj440p"
648
649
for pix_fmt in $conversions ; do
    file=${outfile}libav-${pix_fmt}.yuv
650
    do_ffmpeg_nocheck $file -r 1 -t 1 -f image2 -vcodec pgmyuv -i $raw_src \
651
652
653
                            -f rawvideo -s 352x288 -pix_fmt $pix_fmt $target_path/$raw_dst
    do_ffmpeg $file -f rawvideo -s 352x288 -pix_fmt $pix_fmt -i $target_path/$raw_dst \
                    -f rawvideo -s 352x288 -pix_fmt yuv444p
654
done
Måns Rullgård's avatar
Måns Rullgård committed
655
fi
656

657
rm -f "$bench" "$bench2"