ref: 5677e34fdeca736f5894f01f0099629e823e8608
parent: f0d828fc141432ccaff9fcb6fd2c4e648cbe7963
author: Jean-Marc Valin <[email protected]>
date: Thu Jan 13 11:15:53 EST 2011
Setting oldBandE to zero outside of [start,end[ In case start or end changes, we want the encoder and decoder to be in sync and not do anything stupid.
--- a/libcelt/celt.c
+++ b/libcelt/celt.c
@@ -1326,6 +1326,12 @@
st->prefilter_period = pitch_index;
st->prefilter_gain = gain1;
+ /* In case start or end were to change */
+ for (i=0;i<st->start;i++)
+ oldBandE[i]=0;
+ for (i=st->end;i<st->mode->nbEBands;i++)
+ oldBandE[i]=0;
+
/* If there's any room left (can only happen for very high rates),
fill it with zeros */
while (ec_enc_tell(enc,0) + 8 <= nbCompressedBytes*8)
@@ -2048,6 +2054,12 @@
st->postfilter_period = postfilter_pitch;
st->postfilter_gain = postfilter_gain;
#endif /* ENABLE_POSTFILTER */
+
+ /* In case start or end were to change */
+ for (i=0;i<st->start;i++)
+ oldBandE[i]=0;
+ for (i=st->end;i<st->mode->nbEBands;i++)
+ oldBandE[i]=0;
deemphasis(out_syn, pcm, N, C, st->mode->preemph, st->preemph_memD);
st->loss_count = 0;