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