regression.sh 19.0 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
echo "ffmpeg regression test" > $logfile
echo "ffmpeg benchmarks" > $benchfile

171 172 173
###################################
# generate reference for quality check
do_ffmpeg_nocheck $raw_ref -y -f pgmyuv -i $raw_src -an -f rawvideo $raw_ref
174
do_ffmpeg_nocheck $pcm_ref -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src -f wav $pcm_ref
175

176 177 178 179
###################################
if [ -n "$do_mpeg" ] ; then
# mpeg1 encoding
file=${outfile}mpeg1.mpg
180
do_video_encoding "-qscale 10" "-f mpeg1video"
181 182

# mpeg1 decoding
183
do_video_decoding
M
Michael Niedermayer 已提交
184 185 186 187 188
fi

###################################
if [ -n "$do_mpeg2" ] ; then
# mpeg2 encoding
189
file=${outfile}mpeg2.mpg
190
do_video_encoding "-qscale 10" "-vcodec mpeg2video -f mpeg1video"
191 192

# mpeg2 decoding
193
do_video_decoding
194

195 196
# mpeg2 encoding using intra vlc
file=${outfile}mpeg2ivlc.mpg
197
do_video_encoding "-qscale 10" "-vcodec mpeg2video -f mpeg1video -flags2 +ivlc"
198 199

# mpeg2 decoding
200
do_video_decoding
201

M
Michael Niedermayer 已提交
202 203
# mpeg2 encoding
file=${outfile}mpeg2.mpg
204
do_video_encoding "-qscale 10" "-vcodec mpeg2video -idct int -dct int -f mpeg1video"
M
Michael Niedermayer 已提交
205 206

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

209 210
# mpeg2 encoding interlaced
file=${outfile}mpeg2i.mpg
211
do_video_encoding "-qscale 10" "-vcodec mpeg2video -f mpeg1video -flags +ildct+ilme"
212 213

# mpeg2 decoding
214
do_video_decoding
215 216
fi

217 218 219 220
###################################
if [ -n "$do_mpeg2thread" ] ; then
# mpeg2 encoding interlaced
file=${outfile}mpeg2thread.mpg
221
do_video_encoding "-qscale 10" "-vcodec mpeg2video -f mpeg1video -bf 2 -flags +ildct+ilme -threads 2"
222 223

# mpeg2 decoding
224
do_video_decoding
225 226 227

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

M
Michael Niedermayer 已提交
230
# mpeg2 decoding
231
do_video_decoding
M
Michael Niedermayer 已提交
232 233 234

# mpeg2 encoding interlaced
file=${outfile}mpeg2reuse.mpg
235
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 已提交
236

237
# mpeg2 decoding
238
do_video_decoding
239 240
fi

241 242 243 244
###################################
if [ -n "$do_msmpeg4v2" ] ; then
# msmpeg4 encoding
file=${outfile}msmpeg4v2.avi
245
do_video_encoding "-qscale 10" "-an -vcodec msmpeg4v2"
246 247

# msmpeg4v2 decoding
248
do_video_decoding
249 250
fi

251 252 253 254
###################################
if [ -n "$do_msmpeg4" ] ; then
# msmpeg4 encoding
file=${outfile}msmpeg4.avi
255
do_video_encoding "-qscale 10" "-an -vcodec msmpeg4"
256 257

# msmpeg4 decoding
258
do_video_decoding
259 260
fi

261 262 263 264
###################################
if [ -n "$do_wmv1" ] ; then
# wmv1 encoding
file=${outfile}wmv1.avi
265
do_video_encoding "-qscale 10" "-an -vcodec wmv1"
266 267

# wmv1 decoding
268
do_video_decoding
269 270
fi

271 272 273 274
###################################
if [ -n "$do_wmv2" ] ; then
# wmv2 encoding
file=${outfile}wmv2.avi
275
do_video_encoding "-qscale 10" "-an -vcodec wmv2"
276 277

# wmv2 decoding
278
do_video_decoding
279 280
fi

M
Michael Niedermayer 已提交
281 282 283 284
###################################
if [ -n "$do_h261" ] ; then
# h261 encoding
file=${outfile}h261.avi
285
do_video_encoding "-qscale 11" "-s 352x288 -an -vcodec h261"
M
Michael Niedermayer 已提交
286 287

# h261 decoding
288
do_video_decoding
M
Michael Niedermayer 已提交
289 290
fi

291 292 293 294
###################################
if [ -n "$do_h263" ] ; then
# h263 encoding
file=${outfile}h263.avi
295
do_video_encoding "-qscale 10" "-s 352x288 -an -vcodec h263"
296

M
Michael Niedermayer 已提交
297
# h263 decoding
298
do_video_decoding
M
Michael Niedermayer 已提交
299 300 301 302 303 304
fi

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

