Fixes two encoder bugs causing glitches in stereo->mono switches
[opus.git] / silk / PLC.c
index 43894c2..50e0dda 100644 (file)
@@ -37,6 +37,18 @@ static const opus_int16 HARM_ATT_Q15[NB_ATT]              = { 32440, 31130 }; /*
 static const opus_int16 PLC_RAND_ATTENUATE_V_Q15[NB_ATT]  = { 31130, 26214 }; /* 0.95, 0.8 */
 static const opus_int16 PLC_RAND_ATTENUATE_UV_Q15[NB_ATT] = { 32440, 29491 }; /* 0.99, 0.9 */
 
+static inline void silk_PLC_update(
+    silk_decoder_state      *psDec,             /* I/O Decoder state        */
+    silk_decoder_control    *psDecCtrl          /* I/O Decoder control      */
+);
+
+static inline void silk_PLC_conceal(
+    silk_decoder_state      *psDec,             /* I/O Decoder state        */
+    silk_decoder_control    *psDecCtrl,         /* I/O Decoder control      */
+    opus_int16                signal[]          /* O LPC residual signal    */
+);
+
+
 void silk_PLC_Reset(
     silk_decoder_state      *psDec              /* I/O Decoder state        */
 )
@@ -48,7 +60,6 @@ void silk_PLC(
     silk_decoder_state          *psDec,             /* I Decoder state          */
     silk_decoder_control        *psDecCtrl,         /* I Decoder control        */
     opus_int16                   frame[],            /* O Concealed signal       */
-    opus_int                     length,             /* I length of residual     */
     opus_int                     lost                /* I Loss flag              */
 )
 {
@@ -62,25 +73,23 @@ void silk_PLC(
         /****************************/
         /* Generate Signal          */
         /****************************/
-        silk_PLC_conceal( psDec, psDecCtrl, frame, length );
+        silk_PLC_conceal( psDec, psDecCtrl, frame );
 
         psDec->lossCnt++;
     } else {
         /****************************/
         /* Update state             */
         /****************************/
-        silk_PLC_update( psDec, psDecCtrl, frame, length );
+        silk_PLC_update( psDec, psDecCtrl );
     }
 }
 
 /**************************************************/
 /* Update state of PLC                            */
 /**************************************************/
-void silk_PLC_update(
+static inline void silk_PLC_update(
     silk_decoder_state          *psDec,             /* (I/O) Decoder state          */
-    silk_decoder_control        *psDecCtrl,         /* (I/O) Decoder control        */
-    opus_int16                   frame[],
-    opus_int                     length
+    silk_decoder_control        *psDecCtrl          /* (I/O) Decoder control        */
 )
 {
     opus_int32 LTP_Gain_Q14, temp_LTP_Gain_Q14;
@@ -150,11 +159,10 @@ void silk_PLC_update(
     silk_memcpy( psPLC->prevGain_Q16, psDecCtrl->Gains_Q16, psDec->nb_subfr * sizeof( opus_int32 ) );
 }
 
-void silk_PLC_conceal(
+static inline void silk_PLC_conceal(
     silk_decoder_state          *psDec,             /* I/O Decoder state */
     silk_decoder_control        *psDecCtrl,         /* I/O Decoder control */
-    opus_int16                   frame[],            /* O concealed signal */
-    opus_int                     length              /* I length of residual */
+    opus_int16                   frame[]            /* O concealed signal */
 )
 {
     opus_int   i, j, k;
@@ -337,7 +345,6 @@ void silk_PLC_conceal(
 /* Glues concealed frames with new good recieved frames             */
 void silk_PLC_glue_frames(
     silk_decoder_state          *psDec,             /* I/O decoder state    */
-    silk_decoder_control        *psDecCtrl,         /* I/O Decoder control  */
     opus_int16                   frame[],            /* I/O signal           */
     opus_int                     length              /* I length of residual */
 )