a47c5e1bbf22d7a27f80f14b85864bc075ce901a
[libav.git] / tests / regression.sh
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_flac=y
72 do_rc=y
73 do_mpeg4adv=y
74 do_mpeg4thread=y
75 do_mpeg4nr=y
76 do_mpeg1b=y
77 do_asv1=y
78 do_asv2=y
79 do_flv=y
80 do_ffv1=y
81 do_error=y
82 do_svq1=y
83 do_snow=y
84 do_snowll=y
85 do_adpcm_yam=y
86 do_dv=y
87 do_dv50=y
88 fi
89
90
91 # various files
92 ffmpeg="../ffmpeg_g"
93 tiny_psnr="./tiny_psnr"
94 reffile="$2"
95 benchfile="$datadir/ffmpeg.bench"
96 raw_src="$3/%02d.pgm"
97 raw_dst="$datadir/out.yuv"
98 raw_ref="$datadir/ref.yuv"
99 pcm_src="asynth1.sw"
100 pcm_dst="$datadir/out.wav"
101 pcm_ref="$datadir/ref.wav"
102 if [ X"`echo | md5sum 2> /dev/null`" != X ]; then
103 do_md5sum() { md5sum -b $1; }
104 elif [ -x /sbin/md5 ]; then
105 do_md5sum() { /sbin/md5 -r $1 | sed 's# \**\./# *./#'; }
106 else
107 do_md5sum() { echo No md5sum program found; }
108 fi
109
110 # create the data directory if it does not exists
111 mkdir -p $datadir
112
113 FFMPEG_OPTS="-y -flags +bitexact -dct fastint -idct simple"
114
115 do_ffmpeg()
116 {
117 f="$1"
118 shift
119 echo $ffmpeg $FFMPEG_OPTS $*
120 $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 if [ $f = $raw_dst ] ; then
125 $tiny_psnr $f $raw_ref >> $logfile
126 elif [ $f = $pcm_dst ] ; then
127 $tiny_psnr $f $pcm_ref 2 >> $logfile
128 else
129 wc -c $f >> $logfile
130 fi
131 expr "`cat $datadir/bench.tmp`" : '.*utime=\(.*s\)' > $datadir/bench2.tmp
132 echo `cat $datadir/bench2.tmp` $f >> $benchfile
133 }
134
135 do_ffmpeg_crc()
136 {
137 f="$1"
138 shift
139 echo $ffmpeg $FFMPEG_OPTS $* -f crc $datadir/ffmpeg.crc
140 $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
144 }
145
146 do_ffmpeg_nocheck()
147 {
148 f="$1"
149 shift
150 echo $ffmpeg $FFMPEG_OPTS $*
151 $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 expr "`cat $datadir/bench.tmp`" : '.*utime=\(.*s\)' > $datadir/bench2.tmp
155 echo `cat $datadir/bench2.tmp` $f >> $benchfile
156 }
157
158 echo "ffmpeg regression test" > $logfile
159 echo "ffmpeg benchmarks" > $benchfile
160
161 ###################################
162 # generate reference for quality check
163 do_ffmpeg_nocheck $raw_ref -y -f pgmyuv -i $raw_src -an -f rawvideo $raw_ref
164 do_ffmpeg_nocheck $pcm_ref -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src -f wav $pcm_ref
165
166 ###################################
167 if [ -n "$do_mpeg" ] ; then
168 # mpeg1 encoding
169 file=${outfile}mpeg1.mpg
170 do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -f mpeg1video $file
171
172 # mpeg1 decoding
173 do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
174 fi
175
176 ###################################
177 if [ -n "$do_mpeg2" ] ; then
178 # mpeg2 encoding
179 file=${outfile}mpeg2.mpg
180 do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -vcodec mpeg2video -f mpeg1video $file
181
182 # mpeg2 decoding
183 do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
184
185 # mpeg2 encoding using intra vlc
186 file=${outfile}mpeg2ivlc.mpg
187 do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -vcodec mpeg2video -f mpeg1video -flags2 +ivlc $file
188
189 # mpeg2 decoding
190 do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
191
192 # mpeg2 encoding
193 file=${outfile}mpeg2.mpg
194 do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -vcodec mpeg2video -idct int -dct int -f mpeg1video $file
195
196 # mpeg2 decoding
197 do_ffmpeg $raw_dst -y -idct int -i $file -f rawvideo $raw_dst
198
199 # mpeg2 encoding interlaced
200 file=${outfile}mpeg2i.mpg
201 do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -vcodec mpeg2video -f mpeg1video -flags +ildct+ilme $file
202
203 # mpeg2 decoding
204 do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
205 fi
206
207 ###################################
208 if [ -n "$do_mpeg2thread" ] ; then
209 # mpeg2 encoding interlaced
210 file=${outfile}mpeg2thread.mpg
211 do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -vcodec mpeg2video -f mpeg1video -bf 2 -flags +ildct+ilme -threads 2 $file
212
213 # mpeg2 decoding
214 do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
215
216 # mpeg2 encoding interlaced using intra vlc
217 file=${outfile}mpeg2threadivlc.mpg
218 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
219
220 # mpeg2 decoding
221 do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
222
223 # mpeg2 encoding interlaced
224 file=${outfile}mpeg2reuse.mpg
225 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
226
227 # mpeg2 decoding
228 do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
229 fi
230
231 ###################################
232 if [ -n "$do_msmpeg4v2" ] ; then
233 # msmpeg4 encoding
234 file=${outfile}msmpeg4v2.avi
235 do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec msmpeg4v2 $file
236
237 # msmpeg4v2 decoding
238 do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
239 fi
240
241 ###################################
242 if [ -n "$do_msmpeg4" ] ; then
243 # msmpeg4 encoding
244 file=${outfile}msmpeg4.avi
245 do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec msmpeg4 $file
246
247 # msmpeg4 decoding
248 do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
249 fi
250
251 ###################################
252 if [ -n "$do_wmv1" ] ; then
253 # wmv1 encoding
254 file=${outfile}wmv1.avi
255 do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec wmv1 $file
256
257 # wmv1 decoding
258 do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
259 fi
260
261 ###################################
262 if [ -n "$do_wmv2" ] ; then
263 # wmv2 encoding
264 file=${outfile}wmv2.avi
265 do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec wmv2 $file
266
267 # wmv2 decoding
268 do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
269 fi
270
271 ###################################
272 if [ -n "$do_h261" ] ; then
273 # h261 encoding
274 file=${outfile}h261.avi
275 do_ffmpeg $file -y -qscale 11 -f pgmyuv -i $raw_src -s 352x288 -an -vcodec h261 $file
276
277 # h261 decoding
278 do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
279 fi
280
281 ###################################
282 if [ -n "$do_h263" ] ; then
283 # h263 encoding
284 file=${outfile}h263.avi
285 do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -s 352x288 -an -vcodec h263 $file
286
287 # h263 decoding
288 do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
289 fi
290
291 ###################################
292 if [ -n "$do_h263p" ] ; then
293 # h263p encoding
294 file=${outfile}h263p.avi
295 do_ffmpeg $file -y -qscale 2 -flags +umv+aiv+aic -f pgmyuv -i $raw_src -s 352x288 -an -vcodec h263p -ps 300 $file
296
297 # h263p decoding
298 do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
299 fi
300
301 ###################################
302 if [ -n "$do_mpeg4" ] ; then
303 # mpeg4
304 file=${outfile}odivx.mp4
305 do_ffmpeg $file -y -flags +mv4 -mbd bits -qscale 10 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file
306
307 # mpeg4 decoding
308 do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
309 fi
310
311 ###################################
312 if [ -n "$do_huffyuv" ] ; then
313 # huffyuv
314 file=${outfile}huffyuv.avi
315 do_ffmpeg $file -y -f pgmyuv -i $raw_src -an -vcodec huffyuv -pix_fmt yuv422p $file
316
317 # huffyuv decoding
318 do_ffmpeg $raw_dst -y -i $file -f rawvideo -strict -2 -pix_fmt yuv420p $raw_dst
319 fi
320
321 ###################################
322 if [ -n "$do_rc" ] ; then
323 # mpeg4 rate control
324 file=${outfile}mpeg4-rc.avi
325 do_ffmpeg $file -y -b 400k -bf 2 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file
326
327 # mpeg4 rate control decoding
328 do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
329 fi
330
331 ###################################
332 if [ -n "$do_mpeg4adv" ] ; then
333 # mpeg4
334 file=${outfile}mpeg4-adv.avi
335 do_ffmpeg $file -y -qscale 9 -flags +mv4+part+aic+trell -mbd bits -ps 200 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file
336
337 # mpeg4 decoding
338 do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
339 fi
340
341 ###################################
342 if [ -n "$do_mpeg4thread" ] ; then
343 # mpeg4
344 file=${outfile}mpeg4-thread.avi
345 do_ffmpeg $file -y -b 500k -flags +mv4+part+aic+trell -mbd bits -ps 200 -bf 2 -f pgmyuv -i $raw_src -an -vcodec mpeg4 -threads 2 $file
346
347 # mpeg4 decoding
348 do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
349 fi
350
351 ###################################
352 if [ -n "$do_mpeg4adv" ] ; then
353 # mpeg4
354 file=${outfile}mpeg4-Q.avi
355 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
356
357 # mpeg4 decoding
358 do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
359 fi
360
361 ###################################
362 if [ -n "$do_mp4psp" ] ; then
363 # mp4 PSP style
364 file=${outfile}mpeg4-PSP.mp4
365 do_ffmpeg $file -y -b 768k -s 320x240 -f psp -ar 24000 -ab 32 -i $raw_src $file
366 fi
367
368 ###################################
369 if [ -n "$do_error" ] ; then
370 # damaged mpeg4
371 file=${outfile}error-mpeg4-adv.avi
372 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
373
374 # damaged mpeg4 decoding
375 do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
376 fi
377
378 ###################################
379 if [ -n "$do_mpeg4nr" ] ; then
380 # noise reduction
381 file=${outfile}mpeg4-nr.avi
382 do_ffmpeg $file -y -qscale 8 -flags +mv4 -mbd rd -nr 200 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file
383
384 # mpeg4 decoding
385 do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
386 fi
387
388 ###################################
389 if [ -n "$do_mpeg1b" ] ; then
390 # mpeg1
391 file=${outfile}mpeg1b.mpg
392 do_ffmpeg $file -y -qscale 8 -bf 3 -ps 200 -f pgmyuv -i $raw_src -an -vcodec mpeg1video -f mpeg1video $file
393
394 # mpeg1 decoding
395 do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
396 fi
397
398 ###################################
399 if [ -n "$do_mjpeg" ] ; then
400 # mjpeg
401 file=${outfile}mjpeg.avi
402 do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec mjpeg -pix_fmt yuvj420p $file
403
404 # mjpeg decoding
405 do_ffmpeg $raw_dst -y -i $file -f rawvideo -pix_fmt yuv420p $raw_dst
406 fi
407
408 ###################################
409 if [ -n "$do_ljpeg" ] ; then
410 # ljpeg
411 file=${outfile}ljpeg.avi
412 do_ffmpeg $file -y -f pgmyuv -i $raw_src -an -vcodec ljpeg -strict -1 $file
413
414 # ljpeg decoding
415 do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
416 fi
417
418 ###################################
419 if [ -n "$do_jpegls" ] ; then
420 # jpeg ls
421 file=${outfile}jpegls.avi
422 do_ffmpeg $file -y -f pgmyuv -i $raw_src -an -vcodec jpegls -vtag MJPG $file
423
424 # jpeg ls decoding
425 do_ffmpeg $raw_dst -y -i $file -f rawvideo -pix_fmt yuv420p $raw_dst
426 fi
427
428 ###################################
429 if [ -n "$do_rv10" ] ; then
430 # rv10 encoding
431 file=${outfile}rv10.rm
432 do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an $file
433
434 # rv10 decoding
435 do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
436 fi
437
438 ###################################
439 if [ -n "$do_rv20" ] ; then
440 # rv20 encoding
441 file=${outfile}rv20.rm
442 do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -vcodec rv20 -an $file
443
444 # rv20 decoding
445 do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
446 fi
447
448 ###################################
449 if [ -n "$do_asv1" ] ; then
450 # asv1 encoding
451 file=${outfile}asv1.avi
452 do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec asv1 $file
453
454 # asv1 decoding
455 do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
456 fi
457
458 ###################################
459 if [ -n "$do_asv2" ] ; then
460 # asv2 encoding
461 file=${outfile}asv2.avi
462 do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec asv2 $file
463
464 # asv2 decoding
465 do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
466 fi
467
468 ###################################
469 if [ -n "$do_flv" ] ; then
470 # flv encoding
471 file=${outfile}flv.flv
472 do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec flv $file
473
474 # flv decoding
475 do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
476 fi
477
478 ###################################
479 if [ -n "$do_ffv1" ] ; then
480 # ffv1 encoding
481 file=${outfile}ffv1.avi
482 do_ffmpeg $file -y -strict -2 -f pgmyuv -i $raw_src -an -vcodec ffv1 $file
483
484 # ffv1 decoding
485 do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
486 fi
487
488 ###################################
489 if [ -n "$do_snow" ] ; then
490 # snow encoding
491 file=${outfile}snow.avi
492 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
493
494 # snow decoding
495 do_ffmpeg $raw_dst -y -i $file -f rawvideo -s 352x288 $raw_dst
496 fi
497
498 ###################################
499 if [ -n "$do_snowll" ] ; then
500 # snow encoding
501 file=${outfile}snow53.avi
502 do_ffmpeg $file -y -strict -2 -f pgmyuv -i $raw_src -an -vcodec snow -qscale .001 -pred 1 -flags +mv4+qpel $file
503
504 # snow decoding
505 do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
506 fi
507
508 ###################################
509 if [ -n "$do_dv" ] ; then
510 # dv encoding
511 file=${outfile}dv.dv
512 do_ffmpeg $file -dct int -y -f pgmyuv -i $raw_src -s pal -an $file
513
514 # dv decoding
515 do_ffmpeg $raw_dst -y -i $file -f rawvideo -s cif $raw_dst
516 fi
517
518 ###################################
519 if [ -n "$do_dv50" ] ; then
520 # dv50 encoding
521 file=${outfile}dv.dv
522 do_ffmpeg $file -dct int -y -f pgmyuv -i $raw_src -s pal -pix_fmt yuv422p -an $file
523
524 # dv50 decoding
525 do_ffmpeg $raw_dst -y -i $file -f rawvideo -s cif -pix_fmt yuv420p $raw_dst
526 fi
527
528
529 ###################################
530 if [ -n "$do_svq1" ] ; then
531 # svq1 encoding
532 file=${outfile}svq1.mov
533 do_ffmpeg $file -y -f pgmyuv -i $raw_src -an -vcodec svq1 -qscale 3 -pix_fmt yuv410p $file
534
535 # svq1 decoding
536 do_ffmpeg $raw_dst -y -i $file -f rawvideo -pix_fmt yuv420p $raw_dst
537 fi
538
539 ###################################
540 if [ -n "$do_mp2" ] ; then
541 # mp2 encoding
542 file=${outfile}mp2.mp2
543 do_ffmpeg $file -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src $file
544
545 # mp2 decoding
546 do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
547 $tiny_psnr $pcm_dst $pcm_ref 2 1924 >> $logfile
548 fi
549
550 ###################################
551 if [ -n "$do_ac3" ] ; then
552 # ac3 encoding
553 file=${outfile}ac3.rm
554 do_ffmpeg $file -y -ab 128 -ac 2 -f s16le -i $pcm_src -vn $file
555
556 # ac3 decoding
557 #do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
558 fi
559
560 ###################################
561 if [ -n "$do_g726" ] ; then
562 # g726 encoding
563 file=${outfile}g726.wav
564 do_ffmpeg $file -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src -ab 32 -ac 1 -ar 8000 -acodec g726 $file
565
566 # g726 decoding
567 do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
568 fi
569
570 ###################################
571 if [ -n "$do_adpcm_ima_wav" ] ; then
572 # encoding
573 file=${outfile}adpcm_ima.wav
574 do_ffmpeg $file -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src -acodec adpcm_ima_wav $file
575
576 # decoding
577 do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
578 fi
579
580 ###################################
581 if [ -n "$do_adpcm_ms" ] ; then
582 # encoding
583 file=${outfile}adpcm_ms.wav
584 do_ffmpeg $file -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src -acodec adpcm_ms $file
585
586 # decoding
587 do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
588 fi
589
590 ###################################
591 if [ -n "$do_adpcm_yam" ] ; then
592 # encoding
593 file=${outfile}adpcm_yam.wav
594 do_ffmpeg $file -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src -acodec adpcm_yamaha $file
595
596 # decoding
597 do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
598 fi
599
600 ###################################
601 if [ -n "$do_flac" ] ; then
602 # encoding
603 file=${outfile}flac.flac
604 do_ffmpeg $file -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src -acodec flac -compression_level 2 $file
605
606 # decoding
607 do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
608 fi
609
610 ###################################
611 # libav testing
612 ###################################
613
614 if [ -n "$do_libav" ] ; then
615
616 # avi
617 file=${outfile}libav.avi
618 do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
619 do_ffmpeg_crc $file -i $file
620
621 # asf
622 file=${outfile}libav.asf
623 do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src -acodec mp2 $file
624 do_ffmpeg_crc $file -i $file -r 25
625
626 # rm
627 file=${outfile}libav.rm
628 do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
629 # broken
630 #do_ffmpeg_crc $file -i $file
631
632 # mpegps
633 file=${outfile}libav.mpg
634 do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
635 do_ffmpeg_crc $file -i $file
636
637 # mpegts
638 file=${outfile}libav.ts
639 do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
640 do_ffmpeg_crc $file -i $file
641
642 # swf (decode audio only)
643 file=${outfile}libav.swf
644 do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src -acodec mp2 $file
645 do_ffmpeg_crc $file -i $file
646
647 # ffm
648 file=${outfile}libav.ffm
649 do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
650 do_ffmpeg_crc $file -i $file
651
652 # flv
653 file=${outfile}libav.flv
654 do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src -an $file
655 do_ffmpeg_crc $file -i $file
656
657 # mov
658 file=${outfile}libav.mov
659 do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src -acodec pcm_alaw $file
660 do_ffmpeg_crc $file -i $file
661
662 # nut
663 file=${outfile}libav.nut
664 do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src -acodec mp2 $file
665 do_ffmpeg_crc $file -i $file
666
667 # dv
668 file=${outfile}libav.dv
669 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
670 do_ffmpeg_crc $file -i $file
671
672 # gxf
673 file=${outfile}libav.gxf
674 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
675 do_ffmpeg_crc $file -i $file
676
677 ####################
678 # streamed images
679 # mjpeg
680 #file=${outfile}libav.mjpeg
681 #do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src $file
682 #do_ffmpeg_crc $file -i $file
683
684 # pbmpipe
685 file=${outfile}libav.pbm
686 do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f image2pipe $file
687 do_ffmpeg_crc $file -f image2pipe -i $file
688
689 # pgmpipe
690 file=${outfile}libav.pgm
691 do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f image2pipe $file
692 do_ffmpeg_crc $file -f image2pipe -i $file
693
694 # ppmpipe
695 file=${outfile}libav.ppm
696 do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f image2pipe $file
697 do_ffmpeg_crc $file -f image2pipe -i $file
698
699 # gif
700 file=${outfile}libav.gif
701 do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -pix_fmt rgb24 $file
702 #do_ffmpeg_crc $file -i $file
703
704 # yuv4mpeg
705 file=${outfile}libav.y4m
706 do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src $file
707 #do_ffmpeg_crc $file -i $file
708
709 ####################
710 # image formats
711 # pgm (we do not do md5 on image files yet)
712 file=${outfile}libav%02d.pgm
713 $ffmpeg -t 0.5 -y -qscale 10 -f pgmyuv -i $raw_src $file
714 do_ffmpeg_crc $file -i $file
715
716 # ppm (we do not do md5 on image files yet)
717 file=${outfile}libav%02d.ppm
718 $ffmpeg -t 0.5 -y -qscale 10 -f pgmyuv -i $raw_src $file
719 do_ffmpeg_crc $file -i $file
720
721 # jpeg (we do not do md5 on image files yet)
722 file=${outfile}libav%02d.jpg
723 $ffmpeg -t 0.5 -y -qscale 10 -f pgmyuv -i $raw_src -flags +bitexact -dct fastint -idct simple -pix_fmt yuvj420p -f image2 $file
724 do_ffmpeg_crc $file -f image2 -i $file
725
726 ####################
727 # audio only
728
729 # wav
730 file=${outfile}libav.wav
731 do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
732 do_ffmpeg_crc $file -i $file
733
734 # alaw
735 file=${outfile}libav.al
736 do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
737 do_ffmpeg_crc $file -i $file
738
739 # mulaw
740 file=${outfile}libav.ul
741 do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
742 do_ffmpeg_crc $file -i $file
743
744 # au
745 file=${outfile}libav.au
746 do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
747 do_ffmpeg_crc $file -i $file
748
749 # mmf
750 file=${outfile}libav.mmf
751 do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
752 do_ffmpeg_crc $file -i $file
753
754 # aiff
755 file=${outfile}libav.aif
756 do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
757 do_ffmpeg_crc $file -i $file
758
759 # voc
760 file=${outfile}libav.voc
761 do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
762 do_ffmpeg_crc $file -i $file
763
764 ####################
765 # pix_fmt conversions
766 conversions="yuv420p yuv422p yuv444p yuv422 yuv410p yuv411p yuvj420p \
767 yuvj422p yuvj444p rgb24 bgr24 rgba32 rgb565 rgb555 gray monow \
768 monob pal8"
769 for pix_fmt in $conversions ; do
770 file=${outfile}libav-${pix_fmt}.yuv
771 do_ffmpeg_nocheck $file -r 1 -t 1 -y -f pgmyuv -i $raw_src \
772 -f rawvideo -s 352x288 -pix_fmt $pix_fmt $raw_dst
773 do_ffmpeg $file -f rawvideo -s 352x288 -pix_fmt $pix_fmt -i $raw_dst \
774 -f rawvideo -s 352x288 -pix_fmt yuv444p $file
775 done
776
777 fi
778
779
780
781 if $diff_cmd "$logfile" "$reffile" ; then
782 echo
783 echo Regression test succeeded.
784 exit 0
785 else
786 echo
787 echo Regression test: Error.
788 exit 1
789 fi