3 # FLAC - Free Lossless Audio Codec
4 # Copyright (C) 2001,2002 Josh Coalson
6 # This program is part of FLAC; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License
8 # as published by the Free Software Foundation; either version 2
9 # of the License, or (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 LD_LIBRARY_PATH=../src/libFLAC/.libs:../obj/lib:$LD_LIBRARY_PATH
21 export LD_LIBRARY_PATH
22 PATH=../src/flac:../src/test_streams:../obj/bin:$PATH
24 flac --help 1>/dev/null 2>/dev/null || (echo "ERROR can't find flac executable" 1>&2 && exit 1)
25 if [ $? != 0 ] ; then exit 1 ; fi
27 echo "Generating streams..."
28 if test_streams ; then : ; else
29 echo "ERROR during test_streams" 1>&2
33 echo "Checking for --ogg support in flac..."
34 if flac --ogg wacky1.wav 1>/dev/null 2>&1 ; then
36 echo "flac --ogg works"
39 echo "flac --ogg doesn't work"
45 echo "Generating multiple input files from noise..."
46 if flac --verify --silent --force-raw-input --endian=big --sample-rate=44100 --bps=16 --channels=2 noise.raw ; then : ; else
47 echo "ERROR generating FLAC file" 1>&2
50 if flac --decode --silent noise.flac ; then : ; else
51 echo "ERROR generating WAVE file" 1>&2
55 mv noise.wav file0.wav
56 cp file0.wav file1.wav
57 cp file1.wav file2.wav
64 if [ $streamtype = ogg ] ; then
66 encode_options="$encode_options --ogg"
71 if flac $encode_options file0.wav file1.wav file2.wav ; then : ; else
76 mv file$n.$suffix file${n}x.$suffix
78 if flac --decode file0x.$suffix file1x.$suffix file2x.$suffix ; then : ; else
83 if cmp file$n.wav file${n}x.wav ; then : ; else
84 echo "ERROR: file mismatch on file #$n" 1>&2
89 rm -f file${n}x.$suffix file${n}x.wav
93 echo "Testing multiple files without verify..."
94 test_multifile flac ""
96 echo "Testing multiple files with verify..."
97 test_multifile flac "--verify"
99 #@@@@echo "Testing multiple files with --sector-align, without verify..."
100 #@@@@test_multifile flac "--sector-align"
102 #@@@@echo "Testing multiple files with --sector-align, with verify..."
103 #@@@@test_multifile flac "--sector-align --verify"
105 if [ $has_ogg = "yes" ] ; then
106 echo "Testing multiple files with --ogg, without verify..."
107 test_multifile ogg ""
109 echo "Testing multiple files with --ogg, with verify..."
110 test_multifile ogg "--verify"
112 #@@@@echo "Testing multiple files with --ogg and --sector-align, without verify..."
113 #@@@@test_multifile ogg "--sector-align"
115 #@@@@echo "Testing multiple files with --ogg and --sector-align, with verify..."
116 #@@@@test_multifile ogg "--sector-align --verify"
130 echo -n "$name: encode..."
131 cmd="flac --verify --silent --force-raw-input --endian=big --sample-rate=44100 --bps=$bps --channels=$channels $encode_options $name.raw"
132 echo "### ENCODE $name #######################################################" >> ./streams.log
133 echo "### cmd=$cmd" >> ./streams.log
134 if $cmd 2>>./streams.log ; then : ; else
135 echo "ERROR during encode of $name" 1>&2
139 cmd="flac --silent --endian=big --decode --force-raw-input --output-name=$name.cmp $name.flac"
140 echo "### DECODE $name #######################################################" >> ./streams.log
141 echo "### cmd=$cmd" >> ./streams.log
142 if $cmd 2>>./streams.log ; then : ; else
143 echo "ERROR during decode of $name" 1>&2
146 ls -1l $name.raw >> ./streams.log
147 ls -1l $name.flac >> ./streams.log
148 ls -1l $name.cmp >> ./streams.log
150 if cmp $name.raw $name.cmp ; then : ; else
151 echo "ERROR during compare of $name" 1>&2
164 if [ `env | grep -ic '^comspec='` != 0 ] ; then
170 echo -n "$name: encode via pipes..."
171 if [ $is_win = yes ] ; then
172 cmd="flac --verify --silent --force-raw-input --endian=big --sample-rate=44100 --bps=$bps --channels=$channels $encode_options --stdout $name.raw"
173 echo "### ENCODE $name #######################################################" >> ./streams.log
174 echo "### cmd=$cmd" >> ./streams.log
175 if $cmd 1>$name.flac 2>>./streams.log ; then : ; else
176 echo "ERROR during encode of $name" 1>&2
180 cmd="flac --verify --silent --force-raw-input --endian=big --sample-rate=44100 --bps=$bps --channels=$channels $encode_options --stdout -"
181 echo "### ENCODE $name #######################################################" >> ./streams.log
182 echo "### cmd=$cmd" >> ./streams.log
183 if cat $name.raw | $cmd 1>$name.flac 2>>./streams.log ; then : ; else
184 echo "ERROR during encode of $name" 1>&2
188 echo -n "decode via pipes..."
189 if [ $is_win = yes ] ; then
190 cmd="flac --silent --endian=big --decode --force-raw-input --stdout $name.flac"
191 echo "### DECODE $name #######################################################" >> ./streams.log
192 echo "### cmd=$cmd" >> ./streams.log
193 if $cmd 1>$name.cmp 2>>./streams.log ; then : ; else
194 echo "ERROR during decode of $name" 1>&2
198 cmd="flac --silent --endian=big --decode --force-raw-input --stdout -"
199 echo "### DECODE $name #######################################################" >> ./streams.log
200 echo "### cmd=$cmd" >> ./streams.log
201 if cat $name.flac | $cmd 1>$name.cmp 2>>./streams.log ; then : ; else
202 echo "ERROR during decode of $name" 1>&2
206 ls -1l $name.raw >> ./streams.log
207 ls -1l $name.flac >> ./streams.log
208 ls -1l $name.cmp >> ./streams.log
210 if cmp $name.raw $name.cmp ; then : ; else
211 echo "ERROR during compare of $name" 1>&2
217 echo "Testing noise through pipes..."
218 test_file_piped noise 1 8 "-0"
220 echo "Testing small files..."
221 test_file test01 1 16 "-0 --max-lpc-order=16 --mid-side --exhaustive-model-search --qlp-coeff-precision-search"
222 test_file test02 2 16 "-0 --max-lpc-order=16 --mid-side --exhaustive-model-search --qlp-coeff-precision-search"
223 test_file test03 1 16 "-0 --max-lpc-order=16 --mid-side --exhaustive-model-search --qlp-coeff-precision-search"
224 test_file test04 2 16 "-0 --max-lpc-order=16 --mid-side --exhaustive-model-search --qlp-coeff-precision-search"
226 echo "Testing 8-bit full-scale deflection streams..."
227 for b in 01 02 03 04 05 06 07 ; do
228 test_file fsd8-$b 1 8 "-0 --max-lpc-order=16 --mid-side --exhaustive-model-search --qlp-coeff-precision-search"
231 echo "Testing 16-bit full-scale deflection streams..."
232 for b in 01 02 03 04 05 06 07 ; do
233 test_file fsd16-$b 1 16 "-0 --max-lpc-order=16 --mid-side --exhaustive-model-search --qlp-coeff-precision-search"
236 echo "Testing 24-bit full-scale deflection streams..."
237 for b in 01 02 03 04 05 06 07 ; do
238 test_file fsd24-$b 1 24 "-0 --max-lpc-order=16 --mid-side --exhaustive-model-search --qlp-coeff-precision-search"
241 echo "Testing 16-bit wasted-bits-per-sample streams..."
243 test_file wbps16-$b 1 16 "-0 --max-lpc-order=16 --mid-side --exhaustive-model-search --qlp-coeff-precision-search"
246 for bps in 16 24 ; do
247 echo "Testing $bps-bit sine wave streams..."
248 for b in 00 01 02 03 04 ; do
249 test_file sine${bps}-$b 1 $bps "-0 --max-lpc-order=16 --mid-side --exhaustive-model-search"
251 for b in 10 11 12 13 14 15 16 17 18 19 ; do
252 test_file sine${bps}-$b 2 $bps "-0 --max-lpc-order=16 --mid-side --exhaustive-model-search"
256 echo "Testing some frame header variations..."
257 test_file sine16-01 1 16 "-0 --max-lpc-order=8 --mid-side --exhaustive-model-search --qlp-coeff-precision-search --lax --blocksize=16"
258 test_file sine16-01 1 16 "-0 --max-lpc-order=8 --mid-side --exhaustive-model-search --qlp-coeff-precision-search --lax --blocksize=65535"
259 test_file sine16-01 1 16 "-0 --max-lpc-order=8 --mid-side --exhaustive-model-search --qlp-coeff-precision-search --blocksize=16"
260 test_file sine16-01 1 16 "-0 --max-lpc-order=8 --mid-side --exhaustive-model-search --qlp-coeff-precision-search --blocksize=65535"
261 test_file sine16-01 1 16 "-0 --max-lpc-order=8 --mid-side --exhaustive-model-search --qlp-coeff-precision-search --lax --sample-rate=9"
262 test_file sine16-01 1 16 "-0 --max-lpc-order=8 --mid-side --exhaustive-model-search --qlp-coeff-precision-search --lax --sample-rate=90"
263 test_file sine16-01 1 16 "-0 --max-lpc-order=8 --mid-side --exhaustive-model-search --qlp-coeff-precision-search --lax --sample-rate=90000"
264 test_file sine16-01 1 16 "-0 --max-lpc-order=8 --mid-side --exhaustive-model-search --qlp-coeff-precision-search --sample-rate=9"
265 test_file sine16-01 1 16 "-0 --max-lpc-order=8 --mid-side --exhaustive-model-search --qlp-coeff-precision-search --sample-rate=90"
266 test_file sine16-01 1 16 "-0 --max-lpc-order=8 --mid-side --exhaustive-model-search --qlp-coeff-precision-search --sample-rate=90000"
268 echo "Testing option variations..."
269 for f in 00 01 02 03 04 ; do
270 for opt in 0 1 2 4 5 6 8 ; do
271 for extras in '' '--qlp-coeff-precision-search' '--exhaustive-model-search' ; do
272 test_file sine16-$f 1 16 "-$opt $extras"
276 for f in 10 11 12 13 14 15 16 17 18 19 ; do
277 for opt in 0 1 2 4 5 6 8 ; do
278 for extras in '' '--qlp-coeff-precision-search' '--exhaustive-model-search' ; do
279 test_file sine16-$f 2 16 "-$opt $extras"
284 echo "Testing noise..."
285 for opt in 0 1 2 3 4 5 6 7 8 ; do
286 for extras in '' '--qlp-coeff-precision-search' '--exhaustive-model-search' ; do
287 for blocksize in '' '--blocksize=32' '--blocksize=32768' '--blocksize=65535' ; do
288 for channels in 1 2 4 8 ; do
289 for bps in 8 16 24 ; do
290 test_file noise $channels $bps "-$opt $extras $blocksize"