regression.sh 18.3 KB
Newer Older
1 2 3 4 5 6
#!/bin/sh
#
# automatic regression test for ffmpeg
#
#
#set -x
7
# Even in the 21st century some diffs are not supporting -u.
M
Michael Niedermayer 已提交
8
diff -u "$0" "$0" > /dev/null 2>&1
9 10 11 12 13 14
if [ $? -eq 0 ]; then
  diff_cmd="diff -u"
else
  diff_cmd="diff"
fi

M
Michael Niedermayer 已提交
15
diff -w "$0" "$0" > /dev/null 2>&1
M
diff -w  
Michael Niedermayer 已提交
16 17 18 19
if [ $? -eq 0 ]; then
  diff_cmd="$diff_cmd -w"
fi

20 21
set -e

F
Fabrice Bellard 已提交
22 23 24
datadir="./data"

logfile="$datadir/ffmpeg.regression"
25
outfile="$datadir/a-"
F
Fabrice Bellard 已提交
26

27 28 29 30 31
# tests to do
if [ "$1" = "mpeg4" ] ; then
    do_mpeg4=y
elif [ "$1" = "mpeg" ] ; then
    do_mpeg=y
32
    do_mpeg2=y
F
Fabrice Bellard 已提交
33 34
elif [ "$1" = "ac3" ] ; then
    do_ac3=y
35 36
elif [ "$1" = "huffyuv" ] ; then
    do_huffyuv=y
M
Michael Niedermayer 已提交
37 38
elif [ "$1" = "mpeg2thread" ] ; then
    do_mpeg2thread=y
M
Michael Niedermayer 已提交
39 40
elif [ "$1" = "snow" ] ; then
    do_snow=y
M
Michael Niedermayer 已提交
41 42
elif [ "$1" = "snowll" ] ; then
    do_snowll=y
F
Fabrice Bellard 已提交
43 44
elif [ "$1" = "libavtest" ] ; then
    do_libav=y
F
Fabrice Bellard 已提交
45
    logfile="$datadir/libav.regression"
46
    outfile="$datadir/b-"
47 48
else
    do_mpeg=y
M
Michael Niedermayer 已提交
49
    do_mpeg2=y
50
    do_mpeg2thread=y
51
    do_msmpeg4v2=y
52
    do_msmpeg4=y
53
    do_wmv1=y
54
    do_wmv2=y
M
Michael Niedermayer 已提交
55
    do_h261=y
56
    do_h263=y
M
Michael Niedermayer 已提交
57
    do_h263p=y
58
    do_mpeg4=y
59
    do_mp4psp=y
60
    do_huffyuv=y
61
    do_mjpeg=y
62
    do_ljpeg=y
M
Michael Niedermayer 已提交
63
    do_jpegls=y
64
    do_rv10=y
M
Michael Niedermayer 已提交
65
    do_rv20=y
66 67
    do_mp2=y
    do_ac3=y
M
Michael Niedermayer 已提交
68
    do_g726=y
69 70
    do_adpcm_ima_wav=y
    do_adpcm_ms=y
M
Michael Niedermayer 已提交
71
    do_flac=y
72 73
    do_rc=y
    do_mpeg4adv=y
74
    do_mpeg4thread=y
75
    do_mpeg4nr=y
76
    do_mpeg1b=y
M
Michael Niedermayer 已提交
77
    do_asv1=y
M
Michael Niedermayer 已提交
78
    do_asv2=y
M
Michael Niedermayer 已提交
79
    do_flv=y
M
Michael Niedermayer 已提交
80
    do_ffv1=y
81
    do_error=y
M
Michael Niedermayer 已提交
82
    do_svq1=y
M
Michael Niedermayer 已提交
83
    do_snow=y
M
Michael Niedermayer 已提交
84
    do_snowll=y
85
    do_adpcm_yam=y
M
Michael Niedermayer 已提交
86
    do_dv=y
D
Daniel Maas 已提交
87
    do_dv50=y
88 89 90 91
fi


