diff --git a/celt/bands.c b/celt/bands.c index ee230912..3308bc42 100644 --- a/celt/bands.c +++ b/celt/bands.c @@ -193,12 +193,22 @@ void normalise_bands(const CELTMode *m, const celt_sig * OPUS_RESTRICT freq, cel /* 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 opus_val16 *bandLogE, int start, int end, int C, int M) + celt_sig * OPUS_RESTRICT freq, const opus_val16 *bandLogE, int start, + int end, int C, int M, int downsample, int silence) { int i, c, N; + int bound; const opus_int16 *eBands = m->eBands; N = M*m->shortMdctSize; + bound = M*eBands[end]; + if (downsample!=1) + bound = IMIN(bound, N/downsample); celt_assert2(C<=2, "denormalise_bands() not implemented for >2 channels"); + if (silence) + { + bound = 0; + start = end = 0; + } c=0; do { celt_sig * OPUS_RESTRICT f; const celt_norm * OPUS_RESTRICT x; @@ -252,7 +262,7 @@ void denormalise_bands(const CELTMode *m, const celt_norm * OPUS_RESTRICT X, } while (++jrng = seed; - denormalise_bands(mode, X, freq, plcLogE, start, effEnd, C, 1<>1)); @@ -921,23 +915,16 @@ int celt_decode_with_ec(CELTDecoder * OPUS_RESTRICT st, const unsigned char *dat { for (i=0;idownsample, silence); + c=0; do { OPUS_MOVE(decode_mem[c], decode_mem[c]+N, DECODE_BUFFER_SIZE-N+overlap/2); } while (++cdownsample!=1) - bound = IMIN(bound, N/st->downsample); - OPUS_CLEAR(&freq[c*N+bound], N-bound); - } while (++crng); } - if (silence) - { - for (i=0;iupsample, silence); c=0; do { OPUS_MOVE(st->syn_mem[c], st->syn_mem[c]+N, 2*MAX_PERIOD-N+overlap/2);