ref: 30d5125bfff6fea904c0f046ce9b563c495e8e7c
parent: bb4f63f4a077814ab79b66b47fdad5944463248c
author: Jean-Marc Valin <[email protected]>
date: Mon Jun 21 13:55:28 EDT 2010
No need to memset() the byte buffer
--- a/libcelt/celt.c
+++ b/libcelt/celt.c
@@ -734,9 +734,6 @@
if (LM>=MAX_CONFIG_SIZES)
return CELT_BAD_ARG;
M=1<<LM;
- /* The memset is important for now in case the encoder doesn't
- fill up all the bytes */
- CELT_MEMSET(compressed, 0, nbCompressedBytes);
if (enc==NULL)
{
@@ -1056,6 +1053,10 @@
}
}
+ /* If there's any room left (can only happen for very high rates),
+ fill it with zeros */
+ while (nbCompressedBytes*8 - ec_enc_tell(enc,0) >= 8)
+ ec_enc_bits(enc, 0, 8);
ec_enc_done(enc);
RESTORE_STACK;
@@ -1752,7 +1753,7 @@
quant_all_bands(0, st->mode, st->start, X, C==2 ? X+N : NULL, NULL, pulses, shortBlocks, has_fold, tf_res, 1, len*8, dec, LM);
unquant_energy_finalise(st->mode, st->start, bandE, st->oldBandE, fine_quant, fine_priority, len*8-ec_dec_tell(dec, 0), dec, C);
-
+
if (mdct_weight_shift)
{
mdct_shape(st->mode, X, 0, mdct_weight_pos+1, N, mdct_weight_shift, C, 1, M);
--- a/libcelt/entenc.c
+++ b/libcelt/entenc.c
@@ -38,8 +38,6 @@
#include "arch.h"
-#define EC_BUFFER_INCREMENT (256)
-
void ec_byte_writeinit_buffer(ec_byte_buffer *_b, unsigned char *_buf, long _size){
_b->ptr=_b->buf=_buf;
_b->end_ptr=_b->buf+_size-1;