~ubuntu-branches/ubuntu/precise/flac/precise-updates

« back to all changes in this revision

Viewing changes to test/test_streams.sh

  • Committer: Bazaar Package Importer
  • Author(s): Joshua Kwan
  • Date: 2007-05-29 22:56:36 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070529225636-ljeff8xxip09qaap
Tags: 1.1.4-1
* New upstream release. closes: #405167, #411311
  - libOggFLAC and libOggFLAC++ have been merged into libFLAC, so
    remove their corresponding packages.
  - Because of the API changes required to effect the above, there has
    been yet another soname bump. libflac7 -> libflac8 and
    libflac++5 -> libflac++6. Emails have been dispatched to the
    maintainers of dependent packages.
* Some notes on patches that were removed:
  - 02_stdin_stdout, 06_manpage_mention_utf8_convert: merged upstream
  - 08_manpage_warnings: Upstream has changed the manpage so it defintely
    can't fit in in 80 cols, so just forget about it. We'll live.
  - 05_eof_warnings_are_errors: Upstream decided to add a -w option to
    flac to treat all warnings as errors. I am going to defer to that
    for now, but if people think it's stupid let me know and I'll port
    the patch forward.
  - 04_stack_smasher: was a backport from 1.1.3, so it's obsolete.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/bin/sh
2
2
 
3
3
#  FLAC - Free Lossless Audio Codec
4
 
#  Copyright (C) 2001,2002,2003,2004,2005  Josh Coalson
 
4
#  Copyright (C) 2001,2002,2003,2004,2005,2006,2007  Josh Coalson
5
5
#
6
6
#  This file is part the FLAC project.  FLAC is comprised of several
7
7
#  components distributed under difference licenses.  The codec libraries
35
35
PATH=../src/test_streams:$PATH
36
36
PATH=../obj/$BUILD/bin:$PATH
37
37
 
 
38
if [ x"$FLAC__TEST_LEVEL" = x ] ; then
 
39
        FLAC__TEST_LEVEL=1
 
40
fi
 
41
 
38
42
flac --help 1>/dev/null 2>/dev/null || die "ERROR can't find flac executable"
39
43
 
40
44
run_flac ()
41
45
{
42
 
        if [ x"$FLAC__VALGRIND" = xyes ] ; then
 
46
        if [ x"$FLAC__TEST_WITH_VALGRIND" = xyes ] ; then
 
47
                echo "valgrind --leak-check=yes --show-reachable=yes --num-callers=100 flac $*" >>test_streams.valgrind.log
43
48
                valgrind --leak-check=yes --show-reachable=yes --num-callers=100 --logfile-fd=4 flac $* 4>>test_streams.valgrind.log
44
49
        else
45
50
                flac $*
63
68
        encode_options="$4"
64
69
 
65
70
        echo -n "$name (--channels=$channels --bps=$bps $encode_options): encode..."
66
 
        cmd="run_flac --verify --silent --force --force-raw-format --endian=little --sign=signed --sample-rate=44100 --bps=$bps --channels=$channels $encode_options $name.raw"
 
71
        cmd="run_flac --verify --silent --force --force-raw-format --endian=little --sign=signed --sample-rate=44100 --bps=$bps --channels=$channels $encode_options --no-padding $name.raw"
67
72
        echo "### ENCODE $name #######################################################" >> ./streams.log
68
73
        echo "###    cmd=$cmd" >> ./streams.log
69
74
        $cmd 2>>./streams.log || die "ERROR during encode of $name"
99
104
 
100
105
        echo -n "$name: encode via pipes..."
101
106
        if [ $is_win = yes ] ; then
102
 
                cmd="run_flac --verify --silent --force --force-raw-format --endian=little --sign=signed --sample-rate=44100 --bps=$bps --channels=$channels $encode_options --stdout $name.raw"
 
107
                cmd="run_flac --verify --silent --force --force-raw-format --endian=little --sign=signed --sample-rate=44100 --bps=$bps --channels=$channels $encode_options --no-padding --stdout $name.raw"
103
108
                echo "### ENCODE $name #######################################################" >> ./streams.log
104
109
                echo "###    cmd=$cmd" >> ./streams.log
105
110
                $cmd 1>$name.flac 2>>./streams.log || die "ERROR during encode of $name"
106
111
        else
107
 
                cmd="run_flac --verify --silent --force --force-raw-format --endian=little --sign=signed --sample-rate=44100 --bps=$bps --channels=$channels $encode_options --stdout -"
 
112
                cmd="run_flac --verify --silent --force --force-raw-format --endian=little --sign=signed --sample-rate=44100 --bps=$bps --channels=$channels $encode_options --no-padding --stdout -"
108
113
                echo "### ENCODE $name #######################################################" >> ./streams.log
109
114
                echo "###    cmd=$cmd" >> ./streams.log
110
115
                cat $name.raw | $cmd 1>$name.flac 2>>./streams.log || die "ERROR during encode of $name"
131
136
        echo OK
132
137
}
133
138
 
