Fixes an overflow in silk_log2lin() that was triggered only in debug mode
authorJean-Marc Valin <jmvalin@jmvalin.ca>
Mon, 27 Aug 2012 04:16:38 +0000 (00:16 -0400)
committerJean-Marc Valin <jmvalin@jmvalin.ca>
Mon, 27 Aug 2012 04:18:01 +0000 (00:18 -0400)
silk/log2lin.c

index b0026e6..33a19ad 100644 (file)
@@ -47,7 +47,7 @@ opus_int32 silk_log2lin(
     frac_Q7 = inLog_Q7 & 0x7F;
     if( inLog_Q7 < 2048 ) {
         /* Piece-wise parabolic approximation */
-        out = silk_ADD_RSHIFT( out, silk_MUL( out, silk_SMLAWB( frac_Q7, silk_SMULBB( frac_Q7, 128 - frac_Q7 ), -174 ) ), 7 );
+        out = silk_ADD_RSHIFT32( out, silk_MUL( out, silk_SMLAWB( frac_Q7, silk_SMULBB( frac_Q7, 128 - frac_Q7 ), -174 ) ), 7 );
     } else {
         /* Piece-wise parabolic approximation */
         out = silk_MLA( out, silk_RSHIFT( out, 7 ), silk_SMLAWB( frac_Q7, silk_SMULBB( frac_Q7, 128 - frac_Q7 ), -174 ) );