More headroom in PLC code
authorJean-Marc Valin <jmvalin@jmvalin.ca>
Sun, 24 Jul 2016 21:48:40 +0000 (17:48 -0400)
committerJean-Marc Valin <jmvalin@jmvalin.ca>
Mon, 25 Jul 2016 01:35:24 +0000 (21:35 -0400)
extrapolation_len can be up to 960+120, so we we need a shift of 10
if the values are very large.

celt/celt_decoder.c

index 0d9364d..8a3b348 100644 (file)
@@ -636,7 +636,7 @@ static void celt_decode_lost(CELTDecoder * OPUS_RESTRICT st, int N, int LM)
             tmp = ROUND16(
                   buf[DECODE_BUFFER_SIZE-MAX_PERIOD-N+extrapolation_offset+j],
                   SIG_SHIFT);
-            S1 += SHR32(MULT16_16(tmp, tmp), 9);
+            S1 += SHR32(MULT16_16(tmp, tmp), 10);
          }
 #ifdef FIXED_POINT
          /* For fixed-point, apply bandwidth expansion until we can guarantee that
@@ -680,7 +680,7 @@ static void celt_decode_lost(CELTDecoder * OPUS_RESTRICT st, int N, int LM)
             for (i=0;i<extrapolation_len;i++)
             {
                opus_val16 tmp = ROUND16(buf[DECODE_BUFFER_SIZE-N+i], SIG_SHIFT);
-               S2 += SHR32(MULT16_16(tmp, tmp), 9);
+               S2 += SHR32(MULT16_16(tmp, tmp), 10);
             }
             /* This checks for an "explosion" in the synthesis. */
 #ifdef FIXED_POINT