regression.sh 16.8 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
do_video_decoding()
{
160
    do_ffmpeg $raw_dst -y $1 -i $file -f rawvideo $2 $raw_dst
161 162 163 164
}

do_video_encoding()
{
165
    file=${outfile}$1
166
    do_ffmpeg $file -y $2 -f $3 -i $raw_src $4 $file
167 168
}

169 170 171 172 173 174 175 176 177 178 179
do_audio_encoding()
{
    file=${outfile}$1
    do_ffmpeg $file -y -ab 128 -ac 2 -f s16le -i $pcm_src $3 $file
}

do_audio_decoding()
{
    do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
}

D
Diego Biurrun 已提交
180 181 182 183 184 185 186 187
do_libav()
{
    file=${outfile}libav.$1
    do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $2 $file
    do_ffmpeg_crc $file -i $file $3

}

188 189 190 191 192 193 194
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
}

D
Diego Biurrun 已提交
195 196 197 198 199 200 201 202
do_image_formats()
{
    file=${outfile}libav%02d.$1
    $ffmpeg -t 0.5 -y -qscale 10 -f pgmyuv -i $raw_src $2 $3 $file
    do_ffmpeg_crc $file $3 -i $file

}

203 204 205 206 207 208 209
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
}

210 211 212
echo "ffmpeg regression test" > $logfile
echo "ffmpeg benchmarks" > $benchfile

213 214 215
###################################
# generate reference for quality check
do_ffmpeg_nocheck $raw_ref -y -f pgmyuv -i $raw_src -an -f rawvideo $raw_ref
216
do_ffmpeg_nocheck $pcm_ref -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src -f wav $pcm_ref
217

218 219 220
###################################
if [ -n "$do_mpeg" ] ; then
# mpeg1 encoding
221
do_video_encoding mpeg1.mpg "-qscale 10" pgmyuv "-f mpeg1video"
222 223

# mpeg1 decoding
224
do_video_decoding
M
Michael Niedermayer 已提交
225 226 227 228 229
fi

###################################
if [ -n "$do_mpeg2" ] ; then
# mpeg2 encoding
230
do_video_encoding mpeg2.mpg "-qscale 10" pgmyuv "-vcodec mpeg2video -f mpeg1video"
231 232

# mpeg2 decoding
233
do_video_decoding
234

235 236
# mpeg2 encoding intra vlc qprd
do_video_encoding mpeg2ivlc-qprd.mpg "-b 500k -bf 2 -flags +trell+qprd+mv0 -flags2 +ivlc -cmp 2 -subcmp 2 -mbd rd" pgmyuv "-vcodec mpeg2video -f mpeg2video"
237 238

# mpeg2 decoding
239
do_video_decoding
240

M
Michael Niedermayer 已提交
241
# mpeg2 encoding
242
do_video_encoding mpeg2.mpg "-qscale 10" pgmyuv "-vcodec mpeg2video -idct int -dct int -f mpeg1video"
M
Michael Niedermayer 已提交
243 244

# mpeg2 decoding
245
do_video_decoding "-idct int"
M
Michael Niedermayer 已提交
246

247
# mpeg2 encoding interlaced
248
do_video_encoding mpeg2i.mpg "-qscale 10" pgmyuv "-vcodec mpeg2video -f mpeg1video -flags +ildct+ilme"
249 250

# mpeg2 decoding
251
do_video_decoding
252 253
fi

254 255 256
###################################
if [ -n "$do_mpeg2thread" ] ; then
# mpeg2 encoding interlaced
257
do_video_encoding mpeg2thread.mpg "-qscale 10" pgmyuv "-vcodec mpeg2video -f mpeg1video -bf 2 -flags +ildct+ilme -threads 2"
258 259

# mpeg2 decoding
260
do_video_decoding
261 262

