shithub: opus

Download patch

ref: fd152f55f55a384213f35c95e592f2b25509dd44
parent: 1ee6b48c60a2ce31bfbf35573fe77d97c3e55b00
author: Koen Vos <[email protected]>
date: Fri Oct 28 20:24:46 EDT 2011

fixes a mixup between decoder and PLC states

--- a/silk/PLC.c
+++ b/silk/PLC.c
@@ -56,6 +56,8 @@
     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 @@
             }
         }
 
-#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 @@
     }
     /* 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 */
--- a/silk/PLC.h
+++ b/silk/PLC.h
@@ -35,7 +35,6 @@
 #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      */