# various files
M
Mark Hills 已提交
92
ffmpeg="../ffmpeg_g"
93
tiny_psnr="./tiny_psnr"
94
reffile="$2"
F
Fabrice Bellard 已提交
95
benchfile="$datadir/ffmpeg.bench"
96
raw_src="$3/%02d.pgm"
F
Fabrice Bellard 已提交
97
raw_dst="$datadir/out.yuv"
98
raw_ref="$datadir/ref.yuv"
99
pcm_src="asynth1.sw"
F
Fabrice Bellard 已提交
100
pcm_dst="$datadir/out.wav"
101
pcm_ref="$datadir/ref.wav"
102 103 104 105 106 107 108
if [ X"`echo | md5sum 2> /dev/null`" != X ]; then
    do_md5sum() { md5sum -b $1; }
elif [ -x /sbin/md5 ]; then
    do_md5sum() { /sbin/md5 -r $1 | sed 's# \**\./# *./#'; }
else
    do_md5sum() { echo No md5sum program found; }
fi
F
Fabrice Bellard 已提交
109 110 111

# create the data directory if it does not exists
mkdir -p $datadir
112

D
Diego Biurrun 已提交
113 114
FFMPEG_OPTS="-y -flags +bitexact -dct fastint -idct simple"

115
do_ffmpeg()
116 117 118
{
    f="$1"
    shift
D
Diego Biurrun 已提交
119 120
    echo $ffmpeg $FFMPEG_OPTS $*
    $ffmpeg $FFMPEG_OPTS -benchmark $* > $datadir/bench.tmp 2> /tmp/ffmpeg$$
121
    egrep -v "^(Stream|Press|Input|Output|frame|  Stream|  Duration|video:)" /tmp/ffmpeg$$ || true
122
    rm -f /tmp/ffmpeg$$
123
    do_md5sum $f >> $logfile
124 125
    if [ $f = $raw_dst ] ; then
        $tiny_psnr $f $raw_ref >> $logfile
126
    elif [ $f = $pcm_dst ] ; then
127
        $tiny_psnr $f $pcm_ref 2 >> $logfile
128 129
    else
        wc -c $f >> $logfile
130
    fi
131
    expr "`cat $datadir/bench.tmp`" : '.*utime=\(.*s\)' > $datadir/bench2.tmp
F
Fabrice Bellard 已提交
132
    echo `cat $datadir/bench2.tmp` $f >> $benchfile
133 134
}

135
do_ffmpeg_crc()
F
Fabrice Bellard 已提交
136 137 138
{
    f="$1"
    shift
D
Diego Biurrun 已提交
139 140
    echo $ffmpeg $FFMPEG_OPTS $* -f crc $datadir/ffmpeg.crc
    $ffmpeg $FFMPEG_OPTS $* -f crc $datadir/ffmpeg.crc > /tmp/ffmpeg$$ 2>&1
141
    egrep -v "^(Stream|Press|Input|Output|frame|  Stream|  Duration|video:|ffmpeg version|  configuration|  built)" /tmp/ffmpeg$$ || true
142
    rm -f /tmp/ffmpeg$$
143
    echo "$f `cat $datadir/ffmpeg.crc`" >> $logfile
F
Fabrice Bellard 已提交
144
}
145

146 147 148 149
do_ffmpeg_nocheck()
{
    f="$1"
    shift
D
Diego Biurrun 已提交
150 151
    echo $ffmpeg $FFMPEG_OPTS $*
    $ffmpeg $FFMPEG_OPTS -benchmark $* > $datadir/bench.tmp 2> /tmp/ffmpeg$$
152
    egrep -v "^(Stream|Press|Input|Output|frame|  Stream|  Duration|video:)" /tmp/ffmpeg$$ || true
153
    rm -f /tmp/ffmpeg$$
154 155 156 157
    expr "`cat $datadir/bench.tmp`" : '.*utime=\(.*s\)' > $datadir/bench2.tmp
    echo `cat $datadir/bench2.tmp` $f >> $benchfile
}

158 159 160 161 162 163 164 165 166 167
do_video_decoding()
{
    do_ffmpeg $raw_dst -y -i $file -f rawvideo $@ $raw_dst
}