134
 
if [ "$FLAC__EXHAUSTIVE_TESTS" = yes ] ; then
 
139
if [ "$FLAC__TEST_LEVEL" -gt 1 ] ; then
135
140
        max_lpc_order=32
136
141
else
137
142
        max_lpc_order=16
141
146
test_file_piped noise 1 8 "-0"
142
147
 
143
148
echo "Testing small files..."
144
 
test_file test01 1 16 "-0 -l $max_lpc_order -m -e -p"
145
 
test_file test02 2 16 "-0 -l $max_lpc_order -m -e -p"
146
 
test_file test03 1 16 "-0 -l $max_lpc_order -m -e -p"
147
 
test_file test04 2 16 "-0 -l $max_lpc_order -m -e -p"
148
 
 
149
 
echo "Testing 8-bit full-scale deflection streams..."
150
 
for b in 01 02 03 04 05 06 07 ; do
151
 
        test_file fsd8-$b 1 8 "-0 -l $max_lpc_order -m -e -p"
152
 
done
153
 
 
154
 
echo "Testing 16-bit full-scale deflection streams..."
155
 
for b in 01 02 03 04 05 06 07 ; do
156
 
        test_file fsd16-$b 1 16 "-0 -l $max_lpc_order -m -e -p"
157
 
done
158
 
 
159
 
echo "Testing 24-bit full-scale deflection streams..."
160
 
for b in 01 02 03 04 05 06 07 ; do
161
 
        test_file fsd24-$b 1 24 "-0 -l $max_lpc_order -m -e -p"
 
149
test_file test01 1 16 "-0 -l $max_lpc_order --lax -m -e -p"
 
150
test_file test02 2 16 "-0 -l $max_lpc_order --lax -m -e -p"
 
151
test_file test03 1 16 "-0 -l $max_lpc_order --lax -m -e -p"
 
152
test_file test04 2 16 "-0 -l $max_lpc_order --lax -m -e -p"
 
153
 
 
154
for bps in 8 16 24 ; do
 
155
        echo "Testing $bps-bit full-scale deflection streams..."
 
156
        for b in 01 02 03 04 05 06 07 ; do
 
157
                test_file fsd$bps-$b 1 $bps "-0 -l $max_lpc_order --lax -m -e -p"
 
158
        done
162
159
done
163
160
 
164
161
echo "Testing 16-bit wasted-bits-per-sample streams..."
165
162
for b in 01 ; do
166
 
        test_file wbps16-$b 1 16 "-0 -l $max_lpc_order -m -e -p"
 
163
        test_file wbps16-$b 1 16 "-0 -l $max_lpc_order --lax -m -e -p"
167
164
done
168
165
 
169
166
for bps in 8 16 24 ; do
170
167
        echo "Testing $bps-bit sine wave streams..."
171
168
        for b in 00 ; do
172
 
                test_file sine${bps}-$b 1 $bps "-0 -l $max_lpc_order -m -e --sample-rate=48000"
 
