Correct encoder/decoder state mismatch and spurious state resetting in the encoder...
authorGregory Maxwell <greg@xiph.org>
Wed, 19 Oct 2011 04:20:46 +0000 (00:20 -0400)
committerGregory Maxwell <greg@xiph.org>
Wed, 19 Oct 2011 04:20:46 +0000 (00:20 -0400)
Patch from Tim which corrects a glitch during mode switching tests.

silk/dec_API.c
silk/enc_API.c

index d979e5b..a551077 100644 (file)
@@ -233,6 +233,7 @@ opus_int silk_Decode(
         psDec->channel_state[ 1 ].lagPrev        = 100;
         psDec->channel_state[ 1 ].LastGainIndex  = 10;
         psDec->channel_state[ 1 ].prevSignalType = TYPE_NO_VOICE_ACTIVITY;
+        psDec->channel_state[ 1 ].first_frame_after_reset = 1;
     }
 
     /* Call decoder for one frame */
index 1984a6d..fb4b717 100644 (file)
@@ -393,12 +393,12 @@ opus_int silk_Encode(
                         silk_memset( &psEnc->state_Fxx[ 1 ].sCmn.sNSQ,            0, sizeof( psEnc->state_Fxx[ 1 ].sCmn.sNSQ ) );
                         silk_memset( psEnc->state_Fxx[ 1 ].sCmn.prev_NLSFq_Q15,   0, sizeof( psEnc->state_Fxx[ 1 ].sCmn.prev_NLSFq_Q15 ) );
                         silk_memset( &psEnc->state_Fxx[ 1 ].sCmn.sLP.In_LP_State, 0, sizeof( psEnc->state_Fxx[ 1 ].sCmn.sLP.In_LP_State ) );
-                        silk_memset( &psEnc->state_Fxx[ 1 ].sCmn.inputBuf,        0, sizeof( psEnc->state_Fxx[ 1 ].sCmn.inputBuf ) );
                         psEnc->state_Fxx[ 1 ].sCmn.prevLag                = 100;
                         psEnc->state_Fxx[ 1 ].sCmn.sNSQ.lagPrev           = 100;
                         psEnc->state_Fxx[ 1 ].sShape.LastGainIndex        = 10;
                         psEnc->state_Fxx[ 1 ].sCmn.prevSignalType         = TYPE_NO_VOICE_ACTIVITY;
                         psEnc->state_Fxx[ 1 ].sCmn.sNSQ.prev_inv_gain_Q16 = 65536;
+                        psEnc->state_Fxx[ 1 ].sCmn.first_frame_after_reset = 1;
                     }
                     silk_encode_do_VAD_Fxx( &psEnc->state_Fxx[ 1 ] );
                 } else {