307
# h263p decoding
308
do_video_decoding
309 310 311 312 313
fi

###################################
if [ -n "$do_mpeg4" ] ; then
# mpeg4
314
file=${outfile}odivx.mp4
315
do_video_encoding "-flags +mv4 -mbd bits -qscale 10" "-an -vcodec mpeg4"
316 317

# mpeg4 decoding
318
do_video_decoding
319 320
fi

321 322 323 324
###################################
if [ -n "$do_huffyuv" ] ; then
# huffyuv
file=${outfile}huffyuv.avi
325
do_video_encoding "" "-an -vcodec huffyuv -pix_fmt yuv422p"
326 327

# huffyuv decoding
328
do_video_decoding -strict -2 -pix_fmt yuv420p
329 330
fi

331 332 333 334
###################################
if [ -n "$do_rc" ] ; then
# mpeg4 rate control
file=${outfile}mpeg4-rc.avi
335
do_video_encoding "-b 400k -bf 2" "-an -vcodec mpeg4"
336 337

# mpeg4 rate control decoding
338
do_video_decoding
339 340 341 342 343 344
fi

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

# mpeg4 decoding
348
do_video_decoding
349 350
fi

351 352 353 354
###################################
if [ -n "$do_mpeg4thread" ] ; then
# mpeg4
file=${outfile}mpeg4-thread.avi
355
do_video_encoding "-b 500k -flags +mv4+part+aic+trell -mbd bits -ps 200 -bf 2" "-an -vcodec mpeg4 -threads 2"
356 357

# mpeg4 decoding
358
do_video_decoding
359 360 361 362 363 364
fi

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

# mpeg4 decoding
368
do_video_decoding
369 370
fi

371 372 373 374
###################################
if [ -n "$do_mp4psp" ] ; then
# mp4 PSP style
file=${outfile}mpeg4-PSP.mp4
375
do_ffmpeg $file -y -b 768k -s 320x240 -f psp -ar 24000 -ab 32 -i $raw_src $file
376 377
fi

378 379 380 381
###################################
if [ -n "$do_error" ] ; then
# damaged mpeg4
file=${outfile}error-mpeg4-adv.avi
382
do_video_encoding "-qscale 7 -flags +mv4+part+aic -mbd rd -ps 250 -error 10" "-an -vcodec mpeg4"
383 384

# damaged mpeg4 decoding
385
do_video_decoding
386 387
fi

388 389 390
###################################
if [ -n "$do_mpeg4nr" ] ; then
# noise reduction
391
file=${outfile}mpeg4-nr.avi
392
do_video_encoding "-qscale 8 -flags +mv4 -mbd rd -nr 200" "-an -vcodec mpeg4"
393 394

# mpeg4 decoding
395
do_video_decoding
396 397
fi

398 399 400 401
###################################
if [ -n "$do_mpeg1b" ] ; then
# mpeg1
file=${outfile}mpeg1b.mpg
402
do_video_encoding "-qscale 8 -bf 3 -ps 200" "-an -vcodec mpeg1video -f mpeg1video"
403 404

# mpeg1 decoding
405
do_video_decoding
406 407
fi

408 409 410 411
###################################
if [ -n "$do_mjpeg" ] ; then
# mjpeg
file=${outfile}mjpeg.avi
412
do_video_encoding "-qscale 10" "-an -vcodec mjpeg -pix_fmt yuvj420p"
413 414

# mjpeg decoding
415
do_video_decoding -pix_fmt yuv420p
416 417 418
fi

###################################
419 420 421
if [ -n "$do_ljpeg" ] ; then
# ljpeg
file=${outfile}ljpeg.avi
422
do_video_encoding "" "-an -vcodec ljpeg -strict -1"
423 424

# ljpeg decoding
425
do_video_decoding
426 427
fi

M
Michael Niedermayer 已提交
428 429 430 431
###################################
if [ -n "$do_jpegls" ] ; then
# jpeg ls
file=${outfile}jpegls.avi
432
do_video_encoding "" "-an -vcodec jpegls -vtag MJPG"
M
Michael Niedermayer 已提交
433 434

# jpeg ls decoding
435
do_video_decoding -pix_fmt yuv420p
M
Michael Niedermayer 已提交
436 437
fi

438
###################################
439 440 441
if [ -n "$do_rv10" ] ; then
# rv10 encoding
file=${outfile}rv10.rm
442
do_video_encoding "-qscale 10" "-an"
443 444

# rv10 decoding
445
do_video_decoding
446 447
fi

M
Michael Niedermayer 已提交
448 449 450 451
###################################
if [ -n "$do_rv20" ] ; then
# rv20 encoding
file=${outfile}rv20.rm
452
do_video_encoding "-qscale 10" "-vcodec rv20 -an"
M
Michael Niedermayer 已提交
453 454

