Fixes uninitialised memory issues
authorJean-Marc Valin <jean-marc.valin@octasic.com>
Wed, 2 Feb 2011 23:16:06 +0000 (18:16 -0500)
committerJean-Marc Valin <jean-marc.valin@octasic.com>
Wed, 2 Feb 2011 23:16:06 +0000 (18:16 -0500)
src_FIX/SKP_Silk_find_pitch_lags_FIX.c
src_FLP/SKP_Silk_find_pitch_lags_FLP.c
src_FLP/SKP_Silk_wrappers_FLP.c

index ad78d55..12f62a0 100644 (file)
@@ -128,5 +128,10 @@ void SKP_Silk_find_pitch_lags_FIX(
         } else {\r
             psEncCtrl->sCmn.signalType = TYPE_UNVOICED;\r
         }\r
+    } else {\r
+        SKP_memset( psEncCtrl->sCmn.pitchL, 0, sizeof( psEncCtrl->sCmn.pitchL ) );\r
+        psEncCtrl->sCmn.lagIndex = 0;\r
+        psEncCtrl->sCmn.contourIndex = 0;\r
+        psEnc->LTPCorr_Q15 = 0;\r
     }\r
 }\r
index 5ab8ef6..01e8348 100644 (file)
@@ -120,5 +120,10 @@ void SKP_Silk_find_pitch_lags_FLP(
         } else {\r
             psEncCtrl->sCmn.signalType = TYPE_UNVOICED;\r
         }\r
+    } else {\r
+        SKP_memset( psEncCtrl->sCmn.pitchL, 0, sizeof( psEncCtrl->sCmn.pitchL ) );\r
+        psEncCtrl->sCmn.lagIndex = 0;\r
+        psEncCtrl->sCmn.contourIndex = 0;\r
+        psEnc->LTPCorr = 0;\r
     }\r
 }\r
index c87c20b..449424e 100644 (file)
@@ -163,7 +163,6 @@ void SKP_Silk_NSQ_wrapper_FLP(
     SKP_int     i, j;\r
     SKP_float   tmp_float;\r
     SKP_int16   x_16[ MAX_FRAME_LENGTH ];\r
-    /* Prediction and coding parameters */\r
     SKP_int32   Gains_Q16[ MAX_NB_SUBFR ];\r
     SKP_DWORD_ALIGN SKP_int16 PredCoef_Q12[ 2 ][ MAX_LPC_ORDER ];\r
     SKP_int16   LTPCoef_Q14[ LTP_ORDER * MAX_NB_SUBFR ];\r
@@ -179,8 +178,10 @@ void SKP_Silk_NSQ_wrapper_FLP(
 \r
     /* Convert control struct to fix control struct */\r
     /* Noise shape parameters */\r
-    for( i = 0; i < MAX_NB_SUBFR * MAX_SHAPE_LPC_ORDER; i++ ) {\r
-        AR2_Q13[ i ] = SKP_float2int( psEncCtrl->AR2[ i ] * 8192.0f );\r
+    for( i = 0; i < MAX_NB_SUBFR; i++ ) {\r
+        for( j = 0; j < psEnc->sCmn.shapingLPCOrder; j++ ) {\r
+            AR2_Q13[ i * MAX_SHAPE_LPC_ORDER + j ] = SKP_float2int( psEncCtrl->AR2[ i * MAX_SHAPE_LPC_ORDER + j ] * 8192.0f );\r
+        }\r
     }\r
 \r
     for( i = 0; i < MAX_NB_SUBFR; i++ ) {\r