do_video_encoding()
{
    do_ffmpeg $file -y $1 -f pgmyuv -i $raw_src $2 $file
}

168 169 170 171 172 173 174
do_streamed_images()
{
    file=${outfile}libav.$1
    do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f image2pipe $file
    do_ffmpeg_crc $file -f image2pipe -i $file
}

175 176 177 178 179 180 181
do_audio_only()
{
    file=${outfile}libav.$1
    do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
    do_ffmpeg_crc $file -i $file
}

182 183 184
echo "ffmpeg regression test" > $logfile
echo "ffmpeg benchmarks" > $benchfile

185 186 187
###################################
# generate reference for quality check
do_ffmpeg_nocheck $raw_ref -y -f pgmyuv -i $raw_src -an -f rawvideo $raw_ref
188
do_ffmpeg_nocheck $pcm_ref -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src -f wav $pcm_ref
189

190 191 192 193
###################################
if [ -n "$do_mpeg" ] ; then
# mpeg1 encoding
file=${outfile}mpeg1.mpg
194
do_video_encoding "-qscale 10" "-f mpeg1video"
195 196

# mpeg1 decoding
197
do_video_decoding
M
Michael Niedermayer 已提交
198 199 200 201 202
fi

###################################
if [ -n "$do_mpeg2" ] ; then
# mpeg2 encoding
203
file=${outfile}mpeg2.mpg
204
do_video_encoding "-qscale 10" "-vcodec mpeg2video -f mpeg1video"
205 206

# mpeg2 decoding
207
do_video_decoding
208

209 210
# mpeg2 encoding using intra vlc
file=${outfile}mpeg2ivlc.mpg
211
do_video_encoding "-qscale 10" "-vcodec mpeg2video -f mpeg1video -flags2 +ivlc"
212 213

# mpeg2 decoding
214
do_video_decoding
215

M
Michael Niedermayer 已提交
216 217
# mpeg2 encoding
file=${outfile}mpeg2.mpg
218
do_video_encoding "-qscale 10" "-vcodec mpeg2video -idct int -dct int -f mpeg1video"
M
Michael Niedermayer 已提交
219 220

# mpeg2 decoding
221
do_ffmpeg $raw_dst -y -idct int -i $file -f rawvideo $raw_dst
M
Michael Niedermayer 已提交
222

223 224
# mpeg2 encoding interlaced
file=${outfile}mpeg2i.mpg
225
do_video_encoding "-qscale 10" "-vcodec mpeg2video -f mpeg1video -flags +ildct+ilme"
226 227

# mpeg2 decoding
228
do_video_decoding
229 230
fi

231 232 233 234
###################################
if [ -n "$do_mpeg2thread" ] ; then
# mpeg2 encoding interlaced
file=${outfile}mpeg2thread.mpg
235
do_video_encoding "-qscale 10" "-vcodec mpeg2video -f mpeg1video -bf 2 -flags +ildct+ilme -threads 2"
236 237

# mpeg2 decoding
238
do_video_decoding
239 240 241

# mpeg2 encoding interlaced using intra vlc
file=${outfile}mpeg2threadivlc.mpg
242
do_video_encoding "-qscale 10" "-vcodec mpeg2video -f mpeg1video -bf 2 -flags +ildct+ilme -flags2 +ivlc -threads 2"
243

M
Michael Niedermayer 已提交
244
# mpeg2 decoding
245
do_video_decoding
M
Michael Niedermayer 已提交
246 247 248

# mpeg2 encoding interlaced
file=${outfile}mpeg2reuse.mpg
249
do_ffmpeg $file -y -sameq -me_threshold 256 -mb_threshold 1024 -i ${outfile}mpeg2thread.mpg -vcodec mpeg2video -f mpeg1video -bf 2 -flags +ildct+ilme -threads 4 $file
M
Michael Niedermayer 已提交
250

251
# mpeg2 decoding
252
do_video_decoding
253 254
fi

255 256 257 258
###################################
if [ -n "$do_msmpeg4v2" ] ; then
# msmpeg4 encoding
file=${outfile}msmpeg4v2.avi
259
do_video_encoding "-qscale 10" "-an -vcodec msmpeg4v2"
260 261

