ref: fa248735eac5cb54a64d08b8067488a72646d05d
parent: 96870d93346d0a682dcc924bf6484473488e20b9
author: Jean-Marc Valin <[email protected]>
date: Thu Dec 6 02:51:27 EST 2007
Quantisation of energies
--- a/libcelt/Makefile.am
+++ b/libcelt/Makefile.am
@@ -10,7 +10,7 @@
# Sources for compilation in the library
libcelt_la_SOURCES = bands.c celt.c cwrs.c fftwrap.c mdct.c modes.c pitch.c \
- smallft.c vq.c
+ quant_bands.c smallft.c vq.c
#noinst_HEADERS =
@@ -17,7 +17,7 @@
libcelt_la_LDFLAGS = -version-info @CELT_LT_CURRENT@:@CELT_LT_REVISION@:@CELT_LT_AGE@
noinst_HEADERS = arch.h bands.h celt.h cwrs.h fftwrap.h mdct.h modes.h \
- os_support.h pitch.h smallft.h vq.h
+ os_support.h pitch.h quant_bands.h smallft.h vq.h
noinst_PROGRAMS = testcelt
testcelt_SOURCES = testcelt.c
--- a/libcelt/celt.c
+++ b/libcelt/celt.c
@@ -58,6 +58,7 @@
float *mdct_overlap;
float *out_mem;
+ float *oldBandE;
};
@@ -84,6 +85,8 @@
for (i=0;i<N;i++)
st->window[i] = st->window[2*N-i-1] = sin(.5*M_PI* sin(.5*M_PI*(i+.5)/N) * sin(.5*M_PI*(i+.5)/N));
+ st->oldBandE = celt_alloc(mode->nbEBands*sizeof(float));
+
st->preemph = 0.8;
return st;
}
@@ -200,13 +203,15 @@
/* Band normalisation */
compute_band_energies(st->mode, X, bandE);
normalise_bands(st->mode, X, bandE);
+ //for (i=0;i<st->mode->nbEBands;i++)printf("%f ", bandE[i]);printf("\n");
- //for (i=0;i<NBANDS;i++)printf("%f ", bandE[i]);printf("\n");
{
float bandEp[st->mode->nbEBands];
compute_band_energies(st->mode, P, bandEp);
normalise_bands(st->mode, P, bandEp);
}
+
+ quant_energy(st->mode, bandE, st->oldBandE);
/* Pitch prediction */
compute_pitch_gain(st->mode, X, P, gains, bandE);