# mpeg2 encoding interlaced using intra vlc
263
do_video_encoding mpeg2threadivlc.mpg "-qscale 10" pgmyuv "-vcodec mpeg2video -f mpeg1video -bf 2 -flags +ildct+ilme -flags2 +ivlc -threads 2"
264

M
Michael Niedermayer 已提交
265
# mpeg2 decoding
266
do_video_decoding
M
Michael Niedermayer 已提交
267 268 269

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

272
# mpeg2 decoding
273
do_video_decoding
274 275
fi

276 277 278
###################################
if [ -n "$do_msmpeg4v2" ] ; then
# msmpeg4 encoding
279
do_video_encoding msmpeg4v2.avi "-qscale 10" pgmyuv "-an -vcodec msmpeg4v2"
280 281

# msmpeg4v2 decoding
282
do_video_decoding
283 284
fi

285 286 287
###################################
if [ -n "$do_msmpeg4" ] ; then
# msmpeg4 encoding
288
do_video_encoding msmpeg4.avi "-qscale 10" pgmyuv "-an -vcodec msmpeg4"
289 290

# msmpeg4 decoding
291
do_video_decoding
292 293
fi

294 295 296
###################################
if [ -n "$do_wmv1" ] ; then
# wmv1 encoding
297
do_video_encoding wmv1.avi "-qscale 10" pgmyuv "-an -vcodec wmv1"
298 299

# wmv1 decoding
300
do_video_decoding
301 302
fi

303 304 305
###################################
if [ -n "$do_wmv2" ] ; then
# wmv2 encoding
306
do_video_encoding wmv2.avi "-qscale 10" pgmyuv "-an -vcodec wmv2"
307 308

# wmv2 decoding
309
do_video_decoding
310 311
fi

M
Michael Niedermayer 已提交
312 313 314
###################################
if [ -n "$do_h261" ] ; then
# h261 encoding
315
do_video_encoding h261.avi "-qscale 11" pgmyuv "-s 352x288 -an -vcodec h261"
M
Michael Niedermayer 已提交
316 317

# h261 decoding
318
do_video_decoding
M
Michael Niedermayer 已提交
319 320
fi

321 322 323
###################################
if [ -n "$do_h263" ] ; then
# h263 encoding
324
do_video_encoding h263.avi "-qscale 10" pgmyuv "-s 352x288 -an -vcodec h263"
325

M
Michael Niedermayer 已提交
326
# h263 decoding
327
do_video_decoding
M
Michael Niedermayer 已提交
328 329 330 331 332
fi

###################################
if [ -n "$do_h263p" ] ; then
# h263p encoding
333
do_video_encoding h263p.avi "-qscale 2 -flags +umv+aiv+aic" pgmyuv "-s 352x288 -an -vcodec h263p -ps 300"
M
Michael Niedermayer 已提交
334

335
# h263p decoding
336
do_video_decoding
337 338 339 340 341
fi

###################################
if [ -n "$do_mpeg4" ] ; then
# mpeg4
342
do_video_encoding odivx.mp4 "-flags +mv4 -mbd bits -qscale 10" pgmyuv "-an -vcodec mpeg4"
343 344

# mpeg4 decoding
345
do_video_decoding
346 347
fi

348 349 350
###################################
if [ -n "$do_huffyuv" ] ; then
# huffyuv
351
do_video_encoding huffyuv.avi "" pgmyuv "-an -vcodec huffyuv -pix_fmt yuv422p"
352 353

# huffyuv decoding
354
do_video_decoding "" "-strict -2 -pix_fmt yuv420p"
355 356
fi

357 358 359
###################################
if [ -n "$do_rc" ] ; then
# mpeg4 rate control
360
do_video_encoding mpeg4-rc.avi "-b 400k -bf 2" pgmyuv "-an -vcodec mpeg4"
361 362

# mpeg4 rate control decoding
363
do_video_decoding
364 365 366 367 368
fi

###################################
if [ -n "$do_mpeg4adv" ] ; then
# mpeg4
369
do_video_encoding mpeg4-adv.avi "-qscale 9 -flags +mv4+part+aic+trell -mbd bits -ps 200" pgmyuv "-an -vcodec mpeg4"
370