169
                test_file sine${bps}-$b 1 $bps "-0 -l $max_lpc_order --lax -m -e --sample-rate=48000"
173
170
        done
174
171
        for b in 01 ; do
175
 
                test_file sine${bps}-$b 1 $bps "-0 -l $max_lpc_order -m -e --sample-rate=96000"
 
172
                test_file sine${bps}-$b 1 $bps "-0 -l $max_lpc_order --lax -m -e --sample-rate=96000"
176
173
        done
177
174
        for b in 02 03 04 ; do
178
 
                test_file sine${bps}-$b 1 $bps "-0 -l $max_lpc_order -m -e"
 
175
                test_file sine${bps}-$b 1 $bps "-0 -l $max_lpc_order --lax -m -e"
179
176
        done
180
177
        for b in 10 11 ; do
181
 
                test_file sine${bps}-$b 2 $bps "-0 -l $max_lpc_order -m -e --sample-rate=48000"
 
178
                test_file sine${bps}-$b 2 $bps "-0 -l $max_lpc_order --lax -m -e --sample-rate=48000"
182
179
        done
183
180
        for b in 12 ; do
184
 
                test_file sine${bps}-$b 2 $bps "-0 -l $max_lpc_order -m -e --sample-rate=96000"
 
181
                test_file sine${bps}-$b 2 $bps "-0 -l $max_lpc_order --lax -m -e --sample-rate=96000"
185
182
        done
186
183
        for b in 13 14 15 16 17 18 19 ; do
187
 
                test_file sine${bps}-$b 2 $bps "-0 -l $max_lpc_order -m -e"
 
184
                test_file sine${bps}-$b 2 $bps "-0 -l $max_lpc_order --lax -m -e"
188
185
        done
189
186
done
190
187
 
193
190
        for blocksize in 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 ; do
194
191
                for lpc_order in 0 1 2 3 4 5 7 8 9 15 16 17 31 32 ; do
195
192
                        if [ $lpc_order = 0 ] || [ $lpc_order -le $blocksize ] ; then
196
 
                                        test_file noise8m32 1 8 "-8 -p -e -l $lpc_order --lax --blocksize=$blocksize $disable"
 
193
                                test_file noise8m32 1 8 "-8 -p -e -l $lpc_order --lax --blocksize=$blocksize $disable"
197
194
                        fi
198
195
                done
199
196
        done
212
209
echo "Testing option variations..."
213
210
for f in 00 01 02 03 04 ; do
214
211
        for disable in '' '--disable-verbatim-subframes --disable-constant-subframes' '--disable-verbatim-subframes --disable-constant-subframes --disable-fixed-subframes' ; do
215
 
                for opt in 0 1 2 4 5 6 8 ; do
216
 
                        for extras in '' '-p' '-e' ; do
217
 
                                test_file sine16-$f 1 16 "-$opt $extras $disable"
 
212
                if [ -z "$disable" ] || [ "$FLAC__TEST_LEVEL" -gt 0 ] ; then
 
213
                        for opt in 0 1 2 4 5 6 8 ; do
 
214
                                for extras in '' '-p' '-e' ; do
 
215
                                        if [ -z "$extras" ] || [ "$FLAC__TEST_LEVEL" -gt 0 ] ; then
 
216
                                                test_file sine16-$f 1 16 "-$opt $extras $disable"
 
217
                                        fi
 
218
                                done
218
219
                        done
219
 
                done
220
 
                if [ "$FLAC__EXHAUSTIVE_TESTS" = yes ] ; then
221
 
                        test_file sine16-$f 1 16 "-b 16384 -m -r 8 -l $max_lpc_order -e -p $disable"
 
220
                        if [ "$FLAC__TEST_LEVEL" -gt 1 ] ; then
 
221
                                test_file sine16-$f 1 16 "-b 16384 -m -r 8 -l $max_lpc_order --lax -e -p $disable"
 
222
                        fi
222
223
                fi
223
224
        done
224
225
done
225
226
 