# msmpeg4v2 decoding
262
do_video_decoding
263 264
fi

265 266 267 268
###################################
if [ -n "$do_msmpeg4" ] ; then
# msmpeg4 encoding
file=${outfile}msmpeg4.avi
269
do_video_encoding "-qscale 10" "-an -vcodec msmpeg4"
270 271

# msmpeg4 decoding
272
do_video_decoding
273 274
fi

275 276 277 278
###################################
if [ -n "$do_wmv1" ] ; then
# wmv1 encoding
file=${outfile}wmv1.avi
279
do_video_encoding "-qscale 10" "-an -vcodec wmv1"
280 281

# wmv1 decoding
282
do_video_decoding
283 284
fi

285 286 287 288
###################################
if [ -n "$do_wmv2" ] ; then
# wmv2 encoding
file=${outfile}wmv2.avi
289
do_video_encoding "-qscale 10" "-an -vcodec wmv2"
290 291

# wmv2 decoding
292
do_video_decoding
293 294
fi

M
Michael Niedermayer 已提交
295 296 297 298
###################################
if [ -n "$do_h261" ] ; then
# h261 encoding
file=${outfile}h261.avi
299
do_video_encoding "-qscale 11" "-s 352x288 -an -vcodec h261"
M
Michael Niedermayer 已提交
300 301

# h261 decoding
302
do_video_decoding
M
Michael Niedermayer 已提交
303 304
fi

305 306 307 308
###################################
if [ -n "$do_h263" ] ; then
# h263 encoding
file=${outfile}h263.avi
309
do_video_encoding "-qscale 10" "-s 352x288 -an -vcodec h263"
310

M
Michael Niedermayer 已提交
311
# h263 decoding
312
do_video_decoding
M
Michael Niedermayer 已提交
313 314 315 316 317 318
fi

###################################
if [ -n "$do_h263p" ] ; then
# h263p encoding
file=${outfile}h263p.avi
319
do_video_encoding "-qscale 2 -flags +umv+aiv+aic" "-s 352x288 -an -vcodec h263p -ps 300"
M
Michael Niedermayer 已提交
320

321
# h263p decoding
322
do_video_decoding
323 324 325 326 327
fi

###################################
if [ -n "$do_mpeg4" ] ; then
# mpeg4
328
file=${outfile}odivx.mp4
329
do_video_encoding "-flags +mv4 -mbd bits -qscale 10" "-an -vcodec mpeg4"
330 331

# mpeg4 decoding
332
do_video_decoding
333 334
fi

335 336 337 338
###################################
if [ -n "$do_huffyuv" ] ; then
# huffyuv
file=${outfile}huffyuv.avi
339
do_video_encoding "" "-an -vcodec huffyuv -pix_fmt yuv422p"
340 341

# huffyuv decoding
342
do_video_decoding -strict -2 -pix_fmt yuv420p
343 344
fi

345 346 347 348
###################################
if [ -n "$do_rc" ] ; then
# mpeg4 rate control
file=${outfile}mpeg4-rc.avi
349
do_video_encoding "-b 400k -bf 2" "-an -vcodec mpeg4"
350 351

# mpeg4 rate control decoding
352
do_video_decoding
353 354 355 356 357 358
fi

###################################
if [ -n "$do_mpeg4adv" ] ; then
# mpeg4
file=${outfile}mpeg4-adv.avi
359
do_video_encoding "-qscale 9 -flags +mv4+part+aic+trell -mbd bits -ps 200" "-an -vcodec mpeg4"
360 361

# mpeg4 decoding
362
do_video_decoding
363 364
fi

365 366 367 368
###################################
if [ -n "$do_mpeg4thread" ] ; then
# mpeg4
file=${outfile}mpeg4-thread.avi
369
do_video_encoding "-b 500k -flags +mv4+part+aic+trell -mbd bits -ps 200 -bf 2" "-an -vcodec mpeg4 -threads 2"
370 371

