Statistics
| Branch: | Revision:

ffmpeg / tests / regression.sh @ 307eb248

History | View | Annotate | Download (20.6 KB)

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

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

    
20
set -e
21

    
22
datadir="./data"
23

    
24
logfile="$datadir/ffmpeg.regression"
25
outfile="$datadir/a-"
26

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

    
89

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

    
109
# create the data directory if it does not exists
110
mkdir -p $datadir
111

    
112
do_ffmpeg()
113
{
114
    f="$1"
115
    shift
116
    echo $ffmpeg -y -flags +bitexact -dct fastint -idct simple $*
117
    $ffmpeg -y -flags +bitexact -dct fastint -idct simple -benchmark $* > $datadir/bench.tmp 2> /tmp/ffmpeg$$
118
    egrep -v "^(Stream|Press|Input|Output|frame|  Stream|  Duration|video:)" /tmp/ffmpeg$$ || true
119
    rm -f /tmp/ffmpeg$$
120
    do_md5sum $f >> $logfile
121
    if [ $f = $raw_dst ] ; then
122
        $tiny_psnr $f $raw_ref >> $logfile
123
    elif [ $f = $pcm_dst ] ; then
124
        $tiny_psnr $f $pcm_ref 2 >> $logfile
125
    else
126
        wc -c $f >> $logfile
127
    fi
128
    expr "`cat $datadir/bench.tmp`" : '.*utime=\(.*s\)' > $datadir/bench2.tmp
129
    echo `cat $datadir/bench2.tmp` $f >> $benchfile
130
}
131

    
132
do_ffmpeg_crc()
133
{
134
    f="$1"
135
    shift
136
    echo $ffmpeg -y -flags +bitexact -dct fastint -idct simple $* -f crc $datadir/ffmpeg.crc
137
    $ffmpeg -y -flags +bitexact -dct fastint -idct simple $* -f crc $datadir/ffmpeg.crc > /tmp/ffmpeg$$ 2>&1
138
    egrep -v "^(Stream|Press|Input|Output|frame|  Stream|  Duration|video:|ffmpeg version|  configuration|  built)" /tmp/ffmpeg$$ || true
139
    rm -f /tmp/ffmpeg$$
140
    echo "$f `cat $datadir/ffmpeg.crc`" >> $logfile
141
}
142

    
143
do_ffmpeg_nocheck()
144
{
145
    f="$1"
146
    shift
147
    echo $ffmpeg -y -flags +bitexact -dct fastint -idct simple $*
148
    $ffmpeg -y -flags +bitexact -dct fastint -idct simple -benchmark $* > $datadir/bench.tmp 2> /tmp/ffmpeg$$
149
    egrep -v "^(Stream|Press|Input|Output|frame|  Stream|  Duration|video:)" /tmp/ffmpeg$$ || true
150
    rm -f /tmp/ffmpeg$$
151
    expr "`cat $datadir/bench.tmp`" : '.*utime=\(.*s\)' > $datadir/bench2.tmp
152
    echo `cat $datadir/bench2.tmp` $f >> $benchfile
153
}
154

    
155
echo "ffmpeg regression test" > $logfile
156
echo "ffmpeg benchmarks" > $benchfile
157

    
158
###################################
159
# generate reference for quality check
160
do_ffmpeg_nocheck $raw_ref -y -f pgmyuv -i $raw_src -an -f rawvideo $raw_ref
161
do_ffmpeg_nocheck $pcm_ref -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src -f wav $pcm_ref
162

    
163
###################################
164
if [ -n "$do_mpeg" ] ; then
165
# mpeg1 encoding
166
file=${outfile}mpeg1.mpg
167
do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -f mpeg1video $file
168

    
169
# mpeg1 decoding
170
do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
171
fi
172

    
173
###################################
174
if [ -n "$do_mpeg2" ] ; then
175
# mpeg2 encoding
176
file=${outfile}mpeg2.mpg
177
do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -vcodec mpeg2video -f mpeg1video $file
178

    
179
# mpeg2 decoding
180
do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
181

    
182
# mpeg2 encoding using intra vlc
183
file=${outfile}mpeg2ivlc.mpg
184
do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -vcodec mpeg2video -f mpeg1video -flags2 +ivlc $file
185

    
186
# mpeg2 decoding
187
do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
188

    
189
# mpeg2 encoding
190
file=${outfile}mpeg2.mpg
191
do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -vcodec mpeg2video -idct int -dct int -f mpeg1video $file
192

    
193
# mpeg2 decoding
194
do_ffmpeg $raw_dst -y -idct int -i $file -f rawvideo $raw_dst
195

    
196
# mpeg2 encoding interlaced
197
file=${outfile}mpeg2i.mpg
198
do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -vcodec mpeg2video -f mpeg1video -flags +ildct+ilme $file
199

    
200
# mpeg2 decoding
201
do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
202
fi
203

    
204
###################################
205
if [ -n "$do_mpeg2thread" ] ; then
206
# mpeg2 encoding interlaced
207
file=${outfile}mpeg2thread.mpg
208
do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -vcodec mpeg2video -f mpeg1video -bf 2 -flags +ildct+ilme -threads 2 $file
209

    
210
# mpeg2 decoding
211
do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
212

    
213
# mpeg2 encoding interlaced using intra vlc
214
file=${outfile}mpeg2threadivlc.mpg
215
do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -vcodec mpeg2video -f mpeg1video -bf 2 -flags +ildct+ilme -flags2 +ivlc -threads 2 $file
216

    
217
# mpeg2 decoding
218
do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
219

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

    
224
# mpeg2 decoding
225
do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
226
fi
227

    
228
###################################
229
if [ -n "$do_msmpeg4v2" ] ; then
230
# msmpeg4 encoding
231
file=${outfile}msmpeg4v2.avi
232
do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec msmpeg4v2 $file
233

    
234
# msmpeg4v2 decoding
235
do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
236
fi
237

    
238
###################################
239
if [ -n "$do_msmpeg4" ] ; then
240
# msmpeg4 encoding
241
file=${outfile}msmpeg4.avi
242
do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec msmpeg4 $file
243

    
244
# msmpeg4 decoding
245
do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
246
fi
247

    
248
###################################
249
if [ -n "$do_wmv1" ] ; then
250
# wmv1 encoding
251
file=${outfile}wmv1.avi
252
do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec wmv1 $file
253

    
254
# wmv1 decoding
255
do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
256
fi
257

    
258
###################################
259
if [ -n "$do_wmv2" ] ; then
260
# wmv2 encoding
261
file=${outfile}wmv2.avi
262
do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec wmv2 $file
263

    
264
# wmv2 decoding
265
do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
266
fi
267

    
268
###################################
269
if [ -n "$do_h261" ] ; then
270
# h261 encoding
271
file=${outfile}h261.avi
272
do_ffmpeg $file -y -qscale 11 -f pgmyuv -i $raw_src -s 352x288 -an -vcodec h261 $file
273

    
274
# h261 decoding
275
do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
276
fi
277

    
278
###################################
279
if [ -n "$do_h263" ] ; then
280
# h263 encoding
281
file=${outfile}h263.avi
282
do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -s 352x288 -an -vcodec h263 $file
283

    
284
# h263 decoding
285
do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
286
fi
287

    
288
###################################
289
if [ -n "$do_h263p" ] ; then
290
# h263p encoding
291
file=${outfile}h263p.avi
292
do_ffmpeg $file -y -qscale 2 -flags +umv+aiv+aic -f pgmyuv -i $raw_src -s 352x288 -an -vcodec h263p -ps 300 $file
293

    
294
# h263p decoding
295
do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
296
fi
297

    
298
###################################
299
if [ -n "$do_mpeg4" ] ; then
300
# mpeg4
301
file=${outfile}odivx.mp4
302
do_ffmpeg $file -y -flags +mv4 -mbd bits -qscale 10 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file
303

    
304
# mpeg4 decoding
305
do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
306
fi
307

    
308
###################################
309
if [ -n "$do_huffyuv" ] ; then
310
# huffyuv
311
file=${outfile}huffyuv.avi
312
do_ffmpeg $file -y -f pgmyuv -i $raw_src -an -vcodec huffyuv -pix_fmt yuv422p $file
313

    
314
# huffyuv decoding
315
do_ffmpeg $raw_dst -y -i $file -f rawvideo -strict -2 -pix_fmt yuv420p $raw_dst
316
fi
317

    
318
###################################
319
if [ -n "$do_rc" ] ; then
320
# mpeg4 rate control
321
file=${outfile}mpeg4-rc.avi
322
do_ffmpeg $file -y -b 400 -bf 2 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file
323

    
324
# mpeg4 rate control decoding
325
do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
326
fi
327

    
328
###################################
329
if [ -n "$do_mpeg4adv" ] ; then
330
# mpeg4
331
file=${outfile}mpeg4-adv.avi
332
do_ffmpeg $file -y -qscale 9 -flags +mv4+part+aic+trell -mbd bits -ps 200 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file
333

    
334
# mpeg4 decoding
335
do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
336
fi
337

    
338
###################################
339
if [ -n "$do_mpeg4thread" ] ; then
340
# mpeg4
341
file=${outfile}mpeg4-thread.avi
342
do_ffmpeg $file -y -b 500 -flags +mv4+part+aic+trell -mbd bits  -ps 200 -bf 2 -f pgmyuv -i $raw_src -an -vcodec mpeg4 -threads 2 $file
343

    
344
# mpeg4 decoding
345
do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
346
fi
347

    
348
###################################
349
if [ -n "$do_mpeg4adv" ] ; then
350
# mpeg4
351
file=${outfile}mpeg4-Q.avi
352
do_ffmpeg $file -y -qscale 7 -flags +mv4+qpel -mbd 2 -bf 2 -cmp 1 -subcmp 2 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file
353

    
354
# mpeg4 decoding
355
do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
356
fi
357

    
358
###################################
359
if [ -n "$do_mp4psp" ] ; then
360
# mp4 PSP style
361
file=${outfile}mpeg4-PSP.mp4
362
do_ffmpeg $file -y -b 768 -s 320x240 -f psp -ar 24000 -ab 32 -i $raw_src $file
363
fi
364

    
365
###################################
366
if [ -n "$do_error" ] ; then
367
# damaged mpeg4
368
file=${outfile}error-mpeg4-adv.avi
369
do_ffmpeg $file -y -qscale 7 -flags +mv4+part+aic -mbd rd -ps 250 -error 10 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file
370

    
371
# damaged mpeg4 decoding
372
do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
373
fi
374

    
375
###################################
376
if [ -n "$do_mpeg4nr" ] ; then
377
# noise reduction
378
file=${outfile}mpeg4-nr.avi
379
do_ffmpeg $file -y -qscale 8 -flags +mv4 -mbd rd -nr 200 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file
380

    
381
# mpeg4 decoding
382
do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
383
fi
384

    
385
###################################
386
if [ -n "$do_mpeg1b" ] ; then
387
# mpeg1
388
file=${outfile}mpeg1b.mpg
389
do_ffmpeg $file -y -qscale 8 -bf 3 -ps 200 -f pgmyuv -i $raw_src -an -vcodec mpeg1video -f mpeg1video $file
390

    
391
# mpeg1 decoding
392
do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
393
fi
394

    
395
###################################
396
if [ -n "$do_mjpeg" ] ; then
397
# mjpeg
398
file=${outfile}mjpeg.avi
399
do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec mjpeg -pix_fmt yuvj420p $file
400

    
401
# mjpeg decoding
402
do_ffmpeg $raw_dst -y -i $file -f rawvideo -pix_fmt yuv420p $raw_dst
403
fi
404

    
405
###################################
406
if [ -n "$do_ljpeg" ] ; then
407
# ljpeg
408
file=${outfile}ljpeg.avi
409
do_ffmpeg $file -y -f pgmyuv -i $raw_src -an -vcodec ljpeg -strict -1 $file
410

    
411
# ljpeg decoding
412
do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
413
fi
414

    
415
###################################
416
if [ -n "$do_jpegls" ] ; then
417
# jpeg ls
418
file=${outfile}jpegls.avi
419
do_ffmpeg $file -y -f pgmyuv -i $raw_src -an -vcodec jpegls -vtag MJPG $file
420

    
421
# jpeg ls decoding
422
do_ffmpeg $raw_dst -y -i $file -f rawvideo -pix_fmt yuv420p $raw_dst
423
fi
424

    
425
###################################
426
if [ -n "$do_rv10" ] ; then
427
# rv10 encoding
428
file=${outfile}rv10.rm
429
do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an $file
430

    
431
# rv10 decoding
432
do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
433
fi
434

    
435
###################################
436
if [ -n "$do_rv20" ] ; then
437
# rv20 encoding
438
file=${outfile}rv20.rm
439
do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -vcodec rv20 -an $file
440

    
441
# rv20 decoding
442
do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
443
fi
444

    
445
###################################
446
if [ -n "$do_asv1" ] ; then
447
# asv1 encoding
448
file=${outfile}asv1.avi
449
do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec asv1 $file
450

    
451
# asv1 decoding
452
do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
453
fi
454

    
455
###################################
456
if [ -n "$do_asv2" ] ; then
457
# asv2 encoding
458
file=${outfile}asv2.avi
459
do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec asv2 $file
460

    
461
# asv2 decoding
462
do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
463
fi
464

    
465
###################################
466
if [ -n "$do_flv" ] ; then
467
# flv encoding
468
file=${outfile}flv.flv
469
do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec flv $file
470

    
471
# flv decoding
472
do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
473
fi
474

    
475
###################################
476
if [ -n "$do_ffv1" ] ; then
477
# ffv1 encoding
478
file=${outfile}ffv1.avi
479
do_ffmpeg $file -y -strict -2 -f pgmyuv -i $raw_src -an -vcodec ffv1 $file
480

    
481
# ffv1 decoding
482
do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
483
fi
484

    
485
###################################
486
if [ -n "$do_snow" ] ; then
487
# snow encoding
488
file=${outfile}snow.avi
489
do_ffmpeg $file -y -strict -2 -f pgmyuv -i $raw_src -an -vcodec snow -qscale 2 -flags +qpel -me iter -dia_size 2 -cmp 12 -subcmp 12 -s 128x64 $file
490

    
491
# snow decoding
492
do_ffmpeg $raw_dst -y -i $file -f rawvideo -s 352x288 $raw_dst
493
fi
494

    
495
###################################
496
if [ -n "$do_snowll" ] ; then
497
# snow encoding
498
file=${outfile}snow53.avi
499
do_ffmpeg $file -y -strict -2 -f pgmyuv -i $raw_src -an -vcodec snow -pred 1 -flags +mv4+qpel $file
500

    
501
# snow decoding
502
do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
503
fi
504

    
505
###################################
506
if [ -n "$do_dv" ] ; then
507
# dv encoding
508
file=${outfile}dv.dv
509
do_ffmpeg $file -dct int -y -f pgmyuv -i $raw_src -s pal -an $file
510

    
511
# dv decoding
512
do_ffmpeg $raw_dst -y -i $file -f rawvideo -s cif $raw_dst
513
fi
514

    
515
###################################
516
if [ -n "$do_dv50" ] ; then
517
# dv50 encoding
518
file=${outfile}dv.dv
519
do_ffmpeg $file -dct int -y -f pgmyuv -i $raw_src -s pal -pix_fmt yuv422p -an $file
520

    
521
# dv50 decoding
522
do_ffmpeg $raw_dst -y -i $file -f rawvideo -s cif -pix_fmt yuv420p $raw_dst
523
fi
524

    
525

    
526
###################################
527
if [ -n "$do_svq1" ] ; then
528
# svq1 encoding
529
file=${outfile}svq1.mov
530
do_ffmpeg $file -y -f pgmyuv -i $raw_src -an -vcodec svq1 -qscale 3 -pix_fmt yuv410p $file
531

    
532
# svq1 decoding
533
do_ffmpeg $raw_dst -y -i $file -f rawvideo -pix_fmt yuv420p $raw_dst
534
fi
535

    
536
###################################
537
if [ -n "$do_mp2" ] ; then
538
# mp2 encoding
539
file=${outfile}mp2.mp2
540
do_ffmpeg $file -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src $file
541

    
542
# mp2 decoding
543
do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
544
$tiny_psnr $pcm_dst $pcm_ref 2 1924 >> $logfile
545
fi
546

    
547
###################################
548
if [ -n "$do_ac3" ] ; then
549
# ac3 encoding
550
file=${outfile}ac3.rm
551
do_ffmpeg $file -y -ab 128 -ac 2 -f s16le  -i $pcm_src -vn $file
552

    
553
# ac3 decoding
554
#do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
555
fi
556

    
557
###################################
558
if [ -n "$do_g726" ] ; then
559
# g726 encoding
560
file=${outfile}g726.wav
561
do_ffmpeg $file -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src -ab 32 -ac 1 -ar 8000 -acodec g726 $file
562

    
563
# g726 decoding
564
do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
565
fi
566

    
567
###################################
568
if [ -n "$do_adpcm_ima_wav" ] ; then
569
# encoding
570
file=${outfile}adpcm_ima.wav
571
do_ffmpeg $file -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src -acodec adpcm_ima_wav $file
572

    
573
# decoding
574
do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
575
fi
576

    
577
###################################
578
if [ -n "$do_adpcm_ms" ] ; then
579
# encoding
580
file=${outfile}adpcm_ms.wav
581
do_ffmpeg $file -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src -acodec adpcm_ms $file
582

    
583
# decoding
584
do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
585
fi
586

    
587
###################################
588
if [ -n "$do_adpcm_yam" ] ; then
589
# encoding
590
file=${outfile}adpcm_yam.wav
591
do_ffmpeg $file -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src -acodec adpcm_yamaha $file
592

    
593
# decoding
594
do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
595
fi
596

    
597
###################################
598
# libav testing
599
###################################
600

    
601
if [ -n "$do_libav" ] ; then
602

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

    
608
# asf
609
file=${outfile}libav.asf
610
do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src -acodec mp2 $file
611
do_ffmpeg_crc $file -i $file -r 25
612

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

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

    
624
# mpegts
625
file=${outfile}libav.ts
626
do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
627
do_ffmpeg_crc $file -i $file
628

    
629
# swf (decode audio only)
630
file=${outfile}libav.swf
631
do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src -acodec mp2 $file
632
do_ffmpeg_crc $file -i $file
633

    
634
# ffm
635
file=${outfile}libav.ffm
636
do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
637
do_ffmpeg_crc $file -i $file
638

    
639
# flv
640
file=${outfile}libav.flv
641
do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src -an $file
642
do_ffmpeg_crc $file -i $file
643

    
644
# mov
645
file=${outfile}libav.mov
646
do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src -acodec pcm_alaw $file
647
do_ffmpeg_crc $file -i $file
648

    
649
# nut
650
file=${outfile}libav.nut
651
do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src -acodec mp2 $file
652
do_ffmpeg_crc $file -i $file
653

    
654
# dv
655
file=${outfile}libav.dv
656
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
657
do_ffmpeg_crc $file -i $file
658

    
659
####################
660
# streamed images
661
# mjpeg
662
#file=${outfile}libav.mjpeg
663
#do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src $file
664
#do_ffmpeg_crc $file -i $file
665

    
666
# pbmpipe
667
file=${outfile}libav.pbm
668
do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f image2pipe $file
669
do_ffmpeg_crc $file -f image2pipe -i $file
670

    
671
# pgmpipe
672
file=${outfile}libav.pgm
673
do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f image2pipe $file
674
do_ffmpeg_crc $file -f image2pipe -i $file
675

    
676
# ppmpipe
677
file=${outfile}libav.ppm
678
do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f image2pipe $file
679
do_ffmpeg_crc $file -f image2pipe -i $file
680

    
681
# gif
682
file=${outfile}libav.gif
683
do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src $file
684
#do_ffmpeg_crc $file -i $file
685

    
686
# yuv4mpeg
687
file=${outfile}libav.y4m
688
do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src $file
689
#do_ffmpeg_crc $file -i $file
690

    
691
####################
692
# image formats
693
# pgm (we do not do md5 on image files yet)
694
file=${outfile}libav%02d.pgm
695
$ffmpeg -t 0.5 -y -qscale 10 -f pgmyuv -i $raw_src $file
696
do_ffmpeg_crc $file -i $file
697

    
698
# ppm (we do not do md5 on image files yet)
699
file=${outfile}libav%02d.ppm
700
$ffmpeg -t 0.5 -y -qscale 10 -f pgmyuv -i $raw_src $file
701
do_ffmpeg_crc $file -i $file
702

    
703
# jpeg (we do not do md5 on image files yet)
704
file=${outfile}libav%02d.jpg
705
$ffmpeg -t 0.5 -y -qscale 10 -f pgmyuv -i $raw_src -flags +bitexact -dct fastint -idct simple -pix_fmt yuvj420p -f image2 $file
706
do_ffmpeg_crc $file -f image2 -i $file
707

    
708
####################
709
# audio only
710

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

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

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

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

    
731
# mmf
732
file=${outfile}libav.mmf
733
do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
734
do_ffmpeg_crc $file -i $file
735

    
736
# aiff
737
file=${outfile}libav.aif
738
do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
739
do_ffmpeg_crc $file -i $file
740

    
741
# voc
742
file=${outfile}libav.voc
743
do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
744
do_ffmpeg_crc $file -i $file
745

    
746
####################
747
# pix_fmt conversions
748
conversions="yuv420p yuv422p yuv444p yuv422 yuv410p yuv411p yuvj420p \
749
             yuvj422p yuvj444p rgb24 bgr24 rgba32 rgb565 rgb555 gray monow \
750
             monob pal8"
751
for pix_fmt in $conversions ; do
752
    file=${outfile}libav-${pix_fmt}.yuv
753
    do_ffmpeg_nocheck $file -r 1 -t 1 -y -f pgmyuv -i $raw_src \
754
                            -f rawvideo -s 352x288 -pix_fmt $pix_fmt $raw_dst
755
    do_ffmpeg $file -f rawvideo -s 352x288 -pix_fmt $pix_fmt -i $raw_dst \
756
                    -f rawvideo -s 352x288 -pix_fmt yuv444p $file
757
done
758

    
759
fi
760

    
761

    
762

    
763
if $diff_cmd "$logfile" "$reffile" ; then
764
    echo
765
    echo Regression test succeeded.
766
    exit 0
767
else
768
    echo
769
    echo Regression test: Error.
770
    exit 1
771
fi