shithub: opus

Download patch

ref: 52de536fed9288b6ecd7d9f2672c07b1c78ea3d2
parent: 9a0568869600a2e00589ce19f0d5c4bd85b633a4
author: Gregory Maxwell <[email protected]>
date: Tue Oct 18 20:20:46 EDT 2011

Correct encoder/decoder state mismatch and spurious state resetting in the encoder when side is reset.

Patch from Tim which corrects a glitch during mode switching tests.

--- a/silk/dec_API.c
+++ b/silk/dec_API.c
@@ -233,6 +233,7 @@
         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 */
--- a/silk/enc_API.c
+++ b/silk/enc_API.c
@@ -393,12 +393,12 @@
                         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 {