thread mess check for avcodec_open/close()
[libav.git] / tests / regression.sh
CommitLineData
51133a7d
FB
1#!/bin/sh
2#
3# automatic regression test for ffmpeg
4#
5#
6#set -x
6e023978 7# Even in the 21st century some diffs are not supporting -u.
281a74da 8diff -u "$0" "$0" > /dev/null 2>&1
6e023978
RS
9if [ $? -eq 0 ]; then
10 diff_cmd="diff -u"
11else
12 diff_cmd="diff"
13fi
14
281a74da 15diff -w "$0" "$0" > /dev/null 2>&1
d9d7653e
MN
16if [ $? -eq 0 ]; then
17 diff_cmd="$diff_cmd -w"
18fi
19
51133a7d
FB
20set -e
21
5bcfd1ad
FB
22datadir="./data"
23
24logfile="$datadir/ffmpeg.regression"
a12eea30 25outfile="$datadir/a-"
89d5dfd5 26
51133a7d
FB
27# tests to do
28if [ "$1" = "mpeg4" ] ; then
29 do_mpeg4=y
30elif [ "$1" = "mpeg" ] ; then
31 do_mpeg=y
853d659d 32 do_mpeg2=y
7481e919
FB
33elif [ "$1" = "ac3" ] ; then
34 do_ac3=y
87c5fbc3
MN
35elif [ "$1" = "huffyuv" ] ; then
36 do_huffyuv=y
7f8038ce
MN
37elif [ "$1" = "mpeg2thread" ] ; then
38 do_mpeg2thread=y
d13eef3d
MN
39elif [ "$1" = "snow" ] ; then
40 do_snow=y
89d5dfd5
FB
41elif [ "$1" = "libavtest" ] ; then
42 do_libav=y
5bcfd1ad 43 logfile="$datadir/libav.regression"
a12eea30 44 outfile="$datadir/b-"
51133a7d
FB
45else
46 do_mpeg=y
922bc38d 47 do_mpeg2=y
9c3d33d6 48 do_mpeg2thread=y
6ebd933b 49 do_msmpeg4v2=y
51133a7d 50 do_msmpeg4=y
6ebd933b 51 do_wmv1=y
e23d5712 52 do_wmv2=y
61b262a9 53 do_h261=y
51133a7d 54 do_h263=y
6e2d5f1a 55 do_h263p=y
51133a7d 56 do_mpeg4=y
e23d5712 57 do_huffyuv=y
51133a7d 58 do_mjpeg=y
3b37408b 59 do_ljpeg=y
64a7a8af 60 do_rv10=y
c50cd09d 61 do_rv20=y
51133a7d
FB
62 do_mp2=y
63 do_ac3=y
311be1fb 64 do_g726=y
f02ab814
MN
65 do_adpcm_ima_wav=y
66 do_adpcm_ms=y
1dbb6d90
MN
67 do_rc=y
68 do_mpeg4adv=y
9c3d33d6 69 do_mpeg4thread=y
be408b67 70 do_mpeg4nr=y
cfadadec 71 do_mpeg1b=y
9ca9fce1 72 do_asv1=y
8d876a43 73 do_asv2=y
bbdd42d3 74 do_flv=y
f3203047 75 do_ffv1=y
7ebfc0ea 76 do_error=y
b86bd1f1 77 do_svq1=y
d13eef3d 78 do_snow=y
51133a7d
FB
79fi
80
81
82# various files
3aca208a 83ffmpeg="../ffmpeg_g"
67cbe681 84tiny_psnr="./tiny_psnr"
51133a7d 85reffile="$2"
5bcfd1ad 86benchfile="$datadir/ffmpeg.bench"
6afd3b92 87raw_src="$3/%d.pgm"
5bcfd1ad 88raw_dst="$datadir/out.yuv"
67cbe681 89raw_ref="$datadir/ref.yuv"
51133a7d 90pcm_src="asynth1.sw"
5bcfd1ad 91pcm_dst="$datadir/out.wav"
16dd93ab 92pcm_ref="$datadir/ref.wav"
853d659d
JD
93if [ X"`echo | md5sum 2> /dev/null`" != X ]; then
94 do_md5sum() { md5sum -b $1; }
95elif [ -x /sbin/md5 ]; then
96 do_md5sum() { /sbin/md5 -r $1 | sed 's# \**\./# *./#'; }
97else
98 do_md5sum() { echo No md5sum program found; }
99fi
5bcfd1ad
FB
100
101# create the data directory if it does not exists
102mkdir -p $datadir
51133a7d 103
3f027ca7 104do_ffmpeg()
51133a7d
FB
105{
106 f="$1"
107 shift
affd55a1
RS
108 echo $ffmpeg -y -bitexact -dct_algo 1 -idct_algo 2 $*
109 $ffmpeg -y -bitexact -dct_algo 1 -idct_algo 2 -benchmark $* > $datadir/bench.tmp 2> /tmp/ffmpeg$$
37a00782 110 egrep -v "^(Stream|Press|Input|Output|frame| Stream| Duration|video:)" /tmp/ffmpeg$$ || true
e31c1c30 111 rm -f /tmp/ffmpeg$$
853d659d 112 do_md5sum $f >> $logfile
67cbe681
MN
113 if [ $f = $raw_dst ] ; then
114 $tiny_psnr $f $raw_ref >> $logfile
16dd93ab 115 elif [ $f = $pcm_dst ] ; then
976709ee 116 $tiny_psnr $f $pcm_ref 2 >> $logfile
039e7889
MN
117 else
118 wc -c $f >> $logfile
67cbe681 119 fi
90cee0c3 120 expr "`cat $datadir/bench.tmp`" : '.*utime=\(.*s\)' > $datadir/bench2.tmp
5bcfd1ad 121 echo `cat $datadir/bench2.tmp` $f >> $benchfile
51133a7d
FB
122}
123
3f027ca7 124do_ffmpeg_crc()
89d5dfd5
FB
125{
126 f="$1"
127 shift
2ad1516a 128 echo $ffmpeg -y -bitexact -dct_algo 1 -idct_algo 2 $* -f crc $datadir/ffmpeg.crc
affd55a1 129 $ffmpeg -y -bitexact -dct_algo 1 -idct_algo 2 $* -f crc $datadir/ffmpeg.crc > /tmp/ffmpeg$$ 2>&1
37a00782 130 egrep -v "^(Stream|Press|Input|Output|frame| Stream| Duration|video:|ffmpeg version| configuration| built)" /tmp/ffmpeg$$ || true
affd55a1
RS
131 rm -f /tmp/ffmpeg$$
132 echo "$f `cat $datadir/ffmpeg.crc`" >> $logfile
89d5dfd5 133}
51133a7d 134
67cbe681
MN
135do_ffmpeg_nocheck()
136{
137 f="$1"
138 shift
affd55a1
RS
139 echo $ffmpeg -y -bitexact -dct_algo 1 -idct_algo 2 $*
140 $ffmpeg -y -bitexact -dct_algo 1 -idct_algo 2 -benchmark $* > $datadir/bench.tmp 2> /tmp/ffmpeg$$
37a00782 141 egrep -v "^(Stream|Press|Input|Output|frame| Stream| Duration|video:)" /tmp/ffmpeg$$ || true
affd55a1 142 rm -f /tmp/ffmpeg$$
67cbe681
MN
143 expr "`cat $datadir/bench.tmp`" : '.*utime=\(.*s\)' > $datadir/bench2.tmp
144 echo `cat $datadir/bench2.tmp` $f >> $benchfile
145}
146
51133a7d
FB
147echo "ffmpeg regression test" > $logfile
148echo "ffmpeg benchmarks" > $benchfile
149
150###################################
67cbe681
MN
151# generate reference for quality check
152do_ffmpeg_nocheck $raw_ref -y -f pgmyuv -i $raw_src -an -f rawvideo $raw_ref
16dd93ab 153do_ffmpeg_nocheck $pcm_ref -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src -f wav $pcm_ref
67cbe681
MN
154
155###################################
51133a7d
FB
156if [ -n "$do_mpeg" ] ; then
157# mpeg1 encoding
158file=${outfile}mpeg1.mpg
89d5dfd5 159do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -f mpeg1video $file
51133a7d
FB
160
161# mpeg1 decoding
89d5dfd5 162do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
922bc38d
MN
163fi
164
165###################################
166if [ -n "$do_mpeg2" ] ; then
167# mpeg2 encoding
83dddc4a
FB
168file=${outfile}mpeg2.mpg
169do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -vcodec mpeg2video -f mpeg1video $file
170
171# mpeg2 decoding
172do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
173
6486ad57
MN
174# mpeg2 encoding
175file=${outfile}mpeg2.mpg
176do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -vcodec mpeg2video -idct_algo 1 -dct_algo 2 -f mpeg1video $file
177
178# mpeg2 decoding
179do_ffmpeg $raw_dst -y -idct_algo 1 -i $file -f rawvideo $raw_dst
180
83dddc4a
FB
181# mpeg2 encoding interlaced
182file=${outfile}mpeg2i.mpg
69768b77 183do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -vcodec mpeg2video -f mpeg1video -ildct -ilme $file
51133a7d
FB
184
185# mpeg2 decoding
922bc38d 186do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
51133a7d
FB
187fi
188
189###################################
9c3d33d6
MN
190if [ -n "$do_mpeg2thread" ] ; then
191# mpeg2 encoding interlaced
192file=${outfile}mpeg2thread.mpg
193do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -vcodec mpeg2video -f mpeg1video -bf 2 -ildct -ilme -threads 2 $file
194
195# mpeg2 decoding
196do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
7f8038ce
MN
197
198# mpeg2 encoding interlaced
199file=${outfile}mpeg2reuse.mpg
200do_ffmpeg $file -y -sameq -me_threshold 256 -mb_threshold 1024 -i ${outfile}mpeg2thread.mpg -vcodec mpeg2video -f mpeg1video -bf 2 -ildct -ilme -threads 4 $file
201
202# mpeg2 decoding
203do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
9c3d33d6
MN
204fi
205
206###################################
6ebd933b
MN
207if [ -n "$do_msmpeg4v2" ] ; then
208# msmpeg4 encoding
209file=${outfile}msmpeg4v2.avi
210do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec msmpeg4v2 $file
211
212# msmpeg4v2 decoding
213do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
214fi
215
216###################################
51133a7d
FB
217if [ -n "$do_msmpeg4" ] ; then
218# msmpeg4 encoding
219file=${outfile}msmpeg4.avi
220do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec msmpeg4 $file
221
222# msmpeg4 decoding
223do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
224fi
225
226###################################
6ebd933b
MN
227if [ -n "$do_wmv1" ] ; then
228# wmv1 encoding
229file=${outfile}wmv1.avi
230do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec wmv1 $file
231
232# wmv1 decoding
233do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
234fi
235
236###################################
e23d5712
MN
237if [ -n "$do_wmv2" ] ; then
238# wmv2 encoding
239file=${outfile}wmv2.avi
240do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec wmv2 $file
241
242# wmv2 decoding
243do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
244fi
245
246###################################
61b262a9
MN
247if [ -n "$do_h261" ] ; then
248# h261 encoding
249file=${outfile}h261.avi
250do_ffmpeg $file -y -qscale 11 -f pgmyuv -i $raw_src -s 352x288 -an -vcodec h261 $file
251
252# h261 decoding
253do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
254fi
255
256###################################
51133a7d
FB
257if [ -n "$do_h263" ] ; then
258# h263 encoding
259file=${outfile}h263.avi
260do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -s 352x288 -an -vcodec h263 $file
261
6e2d5f1a
MN
262# h263 decoding
263do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
264fi
265
266###################################
267if [ -n "$do_h263p" ] ; then
268# h263p encoding
269file=${outfile}h263p.avi
d7d24282 270do_ffmpeg $file -y -qscale 2 -umv -aiv -aic -f pgmyuv -i $raw_src -s 352x288 -an -vcodec h263p -ps 300 $file
6e2d5f1a 271
51133a7d
FB
272# h263p decoding
273do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
274fi
275
276###################################
277if [ -n "$do_mpeg4" ] ; then
278# mpeg4
28c70622 279file=${outfile}odivx.mp4
d3985de7 280do_ffmpeg $file -y -4mv -hq -qscale 10 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file
51133a7d
FB
281
282# mpeg4 decoding
283do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
284fi
285
286###################################
e629ab68
RD
287if [ -n "$do_huffyuv" ] ; then
288# huffyuv
289file=${outfile}huffyuv.avi
f37b9768 290do_ffmpeg $file -y -f pgmyuv -i $raw_src -an -vcodec huffyuv -pix_fmt yuv422p $file
e629ab68
RD
291
292# huffyuv decoding
9cd81798 293do_ffmpeg $raw_dst -y -i $file -f rawvideo -strict -2 -pix_fmt yuv420p $raw_dst
e629ab68
RD
294fi
295
296###################################
1dbb6d90
MN
297if [ -n "$do_rc" ] ; then
298# mpeg4 rate control
299file=${outfile}mpeg4-rc.avi
300do_ffmpeg $file -y -b 400 -bf 2 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file
301
302# mpeg4 rate control decoding
303do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
304fi
305
306###################################
307if [ -n "$do_mpeg4adv" ] ; then
308# mpeg4
309file=${outfile}mpeg4-adv.avi
c0baa56a 310do_ffmpeg $file -y -qscale 9 -4mv -hq -part -ps 200 -aic -trell -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file
1dbb6d90
MN
311
312# mpeg4 decoding
313do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
314fi
315
316###################################
9c3d33d6
MN
317if [ -n "$do_mpeg4thread" ] ; then
318# mpeg4
319file=${outfile}mpeg4-thread.avi
320do_ffmpeg $file -y -b 500 -4mv -hq -part -ps 200 -aic -trell -bf 2 -f pgmyuv -i $raw_src -an -vcodec mpeg4 -threads 2 $file
321
322# mpeg4 decoding
323do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
aab9cdcf
MN
324fi
325
326###################################
327if [ -n "$do_mpeg4adv" ] ; then
328# mpeg4
329file=${outfile}mpeg4-Q.avi
330do_ffmpeg $file -y -qscale 7 -4mv -mbd 2 -qpel -bf 2 -cmp 1 -subcmp 2 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file
331
332# mpeg4 decoding
333do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
9c3d33d6
MN
334fi
335
336###################################
7ebfc0ea
MN
337if [ -n "$do_error" ] ; then
338# damaged mpeg4
339file=${outfile}error-mpeg4-adv.avi
340do_ffmpeg $file -y -qscale 7 -4mv -mbd 2 -part -ps 250 -error 10 -aic -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file
341
342# damaged mpeg4 decoding
343do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
344fi
345
346###################################
be408b67
MN
347if [ -n "$do_mpeg4nr" ] ; then
348# noise reduction
9c3d33d6 349file=${outfile}mpeg4-nr.avi
be408b67
MN
350do_ffmpeg $file -y -qscale 8 -4mv -mbd 2 -nr 200 -f pgmyuv -i $raw_src -an -vcodec mpeg4 $file
351
352# mpeg4 decoding
353do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
354fi
355
356###################################
cfadadec
MN
357if [ -n "$do_mpeg1b" ] ; then
358# mpeg1
359file=${outfile}mpeg1b.mpg
83dddc4a 360do_ffmpeg $file -y -qscale 8 -bf 3 -ps 200 -f pgmyuv -i $raw_src -an -vcodec mpeg1video -f mpeg1video $file
cfadadec
MN
361
362# mpeg1 decoding
363do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
364fi
365
366###################################
51133a7d
FB
367if [ -n "$do_mjpeg" ] ; then
368# mjpeg
369file=${outfile}mjpeg.avi
dd4f8a04 370do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec mjpeg -pix_fmt yuvj420p $file
51133a7d
FB
371
372# mjpeg decoding
644a9262 373do_ffmpeg $raw_dst -y -i $file -f rawvideo -pix_fmt yuv420p $raw_dst
51133a7d
FB
374fi
375
376###################################
3b37408b
MN
377if [ -n "$do_ljpeg" ] ; then
378# ljpeg
379file=${outfile}ljpeg.avi
dd4f8a04 380do_ffmpeg $file -y -f pgmyuv -i $raw_src -an -vcodec ljpeg -strict -1 $file
3b37408b
MN
381
382# ljpeg decoding
383do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
384fi
385
386###################################
51133a7d
FB
387if [ -n "$do_rv10" ] ; then
388# rv10 encoding
389file=${outfile}rv10.rm
390do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an $file
391
392# rv10 decoding
393do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
394fi
395
396###################################
c50cd09d
MN
397if [ -n "$do_rv20" ] ; then
398# rv20 encoding
399file=${outfile}rv20.rm
400do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -vcodec rv20 -an $file
401
402# rv20 decoding
403do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
404fi
405
406###################################
9ca9fce1
MN
407if [ -n "$do_asv1" ] ; then
408# asv1 encoding
409file=${outfile}asv1.avi
410do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec asv1 $file
411
412# asv1 decoding
413do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
414fi
415
416###################################
8d876a43
MN
417if [ -n "$do_asv2" ] ; then
418# asv2 encoding
419file=${outfile}asv2.avi
420do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec asv2 $file
421
422# asv2 decoding
423do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
424fi
425
426###################################
bbdd42d3
MN
427if [ -n "$do_flv" ] ; then
428# flv encoding
429file=${outfile}flv.flv
430do_ffmpeg $file -y -qscale 10 -f pgmyuv -i $raw_src -an -vcodec flv $file
431
432# flv decoding
433do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
434fi
435
436###################################
f3203047
MN
437if [ -n "$do_ffv1" ] ; then
438# ffv1 encoding
439file=${outfile}ffv1.avi
9cd81798 440do_ffmpeg $file -y -strict -2 -f pgmyuv -i $raw_src -an -vcodec ffv1 $file
f3203047
MN
441
442# ffv1 decoding
443do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
d13eef3d
MN
444fi
445
446###################################
447if [ -n "$do_snow" ] ; then
448# snow encoding
449file=${outfile}snow.avi
9cd81798 450do_ffmpeg $file -y -strict -2 -f pgmyuv -i $raw_src -an -vcodec snow -qscale 2 $file
d13eef3d
MN
451
452# snow decoding
453do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
454
455# snow encoding
456file=${outfile}snow53.avi
9cd81798 457do_ffmpeg $file -y -strict -2 -f pgmyuv -i $raw_src -an -vcodec snow -pred 1 -qpel -4mv $file
d13eef3d
MN
458
459# snow decoding
460do_ffmpeg $raw_dst -y -i $file -f rawvideo $raw_dst
f3203047
MN
461fi
462
463###################################
b86bd1f1
MN
464if [ -n "$do_svq1" ] ; then
465# svq1 encoding
466file=${outfile}svq1.mov
e6cf9be5 467do_ffmpeg $file -y -f pgmyuv -i $raw_src -an -vcodec svq1 -qscale 3 -pix_fmt yuv410p $file
b86bd1f1
MN
468
469# svq1 decoding
644a9262 470do_ffmpeg $raw_dst -y -i $file -f rawvideo -pix_fmt yuv420p $raw_dst
b86bd1f1
MN
471fi
472
473###################################
51133a7d
FB
474if [ -n "$do_mp2" ] ; then
475# mp2 encoding
476file=${outfile}mp2.mp2
477do_ffmpeg $file -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src $file
478
479# mp2 decoding
480do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
976709ee 481$tiny_psnr $pcm_dst $pcm_ref 2 1924 >> $logfile
51133a7d
FB
482fi
483
484###################################
485if [ -n "$do_ac3" ] ; then
486# ac3 encoding
487file=${outfile}ac3.rm
488do_ffmpeg $file -y -ab 128 -ac 2 -f s16le -i $pcm_src -vn $file
489
490# ac3 decoding
3c300082 491#do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
51133a7d
FB
492fi
493
89d5dfd5 494###################################
311be1fb
MN
495if [ -n "$do_g726" ] ; then
496# g726 encoding
497file=${outfile}g726.wav
498do_ffmpeg $file -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src -ab 32 -ac 1 -ar 8000 -acodec g726 $file
499
500# g726 decoding
501do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
502fi
503
504###################################
f02ab814
MN
505if [ -n "$do_adpcm_ima_wav" ] ; then
506# encoding
507file=${outfile}adpcm_ima.wav
508do_ffmpeg $file -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src -acodec adpcm_ima_wav $file
509
510# decoding
511do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
512fi
513
514###################################
515if [ -n "$do_adpcm_ms" ] ; then
516# encoding
517file=${outfile}adpcm_ms.wav
518do_ffmpeg $file -y -ab 128 -ac 2 -ar 44100 -f s16le -i $pcm_src -acodec adpcm_ms $file
519
520# decoding
521do_ffmpeg $pcm_dst -y -i $file -f wav $pcm_dst
522fi
523
524###################################
89d5dfd5
FB
525# libav testing
526###################################
527
528if [ -n "$do_libav" ] ; then
529
530# avi
531file=${outfile}libav.avi
532do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
533do_ffmpeg_crc $file -i $file
534
535# asf
536file=${outfile}libav.asf
ba30abcb 537do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src -acodec mp2 $file
e928649b 538do_ffmpeg_crc $file -i $file -r 25
89d5dfd5
FB
539
540# rm
541file=${outfile}libav.rm
542do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
543# broken
544#do_ffmpeg_crc $file -i $file
545
546# mpegps
547file=${outfile}libav.mpg
548do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
549do_ffmpeg_crc $file -i $file
550
d05c15cb
MN
551# mpegts
552file=${outfile}libav.ts
553do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
554do_ffmpeg_crc $file -i $file
555
89d5dfd5
FB
556# swf (decode audio only)
557file=${outfile}libav.swf
2dd59ebd 558do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src -acodec mp2 $file
d0c30ca5 559do_ffmpeg_crc $file -i $file
89d5dfd5
FB
560
561# ffm
74d69c07
MN
562file=${outfile}libav.ffm
563do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src $file
564do_ffmpeg_crc $file -i $file
89d5dfd5 565
bbdd42d3
MN
566# flv
567file=${outfile}libav.flv
ba30abcb 568do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src -an $file
bbdd42d3
MN
569do_ffmpeg_crc $file -i $file
570
c280f2d7 571# mov
2dd59ebd
MN
572file=${outfile}libav.mov
573do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src -acodec pcm_alaw $file
574do_ffmpeg_crc $file -i $file
c280f2d7
MN
575
576# nut
577file=${outfile}libav.nut
ba30abcb 578do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f s16le -i $pcm_src -acodec mp2 $file
c280f2d7
MN
579do_ffmpeg_crc $file -i $file
580
a811de6e 581# dv
3ea1ce21
RS
582file=${outfile}libav.dv
583do_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
584do_ffmpeg_crc $file -i $file
a811de6e 585
89d5dfd5
FB
586####################
587# streamed images
588# mjpeg
affd55a1
RS
589#file=${outfile}libav.mjpeg
590#do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src $file
591#do_ffmpeg_crc $file -i $file
89d5dfd5 592
7481e919
FB
593# pbmpipe
594file=${outfile}libav.pbm
87c5fbc3
MN
595do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f image2pipe $file
596do_ffmpeg_crc $file -f image2pipe -i $file
7481e919 597
89d5dfd5 598# pgmpipe
7481e919 599file=${outfile}libav.pgm
87c5fbc3
MN
600do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f image2pipe $file
601do_ffmpeg_crc $file -f image2pipe -i $file
89d5dfd5
FB
602
603# ppmpipe
7481e919 604file=${outfile}libav.ppm
87c5fbc3
MN
605do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src -f image2pipe $file
606do_ffmpeg_crc $file -f image2pipe -i $file
89d5dfd5
FB
607
608# gif
609file=${outfile}libav.gif
7481e919
FB
610do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src $file
611#do_ffmpeg_crc $file -i $file
612
613# yuv4mpeg
8cf71ead 614file=${outfile}libav.y4m
7481e919
FB
615do_ffmpeg $file -t 1 -y -qscale 10 -f pgmyuv -i $raw_src $file
616#do_ffmpeg_crc $file -i $file
89d5dfd5
FB
617
618####################
619# image formats
620# pgm (we do not do md5 on image files yet)
621file=${outfile}libav%d.pgm
622$ffmpeg -t 0.5 -y -qscale 10 -f pgmyuv -i $raw_src $file
623do_ffmpeg_crc $file -i $file
624
625# ppm (we do not do md5 on image files yet)
626file=${outfile}libav%d.ppm
627$ffmpeg -t 0.5 -y -qscale 10 -f pgmyuv -i $raw_src $file
628do_ffmpeg_crc $file -i $file
629
d0c30ca5 630# jpeg (we do not do md5 on image files yet)
72f89c4c 631file=${outfile}libav%d.jpg
dd4f8a04 632$ffmpeg -t 0.5 -y -qscale 10 -f pgmyuv -i $raw_src -bitexact -dct_algo 1 -idct_algo 2 -pix_fmt yuvj420p -f image2 $file
72f89c4c 633do_ffmpeg_crc $file -f image2 -i $file
d0c30ca5 634
89d5dfd5
FB
635####################
636# audio only
637
638# wav
639file=${outfile}libav.wav
640do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
641do_ffmpeg_crc $file -i $file
642
643# alaw
644file=${outfile}libav.al
645do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
646do_ffmpeg_crc $file -i $file
647
648# mulaw
649file=${outfile}libav.ul
650do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
651do_ffmpeg_crc $file -i $file
652
653# au
654file=${outfile}libav.au
655do_ffmpeg $file -t 1 -y -qscale 10 -f s16le -i $pcm_src $file
656do_ffmpeg_crc $file -i $file
657
affd55a1
RS
658####################
659# pix_fmt conversions
660conversions="yuv420p yuv422p yuv444p yuv422 yuv410p yuv411p yuvj420p \
661 yuvj422p yuvj444p rgb24 bgr24 rgba32 rgb565 rgb555 gray monow \
662 monob pal8"
663for pix_fmt in $conversions ; do
664 file=${outfile}libav-${pix_fmt}.yuv
665 do_ffmpeg_nocheck $file -r 1 -t 1 -y -f pgmyuv -i $raw_src \
666 -f rawvideo -s 352x288 -pix_fmt $pix_fmt $raw_dst
667 do_ffmpeg $file -f rawvideo -s 352x288 -pix_fmt $pix_fmt -i $raw_dst \
668 -f rawvideo -s 352x288 -pix_fmt yuv444p $file
669done
670
89d5dfd5
FB
671fi
672
673
51133a7d 674
281a74da 675if $diff_cmd "$logfile" "$reffile" ; then
51133a7d
FB
676 echo
677 echo Regression test succeeded.
678 exit 0
679else
680 echo
681 echo Regression test: Error.
682 exit 1
683fi