shithub: opus

Download patch

ref: 83c26fbd7b6b513b0e0899c52c16a38bf0c6498f
parent: b1fe4f60e6366bb100515150073d07397047e8a4
author: Jean-Marc Valin <[email protected]>
date: Wed Sep 29 16:05:36 EDT 2010

Fixes a ibudget bust and a divide-by-zero at very low bit-rate

--- a/libcelt/celt.c
+++ b/libcelt/celt.c
@@ -861,6 +861,9 @@
 
    for (i=0;i<st->mode->nbEBands;i++)
       offsets[i] = 0;
+   /* Dynamic allocation code */
+   /* Make sure that dynamic allocation can't make us bust the budget */
+   if (nbCompressedBytes > 30)
    {
       int t1, t2;
       if (LM <= 1)
--- a/libcelt/rate.c
+++ b/libcelt/rate.c
@@ -190,7 +190,7 @@
    }
    codedBands++;
    /* Allocate the remaining bits */
-   {
+   if (codedBands) {
       int left, perband;
       left = (total<<BITRES)-psum;
       perband = left/(codedBands-start);