371 372 373 374 375 376 377 378 379 380 381 382
# mpeg4 decoding
do_video_decoding

# mpeg4
do_video_encoding mpeg4-qprd.avi "-b 450k -bf 2 -flags +mv4+trell+qprd+mv0 -cmp 2 -subcmp 2 -mbd rd" pgmyuv "-an -vcodec mpeg4"

# mpeg4 decoding
do_video_decoding

# mpeg4
do_video_encoding mpeg4-adap.avi "-b 550k -bf 2 -flags +mv4+trell+mv0 -cmp 1 -subcmp 2 -mbd rd -scplx_mask 0.3" pgmyuv "-an -vcodec mpeg4"

383
# mpeg4 decoding
384
do_video_decoding
385 386
fi

387 388 389
###################################
if [ -n "$do_mpeg4thread" ] ; then
# mpeg4
390
do_video_encoding mpeg4-thread.avi "-b 500k -flags +mv4+part+aic+trell -mbd bits -ps 200 -bf 2" pgmyuv "-an -vcodec mpeg4 -threads 2"
391 392

# mpeg4 decoding
393
do_video_decoding
394 395 396 397 398
fi

###################################
if [ -n "$do_mpeg4adv" ] ; then
# mpeg4
399
do_video_encoding mpeg4-Q.avi "-qscale 7 -flags +mv4+qpel -mbd 2 -bf 2 -cmp 1 -subcmp 2" pgmyuv "-an -vcodec mpeg4"
400 401

# mpeg4 decoding
402
do_video_decoding
403 404
fi

405 406 407
###################################
if [ -n "$do_mp4psp" ] ; then
# mp4 PSP style
408
do_video_encoding mpeg4-PSP.mp4 "-b 768k -s 320x240" psp "-ar 24000 -ab 32 -i $raw_src"
409 410
fi

411 412 413
###################################
if [ -n "$do_error" ] ; then
# damaged mpeg4
414
do_video_encoding error-mpeg4-adv.avi "-qscale 7 -flags +mv4+part+aic -mbd rd -ps 250 -error 10" pgmyuv "-an -vcodec mpeg4"
415 416

# damaged mpeg4 decoding
417
do_video_decoding
418 419
fi

420 421 422
###################################
if [ -n "$do_mpeg4nr" ] ; then
# noise reduction
423
do_video_encoding mpeg4-nr.avi "-qscale 8 -flags +mv4 -mbd rd -nr 200" pgmyuv "-an -vcodec mpeg4"
424 425

# mpeg4 decoding
426
do_video_decoding
427 428
fi

429 430 431
###################################
if [ -n "$do_mpeg1b" ] ; then
# mpeg1
432
do_video_encoding mpeg1b.mpg "-qscale 8 -bf 3 -ps 200" pgmyuv "-an -vcodec mpeg1video -f mpeg1video"
433 434

# mpeg1 decoding
435
do_video_decoding
436 437
fi

438 439 440
###################################
if [ -n "$do_mjpeg" ] ; then
# mjpeg
441
do_video_encoding mjpeg.avi "-qscale 10" pgmyuv "-an -vcodec mjpeg -pix_fmt yuvj420p"
442 443

# mjpeg decoding
444
do_video_decoding "" "-pix_fmt yuv420p"
445 446 447
fi

###################################
448 449
if [ -n "$do_ljpeg" ] ; then
# ljpeg
450
do_video_encoding ljpeg.avi "" pgmyuv "-an -vcodec ljpeg -strict -1"
451 452

# ljpeg decoding
453
do_video_decoding
454 455
fi

M
Michael Niedermayer 已提交
456 457 458
###################################
if [ -n "$do_jpegls" ] ; then
# jpeg ls
459
do_video_encoding jpegls.avi "" pgmyuv "-an -vcodec jpegls -vtag MJPG"
M
Michael Niedermayer 已提交
460 461