226
227
for f in 10 11 12 13 14 15 16 17 18 19 ; do
227
228
        for disable in '' '--disable-verbatim-subframes --disable-constant-subframes' '--disable-verbatim-subframes --disable-constant-subframes --disable-fixed-subframes' ; do
228
 
                for opt in 0 1 2 4 5 6 8 ; do
229
 
                        for extras in '' '-p' '-e' ; do
230
 
                                test_file sine16-$f 2 16 "-$opt $extras $disable"
 
229
                if [ -z "$disable" ] || [ "$FLAC__TEST_LEVEL" -gt 0 ] ; then
 
230
                        for opt in 0 1 2 4 5 6 8 ; do
 
231
                                for extras in '' '-p' '-e' ; do
 
232
                                        if [ -z "$extras" ] || [ "$FLAC__TEST_LEVEL" -gt 0 ] ; then
 
233
                                                test_file sine16-$f 2 16 "-$opt $extras $disable"
 
234
                                        fi
 
235
                                done
231
236
                        done
232
 
                done
233
 
                if [ "$FLAC__EXHAUSTIVE_TESTS" = yes ] ; then
234
 
                        test_file sine16-$f 2 16 "-b 16384 -m -r 8 -l $max_lpc_order -e -p $disable"
 
237
                        if [ "$FLAC__TEST_LEVEL" -gt 1 ] ; then
 
238
                                test_file sine16-$f 2 16 "-b 16384 -m -r 8 -l $max_lpc_order --lax -e -p $disable"
 
239
                        fi
235
240
                fi
236
241
        done
237
242
done
238
243
 
239
244
echo "Testing noise..."
240
245
for disable in '' '--disable-verbatim-subframes --disable-constant-subframes' '--disable-verbatim-subframes --disable-constant-subframes --disable-fixed-subframes' ; do
241
 
        for channels in 1 2 4 8 ; do
242
 
                for bps in 8 16 24 ; do
243
 
                        for opt in 0 1 2 3 4 5 6 7 8 ; do
244
 
                                for extras in '' '-p' '-e' ; do
245
 
                                        for blocksize in '' '--lax -b 32' '--lax -b 32768' '--lax -b 65535' ; do
246
 
                                                test_file noise $channels $bps "-$opt $extras $blocksize $disable"
 
246
        if [ -z "$disable" ] || [ "$FLAC__TEST_LEVEL" -gt 0 ] ; then
 
247
                for channels in 1 2 4 8 ; do
 
248
                        if [ $channels -le 2 ] || [ "$FLAC__TEST_LEVEL" -gt 0 ] ; then
 
249
                                for bps in 8 16 24 ; do
 
250
                                        for opt in 0 1 2 3 4 5 6 7 8 ; do
 
251
                                                for extras in '' '-p' '-e' ; do
 
252
                                                        if [ -z "$extras" ] || [ "$FLAC__TEST_LEVEL" -gt 0 ] ; then
 
253
                                                                for blocksize in '' '--lax -b 32' '--lax -b 32768' '--lax -b 65535' ; do
 
254
                                                                        if [ -z "$blocksize" ] || [ "$FLAC__TEST_LEVEL" -gt 0 ] ; then
 
255
                                                                                test_file noise $channels $bps "-$opt $extras $blocksize $disable"
 
256
                                                                        fi
 
257
                                                                done
 
258
                                                        fi
 
259
                                                done
247
260
                                        done
 
261
                                        if [ "$FLAC__TEST_LEVEL" -gt 1 ] ; then
 
262
                                                test_file noise $channels $bps "-b 16384 -m -r 8 -l $max_lpc_order --lax -e -p $disable"
 
263
                                        fi
248
264
                                done
249
 
                        done
250
 
                        if [ "$FLAC__EXHAUSTIVE_TESTS" = yes ] ; then
251
 
                                test_file noise $channels $bps "-b 16384 -m -r 8 -l $max_lpc_order -e -p $disable"
252
265
                        fi
253
266
                done
254
 
        done
 
267
        fi
255
268
done