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

gitlab.com/quite/celt.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Marc Valin <jean-marc.valin@usherbrooke.ca>2007-12-29 16:06:10 +0300
committerJean-Marc Valin <jean-marc.valin@usherbrooke.ca>2007-12-29 16:06:10 +0300
commit571e861dc31c602e826921ce6766f3b06d16c7e4 (patch)
treee0a18de90794eed1c3a6b88ec028e135500e1f38 /libcelt/bands.c
parent559e8ff602f172470b7f7faa37a1e531e83faf28 (diff)
more exp_rotation() cleanup
Diffstat (limited to 'libcelt/bands.c')
-rw-r--r--libcelt/bands.c71
1 files changed, 37 insertions, 34 deletions
diff --git a/libcelt/bands.c b/libcelt/bands.c
index 8e0a7f8..9f41aa4 100644
--- a/libcelt/bands.c
+++ b/libcelt/bands.c
@@ -37,53 +37,56 @@
/* Applies a series of rotations so that pulses are spread like a two-sided
exponential */
-static void exp_rotation(float *X, int len, float theta, int dir)
+static void exp_rotation(float *X, int len, float theta, int dir, int stride, int iter)
{
- int i, k, stride=2;
+ int i, k;
float c, s;
c = cos(theta);
s = sin(theta);
if (dir > 0)
{
- for (i=0;i<len-2;i++)
+ for (k=0;k<iter;k++)
{
- float x1, x2;
- x1 = X[i];
- x2 = X[i+2];
- X[i] = c*x1 - s*x2;
- X[i+2] = c*x2 + s*x1;
+ for (i=0;i<len-stride;i++)
+ {
+ float x1, x2;
+ x1 = X[i];
+ x2 = X[i+stride];
+ X[i] = c*x1 - s*x2;
+ X[i+stride] = c*x2 + s*x1;
+ }
+ for (i=len-2*stride-1;i>=0;i--)
+ {
+ float x1, x2;
+ x1 = X[i];
+ x2 = X[i+stride];
+ X[i] = c*x1 - s*x2;
+ X[i+stride] = c*x2 + s*x1;
+ }
}
- for (i=len-5;i>=0;i--)
- {
- float x1, x2;
- x1 = X[i];
- x2 = X[i+2];
- X[i] = c*x1 - s*x2;
- X[i+2] = c*x2 + s*x1;
- }
-
} else {
- for (i=0;i<len-4;i++)
+ for (k=0;k<iter;k++)
{
- float x1, x2;
- x1 = X[i];
- x2 = X[i+2];
- X[i] = c*x1 + s*x2;
- X[i+2] = c*x2 - s*x1;
- }
-
- for (i=len-3;i>=0;i--)
- {
- float x1, x2;
- x1 = X[i];
- x2 = X[i+2];
- X[i] = c*x1 + s*x2;
- X[i+2] = c*x2 - s*x1;
+ for (i=0;i<len-2*stride;i++)
+ {
+ float x1, x2;
+ x1 = X[i];
+ x2 = X[i+stride];
+ X[i] = c*x1 + s*x2;
+ X[i+stride] = c*x2 - s*x1;
+ }
+ for (i=len-stride-1;i>=0;i--)
+ {
+ float x1, x2;
+ x1 = X[i];
+ x2 = X[i+stride];
+ X[i] = c*x1 + s*x2;
+ X[i+stride] = c*x2 - s*x1;
+ }
}
}
}
-
/* Compute the energy in each of the bands */
void compute_band_energies(const CELTMode *m, float *X, float *bank)
{
@@ -264,7 +267,7 @@ void band_rotation(const CELTMode *m, float *X, int dir)
{
float theta;
theta = pow(.1f,1.f*abs(m->nbPulses[i])/(B*(eBands[i+1]-eBands[i])));
- exp_rotation(X+B*eBands[i], B*(eBands[i+1]-eBands[i]), theta, dir);
+ exp_rotation(X+B*eBands[i], B*(eBands[i+1]-eBands[i]), theta, dir, 2, 1);
}
//printf ("\n");
}