# jpeg ls decoding
462
do_video_decoding "" "-pix_fmt yuv420p"
M
Michael Niedermayer 已提交
463 464
fi

465
###################################
466 467
if [ -n "$do_rv10" ] ; then
# rv10 encoding
468
do_video_encoding rv10.rm "-qscale 10" pgmyuv "-an"
469 470

# rv10 decoding
471
do_video_decoding
472 473
fi

M
Michael Niedermayer 已提交
474 475 476
###################################
if [ -n "$do_rv20" ] ; then
# rv20 encoding
477
do_video_encoding rv20.rm "-qscale 10" pgmyuv "-vcodec rv20 -an"
M
Michael Niedermayer 已提交
478 479

# rv20 decoding
480
do_video_decoding
M
Michael Niedermayer 已提交
481 482
fi

M
Michael Niedermayer 已提交
483 484 485
###################################
if [ -n "$do_asv1" ] ; then
# asv1 encoding
486
do_video_encoding asv1.avi "-qscale 10" pgmyuv "-an -vcodec asv1"
M
Michael Niedermayer 已提交
487 488

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

M
Michael Niedermayer 已提交
492 493 494
###################################
if [ -n "$do_asv2" ] ; then
# asv2 encoding
495
do_video_encoding asv2.avi "-qscale 10" pgmyuv "-an -vcodec asv2"
M
Michael Niedermayer 已提交
496 497

# asv2 decoding
498
do_video_decoding
M
Michael Niedermayer 已提交
499 500
fi

M
Michael Niedermayer 已提交
501 502 503
###################################
if [ -n "$do_flv" ] ; then
# flv encoding
504
do_video_encoding flv.flv "-qscale 10" pgmyuv "-an -vcodec flv"
M
Michael Niedermayer 已提交
505 506

# flv decoding
507
do_video_decoding
M
Michael Niedermayer 已提交
508 509
fi

M
Michael Niedermayer 已提交
510 511 512
###################################
if [ -n "$do_ffv1" ] ; then
# ffv1 encoding
513
do_video_encoding ffv1.avi "-strict -2" pgmyuv "-an -vcodec ffv1"
M
Michael Niedermayer 已提交
514 515

# ffv1 decoding
516
do_video_decoding
M
Michael Niedermayer 已提交
517 518 519 520 521
fi

###################################
if [ -n "$do_snow" ] ; then
# snow encoding
522
do_video_encoding snow.avi "-strict -2" pgmyuv "-an -vcodec snow -qscale 2 -flags +qpel -me iter -dia_size 2 -cmp 12 -subcmp 12 -s 128x64"
M
Michael Niedermayer 已提交
523 524

# snow decoding
525
do_video_decoding "" "-s 352x288"
M
Michael Niedermayer 已提交
526
fi
M
Michael Niedermayer 已提交
527

M
Michael Niedermayer 已提交
528 529
###################################
if [ -n "$do_snowll" ] ; then
M
Michael Niedermayer 已提交
530
# snow encoding
531
do_video_encoding snow53.avi "-strict -2" pgmyuv "-an -vcodec snow -qscale .001 -pred 1 -flags +mv4+qpel"
M
Michael Niedermayer 已提交
532 533

# snow decoding
534
do_video_decoding
M
Michael Niedermayer 已提交
535 536
fi

M
Michael Niedermayer 已提交
537 538 539
###################################
if [ -n "$do_dv" ] ; then
# dv encoding
540
do_video_encoding dv.dv "-dct int" pgmyuv "-s pal -an"
M
Michael Niedermayer 已提交
541 542

# dv decoding
543
do_video_decoding "" "-s cif"
M
Michael Niedermayer 已提交
544 545
fi

D
Daniel Maas 已提交
546 547 548
###################################
if [ -n "$do_dv50" ] ; then
# dv50 encoding
549
do_video_encoding dv.dv "-dct int" pgmyuv "-s pal -pix_fmt yuv422p -an"
D
Daniel Maas 已提交
550 551

