blob: 3843518a4bbc4b489369b134ff6f42977878cf79 [file] [log] [blame]
Josh Coalsonbb7f6b92000-12-10 04:09:52 +00001#!/bin/sh
2
Josh Coalson67fcd8e2001-01-19 23:10:56 +00003LD_LIBRARY_PATH=../src/libFLAC/.libs:../obj/lib:$LD_LIBRARY_PATH
Josh Coalsonbb7f6b92000-12-10 04:09:52 +00004export LD_LIBRARY_PATH
Josh Coalson67fcd8e2001-01-19 23:10:56 +00005PATH=../src/flac:../src/test_streams:../obj/bin:$PATH
Josh Coalsonbb7f6b92000-12-10 04:09:52 +00006
Josh Coalsonf6237c82001-02-28 23:43:29 +00007echo "Generating streams..."
Josh Coalson67fcd8e2001-01-19 23:10:56 +00008if test_streams ; then : ; else
Josh Coalsonbb7f6b92000-12-10 04:09:52 +00009 echo "ERROR during test_streams" 1>&2
10 exit 1
11fi
12
Josh Coalsonbb7f6b92000-12-10 04:09:52 +000013test_file ()
14{
15 name=$1
16 channels=$2
17 bps=$3
18 encode_options="$4"
19
Josh Coalsonbb7f6b92000-12-10 04:09:52 +000020 echo -n "$name: encode..."
Josh Coalson29b4af82001-02-08 22:00:05 +000021 cmd="flac -V -s -fr -fb -fs 44100 -fp $bps -fc $channels $encode_options $name.raw $name.flac"
22 echo "### ENCODE $name #######################################################" >> ./streams.log
23 echo "### cmd=$cmd" >> ./streams.log
24 if $cmd 1>/dev/null 2>>./streams.log ; then : ; else
Josh Coalsonbb7f6b92000-12-10 04:09:52 +000025 echo "ERROR during encode of $name" 1>&2
26 exit 1
27 fi
Josh Coalsonbb7f6b92000-12-10 04:09:52 +000028 echo -n "decode..."
Josh Coalson29b4af82001-02-08 22:00:05 +000029 cmd="flac -s -fb -d -fr $name.flac $name.cmp";
30 echo "### DECODE $name #######################################################" >> ./streams.log
31 echo "### cmd=$cmd" >> ./streams.log
32 if $cmd 2>>./streams.log ; then : ; else
Josh Coalsonbb7f6b92000-12-10 04:09:52 +000033 echo "ERROR during decode of $name" 1>&2
34 exit 1
35 fi
Josh Coalson29b4af82001-02-08 22:00:05 +000036 ls -1l $name.raw >> ./streams.log
37 ls -1l $name.flac >> ./streams.log
38 ls -1l $name.cmp >> ./streams.log
Josh Coalsonbb7f6b92000-12-10 04:09:52 +000039 echo -n "compare..."
40 if cmp $name.raw $name.cmp ; then : ; else
41 echo "ERROR during compare of $name" 1>&2
42 exit 1
43 fi
44 echo OK
45}
46
47echo "Testing small files..."
Josh Coalson29b4af82001-02-08 22:00:05 +000048test_file test01 1 16 "-0 -l 8 -m -e"
49test_file test02 2 16 "-0 -l 8 -m -e"
50test_file test03 1 16 "-0 -l 8 -m -e"
51test_file test04 2 16 "-0 -l 8 -m -e"
Josh Coalsonbb7f6b92000-12-10 04:09:52 +000052
53echo "Testing 8-bit full-scale deflection streams..."
54for b in 01 02 03 04 05 06 07 ; do
Josh Coalson29b4af82001-02-08 22:00:05 +000055 test_file fsd8-$b 1 8 "-0 -l 8 -m -e -q 15"
Josh Coalsonbb7f6b92000-12-10 04:09:52 +000056done
57
58echo "Testing 16-bit full-scale deflection streams..."
59for b in 01 02 03 04 05 06 07 ; do
Josh Coalson29b4af82001-02-08 22:00:05 +000060 test_file fsd16-$b 1 16 "-0 -l 8 -m -e -q 15"
Josh Coalsonbb7f6b92000-12-10 04:09:52 +000061done
62
Josh Coalsonf6237c82001-02-28 23:43:29 +000063echo "Testing 24-bit full-scale deflection streams..."
64for b in 01 02 03 04 05 06 07 ; do
65 test_file fsd24-$b 1 24 "-0 -l 8 -m -e -q 7"
Josh Coalson29b4af82001-02-08 22:00:05 +000066done
Josh Coalsonf6237c82001-02-28 23:43:29 +000067
68for bps in 16 24 ; do
69 echo "Testing $bps-bit sine wave streams..."
70 for b in 00 01 02 03 04 ; do
71 test_file sine${bps}-$b 1 $bps "-0 -l 8 -m -e"
72 done
73 for b in 10 11 12 13 14 15 16 17 18 19 ; do
74 test_file sine${bps}-$b 2 $bps "-0 -l 8 -m -e"
75 done
Josh Coalsonbb7f6b92000-12-10 04:09:52 +000076done
77
78echo "Testing some frame header variations..."
Josh Coalsonf6237c82001-02-28 23:43:29 +000079test_file sine16-01 1 16 "-0 -l 8 -m -e --lax -b 16"
80test_file sine16-01 1 16 "-0 -l 8 -m -e --lax -b 65535"
81test_file sine16-01 1 16 "-0 -l 8 -m -e -b 16"
82test_file sine16-01 1 16 "-0 -l 8 -m -e -b 65535"
83test_file sine16-01 1 16 "-0 -l 8 -m -e --lax -fs 9"
84test_file sine16-01 1 16 "-0 -l 8 -m -e --lax -fs 90"
85test_file sine16-01 1 16 "-0 -l 8 -m -e --lax -fs 90000"
86test_file sine16-01 1 16 "-0 -l 8 -m -e -fs 9"
87test_file sine16-01 1 16 "-0 -l 8 -m -e -fs 90"
88test_file sine16-01 1 16 "-0 -l 8 -m -e -fs 90000"
Josh Coalson29b4af82001-02-08 22:00:05 +000089
90echo "Testing option variations..."
91for f in 00 01 02 03 04 ; do
92 for opt in 0 1 2 4 5 6 8 ; do
Josh Coalsonc5f2f3f2001-02-08 22:21:45 +000093 for extras in '' '-p' '-e' ; do
Josh Coalsonf6237c82001-02-28 23:43:29 +000094 test_file sine16-$f 1 16 "-$opt $extras"
Josh Coalson29b4af82001-02-08 22:00:05 +000095 done
96 done
97done
98for f in 10 11 12 13 14 15 16 17 18 19 ; do
99 for opt in 0 1 2 4 5 6 8 ; do
Josh Coalsonc5f2f3f2001-02-08 22:21:45 +0000100 for extras in '' '-p' '-e' ; do
Josh Coalsonf6237c82001-02-28 23:43:29 +0000101 test_file sine16-$f 2 16 "-$opt $extras"
Josh Coalson29b4af82001-02-08 22:00:05 +0000102 done
103 done
104done
105
106echo "Testing noise..."
107for opt in 0 1 2 4 5 6 8 ; do
Josh Coalsonc5f2f3f2001-02-08 22:21:45 +0000108 for extras in '' '-p' '-e' ; do
Josh Coalson29b4af82001-02-08 22:00:05 +0000109 for blocksize in '' '-b 32' '-b 32768' '-b 65535' ; do
Josh Coalsoneda1ff62001-03-02 23:52:41 +0000110 for channels in 1 2 4 8 ; do
Josh Coalsonf6237c82001-02-28 23:43:29 +0000111 for bps in 8 16 24 ; do
Josh Coalsonc5f2f3f2001-02-08 22:21:45 +0000112 test_file noise $channels $bps "-$opt $extras $blocksize"
Josh Coalson29b4af82001-02-08 22:00:05 +0000113 done
114 done
115 done
116 done
117done