ref: 13a7c26654c58cff2aac554921c5e832e549325d
parent: c39bb8ab8c4ba99bf18b00b957807b60333dcddc
author: Jean-Marc Valin <[email protected]>
date: Wed Jan 26 05:58:33 EST 2011
Removes explicit filling of remaining bits with zeros The initialiser already takes care of this
--- a/libcelt/celt.c
+++ b/libcelt/celt.c
@@ -927,9 +927,10 @@
ec_enc_bit_logp(enc, silence, 15);
if (silence)
{
- while (ec_enc_tell(enc,0) < nbCompressedBytes*8)
- ec_enc_bits(enc, 0, 1);
+ /* Pretend we've filled all the remaining bits with zeros
+ (that's what the initialiser did anyway) */
tell = nbCompressedBytes*8;
+ enc->nbits_total+=tell-ec_enc_tell(enc,0);
}
#ifdef ENABLE_POSTFILTER
if (nbAvailableBytes>12*C && st->start==0 && !silence)
@@ -1415,9 +1416,7 @@
st->rng = enc->rng;
/* If there's any room left (can only happen for very high rates),
- fill it with zeros */
- while (ec_enc_tell(enc,0) < nbCompressedBytes*8)
- ec_enc_bits(enc, 0, 1);
+ it's already filled with zeros */
ec_enc_done(enc);
RESTORE_STACK;
@@ -2035,9 +2034,9 @@
silence = ec_dec_bit_logp(dec, 15);
if (silence)
{
- while (ec_dec_tell(dec,0) < len*8)
- ec_dec_bits(dec, 1);
+ /* Pretend we've read all the remaining bits */
tell = len*8;
+ dec->nbits_total+=tell-ec_dec_tell(dec,0);
}
postfilter_gain = 0;