shithub: opus

Download patch

ref: 9826ed99c36504ad466feeadacf5e2ced1518c4a
parent: 9f90e57a9b785682bc52e3cacf0d9f85637ea5d1
author: Jean-Marc Valin <[email protected]>
date: Tue Sep 27 13:12:23 EDT 2011

Fixes a glitch on SILK frame size switching

We no longer reset the decoder predictors when switching only the
frame size and not the sampling rate. The encoder already doesn't reset.

--- a/silk/decoder_set_fs.c
+++ b/silk/decoder_set_fs.c
@@ -69,15 +69,18 @@
             psDec->psNLSF_CB = &silk_NLSF_CB_WB;
         }
 
-        /* Reset part of the decoder state */
-        silk_memset( psDec->sLPC_Q14,     0,                    sizeof( psDec->sLPC_Q14 ) );
-        silk_memset( psDec->outBuf,       0, MAX_FRAME_LENGTH * sizeof( opus_int16 ) );
-        silk_memset( psDec->prevNLSF_Q15, 0,                    sizeof( psDec->prevNLSF_Q15 ) );
-
+        if( psDec->fs_kHz != fs_kHz)
+        {
+           /* Reset part of the decoder state */
+           silk_memset( psDec->sLPC_Q14,     0,                    sizeof( psDec->sLPC_Q14 ) );
+           silk_memset( psDec->outBuf,       0, MAX_FRAME_LENGTH * sizeof( opus_int16 ) );
+           silk_memset( psDec->prevNLSF_Q15, 0,                    sizeof( psDec->prevNLSF_Q15 ) );
+        }
         psDec->lagPrev                 = 100;
         psDec->LastGainIndex           = 10;
         psDec->prevSignalType          = TYPE_NO_VOICE_ACTIVITY;
-        psDec->first_frame_after_reset = 1;
+        if( psDec->fs_kHz != fs_kHz)
+           psDec->first_frame_after_reset = 1;
 
         if( fs_kHz == 16 ) {
             psDec->pitch_lag_low_bits_iCDF = silk_uniform8_iCDF;