# dv50 decoding
552
do_video_decoding "" "-s cif -pix_fmt yuv420p"
D
Daniel Maas 已提交
553 554 555
fi


M
Michael Niedermayer 已提交
556 557 558
###################################
if [ -n "$do_svq1" ] ; then
# svq1 encoding
559
do_video_encoding svq1.mov "" pgmyuv "-an -vcodec svq1 -qscale 3 -pix_fmt yuv410p"
M
Michael Niedermayer 已提交
560 561

# svq1 decoding
562
do_video_decoding "" "-pix_fmt yuv420p"
M
Michael Niedermayer 已提交
563 564
fi

565 566 567
###################################
if [ -n "$do_mp2" ] ; then
# mp2 encoding
568
do_audio_encoding mp2.mp2 "-ar 44100"
569 570

# mp2 decoding
571
do_audio_decoding
572
$tiny_psnr $pcm_dst $pcm_ref 2 1924 >> $logfile
573 574 575 576 577
fi

###################################
if [ -n "$do_ac3" ] ; then
# ac3 encoding
578
do_audio_encoding ac3.rm "" -vn
579 580

# ac3 decoding
581
#do_audio_decoding
582 583
fi

M
Michael Niedermayer 已提交
584 585 586
###################################
if [ -n "$do_g726" ] ; then
# g726 encoding
587
do_audio_encoding g726.wav "-ar 44100" "-ab 32 -ac 1 -ar 8000 -acodec g726"
M
Michael Niedermayer 已提交
588 589

# g726 decoding
590
do_audio_decoding
M
Michael Niedermayer 已提交
591 592
fi

593 594 595
###################################
if [ -n "$do_adpcm_ima_wav" ] ; then
# encoding
596
do_audio_encoding adpcm_ima.wav "-ar 44100" "-acodec adpcm_ima_wav"
597 598

# decoding
599
do_audio_decoding
600 601 602 603 604
fi

###################################
if [ -n "$do_adpcm_ms" ] ; then
# encoding
605
do_audio_encoding adpcm_ms.wav "-ar 44100" "-acodec adpcm_ms"
606 607

# decoding
608
do_audio_decoding
609 610
fi

611 612 613
###################################
if [ -n "$do_adpcm_yam" ] ; then
# encoding
614
do_audio_encoding adpcm_yam.wav "-ar 44100" "-acodec adpcm_yamaha"
615 616

# decoding
617
do_audio_decoding
618 619
fi

M
Michael Niedermayer 已提交
620 621 622
###################################
if [ -n "$do_flac" ] ; then
# encoding
623
do_audio_encoding flac.flac "-ar 44100" "-acodec flac -compression_level 2"
M
Michael Niedermayer 已提交
624 625

# decoding
626
do_audio_decoding
M
Michael Niedermayer 已提交
627 628
fi

F
Fabrice Bellard 已提交
629 630 631 632 633 634 635
###################################
# libav testing
###################################

if [ -n "$do_libav" ] ; then

# avi
D
Diego Biurrun 已提交
636
do_libav avi
F
Fabrice Bellard 已提交
637 638

# asf
D
Diego Biurrun 已提交
639
do_libav asf "-acodec mp2" "-r 25"
F
Fabrice Bellard 已提交
640 641 642 643 644 645 646 647

# 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
D
Diego Biurrun 已提交
648
do_libav mpg
F
Fabrice Bellard 已提交
649

M
Michael Niedermayer 已提交
650
# mpegts
D
Diego Biurrun 已提交
651
do_libav ts
M
Michael Niedermayer 已提交
652

F
Fabrice Bellard 已提交
653
# swf (decode audio only)
D
Diego Biurrun 已提交
654
do_libav swf "-acodec mp2"
F
Fabrice Bellard 已提交
655 656

