diff options
author | Jean-Marc Valin <Jean-Marc.Valin@csiro.au> | 2008-02-08 03:50:17 +0300 |
---|---|---|
committer | Jean-Marc Valin <Jean-Marc.Valin@csiro.au> | 2008-02-08 03:50:17 +0300 |
commit | b3756709ad18f2da42a7cbc97daca012256eb542 (patch) | |
tree | 17885254876f8b623fc9c8c4066871d00a51d542 /libcelt/celt.c | |
parent | e6586d21fad18d4cd4b72c8ff0f870db8ccbcbe6 (diff) |
Fixed incorrect assumption about the number of bytes returned by the
entropy coder. All testcases pass again.
Diffstat (limited to 'libcelt/celt.c')
-rw-r--r-- | libcelt/celt.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/libcelt/celt.c b/libcelt/celt.c index 804782e..bf81354 100644 --- a/libcelt/celt.c +++ b/libcelt/celt.c @@ -343,19 +343,17 @@ int celt_encode(CELTEncoder *st, celt_int16_t *pcm, unsigned char *compressed, i { unsigned char *data; int nbBytes = ec_byte_bytes(&st->buf); - if (nbBytes != nbCompressedBytes) + if (nbBytes > nbCompressedBytes) { - if (nbBytes > nbCompressedBytes) - celt_warning("got too many bytes"); - else - celt_warning("not enough bytes"); - celt_warning_int ("output bytes:", nbBytes); + celt_warning_int ("got too many bytes:", nbBytes); return CELT_INTERNAL_ERROR; } //printf ("%d\n", *nbBytes); data = ec_byte_get_buffer(&st->buf); for (i=0;i<nbBytes;i++) compressed[i] = data[i]; + for (;i<nbCompressedBytes;i++) + compressed[i] = 0; } /* Reset the packing for the next encoding */ ec_byte_reset(&st->buf); |