# rv20 decoding
455
do_video_decoding
M
Michael Niedermayer 已提交
456 457
fi

M
Michael Niedermayer 已提交
458 459 460 461
###################################
if [ -n "$do_asv1" ] ; then
# asv1 encoding
file=${outfile}asv1.avi
462
do_video_encoding "-qscale 10" "-an -vcodec asv1"
M
Michael Niedermayer 已提交
463 464

# asv1 decoding
465
do_video_decoding
M
Michael Niedermayer 已提交
466 467
fi

M
Michael Niedermayer 已提交
468 469 470 471
###################################
if [ -n "$do_asv2" ] ; then
# asv2 encoding
file=${outfile}asv2.avi
472
do_video_encoding "-qscale 10" "-an -vcodec asv2"
M
Michael Niedermayer 已提交
473 474

# asv2 decoding
475
do_video_decoding
M
Michael Niedermayer 已提交
476 477
fi

M
Michael Niedermayer 已提交
478 479 480 481
###################################
if [ -n "$do_flv" ] ; then
# flv encoding
file=${outfile}flv.flv
482
do_video_encoding "-qscale 10" "-an -vcodec flv"
M
Michael Niedermayer 已提交
483 484

# flv decoding
485
do_video_decoding
M
Michael Niedermayer 已提交
486 487
fi

M
Michael Niedermayer 已提交
488 489 490 491
###################################
if [ -n "$do_ffv1" ] ; then
# ffv1 encoding
file=${outfile}ffv1.avi
492
do_video_encoding "-strict -2" "-an -vcodec ffv1"
M
Michael Niedermayer 已提交
493 494

# ffv1 decoding
495
do_video_decoding
M
Michael Niedermayer 已提交
496 497 498 499 500 501
fi

###################################
if [ -n "$do_snow" ] ; then
# snow encoding
file=${outfile}snow.avi
502
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 已提交
503 504

# snow decoding
505
do_video_decoding -s 352x288
M
Michael Niedermayer 已提交
506
fi
M
Michael Niedermayer 已提交
507

M
Michael Niedermayer 已提交
508 509
###################################
if [ -n "$do_snowll" ] ; then
M
Michael Niedermayer 已提交
510 511
# snow encoding
file=${outfile}snow53.avi
512
do_video_encoding "-strict -2" "-an -vcodec snow -qscale .001 -pred 1 -flags +mv4+qpel"
M
Michael Niedermayer 已提交
513 514

# snow decoding
515
do_video_decoding
M
Michael Niedermayer 已提交
516 517
fi

M
Michael Niedermayer 已提交
518 519 520 521
###################################
if [ -n "$do_dv" ] ; then
# dv encoding
file=${outfile}dv.dv
522
do_video_encoding "-dct int" "-s pal -an"
M
Michael Niedermayer 已提交
523 524

# dv decoding
525
do_video_decoding -s cif
M
Michael Niedermayer 已提交
526 527
fi

D
Daniel Maas 已提交
528 529 530 531
###################################
if [ -n "$do_dv50" ] ; then
# dv50 encoding
file=${outfile}dv.dv
532
do_video_encoding "-dct int" "-s pal -pix_fmt yuv422p -an"
D
Daniel Maas 已提交
533 534

# dv50 decoding
535
do_video_decoding -s cif -pix_fmt yuv420p
D
Daniel Maas 已提交
536 537 538
fi


M
Michael Niedermayer 已提交
539 540 541 542
###################################
if [ -n "$do_svq1" ] ; then
# svq1 encoding
file=${outfile}svq1.mov
543
do_video_encoding "" "-an -vcodec svq1 -qscale 3 -pix_fmt yuv410p"
M
Michael Niedermayer 已提交
544 545

# svq1 decoding
546
do_video_decoding -pix_fmt yuv420p
M
Michael Niedermayer 已提交
547 548
fi

549 550 551 552
###################################
if [ -n "$do_mp2" ] ; then
# mp2 encoding
file=${outfile}mp2.mp2
553
do_ffmpeg $file -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src $file
554 555

# mp2 decoding
556
do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
557
$tiny_psnr $pcm_dst $pcm_ref 2 1924 >> $logfile
558 559 560 561 562 563
fi

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

# ac3 decoding
567
#do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
568 569
fi

M
Michael Niedermayer 已提交
570 571 572 573
###################################
if [ -n "$do_g726" ] ; then
# g726 encoding
file=${outfile}g726.wav
574
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 已提交
575 576

# g726 decoding
577
do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
M
Michael Niedermayer 已提交
578 579
fi

580 581 582 583
###################################
if [ -n "$do_adpcm_ima_wav" ] ; then
# encoding
file=${outfile}adpcm_ima.wav
584
do_ffmpeg $file -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src -acodec adpcm_ima_wav $file
585 586

