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-26 08:42:42 +0300
committerJean-Marc Valin <Jean-Marc.Valin@csiro.au>2008-03-26 08:42:42 +0300
commit189acec5d36ae9a8031fb47b6aee8f3ef6b62f2f (patch)
treee85fb22dcf53a65f386081b1b9de6bf1a2c599ec /tests
parent385795ed7bbe22e9f0c4ddbc314fe16b88e6ae4e (diff)
optimisation: defined a reciprocal square root (celt_rsqrt) for use in
find_spectral_pitch instead of using celt_rcp(celt_sqrt(x))
Diffstat (limited to 'tests')
-rw-r--r--tests/mathops-test.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/mathops-test.c b/tests/mathops-test.c
index dc208da..b7ffdac 100644
--- a/tests/mathops-test.c
+++ b/tests/mathops-test.c
@@ -53,9 +53,28 @@ void testsqrt(void)
}
}
+void testrsqrt(void)
+{
+ celt_int32_t i;
+ for (i=1;i<=2000000;i++)
+ {
+ double ratio;
+ celt_word16_t val;
+ val = celt_rsqrt(i);
+ ratio = val*sqrt(i)/32768;
+ if (fabs(ratio - 1) > .05)
+ {
+ fprintf (stderr, "sqrt failed: sqrt(%d)="WORD" (ratio = %f)\n", i, val, ratio);
+ ret = 1;
+ }
+ i+= i>>10;
+ }
+}
+
int main(void)
{
testdiv();
testsqrt();
+ testrsqrt();
return ret;
}