From 3b0df0dc2a0f17bdff7b41d2b437e3e042fec1bc Mon Sep 17 00:00:00 2001 From: Jean-Marc Valin Date: Fri, 16 Jul 2010 15:55:30 -0400 Subject: [PATCH] All modes based on 2.5 ms short blocks now use the same definition --- libcelt/celt.c | 11 +++++++++++ libcelt/modes.c | 3 ++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/libcelt/celt.c b/libcelt/celt.c index e905deb4..e1e35888 100644 --- a/libcelt/celt.c +++ b/libcelt/celt.c @@ -159,6 +159,8 @@ CELTEncoder *celt_encoder_create(const CELTMode *mode, int channels, int *error) st->start = 0; st->end = st->mode->nbEBands; + while (st->mode->eBands[st->end] > st->mode->shortMdctSize) + st->end--; st->vbr_rate_norm = 0; st->pitch_enabled = 1; @@ -1068,6 +1070,13 @@ int celt_encode_with_ec_float(CELTEncoder * restrict st, const celt_sig * pcm, c if (has_pitch) apply_pitch(st->mode, freq, pitch_freq, gain_id, 0, C, M); + for (c=0;cmode->eBands[st->start];i++) + freq[c*N+i] = 0; + for (c=0;cmode->eBands[st->end];imode, shortBlocks, freq, transient_time, transient_shift, st->out_mem, C, LM); /* De-emphasis and put everything back at the right place @@ -1414,6 +1423,8 @@ CELTDecoder *celt_decoder_create(const CELTMode *mode, int channels, int *error) st->start = 0; st->end = st->mode->nbEBands; + while (st->mode->eBands[st->end] > st->mode->shortMdctSize) + st->end--; st->decode_mem = (celt_sig*)celt_alloc((DECODE_BUFFER_SIZE+st->overlap)*C*sizeof(celt_sig)); st->out_mem = st->decode_mem+DECODE_BUFFER_SIZE-MAX_PERIOD; diff --git a/libcelt/modes.c b/libcelt/modes.c index b019ca2d..af2d0077 100644 --- a/libcelt/modes.c +++ b/libcelt/modes.c @@ -119,7 +119,8 @@ static celt_int16 *compute_ebands(celt_int32 Fs, int frame_size, int res, int *n celt_int16 *eBands; int i, lin, low, high, nBark, offset=0; - if (Fs == 400*(celt_int32)frame_size && Fs >= 40000) + /* All modes that have 2.5 ms short blocks use the same definition */ + if (Fs == 400*(celt_int32)frame_size) { *nbEBands = sizeof(eband5ms)/sizeof(eband5ms[0])-1; eBands = celt_alloc(sizeof(celt_int16)*(*nbEBands+2));