shithub: opus

Download patch

ref: a81e6dc2bc337c25156e6e908e45cbf7a5e0f104
parent: e61e6a752e62354ef0ce2684c54d379130ff897b
author: Koen Vos <[email protected]>
date: Thu Feb 3 04:08:25 EST 2011

Minor bugfix

--- a/src_common/SKP_Silk_create_init_destroy.c
+++ b/src_common/SKP_Silk_create_init_destroy.c
@@ -38,10 +38,6 @@
     /* Clear the entire encoder state, except anything copied */
     SKP_memset( psDec, 0, sizeof( SKP_Silk_decoder_state ) );
 
-    /* Set sampling rate to 16 kHz, and init non-zero values */
-    psDec->nb_subfr = MAX_NB_SUBFR;
-    SKP_Silk_decoder_set_fs( psDec, 16 );
-
     /* Used to deactivate e.g. LSF interpolation and fluctuation reduction */
     psDec->first_frame_after_reset = 1;
     psDec->prev_inv_gain_Q16 = 65536;
--- a/src_common/SKP_Silk_decoder_set_fs.c
+++ b/src_common/SKP_Silk_decoder_set_fs.c
@@ -33,11 +33,13 @@
     SKP_int                         fs_kHz              /* I    Sampling frequency (kHz)                    */
 )
 {
-    psDec->frame_length = SKP_SMULBB( psDec->nb_subfr, psDec->subfr_length );
-    if( psDec->fs_kHz != fs_kHz ) {
+    SKP_int frame_length;
+    
+    psDec->subfr_length = SKP_SMULBB( SUB_FRAME_LENGTH_MS, fs_kHz );
+    frame_length = SKP_SMULBB( psDec->nb_subfr, psDec->subfr_length );
+    if( psDec->fs_kHz != fs_kHz || frame_length != psDec->frame_length ) {
         psDec->fs_kHz  = fs_kHz;
-        psDec->subfr_length   = SKP_SMULBB( SUB_FRAME_LENGTH_MS, fs_kHz );
-        psDec->frame_length   = SKP_SMULBB( psDec->nb_subfr, psDec->subfr_length );
+        psDec->frame_length   = frame_length;
         psDec->ltp_mem_length = SKP_SMULBB( LTP_MEM_LENGTH_MS, fs_kHz );
         if( psDec->fs_kHz == 8 ) {
             psDec->LPC_order = MIN_LPC_ORDER;