shithub: opus

Download patch

ref: e99896ebe5eaf57d2590fa2d6b653b4ee94d4b81
parent: da301009df97b0a6f643e87cd6aa8f49c983f7e0
author: Koen Vos <[email protected]>
date: Wed Feb 2 05:01:59 EST 2011

SILK update

--- a/Makefile.am
+++ b/Makefile.am
@@ -30,18 +30,17 @@
 src_common/SKP_Silk_create_init_destroy.c \
 src_common/SKP_Silk_decode_core.c \
 src_common/SKP_Silk_decode_frame.c \
-src_common/SKP_Silk_decode_indices.c \
 src_common/SKP_Silk_decode_parameters.c \
+src_common/SKP_Silk_decode_indices.c \
 src_common/SKP_Silk_decode_pulses.c \
 src_common/SKP_Silk_decoder_set_fs.c \
 src_common/SKP_Silk_dec_API.c \
 src_common/SKP_Silk_detect_SWB_input.c \
 src_common/SKP_Silk_enc_API.c \
-src_common/SKP_Silk_encode_parameters.c \
+src_common/SKP_Silk_encode_indices.c \
 src_common/SKP_Silk_encode_pulses.c \
 src_common/SKP_Silk_gain_quant.c \
 src_common/SKP_Silk_interpolate.c \
-src_common/SKP_Silk_LBRR_reset.c \
 src_common/SKP_Silk_LP_variable_cutoff.c \
 src_common/SKP_Silk_NLSF2A_stable.c \
 src_common/SKP_Silk_NLSF_MSVQ_decode.c \
@@ -49,7 +48,6 @@
 src_common/SKP_Silk_NSQ_del_dec.c \
 src_common/SKP_Silk_PLC.c \
 src_common/SKP_Silk_pulses_to_bytes.c \
-src_common/SKP_Silk_range_coder.c \
 src_common/SKP_Silk_shell_coder.c \
 src_common/SKP_Silk_tables_gain.c \
 src_common/SKP_Silk_tables_LTP.c \
@@ -60,7 +58,6 @@
 src_common/SKP_Silk_tables_other.c \
 src_common/SKP_Silk_tables_pitch_lag.c \
 src_common/SKP_Silk_tables_pulses_per_block.c \
-src_common/SKP_Silk_tables_sign.c \
 src_common/SKP_Silk_VAD.c \
 src_common/SKP_Silk_control_audio_bandwidth.c \
 src_common/SKP_Silk_quant_LTP_gains.c \
--- a/interface/SKP_Silk_SDK_API.h
+++ b/interface/SKP_Silk_SDK_API.h
@@ -39,16 +39,15 @@
 {
 #endif
 
-#define SILK_MAX_FRAMES_PER_PACKET  5
+#define SILK_MAX_FRAMES_PER_PACKET  3
 
 /* Struct for TOC (Table of Contents) */
 typedef struct {
-    SKP_int     framesInPacket;                             /* Number of 20 ms frames in packet     */
-    SKP_int     fs_kHz;                                     /* Sampling frequency in packet         */
-    SKP_int     inbandLBRR;                                 /* Does packet contain LBRR information */
-    SKP_int     corrupt;                                    /* Packet is corrupt                    */
-    SKP_int     vadFlags[     SILK_MAX_FRAMES_PER_PACKET ]; /* VAD flag for each frame in packet    */
-    SKP_int     sigtypeFlags[ SILK_MAX_FRAMES_PER_PACKET ]; /* Signal type for each frame in packet */
+    SKP_int     framesInPacket;                                 /* Number of 20 ms frames in packet     */
+    SKP_int     fs_kHz;                                         /* Sampling frequency in packet         */
+    SKP_int     inbandLBRR;                                     /* Does packet contain LBRR information */
+    SKP_int     corrupt;                                        /* Packet is corrupt                    */
+    SKP_int     signalTypeFlags[ SILK_MAX_FRAMES_PER_PACKET ];  /* Signal type for each frame in packet */
 } SKP_Silk_TOC_struct;
 
 /****************************************/
@@ -136,16 +135,10 @@
 /* Get table of contents for a packet */
 /**************************************/
 void SKP_Silk_SDK_get_TOC(
-    ec_dec                              *psRangeDec,    /* I/O  Compressor data structure                   */
+    ec_dec                              *psRangeDec,    /* I/O  Compressor data structure                       */
     const SKP_int16                     nBytesIn,       /* I:   Number of input bytes                           */
     SKP_Silk_TOC_struct                 *Silk_TOC       /* O:   Table of contents                               */
 );
-
-/**************************/
-/* Get the version number */
-/**************************/
-/* Return a pointer to string specifying the version */ 
-const char *SKP_Silk_SDK_get_version();
 
 #ifdef __cplusplus
 }
--- a/interface/SKP_Silk_control.h
+++ b/interface/SKP_Silk_control.h
@@ -57,7 +57,7 @@
     /* I:   Uplink packet loss in percent (0-100)                                           */
     SKP_int packetLossPercentage;
     
-    /* I:   Complexity mode; 0 is lowest; 1 is medium and 2 is highest complexity           */
+    /* I:   Complexity mode; 0 is lowest, 10 is highest complexity                          */
     SKP_int complexity;
 
     /* I:   Flag to enable in-band Forward Error Correction (FEC); 0/1                      */
--- a/interface/SKP_Silk_errors.h
+++ b/interface/SKP_Silk_errors.h
@@ -42,7 +42,7 @@
 /* Encoder error messages */
 /**************************/
 
-/* Input length is not a multiplum of 10 ms, or length is longer than the packet length */
+/* Input length is not a multiple of 10 ms, or length is longer than the packet length */
 #define SKP_SILK_ENC_INPUT_INVALID_NO_OF_SAMPLES        -101
 
 /* Sampling frequency not 8000, 12000, 16000 or 24000 Hertz */
@@ -57,7 +57,7 @@
 /* Loss rate not between 0 and 100 percent */
 #define SKP_SILK_ENC_INVALID_LOSS_RATE                  -105
 
-/* Complexity setting not valid, use 0, 1 or 2 */
+/* Complexity setting not valid, use 0...10 */
 #define SKP_SILK_ENC_INVALID_COMPLEXITY_SETTING         -106
 
 /* Inband FEC setting not valid, use 0 or 1 */
--- a/interface/SKP_debug.h
+++ b/interface/SKP_debug.h
@@ -25,15 +25,6 @@
 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 ***********************************************************************/
 
-
-/*                                                                      *
- * SKP_debug.h                                                          *
- *                                                                      *
- * This contains code to help debugging                                 *
- *                                                                      *
- * Copyright 2009 (c), Skype Limited                                    *
- * Date: 090629                                                         *
- *                                                                      */
 #ifndef _SKP_DEBUG_H_
 #define _SKP_DEBUG_H_
 
--- a/src_FIX/SKP_Silk_HP_variable_cutoff_FIX.c
+++ b/src_FIX/SKP_Silk_HP_variable_cutoff_FIX.c
@@ -49,7 +49,7 @@
     /*********************************************/
     /* Estimate Low End of Pitch Frequency Range */
     /*********************************************/
-    if( psEnc->sCmn.prev_sigtype == SIG_TYPE_VOICED ) {
+    if( psEnc->sCmn.prevSignalType == TYPE_VOICED ) {
         /* difference, in log domain */
         pitch_freq_Hz_Q16 = SKP_DIV32_16( SKP_LSHIFT( SKP_MUL( psEnc->sCmn.fs_kHz, 1000 ), 16 ), psEnc->sCmn.prevLag );
         pitch_freq_log_Q7 = SKP_Silk_lin2log( pitch_freq_Hz_Q16 ) - ( 16 << 7 ); //0x70
--- a/src_FIX/SKP_Silk_NLSF_MSVQ_encode_FIX.c
+++ b/src_FIX/SKP_Silk_NLSF_MSVQ_encode_FIX.c
@@ -78,7 +78,6 @@
     SKP_assert( ( LOW_COMPLEXITY_ONLY == 0 ) || ( NLSF_MSVQ_Survivors <= MAX_NLSF_MSVQ_SURVIVORS_LC_MODE ) );
 
 #ifdef SAVE_ALL_INTERNAL_DATA
-    /* Use sigtype.dat to seperate into signal types */
     DEBUG_STORE_DATA( NLSF.dat,    pNLSF_Q15,    LPC_order * sizeof( SKP_int   ) );
     DEBUG_STORE_DATA( WNLSF.dat,   pW_Q6,        LPC_order * sizeof( SKP_int   ) );
     DEBUG_STORE_DATA( NLSF_mu.dat, &NLSF_mu_Q15,             sizeof( SKP_int32 ) );
--- a/src_FIX/SKP_Silk_control_codec_FIX.c
+++ b/src_FIX/SKP_Silk_control_codec_FIX.c
@@ -55,7 +55,7 @@
     const SKP_int               PacketSize_ms,          /* I    Packet length (ms)                      */
     const SKP_int32             TargetRate_bps,         /* I    Target max bitrate (bps)                */
     const SKP_int               PacketLoss_perc,        /* I    Packet loss rate (in percent)           */
-    const SKP_int               Complexity              /* I    Complexity (0->low; 1->medium; 2->high) */
+    const SKP_int               Complexity              /* I    Complexity (0-10)                       */
 )
 {
     SKP_int   fs_kHz, ret = 0;
@@ -113,29 +113,6 @@
     return ret;
 }
 
-/* Control low bitrate redundancy usage */
-void SKP_Silk_LBRR_ctrl_FIX(
-    SKP_Silk_encoder_state_FIX      *psEnc,     /* I/O  encoder state                               */
-    SKP_Silk_encoder_control        *psEncCtrlC /* I/O  encoder control                             */
-)
-{
-    SKP_int LBRR_usage;
-
-    if( psEnc->sCmn.LBRR_enabled ) {
-        /* Control LBRR */
-
-        /* Usage Control based on sensitivity and packet loss caracteristics */
-        /* For now only enable adding to next for active frames. Make more complex later */
-        LBRR_usage = SKP_SILK_NO_LBRR;
-        if( psEnc->speech_activity_Q8 > SKP_FIX_CONST( LBRR_SPEECH_ACTIVITY_THRES, 8 ) && psEnc->sCmn.PacketLoss_perc > LBRR_LOSS_THRES ) {
-            LBRR_usage = SKP_SILK_LBRR;
-        }
-        psEncCtrlC->LBRR_usage = LBRR_usage;
-    } else {
-        psEncCtrlC->LBRR_usage = SKP_SILK_NO_LBRR;
-    }
-}
-
 SKP_INLINE SKP_int SKP_Silk_setup_resamplers(
     SKP_Silk_encoder_state_FIX      *psEnc,             /* I/O                      */
     SKP_int                         fs_kHz              /* I                        */
@@ -208,25 +185,34 @@
             /* Only allowed when the payload buffer is empty */
             psEnc->sCmn.nb_subfr = MAX_NB_SUBFR >> 1;
             psEnc->sPred.pitch_LPC_win_length = SKP_SMULBB( FIND_PITCH_LPC_WIN_MS_2_SF, fs_kHz );
+            if( psEnc->sCmn.fs_kHz == 8 ) {
+                psEnc->sCmn.pitch_contour_iCDF = SKP_Silk_pitch_contour_10_ms_NB_iCDF;
+            } else {
+                psEnc->sCmn.pitch_contour_iCDF = SKP_Silk_pitch_contour_10_ms_iCDF;
+            }
         } else {
             psEnc->sCmn.nb_subfr = MAX_NB_SUBFR;
             psEnc->sPred.pitch_LPC_win_length = SKP_SMULBB( FIND_PITCH_LPC_WIN_MS, fs_kHz );
+            if( psEnc->sCmn.fs_kHz == 8 ) {
+                psEnc->sCmn.pitch_contour_iCDF = SKP_Silk_pitch_contour_NB_iCDF;
+            } else {
+                psEnc->sCmn.pitch_contour_iCDF = SKP_Silk_pitch_contour_iCDF; 
+            }
         }
-        /* Packet length changes. Reset LBRR buffer */
-        SKP_Silk_LBRR_reset( &psEnc->sCmn );
         psEnc->sCmn.PacketSize_ms = PacketSize_ms;
+        psEnc->sCmn.LBRR_nBytes = 0;
     }
 
     /* Set internal sampling frequency */
     if( psEnc->sCmn.fs_kHz != fs_kHz ) {
         /* reset part of the state */
-        SKP_memset( &psEnc->sShape,          0,                        sizeof( SKP_Silk_shape_state_FIX ) );
-        SKP_memset( &psEnc->sPrefilt,        0,                        sizeof( SKP_Silk_prefilter_state_FIX ) );
-        SKP_memset( &psEnc->sNSQ,            0,                        sizeof( SKP_Silk_nsq_state ) );
-        SKP_memset( &psEnc->sPred,           0,                        sizeof( SKP_Silk_predict_state_FIX ) );
-        SKP_memset( psEnc->sNSQ.xq,          0, 2 * MAX_FRAME_LENGTH * sizeof( SKP_int16 ) );
-        SKP_memset( psEnc->sNSQ_LBRR.xq,     0, 2 * MAX_FRAME_LENGTH * sizeof( SKP_int16 ) );
-        SKP_memset( psEnc->sCmn.LBRR_buffer, 0,       MAX_LBRR_DELAY * sizeof( SKP_SILK_LBRR_struct ) );
+        SKP_memset( &psEnc->sShape,              0,                        sizeof( SKP_Silk_shape_state_FIX ) );
+        SKP_memset( &psEnc->sPrefilt,            0,                        sizeof( SKP_Silk_prefilter_state_FIX ) );
+        SKP_memset( &psEnc->sNSQ,                0,                        sizeof( SKP_Silk_nsq_state ) );
+        SKP_memset( &psEnc->sPred,               0,                        sizeof( SKP_Silk_predict_state_FIX ) );
+        SKP_memset( psEnc->sNSQ.xq,              0, 2 * MAX_FRAME_LENGTH * sizeof( SKP_int16 ) );
+        SKP_memset( psEnc->sNSQ_LBRR.xq,         0, 2 * MAX_FRAME_LENGTH * sizeof( SKP_int16 ) );
+        SKP_memset( psEnc->sPred.prev_NLSFq_Q15, 0,        MAX_LPC_ORDER * sizeof( SKP_int ) );
 #if SWITCH_TRANSITION_FILTERING
         SKP_memset( psEnc->sCmn.sLP.In_LP_State, 0, 2 * sizeof( SKP_int32 ) );
         if( psEnc->sCmn.sLP.mode == 1 ) {
@@ -237,17 +223,14 @@
             psEnc->sCmn.sLP.transition_frame_no = 0;
         }
 #endif
+        psEnc->sCmn.LBRR_nBytes         = 0;
         psEnc->sCmn.inputBufIx          = 0;
         psEnc->sCmn.nFramesInPayloadBuf = 0;
         psEnc->sCmn.nBytesInPayloadBuf  = 0;
-        psEnc->sCmn.oldest_LBRR_idx     = 0;
         psEnc->sCmn.TargetRate_bps      = 0; /* Ensures that psEnc->SNR_dB is recomputed */
 
-        SKP_memset( psEnc->sPred.prev_NLSFq_Q15, 0, MAX_LPC_ORDER * sizeof( SKP_int ) );
-
         /* Initialize non-zero parameters */
         psEnc->sCmn.prevLag                 = 100;
-        psEnc->sCmn.prev_sigtype            = SIG_TYPE_UNVOICED;
         psEnc->sCmn.first_frame_after_reset = 1;
         psEnc->sPrefilt.lagPrev             = 100;
         psEnc->sShape.LastGainIndex         = 1;
@@ -296,22 +279,22 @@
             SKP_assert( 0 );
         }
         if( psEnc->sCmn.fs_kHz == 24 ) {
-            psEnc->sCmn.mu_LTP_Q10 = SKP_FIX_CONST( MU_LTP_QUANT_SWB, 10 );
+            psEnc->sCmn.mu_LTP_Q9 = SKP_FIX_CONST( MU_LTP_QUANT_SWB, 9 );
             psEnc->sCmn.bitrate_threshold_up    = SKP_int32_MAX;
             psEnc->sCmn.bitrate_threshold_down  = SWB2WB_BITRATE_BPS; 
             psEnc->sCmn.pitch_lag_low_bits_iCDF = SKP_Silk_uniform12_iCDF;
         } else if( psEnc->sCmn.fs_kHz == 16 ) {
-            psEnc->sCmn.mu_LTP_Q10 = SKP_FIX_CONST( MU_LTP_QUANT_WB, 10 );
+            psEnc->sCmn.mu_LTP_Q9 = SKP_FIX_CONST( MU_LTP_QUANT_WB, 9 );
             psEnc->sCmn.bitrate_threshold_up    = WB2SWB_BITRATE_BPS;
             psEnc->sCmn.bitrate_threshold_down  = WB2MB_BITRATE_BPS; 
             psEnc->sCmn.pitch_lag_low_bits_iCDF = SKP_Silk_uniform8_iCDF;
         } else if( psEnc->sCmn.fs_kHz == 12 ) {
-            psEnc->sCmn.mu_LTP_Q10 = SKP_FIX_CONST( MU_LTP_QUANT_MB, 10 );
+            psEnc->sCmn.mu_LTP_Q9 = SKP_FIX_CONST( MU_LTP_QUANT_MB, 9 );
             psEnc->sCmn.bitrate_threshold_up    = MB2WB_BITRATE_BPS;
             psEnc->sCmn.bitrate_threshold_down  = MB2NB_BITRATE_BPS;
             psEnc->sCmn.pitch_lag_low_bits_iCDF = SKP_Silk_uniform6_iCDF;
         } else if( psEnc->sCmn.fs_kHz == 8 ) {
-            psEnc->sCmn.mu_LTP_Q10 = SKP_FIX_CONST( MU_LTP_QUANT_NB, 10 );
+            psEnc->sCmn.mu_LTP_Q9 = SKP_FIX_CONST( MU_LTP_QUANT_NB, 9 );
             psEnc->sCmn.bitrate_threshold_up    = NB2MB_BITRATE_BPS;
             psEnc->sCmn.bitrate_threshold_down  = 0;
             psEnc->sCmn.pitch_lag_low_bits_iCDF = SKP_Silk_uniform4_iCDF;
--- a/src_FIX/SKP_Silk_encode_frame_FIX.c
+++ b/src_FIX/SKP_Silk_encode_frame_FIX.c
@@ -33,8 +33,7 @@
 /****************/
 SKP_int SKP_Silk_encode_frame_FIX( 
     SKP_Silk_encoder_state_FIX      *psEnc,             /* I/O  Encoder state FIX                       */
-    SKP_int32                       *pnBytesOut,        /* I/O  Number of payload bytes                 */
-                                                        /*      input: max length; output: used         */
+    SKP_int32                       *pnBytesOut,        /*   O  Number of payload bytes                 */
     ec_enc                          *psRangeEnc,        /* I/O  compressor data structure               */
     const SKP_int16                 *pIn                /* I    Input speech frame                      */
 )
@@ -45,12 +44,8 @@
     SKP_int16   xfw[ MAX_FRAME_LENGTH ];
     SKP_int16   pIn_HP[ MAX_FRAME_LENGTH ];
     SKP_int16   res_pitch[ 2 * MAX_FRAME_LENGTH + LA_PITCH_MAX ];
-    SKP_int     LBRR_idx, frame_terminator, SNR_dB_Q7;
+    SKP_int     frame_terminator, SNR_dB_Q7;
 
-    /* Low bitrate redundancy parameters */
-    SKP_uint8   LBRRpayload[ MAX_ARITHM_BYTES ];
-    SKP_int32   nBytesLBRR;
-
 TIC(ENCODE_FRAME)
 
     sEncCtrl.sCmn.Seed = psEnc->sCmn.frameCounter++ & 3;
@@ -70,6 +65,25 @@
                                  pIn, psEnc->sCmn.frame_length, psEnc->sCmn.fs_kHz );
 TOC(VAD)
 
+    /**************************************************/
+    /* Convert speech activity into VAD and DTX flags */
+    /**************************************************/
+    if( psEnc->speech_activity_Q8 < SKP_FIX_CONST( SPEECH_ACTIVITY_DTX_THRES, 8 ) ) {
+        sEncCtrl.sCmn.signalType = TYPE_NO_VOICE_ACTIVITY;
+        psEnc->sCmn.noSpeechCounter++;
+        if( psEnc->sCmn.noSpeechCounter > NO_SPEECH_FRAMES_BEFORE_DTX ) {
+            psEnc->sCmn.inDTX = 1;
+        }
+        if( psEnc->sCmn.noSpeechCounter > MAX_CONSECUTIVE_DTX ) {
+            psEnc->sCmn.noSpeechCounter = 0;
+            psEnc->sCmn.inDTX           = 0;
+        }
+    } else {
+        psEnc->sCmn.noSpeechCounter = 0;
+        psEnc->sCmn.inDTX           = 0;
+        sEncCtrl.sCmn.signalType = TYPE_UNVOICED;
+    }
+
     /*******************************************/
     /* High-pass filtering of the input signal */
     /*******************************************/
@@ -124,15 +138,15 @@
     SKP_Silk_process_gains_FIX( psEnc, &sEncCtrl );
 TOC(PROCESS_GAINS)
     
-    psEnc->sCmn.sigtype[         psEnc->sCmn.nFramesInPayloadBuf ] = sEncCtrl.sCmn.sigtype;
-    psEnc->sCmn.QuantOffsetType[ psEnc->sCmn.nFramesInPayloadBuf ] = sEncCtrl.sCmn.QuantOffsetType;
+    psEnc->sCmn.quantOffsetType[ psEnc->sCmn.nFramesInPayloadBuf ] = sEncCtrl.sCmn.quantOffsetType;
+    psEnc->sCmn.signalType[      psEnc->sCmn.nFramesInPayloadBuf ] = sEncCtrl.sCmn.signalType;
 
     /****************************************/
     /* Low Bitrate Redundant Encoding       */
     /****************************************/
-    nBytesLBRR = MAX_ARITHM_BYTES;
+    psEnc->sCmn.LBRR_nBytes = MAX_ARITHM_BYTES;
 TIC(LBRR)
-    //SKP_Silk_LBRR_encode_FIX( psEnc, &sEncCtrl, LBRRpayload, &nBytesLBRR, xfw );
+    //SKP_Silk_LBRR_encode_FIX( psEnc, &sEncCtrl, psEnc->sCmn.LBRR_payload, &psEnc->sCmn.LBRR_nBytes, xfw );
 TOC(LBRR)
 
     /*****************************************/
@@ -154,25 +168,6 @@
     }
 TOC(NSQ)
 
-    /**************************************************/
-    /* Convert speech activity into VAD and DTX flags */
-    /**************************************************/
-    if( psEnc->speech_activity_Q8 < SKP_FIX_CONST( SPEECH_ACTIVITY_DTX_THRES, 8 ) ) {
-        psEnc->sCmn.vadFlag = NO_VOICE_ACTIVITY;
-        psEnc->sCmn.noSpeechCounter++;
-        if( psEnc->sCmn.noSpeechCounter > NO_SPEECH_FRAMES_BEFORE_DTX ) {
-            psEnc->sCmn.inDTX = 1;
-        }
-        if( psEnc->sCmn.noSpeechCounter > MAX_CONSECUTIVE_DTX ) {
-            psEnc->sCmn.noSpeechCounter = 0;
-            psEnc->sCmn.inDTX           = 0;
-        }
-    } else {
-        psEnc->sCmn.noSpeechCounter = 0;
-        psEnc->sCmn.inDTX           = 0;
-        psEnc->sCmn.vadFlag         = VOICE_ACTIVITY;
-    }
-
     /****************************************/
     /* Initialize range coder               */
     /****************************************/
@@ -184,7 +179,7 @@
     /* Encode Parameters                    */
     /****************************************/
 TIC(ENCODE_PARAMS)
-    SKP_Silk_encode_parameters( &psEnc->sCmn, &sEncCtrl.sCmn, psRangeEnc );
+    SKP_Silk_encode_indices( &psEnc->sCmn, &sEncCtrl.sCmn, psRangeEnc );
 TOC(ENCODE_PARAMS)
 
     /****************************************/
@@ -195,26 +190,18 @@
         ( psEnc->sCmn.ltp_mem_length + LA_SHAPE_MS * psEnc->sCmn.fs_kHz ) * sizeof( SKP_int16 ) );
     
     /* Parameters needed for next frame */
-    psEnc->sCmn.prev_sigtype            = sEncCtrl.sCmn.sigtype;
     psEnc->sCmn.prevLag                 = sEncCtrl.sCmn.pitchL[ psEnc->sCmn.nb_subfr - 1 ];
+    psEnc->sCmn.prevSignalType          = sEncCtrl.sCmn.signalType;
     psEnc->sCmn.first_frame_after_reset = 0;
+    psEnc->sCmn.nFramesInPayloadBuf++;
 
-    if( 0 ) { //psEnc->sCmn.sRC.error ) {
-        /* Encoder returned error: clear payload buffer */
-        psEnc->sCmn.nFramesInPayloadBuf = 0;
-    } else {
-        psEnc->sCmn.nFramesInPayloadBuf++;
-    }
-
     /****************************************/
     /* Finalize payload and copy to output  */
     /****************************************/
     if( psEnc->sCmn.nFramesInPayloadBuf * SUB_FRAME_LENGTH_MS * psEnc->sCmn.nb_subfr >= psEnc->sCmn.PacketSize_ms ) {
 
-        LBRR_idx = ( psEnc->sCmn.oldest_LBRR_idx + 1 ) & LBRR_IDX_MASK;
-
         /* Check if FEC information should be added */
-        //frame_terminator = psEnc->sCmn.LBRR_buffer[ LBRR_idx ].usage;
+        //frame_terminator = psEnc->sCmn.usage;
         frame_terminator = SKP_SILK_NO_LBRR;
 
         /* Add the frame termination info to stream */
@@ -222,57 +209,14 @@
 
         /* Code excitation signal */
         for( i = 0; i < psEnc->sCmn.nFramesInPayloadBuf; i++ ) {
-            SKP_Silk_encode_pulses( psRangeEnc, psEnc->sCmn.sigtype[ i ], psEnc->sCmn.QuantOffsetType[ i ], 
+            SKP_Silk_encode_pulses( psRangeEnc, psEnc->sCmn.signalType[ i ], psEnc->sCmn.quantOffsetType[ i ], 
                 &psEnc->sCmn.q[ i * psEnc->sCmn.frame_length ], psEnc->sCmn.frame_length );
         }
 
         /* Payload length so far */
         nBytes = SKP_RSHIFT( ec_enc_tell( psRangeEnc, 0 ) + 7, 3 );
+        *pnBytesOut = nBytes;
 
-        /* Check that there is enough space in external output buffer, and move data */
-        if( *pnBytesOut >= nBytes ) {
-            //SKP_int bits_in_stream, mask;
-            //bits_in_stream = ec_enc_tell( psRangeEnc, 0 );
-            //ec_enc_done( psRangeEnc );
-            
-#if 0
-            /* Fill up any remaining bits in the last byte with 1s */
-            if( bits_in_stream & 7 ) {
-                mask = SKP_RSHIFT( 0xFF, bits_in_stream & 7 );
-                if( nBytes - 1 < *pnBytesOut ) {
-                    psEnc->sCmn.sRC.range_enc_celt_state.buf->buf[ nBytes - 1 ] |= mask;
-                }
-            }
-            SKP_memcpy( pCode, psEnc->sCmn.sRC.range_enc_celt_state.buf->buf, nBytes * sizeof( SKP_uint8 ) );
-#endif
-
-#if 0
-            if( frame_terminator > SKP_SILK_MORE_FRAMES && 
-                    *pnBytesOut >= nBytes + psEnc->sCmn.LBRR_buffer[ LBRR_idx ].nBytes ) {
-                /* Get old packet and add to payload. */
-                SKP_memcpy( &pCode[ nBytes ],
-                    psEnc->sCmn.LBRR_buffer[ LBRR_idx ].payload,
-                    psEnc->sCmn.LBRR_buffer[ LBRR_idx ].nBytes * sizeof( SKP_uint8 ) );
-                nBytes += psEnc->sCmn.LBRR_buffer[ LBRR_idx ].nBytes;
-            }
-#endif
-            *pnBytesOut = nBytes;
-
-            /* Update FEC buffer */
-            SKP_memcpy( psEnc->sCmn.LBRR_buffer[ psEnc->sCmn.oldest_LBRR_idx ].payload, LBRRpayload, 
-                nBytesLBRR * sizeof( SKP_uint8 ) );
-            psEnc->sCmn.LBRR_buffer[ psEnc->sCmn.oldest_LBRR_idx ].nBytes = nBytesLBRR;
-            /* The line below describes how FEC should be used */
-            psEnc->sCmn.LBRR_buffer[ psEnc->sCmn.oldest_LBRR_idx ].usage = sEncCtrl.sCmn.LBRR_usage;
-            psEnc->sCmn.oldest_LBRR_idx = ( psEnc->sCmn.oldest_LBRR_idx + 1 ) & LBRR_IDX_MASK;
-
-        } else {
-            /* Not enough space: Payload will be discarded */
-            *pnBytesOut = 0;
-            nBytes      = 0;
-            ret = SKP_SILK_ENC_PAYLOAD_BUF_TOO_SHORT;
-        }
-
         /* Reset the number of frames in payload buffer */
         psEnc->sCmn.nFramesInPayloadBuf = 0;
     } else {
@@ -287,11 +231,6 @@
             &psEnc->sCmn.q[ psEnc->sCmn.nFramesInPayloadBuf * psEnc->sCmn.frame_length ] );
     }
 
-    /* Check for arithmetic coder errors */
-    if( 0 ) { //psEnc->sCmn.sRC.error ) {
-        ret = SKP_SILK_ENC_INTERNAL_ERROR;
-    }
-
     /* Simulate number of ms buffered in channel because of exceeding TargetRate */
     SKP_assert(  ( 8 * 1000 * ( (SKP_int64)nBytes - (SKP_int64)psEnc->sCmn.nBytesInPayloadBuf ) ) == 
         SKP_SAT32( 8 * 1000 * ( (SKP_int64)nBytes - (SKP_int64)psEnc->sCmn.nBytesInPayloadBuf ) ) );
@@ -339,7 +278,7 @@
         DEBUG_STORE_DATA( nBytes.dat,               &nBytes,                        sizeof( SKP_int ) );
         tmp[ 0 ] = (SKP_float)sEncCtrl.current_SNR_dB_Q7 / 128.0f;
         DEBUG_STORE_DATA( current_SNR_db.dat,       tmp,                            sizeof( SKP_float ) );
-        DEBUG_STORE_DATA( QuantOffsetType.dat,      &sEncCtrl.sCmn.QuantOffsetType, sizeof( SKP_int ) );
+        DEBUG_STORE_DATA( quantOffsetType.dat,      &sEncCtrl.sCmn.quantOffsetType, sizeof( SKP_int ) );
         tmp[ 0 ] = (SKP_float)psEnc->speech_activity_Q8 / 256.0f;
         DEBUG_STORE_DATA( speech_activity.dat,      tmp,                            sizeof( SKP_float ) );
         for( i = 0; i < VAD_N_BANDS; i++ ) {
@@ -346,7 +285,7 @@
             tmp[ i ] = (SKP_float)sEncCtrl.input_quality_bands_Q15[ i ] / 32768.0f;
         }
         DEBUG_STORE_DATA( input_quality_bands.dat,  tmp,                            VAD_N_BANDS * sizeof( SKP_float ) );
-        DEBUG_STORE_DATA( sigtype.dat,              &sEncCtrl.sCmn.sigtype,         sizeof( SKP_int ) ); 
+        DEBUG_STORE_DATA( signalType.dat,           &sEncCtrl.sCmn.signalType,      sizeof( SKP_int ) ); 
         DEBUG_STORE_DATA( ratelevel.dat,            &sEncCtrl.sCmn.RateLevelIndex,  sizeof( SKP_int ) ); 
         DEBUG_STORE_DATA( lag_index.dat,            &sEncCtrl.sCmn.lagIndex,        sizeof( SKP_int ) ); 
         DEBUG_STORE_DATA( contour_index.dat,        &sEncCtrl.sCmn.contourIndex,    sizeof( SKP_int ) ); 
@@ -375,7 +314,14 @@
     /*******************************************/
     /* Control use of inband LBRR              */
     /*******************************************/
-    SKP_Silk_LBRR_ctrl_FIX( psEnc, &psEncCtrl->sCmn );
+    psEnc->sCmn.LBRR_usage = SKP_SILK_NO_LBRR;
+    if( psEnc->sCmn.LBRR_enabled ) {
+        /* Control LBRR */
+        /* Usage Control based on sensitivity and packet loss caracteristics */
+        if( psEnc->speech_activity_Q8 > SKP_FIX_CONST( LBRR_SPEECH_ACTIVITY_THRES, 8 ) && psEnc->sCmn.PacketLoss_perc > LBRR_LOSS_THRES ) {
+            psEnc->sCmn.LBRR_usage = SKP_SILK_LBRR;
+        }
+    }
 
     if( psEnc->sCmn.LBRR_enabled ) {
         /* Save original gains */
@@ -398,7 +344,7 @@
             SKP_assert( 0 );
         }
 
-        if( psEnc->sCmn.Complexity > 0 && psEnc->sCmn.TargetRate_bps > Rate_only_parameters ) {
+        if( psEnc->sCmn.Complexity >= 4 && psEnc->sCmn.TargetRate_bps > Rate_only_parameters ) {
             if( psEnc->sCmn.nFramesInPayloadBuf == 0 ) {
                 /* First frame in packet; copy everything */
                 SKP_memcpy( &psEnc->sNSQ_LBRR, &psEnc->sNSQ, sizeof( SKP_Silk_nsq_state ) );
@@ -445,8 +391,7 @@
         /****************************************/
         /* Encode Parameters                    */
         /****************************************/
-        SKP_Silk_encode_parameters( &psEnc->sCmn, &psEncCtrl->sCmn, 
-            &psEnc->sCmn.sRC_LBRR );
+        SKP_Silk_encode_indices( &psEnc->sCmn, &psEncCtrl->sCmn, &psEnc->sCmn.sRC_LBRR );
 
         /****************************************/
         /* Encode Parameters                    */
@@ -473,7 +418,7 @@
             /* Encode quantization indices of excitation */
             /*********************************************/
             for( i = 0; i < nFramesInPayloadBuf; i++ ) {
-                SKP_Silk_encode_pulses( &psEnc->sCmn.sRC_LBRR, psEnc->sCmn.sigtype[ i ], psEnc->sCmn.QuantOffsetType[ i ],
+                SKP_Silk_encode_pulses( &psEnc->sCmn.sRC_LBRR, psEnc->sCmn.signalType[ i ], psEnc->sCmn.quantOffsetType[ i ],
                     &psEnc->sCmn.q_LBRR[ i * psEnc->sCmn.frame_length ], psEnc->sCmn.frame_length );
             }
 
--- a/src_FIX/SKP_Silk_find_pitch_lags_FIX.c
+++ b/src_FIX/SKP_Silk_find_pitch_lags_FIX.c
@@ -108,20 +108,25 @@
     SKP_Silk_MA_Prediction( x_buf, A_Q12, FiltState, res, buf_len, psEnc->sCmn.pitchEstimationLPCOrder );
     SKP_memset( res, 0, psEnc->sCmn.pitchEstimationLPCOrder * sizeof( SKP_int16 ) );
 
-    /* Threshold for pitch estimator */
-    thrhld_Q15 = SKP_FIX_CONST( 0.45, 15 );
-    thrhld_Q15 = SKP_SMLABB( thrhld_Q15, SKP_FIX_CONST( -0.004, 15 ), psEnc->sCmn.pitchEstimationLPCOrder );
-    thrhld_Q15 = SKP_SMLABB( thrhld_Q15, SKP_FIX_CONST( -0.1,   7  ), psEnc->speech_activity_Q8 );
-    thrhld_Q15 = SKP_SMLABB( thrhld_Q15, SKP_FIX_CONST(  0.15,  15 ), psEnc->sCmn.prev_sigtype );
-    thrhld_Q15 = SKP_SMLAWB( thrhld_Q15, SKP_FIX_CONST( -0.1,   16 ), psEncCtrl->input_tilt_Q15 );
-    thrhld_Q15 = SKP_SAT16(  thrhld_Q15 );
+    if( psEncCtrl->sCmn.signalType != TYPE_NO_VOICE_ACTIVITY ) {
+        /* Threshold for pitch estimator */
+        thrhld_Q15 = SKP_FIX_CONST( 0.6, 15 );
+        thrhld_Q15 = SKP_SMLABB( thrhld_Q15, SKP_FIX_CONST( -0.004, 15 ), psEnc->sCmn.pitchEstimationLPCOrder );
+        thrhld_Q15 = SKP_SMLABB( thrhld_Q15, SKP_FIX_CONST( -0.1,   7  ), psEnc->speech_activity_Q8 );
+        thrhld_Q15 = SKP_SMLABB( thrhld_Q15, SKP_FIX_CONST( -0.15,  15 ), SKP_RSHIFT( psEnc->sCmn.prevSignalType, 1 ) );
+        thrhld_Q15 = SKP_SMLAWB( thrhld_Q15, SKP_FIX_CONST( -0.1,   16 ), psEncCtrl->input_tilt_Q15 );
+        thrhld_Q15 = SKP_SAT16(  thrhld_Q15 );
 
-    /*****************************************/
-    /* Call pitch estimator                  */
-    /*****************************************/
-TIC(pitch_analysis_core_FIX)
-    psEncCtrl->sCmn.sigtype = SKP_Silk_pitch_analysis_core( res, psEncCtrl->sCmn.pitchL, &psEncCtrl->sCmn.lagIndex, 
-        &psEncCtrl->sCmn.contourIndex, &psEnc->LTPCorr_Q15, psEnc->sCmn.prevLag, psEnc->sCmn.pitchEstimationThreshold_Q16, 
-        ( SKP_int16 )thrhld_Q15, psEnc->sCmn.fs_kHz, psEnc->sCmn.pitchEstimationComplexity, psEnc->sCmn.nb_subfr );
-TOC(pitch_analysis_core_FIX)
+        /*****************************************/
+        /* Call pitch estimator                  */
+        /*****************************************/
+        if( SKP_Silk_pitch_analysis_core( res, psEncCtrl->sCmn.pitchL, &psEncCtrl->sCmn.lagIndex, 
+                &psEncCtrl->sCmn.contourIndex, &psEnc->LTPCorr_Q15, psEnc->sCmn.prevLag, psEnc->sCmn.pitchEstimationThreshold_Q16, 
+                ( SKP_int16 )thrhld_Q15, psEnc->sCmn.fs_kHz, psEnc->sCmn.pitchEstimationComplexity, psEnc->sCmn.nb_subfr ) == 0 ) 
+        {
+            psEncCtrl->sCmn.signalType = TYPE_VOICED;
+        } else {
+            psEncCtrl->sCmn.signalType = TYPE_UNVOICED;
+        }
+    }
 }
--- a/src_FIX/SKP_Silk_find_pred_coefs_FIX.c
+++ b/src_FIX/SKP_Silk_find_pred_coefs_FIX.c
@@ -114,7 +114,7 @@
         local_gains[ i ] = SKP_DIV32( ( 1 << 16 ), invGains_Q16[ i ] );
     }
 
-    if( psEncCtrl->sCmn.sigtype == SIG_TYPE_VOICED ) {
+    if( psEncCtrl->sCmn.signalType == TYPE_VOICED ) {
         /**********/
         /* VOICED */
         /**********/
@@ -134,7 +134,7 @@
 
         /* Quantize LTP gain parameters */
         SKP_Silk_quant_LTP_gains( psEncCtrl->LTPCoef_Q14, psEncCtrl->sCmn.LTPIndex, &psEncCtrl->sCmn.PERIndex, 
-            WLTP, psEnc->sCmn.mu_LTP_Q10, psEnc->sCmn.LTPQuantLowComplexity, psEnc->sCmn.nb_subfr);
+            WLTP, psEnc->sCmn.mu_LTP_Q9, psEnc->sCmn.LTPQuantLowComplexity, psEnc->sCmn.nb_subfr);
 
         /* Control LTP scaling */
         SKP_Silk_LTP_scale_ctrl_FIX( psEnc, psEncCtrl );
@@ -266,7 +266,7 @@
                 in_ptr      += psEnc->sCmn.subfr_length;
             }
                 
-            if( psEncCtrl->sCmn.sigtype == SIG_TYPE_VOICED ) {
+            if( psEncCtrl->sCmn.signalType == TYPE_VOICED ) {
                 /* Calculate LTP residual with unquantized LTP and unquantized LPC */
                 SKP_Silk_LTP_ana_core( LPC_res, LTP_res, &psEncCtrl->sCmn.pitchL[ j ],
                     &uq_LTPCoef[ j * LTP_ORDER ], psEnc->sCmn.subfr_length, psEnc->sCmn.ltp_mem_length );
@@ -291,7 +291,7 @@
                 in_ptr       += psEnc->sCmn.subfr_length;
             }
 
-            if( psEncCtrl->sCmn.sigtype == SIG_TYPE_VOICED ) {
+            if( psEncCtrl->sCmn.signalType == TYPE_VOICED ) {
                 /* Calculate LTP residual with unquantized LTP and unquantized LPC */
                 SKP_Silk_LTP_ana_core( LPC_res, LTP_res, &psEncCtrl->sCmn.pitchL[ j ],
                     &LTPCoef[ j * LTP_ORDER ], psEnc->sCmn.subfr_length, psEnc->sCmn.ltp_mem_length );
@@ -310,7 +310,7 @@
             DEBUG_STORE_DATA( LPC_res.dat, &LPC_res[ psEnc->sCmn.ltp_mem_length ], ( psEnc->sCmn.subfr_length << 1 ) * sizeof( SKP_float ) );
             DEBUG_STORE_DATA( res.dat,     LTP_res,                                ( psEnc->sCmn.subfr_length << 1 ) * sizeof( SKP_float ) );
         }
-        if( psEncCtrl->sCmn.sigtype == SIG_TYPE_VOICED ) {
+        if( psEncCtrl->sCmn.signalType == TYPE_VOICED ) {
             LPC_predCodGain  = 3.0f * SKP_Silk_log2( in_nrg       / LPC_res_nrg  );
             QLPC_predCodGain = 3.0f * SKP_Silk_log2( in_nrg       / qLPC_res_nrg );
             LTPredCodGain    = 3.0f * SKP_Silk_log2( LPC_res_nrg  / LTP_res_nrg  );
--- a/src_FIX/SKP_Silk_main_FIX.h
+++ b/src_FIX/SKP_Silk_main_FIX.h
@@ -83,7 +83,7 @@
     const SKP_int               PacketSize_ms,          /* I    Packet length (ms)                      */
     const SKP_int32             TargetRate_bps,         /* I    Target max bitrate (bps)                */
     const SKP_int               PacketLoss_perc,        /* I    Packet loss rate (in percent)           */
-    const SKP_int               Complexity              /* I    Complexity (0->low; 1->medium; 2->high) */
+    const SKP_int               Complexity              /* I    Complexity (0-10)                       */
 );
 
 /****************/
@@ -115,12 +115,6 @@
     const SKP_int                   warping_Q16,        /* I    Warping coefficient                     */
     const SKP_int                   length,             /* I    Length of input                         */
     const SKP_int                   order               /* I    Correlation order (even)                */
-);
-
-/* Control low bitrate redundancy usage */
-void SKP_Silk_LBRR_ctrl_FIX(
-    SKP_Silk_encoder_state_FIX      *psEnc,         /* I/O  encoder state                               */
-    SKP_Silk_encoder_control        *psEncCtrlC     /* I/O  encoder control                             */
 );
 
 /* Calculation of LTP state scaling */
--- a/src_FIX/SKP_Silk_noise_shape_analysis_FIX.c
+++ b/src_FIX/SKP_Silk_noise_shape_analysis_FIX.c
@@ -196,7 +196,7 @@
             SKP_SMULWB( SKP_FIX_CONST( 1.0, 14 ) + psEncCtrl->input_quality_Q14, psEncCtrl->coding_quality_Q14 ) );     // Q12
     }
 
-    if( psEncCtrl->sCmn.sigtype == SIG_TYPE_VOICED ) {
+    if( psEncCtrl->sCmn.signalType == TYPE_VOICED ) {
         /* Reduce gains for periodic signals */
         SNR_adj_dB_Q7 = SKP_SMLAWB( SNR_adj_dB_Q7, SKP_FIX_CONST( HARM_SNR_INCR_dB, 8 ), psEnc->LTPCorr_Q15 );
     } else { 
@@ -210,9 +210,9 @@
     /* SPARSENESS PROCESSING */
     /*************************/
     /* Set quantizer offset */
-    if( psEncCtrl->sCmn.sigtype == SIG_TYPE_VOICED ) {
+    if( psEncCtrl->sCmn.signalType == TYPE_VOICED ) {
         /* Initally set to 0; may be overruled in process_gains(..) */
-        psEncCtrl->sCmn.QuantOffsetType = 0;
+        psEncCtrl->sCmn.quantOffsetType = 0;
         psEncCtrl->sparseness_Q8 = 0;
     } else {
         /* Sparseness measure, based on relative fluctuations of energy per 2 milliseconds */
@@ -237,9 +237,9 @@
 
         /* Set quantization offset depending on sparseness measure */
         if( psEncCtrl->sparseness_Q8 > SKP_FIX_CONST( SPARSENESS_THRESHOLD_QNT_OFFSET, 8 ) ) {
-            psEncCtrl->sCmn.QuantOffsetType = 0;
+            psEncCtrl->sCmn.quantOffsetType = 0;
         } else {
-            psEncCtrl->sCmn.QuantOffsetType = 1;
+            psEncCtrl->sCmn.quantOffsetType = 1;
         }
         
         /* Increase coding SNR for sparse signals */
@@ -388,7 +388,7 @@
         SKP_FIX_CONST( LOW_QUALITY_LOW_FREQ_SHAPING_DECR, 13 ), psEncCtrl->input_quality_bands_Q15[ 0 ] - SKP_FIX_CONST( 1.0, 15 ) ) );
 #endif
     strength_Q16 = SKP_RSHIFT( SKP_MUL( strength_Q16, psEnc->speech_activity_Q8 ), 8 );
-    if( psEncCtrl->sCmn.sigtype == SIG_TYPE_VOICED ) {
+    if( psEncCtrl->sCmn.signalType == TYPE_VOICED ) {
         /* Reduce low frequencies quantization noise for periodic signals, depending on pitch lag */
         /*f = 400; freqz([1, -0.98 + 2e-4 * f], [1, -0.97 + 7e-4 * f], 2^12, Fs); axis([0, 1000, -10, 1])*/
         SKP_int fs_kHz_inv = SKP_DIV32_16( SKP_FIX_CONST( 0.2, 14 ), psEnc->sCmn.fs_kHz );
@@ -425,7 +425,7 @@
     HarmBoost_Q16 = SKP_SMLAWB( HarmBoost_Q16, 
         SKP_FIX_CONST( 1.0, 16 ) - SKP_LSHIFT( psEncCtrl->input_quality_Q14, 2 ), SKP_FIX_CONST( LOW_INPUT_QUALITY_HARMONIC_BOOST, 16 ) );
 
-    if( USE_HARM_SHAPING && psEncCtrl->sCmn.sigtype == SIG_TYPE_VOICED ) {
+    if( USE_HARM_SHAPING && psEncCtrl->sCmn.signalType == TYPE_VOICED ) {
         /* More harmonic noise shaping for high bitrates or noisy input */
         HarmShapeGain_Q16 = SKP_SMLAWB( SKP_FIX_CONST( HARMONIC_SHAPING, 16 ), 
                 SKP_FIX_CONST( 1.0, 16 ) - SKP_SMULWB( SKP_FIX_CONST( 1.0, 18 ) - SKP_LSHIFT( psEncCtrl->coding_quality_Q14, 4 ),
--- a/src_FIX/SKP_Silk_prefilter_FIX.c
+++ b/src_FIX/SKP_Silk_prefilter_FIX.c
@@ -106,7 +106,7 @@
     lag = P->lagPrev;
     for( k = 0; k < psEnc->sCmn.nb_subfr; k++ ) {
         /* Update Variables that change per sub frame */
-        if( psEncCtrl->sCmn.sigtype == SIG_TYPE_VOICED ) {
+        if( psEncCtrl->sCmn.signalType == TYPE_VOICED ) {
             lag = psEncCtrl->sCmn.pitchL[ k ];
         }
 
--- a/src_FIX/SKP_Silk_process_NLSFs_FIX.c
+++ b/src_FIX/SKP_Silk_process_NLSFs_FIX.c
@@ -49,12 +49,11 @@
     SKP_assert( psEnc->speech_activity_Q8 <= 256 );
     SKP_assert( psEncCtrl->sparseness_Q8  >=   0 );
     SKP_assert( psEncCtrl->sparseness_Q8  <= 256 );
-    SKP_assert( psEncCtrl->sCmn.sigtype == SIG_TYPE_VOICED || psEncCtrl->sCmn.sigtype == SIG_TYPE_UNVOICED );
 
     /***********************/
     /* Calculate mu values */
     /***********************/
-    if( psEncCtrl->sCmn.sigtype == SIG_TYPE_VOICED ) {
+    if( psEncCtrl->sCmn.signalType == TYPE_VOICED ) {
         /* NLSF_mu           = 0.002f - 0.001f * psEnc->speech_activity; */
         /* NLSF_mu_fluc_red  = 0.1f   - 0.05f  * psEnc->speech_activity; */
         NLSF_mu_Q15          = SKP_SMLAWB(   66,   -8388, psEnc->speech_activity_Q8 );
@@ -100,7 +99,7 @@
     }
 
     /* Set pointer to the NLSF codebook for the current signal type and LPC order */
-    psNLSF_CB = psEnc->sCmn.psNLSF_CB[ psEncCtrl->sCmn.sigtype ];
+    psNLSF_CB = psEnc->sCmn.psNLSF_CB[ 1 - ( psEncCtrl->sCmn.signalType >> 1 ) ];
 
     /* Quantize NLSF parameters given the trained NLSF codebooks */
     TIC(MSVQ_encode_FIX)
--- a/src_FIX/SKP_Silk_process_gains_FIX.c
+++ b/src_FIX/SKP_Silk_process_gains_FIX.c
@@ -39,7 +39,7 @@
     SKP_int32   s_Q16, InvMaxSqrVal_Q16, gain, gain_squared, ResNrg, ResNrgPart, quant_offset_Q10;
 
     /* Gain reduction when LTP coding gain is high */
-    if( psEncCtrl->sCmn.sigtype == SIG_TYPE_VOICED ) {
+    if( psEncCtrl->sCmn.signalType == TYPE_VOICED ) {
         /*s = -0.5f * SKP_sigmoid( 0.25f * ( psEncCtrl->LTPredCodGain - 12.0f ) ); */
         s_Q16 = -SKP_Silk_sigm_Q15( SKP_RSHIFT_ROUND( psEncCtrl->LTPredCodGain_Q7 - SKP_FIX_CONST( 12.0, 7 ), 4 ) );
         for( k = 0; k < psEnc->sCmn.nb_subfr; k++ ) {
@@ -86,16 +86,16 @@
     SKP_Silk_gains_quant( psEncCtrl->sCmn.GainsIndices, psEncCtrl->Gains_Q16, 
         &psShapeSt->LastGainIndex, psEnc->sCmn.nFramesInPayloadBuf, psEnc->sCmn.nb_subfr );
     /* Set quantizer offset for voiced signals. Larger offset when LTP coding gain is low or tilt is high (ie low-pass) */
-    if( psEncCtrl->sCmn.sigtype == SIG_TYPE_VOICED ) {
+    if( psEncCtrl->sCmn.signalType == TYPE_VOICED ) {
         if( psEncCtrl->LTPredCodGain_Q7 + SKP_RSHIFT( psEncCtrl->input_tilt_Q15, 8 ) > SKP_FIX_CONST( 1.0, 7 ) ) {
-            psEncCtrl->sCmn.QuantOffsetType = 0;
+            psEncCtrl->sCmn.quantOffsetType = 0;
         } else {
-            psEncCtrl->sCmn.QuantOffsetType = 1;
+            psEncCtrl->sCmn.quantOffsetType = 1;
         }
     }
 
     /* Quantizer boundary adjustment */
-    quant_offset_Q10 = SKP_Silk_Quantization_Offsets_Q10[ psEncCtrl->sCmn.sigtype ][ psEncCtrl->sCmn.QuantOffsetType ];
+    quant_offset_Q10 = SKP_Silk_Quantization_Offsets_Q10[ psEncCtrl->sCmn.signalType >> 1 ][ psEncCtrl->sCmn.quantOffsetType ];
     psEncCtrl->Lambda_Q10 = SKP_FIX_CONST( LAMBDA_OFFSET, 10 )
                           + SKP_SMULBB( SKP_FIX_CONST( LAMBDA_DELAYED_DECISIONS, 10 ), psEnc->sCmn.nStatesDelayedDecision )
                           + SKP_SMULWB( SKP_FIX_CONST( LAMBDA_SPEECH_ACT,        18 ), psEnc->speech_activity_Q8          )
--- a/src_FLP/SKP_Silk_HP_variable_cutoff_FLP.c
+++ b/src_FLP/SKP_Silk_HP_variable_cutoff_FLP.c
@@ -44,8 +44,7 @@
     /*********************************************/
     /* Estimate low end of pitch frequency range */
     /*********************************************/
-    if( psEnc->sCmn.prev_sigtype == SIG_TYPE_VOICED ) {
-
+    if( psEnc->sCmn.prevSignalType == TYPE_VOICED ) {
         /* Difference, in log domain */
         pitch_freq_Hz  = 1e3f * psEnc->sCmn.fs_kHz / psEnc->sCmn.prevLag;
         pitch_freq_log = SKP_Silk_log2( pitch_freq_Hz );
--- a/src_FLP/SKP_Silk_LPC_analysis_filter_FLP.c
+++ b/src_FLP/SKP_Silk_LPC_analysis_filter_FLP.c
@@ -35,48 +35,46 @@
 /* first Order output samples are not set  */
 /*******************************************/
 
-void SKP_Silk_LPC_analysis_filter_FLP(
+/* 16th order LPC analysis filter, does not write first 16 samples */
+void SKP_Silk_LPC_analysis_filter16_FLP(
           SKP_float                 r_LPC[],            /* O    LPC residual signal                     */
     const SKP_float                 PredCoef[],         /* I    LPC coefficients                        */
     const SKP_float                 s[],                /* I    Input signal                            */
-    const SKP_int                   length,             /* I    Length of input signal                  */
-    const SKP_int                   Order               /* I    LPC order                               */
+    const SKP_int                   length              /* I    Length of input signal                  */
 )
 {
-    SKP_assert( Order <= length );
+    SKP_int   ix = 16;
+    SKP_float LPC_pred;
+    const SKP_float *s_ptr;
 
-    switch( Order ) {
-        case 6:
-            SKP_Silk_LPC_analysis_filter6_FLP(  r_LPC, PredCoef, s, length );
-        break;
+    for ( ; ix < length; ix++) {
+        s_ptr = &s[ix - 1];
 
-        case 8:
-            SKP_Silk_LPC_analysis_filter8_FLP(  r_LPC, PredCoef, s, length );
-        break;
+        /* short-term prediction */
+        LPC_pred = s_ptr[  0 ]  * PredCoef[ 0 ]  + 
+                   s_ptr[ -1 ]  * PredCoef[ 1 ]  +
+                   s_ptr[ -2 ]  * PredCoef[ 2 ]  +
+                   s_ptr[ -3 ]  * PredCoef[ 3 ]  +
+                   s_ptr[ -4 ]  * PredCoef[ 4 ]  +
+                   s_ptr[ -5 ]  * PredCoef[ 5 ]  +
+                   s_ptr[ -6 ]  * PredCoef[ 6 ]  +
+                   s_ptr[ -7 ]  * PredCoef[ 7 ]  +
+                   s_ptr[ -8 ]  * PredCoef[ 8 ]  +
+                   s_ptr[ -9 ]  * PredCoef[ 9 ]  +
+                   s_ptr[ -10 ] * PredCoef[ 10 ] +
+                   s_ptr[ -11 ] * PredCoef[ 11 ] +
+                   s_ptr[ -12 ] * PredCoef[ 12 ] +
+                   s_ptr[ -13 ] * PredCoef[ 13 ] +
+                   s_ptr[ -14 ] * PredCoef[ 14 ] +
+                   s_ptr[ -15 ] * PredCoef[ 15 ];
 
-        case 10:
-            SKP_Silk_LPC_analysis_filter10_FLP( r_LPC, PredCoef, s, length );
-        break;
-
-        case 12:
-            SKP_Silk_LPC_analysis_filter12_FLP( r_LPC, PredCoef, s, length );
-        break;
-
-        case 16:
-            SKP_Silk_LPC_analysis_filter16_FLP( r_LPC, PredCoef, s, length );
-        break;
-
-        default:
-            SKP_assert( 0 );
-        break;
+        /* prediction error */
+        r_LPC[ix] = s_ptr[ 1 ] - LPC_pred;
     }
-
-    /* Set first LPC Order samples to zero instead of undefined */
-    SKP_memset( r_LPC, 0, Order * sizeof( SKP_float ) );
 }
 
-/* 16th order LPC analysis filter, does not write first 16 samples */
-void SKP_Silk_LPC_analysis_filter16_FLP(
+/* 14th order LPC analysis filter, does not write first 14 samples */
+void SKP_Silk_LPC_analysis_filter14_FLP(
           SKP_float                 r_LPC[],            /* O    LPC residual signal                     */
     const SKP_float                 PredCoef[],         /* I    LPC coefficients                        */
     const SKP_float                 s[],                /* I    Input signal                            */
@@ -83,7 +81,7 @@
     const SKP_int                   length              /* I    Length of input signal                  */
 )
 {
-    SKP_int   ix = 16;
+    SKP_int   ix = 14;
     SKP_float LPC_pred;
     const SKP_float *s_ptr;
 
@@ -104,9 +102,7 @@
                    s_ptr[ -10 ] * PredCoef[ 10 ] +
                    s_ptr[ -11 ] * PredCoef[ 11 ] +
                    s_ptr[ -12 ] * PredCoef[ 12 ] +
-                   s_ptr[ -13 ] * PredCoef[ 13 ] +
-                   s_ptr[ -14 ] * PredCoef[ 14 ] +
-                   s_ptr[ -15 ] * PredCoef[ 15 ];
+                   s_ptr[ -13 ] * PredCoef[ 13 ];
 
         /* prediction error */
         r_LPC[ix] = s_ptr[ 1 ] - LPC_pred;
@@ -236,3 +232,48 @@
         r_LPC[ix] = s_ptr[ 1 ] - LPC_pred;
     }
 }
+
+void SKP_Silk_LPC_analysis_filter_FLP(
+          SKP_float                 r_LPC[],            /* O    LPC residual signal                     */
+    const SKP_float                 PredCoef[],         /* I    LPC coefficients                        */
+    const SKP_float                 s[],                /* I    Input signal                            */
+    const SKP_int                   length,             /* I    Length of input signal                  */
+    const SKP_int                   Order               /* I    LPC order                               */
+)
+{
+    SKP_assert( Order <= length );
+
+    switch( Order ) {
+        case 6:
+            SKP_Silk_LPC_analysis_filter6_FLP(  r_LPC, PredCoef, s, length );
+        break;
+
+        case 8:
+            SKP_Silk_LPC_analysis_filter8_FLP(  r_LPC, PredCoef, s, length );
+        break;
+
+        case 10:
+            SKP_Silk_LPC_analysis_filter10_FLP( r_LPC, PredCoef, s, length );
+        break;
+
+        case 12:
+            SKP_Silk_LPC_analysis_filter12_FLP( r_LPC, PredCoef, s, length );
+        break;
+
+        case 14:
+            SKP_Silk_LPC_analysis_filter14_FLP( r_LPC, PredCoef, s, length );
+        break;
+
+        case 16:
+            SKP_Silk_LPC_analysis_filter16_FLP( r_LPC, PredCoef, s, length );
+        break;
+
+        default:
+            SKP_assert( 0 );
+        break;
+    }
+
+    /* Set first LPC Order samples to zero instead of undefined */
+    SKP_memset( r_LPC, 0, Order * sizeof( SKP_float ) );
+}
+
--- a/src_FLP/SKP_Silk_NLSF_MSVQ_encode_FLP.c
+++ b/src_FLP/SKP_Silk_NLSF_MSVQ_encode_FLP.c
@@ -80,7 +80,6 @@
     SKP_assert( ( LOW_COMPLEXITY_ONLY == 0 ) || ( NLSF_MSVQ_Survivors <= MAX_NLSF_MSVQ_SURVIVORS_LC_MODE ) );
 
 #ifdef SAVE_ALL_INTERNAL_DATA
-    /* Use sigtype.dat to seperate into signal types */
     DEBUG_STORE_DATA( NLSF.dat,    pNLSF,    LPC_order * sizeof( SKP_float ) );
     DEBUG_STORE_DATA( WNLSF.dat,   pW,       LPC_order * sizeof( SKP_float ) );
     DEBUG_STORE_DATA( NLSF_mu.dat, &NLSF_mu,             sizeof( SKP_float ) );
--- a/src_FLP/SKP_Silk_control_codec_FLP.c
+++ b/src_FLP/SKP_Silk_control_codec_FLP.c
@@ -54,7 +54,7 @@
     const SKP_int               PacketSize_ms,          /* I    Packet length (ms)                      */
     const SKP_int32             TargetRate_bps,         /* I    Target max bitrate (bps)                */
     const SKP_int               PacketLoss_perc,        /* I    Packet loss rate (in percent)           */
-    const SKP_int               Complexity              /* I    Complexity (0->low; 1->medium; 2->high) */
+    const SKP_int               Complexity              /* I    Complexity (0-10)                       */
 )
 {
     SKP_int   fs_kHz, ret = 0;
@@ -112,29 +112,6 @@
     return ret;
 }
 
-/* Control low bitrate redundancy usage */
-void SKP_Silk_LBRR_ctrl_FLP(
-    SKP_Silk_encoder_state_FLP      *psEnc,             /* I    Encoder state FLP                       */
-    SKP_Silk_encoder_control        *psEncCtrlC         /* I/O  Encoder control                         */
-)
-{
-    SKP_int LBRR_usage;
-
-    if( psEnc->sCmn.LBRR_enabled ) {
-        /* Control LBRR */
-
-        /* Usage Control based on sensitivity and packet loss caracteristics */
-        /* For now only enable adding to next for active frames. Make more complex later */
-        LBRR_usage = SKP_SILK_NO_LBRR;
-        if( psEnc->speech_activity > LBRR_SPEECH_ACTIVITY_THRES && psEnc->sCmn.PacketLoss_perc > LBRR_LOSS_THRES ) {
-            LBRR_usage = SKP_SILK_LBRR;
-        }
-        psEncCtrlC->LBRR_usage = LBRR_usage;
-    } else {
-        psEncCtrlC->LBRR_usage = SKP_SILK_NO_LBRR;
-    }
-}
-
 SKP_INLINE SKP_int SKP_Silk_setup_resamplers(
     SKP_Silk_encoder_state_FLP      *psEnc,             /* I/O  Pointer to Silk encoder state FLP       */
     SKP_int                         fs_kHz              /* I    External (API) sampling rate (Hz)       */
@@ -211,13 +188,22 @@
             /* Only allowed when the payload buffer is empty */
             psEnc->sCmn.nb_subfr = MAX_NB_SUBFR >> 1;
             psEnc->sPred.pitch_LPC_win_length = SKP_SMULBB( FIND_PITCH_LPC_WIN_MS_2_SF, fs_kHz );
+            if( psEnc->sCmn.fs_kHz == 8 ) {
+                psEnc->sCmn.pitch_contour_iCDF = SKP_Silk_pitch_contour_10_ms_NB_iCDF;
+            } else {
+                psEnc->sCmn.pitch_contour_iCDF = SKP_Silk_pitch_contour_10_ms_iCDF;
+            }
         } else {
             psEnc->sCmn.nb_subfr = MAX_NB_SUBFR;
             psEnc->sPred.pitch_LPC_win_length = SKP_SMULBB( FIND_PITCH_LPC_WIN_MS, fs_kHz );
+            if( psEnc->sCmn.fs_kHz == 8 ) {
+                psEnc->sCmn.pitch_contour_iCDF = SKP_Silk_pitch_contour_NB_iCDF;
+            } else {
+                psEnc->sCmn.pitch_contour_iCDF = SKP_Silk_pitch_contour_iCDF; 
+            }
         }
-        /* Packet length changes. Reset LBRR buffer */
-        SKP_Silk_LBRR_reset( &psEnc->sCmn );
         psEnc->sCmn.PacketSize_ms = PacketSize_ms;
+        psEnc->sCmn.LBRR_nBytes = 0;
     }
 
     /* Set internal sampling frequency */
@@ -229,7 +215,7 @@
         SKP_memset( &psEnc->sPred,           0,                        sizeof( SKP_Silk_predict_state_FLP ) );
         SKP_memset( psEnc->sNSQ.xq,          0, 2 * MAX_FRAME_LENGTH * sizeof( SKP_int16 ) );
         SKP_memset( psEnc->sNSQ_LBRR.xq,     0, 2 * MAX_FRAME_LENGTH * sizeof( SKP_int16 ) );
-        SKP_memset( psEnc->sCmn.LBRR_buffer, 0,       MAX_LBRR_DELAY * sizeof( SKP_SILK_LBRR_struct ) );
+        SKP_memset( psEnc->sPred.prev_NLSFq, 0,        MAX_LPC_ORDER * sizeof( SKP_float ) );
 #if SWITCH_TRANSITION_FILTERING
         SKP_memset( psEnc->sCmn.sLP.In_LP_State, 0, 2 * sizeof( SKP_int32 ) );
         if( psEnc->sCmn.sLP.mode == 1 ) {
@@ -240,17 +226,14 @@
             psEnc->sCmn.sLP.transition_frame_no = 0;
         }
 #endif
+        psEnc->sCmn.LBRR_nBytes         = 0;
         psEnc->sCmn.inputBufIx          = 0;
         psEnc->sCmn.nFramesInPayloadBuf = 0;
         psEnc->sCmn.nBytesInPayloadBuf  = 0;
-        psEnc->sCmn.oldest_LBRR_idx     = 0;
         psEnc->sCmn.TargetRate_bps      = 0; /* Ensures that psEnc->SNR_dB is recomputed */
 
-        SKP_memset( psEnc->sPred.prev_NLSFq, 0, MAX_LPC_ORDER * sizeof( SKP_float ) );
-
         /* Initialize non-zero parameters */
         psEnc->sCmn.prevLag                 = 100;
-        psEnc->sCmn.prev_sigtype            = SIG_TYPE_UNVOICED;
         psEnc->sCmn.first_frame_after_reset = 1;
         psEnc->sPrefilt.lagPrev             = 100;
         psEnc->sShape.LastGainIndex         = 1;
@@ -299,22 +282,22 @@
             SKP_assert( 0 );
         }
         if( psEnc->sCmn.fs_kHz == 24 ) {
-            psEnc->sCmn.mu_LTP_Q10 = SKP_FIX_CONST( MU_LTP_QUANT_SWB, 10 );
+            psEnc->sCmn.mu_LTP_Q9 = SKP_FIX_CONST( MU_LTP_QUANT_SWB, 9 );
             psEnc->sCmn.bitrate_threshold_up    = SKP_int32_MAX;
             psEnc->sCmn.bitrate_threshold_down  = SWB2WB_BITRATE_BPS; 
             psEnc->sCmn.pitch_lag_low_bits_iCDF = SKP_Silk_uniform12_iCDF;
         } else if( psEnc->sCmn.fs_kHz == 16 ) {
-            psEnc->sCmn.mu_LTP_Q10 = SKP_FIX_CONST( MU_LTP_QUANT_WB, 10 );
+            psEnc->sCmn.mu_LTP_Q9 = SKP_FIX_CONST( MU_LTP_QUANT_WB, 9 );
             psEnc->sCmn.bitrate_threshold_up    = WB2SWB_BITRATE_BPS;
             psEnc->sCmn.bitrate_threshold_down  = WB2MB_BITRATE_BPS; 
             psEnc->sCmn.pitch_lag_low_bits_iCDF = SKP_Silk_uniform8_iCDF;
         } else if( psEnc->sCmn.fs_kHz == 12 ) {
-            psEnc->sCmn.mu_LTP_Q10 = SKP_FIX_CONST( MU_LTP_QUANT_MB, 10 );
+            psEnc->sCmn.mu_LTP_Q9 = SKP_FIX_CONST( MU_LTP_QUANT_MB, 9 );
             psEnc->sCmn.bitrate_threshold_up    = MB2WB_BITRATE_BPS;
             psEnc->sCmn.bitrate_threshold_down  = MB2NB_BITRATE_BPS;
             psEnc->sCmn.pitch_lag_low_bits_iCDF = SKP_Silk_uniform6_iCDF;
         } else if( psEnc->sCmn.fs_kHz == 8 ) {
-            psEnc->sCmn.mu_LTP_Q10 = SKP_FIX_CONST( MU_LTP_QUANT_NB, 10 );
+            psEnc->sCmn.mu_LTP_Q9 = SKP_FIX_CONST( MU_LTP_QUANT_NB, 9 );
             psEnc->sCmn.bitrate_threshold_up    = NB2MB_BITRATE_BPS;
             psEnc->sCmn.bitrate_threshold_down  = 0;
             psEnc->sCmn.pitch_lag_low_bits_iCDF = SKP_Silk_uniform4_iCDF;
--- a/src_FLP/SKP_Silk_encode_frame_FLP.c
+++ b/src_FLP/SKP_Silk_encode_frame_FLP.c
@@ -33,8 +33,7 @@
 /****************/
 SKP_int SKP_Silk_encode_frame_FLP( 
     SKP_Silk_encoder_state_FLP      *psEnc,             /* I/O  Encoder state FLP                       */
-    SKP_int32                       *pnBytesOut,        /* I/O  Number of payload bytes                 */
-                                                        /*      input: max length; output: used         */
+    SKP_int32                       *pnBytesOut,        /*   O  Number of payload bytes                 */
     ec_enc                          *psRangeEnc,        /* I/O  compressor data structure               */
     const SKP_int16                 *pIn                /* I    Input speech frame                      */
 )
@@ -46,12 +45,8 @@
     SKP_int16   pIn_HP_LP[ MAX_FRAME_LENGTH ];
     SKP_float   xfw[       MAX_FRAME_LENGTH ];
     SKP_float   res_pitch[ 2 * MAX_FRAME_LENGTH + LA_PITCH_MAX ];
-    SKP_int     LBRR_idx, frame_terminator;
+    SKP_int     frame_terminator;
 
-    /* Low bitrate redundancy parameters */
-    SKP_uint8   LBRRpayload[ MAX_ARITHM_BYTES ];
-    SKP_int16   nBytesLBRR;
-
 TIC(ENCODE_FRAME)
 
     sEncCtrl.sCmn.Seed = psEnc->sCmn.frameCounter++ & 3;
@@ -69,6 +64,25 @@
     SKP_Silk_VAD_FLP( psEnc, &sEncCtrl, pIn );
 TOC(VAD)
 
+    /**************************************************/
+    /* Convert speech activity into VAD and DTX flags */
+    /**************************************************/
+    if( psEnc->speech_activity < SPEECH_ACTIVITY_DTX_THRES ) {
+        sEncCtrl.sCmn.signalType = TYPE_NO_VOICE_ACTIVITY;
+        psEnc->sCmn.noSpeechCounter++;
+        if( psEnc->sCmn.noSpeechCounter > NO_SPEECH_FRAMES_BEFORE_DTX ) {
+            psEnc->sCmn.inDTX = 1;
+        }
+        if( psEnc->sCmn.noSpeechCounter > MAX_CONSECUTIVE_DTX ) {
+            psEnc->sCmn.noSpeechCounter = 0;
+            psEnc->sCmn.inDTX           = 0;
+        }
+    } else {
+        psEnc->sCmn.noSpeechCounter = 0;
+        psEnc->sCmn.inDTX           = 0;
+        sEncCtrl.sCmn.signalType = TYPE_UNVOICED;
+    }
+
     /*******************************************/
     /* High-pass filtering of the input signal */
     /*******************************************/
@@ -133,14 +147,15 @@
     SKP_Silk_process_gains_FLP( psEnc, &sEncCtrl );
 TOC(PROCESS_GAINS)
     
-    psEnc->sCmn.sigtype[         psEnc->sCmn.nFramesInPayloadBuf ] = sEncCtrl.sCmn.sigtype;
-    psEnc->sCmn.QuantOffsetType[ psEnc->sCmn.nFramesInPayloadBuf ] = sEncCtrl.sCmn.QuantOffsetType;
+    psEnc->sCmn.quantOffsetType[ psEnc->sCmn.nFramesInPayloadBuf ] = sEncCtrl.sCmn.quantOffsetType;
+    psEnc->sCmn.signalType[      psEnc->sCmn.nFramesInPayloadBuf ] = sEncCtrl.sCmn.signalType;
+
     /****************************************/
     /* Low Bitrate Redundant Encoding       */
     /****************************************/
-    nBytesLBRR = MAX_ARITHM_BYTES;
+    psEnc->sCmn.LBRR_nBytes = MAX_ARITHM_BYTES;
 TIC(LBRR)
-    //SKP_Silk_LBRR_encode_FLP( psEnc, &sEncCtrl, LBRRpayload, &nBytesLBRR, xfw );
+    //SKP_Silk_LBRR_encode_FLP( psEnc, &sEncCtrl, psEnc->sCmn.LBRR_payload, &psEnc->sCmn.LBRR_nBytes, xfw );
 TOC(LBRR)
 
     /*****************************************/
@@ -150,25 +165,6 @@
     SKP_Silk_NSQ_wrapper_FLP( psEnc, &sEncCtrl, xfw, &psEnc->sCmn.q[ psEnc->sCmn.nFramesInPayloadBuf * psEnc->sCmn.frame_length ], 0 );
 TOC(NSQ)
 
-    /**************************************************/
-    /* Convert speech activity into VAD and DTX flags */
-    /**************************************************/
-    if( psEnc->speech_activity < SPEECH_ACTIVITY_DTX_THRES ) {
-        psEnc->sCmn.vadFlag = NO_VOICE_ACTIVITY;
-        psEnc->sCmn.noSpeechCounter++;
-        if( psEnc->sCmn.noSpeechCounter > NO_SPEECH_FRAMES_BEFORE_DTX ) {
-            psEnc->sCmn.inDTX = 1;
-        }
-        if( psEnc->sCmn.noSpeechCounter > MAX_CONSECUTIVE_DTX ) {
-            psEnc->sCmn.noSpeechCounter = 0;
-            psEnc->sCmn.inDTX           = 0;
-        }
-    } else {
-        psEnc->sCmn.noSpeechCounter = 0;
-        psEnc->sCmn.inDTX           = 0;
-        psEnc->sCmn.vadFlag         = VOICE_ACTIVITY;
-    }
-
     /****************************************/
     /* Initialize range coder               */
     /****************************************/
@@ -180,7 +176,7 @@
     /* Encode Parameters                    */
     /****************************************/
 TIC(ENCODE_PARAMS)
-    SKP_Silk_encode_parameters( &psEnc->sCmn, &sEncCtrl.sCmn, psRangeEnc );
+    SKP_Silk_encode_indices( &psEnc->sCmn, &sEncCtrl.sCmn, psRangeEnc );
 TOC(ENCODE_PARAMS)
 
     /****************************************/
@@ -191,26 +187,18 @@
         ( psEnc->sCmn.ltp_mem_length + LA_SHAPE_MS * psEnc->sCmn.fs_kHz ) * sizeof( SKP_float ) );
     
     /* Parameters needed for next frame */
-    psEnc->sCmn.prev_sigtype            = sEncCtrl.sCmn.sigtype;
+    psEnc->sCmn.prevSignalType          = sEncCtrl.sCmn.signalType;
     psEnc->sCmn.prevLag                 = sEncCtrl.sCmn.pitchL[ psEnc->sCmn.nb_subfr - 1 ];
     psEnc->sCmn.first_frame_after_reset = 0;
+    psEnc->sCmn.nFramesInPayloadBuf++;
 
-    if( 0 ) { //psEnc->sCmn.sRC.error ) {
-        /* Encoder returned error: Clear payload buffer */
-        psEnc->sCmn.nFramesInPayloadBuf = 0;
-    } else {
-        psEnc->sCmn.nFramesInPayloadBuf++;
-    }
-
     /****************************************/
     /* Finalize payload and copy to output  */
     /****************************************/
     if( psEnc->sCmn.nFramesInPayloadBuf * SUB_FRAME_LENGTH_MS * psEnc->sCmn.nb_subfr >= psEnc->sCmn.PacketSize_ms ) {
 
-        LBRR_idx = ( psEnc->sCmn.oldest_LBRR_idx + 1 ) & LBRR_IDX_MASK;
-
         /* Check if FEC information should be added */
-        //frame_terminator = psEnc->sCmn.LBRR_buffer[ LBRR_idx ].usage;
+        //frame_terminator = psEnc->sCmn.LBRR_usage;
         frame_terminator = SKP_SILK_NO_LBRR;
 
         /* Add the frame termination info to stream */
@@ -218,57 +206,14 @@
 
         /* Code excitation signal */
         for( i = 0; i < psEnc->sCmn.nFramesInPayloadBuf; i++ ) {
-            SKP_Silk_encode_pulses( psRangeEnc, psEnc->sCmn.sigtype[ i ], psEnc->sCmn.QuantOffsetType[ i ], 
+            SKP_Silk_encode_pulses( psRangeEnc, psEnc->sCmn.signalType[ i ], psEnc->sCmn.quantOffsetType[ i ], 
                 &psEnc->sCmn.q[ i * psEnc->sCmn.frame_length ], psEnc->sCmn.frame_length );
         }
 
         /* Payload length so far */
         nBytes = SKP_RSHIFT( ec_enc_tell( psRangeEnc, 0 ) + 7, 3 );
+        *pnBytesOut = nBytes;
 
-        /* Check that there is enough space in external output buffer, and move data */
-        if( *pnBytesOut >= nBytes ) {
-            //SKP_int bits_in_stream, mask;
-            //bits_in_stream = ec_enc_tell( psRangeEnc, 0 );
-            //ec_enc_done( psRangeEnc );
-            
-#if 0
-            /* Fill up any remaining bits in the last byte with 1s */
-            if( bits_in_stream & 7 ) {
-                mask = SKP_RSHIFT( 0xFF, bits_in_stream & 7 );
-                if( nBytes - 1 < *pnBytesOut ) {
-                    psEnc->sCmn.sRC.range_enc_celt_state.buf->buf[ nBytes - 1 ] |= mask;
-                }
-            }
-            SKP_memcpy( pCode, psEnc->sCmn.sRC.range_enc_celt_state.buf->buf, nBytes * sizeof( SKP_uint8 ) );
-#endif
-
-#if 0
-            if( frame_terminator > SKP_SILK_MORE_FRAMES && 
-                    *pnBytesOut >= nBytes + psEnc->sCmn.LBRR_buffer[ LBRR_idx ].nBytes ) {
-                /* Get old packet and add to payload. */
-                SKP_memcpy( &pCode[ nBytes ],
-                    psEnc->sCmn.LBRR_buffer[ LBRR_idx ].payload,
-                    psEnc->sCmn.LBRR_buffer[ LBRR_idx ].nBytes * sizeof( SKP_uint8 ) );
-                nBytes += psEnc->sCmn.LBRR_buffer[ LBRR_idx ].nBytes;
-            }
-#endif
-            *pnBytesOut = nBytes;
-
-            /* Update FEC buffer */
-            SKP_memcpy( psEnc->sCmn.LBRR_buffer[ psEnc->sCmn.oldest_LBRR_idx ].payload, LBRRpayload, 
-                nBytesLBRR * sizeof( SKP_uint8 ) );
-            psEnc->sCmn.LBRR_buffer[ psEnc->sCmn.oldest_LBRR_idx ].nBytes = nBytesLBRR;
-            /* The line below describes how FEC should be used */
-            psEnc->sCmn.LBRR_buffer[ psEnc->sCmn.oldest_LBRR_idx ].usage = sEncCtrl.sCmn.LBRR_usage;
-            psEnc->sCmn.oldest_LBRR_idx = ( psEnc->sCmn.oldest_LBRR_idx + 1 ) & LBRR_IDX_MASK;
-
-        } else {
-            /* Not enough space: Payload will be discarded */
-            *pnBytesOut = 0;
-            nBytes      = 0;
-            ret = SKP_SILK_ENC_PAYLOAD_BUF_TOO_SHORT;
-        }
-
         /* Reset the number of frames in payload buffer */
         psEnc->sCmn.nFramesInPayloadBuf = 0;
     } else {
@@ -283,11 +228,6 @@
             &psEnc->sCmn.q[ psEnc->sCmn.nFramesInPayloadBuf * psEnc->sCmn.frame_length ] );
     }
 
-    /* Check for arithmetic coder errors */
-    if( 0 ) { //psEnc->sCmn.sRC.error ) {
-        ret = SKP_SILK_ENC_INTERNAL_ERROR;
-    }
-
     /* Simulate number of ms buffered in channel because of exceeding TargetRate */
     psEnc->BufferedInChannel_ms   += ( 8.0f * 1000.0f * ( nBytes - psEnc->sCmn.nBytesInPayloadBuf ) ) / psEnc->sCmn.TargetRate_bps;
     psEnc->BufferedInChannel_ms   -= SKP_SMULBB( SUB_FRAME_LENGTH_MS, psEnc->sCmn.nb_subfr );
@@ -311,10 +251,10 @@
     DEBUG_STORE_DATA( gains_indices.dat,        &sEncCtrl.sCmn.GainsIndices,             psEnc->sCmn.nb_subfr * sizeof( SKP_int   ) );
     DEBUG_STORE_DATA( nBytes.dat,               &nBytes,                                                        sizeof( SKP_int   ) );
     DEBUG_STORE_DATA( current_SNR_db.dat,       &sEncCtrl.current_SNR_dB,                                       sizeof( SKP_float ) );
-    DEBUG_STORE_DATA( QuantOffsetType.dat,      &sEncCtrl.sCmn.QuantOffsetType,                                 sizeof( SKP_int   ) );
+    DEBUG_STORE_DATA( quantOffsetType.dat,      &sEncCtrl.sCmn.quantOffsetType,                                 sizeof( SKP_int   ) );
     DEBUG_STORE_DATA( speech_activity.dat,      &psEnc->speech_activity,                                        sizeof( SKP_float ) );
     DEBUG_STORE_DATA( input_quality_bands.dat,  sEncCtrl.input_quality_bands,                     VAD_N_BANDS * sizeof( SKP_float ) );
-    DEBUG_STORE_DATA( sigtype.dat,              &sEncCtrl.sCmn.sigtype,                                         sizeof( SKP_int   ) ); 
+    DEBUG_STORE_DATA( signalType.dat,           &sEncCtrl.sCmn.signalType,                                      sizeof( SKP_int   ) ); 
     DEBUG_STORE_DATA( ratelevel.dat,            &sEncCtrl.sCmn.RateLevelIndex,                                  sizeof( SKP_int   ) ); 
     DEBUG_STORE_DATA( lag_index.dat,            &sEncCtrl.sCmn.lagIndex,                                        sizeof( SKP_int   ) ); 
     DEBUG_STORE_DATA( contour_index.dat,        &sEncCtrl.sCmn.contourIndex,                                    sizeof( SKP_int   ) ); 
@@ -326,8 +266,8 @@
     return( ret );
 }
 
-#if 0  //tmp
-/* Low Bitrate Redundancy (LBRR) encoding. Reuse all parameters but encode with lower bitrate           */
+#if 0
+/* Low-Bitrate Redundancy (LBRR) encoding. Reuse all parameters but encode with lower bitrate           */
 void SKP_Silk_LBRR_encode_FLP(
     SKP_Silk_encoder_state_FLP      *psEnc,             /* I/O  Encoder state FLP                       */
     SKP_Silk_encoder_control_FLP    *psEncCtrl,         /* I/O  Encoder control FLP                     */
@@ -346,9 +286,13 @@
     /*******************************************/
     /* Control use of inband LBRR              */
     /*******************************************/
-    SKP_Silk_LBRR_ctrl_FLP( psEnc, &psEncCtrl->sCmn );
-
+    psEnc->sCmn.LBRR_usage = SKP_SILK_NO_LBRR;
     if( psEnc->sCmn.LBRR_enabled ) {
+        /* Control LBRR based on sensitivity and packet loss caracteristics */
+        if( psEnc->speech_activity > LBRR_SPEECH_ACTIVITY_THRES && psEnc->sCmn.PacketLoss_perc > LBRR_LOSS_THRES ) {
+            psEnc->sCmn.LBRR_usage = SKP_SILK_LBRR;
+        }
+
         /* Save original gains */
         SKP_memcpy( TempGainsIndices, psEncCtrl->sCmn.GainsIndices, MAX_NB_SUBFR * sizeof( SKP_int   ) );
         SKP_memcpy( TempGains,        psEncCtrl->Gains,             MAX_NB_SUBFR * sizeof( SKP_float ) );
@@ -369,7 +313,7 @@
             SKP_assert( 0 );
         }
 
-        if( psEnc->sCmn.Complexity > 0 && psEnc->sCmn.TargetRate_bps > Rate_only_parameters ) {
+        if( psEnc->sCmn.Complexity >= 4 && psEnc->sCmn.TargetRate_bps > Rate_only_parameters ) {
             if( psEnc->sCmn.nFramesInPayloadBuf == 0 ) {
                 /* First frame in packet copy everything */
                 SKP_memcpy( &psEnc->sNSQ_LBRR, &psEnc->sNSQ, sizeof( SKP_Silk_nsq_state ) );
@@ -409,7 +353,7 @@
         /****************************************/
         /* Encode Parameters                    */
         /****************************************/
-        SKP_Silk_encode_parameters( &psEnc->sCmn, &psEncCtrl->sCmn, &psEnc->sCmn.sRC_LBRR );
+        SKP_Silk_encode_indices( &psEnc->sCmn, &psEncCtrl->sCmn, &psEnc->sCmn.sRC_LBRR );
 
         if( psEnc->sCmn.sRC_LBRR.error ) {
             /* Encoder returned error: Clear payload buffer */
@@ -434,7 +378,7 @@
             /* Encode quantization indices of excitation */
             /*********************************************/
             for( i = 0; i < nFramesInPayloadBuf; i++ ) {
-                SKP_Silk_encode_pulses( &psEnc->sCmn.sRC_LBRR, psEnc->sCmn.sigtype[ i ], psEnc->sCmn.QuantOffsetType[ i ],
+                SKP_Silk_encode_pulses( &psEnc->sCmn.sRC_LBRR, psEnc->sCmn.signalType[ i ], psEnc->sCmn.quantOffsetType[ i ],
                     &psEnc->sCmn.q_LBRR[ i * psEnc->sCmn.frame_length ], psEnc->sCmn.frame_length );
             }
 
--- a/src_FLP/SKP_Silk_find_pitch_lags_FLP.c
+++ b/src_FLP/SKP_Silk_find_pitch_lags_FLP.c
@@ -101,17 +101,24 @@
     SKP_Silk_LPC_analysis_filter_FLP( res, A, x_buf, buf_len, psEnc->sCmn.pitchEstimationLPCOrder );
     SKP_memset( res, 0, psEnc->sCmn.pitchEstimationLPCOrder * sizeof( SKP_float ) );
 
-    /* Threshold for pitch estimator */
-    thrhld  = 0.45f;
-    thrhld -= 0.004f * psEnc->sCmn.pitchEstimationLPCOrder;
-    thrhld -= 0.1f   * psEnc->speech_activity;
-    thrhld += 0.15f  * psEnc->sCmn.prev_sigtype;
-    thrhld -= 0.1f   * psEncCtrl->input_tilt;
+    if( psEncCtrl->sCmn.signalType != TYPE_NO_VOICE_ACTIVITY ) {
+        /* Threshold for pitch estimator */
+        thrhld  = 0.6f;
+        thrhld -= 0.004f * psEnc->sCmn.pitchEstimationLPCOrder;
+        thrhld -= 0.1f   * psEnc->speech_activity;
+        thrhld -= 0.15f  * (psEnc->sCmn.prevSignalType >> 1);
+        thrhld -= 0.1f   * psEncCtrl->input_tilt;
 
-    /*****************************************/
-    /* Call Pitch estimator                  */
-    /*****************************************/
-    psEncCtrl->sCmn.sigtype = SKP_Silk_pitch_analysis_core_FLP( res, psEncCtrl->sCmn.pitchL, &psEncCtrl->sCmn.lagIndex, 
-        &psEncCtrl->sCmn.contourIndex, &psEnc->LTPCorr, psEnc->sCmn.prevLag, psEnc->sCmn.pitchEstimationThreshold_Q16 / 65536.0f,
-        thrhld, psEnc->sCmn.fs_kHz, psEnc->sCmn.pitchEstimationComplexity, psEnc->sCmn.nb_subfr );
+        /*****************************************/
+        /* Call Pitch estimator                  */
+        /*****************************************/
+        if( SKP_Silk_pitch_analysis_core_FLP( res, psEncCtrl->sCmn.pitchL, &psEncCtrl->sCmn.lagIndex, 
+            &psEncCtrl->sCmn.contourIndex, &psEnc->LTPCorr, psEnc->sCmn.prevLag, psEnc->sCmn.pitchEstimationThreshold_Q16 / 65536.0f,
+            thrhld, psEnc->sCmn.fs_kHz, psEnc->sCmn.pitchEstimationComplexity, psEnc->sCmn.nb_subfr ) == 0 ) 
+        {
+            psEncCtrl->sCmn.signalType = TYPE_VOICED;
+        } else {
+            psEncCtrl->sCmn.signalType = TYPE_UNVOICED;
+        }
+    }
 }
--- a/src_FLP/SKP_Silk_find_pred_coefs_FLP.c
+++ b/src_FLP/SKP_Silk_find_pred_coefs_FLP.c
@@ -50,7 +50,7 @@
         Wght[ i ]     = invGains[ i ] * invGains[ i ];
     }
 
-    if( psEncCtrl->sCmn.sigtype == SIG_TYPE_VOICED ) {
+    if( psEncCtrl->sCmn.signalType == TYPE_VOICED ) {
         /**********/
         /* VOICED */
         /**********/
@@ -68,7 +68,7 @@
 
         /* Quantize LTP gain parameters */
         SKP_Silk_quant_LTP_gains_FLP( psEncCtrl->LTPCoef, psEncCtrl->sCmn.LTPIndex, &psEncCtrl->sCmn.PERIndex, 
-            WLTP, psEnc->sCmn.mu_LTP_Q10, psEnc->sCmn.LTPQuantLowComplexity , psEnc->sCmn.nb_subfr );
+            WLTP, psEnc->sCmn.mu_LTP_Q9, psEnc->sCmn.LTPQuantLowComplexity , psEnc->sCmn.nb_subfr );
 
         /* Control LTP scaling */
         SKP_Silk_LTP_scale_ctrl_FLP( psEnc, psEncCtrl );
--- a/src_FLP/SKP_Silk_main_FLP.h
+++ b/src_FLP/SKP_Silk_main_FLP.h
@@ -85,7 +85,7 @@
     const SKP_int               PacketSize_ms,          /* I    Packet length (ms)                      */
     const SKP_int32             TargetRate_bps,         /* I    Target max bitrate (bps)                */
     const SKP_int               PacketLoss_perc,        /* I    Packet loss rate (in percent)           */
-    const SKP_int               Complexity              /* I    Complexity (0->low; 1->medium; 2->high) */
+    const SKP_int               Complexity              /* I    Complexity (0-10)                       */
 );
 
 /****************/
@@ -118,12 +118,6 @@
     const SKP_int                   order               /* I    Correlation order (even)                */
 );
 
-/* Control low bitrate redundancy usage */
-void SKP_Silk_LBRR_ctrl_FLP(
-    SKP_Silk_encoder_state_FLP      *psEnc,             /* I    Encoder state FLP                       */
-    SKP_Silk_encoder_control        *psEncCtrlC         /* I/O  Encoder control                         */
-);
-
 /* Calculation of LTP state scaling */
 void SKP_Silk_LTP_scale_ctrl_FLP(
     SKP_Silk_encoder_state_FLP      *psEnc,             /* I/O  Encoder state FLP                       */
@@ -204,46 +198,6 @@
     const SKP_float                 s[],                /* I    Input signal                            */
     const SKP_int                   length,             /* I    Length of input signal                  */
     const SKP_int                   Order               /* I    LPC order                               */
-);
-
-/* 16th order LPC analysis filter, does not write first 16 samples */
-void SKP_Silk_LPC_analysis_filter16_FLP(
-          SKP_float                 r_LPC[],            /* O    LPC residual signal                     */
-    const SKP_float                 PredCoef[],         /* I    LPC coefficients                        */
-    const SKP_float                 s[],                /* I    Input signal                            */
-    const SKP_int                   length              /* I    Length of input signal                  */
-);
-
-/* 12th order LPC analysis filter, does not write first 12 samples */
-void SKP_Silk_LPC_analysis_filter12_FLP(
-          SKP_float                 r_LPC[],            /* O    LPC residual signal                     */
-    const SKP_float                 PredCoef[],         /* I    LPC coefficients                        */
-    const SKP_float                 s[],                /* I    Input signal                            */
-    const SKP_int                   length              /* I    Length of input signal                  */
-);
-
-/* 10th order LPC analysis filter, does not write first 10 samples */
-void SKP_Silk_LPC_analysis_filter10_FLP(
-          SKP_float                 r_LPC[],            /* O    LPC residual signal                     */
-    const SKP_float                 PredCoef[],         /* I    LPC coefficients                        */
-    const SKP_float                 s[],                /* I    Input signal                            */
-    const SKP_int                   length              /* I    Length of input signal                  */
-);
-
-/* 8th order LPC analysis filter, does not write first 8 samples */
-void SKP_Silk_LPC_analysis_filter8_FLP(
-          SKP_float                 r_LPC[],            /* O    LPC residual signal                     */
-    const SKP_float                 PredCoef[],         /* I    LPC coefficients                        */
-    const SKP_float                 s[],                /* I    Input signal                            */
-    const SKP_int                   length              /* I    Length of input signal                  */
-);
-
-/* 6th order LPC analysis filter, does not write first 6 samples */
-void SKP_Silk_LPC_analysis_filter6_FLP(
-          SKP_float                 r_LPC[],            /* O    LPC residual signal                     */
-    const SKP_float                 PredCoef[],         /* I    LPC coefficients                        */
-    const SKP_float                 s[],                /* I    Input signal                            */
-    const SKP_int                   length              /* I    Length of input signal                  */
 );
 
 /* LTP tap quantizer */
--- a/src_FLP/SKP_Silk_noise_shape_analysis_FLP.c
+++ b/src_FLP/SKP_Silk_noise_shape_analysis_FLP.c
@@ -170,7 +170,7 @@
         SNR_adj_dB -= BG_SNR_DECR_dB * psEncCtrl->coding_quality * ( 0.5f + 0.5f * psEncCtrl->input_quality ) * b * b;
     }
 
-    if( psEncCtrl->sCmn.sigtype == SIG_TYPE_VOICED ) {
+    if( psEncCtrl->sCmn.signalType == TYPE_VOICED ) {
         /* Reduce gains for periodic signals */
         SNR_adj_dB += HARM_SNR_INCR_dB * psEnc->LTPCorr;
     } else { 
@@ -182,9 +182,9 @@
     /* SPARSENESS PROCESSING */
     /*************************/
     /* Set quantizer offset */
-    if( psEncCtrl->sCmn.sigtype == SIG_TYPE_VOICED ) {
+    if( psEncCtrl->sCmn.signalType == TYPE_VOICED ) {
         /* Initally set to 0; may be overruled in process_gains(..) */
-        psEncCtrl->sCmn.QuantOffsetType = 0;
+        psEncCtrl->sCmn.quantOffsetType = 0;
         psEncCtrl->sparseness = 0.0f;
     } else {
         /* Sparseness measure, based on relative fluctuations of energy per 2 milliseconds */
@@ -205,9 +205,9 @@
 
         /* Set quantization offset depending on sparseness measure */
         if( psEncCtrl->sparseness > SPARSENESS_THRESHOLD_QNT_OFFSET ) {
-            psEncCtrl->sCmn.QuantOffsetType = 0;
+            psEncCtrl->sCmn.quantOffsetType = 0;
         } else {
-            psEncCtrl->sCmn.QuantOffsetType = 1;
+            psEncCtrl->sCmn.quantOffsetType = 1;
         }
         
         /* Increase coding SNR for sparse signals */
@@ -316,7 +316,7 @@
     /* Less low frequency shaping for noisy inputs */
     strength = LOW_FREQ_SHAPING * ( 1.0f + LOW_QUALITY_LOW_FREQ_SHAPING_DECR * ( psEncCtrl->input_quality_bands[ 0 ] - 1.0f ) );
     strength *= psEnc->speech_activity;
-    if( psEncCtrl->sCmn.sigtype == SIG_TYPE_VOICED ) {
+    if( psEncCtrl->sCmn.signalType == TYPE_VOICED ) {
         /* Reduce low frequencies quantization noise for periodic signals, depending on pitch lag */
         /*f = 400; freqz([1, -0.98 + 2e-4 * f], [1, -0.97 + 7e-4 * f], 2^12, Fs); axis([0, 1000, -10, 1])*/
         for( k = 0; k < psEnc->sCmn.nb_subfr; k++ ) {
@@ -346,7 +346,7 @@
     /* More harmonic boost for noisy input signals */
     HarmBoost += LOW_INPUT_QUALITY_HARMONIC_BOOST * ( 1.0f - psEncCtrl->input_quality );
 
-    if( USE_HARM_SHAPING && psEncCtrl->sCmn.sigtype == SIG_TYPE_VOICED ) {
+    if( USE_HARM_SHAPING && psEncCtrl->sCmn.signalType == TYPE_VOICED ) {
         /* Harmonic noise shaping */
         HarmShapeGain = HARMONIC_SHAPING;
 
--- a/src_FLP/SKP_Silk_prefilter_FLP.c
+++ b/src_FLP/SKP_Silk_prefilter_FLP.c
@@ -110,7 +110,7 @@
     lag = P->lagPrev;
     for( k = 0; k < psEnc->sCmn.nb_subfr; k++ ) {
         /* Update Variables that change per sub frame */
-        if( psEncCtrl->sCmn.sigtype == SIG_TYPE_VOICED ) {
+        if( psEncCtrl->sCmn.signalType == TYPE_VOICED ) {
             lag = psEncCtrl->sCmn.pitchL[ k ];
         }
 
--- a/src_FLP/SKP_Silk_process_NLSFs_FLP.c
+++ b/src_FLP/SKP_Silk_process_NLSFs_FLP.c
@@ -45,12 +45,10 @@
     SKP_float   pNLSFW0_temp[ MAX_LPC_ORDER ];
     SKP_int     i;
 
-    SKP_assert( psEncCtrl->sCmn.sigtype == SIG_TYPE_VOICED || psEncCtrl->sCmn.sigtype == SIG_TYPE_UNVOICED );
-
     /***********************/
     /* Calculate mu values */
     /***********************/
-    if( psEncCtrl->sCmn.sigtype == SIG_TYPE_VOICED ) {
+    if( psEncCtrl->sCmn.signalType == TYPE_VOICED ) {
         NLSF_mu          = 0.002f - 0.001f * psEnc->speech_activity;
         NLSF_mu_fluc_red = 0.1f   - 0.05f  * psEnc->speech_activity;
     } else { 
@@ -81,7 +79,7 @@
     }
 
     /* Set pointer to the NLSF codebook for the current signal type and LPC order */
-    psNLSF_CB = psEnc->sCmn.psNLSF_CB[ psEncCtrl->sCmn.sigtype ];
+    psNLSF_CB = psEnc->sCmn.psNLSF_CB[ 1 - (psEncCtrl->sCmn.signalType >> 1) ];
 
     /* Quantize NLSF parameters given the trained NLSF codebooks */
     SKP_Silk_NLSF_MSVQ_encode_FLP( psEncCtrl->sCmn.NLSFIndices, pNLSF, psNLSF_CB, psEnc->sPred.prev_NLSFq, pNLSFW, NLSF_mu, 
--- a/src_FLP/SKP_Silk_process_gains_FLP.c
+++ b/src_FLP/SKP_Silk_process_gains_FLP.c
@@ -40,7 +40,7 @@
     SKP_float   s, InvMaxSqrVal, gain, quant_offset;
 
     /* Gain reduction when LTP coding gain is high */
-    if( psEncCtrl->sCmn.sigtype == SIG_TYPE_VOICED ) {
+    if( psEncCtrl->sCmn.signalType == TYPE_VOICED ) {
         s = 1.0f - 0.5f * SKP_sigmoid( 0.25f * ( psEncCtrl->LTPredCodGain - 12.0f ) );
         for( k = 0; k < psEnc->sCmn.nb_subfr; k++ ) {
             psEncCtrl->Gains[ k ] *= s;
@@ -72,16 +72,16 @@
     }
 
     /* Set quantizer offset for voiced signals. Larger offset when LTP coding gain is low or tilt is high (ie low-pass) */
-    if( psEncCtrl->sCmn.sigtype == SIG_TYPE_VOICED ) {
+    if( psEncCtrl->sCmn.signalType == TYPE_VOICED ) {
         if( psEncCtrl->LTPredCodGain + psEncCtrl->input_tilt > 1.0f ) {
-            psEncCtrl->sCmn.QuantOffsetType = 0;
+            psEncCtrl->sCmn.quantOffsetType = 0;
         } else {
-            psEncCtrl->sCmn.QuantOffsetType = 1;
+            psEncCtrl->sCmn.quantOffsetType = 1;
         }
     }
 
     /* Quantizer boundary adjustment */
-    quant_offset = SKP_Silk_Quantization_Offsets_Q10[ psEncCtrl->sCmn.sigtype ][ psEncCtrl->sCmn.QuantOffsetType ] / 1024.0f;
+    quant_offset = SKP_Silk_Quantization_Offsets_Q10[ psEncCtrl->sCmn.signalType >> 1 ][ psEncCtrl->sCmn.quantOffsetType ] / 1024.0f;
     psEncCtrl->Lambda = LAMBDA_OFFSET 
                       + LAMBDA_DELAYED_DECISIONS * psEnc->sCmn.nStatesDelayedDecision
                       + LAMBDA_SPEECH_ACT        * psEnc->speech_activity 
--- a/src_FLP/SKP_Silk_wrappers_FLP.c
+++ b/src_FLP/SKP_Silk_wrappers_FLP.c
@@ -211,7 +211,7 @@
         }
     }
 
-    if( psEncCtrl->sCmn.sigtype == SIG_TYPE_VOICED ) {
+    if( psEncCtrl->sCmn.signalType == TYPE_VOICED ) {
         LTP_scale_Q14 = SKP_Silk_LTPScales_table_Q14[ psEncCtrl->sCmn.LTP_scaleIndex ];
     } else {
         LTP_scale_Q14 = 0;
--- a/src_common/SKP_Silk_LBRR_reset.c
+++ /dev/null
@@ -1,40 +1,0 @@
-/***********************************************************************
-Copyright (c) 2006-2010, Skype Limited. All rights reserved. 
-Redistribution and use in source and binary forms, with or without 
-modification, (subject to the limitations in the disclaimer below) 
-are permitted provided that the following conditions are met:
-- Redistributions of source code must retain the above copyright notice,
-this list of conditions and the following disclaimer.
-- Redistributions in binary form must reproduce the above copyright 
-notice, this list of conditions and the following disclaimer in the 
-documentation and/or other materials provided with the distribution.
-- Neither the name of Skype Limited, nor the names of specific 
-contributors, may be used to endorse or promote products derived from 
-this software without specific prior written permission.
-NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED 
-BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 
-CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
-BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 
-FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-***********************************************************************/
-
-#include "SKP_Silk_main.h"
-
-/* Resets LBRR buffer, used if packet size changes */
-void SKP_Silk_LBRR_reset( 
-    SKP_Silk_encoder_state      *psEncC             /* I/O  state                                       */
-)
-{
-    SKP_int i;
-
-    for( i = 0; i < MAX_LBRR_DELAY; i++ ) {
-        psEncC->LBRR_buffer[ i ].usage = SKP_SILK_NO_LBRR;
-    }
-}
--- a/src_common/SKP_Silk_NSQ.c
+++ b/src_common/SKP_Silk_NSQ.c
@@ -43,7 +43,7 @@
 
 SKP_INLINE void SKP_Silk_noise_shape_quantizer(
     SKP_Silk_nsq_state  *NSQ,               /* I/O  NSQ state                       */
-    SKP_int             sigtype,            /* I    Signal type                     */
+    SKP_int             signalType,         /* I    Signal type                     */
     const SKP_int32     x_sc_Q10[],         /* I                                    */
     SKP_int8            q[],                /* O                                    */
     SKP_int16           xq[],               /* O                                    */
@@ -118,7 +118,7 @@
 
     SKP_assert( NSQ->prev_inv_gain_Q16 != 0 );
 
-    offset_Q10 = SKP_Silk_Quantization_Offsets_Q10[ psEncCtrlC->sigtype ][ psEncCtrlC->QuantOffsetType ];
+    offset_Q10 = SKP_Silk_Quantization_Offsets_Q10[ psEncCtrlC->signalType >> 1 ][ psEncCtrlC->quantOffsetType ];
 
     if( LSFInterpFactor_Q2 == ( 1 << 2 ) ) {
         LSF_interpolation_flag = 0;
@@ -141,7 +141,7 @@
         HarmShapeFIRPacked_Q14 |= SKP_LSHIFT( ( SKP_int32 )SKP_RSHIFT( HarmShapeGain_Q14[ k ], 1 ), 16 );
 
         NSQ->rewhite_flag = 0;
-        if( psEncCtrlC->sigtype == SIG_TYPE_VOICED ) {
+        if( psEncCtrlC->signalType == TYPE_VOICED ) {
             /* Voiced */
             lag = psEncCtrlC->pitchL[ k ];
 
@@ -164,7 +164,7 @@
         SKP_Silk_nsq_scale_states( psEncC, NSQ, x, x_sc_Q10, psEncC->subfr_length, sLTP, 
             sLTP_Q16, k, LTP_scale_Q14, Gains_Q16, psEncCtrlC->pitchL );
 
-        SKP_Silk_noise_shape_quantizer( NSQ, psEncCtrlC->sigtype, x_sc_Q10, q, pxq, sLTP_Q16, A_Q12, B_Q14, 
+        SKP_Silk_noise_shape_quantizer( NSQ, psEncCtrlC->signalType, x_sc_Q10, q, pxq, sLTP_Q16, A_Q12, B_Q14, 
             AR_shp_Q13, lag, HarmShapeFIRPacked_Q14, Tilt_Q14[ k ], LF_shp_Q14[ k ], Gains_Q16[ k ], Lambda_Q10, 
             offset_Q10, psEncC->subfr_length, psEncC->shapingLPCOrder, psEncC->predictLPCOrder
 #ifdef SAVE_ALL_INTERNAL_DATA
@@ -204,7 +204,7 @@
 /***********************************/
 SKP_INLINE void SKP_Silk_noise_shape_quantizer(
     SKP_Silk_nsq_state  *NSQ,               /* I/O  NSQ state                       */
-    SKP_int             sigtype,            /* I    Signal type                     */
+    SKP_int             signalType,         /* I    Signal type                     */
     const SKP_int32     x_sc_Q10[],         /* I                                    */
     SKP_int8            q[],                /* O                                    */
     SKP_int16           xq[],               /* O                                    */
@@ -278,7 +278,7 @@
         }
 
         /* Long-term prediction */
-        if( sigtype == SIG_TYPE_VOICED ) {
+        if( signalType == TYPE_VOICED ) {
             /* Unrolled loop */
             LTP_pred_Q14 = SKP_SMULWB(               pred_lag_ptr[  0 ], b_Q14[ 0 ] );
             LTP_pred_Q14 = SKP_SMLAWB( LTP_pred_Q14, pred_lag_ptr[ -1 ], b_Q14[ 1 ] );
@@ -313,7 +313,7 @@
         n_LF_Q10 = SKP_LSHIFT( SKP_SMULWB( NSQ->sLTP_shp_Q10[ NSQ->sLTP_shp_buf_idx - 1 ], LF_shp_Q14 ), 2 ); 
         n_LF_Q10 = SKP_SMLAWT( n_LF_Q10, NSQ->sLF_AR_shp_Q12, LF_shp_Q14 );
 
-        SKP_assert( lag > 0 || sigtype == SIG_TYPE_UNVOICED );
+        SKP_assert( lag > 0 || signalType != TYPE_VOICED );
 
         /* Long-term shaping */
         if( lag > 0 ) {
--- a/src_common/SKP_Silk_NSQ_del_dec.c
+++ b/src_common/SKP_Silk_NSQ_del_dec.c
@@ -80,7 +80,7 @@
 SKP_INLINE void SKP_Silk_noise_shape_quantizer_del_dec(
     SKP_Silk_nsq_state  *NSQ,                   /* I/O  NSQ state                           */
     NSQ_del_dec_struct  psDelDec[],             /* I/O  Delayed decision states             */
-    SKP_int             sigtype,                /* I    Signal type                         */
+    SKP_int             signalType,             /* I    Signal type                         */
     const SKP_int32     x_Q10[],                /* I                                        */
     SKP_int8            q[],                    /* O                                        */
     SKP_int16           xq[],                   /* O                                        */
@@ -156,13 +156,13 @@
         SKP_memcpy( psDD->sAR2_Q14, NSQ->sAR2_Q14, sizeof( NSQ->sAR2_Q14 ) );
     }
 
-    offset_Q10   = SKP_Silk_Quantization_Offsets_Q10[ psEncCtrlC->sigtype ][ psEncCtrlC->QuantOffsetType ];
+    offset_Q10   = SKP_Silk_Quantization_Offsets_Q10[ psEncCtrlC->signalType >> 1 ][ psEncCtrlC->quantOffsetType ];
     smpl_buf_idx = 0; /* index of oldest samples */
 
     decisionDelay = SKP_min_int( DECISION_DELAY, subfr_length );
 
     /* For voiced frames limit the decision delay to lower than the pitch lag */
-    if( psEncCtrlC->sigtype == SIG_TYPE_VOICED ) {
+    if( psEncCtrlC->signalType == TYPE_VOICED ) {
         for( k = 0; k < psEncC->nb_subfr; k++ ) {
             decisionDelay = SKP_min_int( decisionDelay, psEncCtrlC->pitchL[ k ] - LTP_ORDER / 2 - 1 );
         }
@@ -194,7 +194,7 @@
         HarmShapeFIRPacked_Q14 |= SKP_LSHIFT( ( SKP_int32 )SKP_RSHIFT( HarmShapeGain_Q14[ k ], 1 ), 16 );
 
         NSQ->rewhite_flag = 0;
-        if( psEncCtrlC->sigtype == SIG_TYPE_VOICED ) {
+        if( psEncCtrlC->signalType == TYPE_VOICED ) {
             /* Voiced */
             lag = psEncCtrlC->pitchL[ k ];
 
@@ -250,7 +250,7 @@
             subfr_length, sLTP, sLTP_Q16, k, psEncC->nStatesDelayedDecision, smpl_buf_idx,
             LTP_scale_Q14, Gains_Q16, psEncCtrlC->pitchL );
 
-        SKP_Silk_noise_shape_quantizer_del_dec( NSQ, psDelDec, psEncCtrlC->sigtype, x_sc_Q10, q, pxq, sLTP_Q16,
+        SKP_Silk_noise_shape_quantizer_del_dec( NSQ, psDelDec, psEncCtrlC->signalType, x_sc_Q10, q, pxq, sLTP_Q16,
             A_Q12, B_Q14, AR_shp_Q13, lag, HarmShapeFIRPacked_Q14, Tilt_Q14[ k ], LF_shp_Q14[ k ], Gains_Q16[ k ], 
             Lambda_Q10, offset_Q10, psEncC->subfr_length, subfr++, psEncC->shapingLPCOrder, psEncC->predictLPCOrder, 
             psEncC->warping_Q16, psEncC->nStatesDelayedDecision, &smpl_buf_idx, decisionDelay );
@@ -296,6 +296,7 @@
 #ifdef SAVE_ALL_INTERNAL_DATA
     DEBUG_STORE_DATA( sLTP_Q16.dat, &sLTP_Q16[ psEncC->frame_length ], psEncC->frame_length * sizeof( SKP_int32 ) );
     DEBUG_STORE_DATA( xq.dat,       NSQ->xq,                           psEncC->frame_length * sizeof( SKP_int16 ) );
+    DEBUG_STORE_DATA( q.dat,        &q[ -psEncC->frame_length ],       psEncC->frame_length * sizeof( SKP_int8 ) );
 #endif
 }
 
@@ -305,7 +306,7 @@
 SKP_INLINE void SKP_Silk_noise_shape_quantizer_del_dec(
     SKP_Silk_nsq_state  *NSQ,                   /* I/O  NSQ state                           */
     NSQ_del_dec_struct  psDelDec[],             /* I/O  Delayed decision states             */
-    SKP_int             sigtype,                /* I    Signal type                         */
+    SKP_int             signalType,             /* I    Signal type                         */
     const SKP_int32     x_Q10[],                /* I                                        */
     SKP_int8            q[],                    /* O                                        */
     SKP_int16           xq[],                   /* O                                        */
@@ -348,7 +349,7 @@
         /* Perform common calculations used in all states */
 
         /* Long-term prediction */
-        if( sigtype == SIG_TYPE_VOICED ) {
+        if( signalType == TYPE_VOICED ) {
             /* Unrolled loop */
             LTP_pred_Q14 = SKP_SMULWB(               pred_lag_ptr[  0 ], b_Q14[ 0 ] );
             LTP_pred_Q14 = SKP_SMLAWB( LTP_pred_Q14, pred_lag_ptr[ -1 ], b_Q14[ 1 ] );
--- a/src_common/SKP_Silk_PLC.c
+++ b/src_common/SKP_Silk_PLC.c
@@ -86,9 +86,9 @@
     psPLC = &psDec->sPLC;
 
     /* Update parameters used in case of packet loss */
-    psDec->prev_sigtype = psDecCtrl->sigtype;
+    psDec->prevSignalType = psDecCtrl->signalType;
     LTP_Gain_Q14 = 0;
-    if( psDecCtrl->sigtype == SIG_TYPE_VOICED ) {
+    if( psDecCtrl->signalType == TYPE_VOICED ) {
         /* Find the parameters for the last subframe which contains a pitch pulse */
         for( j = 0; j * psDec->subfr_length < psDecCtrl->pitchL[ psDec->nb_subfr - 1 ]; j++ ) {
             if( j == psDec->nb_subfr ){
@@ -197,7 +197,7 @@
 
     /* Setup attenuation gains */
     harm_Gain_Q15 = HARM_ATT_Q15[ SKP_min_int( NB_ATT - 1, psDec->lossCnt ) ];
-    if( psDec->prev_sigtype == SIG_TYPE_VOICED ) {
+    if( psDec->prevSignalType == TYPE_VOICED ) {
         rand_Gain_Q15 = PLC_RAND_ATTENUATE_V_Q15[  SKP_min_int( NB_ATT - 1, psDec->lossCnt ) ];
     } else {
         rand_Gain_Q15 = PLC_RAND_ATTENUATE_UV_Q15[ SKP_min_int( NB_ATT - 1, psDec->lossCnt ) ];
@@ -208,16 +208,14 @@
         rand_scale_Q14 = (1 << 14 );
     
         /* Reduce random noise Gain for voiced frames */
-        if( psDec->prev_sigtype == SIG_TYPE_VOICED ) {
+        if( psDec->prevSignalType == TYPE_VOICED ) {
             for( i = 0; i < LTP_ORDER; i++ ) {
                 rand_scale_Q14 -= B_Q14[ i ];
             }
             rand_scale_Q14 = SKP_max_16( 3277, rand_scale_Q14 ); /* 0.2 */
             rand_scale_Q14 = ( SKP_int16 )SKP_RSHIFT( SKP_SMULBB( rand_scale_Q14, psPLC->prevLTP_scale_Q14 ), 14 );
-        }
-
-        /* Reduce random noise for unvoiced frames with high LPC gain */
-        if( psDec->prev_sigtype == SIG_TYPE_UNVOICED ) {
+        } else {
+            /* Reduce random noise for unvoiced frames with high LPC gain */
             SKP_int32 invGain_Q30, down_scale_Q30;
             
             SKP_Silk_LPC_inverse_pred_gain( &invGain_Q30, psPLC->prevLPC_Q12, psDec->LPC_order );
@@ -382,6 +380,5 @@
             }
         }
         psPLC->last_frame_lost = 0;
-
     }
 }
--- a/src_common/SKP_Silk_VQ_WMat_EC.c
+++ b/src_common/SKP_Silk_VQ_WMat_EC.c
@@ -34,8 +34,8 @@
     const SKP_int16                 *in_Q14,            /* I    input vector to be quantized                */
     const SKP_int32                 *W_Q18,             /* I    weighting matrix                            */
     const SKP_int8                  *cb_Q7,             /* I    codebook                                    */
-    const SKP_int8                  *cl_Q4,             /* I    code length for each codebook vector        */
-    const SKP_int                   mu_Q10,             /* I    tradeoff between weighted error and rate    */
+    const SKP_uint8                 *cl_Q5,             /* I    code length for each codebook vector        */
+    const SKP_int                   mu_Q9,              /* I    tradeoff between weighted error and rate    */
     SKP_int                         L                   /* I    number of vectors in codebook               */
 )
 {
@@ -55,7 +55,7 @@
         diff_Q14[ 4 ] = in_Q14[ 4 ] - SKP_LSHIFT( cb_row_Q7[ 4 ], 7 );
 
         /* Weighted rate */
-        sum1_Q14 = SKP_SMULBB( mu_Q10, cl_Q4[ k ] );
+        sum1_Q14 = SKP_SMULBB( mu_Q9, cl_Q5[ k ] );
 
         SKP_assert( sum1_Q14 >= 0 );
 
--- a/src_common/SKP_Silk_code_signs.c
+++ b/src_common/SKP_Silk_code_signs.c
@@ -35,53 +35,72 @@
 
 /* Encodes signs of excitation */
 void SKP_Silk_encode_signs(
-    ec_enc                      *psRangeEnc,        /* I/O  Compressor data structure                   */
-    const SKP_int8              q[],                /* I    Pulse signal                                */
-    const SKP_int               length,             /* I    Length of input                             */
-    const SKP_int               sigtype,            /* I    Signal type                                 */
-    const SKP_int               QuantOffsetType,    /* I    Quantization offset type                    */
-    const SKP_int               RateLevelIndex      /* I    Rate level index                            */
+    ec_enc                      *psRangeEnc,                        /* I/O  Compressor data structure                   */
+    const SKP_int8              q[],                                /* I    pulse signal                                */
+    SKP_int                     length,                             /* I    length of input                             */
+    const SKP_int               signalType,                         /* I    Signal type                                 */
+    const SKP_int               quantOffsetType,                    /* I    Quantization offset type                    */
+    const SKP_int               sum_pulses[ MAX_NB_SHELL_BLOCKS ]   /* I    Sum of absolute pulses per block            */
 )
 {
-    SKP_int   i, inData;
-    SKP_uint8 icdf[ 2 ];
+    SKP_int         i, j, p, inData;
+    SKP_uint8       icdf[ 2 ];
+    const SKP_int8  *q_ptr;
+    const SKP_uint8 *icdf_ptr;
 
-    i = SKP_SMULBB( N_RATE_LEVELS - 1, SKP_LSHIFT( sigtype, 1 ) + QuantOffsetType ) + RateLevelIndex;
-    icdf[ 0 ] = SKP_Silk_sign_iCDF[ i ];
     icdf[ 1 ] = 0;
-    
+    q_ptr = q;
+    i = SKP_SMULBB( 6, SKP_ADD_LSHIFT( quantOffsetType, signalType, 1 ) );
+    icdf_ptr = &SKP_Silk_sign_iCDF[ i ];
+    length = SKP_RSHIFT( length, LOG2_SHELL_CODEC_FRAME_LENGTH );
     for( i = 0; i < length; i++ ) {
-        if( q[ i ] != 0 ) {
-            inData = SKP_enc_map( q[ i ] ); /* - = 0, + = 1 */
-            ec_enc_icdf( psRangeEnc, inData, icdf, 8 );
+        p = sum_pulses[ i ];
+        if( p > 0 ) {
+            icdf[ 0 ] = icdf_ptr[ SKP_min( p - 1, 5 ) ];
+            for( j = 0; j < SHELL_CODEC_FRAME_LENGTH; j++ ) {
+                if( q_ptr[ j ] != 0 ) {
+                    inData = SKP_enc_map( q_ptr[ j ]); /* - = 0, + = 1 */
+                    ec_enc_icdf( psRangeEnc, inData, icdf, 8 );
+                }
+            }
         }
+        q_ptr += SHELL_CODEC_FRAME_LENGTH;
     }
 }
 
 /* Decodes signs of excitation */
 void SKP_Silk_decode_signs(
-    ec_dec                          *psRangeDec,        /* I/O  Compressor data structure                   */
-    SKP_int                         q[],                /* I/O  pulse signal                                */
-    const SKP_int                   length,             /* I    length of output                            */
-    const SKP_int                   sigtype,            /* I    Signal type                                 */
-    const SKP_int                   QuantOffsetType,    /* I    Quantization offset type                    */
-    const SKP_int                   RateLevelIndex      /* I    Rate Level Index                            */
+    ec_dec                      *psRangeDec,                        /* I/O  Compressor data structure                   */
+    SKP_int                     q[],                                /* I/O  pulse signal                                */
+    SKP_int                     length,                             /* I    length of input                             */
+    const SKP_int               signalType,                         /* I    Signal type                                 */
+    const SKP_int               quantOffsetType,                    /* I    Quantization offset type                    */
+    const SKP_int               sum_pulses[ MAX_NB_SHELL_BLOCKS ]   /* I    Sum of absolute pulses per block            */
 )
 {
-    SKP_int   i, data;
-    SKP_uint8 icdf[ 2 ];
+    SKP_int         i, j, p, data;
+    SKP_uint8       icdf[ 2 ];
+    SKP_int         *q_ptr;
+    const SKP_uint8 *icdf_ptr;
 
-    i = SKP_SMULBB( N_RATE_LEVELS - 1, SKP_LSHIFT( sigtype, 1 ) + QuantOffsetType ) + RateLevelIndex;
-    icdf[ 0 ] = SKP_Silk_sign_iCDF[ i ];
     icdf[ 1 ] = 0;
-    
+    q_ptr = q;
+    i = SKP_SMULBB( 6, SKP_ADD_LSHIFT( quantOffsetType, signalType, 1 ) );
+    icdf_ptr = &SKP_Silk_sign_iCDF[ i ];
+    length = SKP_RSHIFT( length, LOG2_SHELL_CODEC_FRAME_LENGTH );
     for( i = 0; i < length; i++ ) {
-        if( q[ i ] > 0 ) {
-            data = ec_dec_icdf( psRangeDec, icdf, 8 );
-            /* attach sign */
-            /* implementation with shift, subtraction, multiplication */
-            q[ i ] *= SKP_dec_map( data );
+        p = sum_pulses[ i ];
+        if( p > 0 ) {
+            icdf[ 0 ] = icdf_ptr[ SKP_min( p - 1, 5 ) ];
+            for( j = 0; j < SHELL_CODEC_FRAME_LENGTH; j++ ) {
+                if( q_ptr[ j ] > 0 ) {
+                    data = ec_dec_icdf( psRangeDec, icdf, 8 );
+                    /* attach sign */
+                    /* implementation with shift, subtraction, multiplication */
+                    q_ptr[ j ] *= SKP_dec_map( data );
+                }
+            }
         }
+        q_ptr += SHELL_CODEC_FRAME_LENGTH;
     }
 }
-
--- a/src_common/SKP_Silk_control_audio_bandwidth.c
+++ b/src_common/SKP_Silk_control_audio_bandwidth.c
@@ -63,7 +63,7 @@
             psEncC->bitrateDiff += SKP_MUL( psEncC->PacketSize_ms, psEncC->TargetRate_bps - psEncC->bitrate_threshold_down );
             psEncC->bitrateDiff  = SKP_min( psEncC->bitrateDiff, 0 );
 
-            if( psEncC->vadFlag == NO_VOICE_ACTIVITY ) { /* Low speech activity */
+            if( psEncC->prevSignalType == TYPE_NO_VOICE_ACTIVITY ) { /* Low speech activity */
                 /* Check if we should switch down */
 #if SWITCH_TRANSITION_FILTERING 
                 if( ( psEncC->sLP.transition_frame_no == 0 ) &&                         /* Transition phase not active */
@@ -124,7 +124,7 @@
         /* After switching up, stop transition filter during speech inactivity */
         if( ( psEncC->sLP.mode == 1 ) &&
             ( psEncC->sLP.transition_frame_no >= TRANSITION_FRAMES_UP ) && 
-            ( psEncC->vadFlag == NO_VOICE_ACTIVITY ) ) {
+            ( psEncC->prevSignalType == TYPE_NO_VOICE_ACTIVITY ) ) {
 
                 psEncC->sLP.transition_frame_no = 0;
 
--- a/src_common/SKP_Silk_dec_API.c
+++ b/src_common/SKP_Silk_dec_API.c
@@ -232,7 +232,6 @@
 }
 #endif
 
-#if 0  // todo: clean up, make efficient
 /* Getting type of content for a packet */
 void SKP_Silk_SDK_get_TOC(
     ec_dec                              *psRangeDec,    /* I/O  Compressor data structure                   */
@@ -247,9 +246,9 @@
     sDec.fs_kHz         = 0; /* Force update parameters LPC_order etc */
 
     /* Decode all parameter indices for the whole packet*/
-    SKP_Silk_decode_indices( &sDec );
+    SKP_Silk_decode_indices( &sDec, psRangeDec );
     
-    if( sDec.sRC.error ) {
+    if( psRangeDec->error ) {
         /* Corrupt packet */
         SKP_memset( Silk_TOC, 0, sizeof( SKP_Silk_TOC_struct ) );
         Silk_TOC->corrupt = 1;
@@ -257,26 +256,14 @@
         Silk_TOC->corrupt = 0;
         Silk_TOC->framesInPacket = sDec.nFramesInPacket;
         Silk_TOC->fs_kHz         = sDec.fs_kHz;
-        if( sDec.FrameTermination == SKP_SILK_LAST_FRAME ) {
-            Silk_TOC->inbandLBRR = sDec.FrameTermination;
+        if( sDec.FrameTermination == SKP_SILK_LBRR ) {
+            Silk_TOC->inbandLBRR = 1;
         } else {
-            Silk_TOC->inbandLBRR = sDec.FrameTermination - 1;
+            Silk_TOC->inbandLBRR = 0;
         }
         /* Copy data */
         for( i = 0; i < sDec.nFramesInPacket; i++ ) {
-            Silk_TOC->vadFlags[ i ]     = sDec.vadFlagBuf[ i ];
-            Silk_TOC->sigtypeFlags[ i ] = sDec.sigtype[ i ];
+            Silk_TOC->signalTypeFlags[ i ] = sDec.signalType[ i ];
         }
     }
 }
-#endif
-
-/**************************/
-/* Get the version number */
-/**************************/
-/* Return a pointer to string specifying the version */ 
-const char *SKP_Silk_SDK_get_version()
-{
-    static const char version[] = "1.0.4";
-    return version;
-}
\ No newline at end of file
--- a/src_common/SKP_Silk_decode_core.c
+++ b/src_common/SKP_Silk_decode_core.c
@@ -37,7 +37,7 @@
     const SKP_int               q[ MAX_FRAME_LENGTH ]               /* I    Pulse signal                */
 )
 {
-    SKP_int   i, j, k, lag = 0, start_idx, sLTP_buf_idx, NLSF_interpolation_flag, sigtype;
+    SKP_int   i, j, k, lag = 0, start_idx, sLTP_buf_idx, NLSF_interpolation_flag, signalType;
     SKP_int16 *A_Q12, *B_Q14, *pxq, A_Q12_tmp[ MAX_LPC_ORDER ];
     SKP_int16 sLTP[ MAX_FRAME_LENGTH ];
     SKP_int32 LTP_pred_Q14, LPC_pred_Q10, Gain_Q16, inv_gain_Q16, inv_gain_Q32, gain_adj_Q16, rand_seed, offset_Q10, dither;
@@ -47,7 +47,7 @@
 
     SKP_assert( psDec->prev_inv_gain_Q16 != 0 );
     
-    offset_Q10 = SKP_Silk_Quantization_Offsets_Q10[ psDecCtrl->sigtype ][ psDecCtrl->QuantOffsetType ];
+    offset_Q10 = SKP_Silk_Quantization_Offsets_Q10[ psDecCtrl->signalType >> 1 ][ psDecCtrl->quantOffsetType ];
 
     if( psDecCtrl->NLSFInterpCoef_Q2 < ( 1 << 2 ) ) {
         NLSF_interpolation_flag = 1;
@@ -90,7 +90,7 @@
         SKP_memcpy( A_Q12_tmp, A_Q12, psDec->LPC_order * sizeof( SKP_int16 ) ); 
         B_Q14         = &psDecCtrl->LTPCoef_Q14[ k * LTP_ORDER ];
         Gain_Q16      = psDecCtrl->Gains_Q16[ k ];
-        sigtype       = psDecCtrl->sigtype;
+        signalType    = psDecCtrl->signalType;
 
         inv_gain_Q16 = SKP_INVERSE32_varQ( SKP_max( Gain_Q16, 1 ), 32 );
         inv_gain_Q16 = SKP_min( inv_gain_Q16, SKP_int16_MAX );
@@ -102,17 +102,17 @@
         }
 
         /* Avoid abrupt transition from voiced PLC to unvoiced normal decoding */
-        if( psDec->lossCnt && psDec->prev_sigtype == SIG_TYPE_VOICED &&
-            psDecCtrl->sigtype == SIG_TYPE_UNVOICED && k < ( MAX_NB_SUBFR >> 1 ) ) {
+        if( psDec->lossCnt && psDec->prevSignalType == TYPE_VOICED &&
+            psDecCtrl->signalType != TYPE_VOICED && k < ( MAX_NB_SUBFR >> 1 ) ) {
             
             SKP_memset( B_Q14, 0, LTP_ORDER * sizeof( SKP_int16 ) );
             B_Q14[ LTP_ORDER/2 ] = ( SKP_int16 )1 << 12; /* 0.25 */
         
-            sigtype = SIG_TYPE_VOICED;
+            signalType = TYPE_VOICED;
             psDecCtrl->pitchL[ k ] = psDec->lagPrev;
         }
 
-        if( sigtype == SIG_TYPE_VOICED ) {
+        if( signalType == TYPE_VOICED ) {
             /* Voiced */
             
             lag = psDecCtrl->pitchL[ k ];
@@ -155,7 +155,7 @@
         psDec->prev_inv_gain_Q16 = inv_gain_Q16;
 
         /* Long-term prediction */
-        if( sigtype == SIG_TYPE_VOICED ) {
+        if( signalType == TYPE_VOICED ) {
             /* Setup pointer */
             pred_lag_ptr = &psDec->sLTP_Q16[ sLTP_buf_idx - lag + LTP_ORDER / 2 ];
             for( i = 0; i < psDec->subfr_length; i++ ) {
--- a/src_common/SKP_Silk_decode_frame.c
+++ b/src_common/SKP_Silk_decode_frame.c
@@ -110,7 +110,7 @@
             SKP_Silk_PLC( psDec, &sDecCtrl, pOut, L, action );
 
             psDec->lossCnt = 0;
-            psDec->prev_sigtype = sDecCtrl.sigtype;
+            psDec->prevSignalType = sDecCtrl.signalType;
 
             /* A frame has been decoded without errors */
             psDec->first_frame_after_reset = 0;
--- a/src_common/SKP_Silk_decode_indices.c
+++ b/src_common/SKP_Silk_decode_indices.c
@@ -34,28 +34,23 @@
 )
 {
     SKP_int   i, k, Ix, FrameIndex;
-    SKP_int   sigtype, QuantOffsetType, nBytesUsed;
+    SKP_int   signalType, quantOffsetType, nBytesUsed;
     SKP_int   decode_absolute_lagIndex, delta_lagIndex, prev_lagIndex = 0;
     const SKP_Silk_NLSF_CB_struct *psNLSF_CB = NULL;
 
     for( FrameIndex = 0; FrameIndex < psDec->nFramesInPacket; FrameIndex++ ) {
-        /*******************/
-        /* Decode VAD flag */
-        /*******************/
-        psDec->vadFlagBuf[ FrameIndex ] = ec_dec_icdf( psRangeDec, SKP_Silk_vadflag_iCDF, 8 );
-
         /*******************************************/
         /* Decode signal type and quantizer offset */
         /*******************************************/
         if( FrameIndex == 0 ) {
-            /* first frame in packet: independent coding, in two stages: MSB bits followed by 3 LSBs */
+            /* first frame in packet: independent coding */
             Ix = ec_dec_icdf( psRangeDec, SKP_Silk_type_offset_iCDF, 8 );
         } else {
-            /* condidtional coding */
+            /* conditional coding */
             Ix = ec_dec_icdf( psRangeDec, SKP_Silk_type_offset_joint_iCDF[ psDec->typeOffsetPrev ], 8 );
         }
-        sigtype               = SKP_RSHIFT( Ix, 1 );
-        QuantOffsetType       = Ix & 1;
+        signalType            = SKP_RSHIFT( Ix, 1 );
+        quantOffsetType       = Ix & 1;
         psDec->typeOffsetPrev = Ix;
 
         /****************/
@@ -63,12 +58,11 @@
         /****************/
         /* first subframe */    
         if( FrameIndex == 0 ) {
-            /* first frame in packet: independent coding */
-            psDec->GainsIndices[ FrameIndex ][ 0 ] = SKP_LSHIFT( ec_dec_icdf( psRangeDec, SKP_Silk_gain_iCDF[ sigtype ], 8 ), 3 );
-            //psDec->GainsIndices[ FrameIndex ][ 0 ] += ec_dec_bits( psRangeDec, 3 );           /* doesn't work somehow */
+            /* first frame in packet: independent coding, in two stages: MSB bits followed by 3 LSBs */
+            psDec->GainsIndices[ FrameIndex ][ 0 ] = SKP_LSHIFT( ec_dec_icdf( psRangeDec, SKP_Silk_gain_iCDF[ signalType ], 8 ), 3 );
             psDec->GainsIndices[ FrameIndex ][ 0 ] += ec_dec_icdf( psRangeDec, SKP_Silk_uniform8_iCDF, 8 );
         } else {
-            /* condidtional coding */
+            /* conditional coding */
             psDec->GainsIndices[ FrameIndex ][ 0 ] = ec_dec_icdf( psRangeDec, SKP_Silk_delta_gain_iCDF, 8 );
         }
 
@@ -80,9 +74,8 @@
         /**********************/
         /* Decode LSF Indices */
         /**********************/
-
         /* Set pointer to LSF VQ CB for the current signal type */
-        psNLSF_CB = psDec->psNLSF_CB[ sigtype ];
+        psNLSF_CB = psDec->psNLSF_CB[ 1 - (signalType >> 1) ];
 
         /* Range decoding of the NLSF path */
         for( i = 0; i < psNLSF_CB->nStages; i++ ) {
@@ -94,13 +87,13 @@
         /***********************************/
         psDec->NLSFInterpCoef_Q2[ FrameIndex ] = ec_dec_icdf( psRangeDec, SKP_Silk_NLSF_interpolation_factor_iCDF, 8 );
         
-        if( sigtype == SIG_TYPE_VOICED ) {
+        if( signalType == TYPE_VOICED ) {
             /*********************/
             /* Decode pitch lags */
             /*********************/
             /* Get lag index */
             decode_absolute_lagIndex = 1;
-            if( FrameIndex > 0 && psDec->sigtype[ FrameIndex - 1 ] == SIG_TYPE_VOICED ) {
+            if( FrameIndex > 0 && psDec->signalType[ FrameIndex - 1 ] == TYPE_VOICED ) {
                 /* Decode Delta index */
                 delta_lagIndex = ec_dec_icdf( psRangeDec, SKP_Silk_pitch_delta_iCDF, 8 );
                 if( delta_lagIndex > 0 ) {
@@ -111,7 +104,7 @@
             }
             if( decode_absolute_lagIndex ) {
                 /* Absolute decoding */
-                psDec->lagIndex[ FrameIndex ] = ec_dec_icdf( psRangeDec, SKP_Silk_pitch_lag_iCDF, 8 ) * SKP_RSHIFT( psDec->fs_kHz, 1 );
+                psDec->lagIndex[ FrameIndex ]  = ec_dec_icdf( psRangeDec, SKP_Silk_pitch_lag_iCDF, 8 ) * SKP_RSHIFT( psDec->fs_kHz, 1 );
                 psDec->lagIndex[ FrameIndex ] += ec_dec_icdf( psRangeDec, psDec->pitch_lag_low_bits_iCDF, 8 );
             }
             prev_lagIndex = psDec->lagIndex[ FrameIndex ];
@@ -140,8 +133,8 @@
         /***************/
         psDec->Seed[ FrameIndex ] = ec_dec_icdf( psRangeDec, SKP_Silk_Seed_iCDF, 8 );
 
-        psDec->sigtype[ FrameIndex ]         = sigtype;
-        psDec->QuantOffsetType[ FrameIndex ] = QuantOffsetType;
+        psDec->signalType[ FrameIndex ]      = signalType;
+        psDec->quantOffsetType[ FrameIndex ] = quantOffsetType;
     }
 
     /**************************************/
--- a/src_common/SKP_Silk_decode_parameters.c
+++ b/src_common/SKP_Silk_decode_parameters.c
@@ -41,9 +41,9 @@
     const SKP_int8 *cbk_ptr_Q7;
     const SKP_Silk_NLSF_CB_struct *psNLSF_CB = NULL;
     
-    psDecCtrl->sigtype            = psDec->sigtype[ psDec->nFramesDecoded ];
-    psDecCtrl->QuantOffsetType    = psDec->QuantOffsetType[ psDec->nFramesDecoded ];
-    psDec->vadFlag                = psDec->vadFlagBuf[ psDec->nFramesDecoded ];
+    psDecCtrl->signalType         = psDec->signalType[ psDec->nFramesDecoded ];
+    psDecCtrl->quantOffsetType    = psDec->quantOffsetType[ psDec->nFramesDecoded ];
+    psDec->vadFlag                = psDecCtrl->signalType > 0 ? 1 : 0;
     psDecCtrl->NLSFInterpCoef_Q2  = psDec->NLSFInterpCoef_Q2[ psDec->nFramesDecoded ];
     psDecCtrl->Seed               = psDec->Seed[ psDec->nFramesDecoded ];
 
@@ -55,7 +55,7 @@
     /* Decode NLSFs */
     /****************/
     /* Set pointer to NLSF VQ CB for the current signal type */
-    psNLSF_CB = psDec->psNLSF_CB[ psDecCtrl->sigtype ];
+    psNLSF_CB = psDec->psNLSF_CB[ 1 - (psDecCtrl->signalType >> 1) ];
 
     /* From the NLSF path, decode an NLSF vector */
     SKP_Silk_NLSF_MSVQ_decode( pNLSF_Q15, psNLSF_CB, psDec->NLSFIndices[ psDec->nFramesDecoded ], psDec->LPC_order );
@@ -93,7 +93,7 @@
         SKP_Silk_bwexpander( psDecCtrl->PredCoef_Q12[ 1 ], psDec->LPC_order, BWE_AFTER_LOSS_Q16 );
     }
 
-    if( psDecCtrl->sigtype == SIG_TYPE_VOICED ) {
+    if( psDecCtrl->signalType == TYPE_VOICED ) {
         /*********************/
         /* Decode pitch lags */
         /*********************/
@@ -123,7 +123,6 @@
         Ix = psDec->LTP_scaleIndex[ psDec->nFramesDecoded ];
         psDecCtrl->LTP_scale_Q14 = SKP_Silk_LTPScales_table_Q14[ Ix ];
     } else {
-        SKP_assert( psDecCtrl->sigtype == SIG_TYPE_UNVOICED );
         SKP_memset( psDecCtrl->pitchL,      0,             psDec->nb_subfr * sizeof( SKP_int   ) );
         SKP_memset( psDecCtrl->LTPCoef_Q14, 0, LTP_ORDER * psDec->nb_subfr * sizeof( SKP_int16 ) );
         psDecCtrl->PERIndex      = 0;
--- a/src_common/SKP_Silk_decode_pulses.c
+++ b/src_common/SKP_Silk_decode_pulses.c
@@ -40,13 +40,12 @@
     SKP_int   i, j, k, iter, abs_q, nLS;
     SKP_int   sum_pulses[ MAX_NB_SHELL_BLOCKS ], nLshifts[ MAX_NB_SHELL_BLOCKS ];
     SKP_int   *pulses_ptr;
-    const SKP_uint16 *cdf_ptr;
+    const SKP_uint8 *cdf_ptr;
     
     /*********************/
     /* Decode rate level */
     /*********************/
-    SKP_Silk_range_decoder( &psDecCtrl->RateLevelIndex, psRangeDec, 
-            SKP_Silk_rate_levels_CDF[ psDecCtrl->sigtype ], SKP_Silk_rate_levels_CDF_offset );
+    psDecCtrl->RateLevelIndex = ec_dec_icdf( psRangeDec, SKP_Silk_rate_levels_iCDF[ psDecCtrl->signalType >> 1 ], 8 );
 
     /* Calculate number of shell blocks */
     SKP_assert( 1 << LOG2_SHELL_CODEC_FRAME_LENGTH == SHELL_CODEC_FRAME_LENGTH );
@@ -58,16 +57,15 @@
     /***************************************************/
     /* Sum-Weighted-Pulses Decoding                    */
     /***************************************************/
-    cdf_ptr = SKP_Silk_pulses_per_block_CDF[ psDecCtrl->RateLevelIndex ];
+    cdf_ptr = SKP_Silk_pulses_per_block_iCDF[ psDecCtrl->RateLevelIndex ];
     for( i = 0; i < iter; i++ ) {
         nLshifts[ i ] = 0;
-        SKP_Silk_range_decoder( &sum_pulses[ i ], psRangeDec, cdf_ptr, SKP_Silk_pulses_per_block_CDF_offset );
+        sum_pulses[ i ] = ec_dec_icdf( psRangeDec, cdf_ptr, 8 );
 
         /* LSB indication */
-        while( sum_pulses[ i ] == ( MAX_PULSES + 1 ) ) {
+        while( sum_pulses[ i ] == MAX_PULSES + 1 ) {
             nLshifts[ i ]++;
-            SKP_Silk_range_decoder( &sum_pulses[ i ], psRangeDec, 
-                    SKP_Silk_pulses_per_block_CDF[ N_RATE_LEVELS - 1 ], SKP_Silk_pulses_per_block_CDF_offset );
+            sum_pulses[ i ] = ec_dec_icdf( psRangeDec, SKP_Silk_pulses_per_block_iCDF[ N_RATE_LEVELS - 1 ], 8 );
         }
     }
     
@@ -103,6 +101,6 @@
     /****************************************/
     /* Decode and add signs to pulse signal */
     /****************************************/
-    SKP_Silk_decode_signs( psRangeDec, q, frame_length, psDecCtrl->sigtype, 
-        psDecCtrl->QuantOffsetType, psDecCtrl->RateLevelIndex);
+    SKP_Silk_decode_signs( psRangeDec, q, frame_length, psDecCtrl->signalType, 
+        psDecCtrl->quantOffsetType, sum_pulses );
 }
--- a/src_common/SKP_Silk_decoder_set_fs.c
+++ b/src_common/SKP_Silk_decoder_set_fs.c
@@ -71,7 +71,7 @@
 
         psDec->lagPrev                 = 100;
         psDec->LastGainIndex           = 1;
-        psDec->prev_sigtype            = 0;
+        psDec->prevSignalType          = TYPE_NO_VOICE_ACTIVITY;
         psDec->first_frame_after_reset = 1;
 
         if( fs_kHz == 24 ) {
--- a/src_common/SKP_Silk_define.h
+++ b/src_common/SKP_Silk_define.h
@@ -102,9 +102,10 @@
 #define MAX_FS_KHZ                              24 
 #define MAX_API_FS_KHZ                          48
 
-/* Signal Types used by silk */
-#define SIG_TYPE_VOICED                         0
-#define SIG_TYPE_UNVOICED                       1
+/* Signal types used by silk */
+#define TYPE_NO_VOICE_ACTIVITY                  0
+#define TYPE_UNVOICED                           1
+#define TYPE_VOICED                             2
 
 /* VAD Types used by silk */
 #define NO_VOICE_ACTIVITY                       0
@@ -197,7 +198,7 @@
 #define N_RATE_LEVELS                           10
 
 /* maximum sum of pulses per shell coding frame */
-#define MAX_PULSES                              18
+#define MAX_PULSES                              16
 
 #define MAX_MATRIX_SIZE                         MAX_LPC_ORDER /* Max of LPC Order and LTP order */
 
@@ -239,8 +240,6 @@
 
 #define NLSF_MSVQ_FLUCTUATION_REDUCTION         1
 #define MAX_NLSF_MSVQ_SURVIVORS                 16
-#define MAX_NLSF_MSVQ_SURVIVORS_LC_MODE         2
-#define MAX_NLSF_MSVQ_SURVIVORS_MC_MODE         4
 
 /* Based on above defines, calculate how much memory is necessary to allocate */
 #if( NLSF_MSVQ_MAX_VECTORS_IN_STAGE > ( MAX_NLSF_MSVQ_SURVIVORS_LC_MODE * NLSF_MSVQ_MAX_VECTORS_IN_STAGE_TWO_TO_END ) )
--- /dev/null
+++ b/src_common/SKP_Silk_encode_indices.c
@@ -1,0 +1,207 @@
+/***********************************************************************
+Copyright (c) 2006-2010, Skype Limited. All rights reserved. 
+Redistribution and use in source and binary forms, with or without 
+modification, (subject to the limitations in the disclaimer below) 
+are permitted provided that the following conditions are met:
+- Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+- Redistributions in binary form must reproduce the above copyright 
+notice, this list of conditions and the following disclaimer in the 
+documentation and/or other materials provided with the distribution.
+- Neither the name of Skype Limited, nor the names of specific 
+contributors, may be used to endorse or promote products derived from 
+this software without specific prior written permission.
+NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED 
+BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 
+CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 
+FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
+COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 
+USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+***********************************************************************/
+
+#include "SKP_Silk_main.h"
+
+/*******************************************/
+/* Encode parameters to create the payload */
+/*******************************************/
+void SKP_Silk_encode_indices(
+    SKP_Silk_encoder_state      *psEncC,            /* I/O  Encoder state                               */
+    SKP_Silk_encoder_control    *psEncCtrlC,        /* I/O  Encoder control                             */
+    ec_enc                      *psRangeEnc         /* I/O  Compressor data structure                   */
+)
+{
+    SKP_int   i, k, typeOffset;
+    SKP_int   encode_absolute_lagIndex, delta_lagIndex;
+    const SKP_Silk_NLSF_CB_struct *psNLSF_CB;
+
+#ifdef SAVE_ALL_INTERNAL_DATA
+    SKP_int nBytes_lagIndex, nBytes_contourIndex, nBytes_LTP;
+    SKP_int nBytes_after, nBytes_before;
+#endif
+
+    /*******************************************/
+    /* Encode signal type and quantizer offset */
+    /*******************************************/
+    typeOffset = 2 * psEncCtrlC->signalType + psEncCtrlC->quantOffsetType;
+    if( psEncC->nFramesInPayloadBuf == 0 ) {
+        /* first frame in packet: independent coding */
+        ec_enc_icdf( psRangeEnc, typeOffset, SKP_Silk_type_offset_iCDF, 8 );
+    } else {
+        /* conditional coding */
+        ec_enc_icdf( psRangeEnc, typeOffset, SKP_Silk_type_offset_joint_iCDF[ psEncC->typeOffsetPrev ], 8 );
+    }
+    psEncC->typeOffsetPrev = typeOffset;
+
+    /****************/
+    /* Encode gains */
+    /****************/
+#ifdef SAVE_ALL_INTERNAL_DATA
+    nBytes_before = SKP_RSHIFT( ec_enc_tell( psRangeEnc, 0 ) + 7, 3 );
+#endif
+    /* first subframe */
+    if( psEncC->nFramesInPayloadBuf == 0 ) {
+        /* first frame in packet: independent coding, in two stages: MSB bits followed by 3 LSBs */
+        ec_enc_icdf( psRangeEnc, SKP_RSHIFT( psEncCtrlC->GainsIndices[ 0 ], 3 ), SKP_Silk_gain_iCDF[ psEncCtrlC->signalType ], 8 );
+        ec_enc_icdf( psRangeEnc, psEncCtrlC->GainsIndices[ 0 ] & 7, SKP_Silk_uniform8_iCDF, 8 );
+    } else {
+        /* conditional coding */
+        ec_enc_icdf( psRangeEnc, psEncCtrlC->GainsIndices[ 0 ], SKP_Silk_delta_gain_iCDF, 8 );
+    }
+
+    /* remaining subframes */
+    for( i = 1; i < psEncC->nb_subfr; i++ ) {
+        ec_enc_icdf( psRangeEnc, psEncCtrlC->GainsIndices[ i ], SKP_Silk_delta_gain_iCDF, 8 );
+    }
+
+#ifdef SAVE_ALL_INTERNAL_DATA
+    nBytes_after = SKP_RSHIFT( ec_enc_tell( psRangeEnc, 0 ) + 7, 3 );
+    nBytes_after -= nBytes_before; // bytes just added
+    DEBUG_STORE_DATA( nBytes_gains.dat, &nBytes_after, sizeof( SKP_int ) );
+#endif
+
+    /****************/
+    /* Encode NLSFs */
+    /****************/
+#ifdef SAVE_ALL_INTERNAL_DATA
+    nBytes_before = SKP_RSHIFT( ec_enc_tell( psRangeEnc, 0 ) + 7, 3 );
+#endif
+    /* Range encoding of the NLSF path */
+    psNLSF_CB = psEncC->psNLSF_CB[ 1 - (psEncCtrlC->signalType>>1) ];
+    for( i = 0; i < psNLSF_CB->nStages; i++ ) {
+        ec_enc_icdf( psRangeEnc, psEncCtrlC->NLSFIndices[ i ], psNLSF_CB->StartPtr[ i ], 8 );
+    }
+
+    /* Encode NLSF interpolation factor */
+    SKP_assert( psEncC->useInterpolatedNLSFs == 1 || psEncCtrlC->NLSFInterpCoef_Q2 == ( 1 << 2 ) );
+    ec_enc_icdf( psRangeEnc, psEncCtrlC->NLSFInterpCoef_Q2, SKP_Silk_NLSF_interpolation_factor_iCDF, 8 );
+
+#ifdef SAVE_ALL_INTERNAL_DATA
+    DEBUG_STORE_DATA( lsf_interpol.dat, &psEncCtrlC->NLSFInterpCoef_Q2, sizeof(int) );
+    nBytes_after = SKP_RSHIFT( ec_enc_tell( psRangeEnc, 0 ) + 7, 3 );
+    nBytes_after -= nBytes_before; // bytes just added
+    DEBUG_STORE_DATA( nBytes_LSF.dat, &nBytes_after, sizeof( SKP_int ) );
+#endif
+
+    if( psEncCtrlC->signalType == TYPE_VOICED ) {
+        /*********************/
+        /* Encode pitch lags */
+        /*********************/
+#ifdef SAVE_ALL_INTERNAL_DATA
+        nBytes_before = SKP_RSHIFT( ec_enc_tell( psRangeEnc, 0 ) + 7, 3 );
+#endif
+        /* lag index */
+        encode_absolute_lagIndex = 1;
+        if( psEncC->nFramesInPayloadBuf > 0 && psEncC->prevSignalType == TYPE_VOICED ) {
+            /* Delta Encoding */
+            delta_lagIndex = psEncCtrlC->lagIndex - psEncC->prev_lagIndex;
+            if( delta_lagIndex < -8 || delta_lagIndex > 11 ) {
+                delta_lagIndex = 0;
+            } else {
+                delta_lagIndex = delta_lagIndex + 9;
+                encode_absolute_lagIndex = 0; /* Only use delta */
+            }
+            SKP_assert( delta_lagIndex < 21 );
+            ec_enc_icdf( psRangeEnc, delta_lagIndex, SKP_Silk_pitch_delta_iCDF, 8 );
+        }
+        if( encode_absolute_lagIndex ) {
+            /* Absolute encoding */
+            SKP_int32 pitch_high_bits, pitch_low_bits;
+            pitch_high_bits = SKP_DIV32_16( psEncCtrlC->lagIndex, SKP_RSHIFT( psEncC->fs_kHz, 1 ) );
+            pitch_low_bits = psEncCtrlC->lagIndex - SKP_SMULBB( pitch_high_bits, SKP_RSHIFT( psEncC->fs_kHz, 1 ) );
+            SKP_assert( pitch_low_bits < psEncC->fs_kHz / 2 );
+            SKP_assert( pitch_high_bits < 32 );
+            ec_enc_icdf( psRangeEnc, pitch_high_bits, SKP_Silk_pitch_lag_iCDF, 8 );
+            ec_enc_icdf( psRangeEnc, pitch_low_bits, psEncC->pitch_lag_low_bits_iCDF, 8 );
+        }
+        psEncC->prev_lagIndex = psEncCtrlC->lagIndex;
+
+#ifdef SAVE_ALL_INTERNAL_DATA
+        nBytes_after = SKP_RSHIFT( ec_enc_tell( psRangeEnc, 0 ) + 7, 3 );
+        nBytes_lagIndex = nBytes_after - nBytes_before; // bytes just added
+#endif
+
+#ifdef SAVE_ALL_INTERNAL_DATA
+        nBytes_before = SKP_RSHIFT( ec_enc_tell( psRangeEnc, 0 ) + 7, 3 );
+#endif
+        /* Countour index */
+        SKP_assert( ( psEncCtrlC->contourIndex < 34 && psEncC->fs_kHz  > 8 && psEncC->nb_subfr == 4 ) ||
+                    ( psEncCtrlC->contourIndex < 11 && psEncC->fs_kHz == 8 && psEncC->nb_subfr == 4 ) ||
+                    ( psEncCtrlC->contourIndex < 12 && psEncC->fs_kHz  > 8 && psEncC->nb_subfr == 2 ) ||
+                    ( psEncCtrlC->contourIndex <  3 && psEncC->fs_kHz == 8 && psEncC->nb_subfr == 2 ) );
+        ec_enc_icdf( psRangeEnc, psEncCtrlC->contourIndex, psEncC->pitch_contour_iCDF, 8 );
+#ifdef SAVE_ALL_INTERNAL_DATA
+        nBytes_after = SKP_RSHIFT( ec_enc_tell( psRangeEnc, 0 ) + 7, 3 );
+        nBytes_contourIndex = nBytes_after - nBytes_before; // bytes just added
+#endif
+
+        /********************/
+        /* Encode LTP gains */
+        /********************/
+#ifdef SAVE_ALL_INTERNAL_DATA
+        nBytes_before = SKP_RSHIFT( ec_enc_tell( psRangeEnc, 0 ) + 7, 3 );
+#endif
+
+        /* PERIndex value */
+        ec_enc_icdf( psRangeEnc, psEncCtrlC->PERIndex, SKP_Silk_LTP_per_index_iCDF, 8 );
+
+        /* Codebook Indices */
+        for( k = 0; k < psEncC->nb_subfr; k++ ) {
+            ec_enc_icdf( psRangeEnc, psEncCtrlC->LTPIndex[ k ], SKP_Silk_LTP_gain_iCDF_ptrs[ psEncCtrlC->PERIndex ], 8 );
+        }
+
+        /**********************/
+        /* Encode LTP scaling */
+        /**********************/
+        ec_enc_icdf( psRangeEnc, psEncCtrlC->LTP_scaleIndex, SKP_Silk_LTPscale_iCDF, 8 );
+#ifdef SAVE_ALL_INTERNAL_DATA
+        nBytes_after = SKP_RSHIFT( ec_enc_tell( psRangeEnc, 0 ) + 7, 3 );
+        nBytes_LTP = nBytes_after - nBytes_before; // bytes just added
+#endif
+    }
+#ifdef SAVE_ALL_INTERNAL_DATA
+    else { 
+        // Unvoiced speech
+        nBytes_lagIndex     = 0;
+        nBytes_contourIndex = 0;
+        nBytes_LTP          = 0;
+    }
+    DEBUG_STORE_DATA( nBytes_lagIndex.dat,      &nBytes_lagIndex,       sizeof( SKP_int ) );
+    DEBUG_STORE_DATA( nBytes_contourIndex.dat,  &nBytes_contourIndex,   sizeof( SKP_int ) );
+    DEBUG_STORE_DATA( nBytes_LTP.dat,           &nBytes_LTP,            sizeof( SKP_int ) );
+#endif
+
+#ifdef SAVE_ALL_INTERNAL_DATA
+    nBytes_before = SKP_RSHIFT( ec_enc_tell( psRangeEnc, 0 ) + 7, 3 );
+#endif
+
+    /***************/
+    /* Encode seed */
+    /***************/
+    ec_enc_icdf( psRangeEnc, psEncCtrlC->Seed, SKP_Silk_Seed_iCDF, 8 );
+}
--- a/src_common/SKP_Silk_encode_parameters.c
+++ /dev/null
@@ -1,213 +1,0 @@
-/***********************************************************************
-Copyright (c) 2006-2010, Skype Limited. All rights reserved. 
-Redistribution and use in source and binary forms, with or without 
-modification, (subject to the limitations in the disclaimer below) 
-are permitted provided that the following conditions are met:
-- Redistributions of source code must retain the above copyright notice,
-this list of conditions and the following disclaimer.
-- Redistributions in binary form must reproduce the above copyright 
-notice, this list of conditions and the following disclaimer in the 
-documentation and/or other materials provided with the distribution.
-- Neither the name of Skype Limited, nor the names of specific 
-contributors, may be used to endorse or promote products derived from 
-this software without specific prior written permission.
-NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED 
-BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 
-CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
-BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 
-FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-***********************************************************************/
-
-#include "SKP_Silk_main.h"
-
-/*******************************************/
-/* Encode parameters to create the payload */
-/*******************************************/
-void SKP_Silk_encode_parameters(
-    SKP_Silk_encoder_state      *psEncC,            /* I/O  Encoder state                               */
-    SKP_Silk_encoder_control    *psEncCtrlC,        /* I/O  Encoder control                             */
-    ec_enc                      *psRangeEnc         /* I/O  Compressor data structure                   */
-)
-{
-    SKP_int   i, k, typeOffset;
-    SKP_int   encode_absolute_lagIndex, delta_lagIndex;
-    const SKP_Silk_NLSF_CB_struct *psNLSF_CB;
-
-#ifdef SAVE_ALL_INTERNAL_DATA
-    SKP_int nBytes_lagIndex, nBytes_contourIndex, nBytes_LTP;
-    SKP_int nBytes_after, nBytes_before;
-#endif
-
-    /*********************************************/
-    /* Encode VAD flag                           */
-    /*********************************************/
-    ec_enc_icdf( psRangeEnc, psEncC->vadFlag, SKP_Silk_vadflag_iCDF, 8 );
-
-    /*******************************************/
-    /* Encode signal type and quantizer offset */
-    /*******************************************/
-    typeOffset = 2 * psEncCtrlC->sigtype + psEncCtrlC->QuantOffsetType;
-    if( psEncC->nFramesInPayloadBuf == 0 ) {
-        /* first frame in packet: independent coding */
-        ec_enc_icdf( psRangeEnc, typeOffset, SKP_Silk_type_offset_iCDF, 8 );
-    } else {
-        /* condidtional coding */
-        ec_enc_icdf( psRangeEnc, typeOffset, SKP_Silk_type_offset_joint_iCDF[ psEncC->typeOffsetPrev ], 8 );
-    }
-    psEncC->typeOffsetPrev = typeOffset;
-
-    /****************/
-    /* Encode gains */
-    /****************/
-#ifdef SAVE_ALL_INTERNAL_DATA
-    nBytes_before = SKP_RSHIFT( ec_enc_tell( psRangeEnc, 0 ) + 7, 3 );
-#endif
-    /* first subframe */
-    if( psEncC->nFramesInPayloadBuf == 0 ) {
-        /* first frame in packet: independent coding, in two stages: MSB bits followed by 3 LSBs */
-        ec_enc_icdf( psRangeEnc, SKP_RSHIFT( psEncCtrlC->GainsIndices[ 0 ], 3 ), SKP_Silk_gain_iCDF[ psEncCtrlC->sigtype ], 8 );
-        //ec_enc_bits( psRangeEnc, psEncCtrlC->GainsIndices[ 0 ] & 7, 3 );          /* doesn't work somehow */
-        ec_enc_icdf( psRangeEnc, psEncCtrlC->GainsIndices[ 0 ] & 7, SKP_Silk_uniform8_iCDF, 8 );
-    } else {
-        /* condidtional coding */
-        ec_enc_icdf( psRangeEnc, psEncCtrlC->GainsIndices[ 0 ], SKP_Silk_delta_gain_iCDF, 8 );
-    }
-
-    /* remaining subframes */
-    for( i = 1; i < psEncC->nb_subfr; i++ ) {
-        ec_enc_icdf( psRangeEnc, psEncCtrlC->GainsIndices[ i ], SKP_Silk_delta_gain_iCDF, 8 );
-    }
-
-#ifdef SAVE_ALL_INTERNAL_DATA
-    nBytes_after = SKP_RSHIFT( ec_enc_tell( psRangeEnc, 0 ) + 7, 3 );
-    nBytes_after -= nBytes_before; // bytes just added
-    DEBUG_STORE_DATA( nBytes_gains.dat, &nBytes_after, sizeof( SKP_int ) );
-#endif
-
-    /****************/
-    /* Encode NLSFs */
-    /****************/
-#ifdef SAVE_ALL_INTERNAL_DATA
-    nBytes_before = SKP_RSHIFT( ec_enc_tell( psRangeEnc, 0 ) + 7, 3 );
-#endif
-    /* Range encoding of the NLSF path */
-    psNLSF_CB = psEncC->psNLSF_CB[ psEncCtrlC->sigtype ];
-    for( i = 0; i < psNLSF_CB->nStages; i++ ) {
-        ec_enc_icdf( psRangeEnc, psEncCtrlC->NLSFIndices[ i ], psNLSF_CB->StartPtr[ i ], 8 );
-    }
-
-    /* Encode NLSF interpolation factor */
-    SKP_assert( psEncC->useInterpolatedNLSFs == 1 || psEncCtrlC->NLSFInterpCoef_Q2 == ( 1 << 2 ) );
-    ec_enc_icdf( psRangeEnc, psEncCtrlC->NLSFInterpCoef_Q2, SKP_Silk_NLSF_interpolation_factor_iCDF, 8 );
-
-#ifdef SAVE_ALL_INTERNAL_DATA
-    DEBUG_STORE_DATA( lsf_interpol.dat, &psEncCtrlC->NLSFInterpCoef_Q2, sizeof(int) );
-    nBytes_after = SKP_RSHIFT( ec_enc_tell( psRangeEnc, 0 ) + 7, 3 );
-    nBytes_after -= nBytes_before; // bytes just added
-    DEBUG_STORE_DATA( nBytes_LSF.dat, &nBytes_after, sizeof( SKP_int ) );
-#endif
-
-    if( psEncCtrlC->sigtype == SIG_TYPE_VOICED ) {
-        /*********************/
-        /* Encode pitch lags */
-        /*********************/
-#ifdef SAVE_ALL_INTERNAL_DATA
-        nBytes_before = SKP_RSHIFT( ec_enc_tell( psRangeEnc, 0 ) + 7, 3 );
-#endif
-        /* lag index */
-        encode_absolute_lagIndex = 1;
-        if( psEncC->nFramesInPayloadBuf > 0 && psEncC->prev_sigtype == SIG_TYPE_VOICED ) {
-            /* Delta Encoding */
-            delta_lagIndex = psEncCtrlC->lagIndex - psEncC->prev_lagIndex;
-            if( delta_lagIndex < -8 || delta_lagIndex > 11 ) {
-                delta_lagIndex = 0;
-            } else {
-                delta_lagIndex = delta_lagIndex + 9;
-                encode_absolute_lagIndex = 0; /* Only use delta */
-            }
-            SKP_assert( delta_lagIndex < 21 );
-            ec_enc_icdf( psRangeEnc, delta_lagIndex, SKP_Silk_pitch_delta_iCDF, 8 );
-        }
-        if( encode_absolute_lagIndex ) {
-            /* Absolute encoding */
-            SKP_int32 pitch_high_bits, pitch_low_bits;
-            pitch_high_bits = SKP_DIV32_16( psEncCtrlC->lagIndex, SKP_RSHIFT( psEncC->fs_kHz, 1 ) );
-            pitch_low_bits = psEncCtrlC->lagIndex - SKP_SMULBB( pitch_high_bits, SKP_RSHIFT( psEncC->fs_kHz, 1 ) );
-            SKP_assert( pitch_low_bits < psEncC->fs_kHz / 2 );
-            SKP_assert( pitch_high_bits < 32 );
-            ec_enc_icdf( psRangeEnc, pitch_high_bits, SKP_Silk_pitch_lag_iCDF, 8 );
-            ec_enc_icdf( psRangeEnc, pitch_low_bits, psEncC->pitch_lag_low_bits_iCDF, 8 );
-        }
-        psEncC->prev_lagIndex = psEncCtrlC->lagIndex;
-
-#ifdef SAVE_ALL_INTERNAL_DATA
-        nBytes_after = SKP_RSHIFT( ec_enc_tell( psRangeEnc, 0 ) + 7, 3 );
-        nBytes_lagIndex = nBytes_after - nBytes_before; // bytes just added
-#endif
-
-#ifdef SAVE_ALL_INTERNAL_DATA
-        nBytes_before = SKP_RSHIFT( ec_enc_tell( psRangeEnc, 0 ) + 7, 3 );
-#endif
-        /* Countour index */
-        SKP_assert( ( psEncCtrlC->contourIndex < 34 && psEncC->fs_kHz  > 8 && psEncC->nb_subfr == 4 ) ||
-                    ( psEncCtrlC->contourIndex < 11 && psEncC->fs_kHz == 8 && psEncC->nb_subfr == 4 ) ||
-                    ( psEncCtrlC->contourIndex < 12 && psEncC->fs_kHz  > 8 && psEncC->nb_subfr == 2 ) ||
-                    ( psEncCtrlC->contourIndex <  3 && psEncC->fs_kHz == 8 && psEncC->nb_subfr == 2 ) );
-        ec_enc_icdf( psRangeEnc, psEncCtrlC->contourIndex, psEncC->pitch_contour_iCDF, 8 );
-#ifdef SAVE_ALL_INTERNAL_DATA
-        nBytes_after = SKP_RSHIFT( ec_enc_tell( psRangeEnc, 0 ) + 7, 3 );
-        nBytes_contourIndex = nBytes_after - nBytes_before; // bytes just added
-#endif
-
-        /********************/
-        /* Encode LTP gains */
-        /********************/
-#ifdef SAVE_ALL_INTERNAL_DATA
-        nBytes_before = SKP_RSHIFT( ec_enc_tell( psRangeEnc, 0 ) + 7, 3 );
-#endif
-
-        /* PERIndex value */
-        ec_enc_icdf( psRangeEnc, psEncCtrlC->PERIndex, SKP_Silk_LTP_per_index_iCDF, 8 );
-
-        /* Codebook Indices */
-        for( k = 0; k < psEncC->nb_subfr; k++ ) {
-            ec_enc_icdf( psRangeEnc, psEncCtrlC->LTPIndex[ k ], SKP_Silk_LTP_gain_iCDF_ptrs[ psEncCtrlC->PERIndex ], 8 );
-        }
-
-        /**********************/
-        /* Encode LTP scaling */
-        /**********************/
-        ec_enc_icdf( psRangeEnc, psEncCtrlC->LTP_scaleIndex, SKP_Silk_LTPscale_iCDF, 8 );
-#ifdef SAVE_ALL_INTERNAL_DATA
-        nBytes_after = SKP_RSHIFT( ec_enc_tell( psRangeEnc, 0 ) + 7, 3 );
-        nBytes_LTP = nBytes_after - nBytes_before; // bytes just added
-#endif
-    }
-#ifdef SAVE_ALL_INTERNAL_DATA
-    else { 
-        // Unvoiced speech
-        nBytes_lagIndex     = 0;
-        nBytes_contourIndex = 0;
-        nBytes_LTP          = 0;
-    }
-    DEBUG_STORE_DATA( nBytes_lagIndex.dat,      &nBytes_lagIndex,       sizeof( SKP_int ) );
-    DEBUG_STORE_DATA( nBytes_contourIndex.dat,  &nBytes_contourIndex,   sizeof( SKP_int ) );
-    DEBUG_STORE_DATA( nBytes_LTP.dat,           &nBytes_LTP,            sizeof( SKP_int ) );
-#endif
-
-#ifdef SAVE_ALL_INTERNAL_DATA
-    nBytes_before = SKP_RSHIFT( ec_enc_tell( psRangeEnc, 0 ) + 7, 3 );
-#endif
-
-    /***************/
-    /* Encode seed */
-    /***************/
-    ec_enc_icdf( psRangeEnc, psEncCtrlC->Seed, SKP_Silk_Seed_iCDF, 8 );
-}
--- a/src_common/SKP_Silk_encode_pulses.c
+++ b/src_common/SKP_Silk_encode_pulses.c
@@ -72,14 +72,14 @@
 /* Encode quantization indices of excitation */
 void SKP_Silk_encode_pulses(
     ec_enc                      *psRangeEnc,        /* I/O  compressor data structure                   */
-    const SKP_int               sigtype,            /* I    Sigtype                                     */
-    const SKP_int               QuantOffsetType,    /* I    QuantOffsetType                             */
+    const SKP_int               signalType,         /* I    Sigtype                                     */
+    const SKP_int               quantOffsetType,    /* I    quantOffsetType                             */
     SKP_int8                    q[],                /* I    quantization indices                        */
     const SKP_int               frame_length        /* I    Frame length                                */
 )
 {
     SKP_int   i, k, j, iter, bit, nLS, scale_down, RateLevelIndex = 0;
-    SKP_int32 abs_q, minSumBits_Q6, sumBits_Q6;
+    SKP_int32 abs_q, minSumBits_Q5, sumBits_Q5;
     SKP_int   abs_pulses[ MAX_FRAME_LENGTH ];
     SKP_int   sum_pulses[ MAX_NB_SHELL_BLOCKS ];
     SKP_int   nRshifts[   MAX_NB_SHELL_BLOCKS ];
@@ -86,8 +86,8 @@
     SKP_int   pulses_comb[ 8 ];
     SKP_int   *abs_pulses_ptr;
     const SKP_int8 *pulses_ptr;
-    const SKP_uint16 *cdf_ptr;
-    const SKP_int16 *nBits_ptr;
+    const SKP_uint8 *cdf_ptr;
+    const SKP_uint8 *nBits_ptr;
 
     SKP_memset( pulses_comb, 0, 8 * sizeof( SKP_int ) ); // Fixing Valgrind reported problem
 
@@ -150,40 +150,37 @@
     /* Rate level */
     /**************/
     /* find rate level that leads to fewest bits for coding of pulses per block info */
-    minSumBits_Q6 = SKP_int32_MAX;
+    minSumBits_Q5 = SKP_int32_MAX;
     for( k = 0; k < N_RATE_LEVELS - 1; k++ ) {
-        nBits_ptr  = SKP_Silk_pulses_per_block_BITS_Q6[ k ];
-        sumBits_Q6 = SKP_Silk_rate_levels_BITS_Q6[sigtype][ k ];
+        nBits_ptr  = SKP_Silk_pulses_per_block_BITS_Q5[ k ];
+        sumBits_Q5 = SKP_Silk_rate_levels_BITS_Q5[ signalType >> 1 ][ k ];
         for( i = 0; i < iter; i++ ) {
             if( nRshifts[ i ] > 0 ) {
-                sumBits_Q6 += nBits_ptr[ MAX_PULSES + 1 ];
+                sumBits_Q5 += nBits_ptr[ MAX_PULSES + 1 ];
             } else {
-                sumBits_Q6 += nBits_ptr[ sum_pulses[ i ] ];
+                sumBits_Q5 += nBits_ptr[ sum_pulses[ i ] ];
             }
         }
-        if( sumBits_Q6 < minSumBits_Q6 ) {
-            minSumBits_Q6 = sumBits_Q6;
+        if( sumBits_Q5 < minSumBits_Q5 ) {
+            minSumBits_Q5 = sumBits_Q5;
             RateLevelIndex = k;
         }
     }
-    ec_encode_bin( psRangeEnc, SKP_Silk_rate_levels_CDF[ sigtype ][ RateLevelIndex ], 
-        SKP_Silk_rate_levels_CDF[ sigtype ][ RateLevelIndex + 1 ], 16 );
+    ec_enc_icdf( psRangeEnc, RateLevelIndex, SKP_Silk_rate_levels_iCDF[ signalType >> 1 ], 8 );
 
     /***************************************************/
     /* Sum-Weighted-Pulses Encoding                    */
     /***************************************************/
-    cdf_ptr = SKP_Silk_pulses_per_block_CDF[ RateLevelIndex ];
+    cdf_ptr = SKP_Silk_pulses_per_block_iCDF[ RateLevelIndex ];
     for( i = 0; i < iter; i++ ) {
         if( nRshifts[ i ] == 0 ) {
-            ec_encode_bin( psRangeEnc, cdf_ptr[ sum_pulses[ i ] ], cdf_ptr[ sum_pulses[ i ] + 1 ], 16 );
+            ec_enc_icdf( psRangeEnc, sum_pulses[ i ], cdf_ptr, 8 );
         } else {
-            ec_encode_bin( psRangeEnc, cdf_ptr[ MAX_PULSES + 1 ], cdf_ptr[ MAX_PULSES + 2 ], 16 );
+            ec_enc_icdf( psRangeEnc, MAX_PULSES + 1, cdf_ptr, 8 );
             for( k = 0; k < nRshifts[ i ] - 1; k++ ) {
-                ec_encode_bin( psRangeEnc, SKP_Silk_pulses_per_block_CDF[ N_RATE_LEVELS - 1 ][ MAX_PULSES + 1 ], 
-                    SKP_Silk_pulses_per_block_CDF[ N_RATE_LEVELS - 1 ][ MAX_PULSES + 2 ], 16 );
+                ec_enc_icdf( psRangeEnc, MAX_PULSES + 1, SKP_Silk_pulses_per_block_iCDF[ N_RATE_LEVELS - 1 ], 8 );
             }
-            ec_encode_bin( psRangeEnc, SKP_Silk_pulses_per_block_CDF[ N_RATE_LEVELS - 1 ][ sum_pulses[ i ] ], 
-                SKP_Silk_pulses_per_block_CDF[ N_RATE_LEVELS - 1 ][ sum_pulses[ i ] + 1 ], 16 );
+            ec_enc_icdf( psRangeEnc, sum_pulses[ i ], SKP_Silk_pulses_per_block_iCDF[ N_RATE_LEVELS - 1 ], 8 );
         }
     }
 
@@ -219,6 +216,6 @@
     /****************/
     /* Encode signs */
     /****************/
-    SKP_Silk_encode_signs( psRangeEnc, q, frame_length, sigtype, QuantOffsetType, RateLevelIndex );
+    SKP_Silk_encode_signs( psRangeEnc, q, frame_length, signalType, quantOffsetType, sum_pulses );
 #endif
 }
--- a/src_common/SKP_Silk_main.h
+++ b/src_common/SKP_Silk_main.h
@@ -51,22 +51,22 @@
 
 /* Encodes signs of excitation */
 void SKP_Silk_encode_signs(
-    ec_enc                      *psRangeEnc,        /* I/O  Compressor data structure                   */
-    const SKP_int8              q[],                /* I    pulse signal                                */
-    const SKP_int               length,             /* I    length of input                             */
-    const SKP_int               sigtype,            /* I    Signal type                                 */
-    const SKP_int               QuantOffsetType,    /* I    Quantization offset type                    */
-    const SKP_int               RateLevelIndex      /* I    Rate Level Index                            */
+    ec_enc                      *psRangeEnc,                        /* I/O  Compressor data structure                   */
+    const SKP_int8              q[],                                /* I    pulse signal                                */
+    SKP_int                     length,                             /* I    length of input                             */
+    const SKP_int               signalType,                         /* I    Signal type                                 */
+    const SKP_int               quantOffsetType,                    /* I    Quantization offset type                    */
+    const SKP_int               sum_pulses[ MAX_NB_SHELL_BLOCKS ]   /* I    Sum of absolute pulses per block            */
 );
 
 /* Decodes signs of excitation */
 void SKP_Silk_decode_signs(
-    ec_dec                      *psRangeDec,        /* I/O  Compressor data structure                   */
-    SKP_int                     q[],                /* I/O  pulse signal                                */
-    const SKP_int               length,             /* I    length of output                            */
-    const SKP_int               sigtype,            /* I    Signal type                                 */
-    const SKP_int               QuantOffsetType,    /* I    Quantization offset type                    */
-    const SKP_int               RateLevelIndex      /* I    Rate Level Index                            */
+    ec_dec                      *psRangeDec,                        /* I/O  Compressor data structure                   */
+    SKP_int                     q[],                                /* I/O  pulse signal                                */
+    SKP_int                     length,                             /* I    length of input                             */
+    const SKP_int               signalType,                         /* I    Signal type                                 */
+    const SKP_int               quantOffsetType,                    /* I    Quantization offset type                    */
+    const SKP_int               sum_pulses[ MAX_NB_SHELL_BLOCKS ]   /* I    Sum of absolute pulses per block            */
 );
 
 /* Control internal sampling rate */
@@ -82,8 +82,8 @@
 /* Encode quantization indices of excitation */
 void SKP_Silk_encode_pulses(
     ec_enc                      *psRangeEnc,        /* I/O  compressor data structure                   */
-    const SKP_int               sigtype,            /* I    Sigtype                                     */
-    const SKP_int               QuantOffsetType,    /* I    QuantOffsetType                             */
+    const SKP_int               signalType,         /* I    Signal type                                 */
+    const SKP_int               quantOffsetType,    /* I    quantOffsetType                             */
     SKP_int8                    q[],                /* I    quantization indices                        */
     const SKP_int               frame_length        /* I    Frame length                                */
 );
@@ -101,17 +101,6 @@
     const SKP_int               pulses4             /* I    number of pulses per pulse-subframe         */
 );
 
-/***************/
-/* Range coder */
-/***************/
-/* Range decoder for one symbol */
-void SKP_Silk_range_decoder(
-    SKP_int                     data[],             /* O    uncompressed data                           */
-    ec_dec                      *psRangeDec,        /* I/O  Compressor data structure                   */
-    const SKP_uint16            prob[],             /* I    cumulative density function                 */
-    SKP_int                     probIx              /* I    initial (middle) entry of cdf               */
-);
-
 /* Gain scalar quantization with hysteresis, uniform on log scale */
 void SKP_Silk_gains_quant(
     SKP_int                         ind[ MAX_NB_SUBFR ],        /* O    gain indices                            */
@@ -152,7 +141,7 @@
     SKP_int             cbk_index[ MAX_NB_SUBFR ],                      /* O    Codebook Index              */
     SKP_int             *periodicity_index,                             /* O    Periodicity Index           */
     const SKP_int32     W_Q18[ MAX_NB_SUBFR*LTP_ORDER*LTP_ORDER ],      /* I    Error Weights in Q18        */
-    SKP_int             mu_Q10,                                         /* I    Mu value (R/D tradeoff)     */
+    SKP_int             mu_Q9,                                          /* I    Mu value (R/D tradeoff)     */
     SKP_int             lowComplexity,                                  /* I    Flag for low complexity     */
     const SKP_int       nb_subfr                                        /* I    number of subframes         */
 );
@@ -164,8 +153,8 @@
     const SKP_int16                 *in_Q14,            /* I    input vector to be quantized                */
     const SKP_int32                 *W_Q18,             /* I    weighting matrix                            */
     const SKP_int8                  *cb_Q7,             /* I    codebook                                    */
-    const SKP_int8                  *cl_Q4,             /* I    code length for each codebook vector        */
-    const SKP_int                   mu_Q10,             /* I    tradeoff between weighted error and rate    */
+    const SKP_uint8                 *cl_Q5,             /* I    code length for each codebook vector        */
+    const SKP_int                   mu_Q9,              /* I    tradeoff between weighted error and rate    */
     SKP_int                         L                   /* I    number of vectors in codebook               */
 );
 
@@ -349,7 +338,7 @@
 );
 
 /* Encoding of various parameters */
-void SKP_Silk_encode_parameters(
+void SKP_Silk_encode_indices(
     SKP_Silk_encoder_state      *psEncC,            /* I/O  Encoder state                               */
     SKP_Silk_encoder_control    *psEncCtrlC,        /* I/O  Encoder control                             */
     ec_enc                      *psRangeEnc         /* I/O  Compressor data structure                   */
@@ -361,11 +350,6 @@
     const SKP_int16             nBytesIn,           /* I:   Number of input Bytes                       */
     SKP_uint8                   *Layer0data,        /* O:   Layer0 payload                              */
     SKP_int32                   *nLayer0Bytes       /* O:   Number of FEC Bytes                         */
-);
-
-/* Resets LBRR buffer, used if packet size changes */
-void SKP_Silk_LBRR_reset( 
-    SKP_Silk_encoder_state      *psEncC             /* I/O  Pointer to Silk encoder state               */
 );
 
 /* Predict number of bytes used to encode q */
--- a/src_common/SKP_Silk_quant_LTP_gains.c
+++ b/src_common/SKP_Silk_quant_LTP_gains.c
@@ -32,13 +32,13 @@
     SKP_int             cbk_index[ MAX_NB_SUBFR ],                      /* O    Codebook Index              */
     SKP_int             *periodicity_index,                             /* O    Periodicity Index           */
     const SKP_int32     W_Q18[ MAX_NB_SUBFR*LTP_ORDER*LTP_ORDER ],      /* I    Error Weights in Q18        */
-    SKP_int             mu_Q10,                                         /* I    Mu value (R/D tradeoff)     */
+    SKP_int             mu_Q9,                                          /* I    Mu value (R/D tradeoff)     */
     SKP_int             lowComplexity,                                  /* I    Flag for low complexity     */
     const SKP_int       nb_subfr                                        /* I    number of subframes         */
 )
 {
     SKP_int             j, k, temp_idx[ MAX_NB_SUBFR ], cbk_size;
-    const SKP_int8      *cl_ptr_Q4;
+    const SKP_uint8     *cl_ptr_Q5;
     const SKP_int8      *cbk_ptr_Q7;
     const SKP_int16     *b_Q14_ptr;
     const SKP_int32     *W_Q18_ptr;
@@ -53,7 +53,7 @@
     /***************************************************/
     min_rate_dist_Q14 = SKP_int32_MAX;
     for( k = 0; k < 3; k++ ) {
-        cl_ptr_Q4  = SKP_Silk_LTP_gain_BITS_Q4_ptrs[ k ];
+        cl_ptr_Q5  = SKP_Silk_LTP_gain_BITS_Q5_ptrs[ k ];
         cbk_ptr_Q7 = SKP_Silk_LTP_vq_ptrs_Q7[        k ];
         cbk_size   = SKP_Silk_LTP_vq_sizes[          k ];
 
@@ -70,8 +70,8 @@
                 b_Q14_ptr,              /* I    input vector to be quantized                            */
                 W_Q18_ptr,              /* I    weighting matrix                                        */
                 cbk_ptr_Q7,             /* I    codebook                                                */
-                cl_ptr_Q4,              /* I    code length for each codebook vector                    */
-                mu_Q10,                 /* I    tradeoff between weighted error and rate                */
+                cl_ptr_Q5,              /* I    code length for each codebook vector                    */
+                mu_Q9,                  /* I    tradeoff between weighted error and rate                */
                 cbk_size                /* I    number of vectors in codebook                           */
             );
 
--- a/src_common/SKP_Silk_range_coder.c
+++ /dev/null
@@ -1,82 +1,0 @@
-/***********************************************************************
-Copyright (c) 2006-2010, Skype Limited. All rights reserved. 
-Redistribution and use in source and binary forms, with or without 
-modification, (subject to the limitations in the disclaimer below) 
-are permitted provided that the following conditions are met:
-- Redistributions of source code must retain the above copyright notice,
-this list of conditions and the following disclaimer.
-- Redistributions in binary form must reproduce the above copyright 
-notice, this list of conditions and the following disclaimer in the 
-documentation and/or other materials provided with the distribution.
-- Neither the name of Skype Limited, nor the names of specific 
-contributors, may be used to endorse or promote products derived from 
-this software without specific prior written permission.
-NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED 
-BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 
-CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
-BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 
-FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-***********************************************************************/
-
-#include "SKP_Silk_main.h"
-
-/* Range decoder for one symbol */
-void SKP_Silk_range_decoder(
-    SKP_int                         data[],             /* O    uncompressed data                           */
-    ec_dec                          *psRangeDec,        /* I/O  Compressor data structure                   */
-    const SKP_uint16                prob[],             /* I    cumulative density function                 */
-    SKP_int                         probIx              /* I    initial (middle) entry of cdf               */
-)
-{
-    SKP_uint32 low_Q16, high_Q16;
-
-    SKP_uint32 low_Q16_returned;
-    SKP_int    temp;
-
-    if( prob[ 2 ] == 65535 ) {
-        /* Instead of detection, we could add a separate function and call when we know that output is a bit */
-        *data = ec_dec_bit_prob( psRangeDec, 65536 - prob[ 1 ] );
-    } else {
-        low_Q16_returned = ec_decode_bin( psRangeDec, 16 );
-
-#if 1
-        temp = 0;
-        while( low_Q16_returned >= prob[ ++temp ] ) {}
-        *data = temp - 1;
-#else
-        temp = probIx;
-        if( low_Q16_returned >= prob[ temp ] ){
-            while( low_Q16_returned >= prob[ temp ] ) {
-                temp++;
-            }
-            temp = temp - 1;
-        } else {
-            /* search down */
-            while( low_Q16_returned < prob[ temp ] ) {
-                temp--;
-            }
-        }
-        *data = temp;
-#endif
-
-        low_Q16  = prob[ *data ];
-        high_Q16 = prob[ *data + 1 ];
-
-#ifdef SAVE_ALL_INTERNAL_DATA
-        DEBUG_STORE_DATA( dec_lr.dat, &low_Q16_returned,  sizeof( SKP_uint32 ) );
-        DEBUG_STORE_DATA( dec_l.dat,  &low_Q16,           sizeof( SKP_uint32 ) );
-        DEBUG_STORE_DATA( dec_h.dat,  &high_Q16,          sizeof( SKP_uint32 ) );
-#endif  
-        ec_dec_update( psRangeDec, low_Q16, high_Q16,( 1 << 16 ) );
-    }
-#ifdef SAVE_ALL_INTERNAL_DATA
-    DEBUG_STORE_DATA( dec.dat, data, sizeof( SKP_int ) );
-#endif
-}
--- a/src_common/SKP_Silk_setup_complexity.h
+++ b/src_common/SKP_Silk_setup_complexity.h
@@ -41,11 +41,9 @@
     }
 
     /* Set encoding complexity */
-    if( Complexity == 0 || LOW_COMPLEXITY_ONLY ) {
-        /* Low complexity */
-        psEncC->Complexity                      = 0;
+    if( Complexity < 2 || LOW_COMPLEXITY_ONLY ) {
         psEncC->pitchEstimationComplexity       = SKP_Silk_PE_MIN_COMPLEX;
-        psEncC->pitchEstimationThreshold_Q16    = SKP_FIX_CONST( FIND_PITCH_CORRELATION_THRESHOLD_LOW_COMPL_MODE, 16 );
+        psEncC->pitchEstimationThreshold_Q16    = SKP_FIX_CONST( 0.8, 16 );
         psEncC->pitchEstimationLPCOrder         = 6;
         psEncC->shapingLPCOrder                 = 8;
         psEncC->la_shape                        = 3 * psEncC->fs_kHz;
@@ -52,26 +50,44 @@
         psEncC->nStatesDelayedDecision          = 1;
         psEncC->useInterpolatedNLSFs            = 0;
         psEncC->LTPQuantLowComplexity           = 1;
-        psEncC->NLSF_MSVQ_Survivors             = MAX_NLSF_MSVQ_SURVIVORS_LC_MODE;
+        psEncC->NLSF_MSVQ_Survivors             = 2;
         psEncC->warping_Q16                     = 0;
-    } else if( Complexity == 1 ) {
-        /* Medium complexity */
-        psEncC->Complexity                      = 1;
+    } else if( Complexity < 4 || LOW_COMPLEXITY_ONLY ) {
         psEncC->pitchEstimationComplexity       = SKP_Silk_PE_MID_COMPLEX;
-        psEncC->pitchEstimationThreshold_Q16    = SKP_FIX_CONST( FIND_PITCH_CORRELATION_THRESHOLD_MID_COMPL_MODE, 16 );
-        psEncC->pitchEstimationLPCOrder         = 12;
+        psEncC->pitchEstimationThreshold_Q16    = SKP_FIX_CONST( 0.76, 16 );
+        psEncC->pitchEstimationLPCOrder         = 8;
+        psEncC->shapingLPCOrder                 = 10;
+        psEncC->la_shape                        = 5 * psEncC->fs_kHz;
+        psEncC->nStatesDelayedDecision          = 1;
+        psEncC->useInterpolatedNLSFs            = 1;
+        psEncC->LTPQuantLowComplexity           = 0;
+        psEncC->NLSF_MSVQ_Survivors             = 4;
+        psEncC->warping_Q16                     = 0;
+    } else if( Complexity < 6 ) {
+        psEncC->pitchEstimationComplexity       = SKP_Silk_PE_MID_COMPLEX;
+        psEncC->pitchEstimationThreshold_Q16    = SKP_FIX_CONST( 0.74, 16 );
+        psEncC->pitchEstimationLPCOrder         = 10;
         psEncC->shapingLPCOrder                 = 12;
         psEncC->la_shape                        = 5 * psEncC->fs_kHz;
         psEncC->nStatesDelayedDecision          = 2;
         psEncC->useInterpolatedNLSFs            = 0;
         psEncC->LTPQuantLowComplexity           = 0;
-        psEncC->NLSF_MSVQ_Survivors             = MAX_NLSF_MSVQ_SURVIVORS_MC_MODE;
+        psEncC->NLSF_MSVQ_Survivors             = 6;
         psEncC->warping_Q16                     = psEncC->fs_kHz * SKP_FIX_CONST( WARPING_MULTIPLIER, 16 );
-    } else if( Complexity == 2 ) {
-        /* High complexity */
-        psEncC->Complexity                      = 2;
+    } else if( Complexity < 8 ) {
+        psEncC->pitchEstimationComplexity       = SKP_Silk_PE_MID_COMPLEX;
+        psEncC->pitchEstimationThreshold_Q16    = SKP_FIX_CONST( 0.72, 16 );
+        psEncC->pitchEstimationLPCOrder         = 12;
+        psEncC->shapingLPCOrder                 = 14;
+        psEncC->la_shape                        = 5 * psEncC->fs_kHz;
+        psEncC->nStatesDelayedDecision          = 3;
+        psEncC->useInterpolatedNLSFs            = 0;
+        psEncC->LTPQuantLowComplexity           = 0;
+        psEncC->NLSF_MSVQ_Survivors             = 8;
+        psEncC->warping_Q16                     = psEncC->fs_kHz * SKP_FIX_CONST( WARPING_MULTIPLIER, 16 );
+    } else if( Complexity <= 10 ) {
         psEncC->pitchEstimationComplexity       = SKP_Silk_PE_MAX_COMPLEX;
-        psEncC->pitchEstimationThreshold_Q16    = SKP_FIX_CONST( FIND_PITCH_CORRELATION_THRESHOLD_HI_COMPL_MODE, 16 );
+        psEncC->pitchEstimationThreshold_Q16    = SKP_FIX_CONST( 0.7, 16 );
         psEncC->pitchEstimationLPCOrder         = 16;
         psEncC->shapingLPCOrder                 = 16;
         psEncC->la_shape                        = 5 * psEncC->fs_kHz;
@@ -78,7 +94,7 @@
         psEncC->nStatesDelayedDecision          = MAX_DEL_DEC_STATES;
         psEncC->useInterpolatedNLSFs            = 1;
         psEncC->LTPQuantLowComplexity           = 0;
-        psEncC->NLSF_MSVQ_Survivors             = MAX_NLSF_MSVQ_SURVIVORS;
+        psEncC->NLSF_MSVQ_Survivors             = 16;
         psEncC->warping_Q16                     = psEncC->fs_kHz * SKP_FIX_CONST( WARPING_MULTIPLIER, 16 );
     } else {
         ret = SKP_SILK_ENC_INVALID_COMPLEXITY_SETTING;
@@ -85,8 +101,9 @@
     }
 
     /* Do not allow higher pitch estimation LPC order than predict LPC order */
-    psEncC->pitchEstimationLPCOrder             = SKP_min_int( psEncC->pitchEstimationLPCOrder, psEncC->predictLPCOrder );
-    psEncC->shapeWinLength                      = SUB_FRAME_LENGTH_MS * psEncC->fs_kHz + 2 * psEncC->la_shape;
+    psEncC->pitchEstimationLPCOrder = SKP_min_int( psEncC->pitchEstimationLPCOrder, psEncC->predictLPCOrder );
+    psEncC->shapeWinLength          = SUB_FRAME_LENGTH_MS * psEncC->fs_kHz + 2 * psEncC->la_shape;
+    psEncC->Complexity              = Complexity;
 
     SKP_assert( psEncC->pitchEstimationLPCOrder <= MAX_FIND_PITCH_LPC_ORDER );
     SKP_assert( psEncC->shapingLPCOrder         <= MAX_SHAPE_LPC_ORDER      );
@@ -94,6 +111,7 @@
     SKP_assert( psEncC->warping_Q16             <= 32767                    );
     SKP_assert( psEncC->la_shape                <= LA_SHAPE_MAX             );
     SKP_assert( psEncC->shapeWinLength          <= SHAPE_LPC_WIN_MAX        );
+    SKP_assert( psEncC->NLSF_MSVQ_Survivors     <= MAX_NLSF_MSVQ_SURVIVORS  );
 
     return( ret );
 }
--- a/src_common/SKP_Silk_shell_coder.c
+++ b/src_common/SKP_Silk_shell_coder.c
@@ -45,18 +45,11 @@
     ec_enc                      *psRangeEnc,    /* I/O  compressor data structure                   */
     const SKP_int               p_child1,       /* I:   pulse amplitude of first child subframe     */
     const SKP_int               p,              /* I:   pulse amplitude of current subframe         */
-    const SKP_uint16            *shell_table    /* I:   table of shell cdfs                         */
+    const SKP_uint8             *shell_table    /* I:   table of shell cdfs                         */
 )
 {
-    const SKP_uint16 *cdf;
-
     if( p > 0 ) {
-        cdf = &shell_table[ SKP_Silk_shell_code_table_offsets[ p ] ];
-        if( cdf[ 2 ] == 65535 ) {
-            ec_enc_bit_prob( psRangeEnc, p_child1, 65536 - cdf[ 1 ] );
-        } else {
-            ec_encode_bin( psRangeEnc, cdf[ p_child1 ], cdf[ p_child1 + 1 ], 16 );
-        }
+        ec_enc_icdf( psRangeEnc, p_child1, &shell_table[ SKP_Silk_shell_code_table_offsets[ p ] ], 8 );
     }
 }
 
@@ -65,16 +58,11 @@
     SKP_int                     *p_child2,      /* O:   pulse amplitude of second child subframe    */
     ec_dec                      *psRangeDec,    /* I/O  Compressor data structure                   */
     const SKP_int               p,              /* I:   pulse amplitude of current subframe         */
-    const SKP_uint16            *shell_table    /* I:   table of shell cdfs                         */
+    const SKP_uint8             *shell_table    /* I:   table of shell cdfs                         */
 )
 {
-    SKP_int cdf_middle;
-    const SKP_uint16 *cdf;
-
     if( p > 0 ) {
-        cdf_middle = SKP_RSHIFT( p, 1 );
-        cdf = &shell_table[ SKP_Silk_shell_code_table_offsets[ p ] ];
-        SKP_Silk_range_decoder( p_child1, psRangeDec, cdf, cdf_middle );
+        p_child1[ 0 ] = ec_dec_icdf( psRangeDec, &shell_table[ SKP_Silk_shell_code_table_offsets[ p ] ], 8 );
         p_child2[ 0 ] = p - p_child1[ 0 ];
     } else {
         p_child1[ 0 ] = 0;
--- a/src_common/SKP_Silk_structs.h
+++ b/src_common/SKP_Silk_structs.h
@@ -57,13 +57,6 @@
     SKP_int     rewhite_flag;
 } SKP_Silk_nsq_state; /* FIX*/
 
-/* Struct for Low BitRate Redundant (LBRR) information */
-typedef struct {
-    SKP_uint8   payload[ MAX_ARITHM_BYTES ];    
-    SKP_int     nBytes;                         /* Number of bytes in payload                               */
-    SKP_int     usage;                          /* Tells how the payload should be used as FEC              */
-} SKP_SILK_LBRR_struct;
-
 /********************************/
 /* VAD state                    */
 /********************************/
@@ -138,8 +131,6 @@
 /* Encoder state                */
 /********************************/
 typedef struct {
-    //SKP_Silk_range_coder_state      sRC;                            /* Range coder state                                                    */
-    //SKP_Silk_range_coder_state      sRC_LBRR;                       /* Range coder state (for low bitrate redundancy)                       */
 #if HIGH_PASS_INPUT
     SKP_int32                       In_HP_State[ 2 ];               /* High pass filter state                                               */
 #endif
@@ -149,7 +140,7 @@
     SKP_Silk_VAD_state              sVAD;                           /* Voice activity detector state                                        */
 
     SKP_int                         LBRRprevLastGainIndex;
-    SKP_int                         prev_sigtype;
+    SKP_int                         prevSignalType;
     SKP_int                         typeOffsetPrev;                 /* Previous signal type and quantization offset                         */
     SKP_int                         prevLag;
     SKP_int                         prev_lagIndex;
@@ -179,7 +170,7 @@
     SKP_int                         pitchEstimationLPCOrder;        /* Whitening filter order for pitch estimator                           */
     SKP_int32                       pitchEstimationThreshold_Q16;   /* Threshold for pitch estimator                                        */
     SKP_int                         LTPQuantLowComplexity;          /* Flag for low complexity LTP quantization                             */
-    SKP_int                         mu_LTP_Q10;                     /* Rate-distortion tradeoff in LTP quantization                         */
+    SKP_int                         mu_LTP_Q9;                      /* Rate-distortion tradeoff in LTP quantization                         */
     SKP_int                         NLSF_MSVQ_Survivors;            /* Number of survivors in NLSF MSVQ                                     */
     SKP_int                         first_frame_after_reset;        /* Flag for deactivating NLSF interp. and fluc. reduction after resets  */
     SKP_int                         controlled_since_last_payload;  /* Flag for ensuring codec_control only runs once per packet            */
@@ -199,9 +190,7 @@
 
     const SKP_Silk_NLSF_CB_struct   *psNLSF_CB[ 2 ];                /* Pointers to voiced/unvoiced NLSF codebooks */
 
-    /* Struct for Inband LBRR */ 
-    SKP_SILK_LBRR_struct            LBRR_buffer[ MAX_LBRR_DELAY ];
-    SKP_int                         oldest_LBRR_idx;
+    /* Inband Low Bitrate Redundancy (LBRR) data */ 
     SKP_int                         useInBandFEC;                   /* Saves the API setting for query                                      */
     SKP_int                         LBRR_enabled;
     SKP_int                         LBRR_GainIncreases;             /* Number of shifts to Gains to get LBRR rate Voiced frames             */
@@ -217,7 +206,7 @@
     SKP_int                         noSpeechCounter;                /* Counts concecutive nonactive frames, used by DTX                     */
     SKP_int                         useDTX;                         /* Flag to enable DTX                                                   */
     SKP_int                         inDTX;                          /* Flag to signal DTX period                                            */
-    SKP_int                         vadFlag;                        /* Flag to indicate Voice Activity                                      */
+    SKP_int                         LBRR_nBytes;
 
     /* Struct for detecting SWB input */
     SKP_Silk_detect_SWB_state       sSWBdetect;
@@ -226,8 +215,8 @@
     /* Buffers */
 	SKP_int8                        q[ MAX_FRAME_LENGTH * MAX_FRAMES_PER_PACKET ];      /* pulse signal buffer */
     SKP_int8                        q_LBRR[ MAX_FRAME_LENGTH * MAX_FRAMES_PER_PACKET ]; /* pulse signal buffer */
-    SKP_int                         sigtype[ MAX_FRAMES_PER_PACKET ];
-    SKP_int                         QuantOffsetType[ MAX_FRAMES_PER_PACKET ];
+    SKP_int                         quantOffsetType[ MAX_FRAMES_PER_PACKET ];
+    SKP_int                         signalType[ MAX_FRAMES_PER_PACKET ];
 } SKP_Silk_encoder_state;
 
 
@@ -246,8 +235,8 @@
     SKP_int32   Seed;
     SKP_int     LTP_scaleIndex;
     SKP_int     RateLevelIndex;
-    SKP_int     QuantOffsetType;
-    SKP_int     sigtype;
+    SKP_int     quantOffsetType;
+    SKP_int     signalType;
 
     /* Prediction and coding parameters */
     SKP_int     pitchL[ MAX_NB_SUBFR ];
@@ -321,8 +310,8 @@
 
     const SKP_Silk_NLSF_CB_struct *psNLSF_CB[ 2 ];      /* Pointers to voiced/unvoiced NLSF codebooks */
 
-    SKP_int         sigtype[               MAX_FRAMES_PER_PACKET ];
-    SKP_int         QuantOffsetType[       MAX_FRAMES_PER_PACKET ];
+    SKP_int         signalType[            MAX_FRAMES_PER_PACKET ];
+    SKP_int         quantOffsetType[       MAX_FRAMES_PER_PACKET ];
     SKP_int         GainsIndices[          MAX_FRAMES_PER_PACKET ][ MAX_NB_SUBFR ];
     SKP_int         GainsIndices_EnhLayer[ MAX_FRAMES_PER_PACKET ][ MAX_NB_SUBFR ];
     SKP_int         NLSFIndices[           MAX_FRAMES_PER_PACKET ][ NLSF_MSVQ_MAX_CB_STAGES ];
@@ -333,7 +322,6 @@
     SKP_int         LTPIndex[              MAX_FRAMES_PER_PACKET ][ MAX_NB_SUBFR ];
     SKP_int         LTP_scaleIndex[        MAX_FRAMES_PER_PACKET ];
     SKP_int         Seed[                  MAX_FRAMES_PER_PACKET ];
-    SKP_int         vadFlagBuf[            MAX_FRAMES_PER_PACKET ];
     
     /* Parameters used to investigate if inband FEC is used */
     SKP_int         vadFlag;
@@ -345,7 +333,7 @@
 
     /* Stuff used for PLC */
     SKP_int         lossCnt;
-    SKP_int         prev_sigtype;                               /* Previous sigtype                                                     */
+    SKP_int         prevSignalType;
 
     SKP_Silk_PLC_struct sPLC;
 
@@ -367,8 +355,8 @@
     /* quantization indices */
     SKP_int             PERIndex;
     SKP_int             RateLevelIndex;
-    SKP_int             QuantOffsetType;
-    SKP_int             sigtype;
+    SKP_int             quantOffsetType;
+    SKP_int             signalType;
     SKP_int             NLSFInterpCoef_Q2;
 } SKP_Silk_decoder_control;
 
--- a/src_common/SKP_Silk_tables.h
+++ b/src_common/SKP_Silk_tables.h
@@ -40,7 +40,7 @@
 #endif
 
 /* entropy coding tables */
-extern const SKP_uint8  SKP_Silk_gain_iCDF[ 2 ][ N_LEVELS_QGAIN / 8 ];                               /* 16 */
+extern const SKP_uint8  SKP_Silk_gain_iCDF[ 3 ][ N_LEVELS_QGAIN / 8 ];                               /* 24 */
 extern const SKP_uint8  SKP_Silk_delta_gain_iCDF[ MAX_DELTA_GAIN_QUANT - MIN_DELTA_GAIN_QUANT + 1 ]; /* 43 */
 
 extern const SKP_uint8  SKP_Silk_pitch_lag_iCDF[ 2 * ( PITCH_EST_MAX_LAG_MS - PITCH_EST_MIN_LAG_MS ) ];  /* 32 */
@@ -50,21 +50,19 @@
 extern const SKP_uint8 SKP_Silk_pitch_contour_10_ms_iCDF[12];                                       /*  12 */
 extern const SKP_uint8 SKP_Silk_pitch_contour_10_ms_NB_iCDF[3];                                     /*   3 */
 
-extern const SKP_uint16 SKP_Silk_pulses_per_block_CDF[ N_RATE_LEVELS ][ MAX_PULSES + 3 ];           /* 210 */
-extern const SKP_int    SKP_Silk_pulses_per_block_CDF_offset;
-extern const SKP_int16  SKP_Silk_pulses_per_block_BITS_Q6[ N_RATE_LEVELS - 1 ][ MAX_PULSES + 2 ];   /* 180 */
+extern const SKP_uint8  SKP_Silk_pulses_per_block_iCDF[ N_RATE_LEVELS ][ MAX_PULSES + 2 ];          /* 180 */
+extern const SKP_uint8  SKP_Silk_pulses_per_block_BITS_Q5[ N_RATE_LEVELS - 1 ][ MAX_PULSES + 2 ];   /* 162 */
 
-extern const SKP_uint16 SKP_Silk_rate_levels_CDF[ 2 ][ N_RATE_LEVELS ];                             /*  20 */
-extern const SKP_int    SKP_Silk_rate_levels_CDF_offset;
-extern const SKP_int16  SKP_Silk_rate_levels_BITS_Q6[ 2 ][ N_RATE_LEVELS - 1 ];                     /*  18 */
+extern const SKP_uint8  SKP_Silk_rate_levels_iCDF[ 2 ][ N_RATE_LEVELS - 1 ];                        /*  18 */
+extern const SKP_uint8  SKP_Silk_rate_levels_BITS_Q5[ 2 ][ N_RATE_LEVELS - 1 ];                     /*  18 */
 
-extern const SKP_int    SKP_Silk_max_pulses_table[ 4 ];                                             /*   4 */
+extern const SKP_uint8  SKP_Silk_max_pulses_table[ 4 ];                                             /*   4 */
 
-extern const SKP_uint16 SKP_Silk_shell_code_table0[  33 ];                                          /*  33 */
-extern const SKP_uint16 SKP_Silk_shell_code_table1[  52 ];                                          /*  52 */
-extern const SKP_uint16 SKP_Silk_shell_code_table2[ 102 ];                                          /* 102 */
-extern const SKP_uint16 SKP_Silk_shell_code_table3[ 207 ];                                          /* 207 */
-extern const SKP_uint16 SKP_Silk_shell_code_table_offsets[ 19 ];                                    /*  19 */
+extern const SKP_uint8  SKP_Silk_shell_code_table0[  44 ];                                          /*  44 */
+extern const SKP_uint8  SKP_Silk_shell_code_table1[  65 ];                                          /*  65 */
+extern const SKP_uint8  SKP_Silk_shell_code_table2[  90 ];                                          /*  90 */
+extern const SKP_uint8  SKP_Silk_shell_code_table3[ 152 ];                                          /* 152 */
+extern const SKP_uint8  SKP_Silk_shell_code_table_offsets[ MAX_PULSES + 1 ];                        /*  17 */
 
 extern const SKP_uint8  SKP_Silk_lsb_iCDF[ 2 ];                                                     /*   2 */
 
@@ -77,7 +75,7 @@
 
 extern const SKP_uint8  SKP_Silk_LTP_per_index_iCDF[ 3 ];                                           /*   3 */
 extern const SKP_uint8  * const SKP_Silk_LTP_gain_iCDF_ptrs[ NB_LTP_CBKS ];                         /*   3 */
-extern const SKP_int8   * const SKP_Silk_LTP_gain_BITS_Q4_ptrs[ NB_LTP_CBKS ];                      /*   3 */
+extern const SKP_uint8  * const SKP_Silk_LTP_gain_BITS_Q5_ptrs[ NB_LTP_CBKS ];                      /*   3 */
 extern const SKP_int16  SKP_Silk_LTP_gain_middle_avg_RD_Q14;
 extern const SKP_int8   * const SKP_Silk_LTP_vq_ptrs_Q7[ NB_LTP_CBKS ];                             /* 168 */
 extern const SKP_int8   SKP_Silk_LTP_vq_sizes[ NB_LTP_CBKS ];                                       /*   3 */
@@ -85,10 +83,8 @@
 extern const SKP_uint8  SKP_Silk_LTPscale_iCDF[ 3 ];                                                /*   4 */
 extern const SKP_int16  SKP_Silk_LTPScales_table_Q14[ 3 ];
 
-extern const SKP_uint8  SKP_Silk_vadflag_iCDF[ 2 ];                                                 /*   2 */
-
-extern const SKP_uint8 SKP_Silk_type_offset_iCDF[4];                                                /*   4 */
-extern const SKP_uint8 SKP_Silk_type_offset_joint_iCDF[4][4];                                       /*  16 */
+const SKP_uint8 SKP_Silk_type_offset_iCDF[6];                                                       /*   6 */
+const SKP_uint8 SKP_Silk_type_offset_joint_iCDF[6][6];                                              /*  36 */
 
 extern const SKP_uint8  SKP_Silk_NLSF_interpolation_factor_iCDF[ 5 ];                               /*   5 */
 
--- a/src_common/SKP_Silk_tables_LTP.c
+++ b/src_common/SKP_Silk_tables_LTP.c
@@ -28,41 +28,41 @@
 #include "SKP_Silk_tables.h"
 
 const SKP_uint8 SKP_Silk_LTP_per_index_iCDF[3] = {
-	   188,    111,      0
+	   179,     99,      0
 };
 
 const SKP_uint8 SKP_Silk_LTP_gain_iCDF_0[8] = {
-	    83,     65,     48,     34,     24,     15,      7,      0
+	    71,     56,     43,     30,     21,     12,      6,      0
 };
 
 const SKP_uint8 SKP_Silk_LTP_gain_iCDF_1[16] = {
-	   211,    186,    163,    144,    129,    115,    102,     89,
-	    77,     65,     53,     42,     31,     19,      9,      0
+	   199,    165,    144,    124,    109,     96,     84,     71,
+	    61,     51,     42,     32,     23,     15,      8,      0
 };
 
 const SKP_uint8 SKP_Silk_LTP_gain_iCDF_2[32] = {
-	   241,    227,    214,    202,    191,    180,    170,    160,
-	   149,    139,    129,    120,    110,    101,     92,     84,
-	    76,     69,     61,     54,     47,     40,     35,     30,
-	    26,     21,     17,     13,     10,      6,      3,      0
+	   241,    225,    211,    199,    187,    175,    164,    153,
+	   142,    132,    123,    114,    105,     96,     88,     80,
+	    72,     64,     57,     50,     44,     38,     33,     29,
+	    24,     20,     16,     12,      9,      5,      2,      0
 };
 
-const SKP_int16 SKP_Silk_LTP_gain_middle_avg_RD_Q14 = 14008;
+const SKP_int16 SKP_Silk_LTP_gain_middle_avg_RD_Q14 = 12304;
 
-const SKP_int8 SKP_Silk_LTP_gain_BITS_Q4_0[8] = {
-	     9,     61,     63,     66,     76,     77,     81,     83
+const SKP_uint8 SKP_Silk_LTP_gain_BITS_Q5_0[8] = {
+	    15,    131,    138,    138,    155,    155,    173,    173
 };
 
-const SKP_int8 SKP_Silk_LTP_gain_BITS_Q4_1[16] = {
-	    40,     54,     56,     60,     65,     68,     68,     68,
-	    71,     71,     72,     72,     72,     72,     76,     76
+const SKP_uint8 SKP_Silk_LTP_gain_BITS_Q5_1[16] = {
+	    69,     93,    115,    118,    131,    138,    141,    138,
+	   150,    150,    155,    150,    155,    160,    166,    160
 };
 
-const SKP_int8 SKP_Silk_LTP_gain_BITS_Q4_2[32] = {
-	    65,     67,     69,     70,     73,     74,     74,     74,
-	    74,     75,     75,     76,     76,     76,     78,     80,
-	    80,     81,     82,     82,     82,     86,     90,     91,
-	    92,     95,     95,     96,     99,    100,    102,    102
+const SKP_uint8 SKP_Silk_LTP_gain_BITS_Q5_2[32] = {
+	   131,    128,    134,    141,    141,    141,    145,    145,
+	   145,    150,    155,    155,    155,    155,    160,    160,
+	   160,    160,    166,    166,    173,    173,    182,    192,
+	   182,    192,    192,    192,    205,    192,    205,    224
 };
 
 const SKP_uint8 * const SKP_Silk_LTP_gain_iCDF_ptrs[NB_LTP_CBKS] = {
@@ -71,37 +71,37 @@
     SKP_Silk_LTP_gain_iCDF_2
 };
 
-const SKP_int8 * const SKP_Silk_LTP_gain_BITS_Q4_ptrs[NB_LTP_CBKS] = {
-    SKP_Silk_LTP_gain_BITS_Q4_0,
-    SKP_Silk_LTP_gain_BITS_Q4_1,
-    SKP_Silk_LTP_gain_BITS_Q4_2
+const SKP_uint8 * const SKP_Silk_LTP_gain_BITS_Q5_ptrs[NB_LTP_CBKS] = {
+    SKP_Silk_LTP_gain_BITS_Q5_0,
+    SKP_Silk_LTP_gain_BITS_Q5_1,
+    SKP_Silk_LTP_gain_BITS_Q5_2
 };
 
 const SKP_int8 SKP_Silk_LTP_gain_vq_0[8][5] = 
 {
 {
-	     6,      9,     28,      9,      8
+	     4,      6,     24,      7,      5
 },
 {
 	     0,      0,      2,      0,      0
 },
 {
-	    -4,     32,     55,      5,     -1
+	    12,     28,     41,     13,     -4
 },
 {
-	    -6,      6,     51,     34,      1
+	    -9,     15,     42,     25,     14
 },
 {
-	    27,      8,     43,     26,    -20
+	     1,     -2,     62,     41,     -9
 },
 {
-	     2,      5,     11,      5,      3
+	   -10,     37,     65,     -4,      3
 },
 {
-	   -23,      8,     35,      4,     22
+	    -6,      4,     66,      7,     -8
 },
 {
-	    22,     18,     26,     -6,    -14
+	    16,     14,     38,     -3,     33
 }
 };
 
@@ -108,52 +108,52 @@
 const SKP_int8 SKP_Silk_LTP_gain_vq_1[16][5] = 
 {
 {
-	    10,     22,     39,     23,     17
+	    13,     22,     39,     23,     12
 },
 {
-	     5,     29,     56,     38,     -8
+	    -1,     36,     64,     27,     -6
 },
 {
-	    20,     40,     54,      4,     -5
+	    -7,     10,     55,     43,     17
 },
 {
-	     0,      1,      7,      0,      1
+	     1,      1,      8,      1,      1
 },
 {
-	   -20,     12,     67,     46,      9
+	     6,    -11,     74,     53,     -9
 },
 {
-	    -9,     51,     75,     12,    -12
+	   -12,     55,     76,    -12,      8
 },
 {
-	     6,    -11,     84,     41,    -14
+	    -3,      3,     93,     27,     -4
 },
 {
-	    -8,     15,     96,      5,      3
+	    26,     39,     59,      3,     -8
 },
 {
-	    41,      5,     32,      4,     10
+	     2,      0,     77,     11,      9
 },
 {
-	   -13,     50,     73,    -18,     18
+	    -8,     22,     44,     -6,      7
 },
 {
-	     7,    -14,     56,     47,     10
+	    40,      9,     26,      3,      9
 },
 {
-	    -3,     -2,     73,      8,     10
+	    -7,     20,    101,     -7,      4
 },
 {
-	   -11,     30,     42,     -7,     14
+	     3,     -8,     42,     26,      0
 },
 {
-	   -23,     42,     57,     15,     21
+	   -15,     33,     68,      2,     23
 },
 {
-	    -1,      0,     21,     23,     38
+	    -2,     55,     46,     -2,     15
 },
 {
-	    -1,     -6,     37,     20,     -3
+	     3,     -1,     21,     16,     41
 }
 };
 
@@ -160,100 +160,100 @@
 const SKP_int8 SKP_Silk_LTP_gain_vq_2[32][5] = 
 {
 {
-	    -6,     59,     68,      3,      0
+	    -6,     27,     61,     39,      5
 },
 {
-	    -6,     36,     72,     29,     -6
+	   -11,     42,     88,      4,      1
 },
 {
-	    -3,      1,     93,     24,      6
+	    -2,     60,     65,      6,     -4
 },
 {
-	    -4,     16,     52,     39,     19
+	    -1,     -5,     73,     56,      1
 },
 {
-	     0,    -11,     80,     52,      1
+	    -9,     19,     94,     29,     -9
 },
 {
-	     3,      4,     19,      3,      6
+	     0,     12,     99,      6,      4
 },
 {
-	    -3,     35,     98,      5,    -13
+	     8,    -19,    102,     46,    -13
 },
 {
-	    -9,     16,     75,     60,    -15
+	     3,      2,     13,      3,      2
 },
 {
-	     9,    -21,     84,     71,    -17
+	     9,    -21,     84,     72,    -18
 },
 {
-	    11,    -20,    106,     44,    -13
+	   -11,     46,    104,    -22,      8
 },
 {
-	     3,      9,     98,     33,    -23
+	    18,     38,     48,     23,      0
 },
 {
-	    22,     -4,     65,     51,    -15
+	   -16,     70,     83,    -21,     11
 },
 {
-	    -6,     11,    109,      7,      2
+	     5,    -11,    117,     22,     -8
 },
 {
-	    21,     38,     41,     22,      4
+	    -6,     23,    117,    -12,      3
 },
 {
-	   -19,     72,     83,    -22,     13
+	     3,     -8,     95,     28,      4
 },
 {
-	     1,     24,     77,     -5,     17
+	   -10,     15,     77,     60,    -15
 },
 {
-	     4,    -12,    121,     19,     -6
+	    -1,      4,    124,      2,     -4
 },
 {
-	    -6,     25,    115,    -17,      7
+	     3,     38,     84,     24,    -25
 },
 {
-	    27,     11,     84,     12,    -27
+	     2,     13,     42,     13,     31
 },
 {
-	   -13,     49,    105,    -24,      8
+	    21,     -4,     56,     46,     -1
 },
 {
-	   -21,     43,     91,     -4,     15
+	    -1,     35,     79,    -13,     19
 },
 {
-	     7,     49,     88,    -25,     -4
+	    -7,     65,     88,     -9,    -14
 },
 {
-	     0,      5,    128,     -5,     -4
+	    20,      4,     81,     49,    -29
 },
 {
-	    -9,     67,     95,     -4,    -23
+	    20,      0,     75,      3,    -17
 },
 {
-	     6,    -10,     45,     93,     -9
+	     5,     -9,     44,     92,     -8
 },
 {
-	    -8,     95,     43,    -11,      6
+	     1,     -3,     22,     69,     31
 },
 {
-	    17,    -19,    101,     77,    -42
+	    -6,     95,     41,    -12,      5
 },
 {
-	    35,     74,     19,     -7,      1
+	    39,     67,     16,     -4,      1
 },
 {
-	     3,     12,    128,     27,    -39
+	     0,     -6,    120,     55,    -36
 },
 {
-	     1,     -2,     14,     80,     31
+	   -13,     44,    122,      4,    -24
 },
 {
-	    86,     10,     12,     -3,      3
+	    81,      5,     11,      3,      7
 },
 {
-	     5,     -3,     14,      7,     85
+	     2,      0,      9,     10,     88
 }
 };
 
--- a/src_common/SKP_Silk_tables_NLSF_CB0_10.c
+++ b/src_common/SKP_Silk_tables_NLSF_CB0_10.c
@@ -37,63 +37,63 @@
 
 const SKP_uint8 SKP_Silk_NLSF_MSVQ_CB0_10_CDF[ NLSF_MSVQ_CB0_10_VECTORS ] =
 {
-          244,
-          236,
-          228,
-          220,
-          213,
-          207,
-          201,
-          195,
-          190,
-          184,
-          179,
-          173,
-          168,
-          163,
+          246,
+          237,
+          230,
+          223,
+          216,
+          210,
+          204,
+          198,
+          192,
+          186,
+          180,
+          175,
+          169,
+          164,
           158,
           153,
-          148,
-          143,
-          139,
-          134,
-          129,
-          125,
-          120,
-          116,
-          112,
-          107,
-          103,
-           99,
-           95,
-           91,
-           88,
-           84,
-           80,
-           77,
-           73,
-           69,
-           66,
-           62,
-           59,
-           55,
-           52,
-           48,
-           45,
-           42,
-           39,
-           36,
+          147,
+          142,
+          137,
+          132,
+          127,
+          123,
+          118,
+          113,
+          109,
+          105,
+          101,
+           97,
+           93,
+           89,
+           85,
+           81,
+           78,
+           74,
+           71,
+           67,
+           64,
+           60,
+           57,
+           54,
+           50,
+           47,
+           44,
+           41,
+           38,
+           35,
            32,
            29,
            27,
            24,
            21,
-           18,
+           19,
            16,
-           13,
-           11,
-            9,
-            7,
+           14,
+           12,
+           10,
+            8,
             6,
             5,
             4,
@@ -101,68 +101,68 @@
             2,
             1,
             0,
-          235,
+          234,
           216,
           198,
           180,
           162,
           145,
-          129,
-          112,
-           96,
-           80,
-           65,
+          128,
+          111,
+           95,
+           79,
+           64,
            50,
-           36,
-           22,
+           37,
+           23,
            10,
             0,
-          222,
-          189,
-          155,
-          123,
-           92,
-           62,
-           31,
-            0,
           221,
-          187,
+          188,
           154,
-          122,
+          123,
            91,
-           60,
-           29,
+           59,
+           28,
             0,
           220,
-          186,
-          154,
-          122,
-           90,
-           60,
-           29,
+          185,
+          151,
+          118,
+           85,
+           51,
+           26,
             0,
-          223,
-          189,
-          156,
-          124,
-           92,
-           60,
-           29,
+          220,
+          185,
+          150,
+          116,
+           86,
+           55,
+           26,
             0,
+          220,
+          185,
+          152,
+          118,
+           88,
+           57,
+           28,
+            0,
           236,
-          219,
-          201,
-          184,
-          168,
-          151,
-          134,
-          117,
-          101,
-           85,
-           69,
-           53,
-           38,
-           24,
+          217,
+          199,
+          181,
+          164,
+          146,
+          130,
+          113,
+           97,
+           81,
+           66,
+           51,
+           37,
+           23,
            11,
             0
 };
@@ -180,70 +180,70 @@
 
 const SKP_uint8 SKP_Silk_NLSF_MSVQ_CB0_10_rates_Q4[ NLSF_MSVQ_CB0_10_VECTORS ] =
 {
-               71,               79,
-               80,               81,
+               74,               79,
+               83,               83,
                84,               85,
-               87,               88,
+               85,               87,
+               87,               87,
                88,               88,
                89,               89,
-               90,               90,
+               89,               89,
+               89,               89,
                91,               91,
                92,               92,
-               92,               92,
-               93,               93,
+               92,               94,
                94,               94,
-               94,               95,
-               96,               96,
+               95,               96,
                96,               97,
                97,               98,
-               98,               98,
-               98,               98,
-               99,               99,
-               99,               99,
+               98,               99,
                99,              100,
-              100,              101,
+              100,              100,
+              100,              100,
+              101,              101,
               102,              102,
               102,              103,
-              104,              104,
+              103,              105,
               105,              105,
-              105,              108,
-              111,              111,
-              114,              123,
+              106,              106,
+              108,              108,
+              109,              111,
+              111,              121,
+              124,              128,
               128,              128,
               128,              128,
-              128,              128,
-               58,               60,
+               57,               61,
                61,               61,
-               62,               63,
+               61,               63,
                63,               63,
                64,               64,
-               65,               66,
-               67,               68,
-               69,               76,
-               47,               47,
-               47,               48,
-               49,               49,
-               49,               49,
+               65,               67,
+               68,               68,
+               69,               74,
                46,               47,
                47,               48,
-               49,               49,
-               49,               50,
-               45,               47,
                48,               48,
-               48,               49,
-               49,               50,
+               49,               51,
+               45,               46,
                47,               47,
-               47,               48,
-               48,               48,
-               49,               50,
-               59,               62,
-               62,               63,
+               47,               47,
+               53,               53,
+               45,               46,
+               46,               47,
+               49,               49,
+               50,               53,
+               45,               46,
+               47,               47,
+               49,               49,
+               50,               51,
+               59,               60,
+               61,               61,
+               62,               62,
                63,               63,
-               63,               63,
                64,               64,
-               64,               64,
-               65,               68,
-               68,               73
+               65,               65,
+               67,               67,
+               71,               72
 };
 
 const SKP_int SKP_Silk_NLSF_MSVQ_CB0_10_ndelta_min_Q15[ 10 + 1 ] =
@@ -263,646 +263,646 @@
 
 const SKP_int8 SKP_Silk_NLSF_MSVQ_CB0_10_Q8[ 10 * NLSF_MSVQ_CB0_10_VECTORS ] =
 {
-             -109,              -96,
+             -107,              -97,
               -74,              -56,
-              -35,              -11,
-               17,               45,
-               74,              100,
+              -37,               -8,
+               20,               48,
+               75,              100,
+             -109,              -91,
+              -71,              -48,
+              -20,               -1,
+               23,               47,
+               77,              100,
+             -100,              -93,
+              -78,              -50,
+               -5,                8,
+               28,               53,
+               72,               93,
+             -105,              -97,
+              -82,              -49,
+              -16,               -5,
+               33,               52,
+               72,              100,
               -98,              -92,
-              -76,              -40,
-              -10,                0,
-               28,               47,
-               65,              103,
-             -107,              -92,
-              -69,              -48,
-              -16,                4,
-               29,               49,
-               77,              101,
-             -104,              -94,
-              -81,              -60,
-              -24,              -10,
-               13,               49,
-               67,               94,
-             -104,              -97,
-              -81,              -51,
-                2,               18,
-               33,               53,
-               70,              101,
-             -104,              -96,
-              -82,              -54,
-              -10,                3,
-               26,               51,
-               70,               89,
-             -109,              -99,
-              -84,              -53,
-              -33,              -18,
-               22,               36,
-               77,               96,
-              -92,              -86,
-              -70,              -37,
-              -25,              -10,
-               24,               40,
-               79,               95,
-             -102,              -95,
-              -78,              -47,
-              -32,              -17,
-               34,               52,
-               71,              105,
-             -113,             -106,
-              -85,              -60,
-              -34,              -15,
-               15,               40,
-               63,               93,
-              -99,              -94,
-              -64,              -18,
-               -6,               10,
-               32,               47,
-               88,              104,
-             -115,             -108,
-              -79,              -48,
-              -21,                0,
-               28,               55,
-               77,              101,
-              -94,              -88,
-              -69,              -32,
-                5,               16,
-               37,               57,
-               75,              103,
-             -110,             -101,
-              -87,              -58,
-              -12,                1,
-               19,               38,
-               65,              101,
-             -103,              -96,
-              -80,              -40,
-              -26,              -11,
-                8,               26,
-               78,               93,
-             -104,              -98,
-              -83,              -35,
-              -21,               -7,
-               30,               43,
-               88,              104,
-             -105,             -100,
-              -78,              -21,
-               -7,                6,
-               28,               45,
-               77,               92,
-             -102,              -95,
-              -71,              -34,
-              -21,               -1,
-               22,               41,
-               66,               83,
-              -98,              -91,
-              -71,              -60,
-              -49,               -4,
-               20,               36,
-               85,              101,
-              -86,              -80,
-              -61,              -28,
+              -75,              -39,
               -10,                1,
+               24,               41,
+               62,              103,
+              -99,              -92,
+              -74,              -44,
+              -30,              -16,
+               33,               51,
+               69,              105,
+             -105,              -98,
+              -82,              -51,
+                5,               19,
                35,               54,
+               73,              102,
+             -110,             -101,
+              -85,              -61,
+              -40,              -24,
+               12,               45,
+               67,               97,
+             -104,              -95,
+              -81,              -61,
+              -22,               -8,
+               14,               50,
+               68,               88,
+              -96,              -90,
+              -74,              -44,
+              -30,              -16,
+               20,               34,
+               74,               90,
+              -89,              -83,
+              -64,              -27,
+              -11,                0,
+               36,               54,
                74,              103,
-             -107,             -100,
-              -81,              -45,
-              -35,                2,
-               25,               45,
-               83,               99,
-             -103,              -97,
-              -73,              -33,
-               17,               30,
-               45,               64,
-               81,              105,
-              -86,              -79,
-              -59,              -41,
-              -29,              -14,
-               41,               59,
-               78,              105,
-              -87,              -76,
-              -62,              -45,
-              -23,              -10,
-               20,               44,
-               63,               96,
-             -108,              -99,
-              -73,              -53,
-              -28,                7,
-               27,               42,
-               60,               94,
-              -95,              -87,
-              -72,              -54,
-              -40,              -26,
-               24,               42,
-               60,              102,
-              -96,              -89,
-              -73,              -59,
-              -49,              -25,
+             -102,              -96,
+              -71,              -28,
+              -16,                1,
+               21,               40,
+               71,               86,
+             -102,              -96,
+              -80,              -32,
+              -19,               -4,
                31,               45,
+               88,              103,
+              -90,              -83,
+              -66,              -51,
+              -40,              -20,
+               43,               62,
+               81,              105,
+             -115,             -108,
+              -79,              -49,
+              -21,                0,
+               26,               54,
+               78,              100,
+             -105,              -93,
+              -78,              -59,
+              -28,              -14,
+               11,               32,
+               57,               96,
+             -101,              -96,
+              -68,              -17,
+               -5,                9,
+               30,               46,
+               87,              103,
+             -109,             -101,
+              -87,              -59,
+              -10,                5,
+               23,               41,
+               63,              100,
+              -86,              -78,
+              -63,              -45,
+              -28,              -15,
+               26,               43,
+               63,              102,
+             -106,              -98,
+              -83,              -41,
+              -21,               -7,
+               13,               30,
                80,               96,
-             -100,              -94,
-              -77,              -67,
-              -56,              -14,
-               41,               59,
-               85,              104,
-              -96,              -91,
-              -65,              -30,
-              -18,               -4,
-               14,               28,
-               82,              105,
-             -102,              -95,
-              -59,              -41,
-              -29,               10,
-               31,               52,
+              -94,              -88,
+              -67,              -30,
+                7,               18,
+               37,               55,
+               73,              102,
+              -96,              -90,
+              -73,              -61,
+              -51,              -15,
+               30,               44,
                83,               99,
-             -103,              -97,
-              -78,              -66,
-              -54,                1,
+             -112,             -105,
+              -84,              -61,
+              -35,               -3,
+               21,               39,
+               61,               92,
+             -105,              -98,
+              -80,              -49,
+              -38,               -2,
+               17,               38,
+               79,               94,
+              -86,              -78,
+              -66,              -48,
+              -12,                1,
+               25,               51,
+               71,               94,
+             -108,             -102,
+              -83,              -30,
+                0,               10,
+               35,               51,
+               82,              100,
+             -107,              -99,
+              -84,              -70,
+              -58,              -14,
+               17,               40,
+               75,               97,
+              -94,              -88,
+              -62,              -32,
+              -20,               -6,
+               10,               28,
+               86,              105,
+              -97,              -91,
+              -72,              -62,
+              -50,                1,
+               18,               43,
+               68,               84,
+             -103,              -98,
+              -72,              -32,
+               17,               31,
+               47,               66,
+               83,              105,
+              -99,              -90,
+              -76,              -61,
+              -49,              -33,
+               21,               40,
+               63,              100,
+              -86,              -80,
+              -60,              -43,
+              -32,              -13,
+               26,               39,
+               84,              104,
+             -102,              -96,
+              -61,              -33,
+              -23,               13,
+               31,               54,
+               85,              100,
+             -110,             -100,
+              -87,              -52,
+              -35,              -20,
+               28,               41,
+               83,              102,
+              -91,              -84,
+              -58,              -45,
+              -36,               -2,
                22,               42,
-               70,               87,
-             -109,             -101,
-              -86,              -70,
-              -57,              -17,
-               19,               41,
-               75,               98,
-              -87,              -80,
-              -67,              -51,
-               -7,                6,
-               26,               54,
-               74,               94,
-             -101,              -91,
-              -76,              -52,
-              -27,              -14,
-                8,               27,
-               54,               96,
-              -99,              -93,
-              -65,              -51,
-              -39,              -23,
-              -10,               48,
-               79,               95,
-             -100,              -95,
-              -54,              -37,
-              -25,               -9,
-                5,               51,
-               74,               89,
-             -113,             -107,
-              -93,              -70,
-              -27,                1,
-               23,               46,
-               72,               96,
-              -96,              -86,
-              -67,              -40,
-              -22,              -10,
-               21,               62,
-               80,              100,
+               72,               85,
+             -105,              -96,
+              -66,              -47,
+              -24,               11,
+               31,               45,
+               63,               91,
               -93,              -87,
-              -65,              -49,
-              -37,              -10,
-               11,               30,
-               67,               82,
-             -106,              -97,
-              -83,              -64,
-              -51,              -33,
-               20,               52,
-               72,              100,
-              -93,              -87,
-              -65,              -55,
-              -41,                6,
-               27,               46,
-               70,               84,
-             -109,             -103,
-              -86,              -37,
-                1,               11,
-               34,               50,
-               84,              100,
-             -105,              -99,
-              -61,               -7,
-                6,               20,
+              -70,              -45,
+              -31,              -18,
+               -2,               14,
+               69,              105,
+              -98,              -93,
+              -61,              -48,
+              -35,              -19,
+               -6,               44,
+               69,               85,
+             -101,              -94,
+              -77,              -56,
+              -43,              -24,
+               -7,               18,
+               73,               92,
+             -102,              -95,
+              -77,              -48,
+              -34,              -15,
+                5,               30,
+               55,               79,
+             -100,              -95,
+              -50,              -32,
+              -22,               -5,
+               10,               52,
+               77,               91,
+             -114,             -109,
+              -94,              -71,
+              -27,               -5,
+               21,               47,
+               74,              100,
+              -95,              -80,
+              -65,              -46,
+              -27,              -15,
+               16,               61,
+               79,               98,
+             -105,             -100,
+              -62,               -7,
+                7,               20,
+               44,               61,
+               87,              102,
+             -101,              -95,
+              -81,              -66,
+              -57,              -26,
+               40,               57,
+               83,              104,
+              -97,              -92,
+              -66,              -53,
+              -43,               11,
+               32,               49,
+               89,              102,
+              -99,              -91,
+              -75,              -57,
+              -45,              -29,
+               19,               64,
+               83,              101,
+              -91,              -85,
+              -66,              -55,
+              -44,               -9,
+               11,               27,
+               83,               99,
+             -107,              -99,
+              -83,              -59,
+               -9,               29,
                43,               61,
-               86,              101,
-              -96,              -88,
-              -73,              -54,
-              -40,              -25,
-               18,               64,
-               82,              100,
-              -90,              -83,
-              -67,              -56,
-              -45,              -18,
-               47,               67,
-               85,              106,
-             -103,              -95,
-              -80,              -57,
-              -45,              -24,
-               -4,               19,
-               70,               92,
-              -93,              -87,
-              -69,              -47,
-              -34,              -20,
-               -5,               12,
-               75,              106,
-              -87,              -81,
-              -59,              -42,
-              -28,               -8,
-               10,               30,
-               86,              104,
-             -107,             -100,
-              -85,              -60,
-               -8,               28,
-               42,               61,
-               80,               98,
-              -88,              -81,
-              -62,              -51,
-              -37,                9,
-               37,               52,
-               88,              103,
-              -99,              -94,
-              -74,              -66,
-              -51,               19,
-               41,               57,
-               86,              101,
-             -103,              -96,
-              -76,              -52,
-              -39,              -18,
-               -1,               34,
-               56,               79,
-             -104,              -98,
-              -44,              -21,
-              -11,                9,
-               25,               55,
-               80,               95,
-              -84,              -76,
-              -43,              -28,
-              -15,                8,
-               28,               47,
-               79,               95,
-             -106,              -95,
-              -63,              -39,
-              -12,               19,
-               45,               68,
-               90,              107,
-              -83,              -79,
-              -61,              -49,
-              -41,              -22,
-               26,               40,
-               81,              105,
-              -98,              -93,
-              -81,              -73,
-              -27,                8,
-               28,               58,
+               81,               99,
+             -101,              -96,
+              -77,              -68,
+              -53,               17,
+               35,               53,
+               80,               94,
+              -99,              -93,
+              -65,              -50,
+              -37,              -20,
+               -7,               51,
+               85,              101,
+              -97,              -91,
+              -72,              -64,
+              -49,                2,
+               49,               65,
+               89,              105,
+             -107,              -95,
+              -63,              -41,
+              -14,               17,
+               43,               66,
+               89,              106,
+              -84,              -76,
+              -44,              -28,
+              -15,                5,
+               25,               44,
                78,               95,
-              -85,              -72,
-              -35,              -11,
-                4,               22,
-               40,               61,
-               83,               99,
-              -74,              -70,
-              -62,              -37,
-              -30,              -17,
-               19,               57,
-               75,               97,
-              -95,              -75,
-              -31,              -22,
-              -16,              -11,
-                5,               56,
-               80,              100,
-              -82,              -79,
-              -75,              -72,
-              -23,              -16,
-               24,               49,
-               78,              105,
-              -74,              -70,
-              -61,              -50,
-              -44,                6,
-               29,               50,
-               76,               99,
+             -102,              -97,
+              -42,              -17,
+               -7,               13,
+               29,               55,
+               82,               98,
+              -99,              -94,
+              -81,              -71,
+              -21,                9,
+               28,               53,
+               76,               95,
+              -86,              -79,
+              -62,              -53,
+              -34,               15,
+               37,               54,
+               83,               97,
               -76,              -73,
-              -68,              -51,
-              -46,              -40,
-               14,               46,
+              -57,              -33,
+              -26,              -14,
+               37,               56,
+               76,              103,
+              -85,              -71,
+              -35,              -10,
+                4,               21,
+               40,               59,
+               84,              100,
+              -79,              -77,
+              -71,              -63,
+              -27,              -18,
+               25,               52,
+               77,              103,
+              -81,              -60,
+              -50,              -47,
+              -42,                3,
+               24,               54,
+               80,              104,
+              -97,              -79,
+              -23,              -16,
+              -12,               -9,
+                6,               55,
+               78,              102,
+              -76,              -74,
+              -66,              -49,
+              -47,              -38,
+               14,               47,
                75,              101,
-              -99,              -51,
-              -42,              -39,
-              -34,              -25,
-               27,               53,
-               79,              103,
-                2,                0,
-                4,               10,
+              -93,              -63,
+              -44,              -37,
+              -30,              -23,
+               28,               52,
+               77,              102,
+                5,                4,
                 6,                5,
-                3,                1,
-                3,                0,
-                0,                0,
-               -3,               -6,
-               -8,              -10,
-                1,               -2,
-               -5,                2,
-               -2,               -3,
-               -3,               -5,
-               -9,                4,
-               -2,               -2,
-                0,               -4,
-                2,                1,
-                1,                1,
-               -1,               -1,
-               -2,               -5,
-               -8,              -13,
-               -1,               -1,
-               -4,               -5,
-                9,                6,
-                5,                2,
-               -2,               -1,
-               -1,               -1,
-               -2,               -2,
-               -3,               -7,
-              -13,                4,
-                0,               -3,
-                1,                1,
-               -1,               -1,
-               -3,               -6,
-               10,                5,
-                7,                4,
-                8,                8,
-                6,                1,
-                1,               -2,
-               -2,                1,
-                0,               -2,
-                1,                1,
+                5,                8,
+                4,                4,
+                0,               -2,
+                0,               -1,
+               -3,               -3,
+               -5,               -6,
+              -12,                4,
+               -1,               -3,
+                2,                1,
+                2,                0,
+                1,               -1,
+               -1,               -7,
+              -12,                6,
+               -2,               -3,
+               -8,                8,
+                6,                5,
                 1,                2,
-                3,               -1,
-               -3,               -8,
-              -13,                6,
-                1,                0,
-                3,                2,
                 0,               -1,
-               -6,              -12,
-                9,                4,
-               -5,               -5,
-              -10,                5,
-                3,                2,
-               -1,               -2,
-                3,               -1,
+               -1,               -1,
                 1,                1,
-                6,                3,
+                1,                0,
+               -3,               -5,
+               -9,              -13,
+                0,                0,
+               -2,               -3,
+               -6,              -10,
+                3,               -3,
+               -3,               -5,
+               -2,               -3,
+               -4,               -7,
+               -8,               10,
                 4,                2,
-               -2,               13,
-                7,                3,
-                1,               -1,
-                0,                1,
-               -3,               13,
-                8,                5,
-                3,               -1,
+                1,               -2,
+               -5,               -6,
+               -9,               -3,
+                0,               -3,
+                2,               -2,
+                2,                3,
                 0,               -1,
-               -5,              -14,
-                3,               -1,
-                0,                0,
+                2,               -1,
+               -2,               -3,
+               -8,              -14,
+                4,                2,
+                2,                1,
+                2,                2,
+               -1,               -4,
+               12,                6,
+                4,                5,
+                2,                1,
                 2,                4,
+                3,                3,
+                1,               -5,
+               10,                7,
+                8,                8,
+                4,               -1,
+               -1,               -4,
+               -6,                2,
+                0,               -1,
+                1,                0,
+               -4,              -12,
+                5,                3,
+                3,                3,
+                2,                2,
+                1,                0,
+                2,               -1,
+                1,                0,
+               -3,               15,
+                7,                4,
                -5,               -6,
-                4,                4,
-               -2,               -2,
+                9,                5,
+                2,                3,
                 4,                0,
-               -2,                4,
-               -7,                8,
-                4,                2,
+               -1,                3,
+               -8,                7,
+                3,                2,
                 0,               -2,
-               -1,                0,
-               -3,                0,
                 0,                0,
-               -2,                4,
-                4,                4,
-                3,                0,
-                3,                5,
-                0,                0,
-               -1,               -1,
+               -2,                0,
+               -2,               -2,
                -3,               -4,
-               -4,               -9,
-                1,                0,
-               -1,               -1,
-               -2,                4,
-                2,                0,
-               -4,               -1,
-               -6,               -4,
-                4,                4,
+               -3,               -3,
+               -3,                0,
+               -5,                4,
+                3,                3,
+                2,               -2,
+               -2,                0,
+               -1,               -2,
+               -4,               -8,
+                2,                2,
+                0,                0,
+                7,                4,
                 2,                1,
-               -1,               -3,
-                5,                2,
-               -1,                0,
-               -4,               -4,
-               -6,               -2,
-               -2,               -2,
-                5,                2,
-                0,                1,
+                0,                3,
                 2,                2,
-                0,               -6,
-                3,                5,
                 1,                1,
-               -2,               -4,
-               -1,               -2,
-               10,                3,
-                1,                2,
+               -2,               -6,
+                3,                0,
+               -1,                4,
+               -4,               -4,
+               -5,                1,
+                1,                3,
+                5,                4,
+                1,               -1,
                -1,               -1,
+                7,                5,
+                3,                0,
+               -2,                5,
+                1,               -2,
+               -2,               -2,
+               -3,                2,
+                2,               -1,
+               -4,               -7,
+                3,               -2,
+                1,                1,
+                2,               -3,
+               -7,                3,
                 1,               -1,
+                7,                2,
+               -1,               -1,
+               -3,                3,
+                0,               -1,
+               -2,                0,
+               -6,                0,
                 0,                0,
-                0,               -3,
-               -5,               -1,
-               -5,                7,
-                4,                2,
+               -2,                3,
+                0,                2,
+                3,                1,
+                4,                5,
                 1,                1,
-                1,                0,
-                0,               -4,
-                0,                0,
-               -3,                5,
+               -3,               -3,
+               -4,               -3,
                -2,               -2,
-               -2,               -1,
+                2,                0,
                 1,                1,
-               -2,               -4,
-               -5,                2,
+                0,                0,
+               -1,               -2,
+                5,                5,
+                0,               -3,
                -1,               -1,
-                3,                3,
+               -1,               -5,
+                5,                4,
+                1,                0,
+               -1,               -2,
                 3,                2,
-                4,                3,
+                3,                4,
+                1,                1,
                -1,               -3,
-                0,                0,
-                0,               -2,
+                0,               -1,
                -3,               -4,
-                1,               -1,
-               -1,               -6,
-                3,                3,
-                1,                2,
-                1,                0,
-               -4,               -2,
-                1,               -2,
-               -3,               -3,
-                2,                1,
-                1,                0,
+                4,                1,
+               -2,                0,
+                0,               -2,
+                2,                0,
+                0,                4,
+                4,               -3,
                 0,               -1,
-                6,                2,
-                2,                3,
-                2,               -3,
-               -4,                4,
-                2,                1,
-                3,                1,
-                0,                0,
-               -6,               -1,
+               -4,                2,
+                0,                1,
+               -1,               -1,
+                0,               -1,
+               -3,                4,
+                1,               -2,
+               -2,               -1,
                 1,                1,
-                1,                4,
-                1,                1,
+                0,                0,
+                1,               -1,
+               -4,               -3,
+                0,                2,
+               -1,               -1,
+                0,                3,
+                4,                0,
+                2,                0,
+               -3,                1,
+               -1,               -1,
+               -3,                2,
+               -1,                2,
+               -3,                3,
+                2,                0,
+                1,                0,
+                4,                0,
+               -1,                0,
+                2,                2,
+                1,                3,
+                0,                0,
+                2,                1,
                 1,               -1,
-                2,               -1,
-               -2,               -2,
-               -5,                1,
+                0,               -2,
+                1,               -5,
                -2,               -1,
-                2,                2,
+               -2,               -2,
+                0,               -4,
+                1,                0,
+                2,                1,
+                3,                4,
+                0,               -3,
+                1,               -1,
                 1,                1,
-                2,                3,
                 0,               -1,
-               -4,                1,
-                2,                0,
+               -4,                2,
                -1,                0,
-                0,               -2,
-                4,                4,
-                0,               -2,
-               -5,                3,
+               -1,               -1,
                 0,                0,
+                0,                0,
                 0,               -1,
+                2,                0,
+               -2,               -3,
+               -2,                0,
+               -2,               -1,
+                2,                0,
+               -2,                1,
                 0,                0,
                 1,                0,
-               -1,               -2,
-               -1,               -1,
-                3,                1,
-               -1,               -2,
                 0,               -3,
-                0,               -2,
-                0,               -3,
-               -3,                2,
-                2,               -1,
-                0,                2,
-                2,                1,
-               -2,                1,
-                1,               -1,
+                1,                0,
+                0,               -1,
+                0,               -1,
                 1,               -3,
-                3,                2,
+                0,                3,
                 0,               -2,
-               -1,                4,
+               -1,               -3,
+                0,                1,
+                0,                2,
                 0,                0,
-               -1,                2,
-                1,                2,
-                1,                0,
-               -1,               -2,
-                3,                0,
+                2,                2,
                 1,                1,
+                0,                3,
+                1,                1,
                 0,                1,
-                0,                2,
-                3,                1,
-                1,                0,
-                0,               -2,
-                1,               -1,
-                0,               -1,
-               -1,                0,
                -1,               -2,
-               -3,                0,
-                3,                1,
-               -1,               -1,
-               -2,                2,
-               -1,                0,
-                2,               -2,
-               -1,               -1,
-                1,                0,
                 2,                2,
+                1,                2,
+                0,               -1,
                 0,                0,
-                2,                2,
-               -1,                3,
-               -2,               -1,
-                1,               -2,
-               -1,                0,
-                0,                2,
-               -1,                0,
-                0,                0,
-               -1,                0,
-                0,                4,
-               -1,                1,
+                1,                0,
+                0,                0,
                 2,               -1,
-                1,                2,
-               -1,               -1,
-               -2,               -1,
-               -1,               -1,
-               -1,               -1,
                -2,                1,
-                0,               -2,
+                3,                0,
                 1,                0,
-                1,               -2,
                -1,                0,
-                1,                3,
-                1,                0,
-                1,                0,
+                0,                0,
+               -1,                4,
                -1,                1,
+               -1,                0,
+                0,               -1,
+                0,                1,
+                4,                0,
+               -2,                0,
+                0,               -1,
+               -3,               -1,
+                0,                0,
+                0,               -2,
                 1,                1,
-               -1,                3,
-               -2,                2,
+               -1,                2,
                 0,                0,
-                0,                0,
-                0,                0,
+                0,                1,
+                1,                0,
+                4,                0,
+                1,                0,
+                1,               -1,
+                0,                2,
+               -3,                0,
+                1,               -1,
+                0,                2,
+               -1,                3,
+                1,                0,
                -1,               -1,
+               -1,                0,
                 0,                1,
-                1,               -3,
                 0,                0,
-               -1,                1,
-                0,               -1,
-                1,                0,
+               -4,               -1,
                 0,                1,
-               -1,               -3,
+                1,                0,
                -1,                2,
+               -1,               -1,
+                2,                1,
+               -1,                0,
+               -1,               -1,
                -2,               -2,
-                0,                1,
-                1,                2,
+                1,               -1,
+                0,                0,
                -1,                1,
+                0,                2,
+                2,               -1,
+                1,                1,
+               -1,                1,
+                0,               -1,
+               -3,                0,
                 0,                1,
+                3,               -2,
                 0,                0,
-               -1,                0,
-                0,                0,
-                3,                0,
-                3,                1,
-                0,                0,
-               -1,                0,
                 0,               -1,
+               -1,               -1,
+               -1,               -2,
                -1,                1,
-                2,               -4,
                 1,               -1,
-                2,               -3,
-                1,                0,
+               -1,                0,
+               -1,               -2,
                 0,                1,
                 1,                1,
-                1,                0,
-                0,                2,
-                2,                0,
-               -2,                1,
-               -1,                0,
-                0,               -1,
-               -3,               -2,
-               -1,                0,
-               -1,                0,
-                0,                0,
+                1,               -3,
                 1,                1,
                 0,                0,
-               -1,                1,
-                1,                2,
-               -3,               -1,
-               -1,                0,
-                1,                1,
-               -3,                0,
-                1,                0,
-                0,                0,
-                0,               -2,
-                2,                0,
                 0,               -1,
-                2,               -1,
-                0,               -1,
-                2,               -1,
-                0,                1,
-               -2,                2,
-               -1,                0,
-                0,               -1,
+                0,                2,
+               -2,                0,
+                1,                0,
+                1,                0,
                 2,                1,
-               -1,                1,
+               -1,               -1,
                 0,               -1,
+                1,                0,
+                2,                0,
+                0,               -2,
                 1,               -1,
-                0,               -1
+                1,               -1,
+                1,                0,
+                2,                0
 };
 
 const SKP_Silk_NLSF_CBS SKP_Silk_NLSF_CB0_10_Stage_info[ NLSF_MSVQ_CB0_10_STAGES ] =
--- a/src_common/SKP_Silk_tables_NLSF_CB0_16.c
+++ b/src_common/SKP_Silk_tables_NLSF_CB0_16.c
@@ -37,157 +37,157 @@
 
 const SKP_uint8 SKP_Silk_NLSF_MSVQ_CB0_16_CDF[ NLSF_MSVQ_CB0_16_VECTORS ] =
 {
-          246,
-          237,
-          228,
-          221,
-          214,
-          207,
-          200,
-          194,
-          188,
-          182,
-          177,
-          173,
-          168,
-          163,
-          158,
-          154,
-          149,
-          145,
-          140,
-          136,
-          131,
-          127,
-          123,
-          119,
+          247,
+          238,
+          230,
+          223,
+          215,
+          209,
+          203,
+          197,
+          191,
+          186,
+          180,
+          174,
+          169,
+          164,
+          158,
+          153,
+          148,
+          143,
+          138,
+          134,
+          129,
+          124,
+          119,
           115,
-          110,
-          106,
+          111,
+          107,
           102,
-           99,
-           95,
-           91,
-           87,
-           84,
-           80,
+           98,
+           94,
+           90,
+           86,
+           83,
+           79,
            76,
-           73,
+           72,
            69,
-           66,
+           65,
            62,
            59,
            56,
-           52,
-           49,
-           46,
-           43,
-           40,
-           36,
-           33,
-           31,
-           28,
-           25,
+           53,
+           50,
+           47,
+           44,
+           41,
+           38,
+           35,
+           32,
+           30,
+           27,
+           24,
            22,
-           20,
+           19,
            17,
-           15,
-           13,
+           14,
+           12,
            10,
             8,
-            6,
+            7,
             5,
             3,
             2,
             1,
             0,
-          235,
-          215,
-          197,
-          180,
-          163,
-          146,
-          130,
-          114,
-           98,
-           82,
-           66,
+          234,
+          214,
+          196,
+          178,
+          161,
+          144,
+          128,
+          112,
+           96,
+           79,
+           65,
            51,
            37,
-           23,
+           24,
            11,
             0,
           216,
-          181,
-          149,
-          118,
-           87,
-           58,
-           28,
+          178,
+          145,
+          113,
+           83,
+           54,
+           27,
             0,
-          218,
-          183,
+          216,
+          181,
           148,
-          117,
-           86,
-           56,
-           28,
+          116,
+           84,
+           53,
+           25,
             0,
           220,
           185,
-          151,
-          118,
-           85,
-           53,
+          150,
+          116,
+           84,
+           54,
            26,
             0,
-          220,
-          185,
-          152,
-          120,
-           88,
-           56,
-           28,
-            0,
-          221,
-          187,
-          154,
-          120,
-           90,
-           59,
-           28,
-            0,
-          221,
-          186,
-          152,
+          218,
+          183,
+          150,
           118,
-           85,
-           51,
-           23,
-            0,
-          221,
-          187,
-          152,
-          117,
            87,
            56,
-           27,
+           26,
             0,
-          237,
-          218,
-          199,
-          182,
-          164,
-          147,
-          130,
-          115,
-           99,
-           83,
-           67,
+          211,
+          171,
+          134,
+          106,
+           78,
+           50,
+           25,
+            0,
+          215,
+          175,
+          140,
+          108,
+           79,
            51,
-           37,
            24,
-           12,
+            0,
+          219,
+          184,
+          150,
+          120,
+           89,
+           58,
+           28,
+            0,
+          235,
+          215,
+          197,
+          179,
+          161,
+          144,
+          127,
+          111,
+           95,
+           80,
+           65,
+           51,
+           36,
+           23,
+           11,
             0
 };
 
@@ -207,82 +207,82 @@
 
 const SKP_uint8 SKP_Silk_NLSF_MSVQ_CB0_16_rates_Q4[ NLSF_MSVQ_CB0_16_VECTORS ] =
 {
-               75,               77,
-               77,               83,
-               83,               83,
-               84,               85,
+               77,               78,
+               80,               81,
+               81,               86,
+               87,               87,
+               88,               88,
                88,               89,
-               91,               92,
+               89,               89,
+               90,               90,
+               90,               91,
                92,               92,
-               92,               93,
-               93,               93,
-               93,               94,
-               94,               94,
+               92,               92,
+               92,               94,
                95,               95,
                95,               95,
                96,               96,
-               97,               97,
                97,               98,
-               98,               98,
                98,               99,
                99,              100,
-              100,              100,
               100,              101,
-              101,              101,
-              101,              101,
               102,              102,
+              102,              102,
+              103,              103,
+              103,              103,
+              104,              104,
               104,              105,
-              105,              105,
+              106,              106,
               107,              107,
-              108,              108,
-              108,              109,
-              111,              121,
-              121,              124,
+              108,              111,
+              111,              113,
+              116,              117,
+              118,              121,
               128,              128,
-               58,               58,
-               62,               62,
+               57,               59,
+               61,               61,
                63,               63,
                63,               64,
                64,               64,
-               65,               65,
-               66,               68,
-               71,               72,
+               66,               67,
+               67,               69,
+               70,               72,
+               43,               44,
+               47,               48,
+               50,               50,
+               52,               52,
                43,               46,
+               47,               48,
                48,               49,
-               49,               50,
-               50,               51,
-               44,               46,
-               46,               49,
-               49,               50,
-               51,               51,
+               51,               54,
                45,               46,
-               47,               47,
+               46,               47,
+               48,               49,
+               51,               53,
+               44,               46,
                47,               48,
-               52,               53,
-               45,               46,
-               47,               48,
-               48,               48,
+               49,               49,
+               49,               53,
+               40,               43,
+               45,               51,
                51,               51,
-               46,               47,
-               47,               47,
+               54,               54,
+               42,               43,
+               46,               48,
+               50,               51,
+               52,               55,
+               45,               46,
+               47,               49,
                49,               49,
-               49,               51,
-               46,               46,
-               47,               47,
-               47,               47,
-               51,               56,
-               46,               46,
-               46,               46,
-               49,               49,
-               50,               52,
-               60,               60,
-               60,               62,
-               62,               62,
+               50,               51,
+               58,               59,
+               61,               61,
+               61,               63,
                63,               64,
-               64,               64,
                64,               65,
-               66,               69,
-               70,               71
+               66,               66,
+               66,               68,
+               71,               73
 };
 
 const SKP_int SKP_Silk_NLSF_MSVQ_CB0_16_ndelta_min_Q15[ 16 + 1 ] =
@@ -308,614 +308,614 @@
 
 const SKP_int8 SKP_Silk_NLSF_MSVQ_CB0_16_Q8[ 16 * NLSF_MSVQ_CB0_16_VECTORS ] =
 {
-             -119,             -115,              -98,              -85,
-              -67,              -51,              -37,              -20,
-               -3,               13,               30,               46,
-               62,               78,               93,              108,
-             -116,             -102,              -91,              -78,
-              -63,              -51,              -37,              -21,
-               -4,               10,               28,               42,
-               58,               74,               92,              107,
-             -115,             -109,              -95,              -76,
-              -65,              -47,              -32,              -15,
-                1,               17,               32,               46,
-               61,               76,               92,              106,
-             -115,             -107,              -98,              -83,
-              -71,              -60,              -45,              -26,
-               -9,                4,               24,               38,
-               52,               69,               86,              103,
-             -114,             -109,              -94,              -79,
-              -67,              -53,              -37,              -20,
-               -6,                8,               24,               39,
-               52,               65,               81,               93,
-             -118,             -111,             -101,              -83,
-              -69,              -58,              -37,              -26,
-               -4,                9,               24,               43,
-               61,               77,               95,              110,
-             -116,             -107,              -87,              -75,
-              -57,              -43,              -27,              -13,
-                2,               18,               32,               48,
-               63,               78,               93,              109,
-             -116,             -112,              -99,              -75,
-              -66,              -51,              -40,              -22,
-              -10,                3,               18,               37,
-               55,               72,               89,              105,
-             -107,             -103,              -94,              -77,
-              -51,              -43,              -32,              -16,
-               -3,                8,               31,               44,
-               57,               70,               86,              100,
-             -115,             -109,              -99,              -89,
-              -81,              -60,              -37,              -26,
-               -6,                6,               22,               37,
-               56,               75,               93,              108,
-             -114,             -111,              -83,              -74,
-              -64,              -53,              -39,              -23,
-              -12,                5,               28,               44,
-               59,               76,               94,              111,
-             -114,             -109,              -99,              -81,
-              -71,              -59,              -47,              -33,
-              -16,               -3,               17,               36,
-               56,               73,               92,              108,
-             -114,             -110,              -98,              -69,
-              -57,              -48,              -34,              -23,
-               -6,                7,               20,               35,
-               64,               81,               97,              110,
-             -112,             -109,              -94,              -86,
-              -77,              -52,              -43,              -23,
-              -13,               -2,               13,               36,
-               58,               77,               91,              105,
-             -111,             -106,              -95,              -78,
-              -67,              -56,              -40,              -28,
-              -11,                2,               15,               29,
-               43,               57,               85,              105,
-             -109,             -107,              -90,              -84,
-              -70,              -53,              -41,              -22,
-              -12,               15,               30,               43,
-               57,               72,               91,              111,
-             -113,             -109,              -94,              -86,
-              -75,              -65,              -53,              -27,
-              -16,                6,               22,               42,
-               60,               77,               92,              109,
-             -110,             -106,              -93,              -73,
-              -64,              -52,              -39,              -27,
-               -6,                6,               20,               32,
-               48,               79,               98,              112,
-             -115,             -110,              -94,              -74,
-              -61,              -48,              -36,              -24,
-                4,               15,               31,               45,
-               63,               81,               99,              112,
-             -115,             -110,             -102,              -77,
-              -54,              -47,              -32,              -20,
-               -7,               12,               26,               37,
-               50,               65,               88,              107,
+             -117,             -105,              -93,              -79,
+              -66,              -52,              -37,              -22,
+               -6,               10,               27,               41,
+               58,               75,               92,              107,
+             -114,             -109,              -95,              -80,
+              -68,              -53,              -38,              -19,
+               -6,                7,               26,               40,
+               53,               66,               81,               94,
+             -120,             -116,             -102,              -84,
+              -65,              -51,              -36,              -21,
+               -4,               11,               29,               46,
+               61,               77,               93,              107,
+             -117,             -110,              -99,              -86,
+              -74,              -60,              -42,              -29,
+               -9,                6,               26,               41,
+               58,               75,               91,              107,
+             -117,             -110,              -96,              -85,
+              -67,              -50,              -34,              -16,
+                0,               17,               34,               49,
+               64,               79,               94,              109,
+             -115,             -110,             -100,              -79,
+              -69,              -57,              -43,              -30,
+              -10,                3,               16,               33,
+               52,               67,               86,              105,
+             -113,             -110,              -87,              -78,
+              -68,              -54,              -39,              -23,
+              -13,               12,               29,               43,
+               59,               75,               93,              112,
+             -114,             -103,              -85,              -73,
+              -56,              -43,              -28,              -14,
+                2,               17,               32,               47,
+               63,               78,               94,              109,
+             -115,             -110,              -99,              -76,
+              -66,              -52,              -37,              -26,
+                1,               12,               26,               41,
+               59,               78,               98,              112,
+             -115,             -111,              -96,              -72,
+              -61,              -48,              -30,              -14,
+                1,               16,               34,               48,
+               61,               75,               91,              104,
+             -117,             -110,              -94,              -80,
+              -60,              -48,              -36,              -25,
+               -3,               12,               28,               47,
+               65,               80,               97,              111,
+             -108,             -104,              -94,              -76,
+              -50,              -42,              -30,              -14,
+               -2,               10,               32,               45,
+               58,               71,               85,               98,
+             -112,             -109,              -95,              -67,
+              -57,              -47,              -34,              -23,
+               -5,                8,               19,               35,
+               65,               81,               96,              108,
+             -113,             -109,              -94,              -85,
+              -75,              -64,              -51,              -26,
+              -16,                5,               22,               42,
+               60,               76,               92,              108,
              -113,             -109,              -97,              -88,
-              -78,              -50,              -39,              -21,
-               -7,                9,               32,               46,
-               58,               71,               85,              102,
-             -104,              -99,              -89,              -76,
-              -67,              -58,              -33,              -23,
-               -7,                8,               22,               37,
-               61,               78,               94,              107,
-             -113,             -109,              -86,              -77,
-              -67,              -56,              -43,              -24,
-              -15,               -2,               12,               43,
-               61,               77,               91,              109,
-             -109,             -106,              -93,              -66,
-              -60,              -48,              -34,              -23,
-               -2,               10,               23,               35,
-               47,               63,               92,              113,
-             -116,             -112,             -100,              -92,
-              -82,              -50,              -38,              -21,
-              -10,                5,               25,               43,
-               60,               77,               94,              108,
-             -109,             -104,              -92,              -84,
-              -75,              -50,              -37,              -25,
-               -7,                4,               18,               31,
-               45,               69,               92,              106,
-             -105,             -101,              -89,              -71,
-              -61,              -52,              -28,              -14,
-               -1,               14,               33,               44,
-               58,               71,               86,               99,
-             -113,             -109,              -99,              -94,
-              -59,              -48,              -36,              -21,
-              -10,                5,               20,               37,
-               56,               75,               91,              108,
-             -110,             -106,              -88,              -77,
-              -68,              -45,              -34,              -17,
-               -2,               10,               25,               36,
-               48,               76,               97,              113,
-             -115,             -112,              -98,              -64,
-              -54,              -45,              -33,              -21,
-               -5,                9,               21,               35,
-               50,               67,               85,               99,
-             -117,             -111,              -97,              -78,
-              -60,              -46,              -25,               -9,
-                7,               24,               40,               53,
-               68,               83,               97,              110,
-             -110,             -106,              -91,              -82,
-              -72,              -58,              -44,              -30,
-              -17,               -5,                8,               20,
-               51,               72,               92,              109,
-             -112,             -108,              -96,              -89,
-              -78,              -40,              -29,              -16,
-               -1,               10,               27,               40,
-               54,               73,               94,              109,
-             -110,             -107,              -90,              -81,
-              -71,              -62,              -50,              -14,
-               -2,               11,               25,               37,
-               58,               81,              100,              114,
-             -113,             -109,              -87,              -60,
-              -51,              -41,              -29,              -17,
-                0,               11,               23,               34,
-               49,               78,               97,              111,
-             -116,             -111,             -102,              -86,
-              -51,              -37,              -28,              -16,
-               -2,               10,               27,               41,
-               55,               68,               86,              106,
-             -112,             -108,              -96,              -89,
-              -74,              -48,              -38,              -16,
-               -3,                9,               22,               37,
-               65,               84,              100,              112,
-             -111,             -107,              -95,              -77,
-              -43,              -29,              -19,               -8,
-                4,               16,               35,               48,
-               60,               74,               90,              104,
-             -113,             -108,              -95,              -86,
-              -60,              -50,              -35,              -21,
-              -10,                3,               32,               50,
+              -78,              -53,              -43,              -21,
+               -9,               11,               30,               44,
+               57,               71,               86,              104,
+             -115,             -111,             -100,              -69,
+              -60,              -48,              -36,              -22,
+               -8,                5,               18,               34,
+               51,               68,               87,              102,
+             -111,             -108,              -94,              -66,
+              -56,              -46,              -32,              -21,
+               -4,                9,               22,               33,
+               46,               62,               91,              112,
+             -116,             -111,             -102,              -82,
+              -60,              -49,              -35,              -21,
+               -8,               10,               24,               35,
+               49,               65,               88,              107,
+             -113,             -109,              -96,              -78,
+              -69,              -55,              -44,              -27,
+              -14,               -1,               19,               31,
+               58,               76,               94,              109,
+             -116,             -112,             -101,              -92,
+              -82,              -51,              -37,              -21,
+               -7,                6,               23,               41,
+               59,               75,               92,              108,
+             -111,             -107,              -96,              -87,
+              -79,              -49,              -36,              -24,
+               -8,                3,               19,               33,
+               49,               71,               92,              107,
+             -113,             -110,              -92,              -81,
+              -72,              -52,              -43,              -22,
+              -11,               -1,               13,               41,
+               58,               75,               88,              103,
+             -110,             -105,              -92,              -80,
+              -69,              -56,              -39,              -27,
+              -11,                2,               15,               30,
+               42,               58,               87,              104,
+             -109,             -105,              -91,              -74,
+              -66,              -52,              -38,              -25,
+               -6,                6,               19,               31,
+               45,               78,               98,              111,
+             -114,             -111,              -80,              -73,
+              -66,              -53,              -39,              -22,
+              -13,                0,               16,               42,
+               60,               77,               93,              111,
+             -112,             -108,              -94,              -83,
+              -72,              -58,              -44,              -31,
+              -18,               -6,                8,               26,
+               52,               72,               91,              109,
+             -108,              -99,              -89,              -78,
+              -60,              -49,              -38,              -18,
+               -1,                9,               25,               41,
+               54,               67,               88,              103,
+             -108,             -104,              -96,              -90,
+              -58,              -46,              -35,              -19,
+               -8,                7,               21,               36,
+               53,               74,               91,              108,
+             -114,             -110,              -86,              -73,
+              -63,              -48,              -38,              -11,
+                1,               14,               28,               42,
+               61,               81,               96,              112,
+             -115,             -111,              -74,              -66,
+              -56,              -44,              -30,              -16,
+               -5,                9,               27,               43,
+               61,               78,               95,              111,
+             -107,             -104,              -86,              -79,
+              -69,              -45,              -33,              -18,
+               -2,               10,               25,               37,
+               50,               76,               99,              113,
+             -111,             -107,              -97,              -90,
+              -67,              -52,              -36,              -22,
+              -12,                2,               26,               47,
                63,               77,               93,              109,
-             -114,             -111,              -78,              -68,
-              -59,              -48,              -37,              -19,
-               -9,                3,               15,               29,
-               52,               74,               92,              110,
-             -102,              -98,              -85,              -74,
-              -63,              -52,              -35,              -23,
-               -9,                6,               21,               33,
-               48,               62,               77,              100,
-             -115,             -112,              -74,              -64,
-              -54,              -42,              -29,              -15,
-               -4,               10,               28,               44,
-               61,               78,               94,              110,
-             -113,             -110,              -92,              -86,
-              -74,              -66,              -36,              -24,
-              -10,                9,               29,               49,
-               65,               80,               96,              111,
-             -115,             -111,              -95,              -60,
-              -48,              -39,              -25,              -14,
-                1,               13,               27,               44,
-               63,               79,               96,              109,
-             -109,             -105,              -95,              -82,
-              -74,              -65,              -30,              -19,
-               -7,               12,               25,               36,
-               48,               63,               87,              108,
-             -108,             -104,              -92,              -79,
-              -71,              -60,              -51,              -40,
-               -2,               10,               23,               38,
-               56,               73,               92,              109,
-             -107,             -105,              -86,              -81,
-              -72,              -46,              -34,              -21,
-               -2,                9,               27,               45,
-               66,               83,               97,              111,
-             -112,             -107,              -97,              -85,
-              -75,              -66,              -40,              -11,
-                2,               14,               31,               43,
-               56,               73,               91,              106,
-             -113,             -109,              -95,              -71,
-              -61,              -51,              -39,              -29,
-              -14,               -3,                8,               19,
-               44,               69,               90,              106,
-             -116,             -112,             -103,              -97,
-              -61,              -47,              -33,              -19,
-               -3,               17,               33,               46,
-               60,               76,               93,              109,
-             -110,             -106,              -94,              -71,
-              -55,              -47,              -34,              -20,
-               -7,                5,               20,               32,
-               43,               54,               68,              103,
-             -106,             -102,              -89,              -73,
-              -63,              -55,              -43,              -34,
-              -13,               17,               33,               44,
-               58,               71,               85,               99,
-             -100,              -95,              -81,              -68,
-              -55,              -45,              -30,              -17,
-               -2,               13,               33,               47,
-               65,               80,               97,              110,
-             -104,             -100,              -89,              -79,
-              -74,              -62,              -23,              -11,
-                2,               16,               31,               42,
-               57,               71,               86,              101,
-             -111,             -107,              -90,              -61,
-              -42,              -35,              -23,              -11,
-                2,               17,               32,               43,
-               56,               67,               80,               96,
-             -107,             -103,              -96,              -91,
-              -58,              -41,              -29,              -14,
-                0,               14,               29,               45,
-               61,               78,               96,              111,
-             -110,             -106,              -96,              -88,
-              -80,              -67,              -27,              -15,
-               -2,               13,               25,               38,
-               61,               77,               95,              108,
-             -105,             -103,              -79,              -75,
-              -67,              -52,              -40,              -22,
-               -6,                6,               22,               38,
-               53,               70,               90,              109,
-             -113,             -106,              -84,              -65,
-              -48,              -31,              -14,                0,
-               15,               28,               42,               55,
-               68,               81,               96,              110,
-             -101,              -92,              -71,              -59,
-              -48,              -39,              -26,              -16,
-               -1,               12,               25,               38,
-               55,               72,               89,              104,
-              -97,              -92,              -82,              -74,
-              -68,              -56,              -28,              -10,
+             -103,              -98,              -84,              -72,
+              -61,              -48,              -33,              -21,
+               -4,                8,               27,               42,
+               65,               81,               98,              111,
+             -111,             -108,              -95,              -87,
+              -76,              -44,              -32,              -17,
+               -3,                9,               25,               39,
+               65,               82,               99,              112,
+             -114,             -110,             -100,              -82,
+              -48,              -37,              -27,              -15,
+               -2,               11,               26,               39,
+               52,               65,               82,              105,
+             -110,             -107,              -89,              -82,
+              -71,              -61,              -49,              -13,
+               -1,               11,               26,               38,
+               59,               82,              100,              114,
+             -112,             -109,              -88,              -61,
+              -52,              -41,              -29,              -17,
+                0,               11,               24,               34,
+               48,               80,               99,              112,
+             -115,             -111,              -92,              -58,
+              -47,              -39,              -25,              -14,
+                2,               14,               27,               43,
+               63,               79,               95,              109,
+             -113,             -109,              -96,              -79,
+              -45,              -32,              -21,              -10,
                 3,               16,               33,               46,
+               60,               76,               93,              107,
+             -105,             -102,              -90,              -76,
+              -68,              -56,              -41,              -32,
+              -13,               15,               32,               43,
+               59,               74,               86,              101,
+             -110,             -106,              -94,              -85,
+              -77,              -65,              -31,              -22,
+               -5,                8,               20,               34,
+               59,               77,               96,              109,
+             -112,             -109,              -89,              -61,
+              -52,              -43,              -29,              -18,
+               -3,               14,               27,               39,
+               52,               66,               79,               98,
+             -114,             -110,             -104,              -96,
+              -56,              -44,              -30,              -17,
+               -4,               17,               32,               46,
+               61,               77,               94,              109,
+             -109,             -105,              -94,              -81,
+              -74,              -63,              -29,              -19,
+               -8,               11,               23,               33,
+               46,               62,               85,              107,
+             -111,             -108,              -91,              -83,
+              -72,              -63,              -35,              -24,
+              -13,                5,               29,               49,
+               66,               80,               97,              111,
+             -117,             -111,              -94,              -76,
+              -58,              -43,              -23,               -7,
+               10,               27,               43,               55,
+               69,               83,               97,              110,
+             -111,             -107,              -97,              -91,
+              -74,              -38,              -25,              -13,
+                0,               13,               27,               40,
+               54,               73,               93,              109,
+             -107,             -103,              -91,              -78,
+              -69,              -57,              -46,              -35,
+               -2,               11,               24,               37,
+               51,               64,               84,              107,
+             -109,             -104,              -94,              -82,
+              -72,              -62,              -39,               -9,
+                5,               15,               33,               43,
+               56,               71,               87,              102,
+             -103,              -99,              -88,              -73,
+              -68,              -55,              -28,              -15,
+               -3,               14,               30,               41,
+               56,               69,               82,               96,
+             -109,             -106,              -90,              -69,
+              -39,              -29,              -19,               -7,
+                4,               16,               35,               46,
+               57,               68,               82,               96,
+             -109,             -105,              -93,              -86,
+              -63,              -47,              -36,               -9,
+                3,               14,               30,               46,
+               66,               82,               99,              112,
+             -114,             -109,              -99,              -89,
+              -81,              -69,              -39,              -16,
+               -3,               12,               28,               41,
+               56,               72,               93,              108,
+             -107,             -104,              -91,              -79,
+              -72,              -61,              -51,              -40,
+               -6,                5,               20,               38,
+               61,               78,               97,              111,
+             -102,              -98,              -81,              -72,
+              -66,              -53,              -37,              -24,
+               -9,                3,               17,               31,
+               47,               62,               81,              102,
+             -111,             -108,              -87,              -75,
+              -66,              -53,              -40,              -29,
+              -17,               -7,                6,               16,
+               38,               68,               88,              108,
+             -108,             -105,              -92,              -70,
+              -56,              -47,              -33,              -21,
+               -7,                5,               19,               30,
+               42,               53,               65,              102,
+             -102,              -99,              -88,              -78,
+              -73,              -59,              -32,              -22,
+               -4,               10,               23,               46,
+               66,               80,               95,              107,
+             -106,             -103,              -92,              -85,
+              -82,              -62,              -22,              -11,
+                2,               18,               33,               46,
+               63,               77,               93,              106,
+             -113,             -104,              -81,              -64,
+              -47,              -30,              -13,                0,
+               15,               28,               41,               54,
+               68,               82,               97,              111,
+              -99,              -91,              -71,              -58,
+              -48,              -38,              -24,              -14,
+                0,               13,               28,               40,
+               58,               74,               92,              105,
+              -98,              -94,              -83,              -74,
+              -71,              -60,              -28,               -9,
+                3,               15,               35,               47,
                61,               78,               96,              108,
-             -106,             -103,              -93,              -88,
-              -83,              -50,              -23,              -11,
-                3,               20,               32,               47,
-               64,               78,               94,              109,
-              -97,              -94,              -85,              -78,
-              -73,              -66,              -32,              -14,
-                1,               16,               35,               49,
-               61,               77,               96,              111,
-              -97,              -94,              -89,              -81,
-              -63,              -58,              -42,              -15,
-                2,               13,               31,               49,
-               64,               77,               94,              109,
-               -3,               -2,               -5,               -8,
-                0,                1,                0,                0,
-               -1,               -1,                0,                0,
-                0,                0,                0,                0,
-               -1,               -1,                1,                1,
-                0,                1,               -1,               -2,
-               -4,               -5,               -6,               -8,
-               -8,               -6,               -5,               -2,
-               -3,               -4,               -6,                5,
-                2,                2,                3,                2,
-                2,                1,                1,                0,
-               -1,                0,                0,                1,
-               -1,               -1,                2,                3,
-                3,                3,                2,                3,
-                2,                1,                2,                1,
-               -1,               -4,               -8,              -11,
-               -2,               -2,                3,                4,
-                3,                4,                3,                5,
-                4,                5,                6,                7,
-                6,                5,                4,                3,
-               -2,               -2,               -1,               -1,
-               -4,               -5,               -8,                4,
-                1,                0,                2,                2,
+              -98,              -96,              -89,              -82,
+              -68,              -63,              -42,              -16,
+                1,               14,               31,               46,
+               64,               81,               96,              110,
+              -98,              -94,              -88,              -81,
+              -77,              -51,              -30,              -16,
+                1,               19,               34,               49,
+               64,               79,               96,              112,
+               -2,               -2,               -4,               -9,
+                3,                3,                2,                2,
                 1,                0,                0,                1,
-                3,                3,                2,                0,
-               -3,                0,                0,               -2,
-                4,                3,                3,                5,
-                6,                5,                3,                1,
-                2,                2,                0,               -4,
-                7,                7,                5,                6,
-                4,                3,                2,                2,
-                1,                1,                0,                0,
-                1,                1,                0,               -2,
-               -4,               -7,                1,               -2,
-               -4,                3,                1,               -2,
-               -3,               -2,                0,                1,
-                1,                0,               -1,                2,
-               -1,               -3,               -6,               -9,
-                2,                0,               -1,               -1,
-               -2,               -2,               -3,               -1,
+                1,                1,                1,                1,
+                1,                0,                0,                6,
+                4,                4,                2,                2,
+                1,                1,                3,                4,
+                4,                4,                3,                2,
+               -4,               -4,               -7,                2,
+                1,                0,               -1,               -1,
+               -2,               -2,               -1,               -1,
+                0,                0,                1,                1,
+                2,                2,                2,                1,
+                0,               -1,               -2,               -3,
+               -4,               -5,               -5,               -6,
+               -8,               -9,               -6,               -1,
+               -1,                0,                0,                0,
+                1,                1,                2,                0,
+               -1,               -1,               -2,               -1,
+               -2,               -3,               -8,              -10,
                 0,                0,                0,               -1,
-               -2,               -2,               -2,               -4,
-               -6,               -9,               -8,                2,
-                2,                2,                2,                2,
-                7,                8,                4,                1,
-                2,                1,                0,               -1,
-               -1,               -3,               -2,               -2,
-               -4,               -3,               -2,               -1,
-                1,                1,                3,                3,
-                0,                2,                0,                0,
-                1,               -2,               -4,               -6,
-                8,                7,                4,                2,
-               -1,                0,               -1,               -4,
-               -4,               -5,                8,                6,
-                4,                2,                1,                0,
-                0,                0,                0,                0,
-               -1,               -1,               -1,               -1,
-               -2,               -3,               -4,               -7,
-              -10,                4,                5,                3,
-                4,                4,                3,                1,
-                1,                1,                2,                2,
-                2,                2,                0,                0,
-                0,               -1,               -1,               -3,
-               -6,               -7,                7,                5,
+               -3,               -6,               -9,                4,
+                1,               -1,                0,               -1,
+               -2,               -1,                0,                0,
+                0,                0,                5,                3,
                 1,                1,                0,               -1,
-               -1,               -2,               -2,               -1,
-               -3,               -3,               -5,               -5,
-               -5,               -2,               -1,               -1,
-               -1,               -1,                6,                6,
+               -2,               -4,               -7,              -10,
+               -4,                2,                1,                1,
+               -3,               -3,                0,                3,
+                2,                6,                7,                6,
+                6,                5,                3,                2,
+                0,               -2,               -2,               -3,
+                0,                0,                0,               -2,
+               -3,               -3,               -3,               -4,
+               -6,               -8,               -6,                4,
                 4,                3,                2,                2,
-                1,                1,               -1,               -1,
+               -1,               -1,               -2,               -2,
+               -4,               -6,                6,                3,
+                2,                3,                1,                0,
+                1,                3,                3,                2,
+                7,                7,                3,               -1,
+                3,               -2,                0,                3,
+                0,               -1,                4,                3,
+                2,                0,               -1,               -1,
+               -1,                0,               -1,               -2,
+               -3,               -5,               -5,               -7,
+              -10,                5,                4,                2,
+                2,                2,                1,                1,
+                0,               -1,                0,                1,
+               -1,               -2,               -5,               -8,
+                5,                4,                0,               -2,
+               -3,               -2,               -3,               -1,
+                1,                1,                3,                1,
+               -1,                0,                1,               -1,
+                7,                7,                7,                7,
+                6,                4,                2,                1,
+                1,                1,                3,                2,
+                1,                2,                0,                1,
+                1,               -1,                0,               -1,
+               -4,               -6,                7,                6,
+                5,                4,                2,               -2,
+               -4,                7,                4,                2,
+                4,                2,                2,                1,
+                4,                3,                1,                1,
+                0,                0,               -2,               -3,
+                6,                3,                2,                0,
+               -1,                1,                0,               -1,
                -1,               -1,               -1,                0,
-                4,                4,                1,                0,
-               -1,               -2,               -1,                0,
-                0,               -1,                1,                2,
+               -1,               -1,               -1,               -1,
+               -1,               -2,               -3,               -2,
+               -3,               -4,               -5,               -5,
+               -4,               -1,               -1,                0,
+               -1,               -1,                6,                7,
+                4,                3,                1,                2,
+                2,                1,               -1,               -1,
+               -1,               -1,                0,                0,
+                4,                4,                2,                1,
+               -1,               -2,               -1,               -2,
+               -1,                0,                1,                0,
                 2,                4,                4,                2,
-               -1,               -1,               -3,               -3,
-                5,                2,                0,               -1,
-               -3,                3,                2,                0,
-                1,                1,                0,                0,
-               -3,               -3,               -5,                1,
-               -1,               -2,                0,                0,
-                0,                0,               -2,                0,
-                3,                3,                3,                2,
-                1,                0,                0,               -2,
-               -3,                7,                6,                4,
-                3,                2,                0,                0,
-                0,               -1,                0,                0,
-                0,               -1,                0,               -1,
-               -2,               -3,               -4,               -2,
-               -3,               -5,                5,                5,
-                2,                0,               -1,               -1,
+                1,                1,                0,               -1,
+               -3,               -5,                3,                1,
+                1,                3,                1,               -1,
+               -2,               -4,               -3,               -1,
+               -3,               -2,               -4,               -1,
+               -2,               -2,               -2,                0,
+                3,                2,                1,                2,
+                3,                4,                4,                2,
+                0,                0,               -1,               -2,
+               -4,                6,                4,                3,
+                2,                1,                0,                2,
+                2,                1,                0,               -1,
+                0,               -1,                1,                0,
+               -2,               -2,               -4,               -1,
+               -2,               -3,                6,                5,
+                3,                0,               -2,               -1,
+               -1,               -1,               -4,                3,
+                3,                1,                1,                0,
+                0,                1,               -1,               -2,
+               -3,                0,                0,                0,
                -1,               -1,                0,               -1,
-               -2,               -2,               -1,               -2,
-                6,                5,                2,                1,
-               -1,               -3,               -2,               -2,
-               -2,               -1,               -3,               -4,
-               -4,               -1,                0,                0,
+                0,               -1,                0,                3,
+                0,                5,                4,                3,
+                2,                1,                0,               -1,
+                0,                1,               -1,               -1,
+               -2,               -3,               -4,               -5,
+                3,                0,                0,                0,
+               -1,               -1,                0,                1,
+               -1,               -1,                0,               -1,
+               -2,                3,                2,                3,
+                2,                1,                0,               -1,
+               -3,               -4,               -2,                1,
+               -2,               -3,                3,                1,
+                0,               -1,               -1,                0,
+               -2,               -2,               -3,                1,
+                0,                0,                0,                1,
                 1,                1,                1,                0,
                 1,                1,                0,               -1,
-               -1,               -1,               -2,                0,
-                0,                0,               -1,               -1,
-                0,               -1,               -3,               -3,
-               -4,               -5,                0,                0,
-                1,                1,                0,                0,
-                0,               -1,               -2,                4,
-                3,                3,                4,                2,
-                2,                2,                1,               -1,
+               -4,               -5,                5,                3,
+                1,                1,                1,                0,
+                3,                5,                2,                0,
+                0,                1,                2,                1,
+                1,                0,               -2,                0,
+               -1,                0,                0,               -1,
+                0,                0,                0,               -1,
+               -2,               -1,                0,                0,
+               -1,               -1,               -4,               -5,
+                6,                5,                2,                0,
+               -1,                0,               -2,               -4,
+               -3,                0,               -1,               -1,
+               -2,                1,                0,               -1,
+               -1,                0,                0,                0,
+               -1,                0,                1,                1,
                 1,                2,                0,                0,
-                0,                0,               -1,               -3,
-               -5,               -5,                2,               -1,
-               -1,                1,                0,               -1,
-                2,                2,                1,                1,
-                1,                0,                1,                1,
+                0,                0,                2,                1,
+                1,                0,               -3,               -6,
+                1,                1,                1,                0,
+                0,               -1,               -4,                4,
+                2,                1,                1,                2,
+                2,                1,                2,                1,
+               -1,               -1,               -3,                1,
+                1,                0,               -1,               -3,
+                0,               -1,               -3,                4,
+                3,               -1,                0,               -1,
+                0,               -1,                0,                0,
+                0,               -3,                5,                2,
+                1,                0,                0,                1,
+                2,                0,                0,                0,
+                1,                1,                1,                1,
+                1,                1,                2,                0,
+                2,                2,                0,               -2,
+               -4,               -2,                4,                3,
+                1,                1,                1,                1,
+                0,                0,                0,               -1,
+               -1,               -1,               -1,               -2,
+                0,               -3,               -6,                2,
+               -1,               -1,                2,                1,
+                1,                1,                0,               -1,
+               -2,               -2,                0,               -2,
+               -3,                5,                2,                1,
+                0,                1,                1,                0,
+                0,                1,                1,                0,
+               -1,               -3,               -2,                0,
+               -2,               -3,                1,               -1,
+                1,                0,                1,                0,
+                0,                2,                0,               -1,
+                3,                0,                0,               -2,
+                2,                3,                2,                2,
+                1,                1,                1,                0,
+                0,                0,                0,               -1,
+               -3,                4,                3,                1,
+               -2,               -1,               -1,                1,
                 1,                1,                0,                0,
-               -1,               -5,               -7,                1,
-                0,                0,                1,                3,
-                3,                3,                3,                1,
-                2,                1,                0,               -3,
-               -4,                3,                3,                1,
-               -1,               -2,                3,                0,
-                0,               -2,                0,               -2,
-               -2,                0,               -1,                0,
-                2,                2,                4,                3,
-                0,                0,                0,                1,
-                1,                2,                1,                0,
-                0,               -2,               -4,                6,
-                5,                1,               -1,               -3,
-               -1,               -1,               -3,                4,
-                2,                1,                0,               -1,
-                0,               -1,                1,                2,
-                1,                0,               -1,                0,
-                0,                0,                1,                0,
-               -1,               -2,               -1,               -1,
-               -4,                4,                2,                1,
+               -1,               -1,                0,               -1,
+                0,               -2,               -2,                4,
+                2,                1,               -2,               -1,
+               -1,               -1,               -2,                0,
+                0,               -1,                0,                1,
+                0,               -3,                2,                1,
+               -1,               -1,                2,                3,
+                0,                0,                0,                0,
+               -1,                0,               -3,                4,
+                3,                1,               -1,               -2,
                 0,               -1,               -2,               -1,
+               -1,                0,               -1,                1,
+                1,                0,                0,               -2,
+               -4,                2,                0,               -2,
+                3,                1,                1,                0,
+               -2,               -1,                0,                0,
+                0,               -2,                2,               -1,
+                2,                0,                0,               -1,
+               -3,                1,               -2,               -2,
+                0,                0,               -1,               -3,
+                3,                1,                0,                0,
+               -1,               -1,               -1,               -1,
+                0,                1,               -1,               -1,
+                0,               -1,                0,                0,
+                2,                0,                1,                0,
+                1,                1,                2,                1,
+                0,               -4,                0,                0,
                 0,                0,                1,                0,
-                0,               -2,               -4,                5,
-                2,                0,               -2,               -1,
-               -1,               -1,               -1,                0,
-               -1,               -1,               -2,               -4,
+               -1,                0,               -1,               -3,
+                3,                2,               -1,                0,
+                0,                1,                0,               -1,
+                0,                0,                0,                2,
+                1,                1,                1,                1,
+                0,                0,               -1,                2,
+                2,                1,               -2,                3,
+                0,                1,                0,                0,
+               -1,                0,               -1,                1,
+                0,               -2,                2,                0,
+               -3,                2,                1,               -2,
+                0,               -1,                0,                0,
+               -3,                3,                1,                0,
+               -1,               -1,               -1,               -1,
                 1,               -1,                1,                0,
-               -1,               -2,               -1,                0,
-                0,                2,                2,                2,
-                0,                0,                1,                0,
-               -1,               -1,               -2,               -5,
-                4,                1,                0,               -1,
-                0,                2,                2,                2,
-                2,                2,                1,                0,
-                0,                0,                3,                0,
-                0,                0,               -1,               -2,
-                3,                3,                0,               -2,
-                1,                2,                1,                0,
-               -1,                1,                1,                0,
-               -1,               -2,                1,                1,
-               -2,               -5,                2,                2,
-               -3,               -3,                1,                0,
-               -1,                3,                2,                1,
+                1,                2,                0,                0,
+               -1,               -3,                2,                0,
+               -2,                1,                0,               -1,
+                1,                0,                0,               -1,
+               -1,               -1,                0,                0,
+               -1,               -3,               -3,                2,
+                0,               -1,                0,               -1,
+                1,                0,                0,                2,
+                1,                0,                1,                0,
+                0,               -1,               -2,               -1,
+               -2,                1,                0,               -1,
+               -2,               -1,                1,               -1,
                 1,                0,                0,                0,
-               -1,               -1,               -2,               -2,
-                0,                0,                1,                0,
+                1,                1,                1,                0,
+                1,                1,                1,                0,
+                1,                2,                0,               -1,
+                0,               -1,                0,                0,
+                0,                1,                0,                1,
+                0,                0,               -2,                2,
+               -1,                2,                1,                0,
+                0,               -1,               -3,                0,
+                0,                0,                1,                1,
+                0,               -1,               -1,               -2,
                 0,                0,               -1,               -1,
-                0,                1,                0,               -2,
-                3,                2,               -2,               -3,
-                0,                1,                0,               -2,
-               -1,                1,                0,                1,
-                0,               -1,               -3,               -3,
-               -1,               -2,               -1,                1,
-                0,                0,                0,                0,
-                3,                1,                1,                0,
-               -2,               -2,                1,                1,
-               -1,               -1,               -1,               -3,
                 1,                1,                0,                0,
-                0,               -2,               -2,               -2,
-                0,                0,               -2,                4,
-                1,               -1,                1,                0,
-                0,                0,                2,                0,
-                0,                2,                1,                0,
-               -1,               -2,                2,                0,
-                2,                1,                0,                4,
-                0,                0,               -1,                1,
-               -1,               -3,                3,                0,
-                1,                2,                0,               -1,
-               -1,                0,                1,                0,
-               -1,               -1,                0,                0,
-                0,                0,               -2,                1,
-                0,               -1,                1,               -1,
-               -4,                4,                3,                1,
-               -1,               -1,               -2,                1,
-                0,                1,                0,                2,
-                1,                2,                2,                1,
-                0,               -3,                1,                1,
-                0,                0,                0,               -2,
-                3,                1,               -1,                0,
-                2,                0,               -1,                2,
-                1,                0,                0,                0,
-                0,                0,                2,                2,
-                1,                1,                0,               -2,
-                2,                1,                0,                0,
-               -1,               -1,                0,               -2,
+               -1,                0,                1,               -1,
+                1,                0,               -1,                1,
+               -1,               -2,                0,                2,
+                0,               -1,                2,                0,
+                0,                0,                0,                0,
+               -1,               -1,                1,               -1,
+                2,               -1,                2,                1,
+                0,               -1,                0,                0,
+               -1,                0,               -1,                0,
+                0,               -1,                2,                1,
+                0,                0,               -3,                0,
+               -3,                3,                0,                0,
                 0,                0,                0,                0,
-               -3,                3,                1,                0,
-                0,               -1,                1,                1,
-                1,                0,                0,               -1,
-                0,                0,               -1,                0,
-                0,                0,                0,               -1,
-               -3,                3,                1,                1,
-               -2,                1,                1,                1,
                 0,                0,                0,                0,
-                0,               -1,               -1,                0,
-               -2,               -1,               -1,               -3,
-                3,                0,                2,                1,
-               -1,               -1,               -3,                0,
-                0,               -1,                0,                1,
                 0,                0,                0,                0,
-               -1,                1,               -1,               -3,
-                1,                1,                0,                0,
-               -1,               -1,               -1,                1,
-                2,                0,                1,               -2,
-               -1,                0,               -2,                3,
-                0,                0,                2,                0,
-                0,               -3,                3,                1,
-               -1,               -1,                0,                2,
+                0,                0,               -1,                3,
+                1,               -1,                0,                0,
+                0,                0,                1,                0,
+                0,               -1,                0,               -1,
+               -1,                0,                0,               -2,
+                1,               -2,                0,                0,
                 0,                0,               -1,                0,
-                0,               -1,                0,                0,
-               -1,                0,               -1,               -1,
-               -1,               -1,               -1,                1,
-               -1,               -2,               -2,                2,
-               -2,                2,                0,                0,
+               -1,                0,                2,                1,
+                0,                0,               -2,                0,
+                0,                2,                0,                0,
+                0,                1,                1,                0,
+               -1,                1,                0,                1,
+               -1,               -1,                0,                0,
                 0,                0,               -1,                0,
-                0,                0,                0,                0,
-                0,                0,                0,                0,
-                1,                1,                0,                0,
-                0,               -1,                1,                0,
-                1,               -1,                0,                0,
-                2,                0,               -2,                0,
-                1,                0,                0,               -1,
-               -1,                2,                0,                1,
-                1,                1,                0,               -1,
-               -2,                2,               -1,               -2,
-                1,                0,                0,                2,
-                0,                1,               -1,                1,
-                0,               -1,               -2,                1,
-                1,                1,                2,                0,
+                2,                0,               -1,                1,
+                1,               -1,               -2,                0,
+                1,                2,                0,                0,
                 0,                0,               -1,                0,
-                3,                0,                1,               -1,
-               -1,                2,                0,               -2,
-                0,               -1,               -1,                1,
+               -1,               -1,               -1,                0,
+                2,                0,                0,               -1,
+                0,                0,                0,                0,
+               -2,                0,                1,                0,
+                1,                1,                1,                0,
+                1,                1,                2,               -1,
                 0,               -1,                0,                0,
+                0,                0,                1,               -2,
+               -2,               -1,                1,                0,
+               -1,                0,               -1,                0,
                 0,                0,                2,                0,
-                0,                0,                2,                1,
-                1,                1,                3,                1,
-               -1,               -2,                2,                0,
-                0,               -1,               -1,                1,
-                1,                0,                1,               -1,
-                0,               -2,                1,               -1,
-               -1,               -1,                1,                0,
-                0,               -1,               -1,                0,
-                0,                0,                0,                2,
-                0,                2,               -1,                1,
-                0,               -1,               -2,                0,
-                0,                1,               -1,               -1,
-                1,                0,                0,               -1,
+                0,               -1,                1,                2,
+                0,               -1,                0,               -1,
+               -1,                1,               -1,                1,
                 0,                0,                1,                0,
-                0,                0,                0,               -2,
-                0,               -1,                0,                0,
-                0,                1,                1,                1,
-                1,               -1,               -1,               -1,
+                0,                0,                1,                0,
+                0,                2,               -2,               -1,
+                1,               -1,               -1,                0,
+                1,                0,               -3,                0,
+                0,                0,                0,               -1,
+                0,                1,                0,                1,
                 1,                0,                0,                0,
-               -1,               -1,                0,               -2,
-               -1,               -1,               -1,               -1,
-               -2,                0,                0,               -1,
-                1,                2,                1,                0,
+               -1,               -1,                0,                0,
+                1,                0,               -1,                1,
+                0,               -1,                0,                0,
+                0,                0,                1,               -2,
+                0,               -1,                0,                0,
+                1,                0,               -1,               -1,
+                1,               -2,               -1,                0,
+               -1,                0,                0,                1,
+                1,               -1,                1,               -2,
                 0,                1,                0,                1,
-                1,                1,                0,                0,
-                0,                0,                2,                0,
-                1,                0,                0,                1,
-                0,                0,               -1,                2,
-               -2,               -1,                2,               -1,
+                0,                0,                0,                0,
                 0,               -1,                0,                0,
-                0,               -1,                1,                0,
-                0,                1,                2,                1,
-                0,                1,               -2,                0,
+                1,                2,                0,                0,
                 0,                0,                0,                1,
+                1,                0,                0,                1,
+                0,                0,                0,               -1,
+                1,                0,                0,                0,
+                0,                0,                1,                0,
                -1,                0,                0,                0,
-                0,                0,                2,                0,
-                0,               -1,                0,                0,
-                0,                0,                0,                0,
-               -2,                1,                0,                1,
-                0,                0,               -1,                0,
-                1,                1,               -1,                0,
-                0,                0,               -1,                0,
-                1,                0,               -2,                0,
+                0,                1,                3,                1,
+                1,                0,                1,                1,
+                0,                2,               -1,                0,
                 0,                0,                1,                0,
-                1,                0,                0,                2,
-               -2,                0,                0,                0,
+                0,                0,                0,                0,
                 0,                1,                0,                0,
-                1,               -1,               -2,               -1,
-                0,               -2,                2,                0,
-                0,                0,                0,               -1,
+                0,               -1,                0,               -1,
+                1,               -1,                2,               -2,
+                1,               -1,                0,                0,
                 0,                0,                0,                0,
-                0,                0,                0,               -1,
-                1,               -1,                0,                1,
-                1,               -3,                0,                0,
-                0,                0,                0,               -1,
-               -2,               -1,                0,                1,
-                0,                0,               -1,                0,
-                0,                0,                1,                1,
-                0,               -1,                0,                0,
-                0,                1,                1,               -2,
-               -1,                0,               -1,                0,
-                0,                1,               -1,                0,
-                1,                0,                0,                0,
-                0,                1,               -2,                1,
-               -1,                0,                0,                0,
+                0,                0,                0,                2,
+               -2,                0,                0,                1,
                 1,                0,               -1,                0,
-                1,                0,                0,                0,
-                2,               -1,                0,                1,
+               -2,                1,                1,                0,
                 0,                0,               -1,               -1,
                 0,                0,                0,                1,
+                0,                0,                0,                1,
                 1,                0,                0,                0,
-                0,               -2,                0,               -1,
-                1,                2,                1,                0,
+               -2,                0,               -1,                0,
+                0,                0,               -1,               -1,
+                0,                2,               -1,                0,
+               -1,                1,                0,                0,
+                0,                1,                2,               -1,
+                0,               -1,                0,                1,
                 0,                0,                0,                0,
-               -1,                0,               -1,                0,
-                0,                1,                0,                2,
-                0,                1,                0,                0,
-                2,                1,                0,                0,
-                0,                0,                3,                0,
-                0,                1,                0,                0,
+                0,               -1,                1,                0,
+                0,               -3,                0,                0,
+                0,                0,                1,                1,
+               -1,                0,                0,                0,
+               -1,               -1,                0,                0,
                 0,                0,                1,                0,
+                0,                1,                1,               -1,
                -1,                0,                0,                1,
-                1,                3,                0,                0,
-                0,                0,                1,                0,
-               -1,                0,                0,               -1,
-                0,                0,                0,                0,
-                0,               -1,                0,                0,
-                0,                0,                0,                0,
-               -2,                0,               -1,                1,
-                0,               -1,                2,               -2,
-                0,                0,                0,                2,
-               -1,                0,                1,                0,
-                0,                0,                0,               -1,
-                0,                0,               -1,                0,
-               -2,               -1,                0,               -1,
-                0,                0,                0,                0,
-               -1,                0,                0,               -1,
-                0,                0,                0,                1,
-                0,               -1,                0,                0,
-                0,                1,                1,                1,
-                1,               -1,                1,               -1,
-                0,                0,                0,                0
+               -1,                0,               -1,                1,
+               -2,               -1,               -1,                0,
+                0,                1,                0,                0,
+                0,               -1,                0,                0
 };
 
 const SKP_Silk_NLSF_CBS SKP_Silk_NLSF_CB0_16_Stage_info[ NLSF_MSVQ_CB0_16_STAGES ] =
--- a/src_common/SKP_Silk_tables_NLSF_CB1_10.h
+++ /dev/null
@@ -1,51 +1,0 @@
-/***********************************************************************
-Copyright (c) 2006-2010, Skype Limited. All rights reserved. 
-Redistribution and use in source and binary forms, with or without 
-modification, (subject to the limitations in the disclaimer below) 
-are permitted provided that the following conditions are met:
-- Redistributions of source code must retain the above copyright notice,
-this list of conditions and the following disclaimer.
-- Redistributions in binary form must reproduce the above copyright 
-notice, this list of conditions and the following disclaimer in the 
-documentation and/or other materials provided with the distribution.
-- Neither the name of Skype Limited, nor the names of specific 
-contributors, may be used to endorse or promote products derived from 
-this software without specific prior written permission.
-NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED 
-BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 
-CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
-BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 
-FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-***********************************************************************/
-
-#ifndef SKP_SILK_TABLES_NLSF_CB1_10_H
-#define SKP_SILK_TABLES_NLSF_CB1_10_H
-
-#include "SKP_Silk_define.h"
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-#define NLSF_MSVQ_CB1_10_STAGES       7
-#define NLSF_MSVQ_CB1_10_VECTORS      80
-
-/* NLSF codebook entropy coding tables */
-extern const SKP_uint16         SKP_Silk_NLSF_MSVQ_CB1_10_CDF[ NLSF_MSVQ_CB1_10_VECTORS + NLSF_MSVQ_CB1_10_STAGES ];
-extern const SKP_uint16 * const SKP_Silk_NLSF_MSVQ_CB1_10_CDF_start_ptr[                  NLSF_MSVQ_CB1_10_STAGES ];
-extern const SKP_int            SKP_Silk_NLSF_MSVQ_CB1_10_CDF_middle_idx[                 NLSF_MSVQ_CB1_10_STAGES ];
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
--- a/src_common/SKP_Silk_tables_gain.c
+++ b/src_common/SKP_Silk_tables_gain.c
@@ -32,13 +32,16 @@
 {
 #endif
 
-const SKP_uint8 SKP_Silk_gain_iCDF[ 2 ][ N_LEVELS_QGAIN / 8 ] = 
+const SKP_uint8 SKP_Silk_gain_iCDF[ 3 ][ N_LEVELS_QGAIN / 8 ] = 
 {
 {
-	   255,    251,    219,    143,     53,     10,      1,      0
+	   224,    112,     44,     15,      3,      2,      1,      0
 },
 {
-	   242,    199,    146,     94,     48,     15,      2,      0
+	   254,    237,    192,    132,     70,     23,      4,      0
+},
+{
+	   255,    252,    226,    155,     61,     11,      2,      0
 }
 };
 
--- a/src_common/SKP_Silk_tables_other.c
+++ b/src_common/SKP_Silk_tables_other.c
@@ -36,19 +36,19 @@
 
 /* Piece-wise linear mapping from bitrate in kbps to coding quality in dB SNR */
 const SKP_uint16 TargetRate_table_NB[ TARGET_RATE_TAB_SZ ] = {
-    0,      8000,   9000,   11000,  13000,  16000,  22000,  MAX_TARGET_RATE_BPS
+    0,      8000,   9000,   11000,  13000,  16000,  21000,  MAX_TARGET_RATE_BPS
 };
 const SKP_uint16 TargetRate_table_MB[ TARGET_RATE_TAB_SZ ] = {
-    0,      10000,  12000,  14000,  17000,  21000,  28000,  MAX_TARGET_RATE_BPS
+    0,      10000,  12000,  14000,  17000,  21000,  27000,  MAX_TARGET_RATE_BPS
 };
 const SKP_uint16 TargetRate_table_WB[ TARGET_RATE_TAB_SZ ] = {
-    0,      11000,  14000,  17000,  21000,  26000,  36000,  MAX_TARGET_RATE_BPS
+    0,      11000,  14000,  17000,  21000,  26000,  35000,  MAX_TARGET_RATE_BPS
 };
 const SKP_uint16 TargetRate_table_SWB[ TARGET_RATE_TAB_SZ ] = {
-    0,      13000,  16000,  19000,  25000,  32000,  46000,  MAX_TARGET_RATE_BPS
+    0,      13000,  16000,  19000,  25000,  32000,  45000,  MAX_TARGET_RATE_BPS
 };
 const SKP_uint16 SNR_table_Q1[ TARGET_RATE_TAB_SZ ] = {
-    19,     31,     35,     39,     43,     47,     54,     59
+    19,     31,     35,     39,     44,     49,     55,     60
 };
 
 /* Filter coeficicnts for HP filter: 4. Order filter implementad as two biquad filters  */
@@ -81,24 +81,31 @@
 const SKP_uint8 SKP_Silk_LTPscale_iCDF[ 3 ] = { 128, 64, 0 };
 
 /* tables for VAD flag */
-const SKP_uint8  SKP_Silk_vadflag_iCDF[ 2 ] = { 171,  0 };   /* 66% for speech, 33% for no speech */
+const SKP_uint8  SKP_Silk_vadflag_iCDF[ 2 ] = { 100,  0 };
 
 /* tables for signal type and offset coding */
-const SKP_uint8 SKP_Silk_type_offset_iCDF[4] = {
-	   123,    116,     94,      0
+const SKP_uint8 SKP_Silk_type_offset_iCDF[6] = {
+	   253,    222,    202,    138,      7,      0
 };
-const SKP_uint8 SKP_Silk_type_offset_joint_iCDF[4][4] = {
+const SKP_uint8 SKP_Silk_type_offset_joint_iCDF[6][6] = 
 {
-	   151,     33,      9,      0
+{
+	    67,     34,      8,      5,      4,      0
 },
 {
-	   248,     50,     25,      0
+	   156,     42,     16,     11,     10,      0
 },
 {
-	   231,    204,     43,      0
+	   154,    140,     55,     29,     15,      0
 },
 {
-	   249,    215,    126,      0
+	   169,    156,    109,     23,     18,      0
+},
+{
+	   156,    150,    136,    129,     68,      0
+},
+{
+	   195,    187,    169,    147,    141,      0
 }
 };
 
@@ -114,7 +121,7 @@
 
 /* Quantization offsets */
 const SKP_int16  SKP_Silk_Quantization_Offsets_Q10[ 2 ][ 2 ] = {
-    { OFFSET_VL_Q10, OFFSET_VH_Q10 }, { OFFSET_UVL_Q10, OFFSET_UVH_Q10 }
+    { OFFSET_UVL_Q10, OFFSET_UVH_Q10 }, { OFFSET_VL_Q10, OFFSET_VH_Q10 }
 };
 
 /* Table for LTPScale */
--- a/src_common/SKP_Silk_tables_pulses_per_block.c
+++ b/src_common/SKP_Silk_tables_pulses_per_block.c
@@ -27,209 +27,205 @@
 
 #include "SKP_Silk_tables.h"
 
-const SKP_int SKP_Silk_max_pulses_table[ 4 ] = {
-         6,      8,     12,     18
+const SKP_uint8 SKP_Silk_max_pulses_table[4] = {
+	     8,     10,     12,     16
 };
 
-const SKP_uint16 SKP_Silk_pulses_per_block_CDF[ 10 ][ 21 ] = 
+const SKP_uint8 SKP_Silk_pulses_per_block_iCDF[10][18] = 
 {
 {
-         0,  47113,  61501,  64590,  65125,  65277,  65352,  65407,
-     65450,  65474,  65488,  65501,  65508,  65514,  65516,  65520,
-     65521,  65523,  65524,  65526,  65535
+	   125,     51,     26,     18,     15,     12,     11,     10,
+	     9,      8,      7,      6,      5,      4,      3,      2,
+	     1,      0
 },
 {
-         0,  26368,  47760,  58803,  63085,  64567,  65113,  65333,
-     65424,  65474,  65498,  65511,  65517,  65520,  65523,  65525,
-     65526,  65528,  65529,  65530,  65535
+	   198,    105,     45,     22,     15,     12,     11,     10,
+	     9,      8,      7,      6,      5,      4,      3,      2,
+	     1,      0
 },
 {
-         0,   9601,  28014,  45877,  57210,  62560,  64611,  65260,
-     65447,  65500,  65511,  65519,  65521,  65525,  65526,  65529,
-     65530,  65531,  65532,  65534,  65535
+	   213,    162,    116,     83,     59,     43,     32,     24,
+	    18,     15,     12,      9,      7,      6,      5,      3,
+	     2,      0
 },
 {
-         0,   3351,  12462,  25972,  39782,  50686,  57644,  61525,
-     63521,  64506,  65009,  65255,  65375,  65441,  65471,  65488,
-     65497,  65505,  65509,  65512,  65535
+	   239,    187,    116,     59,     28,     16,     11,     10,
+	     9,      8,      7,      6,      5,      4,      3,      2,
+	     1,      0
 },
 {
-         0,    488,   2944,   9295,  19712,  32160,  43976,  53121,
-     59144,  62518,  64213,  65016,  65346,  65470,  65511,  65515,
-     65525,  65529,  65531,  65534,  65535
+	   250,    229,    188,    135,     86,     51,     30,     19,
+	    13,     10,      8,      6,      5,      4,      3,      2,
+	     1,      0
 },
 {
-         0,  17013,  30405,  40812,  48142,  53466,  57166,  59845,
-     61650,  62873,  63684,  64223,  64575,  64811,  64959,  65051,
-     65111,  65143,  65165,  65183,  65535
+	   249,    235,    213,    185,    156,    128,    103,     83,
+	    66,     53,     42,     33,     26,     21,     17,     13,
+	    10,      0
 },
 {
-         0,   2994,   8323,  15845,  24196,  32300,  39340,  45140,
-     49813,  53474,  56349,  58518,  60167,  61397,  62313,  62969,
-     63410,  63715,  63906,  64056,  65535
+	   254,    249,    235,    206,    164,    118,     77,     46,
+	    27,     16,     10,      7,      5,      4,      3,      2,
+	     1,      0
 },
 {
-         0,     88,    721,   2795,   7542,  14888,  24420,  34593,
-     43912,  51484,  56962,  60558,  62760,  64037,  64716,  65069,
-     65262,  65358,  65398,  65420,  65535
+	   255,    253,    249,    239,    220,    191,    156,    119,
+	    85,     57,     37,     23,     15,     10,      6,      4,
+	     2,      0
 },
 {
-         0,    287,    789,   2064,   4398,   8174,  13534,  20151,
-     27347,  34533,  41295,  47242,  52070,  55772,  58458,  60381,
-     61679,  62533,  63109,  63519,  65535
+	   255,    253,    251,    246,    237,    223,    203,    179,
+	   152,    124,     98,     75,     55,     40,     29,     21,
+	    15,      0
 },
 {
-         0,      1,      3,     91,   4521,  14708,  28329,  41955,
-     52116,  58375,  61729,  63534,  64459,  64924,  65092,  65164,
-     65182,  65198,  65203,  65211,  65535
+	   255,    254,    253,    247,    220,    162,    106,     67,
+	    42,     28,     18,     12,      9,      6,      4,      3,
+	     2,      0
 }
 };
 
-const SKP_int SKP_Silk_pulses_per_block_CDF_offset = 6;
-
-
-const SKP_int16 SKP_Silk_pulses_per_block_BITS_Q6[ 9 ][ 20 ] = 
+const SKP_uint8 SKP_Silk_pulses_per_block_BITS_Q5[9][18] = 
 {
 {
-        30,    140,    282,    444,    560,    625,    654,    677,
-       731,    780,    787,    844,    859,    960,    896,   1024,
-       960,   1024,    960,    821
+	    31,     57,    107,    160,    205,    205,    255,    255,
+	   255,    255,    255,    255,    255,    255,    255,    255,
+	   255,    255
 },
 {
-        84,    103,    164,    252,    350,    442,    526,    607,
-       663,    731,    787,    859,    923,    923,    960,   1024,
-       960,   1024,   1024,    875
+	    69,     47,     67,    111,    166,    205,    255,    255,
+	   255,    255,    255,    255,    255,    255,    255,    255,
+	   255,    255
 },
 {
-       177,    117,    120,    162,    231,    320,    426,    541,
-       657,    803,    832,    960,    896,   1024,    923,   1024,
-      1024,   1024,    960,   1024
+	    82,     74,     79,     95,    109,    128,    145,    160,
+	   173,    205,    205,    205,    224,    255,    255,    224,
+	   255,    224
 },
 {
-       275,    182,    146,    144,    166,    207,    261,    322,
-       388,    450,    516,    582,    637,    710,    762,    821,
-       832,    896,    923,    734
+	   125,     74,     59,     69,     97,    141,    182,    255,
+	   255,    255,    255,    255,    255,    255,    255,    255,
+	   255,    255
 },
 {
-       452,    303,    216,    170,    153,    158,    182,    220,
-       274,    337,    406,    489,    579,    681,    896,    811,
-       896,    960,    923,   1024
+	   173,    115,     85,     73,     76,     92,    115,    145,
+	   173,    205,    224,    224,    255,    255,    255,    255,
+	   255,    255
 },
 {
-       125,    147,    170,    202,    232,    265,    295,    332,
-       368,    406,    443,    483,    520,    563,    606,    646,
-       704,    739,    757,    483
+	   166,    134,    113,    102,    101,    102,    107,    118,
+	   125,    138,    145,    155,    166,    182,    192,    192,
+	   205,    150
 },
 {
-       285,    232,    200,    190,    193,    206,    224,    244,
-       266,    289,    315,    340,    367,    394,    425,    462,
-       496,    539,    561,    350
+	   224,    182,    134,    101,     83,     79,     85,     97,
+	   120,    145,    173,    205,    224,    255,    255,    255,
+	   255,    255
 },
 {
-       611,    428,    319,    242,    202,    178,    172,    180,
-       199,    229,    268,    313,    364,    422,    482,    538,
-       603,    683,    739,    586
+	   255,    224,    192,    150,    120,    101,     92,     89,
+	    93,    102,    118,    134,    160,    182,    192,    224,
+	   224,    224
 },
 {
-       501,    450,    364,    308,    264,    231,    212,    204,
-       204,    210,    222,    241,    265,    295,    326,    362,
-       401,    437,    469,    321
+	   255,    224,    224,    182,    155,    134,    118,    109,
+	   104,    102,    106,    111,    118,    131,    145,    160,
+	   173,    131
 }
 };
 
-const SKP_uint16 SKP_Silk_rate_levels_CDF[ 2 ][ 10 ] = 
+const SKP_uint8 SKP_Silk_rate_levels_iCDF[2][9] = 
 {
 {
-         0,   2005,  12717,  20281,  31328,  36234,  45816,  57753,
-     63104,  65535
+	   241,    190,    178,    132,     87,     74,     41,     14,
+	     0
 },
 {
-         0,   8553,  23489,  36031,  46295,  53519,  56519,  59151,
-     64185,  65535
+	   223,    193,    157,    140,    106,     57,     39,     18,
+	     0
 }
 };
 
-const SKP_int SKP_Silk_rate_levels_CDF_offset = 4;
-
-
-const SKP_int16 SKP_Silk_rate_levels_BITS_Q6[ 2 ][ 9 ] = 
+const SKP_uint8 SKP_Silk_rate_levels_BITS_Q5[2][9] = 
 {
 {
-       322,    167,    199,    164,    239,    178,    157,    231,
-       304
+	   131,     74,    141,     79,     80,    138,     95,    104,
+	   134
 },
 {
-       188,    137,    153,    171,    204,    285,    297,    237,
-       358
+	    95,     99,     91,    125,     93,     76,    123,    115,
+	   123
 }
 };
 
-const SKP_uint16 SKP_Silk_shell_code_table0[ 33 ] = {
-         0,  32748,  65535,      0,   9505,  56230,  65535,      0,
-      4093,  32204,  61720,  65535,      0,   2285,  16207,  48750,
-     63424,  65535,      0,   1709,   9446,  32026,  55752,  63876,
-     65535,      0,   1623,   6986,  21845,  45381,  59147,  64186,
-     65535
+const SKP_uint8 SKP_Silk_shell_code_table0[44] = {
+	   128,      0,    214,     42,      0,    235,    128,     21,
+	     0,    244,    184,     72,     11,      0,    248,    214,
+	   128,     42,      7,      0,    248,    225,    170,     80,
+	    25,      5,      0,    251,    236,    198,    126,     54,
+	    18,      3,      0,    250,    238,    211,    159,     82,
+	    35,     15,      5,      0
 };
 
-const SKP_uint16 SKP_Silk_shell_code_table1[ 52 ] = {
-         0,  32691,  65535,      0,  12782,  52752,  65535,      0,
-      4847,  32665,  60899,  65535,      0,   2500,  17305,  47989,
-     63369,  65535,      0,   1843,  10329,  32419,  55433,  64277,
-     65535,      0,   1485,   7062,  21465,  43414,  59079,  64623,
-     65535,      0,      0,   4841,  14797,  31799,  49667,  61309,
-     65535,  65535,      0,      0,      0,   8032,  21695,  41078,
-     56317,  65535,  65535,  65535
+const SKP_uint8 SKP_Silk_shell_code_table1[65] = {
+	   129,      0,    207,     50,      0,    236,    129,     20,
+	     0,    245,    185,     72,     10,      0,    249,    213,
+	   129,     42,      6,      0,    250,    226,    169,     87,
+	    27,      4,      0,    251,    233,    194,    130,     62,
+	    20,      4,      0,    250,    236,    207,    160,     99,
+	    47,     17,      3,      0,    255,    240,    217,    182,
+	   131,     81,     41,     11,      1,      0,    255,    254,
+	   233,    201,    159,    107,     61,     20,      2,      1,
+	     0
 };
 
-const SKP_uint16 SKP_Silk_shell_code_table2[ 102 ] = {
-         0,  32615,  65535,      0,  14447,  50912,  65535,      0,
-      6301,  32587,  59361,  65535,      0,   3038,  18640,  46809,
-     62852,  65535,      0,   1746,  10524,  32509,  55273,  64278,
-     65535,      0,   1234,   6360,  21259,  43712,  59651,  64805,
-     65535,      0,   1020,   4461,  14030,  32286,  51249,  61904,
-     65100,  65535,      0,    851,   3435,  10006,  23241,  40797,
-     55444,  63009,  65252,  65535,      0,      0,   2075,   7137,
-     17119,  31499,  46982,  58723,  63976,  65535,  65535,      0,
-         0,      0,   3820,  11572,  23038,  37789,  51969,  61243,
-     65535,  65535,  65535,      0,      0,      0,      0,   6882,
-     16828,  30444,  44844,  57365,  65535,  65535,  65535,  65535,
-         0,      0,      0,      0,      0,  10093,  22963,  38779,
-     54426,  65535,  65535,  65535,  65535,  65535
+const SKP_uint8 SKP_Silk_shell_code_table2[90] = {
+	   129,      0,    203,     54,      0,    234,    129,     23,
+	     0,    245,    184,     73,     10,      0,    250,    215,
+	   129,     41,      5,      0,    252,    232,    173,     86,
+	    24,      3,      0,    253,    240,    200,    129,     56,
+	    15,      2,      0,    253,    244,    217,    164,     94,
+	    38,     10,      1,      0,    253,    245,    226,    189,
+	   132,     71,     27,      7,      1,      0,    253,    246,
+	   231,    203,    159,    105,     56,     23,      6,      1,
+	     0,    255,    248,    235,    213,    179,    133,     85,
+	    47,     19,      5,      1,      0,    255,    254,    243,
+	   221,    194,    159,    117,     70,     37,     12,      2,
+	     1,      0
 };
 
-const SKP_uint16 SKP_Silk_shell_code_table3[ 207 ] = {
-         0,  32324,  65535,      0,  15328,  49505,  65535,      0,
-      7474,  32344,  57955,  65535,      0,   3944,  19450,  45364,
-     61873,  65535,      0,   2338,  11698,  32435,  53915,  63734,
-     65535,      0,   1506,   7074,  21778,  42972,  58861,  64590,
-     65535,      0,   1027,   4490,  14383,  32264,  50980,  61712,
-     65043,  65535,      0,    760,   3022,   9696,  23264,  41465,
-     56181,  63253,  65251,  65535,      0,    579,   2256,   6873,
-     16661,  31951,  48250,  59403,  64198,  65360,  65535,      0,
-       464,   1783,   5181,  12269,  24247,  39877,  53490,  61502,
-     64591,  65410,  65535,      0,    366,   1332,   3880,   9273,
-     18585,  32014,  45928,  56659,  62616,  64899,  65483,  65535,
-         0,    286,   1065,   3089,   6969,  14148,  24859,  38274,
-     50715,  59078,  63448,  65091,  65481,  65535,      0,      0,
-       482,   2010,   5302,  10408,  18988,  30698,  43634,  54233,
-     60828,  64119,  65288,  65535,  65535,      0,      0,      0,
-      1006,   3531,   7857,  14832,  24543,  36272,  47547,  56883,
-     62327,  64746,  65535,  65535,  65535,      0,      0,      0,
-         0,   1863,   4950,  10730,  19284,  29397,  41382,  52335,
-     59755,  63834,  65535,  65535,  65535,  65535,      0,      0,
-         0,      0,      0,   2513,   7290,  14487,  24275,  35312,
-     46240,  55841,  62007,  65535,  65535,  65535,  65535,  65535,
-         0,      0,      0,      0,      0,      0,   3606,   9573,
-     18764,  28667,  40220,  51290,  59924,  65535,  65535,  65535,
-     65535,  65535,  65535,      0,      0,      0,      0,      0,
-         0,      0,   4879,  13091,  23376,  36061,  49395,  59315,
-     65535,  65535,  65535,  65535,  65535,  65535,  65535
+const SKP_uint8 SKP_Silk_shell_code_table3[152] = {
+	   130,      0,    200,     58,      0,    231,    130,     26,
+	     0,    244,    184,     76,     12,      0,    249,    214,
+	   130,     43,      6,      0,    252,    232,    173,     87,
+	    24,      3,      0,    253,    241,    203,    131,     56,
+	    14,      2,      0,    254,    246,    221,    167,     94,
+	    35,      8,      1,      0,    254,    249,    232,    193,
+	   130,     65,     23,      5,      1,      0,    255,    251,
+	   239,    211,    162,     99,     45,     15,      4,      1,
+	     0,    255,    251,    243,    223,    186,    131,     74,
+	    33,     11,      3,      1,      0,    255,    252,    245,
+	   230,    202,    158,    105,     57,     24,      8,      2,
+	     1,      0,    255,    253,    247,    235,    214,    179,
+	   132,     84,     44,     19,      7,      2,      1,      0,
+	   255,    254,    250,    240,    223,    196,    159,    112,
+	    69,     36,     15,      6,      2,      1,      0,    255,
+	   254,    253,    245,    231,    209,    176,    136,     93,
+	    55,     27,     11,      3,      2,      1,      0,    255,
+	   254,    253,    252,    239,    221,    194,    158,    117,
+	    76,     42,     18,      4,      3,      2,      1,      0
 };
 
-const SKP_uint16 SKP_Silk_shell_code_table_offsets[ 19 ] = {
-         0,      0,      3,      7,     12,     18,     25,     33,
-        42,     52,     63,     75,     88,    102,    117,    133,
-       150,    168,    187
+const SKP_uint8 SKP_Silk_shell_code_table_offsets[17] = {
+	     0,      0,      2,      5,      9,     14,     20,     27,
+	    35,     44,     54,     65,     77,     90,    104,    119,
+	   135
 };
 
+const SKP_uint8 SKP_Silk_sign_iCDF[36] = {
+	    49,     67,     77,     82,     93,     99,     11,     18,
+	    24,     31,     36,     45,     46,     66,     78,     87,
+	    94,    104,     14,     21,     32,     42,     51,     66,
+	    94,    104,    109,    112,    115,    118,     53,     69,
+	    80,     88,     95,    102
+};
--- a/src_common/SKP_Silk_tables_sign.c
+++ /dev/null
@@ -1,53 +1,0 @@
-/***********************************************************************
-Copyright (c) 2006-2010, Skype Limited. All rights reserved. 
-Redistribution and use in source and binary forms, with or without 
-modification, (subject to the limitations in the disclaimer below) 
-are permitted provided that the following conditions are met:
-- Redistributions of source code must retain the above copyright notice,
-this list of conditions and the following disclaimer.
-- Redistributions in binary form must reproduce the above copyright 
-notice, this list of conditions and the following disclaimer in the 
-documentation and/or other materials provided with the distribution.
-- Neither the name of Skype Limited, nor the names of specific 
-contributors, may be used to endorse or promote products derived from 
-this software without specific prior written permission.
-NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED 
-BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 
-CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
-BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 
-FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 
-USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-***********************************************************************/
-
-#include "SKP_Silk_tables.h"
-
-const SKP_uint8 SKP_Silk_sign_iCDF[ 36 ] = 
-{
-    /*
-         37840,  36944,  36251,  35304,
-         34715,  35503,  34529,  34296,
-         34016,  47659,  44945,  42503,
-         40235,  38569,  40254,  37851,
-         37243,  36595,  43410,  44121,
-         43127,  40978,  38845,  40433,
-         38252,  37795,  36637,  59159,
-         55630,  51806,  48073,  45036,
-         48416,  43857,  42678,  41146,
-         */
-    128, 128, 128, 128,
-    128, 128, 128, 128,
-    128, 128, 128, 128,
-    128, 128, 128, 128,
-    128, 128, 128, 128,
-    128, 128, 128, 128,
-    128, 128, 128, 128,
-    128, 128, 128, 128,
-    128, 128, 128, 128,
-};
-
--- a/src_common/SKP_Silk_tuning_parameters.h
+++ b/src_common/SKP_Silk_tuning_parameters.h
@@ -43,11 +43,6 @@
 /* Bandwidth expansion for whitening filter in pitch analysis */
 #define FIND_PITCH_BANDWITH_EXPANSION                   0.99f
 
-/* Threshold used by pitch estimator for early escape */
-#define FIND_PITCH_CORRELATION_THRESHOLD_HI_COMPL_MODE  0.7f
-#define FIND_PITCH_CORRELATION_THRESHOLD_MID_COMPL_MODE 0.75f
-#define FIND_PITCH_CORRELATION_THRESHOLD_LOW_COMPL_MODE 0.8f
-
 /*********************/
 /* Linear prediction */
 /*********************/
--- a/src_common/Silk_Common.vcproj
+++ /dev/null
@@ -1,360 +1,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="8,00"
-	Name="Silk_Common"
-	ProjectGUID="{0E29E502-AB22-4147-93A1-AC91528ED758}"
-	RootNamespace="Silk"
-	Keyword="Win32Proj"
-	>
-	<Platforms>
-		<Platform
-			Name="Win32"
-		/>
-	</Platforms>
-	<ToolFiles>
-	</ToolFiles>
-	<Configurations>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory="$(SolutionDir)"
-			IntermediateDirectory="$(ConfigurationName)"
-			ConfigurationType="4"
-			CharacterSet="1"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				FavorSizeOrSpeed="0"
-				AdditionalIncludeDirectories="&quot;../../../celt-0.7.1/libcelt&quot;;../interface;../src_SigProc_FIX;../src_FIX"
-				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;FIXED_POINT;HAVE_CONFIG_H"
-				MinimalRebuild="true"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="1"
-				FloatingPointModel="2"
-				UsePrecompiledHeader="0"
-				WarningLevel="3"
-				Detect64BitPortabilityProblems="true"
-				DebugInformationFormat="4"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLibrarianTool"
-				OutputFile="SKP_Silk_Common_Win32_debug.lib"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-				CommandLine=""
-			/>
-		</Configuration>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory="$(SolutionDir)"
-			IntermediateDirectory="$(ConfigurationName)"
-			ConfigurationType="4"
-			CharacterSet="1"
-			WholeProgramOptimization="1"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="2"
-				InlineFunctionExpansion="0"
-				FavorSizeOrSpeed="0"
-				AdditionalIncludeDirectories="&quot;../../../celt-0.7.1/libcelt&quot;;../interface;../src_SigProc_FIX;../src_FIX"
-				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;FIXED_POINT;HAVE_CONFIG_H"
-				GeneratePreprocessedFile="0"
-				RuntimeLibrary="0"
-				FloatingPointModel="2"
-				UsePrecompiledHeader="0"
-				WarningLevel="3"
-				Detect64BitPortabilityProblems="true"
-				DebugInformationFormat="3"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLibrarianTool"
-				OutputFile="SKP_Silk_Common_Win32_mt.lib"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-				CommandLine=""
-			/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Source Files"
-			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
-			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
-			>
-			<File
-				RelativePath=".\SKP_Silk_CNG.c"
-				>
-			</File>
-			<File
-				RelativePath=".\SKP_Silk_code_signs.c"
-				>
-			</File>
-			<File
-				RelativePath=".\SKP_Silk_create_init_destroy.c"
-				>
-			</File>
-			<File
-				RelativePath=".\SKP_Silk_dec_SDK_API.c"
-				>
-			</File>
-			<File
-				RelativePath=".\SKP_Silk_decode_core.c"
-				>
-			</File>
-			<File
-				RelativePath=".\SKP_Silk_decode_frame.c"
-				>
-			</File>
-			<File
-				RelativePath=".\SKP_Silk_decode_indices_v4.c"
-				>
-			</File>
-			<File
-				RelativePath=".\SKP_Silk_decode_parameters_v4.c"
-				>
-			</File>
-			<File
-				RelativePath=".\SKP_Silk_decode_pulses.c"
-				>
-			</File>
-			<File
-				RelativePath=".\SKP_Silk_decoder_set_fs.c"
-				>
-			</File>
-			<File
-				RelativePath=".\SKP_Silk_detect_SWB_input.c"
-				>
-			</File>
-			<File
-				RelativePath=".\SKP_Silk_enc_API.c"
-				>
-			</File>
-			<File
-				RelativePath=".\SKP_Silk_encode_parameters_v4.c"
-				>
-			</File>
-			<File
-				RelativePath=".\SKP_Silk_encode_pulses.c"
-				>
-			</File>
-			<File
-				RelativePath=".\SKP_Silk_gain_quant.c"
-				>
-			</File>
-			<File
-				RelativePath=".\SKP_Silk_interpolate.c"
-				>
-			</File>
-			<File
-				RelativePath=".\SKP_Silk_LBRR_reset.c"
-				>
-			</File>
-			<File
-				RelativePath=".\SKP_Silk_LP_variable_cutoff.c"
-				>
-			</File>
-			<File
-				RelativePath=".\SKP_Silk_NLSF2A_stable.c"
-				>
-			</File>
-			<File
-				RelativePath=".\SKP_Silk_NLSF_MSVQ_decode.c"
-				>
-			</File>
-			<File
-				RelativePath=".\SKP_Silk_NSQ.c"
-				>
-			</File>
-			<File
-				RelativePath=".\SKP_Silk_NSQ_del_dec.c"
-				>
-			</File>
-			<File
-				RelativePath=".\SKP_Silk_PLC.c"
-				>
-			</File>
-			<File
-				RelativePath=".\SKP_Silk_pulses_to_bytes.c"
-				>
-			</File>
-			<File
-				RelativePath=".\SKP_Silk_range_coder.c"
-				>
-			</File>
-			<File
-				RelativePath=".\SKP_Silk_shell_coder.c"
-				>
-			</File>
-			<File
-				RelativePath=".\SKP_Silk_tables_gain.c"
-				>
-			</File>
-			<File
-				RelativePath=".\SKP_Silk_tables_LTP.c"
-				>
-			</File>
-			<File
-				RelativePath=".\SKP_Silk_tables_NLSF_CB0_10.c"
-				>
-			</File>
-			<File
-				RelativePath=".\SKP_Silk_tables_NLSF_CB0_16.c"
-				>
-			</File>
-			<File
-				RelativePath=".\SKP_Silk_tables_NLSF_CB1_10.c"
-				>
-			</File>
-			<File
-				RelativePath=".\SKP_Silk_tables_NLSF_CB1_16.c"
-				>
-			</File>
-			<File
-				RelativePath=".\SKP_Silk_tables_other.c"
-				>
-			</File>
-			<File
-				RelativePath=".\SKP_Silk_tables_pitch_lag.c"
-				>
-			</File>
-			<File
-				RelativePath=".\SKP_Silk_tables_pulses_per_block.c"
-				>
-			</File>
-			<File
-				RelativePath=".\SKP_Silk_tables_sign.c"
-				>
-			</File>
-			<File
-				RelativePath=".\SKP_Silk_tables_type_offset.c"
-				>
-			</File>
-			<File
-				RelativePath=".\SKP_Silk_VAD.c"
-				>
-			</File>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl;inc;xsd"
-			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
-			>
-			<File
-				RelativePath=".\SKP_Silk_define.h"
-				>
-			</File>
-			<File
-				RelativePath=".\SKP_Silk_main.h"
-				>
-			</File>
-			<File
-				RelativePath=".\SKP_Silk_PLC.h"
-				>
-			</File>
-			<File
-				RelativePath=".\SKP_Silk_structs.h"
-				>
-			</File>
-			<File
-				RelativePath=".\SKP_Silk_tables.h"
-				>
-			</File>
-			<File
-				RelativePath=".\SKP_Silk_tables_NLSF_CB0_10.h"
-				>
-			</File>
-			<File
-				RelativePath=".\SKP_Silk_tables_NLSF_CB0_16.h"
-				>
-			</File>
-			<File
-				RelativePath=".\SKP_Silk_tables_NLSF_CB1_10.h"
-				>
-			</File>
-			<File
-				RelativePath=".\SKP_Silk_tables_NLSF_CB1_16.h"
-				>
-			</File>
-		</Filter>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>
--- a/src_common/src_common.vcxproj
+++ b/src_common/src_common.vcxproj
@@ -96,12 +96,11 @@
     <ClCompile Include="SKP_Silk_decode_pulses.c" />
     <ClCompile Include="SKP_Silk_dec_API.c" />
     <ClCompile Include="SKP_Silk_detect_SWB_input.c" />
-    <ClCompile Include="SKP_Silk_encode_parameters.c" />
+    <ClCompile Include="SKP_Silk_encode_indices.c" />
     <ClCompile Include="SKP_Silk_encode_pulses.c" />
     <ClCompile Include="SKP_Silk_enc_API.c" />
     <ClCompile Include="SKP_Silk_gain_quant.c" />
     <ClCompile Include="SKP_Silk_interpolate.c" />
-    <ClCompile Include="SKP_Silk_LBRR_reset.c" />
     <ClCompile Include="SKP_Silk_LP_variable_cutoff.c" />
     <ClCompile Include="SKP_Silk_NLSF2A_stable.c" />
     <ClCompile Include="SKP_Silk_NLSF_MSVQ_decode.c" />
@@ -110,7 +109,6 @@
     <ClCompile Include="SKP_Silk_PLC.c" />
     <ClCompile Include="SKP_Silk_pulses_to_bytes.c" />
     <ClCompile Include="SKP_Silk_quant_LTP_gains.c" />
-    <ClCompile Include="SKP_Silk_range_coder.c" />
     <ClCompile Include="SKP_Silk_shell_coder.c" />
     <ClCompile Include="SKP_Silk_tables_gain.c" />
     <ClCompile Include="SKP_Silk_tables_LTP.c" />
@@ -121,7 +119,6 @@
     <ClCompile Include="SKP_Silk_tables_other.c" />
     <ClCompile Include="SKP_Silk_tables_pitch_lag.c" />
     <ClCompile Include="SKP_Silk_tables_pulses_per_block.c" />
-    <ClCompile Include="SKP_Silk_tables_sign.c" />
     <ClCompile Include="SKP_Silk_VAD.c" />
     <ClCompile Include="SKP_Silk_VQ_WMat_EC.c" />
   </ItemGroup>
--- a/src_common/src_common.vcxproj.filters
+++ b/src_common/src_common.vcxproj.filters
@@ -77,9 +77,6 @@
     <ClCompile Include="SKP_Silk_enc_API.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="SKP_Silk_encode_parameters.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="SKP_Silk_encode_pulses.c">
       <Filter>Source Files</Filter>
     </ClCompile>
@@ -89,9 +86,6 @@
     <ClCompile Include="SKP_Silk_interpolate.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="SKP_Silk_LBRR_reset.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="SKP_Silk_LP_variable_cutoff.c">
       <Filter>Source Files</Filter>
     </ClCompile>
@@ -113,9 +107,6 @@
     <ClCompile Include="SKP_Silk_pulses_to_bytes.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="SKP_Silk_range_coder.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="SKP_Silk_shell_coder.c">
       <Filter>Source Files</Filter>
     </ClCompile>
@@ -146,9 +137,6 @@
     <ClCompile Include="SKP_Silk_tables_pulses_per_block.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="SKP_Silk_tables_sign.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="SKP_Silk_VAD.c">
       <Filter>Source Files</Filter>
     </ClCompile>
@@ -162,6 +150,9 @@
       <Filter>Source Files</Filter>
     </ClCompile>
     <ClCompile Include="SKP_Silk_VQ_WMat_EC.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="SKP_Silk_encode_indices.c">
       <Filter>Source Files</Filter>
     </ClCompile>
   </ItemGroup>
--- a/test/Decoder.c
+++ b/test/Decoder.c
@@ -143,7 +143,6 @@
     }
 
     if( !quiet ) {
-        printf("******************* Silk Decoder v %s ****************\n", SKP_Silk_SDK_get_version());
         printf("******************* Compiled for %d bit cpu ********* \n", (int)sizeof(void*) * 8 );
         printf( "Input:                       %s\n", bitInFileName );
         printf( "Output:                      %s\n", speechOutFileName );
--- a/test/Encoder.c
+++ b/test/Encoder.c
@@ -176,7 +176,6 @@
 
     /* Print options */
     if( !quiet ) {
-        printf("******************* Silk Encoder v %s ****************\n", SKP_Silk_SDK_get_version());
         printf("******************* Compiled for %d bit cpu ********* \n", (int)sizeof(void*) * 8 );
         printf( "Input:                          %s\n",     speechInFileName );
         printf( "Output:                         %s\n",     bitOutFileName );