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@csiro.au>2007-12-05 09:48:24 +0300
committerJean-Marc Valin <Jean-Marc.Valin@csiro.au>2007-12-05 09:48:24 +0300
commit73e51b3e94d4e9708fa1ede4b45dc56968a6f3ac (patch)
tree5413af3eae7f3132fd958ba40d33edcbd642abd5 /libcelt/bands.c
parentecb36a3323b0d222224546f818e7c701f67c2de7 (diff)
Converting the code to use the modes instead of global arrays.
Diffstat (limited to 'libcelt/bands.c')
-rw-r--r--libcelt/bands.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/libcelt/bands.c b/libcelt/bands.c
index 98c7933..0a3a17e 100644
--- a/libcelt/bands.c
+++ b/libcelt/bands.c
@@ -31,6 +31,7 @@
#include <math.h>
#include "bands.h"
+#include "modes.h"
#include "vq.h"
#include "cwrs.h"
@@ -45,31 +46,35 @@ const int qpulses[NBANDS ] = {7, 5, 4, 4, 3, 3, 3, 4, 4, 4, -2, -1, -1, -1
int pbank[] = {0, 4, 8, 12, 20, WAVEFORM_END, 128};
/* Compute the energy in each of the bands */
-void compute_bands(float *X, int B, float *bank)
+void compute_band_energies(const CELTMode *m, float *X, float *bank)
{
- int i;
+ int i, B;
+ const int *eBands = m->eBands;
+ B = m->nbMdctBlocks;
for (i=0;i<NBANDS;i++)
{
int j;
bank[i] = 1e-10;
- for (j=B*qbank[i];j<B*qbank[i+1];j++)
+ for (j=B*eBands[i];j<B*eBands[i+1];j++)
bank[i] += X[j]*X[j];
bank[i] = sqrt(bank[i]);
}
}
/* Normalise each band such that the energy is one. */
-void normalise_bands(float *X, int B, float *bank)
+void normalise_bands(const CELTMode *m, float *X, float *bank)
{
- int i;
+ int i, B;
+ const int *eBands = m->eBands;
+ B = m->nbMdctBlocks;
for (i=0;i<NBANDS;i++)
{
int j;
float x = 1.f/(1e-10+bank[i]);
- for (j=B*qbank[i];j<B*qbank[i+1];j++)
+ for (j=B*eBands[i];j<B*eBands[i+1];j++)
X[j] *= x;
}
- for (i=B*qbank[NBANDS];i<B*qbank[NBANDS+1];i++)
+ for (i=B*eBands[NBANDS];i<B*eBands[NBANDS+1];i++)
X[i] = 0;
}