shithub: opus

Download patch

ref: 34952f3e45888a5af2dcb9718891703095c9b3ac
parent: f61be66f425aa3a10b2e8516137b7078c8211600
author: Gregory Maxwell <[email protected]>
date: Tue Sep 23 14:25:07 EDT 2008

Add an additional 1/16th bit of padding to avoid budget busting on some inputs.

--- a/libcelt/bands.c
+++ b/libcelt/bands.c
@@ -361,7 +361,7 @@
       tell = ec_enc_tell(enc, 4);
       if (i != 0)
          balance -= tell;
-      remaining_bits = (total_bits<<BITRES)-tell-1;
+      remaining_bits = (total_bits<<BITRES)-tell-2;
       curr_balance = (m->nbEBands-i);
       if (curr_balance > 3)
          curr_balance = 3;
@@ -440,7 +440,7 @@
       tell = ec_dec_tell(dec, 4);
       if (i != 0)
          balance -= tell;
-      remaining_bits = (total_bits<<BITRES)-tell-1;
+      remaining_bits = (total_bits<<BITRES)-tell-2;
       curr_balance = (m->nbEBands-i);
       if (curr_balance > 3)
          curr_balance = 3;