# mpeg4 decoding
372
do_video_decoding
373 374 375 376 377 378
fi

###################################
if [ -n "$do_mpeg4adv" ] ; then
# mpeg4
file=${outfile}mpeg4-Q.avi
379
do_video_encoding "-qscale 7 -flags +mv4+qpel -mbd 2 -bf 2 -cmp 1 -subcmp 2" "-an -vcodec mpeg4"
380 381

# mpeg4 decoding
382
do_video_decoding
383 384
fi

385 386 387 388
###################################
if [ -n "$do_mp4psp" ] ; then
# mp4 PSP style
file=${outfile}mpeg4-PSP.mp4
389
do_ffmpeg $file -y -b 768k -s 320x240 -f psp -ar 24000 -ab 32 -i $raw_src $file
390 391
fi

392 393 394 395
###################################
if [ -n "$do_error" ] ; then
# damaged mpeg4
file=${outfile}error-mpeg4-adv.avi
396
do_video_encoding "-qscale 7 -flags +mv4+part+aic -mbd rd -ps 250 -error 10" "-an -vcodec mpeg4"
397 398

# damaged mpeg4 decoding
399
do_video_decoding
400 401
fi

402 403 404
###################################
if [ -n "$do_mpeg4nr" ] ; then
# noise reduction
405
file=${outfile}mpeg4-nr.avi
406
do_video_encoding "-qscale 8 -flags +mv4 -mbd rd -nr 200" "-an -vcodec mpeg4"
407 408

# mpeg4 decoding
409
do_video_decoding
410 411
fi

412 413 414 415
###################################
if [ -n "$do_mpeg1b" ] ; then
# mpeg1
file=${outfile}mpeg1b.mpg
416
do_video_encoding "-qscale 8 -bf 3 -ps 200" "-an -vcodec mpeg1video -f mpeg1video"
417 418

# mpeg1 decoding
419
do_video_decoding
420 421
fi

422 423 424 425
###################################
if [ -n "$do_mjpeg" ] ; then
# mjpeg
file=${outfile}mjpeg.avi
426
do_video_encoding "-qscale 10" "-an -vcodec mjpeg -pix_fmt yuvj420p"
427 428

# mjpeg decoding
429
do_video_decoding -pix_fmt yuv420p
430 431 432
fi

###################################
433 434 435
if [ -n "$do_ljpeg" ] ; then
# ljpeg
file=${outfile}ljpeg.avi
436
do_video_encoding "" "-an -vcodec ljpeg -strict -1"
437 438

# ljpeg decoding
439
do_video_decoding
440 441
fi

M
Michael Niedermayer 已提交
442 443 444 445
###################################
if [ -n "$do_jpegls" ] ; then
# jpeg ls
file=${outfile}jpegls.avi
446
do_video_encoding "" "-an -vcodec jpegls -vtag MJPG"
M
Michael Niedermayer 已提交
447 448

# jpeg ls decoding
449
do_video_decoding -pix_fmt yuv420p
M
Michael Niedermayer 已提交
450 451
fi

452
###################################
453 454 455
if [ -n "$do_rv10" ] ; then
# rv10 encoding
file=${outfile}rv10.rm
456
do_video_encoding "-qscale 10" "-an"
457 458

# rv10 decoding
459
do_video_decoding
460 461
fi

M
Michael Niedermayer 已提交
462 463 464 465
###################################
if [ -n "$do_rv20" ] ; then
# rv20 encoding
file=${outfile}rv20.rm
466
do_video_encoding "-qscale 10" "-vcodec rv20 -an"
M
Michael Niedermayer 已提交
467 468

# rv20 decoding
469
do_video_decoding
M
Michael Niedermayer 已提交
470 471
fi

M
Michael Niedermayer 已提交
472 473 474 475
###################################
if [ -n "$do_asv1" ] ; then
# asv1 encoding
file=${outfile}asv1.avi
476
do_video_encoding "-qscale 10" "-an -vcodec asv1"
M
Michael Niedermayer 已提交
477 478

# asv1 decoding
479
do_video_decoding
M
Michael Niedermayer 已提交
480 481
fi