# ffm
D
Diego Biurrun 已提交
657
do_libav ffm
F
Fabrice Bellard 已提交
658

M
Michael Niedermayer 已提交
659
# flv
D
Diego Biurrun 已提交
660
do_libav flv -an
M
Michael Niedermayer 已提交
661

M
Michael Niedermayer 已提交
662
# mov
D
Diego Biurrun 已提交
663
do_libav mov "-acodec pcm_alaw"
M
Michael Niedermayer 已提交
664 665

# nut
D
Diego Biurrun 已提交
666
#do_libav nut "-acodec mp2"
M
Michael Niedermayer 已提交
667

M
Michael Niedermayer 已提交
668
# dv
D
Diego Biurrun 已提交
669
do_libav dv "-ar 48000 -r 25 -s pal -ac 2"
M
Michael Niedermayer 已提交
670

B
Baptiste Coudurier 已提交
671
# gxf
D
Diego Biurrun 已提交
672
do_libav gxf "-ar 48000 -r 25 -s pal -ac 1"
B
Baptiste Coudurier 已提交
673

F
Fabrice Bellard 已提交
674 675 676
####################
# streamed images
# mjpeg
677 678 679
#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 已提交
680

F
Fabrice Bellard 已提交
681
# pbmpipe
682
do_streamed_images pbm
F
Fabrice Bellard 已提交
683

F
Fabrice Bellard 已提交
684
# pgmpipe
685
do_streamed_images pgm
F
Fabrice Bellard 已提交
686 687

# ppmpipe
688
do_streamed_images ppm
F
Fabrice Bellard 已提交
689 690 691

# gif
file=${outfile}libav.gif
692
do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -pix_fmt rgb24 $file
F
Fabrice Bellard 已提交
693 694 695
#do_ffmpeg_crc $file -i $file

# yuv4mpeg
696
file=${outfile}libav.y4m
F
Fabrice Bellard 已提交
697 698
do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src $file
#do_ffmpeg_crc $file -i $file
F
Fabrice Bellard 已提交
699 700 701 702

####################
# image formats
# pgm (we do not do md5 on image files yet)
D
Diego Biurrun 已提交
703
do_image_formats pgm
F
Fabrice Bellard 已提交
704 705

# ppm (we do not do md5 on image files yet)
D
Diego Biurrun 已提交
706
do_image_formats ppm
F
Fabrice Bellard 已提交
707

708
# jpeg (we do not do md5 on image files yet)
D
Diego Biurrun 已提交
709
do_image_formats jpg "-flags +bitexact -dct fastint -idct simple -pix_fmt yuvj420p" "-f image2"
710

F
Fabrice Bellard 已提交
711 712 713 714
####################
# audio only

# wav
715
do_audio_only wav
F
Fabrice Bellard 已提交
716 717

# alaw
718
do_audio_only al
F
Fabrice Bellard 已提交
719 720

# mulaw
721
do_audio_only ul
F
Fabrice Bellard 已提交
722 723

# au
724
do_audio_only au
F
Fabrice Bellard 已提交
725

726
# mmf
727
do_audio_only mmf
728

729
# aiff
730
do_audio_only aif
731

A
Aurelien Jacobs 已提交
732
# voc
733
do_audio_only voc
A
Aurelien Jacobs 已提交
734

735 736 737 738
####################
# pix_fmt conversions
conversions="yuv420p yuv422p yuv444p yuv422 yuv410p yuv411p yuvj420p \
             yuvj422p yuvj444p rgb24 bgr24 rgba32 rgb565 rgb555 gray monow \
739
             monob pal8"
740 741 742 743 744 745 746 747
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 已提交
748 749 750
fi


751

M
Michael Niedermayer 已提交
752
if $diff_cmd "$logfile" "$reffile" ; then
753
    echo
754 755 756
    echo Regression test succeeded.
    exit 0
else
757
    echo
758 759 760
    echo Regression test: Error.
    exit 1
fi