shithub: opus

Download patch

ref: 51891c9d5c877e617de113abb627e1bb6b3258ee
parent: 679083f449d48d6f3e9595c786514abb240a71c9
author: Jean-Marc Valin <[email protected]>
date: Tue Jun 10 16:57:52 EDT 2008

fixed a cwrs bug in fits_in32()

--- a/libcelt/cwrs.c
+++ b/libcelt/cwrs.c
@@ -101,11 +101,11 @@
 int fits_in32(int _n, int _m)
 {
    static const celt_int16_t maxN[15] = {
-      255, 255, 255, 255, 255, 238,  95,  53,
-       36,  27,  22,  18,  16,  15,  13};
-   static const celt_int16_t maxM[28] = {
       255, 255, 255, 255, 255, 109,  60,  40,
        29,  24,  20,  18,  16,  14,  13};
+   static const celt_int16_t maxM[15] = {
+      255, 255, 255, 255, 255, 238,  95,  53,
+       36,  27,  22,  18,  16,  15,  13};
    if (_n>=14)
    {
       if (_m>=14)
@@ -525,7 +525,13 @@
      decode_pulses(_y, split+1, (K+1)/2, dec);
      count = _y[split];
      if (K/2 != 0)
-       decode_pulses(_y+split, N-split, K/2, dec);
+     {
+        decode_pulses(_y+split, N-split, K/2, dec);
+     } else {
+       int i;
+       for (i=0;i<N-split;i++)
+          _y[split+i] = 0;
+     }
      _y[split] += count;
    }
    RESTORE_STACK;