Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mumble-voip/celt-0.7.0.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJean-Marc Valin <Jean-Marc.Valin@csiro.au>2008-03-07 06:44:56 +0300
committerJean-Marc Valin <Jean-Marc.Valin@csiro.au>2008-03-07 06:44:56 +0300
commitf8eb420a09a1c57430505f52f282c7ed5b225db3 (patch)
tree0472f732807b78d02ac5b1dd73b878dc9d0aa3a5 /tests
parentba8e2f7b2932cd68a6ff3f19c695a0771a0ec7b9 (diff)
Changed the pulse spreading rotations so that the number of iterations is
variable instead of the angle. Should now be both less CPU-intensive and makes fixed-point code simpler.
Diffstat (limited to 'tests')
-rw-r--r--tests/rotation-test.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/tests/rotation-test.c b/tests/rotation-test.c
index c675ae4..561dcc7 100644
--- a/tests/rotation-test.c
+++ b/tests/rotation-test.c
@@ -13,31 +13,37 @@ int ret=0;
void test_rotation(int N, int K)
{
int i;
- double err = 0, ener = 0, snr;
- celt_word16_t theta = Q15_ONE*.007*N/K;
+ double err = 0, ener = 0, snr, snr0;
celt_word16_t x0[MAX_SIZE];
celt_word16_t x1[MAX_SIZE];
+ int nb_rotations = (N+4*K)/(8*K);
for (i=0;i<N;i++)
x1[i] = x0[i] = rand()%32767-16384;
- exp_rotation(x1, N, theta, 1, 1, 8);
- exp_rotation(x1, N, theta, -1, 1, 8);
+ exp_rotation(x1, N, 1, 1, nb_rotations);
+ for (i=0;i<N;i++)
+ {
+ err += (x0[i]-(double)x1[i])*(x0[i]-(double)x1[i]);
+ ener += x0[i]*(double)x0[i];
+ }
+ snr0 = 20*log10(ener/err);
+ err = ener = 0;
+ exp_rotation(x1, N, -1, 1, nb_rotations);
for (i=0;i<N;i++)
{
err += (x0[i]-(double)x1[i])*(x0[i]-(double)x1[i]);
ener += x0[i]*(double)x0[i];
}
snr = 20*log10(ener/err);
- printf ("SNR for size %d (%d pulses) is %f\n", N, K, snr);
- if (snr < 60)
+ printf ("SNR for size %d (%d pulses) is %f (was %f without inverse)\n", N, K, snr, snr0);
+ if (snr < 60 || snr0 > 20)
ret = 1;
}
int main()
{
- test_rotation(4, 40);
- test_rotation(7, 20);
- test_rotation(10, 10);
+ test_rotation(15, 3);
test_rotation(23, 5);
test_rotation(50, 3);
+ test_rotation(80, 1);
return ret;
}