M
Michael Niedermayer 已提交
482 483 484 485
###################################
if [ -n "$do_asv2" ] ; then
# asv2 encoding
file=${outfile}asv2.avi
486
do_video_encoding "-qscale 10" "-an -vcodec asv2"
M
Michael Niedermayer 已提交
487 488

# asv2 decoding
489
do_video_decoding
M
Michael Niedermayer 已提交
490 491
fi

M
Michael Niedermayer 已提交
492 493 494 495
###################################
if [ -n "$do_flv" ] ; then
# flv encoding
file=${outfile}flv.flv
496
do_video_encoding "-qscale 10" "-an -vcodec flv"
M
Michael Niedermayer 已提交
497 498

# flv decoding
499
do_video_decoding
M
Michael Niedermayer 已提交
500 501
fi

M
Michael Niedermayer 已提交
502 503 504 505
###################################
if [ -n "$do_ffv1" ] ; then
# ffv1 encoding
file=${outfile}ffv1.avi
506
do_video_encoding "-strict -2" "-an -vcodec ffv1"
M
Michael Niedermayer 已提交
507 508

# ffv1 decoding
509
do_video_decoding
M
Michael Niedermayer 已提交
510 511 512 513 514 515
fi

###################################
if [ -n "$do_snow" ] ; then
# snow encoding
file=${outfile}snow.avi
516
do_video_encoding "-strict -2" "-an -vcodec snow -qscale 2 -flags +qpel -me iter -dia_size 2 -cmp 12 -subcmp 12 -s 128x64"
M
Michael Niedermayer 已提交
517 518

# snow decoding
519
do_video_decoding -s 352x288
M
Michael Niedermayer 已提交
520
fi
M
Michael Niedermayer 已提交
521

M
Michael Niedermayer 已提交
522 523
###################################
if [ -n "$do_snowll" ] ; then
M
Michael Niedermayer 已提交
524 525
# snow encoding
file=${outfile}snow53.avi
526
do_video_encoding "-strict -2" "-an -vcodec snow -qscale .001 -pred 1 -flags +mv4+qpel"
M
Michael Niedermayer 已提交
527 528

# snow decoding
529
do_video_decoding
M
Michael Niedermayer 已提交
530 531
fi

M
Michael Niedermayer 已提交
532 533 534 535
###################################
if [ -n "$do_dv" ] ; then
# dv encoding
file=${outfile}dv.dv
536
do_video_encoding "-dct int" "-s pal -an"
M
Michael Niedermayer 已提交
537 538

# dv decoding
539
do_video_decoding -s cif
M
Michael Niedermayer 已提交
540 541
fi

D
Daniel Maas 已提交
542 543 544 545
###################################
if [ -n "$do_dv50" ] ; then
# dv50 encoding
file=${outfile}dv.dv
546
do_video_encoding "-dct int" "-s pal -pix_fmt yuv422p -an"
D
Daniel Maas 已提交
547 548

# dv50 decoding
549
do_video_decoding -s cif -pix_fmt yuv420p
D
Daniel Maas 已提交
550 551 552
fi


M
Michael Niedermayer 已提交
553 554 555 556
###################################
if [ -n "$do_svq1" ] ; then
# svq1 encoding
file=${outfile}svq1.mov
557
do_video_encoding "" "-an -vcodec svq1 -qscale 3 -pix_fmt yuv410p"
M
Michael Niedermayer 已提交
558 559

# svq1 decoding
560
do_video_decoding -pix_fmt yuv420p
M
Michael Niedermayer 已提交
561 562
fi

563 564 565 566
###################################
if [ -n "$do_mp2" ] ; then
# mp2 encoding
file=${outfile}mp2.mp2
567
do_ffmpeg $file -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src $file
568 569

# mp2 decoding
570
do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
571
$tiny_psnr $pcm_dst $pcm_ref 2 1924 >> $logfile
572 573 574 575 576 577
fi

###################################
if [ -n "$do_ac3" ] ; then
# ac3 encoding
file=${outfile}ac3.rm
578
do_ffmpeg $file -y -ab 128 -ac 2 -f s16le  -i $pcm_src -vn $file
579 580