# decoding
587
do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
588 589 590 591 592 593
fi

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

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

600 601 602 603
###################################
if [ -n "$do_adpcm_yam" ] ; then
# encoding
file=${outfile}adpcm_yam.wav
604
do_ffmpeg $file -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src -acodec adpcm_yamaha $file
605 606

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

M
Michael Niedermayer 已提交
610 611 612 613
###################################
if [ -n "$do_flac" ] ; then
# encoding
file=${outfile}flac.flac
614
do_ffmpeg $file -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src -acodec flac -compression_level 2 $file
M
Michael Niedermayer 已提交
615 616 617 618 619

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

F
Fabrice Bellard 已提交
620 621 622 623 624 625 626 627 628 629 630 631 632
###################################
# 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
633
do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src -acodec mp2 $file
634
do_ffmpeg_crc $file -i $file -r 25
F
Fabrice Bellard 已提交
635 636 637 638 639 640 641 642 643 644 645 646

# 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 已提交
647 648 649 650 651
# 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 已提交
652 653
# swf (decode audio only)
file=${outfile}libav.swf
654
do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src -acodec mp2 $file
655
do_ffmpeg_crc $file -i $file
F
Fabrice Bellard 已提交
656 657

# ffm
658 659 660
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 已提交
661

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

M
Michael Niedermayer 已提交
667
# mov
668 669 670
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 已提交
671 672

# nut
673 674 675
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 已提交
676

M
Michael Niedermayer 已提交
677
# dv
678 679 680
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 已提交
681

B
Baptiste Coudurier 已提交
682 683 684 685 686
# 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 已提交
687 688 689
####################
# streamed images
# mjpeg
690 691 692
#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 已提交
693

F
Fabrice Bellard 已提交
694 695
# pbmpipe
file=${outfile}libav.pbm
696 697
do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f image2pipe $file
do_ffmpeg_crc $file -f image2pipe -i $file
F
Fabrice Bellard 已提交
698

F
Fabrice Bellard 已提交
699
# pgmpipe
F
Fabrice Bellard 已提交
700
file=${outfile}libav.pgm
701 702
do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f image2pipe $file
do_ffmpeg_crc $file -f image2pipe -i $file
F
Fabrice Bellard 已提交
703 704

# ppmpipe
F
Fabrice Bellard 已提交
705
file=${outfile}libav.ppm
706 707
do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f image2pipe $file
do_ffmpeg_crc $file -f image2pipe -i $file
F
Fabrice Bellard 已提交
708 709 710

# gif
file=${outfile}libav.gif
711
do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -pix_fmt rgb24 $file
F
Fabrice Bellard 已提交
712 713 714
#do_ffmpeg_crc $file -i $file

# yuv4mpeg
715
file=${outfile}libav.y4m
F
Fabrice Bellard 已提交
716 717
do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src $file
#do_ffmpeg_crc $file -i $file
F
Fabrice Bellard 已提交
718 719 720 721

####################
# image formats
# pgm (we do not do md5 on image files yet)
722
file=${outfile}libav%02d.pgm
F
Fabrice Bellard 已提交
723 724 725 726
$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)
727
file=${outfile}libav%02d.ppm
F
Fabrice Bellard 已提交
728 729 730
$ffmpeg -t 0.5 -y -qscale 10 -f pgmyuv -i $raw_src $file
do_ffmpeg_crc $file -i $file

731
# jpeg (we do not do md5 on image files yet)
732
file=${outfile}libav%02d.jpg
733
$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 已提交
734
do_ffmpeg_crc $file -f image2 -i $file
735

F
Fabrice Bellard 已提交
736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758
####################
# audio only

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

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

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

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

759 760 761 762 763
# mmf
file=${outfile}libav.mmf
do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
do_ffmpeg_crc $file -i $file

764 765 766 767 768
# aiff
file=${outfile}libav.aif
do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
do_ffmpeg_crc $file -i $file

A
Aurelien Jacobs 已提交
769 770 771 772 773
# voc
file=${outfile}libav.voc
do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
do_ffmpeg_crc $file -i $file

774 775 776 777
####################
# pix_fmt conversions
conversions="yuv420p yuv422p yuv444p yuv422 yuv410p yuv411p yuvj420p \
             yuvj422p yuvj444p rgb24 bgr24 rgba32 rgb565 rgb555 gray monow \
778
             monob pal8"
779 780 781 782 783 784 785 786
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 已提交
787 788 789
fi


790

M
Michael Niedermayer 已提交
791
if $diff_cmd "$logfile" "$reffile" ; then
792
    echo
793 794 795
    echo Regression test succeeded.
    exit 0
else
796
    echo
797 798 799
    echo Regression test: Error.
    exit 1
fi