Update SILK code using the CELT range coder
[opus.git] / src_FIX / SKP_Silk_process_gains_FIX.c
similarity index 92%
rename from src/SKP_Silk_process_gains_FIX.c
rename to src_FIX/SKP_Silk_process_gains_FIX.c
index e6400aa..272fd29 100644 (file)
@@ -41,7 +41,7 @@ void SKP_Silk_process_gains_FIX(
     if( psEncCtrl->sCmn.sigtype == SIG_TYPE_VOICED ) {\r
         /*s = -0.5f * SKP_sigmoid( 0.25f * ( psEncCtrl->LTPredCodGain - 12.0f ) ); */\r
         s_Q16 = -SKP_Silk_sigm_Q15( SKP_RSHIFT_ROUND( psEncCtrl->LTPredCodGain_Q7 - (12 << 7), 4 ) );\r
-        for( k = 0; k < NB_SUBFR; k++ ) {\r
+        for( k = 0; k < psEnc->sCmn.nb_subfr; k++ ) {\r
             psEncCtrl->Gains_Q16[ k ] = SKP_SMLAWB( psEncCtrl->Gains_Q16[ k ], psEncCtrl->Gains_Q16[ k ], s_Q16 );\r
         }\r
     }\r
@@ -51,7 +51,7 @@ void SKP_Silk_process_gains_FIX(
     InvMaxSqrVal_Q16 = SKP_DIV32_16( SKP_Silk_log2lin( \r
         SKP_SMULWB( (69 << 7) - psEncCtrl->current_SNR_dB_Q7, SKP_FIX_CONST( 0.33, 16 )) ), psEnc->sCmn.subfr_length );\r
 \r
-    for( k = 0; k < NB_SUBFR; k++ ) {\r
+    for( k = 0; k < psEnc->sCmn.nb_subfr; k++ ) {\r
         /* Soft limit on ratio residual energy and squared gains */\r
         ResNrg     = psEncCtrl->ResNrg[ k ];\r
         ResNrgPart = SKP_SMULWW( ResNrg, InvMaxSqrVal_Q16 );\r
@@ -84,7 +84,7 @@ void SKP_Silk_process_gains_FIX(
 \r
     /* Noise shaping quantization */\r
     SKP_Silk_gains_quant( psEncCtrl->sCmn.GainsIndices, psEncCtrl->Gains_Q16, \r
-        &psShapeSt->LastGainIndex, psEnc->sCmn.nFramesInPayloadBuf );\r
+        &psShapeSt->LastGainIndex, psEnc->sCmn.nFramesInPayloadBuf, psEnc->sCmn.nb_subfr );\r
     /* Set quantizer offset for voiced signals. Larger offset when LTP coding gain is low or tilt is high (ie low-pass) */\r
     if( psEncCtrl->sCmn.sigtype == SIG_TYPE_VOICED ) {\r
         if( psEncCtrl->LTPredCodGain_Q7 + SKP_RSHIFT( psEncCtrl->input_tilt_Q15, 8 ) > ( 1 << 7 ) ) {\r
@@ -96,19 +96,18 @@ void SKP_Silk_process_gains_FIX(
 \r
     /* Quantizer boundary adjustment */\r
     if( psEncCtrl->sCmn.sigtype == SIG_TYPE_VOICED ) {\r
-        psEncCtrl->Lambda_Q10 = SKP_FIX_CONST( 1.3, 10 )\r
-                  - SKP_SMULWB( SKP_FIX_CONST( 0.5, 18 ), psEnc->speech_activity_Q8       )\r
+        psEncCtrl->Lambda_Q10 = SKP_FIX_CONST( 1.2, 10 )\r
+                  - SKP_SMULWB( SKP_FIX_CONST( 0.4, 18 ), psEnc->speech_activity_Q8       )\r
                   - SKP_SMULWB( SKP_FIX_CONST( 0.3, 12 ), psEncCtrl->input_quality_Q14    )\r
                   + SKP_SMULBB( SKP_FIX_CONST( 0.2, 10 ), psEncCtrl->sCmn.QuantOffsetType )\r
                   - SKP_SMULWB( SKP_FIX_CONST( 0.1, 12 ), psEncCtrl->coding_quality_Q14   );\r
     } else {\r
-        psEncCtrl->Lambda_Q10 = SKP_FIX_CONST( 1.3, 10 )\r
-                  - SKP_SMULWB( SKP_FIX_CONST( 0.5, 18 ), psEnc->speech_activity_Q8       )\r
+        psEncCtrl->Lambda_Q10 = SKP_FIX_CONST( 1.2, 10 )\r
+                  - SKP_SMULWB( SKP_FIX_CONST( 0.4, 18 ), psEnc->speech_activity_Q8       )\r
                   - SKP_SMULWB( SKP_FIX_CONST( 0.4, 12 ), psEncCtrl->input_quality_Q14    )\r
                   + SKP_SMULBB( SKP_FIX_CONST( 0.4, 10 ), psEncCtrl->sCmn.QuantOffsetType )\r
                   - SKP_SMULWB( SKP_FIX_CONST( 0.1, 12 ), psEncCtrl->coding_quality_Q14   );\r
     }\r
     SKP_assert( psEncCtrl->Lambda_Q10 >= 0 );\r
     SKP_assert( psEncCtrl->Lambda_Q10 < SKP_FIX_CONST( 2, 10 ) );\r
-    \r
 }\r