From 8b906c102b37ce74571898c8879c01b2a9088fb3 Mon Sep 17 00:00:00 2001 From: Jean-Marc Valin Date: Wed, 7 Nov 2012 14:09:04 -0500 Subject: [PATCH] Changed denormalize_bands() to only work between "start" and "end" --- celt/bands.c | 9 ++++++--- celt/bands.h | 3 ++- celt/celt.c | 28 +++------------------------- 3 files changed, 11 insertions(+), 29 deletions(-) diff --git a/celt/bands.c b/celt/bands.c index c352b7a2..8883f40a 100644 --- a/celt/bands.c +++ b/celt/bands.c @@ -187,7 +187,8 @@ void normalise_bands(const CELTMode *m, const celt_sig * OPUS_RESTRICT freq, cel #endif /* FIXED_POINT */ /* De-normalise the energy to produce the synthesis from the unit-energy bands */ -void denormalise_bands(const CELTMode *m, const celt_norm * OPUS_RESTRICT X, celt_sig * OPUS_RESTRICT freq, const celt_ener *bandE, int end, int C, int M) +void denormalise_bands(const CELTMode *m, const celt_norm * OPUS_RESTRICT X, + celt_sig * OPUS_RESTRICT freq, const celt_ener *bandE, int start, int end, int C, int M) { int i, c, N; const opus_int16 *eBands = m->eBands; @@ -197,8 +198,10 @@ void denormalise_bands(const CELTMode *m, const celt_norm * OPUS_RESTRICT X, cel celt_sig * OPUS_RESTRICT f; const celt_norm * OPUS_RESTRICT x; f = freq+c*N; - x = X+c*N; - for (i=0;inbEBands],1); diff --git a/celt/bands.h b/celt/bands.h index 47d15b6d..66b69cc7 100644 --- a/celt/bands.h +++ b/celt/bands.h @@ -58,7 +58,8 @@ void normalise_bands(const CELTMode *m, const celt_sig * OPUS_RESTRICT freq, cel * @param X Spectrum (returned de-normalised) * @param bands Square root of the energy for each band */ -void denormalise_bands(const CELTMode *m, const celt_norm * OPUS_RESTRICT X, celt_sig * OPUS_RESTRICT freq, const celt_ener *bandE, int end, int C, int M); +void denormalise_bands(const CELTMode *m, const celt_norm * OPUS_RESTRICT X, + celt_sig * OPUS_RESTRICT freq, const celt_ener *bandE, int start, int end, int C, int M); #define SPREAD_NONE (0) #define SPREAD_LIGHT (1) diff --git a/celt/celt.c b/celt/celt.c index 1c8b65f6..b29d0db0 100644 --- a/celt/celt.c +++ b/celt/celt.c @@ -1987,21 +1987,12 @@ int celt_encode_with_ec(CELTEncoder * OPUS_RESTRICT st, const opus_val16 * pcm, } /* Synthesis */ - denormalise_bands(mode, X, freq, bandE, effEnd, C, M); + denormalise_bands(mode, X, freq, bandE, st->start, effEnd, C, M); c=0; do { OPUS_MOVE(st->syn_mem[c], st->syn_mem[c]+N, 2*MAX_PERIOD-N+overlap); } while (++cstart];i++) - freq[c*N+i] = 0; - while (++cend];irng; for (c=0;cstart]<start;ieffEBands;i++) { int j; @@ -2541,12 +2530,10 @@ static void celt_decode_lost(CELTDecoder * OPUS_RESTRICT st, opus_val16 * OPUS_R } renormalise_vector(X+boffs, blen, Q15ONE); } - for (i=(eBands[st->end]<rng = seed; - denormalise_bands(mode, X, freq, bandE, mode->effEBands, C, 1<start, mode->effEBands, C, 1<start]<start];i++) - X[c*N+i] = 0; - while (++cstart, st->end, X, C==2 ? X+N : NULL, collapse_masks, NULL, pulses, shortBlocks, spread_decision, dual_stereo, intensity, tf_res, len*(8<rng); @@ -3009,7 +2987,7 @@ int celt_decode_with_ec(CELTDecoder * OPUS_RESTRICT st, const unsigned char *dat } ALLOC(freq, IMAX(CC,C)*N, celt_sig); /**< Interleaved signal MDCTs */ /* Synthesis */ - denormalise_bands(mode, X, freq, bandE, effEnd, C, M); + denormalise_bands(mode, X, freq, bandE, st->start, effEnd, C, M); c=0; do { OPUS_MOVE(decode_mem[c], decode_mem[c]+N, DECODE_BUFFER_SIZE-N+overlap);