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