Quantisation of energies
This commit is contained in:
parent
96870d9334
commit
fa248735ea
2 changed files with 8 additions and 3 deletions
|
@ -10,14 +10,14 @@ lib_LTLIBRARIES = libcelt.la
|
||||||
|
|
||||||
# Sources for compilation in the library
|
# Sources for compilation in the library
|
||||||
libcelt_la_SOURCES = bands.c celt.c cwrs.c fftwrap.c mdct.c modes.c pitch.c \
|
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 =
|
#noinst_HEADERS =
|
||||||
|
|
||||||
libcelt_la_LDFLAGS = -version-info @CELT_LT_CURRENT@:@CELT_LT_REVISION@:@CELT_LT_AGE@
|
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 \
|
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
|
noinst_PROGRAMS = testcelt
|
||||||
testcelt_SOURCES = testcelt.c
|
testcelt_SOURCES = testcelt.c
|
||||||
|
|
|
@ -58,6 +58,7 @@ struct CELTState_ {
|
||||||
float *mdct_overlap;
|
float *mdct_overlap;
|
||||||
float *out_mem;
|
float *out_mem;
|
||||||
|
|
||||||
|
float *oldBandE;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -84,6 +85,8 @@ CELTState *celt_encoder_new(const CELTMode *mode)
|
||||||
for (i=0;i<N;i++)
|
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->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;
|
st->preemph = 0.8;
|
||||||
return st;
|
return st;
|
||||||
}
|
}
|
||||||
|
@ -200,14 +203,16 @@ int celt_encode(CELTState *st, short *pcm)
|
||||||
/* Band normalisation */
|
/* Band normalisation */
|
||||||
compute_band_energies(st->mode, X, bandE);
|
compute_band_energies(st->mode, X, bandE);
|
||||||
normalise_bands(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];
|
float bandEp[st->mode->nbEBands];
|
||||||
compute_band_energies(st->mode, P, bandEp);
|
compute_band_energies(st->mode, P, bandEp);
|
||||||
normalise_bands(st->mode, P, bandEp);
|
normalise_bands(st->mode, P, bandEp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
quant_energy(st->mode, bandE, st->oldBandE);
|
||||||
|
|
||||||
/* Pitch prediction */
|
/* Pitch prediction */
|
||||||
compute_pitch_gain(st->mode, X, P, gains, bandE);
|
compute_pitch_gain(st->mode, X, P, gains, bandE);
|
||||||
//quantise_pitch(gains, PBANDS);
|
//quantise_pitch(gains, PBANDS);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue