annotate src/flac-1.2.1/test/test_streams.sh @ 23:619f715526df sv_v2.1

Update Vamp plugin SDK to 2.5
author Chris Cannam
date Thu, 09 May 2013 10:52:46 +0100
parents 05aa0afa9217
children
rev   line source
Chris@1 1 #!/bin/sh
Chris@1 2
Chris@1 3 # FLAC - Free Lossless Audio Codec
Chris@1 4 # Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson
Chris@1 5 #
Chris@1 6 # This file is part the FLAC project. FLAC is comprised of several
Chris@1 7 # components distributed under difference licenses. The codec libraries
Chris@1 8 # are distributed under Xiph.Org's BSD-like license (see the file
Chris@1 9 # COPYING.Xiph in this distribution). All other programs, libraries, and
Chris@1 10 # plugins are distributed under the GPL (see COPYING.GPL). The documentation
Chris@1 11 # is distributed under the Gnu FDL (see COPYING.FDL). Each file in the
Chris@1 12 # FLAC distribution contains at the top the terms under which it may be
Chris@1 13 # distributed.
Chris@1 14 #
Chris@1 15 # Since this particular file is relevant to all components of FLAC,
Chris@1 16 # it may be distributed under the Xiph.Org license, which is the least
Chris@1 17 # restrictive of those mentioned above. See the file COPYING.Xiph in this
Chris@1 18 # distribution.
Chris@1 19
Chris@1 20 die ()
Chris@1 21 {
Chris@1 22 echo $* 1>&2
Chris@1 23 exit 1
Chris@1 24 }
Chris@1 25
Chris@1 26 if [ x = x"$1" ] ; then
Chris@1 27 BUILD=debug
Chris@1 28 else
Chris@1 29 BUILD="$1"
Chris@1 30 fi
Chris@1 31
Chris@1 32 LD_LIBRARY_PATH=../obj/$BUILD/lib:$LD_LIBRARY_PATH
Chris@1 33 export LD_LIBRARY_PATH
Chris@1 34 PATH=../src/flac:$PATH
Chris@1 35 PATH=../src/test_streams:$PATH
Chris@1 36 PATH=../obj/$BUILD/bin:$PATH
Chris@1 37
Chris@1 38 if [ x"$FLAC__TEST_LEVEL" = x ] ; then
Chris@1 39 FLAC__TEST_LEVEL=1
Chris@1 40 fi
Chris@1 41
Chris@1 42 flac --help 1>/dev/null 2>/dev/null || die "ERROR can't find flac executable"
Chris@1 43
Chris@1 44 run_flac ()
Chris@1 45 {
Chris@1 46 if [ x"$FLAC__TEST_WITH_VALGRIND" = xyes ] ; then
Chris@1 47 echo "valgrind --leak-check=yes --show-reachable=yes --num-callers=100 flac $*" >>test_streams.valgrind.log
Chris@1 48 valgrind --leak-check=yes --show-reachable=yes --num-callers=100 --log-fd=4 flac $* 4>>test_streams.valgrind.log
Chris@1 49 else
Chris@1 50 flac $*
Chris@1 51 fi
Chris@1 52 }
Chris@1 53
Chris@1 54 echo "Generating streams..."
Chris@1 55 if [ ! -f wacky1.wav ] ; then
Chris@1 56 test_streams || die "ERROR during test_streams"
Chris@1 57 fi
Chris@1 58
Chris@1 59 #
Chris@1 60 # single-file test routines
Chris@1 61 #
Chris@1 62
Chris@1 63 test_file ()
Chris@1 64 {
Chris@1 65 name=$1
Chris@1 66 channels=$2
Chris@1 67 bps=$3
Chris@1 68 encode_options="$4"
Chris@1 69
Chris@1 70 echo -n "$name (--channels=$channels --bps=$bps $encode_options): encode..."
Chris@1 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"
Chris@1 72 echo "### ENCODE $name #######################################################" >> ./streams.log
Chris@1 73 echo "### cmd=$cmd" >> ./streams.log
Chris@1 74 $cmd 2>>./streams.log || die "ERROR during encode of $name"
Chris@1 75
Chris@1 76 echo -n "decode..."
Chris@1 77 cmd="run_flac --silent --force --endian=little --sign=signed --decode --force-raw-format --output-name=$name.cmp $name.flac"
Chris@1 78 echo "### DECODE $name #######################################################" >> ./streams.log
Chris@1 79 echo "### cmd=$cmd" >> ./streams.log
Chris@1 80 $cmd 2>>./streams.log || die "ERROR during decode of $name"
Chris@1 81
Chris@1 82 ls -1l $name.raw >> ./streams.log
Chris@1 83 ls -1l $name.flac >> ./streams.log
Chris@1 84 ls -1l $name.cmp >> ./streams.log
Chris@1 85
Chris@1 86 echo -n "compare..."
Chris@1 87 cmp $name.raw $name.cmp || die "ERROR during compare of $name"
Chris@1 88
Chris@1 89 echo OK
Chris@1 90 }
Chris@1 91
Chris@1 92 test_file_piped ()
Chris@1 93 {
Chris@1 94 name=$1
Chris@1 95 channels=$2
Chris@1 96 bps=$3
Chris@1 97 encode_options="$4"
Chris@1 98
Chris@1 99 if [ `env | grep -ic '^comspec='` != 0 ] ; then
Chris@1 100 is_win=yes
Chris@1 101 else
Chris@1 102 is_win=no
Chris@1 103 fi
Chris@1 104
Chris@1 105 echo -n "$name: encode via pipes..."
Chris@1 106 if [ $is_win = yes ] ; then
Chris@1 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"
Chris@1 108 echo "### ENCODE $name #######################################################" >> ./streams.log
Chris@1 109 echo "### cmd=$cmd" >> ./streams.log
Chris@1 110 $cmd 1>$name.flac 2>>./streams.log || die "ERROR during encode of $name"
Chris@1 111 else
Chris@1 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 -"
Chris@1 113 echo "### ENCODE $name #######################################################" >> ./streams.log
Chris@1 114 echo "### cmd=$cmd" >> ./streams.log
Chris@1 115 cat $name.raw | $cmd 1>$name.flac 2>>./streams.log || die "ERROR during encode of $name"
Chris@1 116 fi
Chris@1 117 echo -n "decode via pipes..."
Chris@1 118 if [ $is_win = yes ] ; then
Chris@1 119 cmd="run_flac --silent --force --endian=little --sign=signed --decode --force-raw-format --stdout $name.flac"
Chris@1 120 echo "### DECODE $name #######################################################" >> ./streams.log
Chris@1 121 echo "### cmd=$cmd" >> ./streams.log
Chris@1 122 $cmd 1>$name.cmp 2>>./streams.log || die "ERROR during decode of $name"
Chris@1 123 else
Chris@1 124 cmd="run_flac --silent --force --endian=little --sign=signed --decode --force-raw-format --stdout -"
Chris@1 125 echo "### DECODE $name #######################################################" >> ./streams.log
Chris@1 126 echo "### cmd=$cmd" >> ./streams.log
Chris@1 127 cat $name.flac | $cmd 1>$name.cmp 2>>./streams.log || die "ERROR during decode of $name"
Chris@1 128 fi
Chris@1 129 ls -1l $name.raw >> ./streams.log
Chris@1 130 ls -1l $name.flac >> ./streams.log
Chris@1 131 ls -1l $name.cmp >> ./streams.log
Chris@1 132
Chris@1 133 echo -n "compare..."
Chris@1 134 cmp $name.raw $name.cmp || die "ERROR during compare of $name"
Chris@1 135
Chris@1 136 echo OK
Chris@1 137 }
Chris@1 138
Chris@1 139 if [ "$FLAC__TEST_LEVEL" -gt 1 ] ; then
Chris@1 140 max_lpc_order=32
Chris@1 141 else
Chris@1 142 max_lpc_order=16
Chris@1 143 fi
Chris@1 144
Chris@1 145 echo "Testing noise through pipes..."
Chris@1 146 test_file_piped noise 1 8 "-0"
Chris@1 147
Chris@1 148 echo "Testing small files..."
Chris@1 149 test_file test01 1 16 "-0 -l $max_lpc_order --lax -m -e -p"
Chris@1 150 test_file test02 2 16 "-0 -l $max_lpc_order --lax -m -e -p"
Chris@1 151 test_file test03 1 16 "-0 -l $max_lpc_order --lax -m -e -p"
Chris@1 152 test_file test04 2 16 "-0 -l $max_lpc_order --lax -m -e -p"
Chris@1 153
Chris@1 154 for bps in 8 16 24 ; do
Chris@1 155 echo "Testing $bps-bit full-scale deflection streams..."
Chris@1 156 for b in 01 02 03 04 05 06 07 ; do
Chris@1 157 test_file fsd$bps-$b 1 $bps "-0 -l $max_lpc_order --lax -m -e -p"
Chris@1 158 done
Chris@1 159 done
Chris@1 160
Chris@1 161 echo "Testing 16-bit wasted-bits-per-sample streams..."
Chris@1 162 for b in 01 ; do
Chris@1 163 test_file wbps16-$b 1 16 "-0 -l $max_lpc_order --lax -m -e -p"
Chris@1 164 done
Chris@1 165
Chris@1 166 for bps in 8 16 24 ; do
Chris@1 167 echo "Testing $bps-bit sine wave streams..."
Chris@1 168 for b in 00 ; do
Chris@1 169 test_file sine${bps}-$b 1 $bps "-0 -l $max_lpc_order --lax -m -e --sample-rate=48000"
Chris@1 170 done
Chris@1 171 for b in 01 ; do
Chris@1 172 test_file sine${bps}-$b 1 $bps "-0 -l $max_lpc_order --lax -m -e --sample-rate=96000"
Chris@1 173 done
Chris@1 174 for b in 02 03 04 ; do
Chris@1 175 test_file sine${bps}-$b 1 $bps "-0 -l $max_lpc_order --lax -m -e"
Chris@1 176 done
Chris@1 177 for b in 10 11 ; do
Chris@1 178 test_file sine${bps}-$b 2 $bps "-0 -l $max_lpc_order --lax -m -e --sample-rate=48000"
Chris@1 179 done
Chris@1 180 for b in 12 ; do
Chris@1 181 test_file sine${bps}-$b 2 $bps "-0 -l $max_lpc_order --lax -m -e --sample-rate=96000"
Chris@1 182 done
Chris@1 183 for b in 13 14 15 16 17 18 19 ; do
Chris@1 184 test_file sine${bps}-$b 2 $bps "-0 -l $max_lpc_order --lax -m -e"
Chris@1 185 done
Chris@1 186 done
Chris@1 187
Chris@1 188 echo "Testing blocksize variations..."
Chris@1 189 for disable in '' '--disable-verbatim-subframes --disable-constant-subframes' '--disable-verbatim-subframes --disable-constant-subframes --disable-fixed-subframes' ; do
Chris@1 190 for blocksize in 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 ; do
Chris@1 191 for lpc_order in 0 1 2 3 4 5 7 8 9 15 16 17 31 32 ; do
Chris@1 192 if [ $lpc_order = 0 ] || [ $lpc_order -le $blocksize ] ; then
Chris@1 193 test_file noise8m32 1 8 "-8 -p -e -l $lpc_order --lax --blocksize=$blocksize $disable"
Chris@1 194 fi
Chris@1 195 done
Chris@1 196 done
Chris@1 197 done
Chris@1 198
Chris@1 199 echo "Testing some frame header variations..."
Chris@1 200 test_file sine16-01 1 16 "-0 -l $max_lpc_order -m -e -p --lax -b $max_lpc_order"
Chris@1 201 test_file sine16-01 1 16 "-0 -l $max_lpc_order -m -e -p --lax -b 65535"
Chris@1 202 test_file sine16-01 1 16 "-0 -l $max_lpc_order -m -e -p --lax --sample-rate=9"
Chris@1 203 test_file sine16-01 1 16 "-0 -l $max_lpc_order -m -e -p --lax --sample-rate=90"
Chris@1 204 test_file sine16-01 1 16 "-0 -l $max_lpc_order -m -e -p --lax --sample-rate=90000"
Chris@1 205 test_file sine16-01 1 16 "-0 -l $max_lpc_order -m -e -p --lax --sample-rate=9"
Chris@1 206 test_file sine16-01 1 16 "-0 -l $max_lpc_order -m -e -p --lax --sample-rate=90"
Chris@1 207 test_file sine16-01 1 16 "-0 -l $max_lpc_order -m -e -p --lax --sample-rate=90000"
Chris@1 208
Chris@1 209 echo "Testing option variations..."
Chris@1 210 for f in 00 01 02 03 04 ; do
Chris@1 211 for disable in '' '--disable-verbatim-subframes --disable-constant-subframes' '--disable-verbatim-subframes --disable-constant-subframes --disable-fixed-subframes' ; do
Chris@1 212 if [ -z "$disable" ] || [ "$FLAC__TEST_LEVEL" -gt 0 ] ; then
Chris@1 213 for opt in 0 1 2 4 5 6 8 ; do
Chris@1 214 for extras in '' '-p' '-e' ; do
Chris@1 215 if [ -z "$extras" ] || [ "$FLAC__TEST_LEVEL" -gt 0 ] ; then
Chris@1 216 test_file sine16-$f 1 16 "-$opt $extras $disable"
Chris@1 217 fi
Chris@1 218 done
Chris@1 219 done
Chris@1 220 if [ "$FLAC__TEST_LEVEL" -gt 1 ] ; then
Chris@1 221 test_file sine16-$f 1 16 "-b 16384 -m -r 8 -l $max_lpc_order --lax -e -p $disable"
Chris@1 222 fi
Chris@1 223 fi
Chris@1 224 done
Chris@1 225 done
Chris@1 226
Chris@1 227 for f in 10 11 12 13 14 15 16 17 18 19 ; do
Chris@1 228 for disable in '' '--disable-verbatim-subframes --disable-constant-subframes' '--disable-verbatim-subframes --disable-constant-subframes --disable-fixed-subframes' ; do
Chris@1 229 if [ -z "$disable" ] || [ "$FLAC__TEST_LEVEL" -gt 0 ] ; then
Chris@1 230 for opt in 0 1 2 4 5 6 8 ; do
Chris@1 231 for extras in '' '-p' '-e' ; do
Chris@1 232 if [ -z "$extras" ] || [ "$FLAC__TEST_LEVEL" -gt 0 ] ; then
Chris@1 233 test_file sine16-$f 2 16 "-$opt $extras $disable"
Chris@1 234 fi
Chris@1 235 done
Chris@1 236 done
Chris@1 237 if [ "$FLAC__TEST_LEVEL" -gt 1 ] ; then
Chris@1 238 test_file sine16-$f 2 16 "-b 16384 -m -r 8 -l $max_lpc_order --lax -e -p $disable"
Chris@1 239 fi
Chris@1 240 fi
Chris@1 241 done
Chris@1 242 done
Chris@1 243
Chris@1 244 echo "Testing noise..."
Chris@1 245 for disable in '' '--disable-verbatim-subframes --disable-constant-subframes' '--disable-verbatim-subframes --disable-constant-subframes --disable-fixed-subframes' ; do
Chris@1 246 if [ -z "$disable" ] || [ "$FLAC__TEST_LEVEL" -gt 0 ] ; then
Chris@1 247 for channels in 1 2 4 8 ; do
Chris@1 248 if [ $channels -le 2 ] || [ "$FLAC__TEST_LEVEL" -gt 0 ] ; then
Chris@1 249 for bps in 8 16 24 ; do
Chris@1 250 for opt in 0 1 2 3 4 5 6 7 8 ; do
Chris@1 251 for extras in '' '-p' '-e' ; do
Chris@1 252 if [ -z "$extras" ] || [ "$FLAC__TEST_LEVEL" -gt 0 ] ; then
Chris@1 253 for blocksize in '' '--lax -b 32' '--lax -b 32768' '--lax -b 65535' ; do
Chris@1 254 if [ -z "$blocksize" ] || [ "$FLAC__TEST_LEVEL" -gt 0 ] ; then
Chris@1 255 test_file noise $channels $bps "-$opt $extras $blocksize $disable"
Chris@1 256 fi
Chris@1 257 done
Chris@1 258 fi
Chris@1 259 done
Chris@1 260 done
Chris@1 261 if [ "$FLAC__TEST_LEVEL" -gt 1 ] ; then
Chris@1 262 test_file noise $channels $bps "-b 16384 -m -r 8 -l $max_lpc_order --lax -e -p $disable"
Chris@1 263 fi
Chris@1 264 done
Chris@1 265 fi
Chris@1 266 done
Chris@1 267 fi
Chris@1 268 done