Minor bugfix
authorKoen Vos <koen.vos@skype.net>
Thu, 3 Feb 2011 14:08:25 +0000 (09:08 -0500)
committerJean-Marc Valin <jean-marc.valin@usherbrooke.ca>
Thu, 3 Feb 2011 14:08:25 +0000 (09:08 -0500)
src_common/SKP_Silk_create_init_destroy.c
src_common/SKP_Silk_decoder_set_fs.c

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