Quantisation of energies

This commit is contained in:
Jean-Marc Valin 2007-12-06 07:51:27 +11:00
parent 96870d9334
commit fa248735ea
2 changed files with 8 additions and 3 deletions

View file

@ -10,14 +10,14 @@ lib_LTLIBRARIES = libcelt.la
# 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 =
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

View file

@ -58,6 +58,7 @@ struct CELTState_ {
float *mdct_overlap;
float *out_mem;
float *oldBandE;
};
@ -84,6 +85,8 @@ CELTState *celt_encoder_new(const CELTMode *mode)
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,14 +203,16 @@ int celt_encode(CELTState *st, short *pcm)
/* 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);
//quantise_pitch(gains, PBANDS);