# ac3 decoding
581
#do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
582 583
fi

M
Michael Niedermayer 已提交
584 585 586 587
###################################
if [ -n "$do_g726" ] ; then
# g726 encoding
file=${outfile}g726.wav
588
do_ffmpeg $file -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src -ab 32 -ac 1 -ar 8000 -acodec g726 $file
M
Michael Niedermayer 已提交
589 590

# g726 decoding
591
do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
M
Michael Niedermayer 已提交
592 593
fi

594 595 596 597
###################################
if [ -n "$do_adpcm_ima_wav" ] ; then
# encoding
file=${outfile}adpcm_ima.wav
598
do_ffmpeg $file -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src -acodec adpcm_ima_wav $file
599 600

# decoding
601
do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
602 603 604 605 606 607
fi

###################################
if [ -n "$do_adpcm_ms" ] ; then
# encoding
file=${outfile}adpcm_ms.wav
608
do_ffmpeg $file -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src -acodec adpcm_ms $file
609 610

# decoding
611
do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
612 613
fi

614 615 616 617
###################################
if [ -n "$do_adpcm_yam" ] ; then
# encoding
file=${outfile}adpcm_yam.wav
618
do_ffmpeg $file -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src -acodec adpcm_yamaha $file
619 620

# decoding
621
do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
622 623
fi

M
Michael Niedermayer 已提交
624 625 626 627
###################################
if [ -n "$do_flac" ] ; then
# encoding
file=${outfile}flac.flac
628
do_ffmpeg $file -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src -acodec flac -compression_level 2 $file
M
Michael Niedermayer 已提交
629 630 631 632 633

# decoding
do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
fi

F
Fabrice Bellard 已提交
634 635 636 637 638 639 640 641 642 643 644 645 646
###################################
# libav testing
###################################

if [ -n "$do_libav" ] ; then

# avi
file=${outfile}libav.avi
do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
do_ffmpeg_crc $file -i $file

# asf
file=${outfile}libav.asf
647
do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src -acodec mp2 $file
648
do_ffmpeg_crc $file -i $file -r 25
F
Fabrice Bellard 已提交
649 650 651 652 653 654 655 656 657 658 659 660

# rm
file=${outfile}libav.rm
do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
# broken
#do_ffmpeg_crc $file -i $file

# mpegps
file=${outfile}libav.mpg
do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
do_ffmpeg_crc $file -i $file

M
Michael Niedermayer 已提交
661 662 663 664 665
# mpegts
file=${outfile}libav.ts
do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
do_ffmpeg_crc $file -i $file

F
Fabrice Bellard 已提交
666 667
# swf (decode audio only)
file=${outfile}libav.swf
668
do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src -acodec mp2 $file
669
do_ffmpeg_crc $file -i $file
F
Fabrice Bellard 已提交
670 671

# ffm
672 673 674
file=${outfile}libav.ffm
do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
do_ffmpeg_crc $file -i $file
F
Fabrice Bellard 已提交
675

M
Michael Niedermayer 已提交
676 677
# flv
file=${outfile}libav.flv
678
do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src -an $file
M
Michael Niedermayer 已提交
679 680
do_ffmpeg_crc $file -i $file

M
Michael Niedermayer 已提交
681
# mov
682 683 684
file=${outfile}libav.mov
do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src -acodec pcm_alaw $file
do_ffmpeg_crc $file -i $file
M
Michael Niedermayer 已提交
685 686

# nut
687 688 689
#file=${outfile}libav.nut
#do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src -acodec mp2 $file
#do_ffmpeg_crc $file -i $file
M
Michael Niedermayer 已提交
690

M
Michael Niedermayer 已提交
691
# dv
692 693 694
file=${outfile}libav.dv
do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src -ar 48000 -r 25 -s pal -ac 2 $file
do_ffmpeg_crc $file -i $file
M
Michael Niedermayer 已提交
695

B
Baptiste Coudurier 已提交
696 697 698 699 700
# gxf
file=${outfile}libav.gxf
do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src -ar 48000 -r 25 -s pal -ac 1 $file
do_ffmpeg_crc $file -i $file

