fixes a mixup between decoder and PLC states
authorKoen Vos <koen.vos@skype.net>
Sat, 29 Oct 2011 04:24:46 +0000 (00:24 -0400)
committerJean-Marc Valin <jmvalin@jmvalin.ca>
Sat, 29 Oct 2011 04:24:46 +0000 (00:24 -0400)
silk/PLC.c
silk/PLC.h

index 3821631..a30f23b 100644 (file)
@@ -56,6 +56,8 @@ void silk_PLC_Reset(
     psDec->sPLC.pitchL_Q8 = silk_LSHIFT( psDec->frame_length, 8 - 1 );
     psDec->sPLC.prevGain_Q16[ 0 ] = SILK_FIX_CONST( 1, 16 );
     psDec->sPLC.prevGain_Q16[ 1 ] = SILK_FIX_CONST( 1, 16 );
+    psDec->sPLC.subfr_length = 20;
+    psDec->sPLC.nb_subfr = 2;
 }
 
 void silk_PLC(
@@ -123,10 +125,8 @@ static inline void silk_PLC_update(
             }
         }
 
-#if USE_SINGLE_TAP
         silk_memset( psPLC->LTPCoef_Q14, 0, LTP_ORDER * sizeof( opus_int16 ) );
         psPLC->LTPCoef_Q14[ LTP_ORDER / 2 ] = LTP_Gain_Q14;
-#endif
 
         /* Limit LT coefs */
         if( LTP_Gain_Q14 < V_PITCH_GAIN_START_MIN_Q14 ) {
@@ -196,7 +196,7 @@ static inline void silk_PLC_conceal(
     }
     /* Find the subframe with lowest energy of the last two and use that as random noise generator */
     silk_sum_sqr_shift( &energy1, &shift1, exc_buf,                         psPLC->subfr_length );
-    silk_sum_sqr_shift( &energy2, &shift2, &exc_buf[ psDec->subfr_length ], psPLC->subfr_length );
+    silk_sum_sqr_shift( &energy2, &shift2, &exc_buf[ psPLC->subfr_length ], psPLC->subfr_length );
 
     if( silk_RSHIFT( energy1, shift2 ) < silk_RSHIFT( energy2, shift1 ) ) {
         /* First sub-frame has lowest energy */
index c1f1e7e..5be504f 100644 (file)
@@ -35,7 +35,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #define V_PITCH_GAIN_START_MAX_Q14      15565               /* 0.95 in Q14              */
 #define MAX_PITCH_LAG_MS                18
 #define SA_THRES_Q8                     50
-#define USE_SINGLE_TAP                  1
 #define RAND_BUF_SIZE                   128
 #define RAND_BUF_MASK                   ( RAND_BUF_SIZE - 1 )
 #define LOG2_INV_LPC_GAIN_HIGH_THRES    3                   /* 2^3 = 8 dB LPC gain      */