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-11-30 09:41:09 +0300
committerJean-Marc Valin <Jean-Marc.Valin@csiro.au>2007-11-30 09:41:09 +0300
commit3c453121d2b2daaa2af47d99b9cbe5027611383f (patch)
treeab820f7742b92f9f600a14a505014d14b5fef9f9 /libcelt/bands.c
parentdff7d36a88df376a035b922dd6fb7648d5d24f4f (diff)
Vector quantisation of the residual (copied from Ghost/ceft)
Diffstat (limited to 'libcelt/bands.c')
-rw-r--r--libcelt/bands.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/libcelt/bands.c b/libcelt/bands.c
index 6fbcf54..9c13444 100644
--- a/libcelt/bands.c
+++ b/libcelt/bands.c
@@ -31,6 +31,7 @@
#include <math.h>
#include "bands.h"
+#include "vq.h"
const int qbank[NBANDS+2] = {0, 2, 4, 6, 8, 12, 16, 20, 24, 28, 36, 44, 52, 68, 84, 116, 128};
int qpulses[] = {4, 5, 4, 4, 3, 3, 3, 3, 3, 4, 4, 4, 0, 0, 0}; //c: 134 bits
@@ -138,6 +139,23 @@ void pitch_quant_bands(float *X, int B, float *P, float *gains)
P[i] = 0;
}
+void quant_bands(float *X, int B, float *P)
+{
+ int i;
+ for (i=0;i<NBANDS;i++)
+ {
+ int q;
+ q =qpulses[i];
+ if (q) {
+ alg_quant2(X+B*qbank[i], B*(qbank[i+1]-qbank[i]), q, P+B*qbank[i]);
+ } else {
+ noise_quant(X+B*qbank[i], B*(qbank[i+1]-qbank[i]), q, P+B*qbank[i]);
+ }
+ }
+ for (i=B*qbank[NBANDS];i<B*qbank[NBANDS+1];i++)
+ X[i] = 0;
+}
+
/* Scales the pulse-codebook entry in each band such that unit-energy is conserved when
adding the pitch */