F
Fabrice Bellard 已提交
701 702 703
####################
# streamed images
# mjpeg
704 705 706
#file=${outfile}libav.mjpeg
#do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src $file
#do_ffmpeg_crc $file -i $file
F
Fabrice Bellard 已提交
707

F
Fabrice Bellard 已提交
708
# pbmpipe
709
do_streamed_images pbm
F
Fabrice Bellard 已提交
710

F
Fabrice Bellard 已提交
711
# pgmpipe
712
do_streamed_images pgm
F
Fabrice Bellard 已提交
713 714

# ppmpipe
715
do_streamed_images ppm
F
Fabrice Bellard 已提交
716 717 718

# gif
file=${outfile}libav.gif
719
do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -pix_fmt rgb24 $file
F
Fabrice Bellard 已提交
720 721 722
#do_ffmpeg_crc $file -i $file

# yuv4mpeg
723
file=${outfile}libav.y4m
F
Fabrice Bellard 已提交
724 725
do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src $file
#do_ffmpeg_crc $file -i $file
F
Fabrice Bellard 已提交
726 727 728 729

####################
# image formats
# pgm (we do not do md5 on image files yet)
730
file=${outfile}libav%02d.pgm
F
Fabrice Bellard 已提交
731 732 733 734
$ffmpeg -t 0.5 -y -qscale 10 -f pgmyuv -i $raw_src $file
do_ffmpeg_crc $file -i $file

# ppm (we do not do md5 on image files yet)
735
file=${outfile}libav%02d.ppm
F
Fabrice Bellard 已提交
736 737 738
$ffmpeg -t 0.5 -y -qscale 10 -f pgmyuv -i $raw_src $file
do_ffmpeg_crc $file -i $file

739
# jpeg (we do not do md5 on image files yet)
740
file=${outfile}libav%02d.jpg
741
$ffmpeg -t 0.5 -y -qscale 10 -f pgmyuv -i $raw_src -flags +bitexact -dct fastint -idct simple -pix_fmt yuvj420p -f image2 $file
M
Michael Niedermayer 已提交
742
do_ffmpeg_crc $file -f image2 -i $file
743

F
Fabrice Bellard 已提交
744 745 746 747
####################
# audio only

# wav
748
do_audio_only wav
F
Fabrice Bellard 已提交
749 750

# alaw
751
do_audio_only al
F
Fabrice Bellard 已提交
752 753

# mulaw
754
do_audio_only ul
F
Fabrice Bellard 已提交
755 756

# au
757
do_audio_only au
F
Fabrice Bellard 已提交
758

759
# mmf
760
do_audio_only mmf
761

762
# aiff
763
do_audio_only aif
764

A
Aurelien Jacobs 已提交
765
# voc
766
do_audio_only voc
A
Aurelien Jacobs 已提交
767

768 769 770 771
####################
# pix_fmt conversions
conversions="yuv420p yuv422p yuv444p yuv422 yuv410p yuv411p yuvj420p \
             yuvj422p yuvj444p rgb24 bgr24 rgba32 rgb565 rgb555 gray monow \
772
             monob pal8"
773 774 775 776 777 778 779 780
for pix_fmt in $conversions ; do
    file=${outfile}libav-${pix_fmt}.yuv
    do_ffmpeg_nocheck $file -r 1 -t 1 -y -f pgmyuv -i $raw_src \
                            -f rawvideo -s 352x288 -pix_fmt $pix_fmt $raw_dst
    do_ffmpeg $file -f rawvideo -s 352x288 -pix_fmt $pix_fmt -i $raw_dst \
                    -f rawvideo -s 352x288 -pix_fmt yuv444p $file
done

F
Fabrice Bellard 已提交
781 782 783
fi


784

M
Michael Niedermayer 已提交
785
if $diff_cmd "$logfile" "$reffile" ; then
786
    echo
787 788 789
    echo Regression test succeeded.
    exit 0
else
790
    echo
791 792 793
    echo Regression test: Error.
    exit 1
fi