diff --git a/Makefile.am b/Makefile.am
index 2ca8fa46967b2445c43400b48888140e51393a31..ec45a7bd7e7976150ddc28536c379cbeb57b95e4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3,7 +3,7 @@
 NAME = libSKP_SILK_SDK
 AM_CPPFLAGS = $(AM_CFLAGS)
 
-INCLUDES = -I$(top_srcdir)/src_FLP -I$(top_srcdir)/src_SigProc_FIX -I$(top_srcdir)/src_SigProc_FLP -I$(top_srcdir)/src_common -I$(top_srcdir)/interface -I$(top_srcdir)/../celt/libcelt
+INCLUDES = -I$(top_srcdir)/src_FLP -I$(top_srcdir)/src_FIX -I$(top_srcdir)/src_SigProc_FIX -I$(top_srcdir)/src_SigProc_FLP -I$(top_srcdir)/src_common -I$(top_srcdir)/interface -I$(top_srcdir)/../celt/libcelt
 EXTRA_DIST = src_FIX/src_FIX.vcxproj \
 src_FIX/src_FIX.vcxproj.filters \
 src_FLP/src_FLP.vcxproj \
@@ -59,6 +59,11 @@ src_common/SKP_Silk_VAD.c \
 src_common/SKP_Silk_control_audio_bandwidth.c \
 src_common/SKP_Silk_quant_LTP_gains.c \
 src_common/SKP_Silk_VQ_WMat_EC.c \
+src_common/SKP_Silk_HP_variable_cutoff.c \
+src_common/SKP_Silk_NLSF_MSVQ_encode.c \
+src_common/SKP_Silk_NLSF_VQ_rate_distortion.c \
+src_common/SKP_Silk_NLSF_VQ_sum_error.c \
+src_common/SKP_Silk_process_NLSFs.c \
 src_FLP/SKP_Silk_apply_sine_window_FLP.c \
 src_FLP/SKP_Silk_control_codec_FLP.c \
 src_FLP/SKP_Silk_corrMatrix_FLP.c \
@@ -67,19 +72,13 @@ src_FLP/SKP_Silk_find_LPC_FLP.c \
 src_FLP/SKP_Silk_find_LTP_FLP.c \
 src_FLP/SKP_Silk_find_pitch_lags_FLP.c \
 src_FLP/SKP_Silk_find_pred_coefs_FLP.c \
-src_FLP/SKP_Silk_HP_variable_cutoff_FLP.c \
 src_FLP/SKP_Silk_init_encoder_FLP.c \
 src_FLP/SKP_Silk_LPC_analysis_filter_FLP.c \
 src_FLP/SKP_Silk_LTP_analysis_filter_FLP.c \
 src_FLP/SKP_Silk_LTP_scale_ctrl_FLP.c \
-src_FLP/SKP_Silk_NLSF_MSVQ_decode_FLP.c \
-src_FLP/SKP_Silk_NLSF_MSVQ_encode_FLP.c \
-src_FLP/SKP_Silk_NLSF_VQ_rate_distortion_FLP.c \
-src_FLP/SKP_Silk_NLSF_VQ_sum_error_FLP.c \
 src_FLP/SKP_Silk_noise_shape_analysis_FLP.c \
 src_FLP/SKP_Silk_prefilter_FLP.c \
 src_FLP/SKP_Silk_process_gains_FLP.c \
-src_FLP/SKP_Silk_process_NLSFs_FLP.c \
 src_FLP/SKP_Silk_regularize_correlations_FLP.c \
 src_FLP/SKP_Silk_residual_energy_FLP.c \
 src_FLP/SKP_Silk_solve_LS_FLP.c \
@@ -144,7 +143,6 @@ src_SigProc_FLP/SKP_Silk_inner_product_FLP.c \
 src_SigProc_FLP/SKP_Silk_k2a_FLP.c \
 src_SigProc_FLP/SKP_Silk_levinsondurbin_FLP.c \
 src_SigProc_FLP/SKP_Silk_LPC_inv_pred_gain_FLP.c \
-src_SigProc_FLP/SKP_Silk_NLSF_VQ_weights_laroia_FLP.c \
 src_SigProc_FLP/SKP_Silk_pitch_analysis_core_FLP.c \
 src_SigProc_FLP/SKP_Silk_scale_copy_vector_FLP.c \
 src_SigProc_FLP/SKP_Silk_scale_vector_FLP.c \
diff --git a/interface/SKP_Silk_SDK_API.h b/interface/SKP_Silk_SDK_API.h
index ed4fcc4bdcc549f253c01a20106f8c1de40aa525..2a7546ea9d98a4d5052e73d509aea1f29a98c151 100644
--- a/interface/SKP_Silk_SDK_API.h
+++ b/interface/SKP_Silk_SDK_API.h
@@ -75,6 +75,16 @@ SKP_int SKP_Silk_SDK_QueryEncoder(                      /* O:   Returns error co
     SKP_SILK_SDK_EncControlStruct       *encStatus      /* O:   Encoder Status                                  */
 );
 
+/*****************************/
+/* Prefill look-ahead buffer */
+/*****************************/
+SKP_int SKP_Silk_SDK_Encoder_prefill_buffer( 
+    void                                *encState,      /* I/O: State                                                       */
+    SKP_SILK_SDK_EncControlStruct       *encControl,    /* I:   Control structure                                           */
+    const SKP_int16                     *samplesIn,     /* I:   Speech sample input vector  (last part will be used)        */
+    SKP_int                             nSamplesIn      /* I:   Number of samples in input vector                           */
+);
+
 /**************************/
 /* Encode frame with Silk */
 /**************************/
diff --git a/src_FIX/SKP_Silk_NLSF_VQ_sum_error_FIX.c b/src_FIX/SKP_Silk_NLSF_VQ_sum_error_FIX.c
deleted file mode 100644
index 4c448f90bb02d2567a8ee01984f605a27f8e12eb..0000000000000000000000000000000000000000
--- a/src_FIX/SKP_Silk_NLSF_VQ_sum_error_FIX.c
+++ /dev/null
@@ -1,79 +0,0 @@
-/***********************************************************************
-Copyright (c) 2006-2011, 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_FIX.h"
-
-/* Compute weighted quantization errors for an LPC_order element input vector, over one codebook stage */
-void SKP_Silk_NLSF_VQ_sum_error_FIX(
-    SKP_int32                       *err_Q20,           /* O    Weighted quantization errors  [N*K]         */
-    const SKP_int16                 *in_Q15,            /* I    Input vectors to be quantized [N*LPC_order] */
-    const SKP_int                   *w_Q6,              /* I    Weighting vectors             [LPC_order]   */
-    const SKP_int8                  *pCB_Q8,            /* I    Codebook vectors              [K*LPC_order] */
-    const SKP_int                   N,                  /* I    Number of input vectors                     */
-    const SKP_int                   K,                  /* I    Number of codebook vectors                  */
-    const SKP_int                   LPC_order           /* I    Number of LPCs                              */
-)
-{
-    SKP_int        i, n, m;
-    SKP_int32      diff_Q15, sum_error, Wtmp_Q6;
-    SKP_int32      Wcpy_Q6[ MAX_LPC_ORDER / 2 ];
-    const SKP_int8 *cb_vec_Q8;
-
-    SKP_assert( LPC_order <= 16 );
-    SKP_assert( ( LPC_order & 1 ) == 0 );
-
-    /* Copy to local stack and pack two weights per int32 */
-    for( m = 0; m < SKP_RSHIFT( LPC_order, 1 ); m++ ) {
-        Wcpy_Q6[ m ] = w_Q6[ 2 * m ] | SKP_LSHIFT( ( SKP_int32 )w_Q6[ 2 * m + 1 ], 16 );
-    }
-
-    /* Loop over input vectors */
-    for( n = 0; n < N; n++ ) {
-        /* Loop over codebook */
-        cb_vec_Q8 = pCB_Q8;
-        for( i = 0; i < K; i++ ) {
-            sum_error = 0;
-            for( m = 0; m < LPC_order; m += 2 ) {
-                /* Get two weights packed in an int32 */
-                Wtmp_Q6 = Wcpy_Q6[ SKP_RSHIFT( m, 1 ) ];
-
-                /* Compute weighted squared quantization error for index m */
-                diff_Q15 = in_Q15[ m ] - SKP_LSHIFT16( ( SKP_int16 )( *cb_vec_Q8++ ), 7 ); // range: [ -32767 : 32767 ]
-                sum_error = SKP_SMLAWB( sum_error, SKP_SMULBB( diff_Q15, diff_Q15 ), Wtmp_Q6 );
-
-                /* Compute weighted squared quantization error for index m + 1 */
-                diff_Q15 = in_Q15[m + 1] - SKP_LSHIFT16( ( SKP_int16 )( *cb_vec_Q8++ ), 7 ); // range: [ -32767 : 32767 ]
-                sum_error = SKP_SMLAWT( sum_error, SKP_SMULBB( diff_Q15, diff_Q15 ), Wtmp_Q6 );
-            }
-            SKP_assert( sum_error >= 0 );
-            err_Q20[ i ] = sum_error;
-        }
-        err_Q20 += K;
-        in_Q15 += LPC_order;
-    }
-}
-
diff --git a/src_FIX/SKP_Silk_control_codec_FIX.c b/src_FIX/SKP_Silk_control_codec_FIX.c
index 016c88ebda1fc82343c58f40ed4dd5f9208f61d1..5c9242715084914b24dae8ebf7361ca3952a0c0e 100644
--- a/src_FIX/SKP_Silk_control_codec_FIX.c
+++ b/src_FIX/SKP_Silk_control_codec_FIX.c
@@ -28,7 +28,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include "SKP_Silk_main_FIX.h"
 #include "SKP_Silk_setup.h"
 
-/* ToDo: Move the functions belowto common to be able to use them in FLP control codec also */
 SKP_INLINE SKP_int SKP_Silk_setup_resamplers(
     SKP_Silk_encoder_state_FIX      *psEnc,             /* I/O                      */
     SKP_int                         fs_kHz              /* I                        */
@@ -180,7 +179,7 @@ SKP_INLINE SKP_int SKP_Silk_setup_fs(
         if( PacketSize_ms == 10 ) {
             psEnc->sCmn.nFramesPerPacket = 1;
             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 );
+            psEnc->sCmn.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 {
@@ -189,7 +188,7 @@ SKP_INLINE SKP_int SKP_Silk_setup_fs(
         } else {
             psEnc->sCmn.nFramesPerPacket = SKP_DIV32_16( PacketSize_ms, MAX_FRAME_LENGTH_MS );
             psEnc->sCmn.nb_subfr = MAX_NB_SUBFR;
-            psEnc->sPred.pitch_LPC_win_length = SKP_SMULBB( FIND_PITCH_LPC_WIN_MS, fs_kHz );
+            psEnc->sCmn.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 {
@@ -202,24 +201,14 @@ SKP_INLINE SKP_int SKP_Silk_setup_fs(
     /* 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->sCmn.sNSQ,           0, sizeof( SKP_Silk_nsq_state ) );
-        SKP_memset( &psEnc->sPred,               0, sizeof( SKP_Silk_predict_state_FIX ) );
-        SKP_memset( psEnc->sPred.prev_NLSFq_Q15, 0, sizeof( psEnc->sPred.prev_NLSFq_Q15 ) );
-#if SWITCH_TRANSITION_FILTERING
-        SKP_memset( psEnc->sCmn.sLP.In_LP_State, 0, sizeof( psEnc->sCmn.sLP.In_LP_State ) );
-        if( psEnc->sCmn.sLP.mode == 1 ) {
-            /* Begin transition phase */
-            psEnc->sCmn.sLP.transition_frame_no = 1;
-        } else {
-            /* End transition phase */
-            psEnc->sCmn.sLP.transition_frame_no = 0;
-        }
-#endif
-        psEnc->sCmn.inputBufIx          = 0;
-        psEnc->sCmn.nFramesAnalyzed     = 0;
-        psEnc->sCmn.TargetRate_bps      = 0; /* Ensures that psEnc->SNR_dB is recomputed */
+        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->sCmn.sNSQ,            0, sizeof( SKP_Silk_nsq_state ) );
+        SKP_memset( psEnc->sCmn.prev_NLSFq_Q15,   0, sizeof( psEnc->sCmn.prev_NLSFq_Q15 ) );
+        SKP_memset( &psEnc->sCmn.sLP.In_LP_State, 0, sizeof( psEnc->sCmn.sLP.In_LP_State ) );
+        psEnc->sCmn.inputBufIx                  = 0;
+        psEnc->sCmn.nFramesAnalyzed             = 0;
+        psEnc->sCmn.TargetRate_bps              = 0; /* Ensures that psEnc->SNR_dB is recomputed */
 
         /* Initialize non-zero parameters */
         psEnc->sCmn.prevLag                     = 100;
@@ -259,30 +248,23 @@ SKP_INLINE SKP_int SKP_Silk_setup_fs(
         psEnc->sCmn.frame_length   = SKP_SMULBB( psEnc->sCmn.subfr_length, psEnc->sCmn.nb_subfr );
         psEnc->sCmn.ltp_mem_length = SKP_SMULBB( LTP_MEM_LENGTH_MS, fs_kHz ); 
         psEnc->sCmn.la_pitch       = SKP_SMULBB( LA_PITCH_MS, fs_kHz );
-        psEnc->sPred.min_pitch_lag = SKP_SMULBB(  3, fs_kHz );
-        psEnc->sPred.max_pitch_lag = SKP_SMULBB( 18, fs_kHz );
+        psEnc->sCmn.max_pitch_lag  = SKP_SMULBB( 18, fs_kHz );
         if( psEnc->sCmn.nb_subfr == MAX_NB_SUBFR ){
-            psEnc->sPred.pitch_LPC_win_length = SKP_SMULBB( FIND_PITCH_LPC_WIN_MS, fs_kHz );
+            psEnc->sCmn.pitch_LPC_win_length = SKP_SMULBB( FIND_PITCH_LPC_WIN_MS, fs_kHz );
         } else if( psEnc->sCmn.nb_subfr == MAX_NB_SUBFR / 2 ){
-            psEnc->sPred.pitch_LPC_win_length = SKP_SMULBB( FIND_PITCH_LPC_WIN_MS_2_SF, fs_kHz );
+            psEnc->sCmn.pitch_LPC_win_length = SKP_SMULBB( FIND_PITCH_LPC_WIN_MS_2_SF, fs_kHz );
         } else {
             /* Unsupported number of frames */
             SKP_assert( 0 );
         }
         if( psEnc->sCmn.fs_kHz == 16 ) {
             psEnc->sCmn.mu_LTP_Q9 = SKP_FIX_CONST( MU_LTP_QUANT_WB, 9 );
-            psEnc->sCmn.bitrate_threshold_up    = SKP_int32_MAX;
-            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_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_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;
         } else {
             /* unsupported sampling rate */
diff --git a/src_FIX/SKP_Silk_encode_frame_FIX.c b/src_FIX/SKP_Silk_encode_frame_FIX.c
index 43e4f0a075c84e18dd1ba7a658aa70c701e59545..985b114da943174645f06ec155622fc29a35c408 100644
--- a/src_FIX/SKP_Silk_encode_frame_FIX.c
+++ b/src_FIX/SKP_Silk_encode_frame_FIX.c
@@ -38,7 +38,7 @@ SKP_int SKP_Silk_encode_frame_FIX(
 )
 {
     SKP_Silk_encoder_control_FIX sEncCtrl;
-    SKP_int     i, nBits, SNR_dB_Q7, ret = 0;
+    SKP_int     i, nBits, ret = 0;
     SKP_uint8   flags;
     SKP_int16   *x_frame, *res_pitch_frame;
     SKP_int16   xfw[ MAX_FRAME_LENGTH ];
@@ -77,15 +77,13 @@ TIC(ENCODE_FRAME)
     /* Voice Activity Detection */
     /****************************/
 TIC(VAD)
-    ret = SKP_Silk_VAD_GetSA_Q8( &psEnc->sCmn.sVAD, &psEnc->speech_activity_Q8, &SNR_dB_Q7, 
-                                 sEncCtrl.input_quality_bands_Q15, &sEncCtrl.input_tilt_Q15,
-                                 psEnc->sCmn.inputBuf, psEnc->sCmn.frame_length, psEnc->sCmn.fs_kHz );
+    ret = SKP_Silk_VAD_GetSA_Q8( &psEnc->sCmn, psEnc->sCmn.inputBuf );
 TOC(VAD)
 
     /**************************************************/
     /* Convert speech activity into VAD and DTX flags */
     /**************************************************/
-    if( psEnc->speech_activity_Q8 < SKP_FIX_CONST( SPEECH_ACTIVITY_DTX_THRES, 8 ) ) {
+    if( psEnc->sCmn.speech_activity_Q8 < SKP_FIX_CONST( SPEECH_ACTIVITY_DTX_THRES, 8 ) ) {
         psEnc->sCmn.indices.signalType = TYPE_NO_VOICE_ACTIVITY;
         psEnc->sCmn.noSpeechCounter++;
         if( psEnc->sCmn.noSpeechCounter > NO_SPEECH_FRAMES_BEFORE_DTX ) {
@@ -109,7 +107,7 @@ TOC(VAD)
 TIC(HP_IN)
 #if HIGH_PASS_INPUT
     /* Variable high-pass filter */
-    SKP_Silk_HP_variable_cutoff_FIX( psEnc, &sEncCtrl, x_frame + LA_SHAPE_MS * psEnc->sCmn.fs_kHz, psEnc->sCmn.inputBuf );
+    SKP_Silk_HP_variable_cutoff( &psEnc->sCmn, x_frame + LA_SHAPE_MS * psEnc->sCmn.fs_kHz, psEnc->sCmn.inputBuf, psEnc->sCmn.frame_length );
 #else
     SKP_memcpy( x_frame + LA_SHAPE_MS * psEnc->sCmn.fs_kHz, psEnc->sCmn.inputBuf, psEnc->sCmn.frame_length * sizeof( SKP_int16 ) );
 #endif
@@ -257,13 +255,11 @@ TOC(ENCODE_FRAME)
         }
         DEBUG_STORE_DATA( PredCoef.dat,             tmp,                            psEnc->sCmn.predictLPCOrder * sizeof( SKP_float ) );
         
-        tmp[ 0 ] = (SKP_float)sEncCtrl.pitch_freq_low_Hz;
-        DEBUG_STORE_DATA( pitch_freq_low_Hz.dat,    tmp,                            sizeof( SKP_float ) );
         tmp[ 0 ] = (SKP_float)sEncCtrl.LTPredCodGain_Q7 / 128.0f;
         DEBUG_STORE_DATA( LTPredCodGain.dat,        tmp,                            sizeof( SKP_float ) );
         tmp[ 0 ] = (SKP_float)psEnc->LTPCorr_Q15 / 32768.0f;
         DEBUG_STORE_DATA( LTPcorr.dat,              tmp,                            sizeof( SKP_float ) );
-        tmp[ 0 ] = (SKP_float)sEncCtrl.input_tilt_Q15 / 32768.0f;
+        tmp[ 0 ] = (SKP_float)psEnc->sCmn.input_tilt_Q15 / 32768.0f;
         DEBUG_STORE_DATA( tilt.dat,                 tmp,                            sizeof( SKP_float ) );
         for( i = 0; i < psEnc->sCmn.nb_subfr; i++ ) {
             tmp[ i ] = (SKP_float)sEncCtrl.Gains_Q16[ i ] / 65536.0f;
@@ -277,7 +273,7 @@ TOC(ENCODE_FRAME)
         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++ ) {
-            tmp[ i ] = (SKP_float)sEncCtrl.input_quality_bands_Q15[ i ] / 32768.0f;
+            tmp[ i ] = (SKP_float)psEnc->sCmn.input_quality_bands_Q15[ i ] / 32768.0f;
         }
         DEBUG_STORE_DATA( input_quality_bands.dat,  tmp,                            VAD_N_BANDS * sizeof( SKP_float ) );
         DEBUG_STORE_DATA( signalType.dat,           &psEnc->sCmn.indices.signalType,         sizeof( SKP_int ) ); 
@@ -304,7 +300,7 @@ void SKP_Silk_LBRR_encode_FIX(
     /*******************************************/
     /* Control use of inband LBRR              */
     /*******************************************/
-    if( psEnc->sCmn.LBRR_enabled && psEnc->speech_activity_Q8 > SKP_FIX_CONST( LBRR_SPEECH_ACTIVITY_THRES, 8 ) ) {
+    if( psEnc->sCmn.LBRR_enabled && psEnc->sCmn.speech_activity_Q8 > SKP_FIX_CONST( LBRR_SPEECH_ACTIVITY_THRES, 8 ) ) {
         psEnc->sCmn.LBRR_flags[ psEnc->sCmn.nFramesAnalyzed ] = 1;
 
         /* Copy noise shaping quantizer state and quantization indices from regular encoding */
diff --git a/src_FIX/SKP_Silk_find_pitch_lags_FIX.c b/src_FIX/SKP_Silk_find_pitch_lags_FIX.c
index 2a66f528a337d99de22e61721b866e42ab8b8e4a..bfc3e36b85e791121418e19d67a602cb185ec4c2 100644
--- a/src_FIX/SKP_Silk_find_pitch_lags_FIX.c
+++ b/src_FIX/SKP_Silk_find_pitch_lags_FIX.c
@@ -36,7 +36,6 @@ void SKP_Silk_find_pitch_lags_FIX(
     const SKP_int16                 x[]             /* I    Speech signal                               */
 )
 {
-    SKP_Silk_predict_state_FIX *psPredSt = &psEnc->sPred;
     SKP_int   buf_len, i, scale;
     SKP_int32 thrhld_Q15, res_nrg;
     const SKP_int16 *x_buf, *x_buf_ptr;
@@ -52,7 +51,7 @@ void SKP_Silk_find_pitch_lags_FIX(
     buf_len = psEnc->sCmn.la_pitch + psEnc->sCmn.frame_length + psEnc->sCmn.ltp_mem_length;
 
     /* Safty check */
-    SKP_assert( buf_len >= psPredSt->pitch_LPC_win_length );
+    SKP_assert( buf_len >= psEnc->sCmn.pitch_LPC_win_length );
 
     x_buf = x - psEnc->sCmn.ltp_mem_length;
 
@@ -63,22 +62,22 @@ void SKP_Silk_find_pitch_lags_FIX(
     /* Calculate windowed signal */
     
     /* First LA_LTP samples */
-    x_buf_ptr = x_buf + buf_len - psPredSt->pitch_LPC_win_length;
+    x_buf_ptr = x_buf + buf_len - psEnc->sCmn.pitch_LPC_win_length;
     Wsig_ptr  = Wsig;
     SKP_Silk_apply_sine_window( Wsig_ptr, x_buf_ptr, 1, psEnc->sCmn.la_pitch );
 
     /* Middle un - windowed samples */
     Wsig_ptr  += psEnc->sCmn.la_pitch;
     x_buf_ptr += psEnc->sCmn.la_pitch;
-    SKP_memcpy( Wsig_ptr, x_buf_ptr, ( psPredSt->pitch_LPC_win_length - SKP_LSHIFT( psEnc->sCmn.la_pitch, 1 ) ) * sizeof( SKP_int16 ) );
+    SKP_memcpy( Wsig_ptr, x_buf_ptr, ( psEnc->sCmn.pitch_LPC_win_length - SKP_LSHIFT( psEnc->sCmn.la_pitch, 1 ) ) * sizeof( SKP_int16 ) );
 
     /* Last LA_LTP samples */
-    Wsig_ptr  += psPredSt->pitch_LPC_win_length - SKP_LSHIFT( psEnc->sCmn.la_pitch, 1 );
-    x_buf_ptr += psPredSt->pitch_LPC_win_length - SKP_LSHIFT( psEnc->sCmn.la_pitch, 1 );
+    Wsig_ptr  += psEnc->sCmn.pitch_LPC_win_length - SKP_LSHIFT( psEnc->sCmn.la_pitch, 1 );
+    x_buf_ptr += psEnc->sCmn.pitch_LPC_win_length - SKP_LSHIFT( psEnc->sCmn.la_pitch, 1 );
     SKP_Silk_apply_sine_window( Wsig_ptr, x_buf_ptr, 2, psEnc->sCmn.la_pitch );
 
     /* Calculate autocorrelation sequence */
-    SKP_Silk_autocorr( auto_corr, &scale, Wsig, psPredSt->pitch_LPC_win_length, psEnc->sCmn.pitchEstimationLPCOrder + 1 ); 
+    SKP_Silk_autocorr( auto_corr, &scale, Wsig, psEnc->sCmn.pitch_LPC_win_length, psEnc->sCmn.pitchEstimationLPCOrder + 1 ); 
         
     /* Add white noise, as fraction of energy */
     auto_corr[ 0 ] = SKP_SMLAWB( auto_corr[ 0 ], auto_corr[ 0 ], SKP_FIX_CONST( FIND_PITCH_WHITE_NOISE_FRACTION, 16 ) ) + 1;
@@ -105,13 +104,13 @@ void SKP_Silk_find_pitch_lags_FIX(
     /*****************************************/
     SKP_Silk_LPC_analysis_filter( res, x_buf, A_Q12, buf_len, psEnc->sCmn.pitchEstimationLPCOrder );
 
-    if( psEnc->sCmn.indices.signalType != TYPE_NO_VOICE_ACTIVITY ) {
+    if( psEnc->sCmn.indices.signalType != TYPE_NO_VOICE_ACTIVITY && psEnc->sCmn.first_frame_after_reset == 0 ) {
         /* 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.1,   7  ), psEnc->sCmn.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_SMLAWB( thrhld_Q15, SKP_FIX_CONST( -0.1,   16 ), psEnc->sCmn.input_tilt_Q15 );
         thrhld_Q15 = SKP_SAT16(  thrhld_Q15 );
 
         /*****************************************/
diff --git a/src_FIX/SKP_Silk_find_pred_coefs_FIX.c b/src_FIX/SKP_Silk_find_pred_coefs_FIX.c
index 5f3dcdc5de8bfd5a71197fa20ea7e05c20add3ac..babc4e8e744df3444cf3823b9b556f3f33d5c623 100644
--- a/src_FIX/SKP_Silk_find_pred_coefs_FIX.c
+++ b/src_FIX/SKP_Silk_find_pred_coefs_FIX.c
@@ -108,14 +108,14 @@ void SKP_Silk_find_pred_coefs_FIX(
 
     /* LPC_in_pre contains the LTP-filtered input for voiced, and the unfiltered input for unvoiced */
     TIC(FIND_LPC)
-    SKP_Silk_find_LPC_FIX( NLSF_Q15, &psEnc->sCmn.indices.NLSFInterpCoef_Q2, psEnc->sPred.prev_NLSFq_Q15, 
+    SKP_Silk_find_LPC_FIX( NLSF_Q15, &psEnc->sCmn.indices.NLSFInterpCoef_Q2, psEnc->sCmn.prev_NLSFq_Q15, 
         psEnc->sCmn.useInterpolatedNLSFs * ( 1 - psEnc->sCmn.first_frame_after_reset ), psEnc->sCmn.predictLPCOrder, 
         LPC_in_pre, psEnc->sCmn.subfr_length + psEnc->sCmn.predictLPCOrder, psEnc->sCmn.nb_subfr );
     TOC(FIND_LPC)
 
     /* Quantize LSFs */
     TIC(PROCESS_LSFS)
-        SKP_Silk_process_NLSFs_FIX( psEnc, psEncCtrl, NLSF_Q15 );
+    SKP_Silk_process_NLSFs( &psEnc->sCmn, psEncCtrl->PredCoef_Q12, NLSF_Q15, psEnc->sCmn.prev_NLSFq_Q15 );
     TOC(PROCESS_LSFS)
 
     /* Calculate residual energy using quantized LPC coefficients */
@@ -123,5 +123,5 @@ void SKP_Silk_find_pred_coefs_FIX(
         psEnc->sCmn.subfr_length, psEnc->sCmn.nb_subfr, psEnc->sCmn.predictLPCOrder );
 
     /* Copy to prediction struct for use in next frame for fluctuation reduction */
-    SKP_memcpy( psEnc->sPred.prev_NLSFq_Q15, NLSF_Q15, psEnc->sCmn.predictLPCOrder * sizeof( SKP_int ) );
+    SKP_memcpy( psEnc->sCmn.prev_NLSFq_Q15, NLSF_Q15, sizeof( psEnc->sCmn.prev_NLSFq_Q15 ) );
 }
diff --git a/src_FIX/SKP_Silk_init_encoder_FIX.c b/src_FIX/SKP_Silk_init_encoder_FIX.c
index d57d15b47a6cec2c2611be4ee12b865b1a984c85..1818b19a4586167e8b2001f88a4b13bf0cf6dd37 100644
--- a/src_FIX/SKP_Silk_init_encoder_FIX.c
+++ b/src_FIX/SKP_Silk_init_encoder_FIX.c
@@ -38,11 +38,11 @@ SKP_int SKP_Silk_init_encoder_FIX(
     SKP_memset( psEnc, 0, sizeof( SKP_Silk_encoder_state_FIX ) );
 
 #if HIGH_PASS_INPUT
-    psEnc->variable_HP_smth1_Q15 = 200844; /* = SKP_Silk_log2(70)_Q0; */
-    psEnc->variable_HP_smth2_Q15 = 200844; /* = SKP_Silk_log2(70)_Q0; */
+    psEnc->sCmn.variable_HP_smth1_Q15 = 200844; /* = SKP_Silk_log2(70)_Q0; */
+    psEnc->sCmn.variable_HP_smth2_Q15 = 200844; /* = SKP_Silk_log2(70)_Q0; */
 #endif
 
-    /* Used to deactivate e.g. LSF interpolation and fluctuation reduction */
+    /* Used to deactivate LSF interpolation, fluctuation reduction, pitch prediction */
     psEnc->sCmn.first_frame_after_reset = 1;
 
     /* Initialize Silk VAD */
diff --git a/src_FIX/SKP_Silk_main_FIX.h b/src_FIX/SKP_Silk_main_FIX.h
index 64c5b8b89084fd75ef61411c56431d242484c47d..004e7d2c00495b8185614836211ad7b0fdb05fc3 100644
--- a/src_FIX/SKP_Silk_main_FIX.h
+++ b/src_FIX/SKP_Silk_main_FIX.h
@@ -46,14 +46,6 @@ extern "C"
 /* Encoder Functions */
 /*********************/
 
-/* High-pass filter with cutoff frequency adaptation based on pitch lag statistics */
-void SKP_Silk_HP_variable_cutoff_FIX(
-    SKP_Silk_encoder_state_FIX      *psEnc,         /* I/O  Encoder state                               */
-    SKP_Silk_encoder_control_FIX    *psEncCtrl,     /* I/O  Encoder control                             */
-    SKP_int16                       *out,           /* O    high-pass filtered output signal            */
-    const SKP_int16                 *in             /* I    input signal                                */
-);
-
 /* Encoder main function */
 SKP_int SKP_Silk_encode_frame_FIX( 
     SKP_Silk_encoder_state_FIX      *psEnc,             /* I/O  Pointer to Silk FIX encoder state       */
@@ -188,53 +180,6 @@ void SKP_Silk_residual_energy_FIX(
     const SKP_int   LPC_order                       /* I    LPC order                       */
 );
 
-/******************/
-/* NLSF Quantizer */
-/******************/
-/* Limit, stabilize, convert and quantize NLSFs.    */ 
-void SKP_Silk_process_NLSFs_FIX(
-    SKP_Silk_encoder_state_FIX      *psEnc,     /* I/O  encoder state                               */
-    SKP_Silk_encoder_control_FIX    *psEncCtrl, /* I/O  encoder control                             */
-    SKP_int                         *pNLSF_Q15  /* I/O  Normalized LSFs (quant out) (0 - (2^15-1))  */
-);
-
-/* NLSF vector encoder */
-void SKP_Silk_NLSF_MSVQ_encode_FIX(
-          SKP_int8                  *NLSFIndices,           /* O    Codebook path vector [ CB_STAGES ]      */
-          SKP_int                   *pNLSF_Q15,             /* I/O  Quantized NLSF vector [ LPC_ORDER ]     */
-    const SKP_Silk_NLSF_CB_struct   *psNLSF_CB,             /* I    Codebook object                         */
-    const SKP_int                   *pNLSF_q_Q15_prev,      /* I    Prev. quantized NLSF vector [LPC_ORDER] */
-    const SKP_int                   *pW_Q6,                 /* I    NLSF weight vector [ LPC_ORDER ]        */
-    const SKP_int                   NLSF_mu_Q15,            /* I    Rate weight for the RD optimization     */
-    const SKP_int                   NLSF_mu_fluc_red_Q16,   /* I    Fluctuation reduction error weight      */
-    const SKP_int                   NLSF_MSVQ_Survivors,    /* I    Max survivors from each stage           */
-    const SKP_int                   LPC_order,              /* I    LPC order                               */
-    const SKP_int                   deactivate_fluc_red     /* I    Deactivate fluctuation reduction        */
-);
-
-/* Rate-Distortion calculations for multiple input data vectors */
-void SKP_Silk_NLSF_VQ_rate_distortion_FIX(
-    SKP_int32                       *pRD_Q20,           /* O    Rate-distortion values [psNLSF_CBS->nVectors*N] */
-    const SKP_Silk_NLSF_CBS         *psNLSF_CBS,        /* I    NLSF codebook stage struct                      */
-    const SKP_int16                 *in_Q15,            /* I    Input vectors to be quantized                   */
-    const SKP_int                   *w_Q6,              /* I    Weight vector                                   */
-    const SKP_int32                 *rate_acc_Q5,       /* I    Accumulated rates from previous stage           */
-    const SKP_int                   mu_Q15,             /* I    Weight between weighted error and rate          */
-    const SKP_int                   N,                  /* I    Number of input vectors to be quantized         */
-    const SKP_int                   LPC_order           /* I    LPC order                                       */
-);
-
-/* Compute weighted quantization errors for an LPC_order element input vector, over one codebook stage */
-void SKP_Silk_NLSF_VQ_sum_error_FIX(
-    SKP_int32                       *err_Q20,           /* O    Weighted quantization errors  [N*K]         */
-    const SKP_int16                 *in_Q15,            /* I    Input vectors to be quantized [N*LPC_order] */
-    const SKP_int                   *w_Q6,              /* I    Weighting vectors             [N*LPC_order] */
-    const SKP_int8                  *pCB_Q9,            /* I    Codebook vectors              [K*LPC_order] */
-    const SKP_int                   N,                  /* I    Number of input vectors                     */
-    const SKP_int                   K,                  /* I    Number of codebook vectors                  */
-    const SKP_int                   LPC_order           /* I    Number of LPCs                              */
-);
-
 /* Residual energy: nrg = wxx - 2 * wXx * c + c' * wXX * c */
 SKP_int32 SKP_Silk_residual_energy16_covar_FIX(
     const SKP_int16                 *c,                 /* I    Prediction vector                           */
diff --git a/src_FIX/SKP_Silk_noise_shape_analysis_FIX.c b/src_FIX/SKP_Silk_noise_shape_analysis_FIX.c
index 649161d8ff8e32fd02e3185cd7029497b7e2e89c..e43e253268d7989e53d544c033c1d7becc2cd483 100644
--- a/src_FIX/SKP_Silk_noise_shape_analysis_FIX.c
+++ b/src_FIX/SKP_Silk_noise_shape_analysis_FIX.c
@@ -170,8 +170,8 @@ void SKP_Silk_noise_shape_analysis_FIX(
     /* GAIN CONTROL */
     /****************/
     /* Input quality is the average of the quality in the lowest two VAD bands */
-    psEncCtrl->input_quality_Q14 = ( SKP_int )SKP_RSHIFT( ( SKP_int32 )psEncCtrl->input_quality_bands_Q15[ 0 ] 
-        + psEncCtrl->input_quality_bands_Q15[ 1 ], 2 );
+    psEncCtrl->input_quality_Q14 = ( SKP_int )SKP_RSHIFT( ( SKP_int32 )psEnc->sCmn.input_quality_bands_Q15[ 0 ] 
+        + psEnc->sCmn.input_quality_bands_Q15[ 1 ], 2 );
 
     /* Coding quality level, between 0.0_Q0 and 1.0_Q0, but in Q14 */
     psEncCtrl->coding_quality_Q14 = SKP_RSHIFT( SKP_Silk_sigm_Q15( SKP_RSHIFT_ROUND( psEncCtrl->current_SNR_dB_Q7 - 
@@ -180,7 +180,7 @@ void SKP_Silk_noise_shape_analysis_FIX(
     /* Reduce coding SNR during low speech activity */
     SNR_adj_dB_Q7 = psEncCtrl->current_SNR_dB_Q7;
     if( psEnc->sCmn.useCBR == 0 ) {
-        b_Q8 = SKP_FIX_CONST( 1.0, 8 ) - psEnc->speech_activity_Q8;
+        b_Q8 = SKP_FIX_CONST( 1.0, 8 ) - psEnc->sCmn.speech_activity_Q8;
         b_Q8 = SKP_SMULWB( SKP_LSHIFT( b_Q8, 8 ), b_Q8 );
         SNR_adj_dB_Q7 = SKP_SMLAWB( SNR_adj_dB_Q7,
             SKP_SMULBB( SKP_FIX_CONST( -BG_SNR_DECR_dB, 7 ) >> ( 4 + 1 ), b_Q8 ),                                       // Q11
@@ -370,15 +370,9 @@ void SKP_Silk_noise_shape_analysis_FIX(
     /* Control low-frequency shaping and noise tilt */
     /************************************************/
     /* Less low frequency shaping for noisy inputs */
-#if 1
-    strength_Q16 = SKP_MUL( SKP_FIX_CONST( LOW_FREQ_SHAPING, 0 ), SKP_FIX_CONST( 1.0, 16 ) + 
-        SKP_SMULBB( SKP_FIX_CONST( LOW_QUALITY_LOW_FREQ_SHAPING_DECR, 1 ), psEncCtrl->input_quality_bands_Q15[ 0 ] - SKP_FIX_CONST( 1.0, 15 ) ) );
-#else
-// TODO: CHECK THAT BELOW WORKS FINE AND REPLACE
     strength_Q16 = SKP_MUL( SKP_FIX_CONST( LOW_FREQ_SHAPING, 4 ), SKP_SMLAWB( SKP_FIX_CONST( 1.0, 12 ),
-        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 );
+        SKP_FIX_CONST( LOW_QUALITY_LOW_FREQ_SHAPING_DECR, 13 ), psEnc->sCmn.input_quality_bands_Q15[ 0 ] - SKP_FIX_CONST( 1.0, 15 ) ) );
+    strength_Q16 = SKP_RSHIFT( SKP_MUL( strength_Q16, psEnc->sCmn.speech_activity_Q8 ), 8 );
     if( psEnc->sCmn.indices.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])*/
@@ -392,7 +386,7 @@ void SKP_Silk_noise_shape_analysis_FIX(
         SKP_assert( SKP_FIX_CONST( HARM_HP_NOISE_COEF, 24 ) < SKP_FIX_CONST( 0.5, 24 ) ); // Guarantees that second argument to SMULWB() is within range of an SKP_int16
         Tilt_Q16 = - SKP_FIX_CONST( HP_NOISE_COEF, 16 ) - 
             SKP_SMULWB( SKP_FIX_CONST( 1.0, 16 ) - SKP_FIX_CONST( HP_NOISE_COEF, 16 ), 
-                SKP_SMULWB( SKP_FIX_CONST( HARM_HP_NOISE_COEF, 24 ), psEnc->speech_activity_Q8 ) );
+                SKP_SMULWB( SKP_FIX_CONST( HARM_HP_NOISE_COEF, 24 ), psEnc->sCmn.speech_activity_Q8 ) );
     } else {
         b_Q14 = SKP_DIV32_16( 21299, psEnc->sCmn.fs_kHz ); // 1.3_Q0 = 21299_Q14
         /* Pack two coefficients in one int32 */
diff --git a/src_FIX/SKP_Silk_process_gains_FIX.c b/src_FIX/SKP_Silk_process_gains_FIX.c
index dfa0980ac25aeeda28331273f4175b44416d000f..f8bb2959754d159941e1d29d35e274a29f4f1520 100644
--- a/src_FIX/SKP_Silk_process_gains_FIX.c
+++ b/src_FIX/SKP_Silk_process_gains_FIX.c
@@ -87,7 +87,7 @@ void SKP_Silk_process_gains_FIX(
         &psShapeSt->LastGainIndex, psEnc->sCmn.nFramesAnalyzed, 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( psEnc->sCmn.indices.signalType == TYPE_VOICED ) {
-        if( psEncCtrl->LTPredCodGain_Q7 + SKP_RSHIFT( psEncCtrl->input_tilt_Q15, 8 ) > SKP_FIX_CONST( 1.0, 7 ) ) {
+        if( psEncCtrl->LTPredCodGain_Q7 + SKP_RSHIFT( psEnc->sCmn.input_tilt_Q15, 8 ) > SKP_FIX_CONST( 1.0, 7 ) ) {
             psEnc->sCmn.indices.quantOffsetType = 0;
         } else {
             psEnc->sCmn.indices.quantOffsetType = 1;
@@ -98,7 +98,7 @@ void SKP_Silk_process_gains_FIX(
     quant_offset_Q10 = SKP_Silk_Quantization_Offsets_Q10[ psEnc->sCmn.indices.signalType >> 1 ][ psEnc->sCmn.indices.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          )
+                          + SKP_SMULWB( SKP_FIX_CONST( LAMBDA_SPEECH_ACT,        18 ), psEnc->sCmn.speech_activity_Q8     )
                           + SKP_SMULWB( SKP_FIX_CONST( LAMBDA_INPUT_QUALITY,     12 ), psEncCtrl->input_quality_Q14       )
                           + SKP_SMULWB( SKP_FIX_CONST( LAMBDA_CODING_QUALITY,    12 ), psEncCtrl->coding_quality_Q14      )
                           + SKP_SMULWB( SKP_FIX_CONST( LAMBDA_QUANT_OFFSET,      16 ), quant_offset_Q10                   );
diff --git a/src_FIX/SKP_Silk_structs_FIX.h b/src_FIX/SKP_Silk_structs_FIX.h
index 0cc04891465c094bed793f2c86a0c0a8f6bd8504..9f6047714ca4e83c06e646e8f7d2f10b078b8340 100644
--- a/src_FIX/SKP_Silk_structs_FIX.h
+++ b/src_FIX/SKP_Silk_structs_FIX.h
@@ -61,37 +61,19 @@ typedef struct {
     SKP_int     lagPrev;
 } SKP_Silk_prefilter_state_FIX;
 
-/*****************************/
-/* Prediction analysis state */
-/*****************************/
-typedef struct {
-    SKP_int   pitch_LPC_win_length;
-    SKP_int   min_pitch_lag;                                        /* Lowest possible pitch lag (samples)  */
-    SKP_int   max_pitch_lag;                                        /* Highest possible pitch lag (samples) */
-    SKP_int   prev_NLSFq_Q15[ MAX_LPC_ORDER ];                      /* Previously quantized NLSF vector     */
-} SKP_Silk_predict_state_FIX;
-
-
 /********************************/
 /* Encoder state FIX            */
 /********************************/
 typedef struct {
     SKP_Silk_encoder_state          sCmn;                           /* Common struct, shared with floating-point code */
-
-#if HIGH_PASS_INPUT
-    SKP_int32                       variable_HP_smth1_Q15;          /* State of first smoother                                              */
-    SKP_int32                       variable_HP_smth2_Q15;          /* State of second smoother                                             */
-#endif
     SKP_Silk_shape_state_FIX        sShape;                         /* Shape state                                                          */
     SKP_Silk_prefilter_state_FIX    sPrefilt;                       /* Prefilter State                                                      */
-    SKP_Silk_predict_state_FIX      sPred;                          /* Prediction state                                                     */
 
     /* Buffer for find pitch and noise shape analysis */
     SKP_DWORD_ALIGN SKP_int16 x_buf[ 2 * MAX_FRAME_LENGTH + LA_SHAPE_MAX ];
     SKP_int                         LTPCorr_Q15;                    /* Normalized correlation from pitch lag estimator                      */
     SKP_int32                       SNR_dB_Q7;                      /* Quality setting                                                      */
     SKP_int                         BufferedInChannel_ms;           /* Simulated number of ms buffer because of exceeded TargetRate_bps     */
-    SKP_int                         speech_activity_Q8;             /* Speech activity in Q8                                                */
 
     /* Parameters For LTP scaling Control */
     SKP_int                         prevLTPredCodGain_Q7;
@@ -124,15 +106,12 @@ typedef struct {
     SKP_int     Lambda_Q10;
     SKP_int     input_quality_Q14;
     SKP_int     coding_quality_Q14;
-    SKP_int32   pitch_freq_low_Hz;
     SKP_int     current_SNR_dB_Q7;
 
     /* measures */
     SKP_int     sparseness_Q8;
     SKP_int32   predGain_Q16;
     SKP_int     LTPredCodGain_Q7;
-    SKP_int     input_quality_bands_Q15[ VAD_N_BANDS ];
-    SKP_int     input_tilt_Q15;
     SKP_int32   ResNrg[ MAX_NB_SUBFR ];             /* Residual energy per subframe                             */
     SKP_int     ResNrgQ[ MAX_NB_SUBFR ];            /* Q domain for the residual energy > 0                     */
     
diff --git a/src_FIX/src_FIX.vcxproj b/src_FIX/src_FIX.vcxproj
index 1b73d8a3953db35c8f5ada447e46e5504e6a4194..15da4c620a4ab5ca99f6ed03133efc613bd656aa 100644
--- a/src_FIX/src_FIX.vcxproj
+++ b/src_FIX/src_FIX.vcxproj
@@ -85,17 +85,12 @@
     <ClCompile Include="SKP_Silk_find_LTP_FIX.c" />
     <ClCompile Include="SKP_Silk_find_pitch_lags_FIX.c" />
     <ClCompile Include="SKP_Silk_find_pred_coefs_FIX.c" />
-    <ClCompile Include="SKP_Silk_HP_variable_cutoff_FIX.c" />
     <ClCompile Include="SKP_Silk_init_encoder_FIX.c" />
     <ClCompile Include="SKP_Silk_LTP_analysis_filter_FIX.c" />
     <ClCompile Include="SKP_Silk_LTP_scale_ctrl_FIX.c" />
-    <ClCompile Include="SKP_Silk_NLSF_MSVQ_encode_FIX.c" />
-    <ClCompile Include="SKP_Silk_NLSF_VQ_rate_distortion_FIX.c" />
-    <ClCompile Include="SKP_Silk_NLSF_VQ_sum_error_FIX.c" />
     <ClCompile Include="SKP_Silk_noise_shape_analysis_FIX.c" />
     <ClCompile Include="SKP_Silk_prefilter_FIX.c" />
     <ClCompile Include="SKP_Silk_process_gains_FIX.c" />
-    <ClCompile Include="SKP_Silk_process_NLSFs_FIX.c" />
     <ClCompile Include="SKP_Silk_regularize_correlations_FIX.c" />
     <ClCompile Include="SKP_Silk_residual_energy16_FIX.c" />
     <ClCompile Include="SKP_Silk_residual_energy_FIX.c" />
diff --git a/src_FIX/src_FIX.vcxproj.filters b/src_FIX/src_FIX.vcxproj.filters
index ad867d7f5d99eb0ccfab45cde8273e2d2bcaa386..1718e615c0a26867096cd4853d56fd9b048bd9f7 100644
--- a/src_FIX/src_FIX.vcxproj.filters
+++ b/src_FIX/src_FIX.vcxproj.filters
@@ -47,9 +47,6 @@
     <ClCompile Include="SKP_Silk_find_pred_coefs_FIX.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="SKP_Silk_HP_variable_cutoff_FIX.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="SKP_Silk_init_encoder_FIX.c">
       <Filter>Source Files</Filter>
     </ClCompile>
@@ -59,15 +56,6 @@
     <ClCompile Include="SKP_Silk_LTP_scale_ctrl_FIX.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="SKP_Silk_NLSF_MSVQ_encode_FIX.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="SKP_Silk_NLSF_VQ_rate_distortion_FIX.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="SKP_Silk_NLSF_VQ_sum_error_FIX.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="SKP_Silk_noise_shape_analysis_FIX.c">
       <Filter>Source Files</Filter>
     </ClCompile>
@@ -77,9 +65,6 @@
     <ClCompile Include="SKP_Silk_process_gains_FIX.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="SKP_Silk_process_NLSFs_FIX.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="SKP_Silk_regularize_correlations_FIX.c">
       <Filter>Source Files</Filter>
     </ClCompile>
diff --git a/src_FLP/SKP_Silk_HP_variable_cutoff_FLP.c b/src_FLP/SKP_Silk_HP_variable_cutoff_FLP.c
deleted file mode 100644
index dcac37be6e121e2bdebeea48a4391e055d1bbf3a..0000000000000000000000000000000000000000
--- a/src_FLP/SKP_Silk_HP_variable_cutoff_FLP.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/***********************************************************************
-Copyright (c) 2006-2011, 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_FLP.h"
-#include "SKP_Silk_tuning_parameters.h"
-
-#if HIGH_PASS_INPUT
-
-/* High-pass filter with cutoff frequency adaptation based on pitch lag statistics */
-void SKP_Silk_HP_variable_cutoff_FLP(
-    SKP_Silk_encoder_state_FLP      *psEnc,             /* I/O  Encoder state FLP                       */
-    SKP_Silk_encoder_control_FLP    *psEncCtrl,         /* I/O  Encoder control FLP                     */
-          SKP_int16                 *out,               /* O    High-pass filtered output signal        */
-    const SKP_int16                 *in                 /* I    Input signal                            */
-)
-{
-    SKP_float pitch_freq_Hz, pitch_freq_log, quality, delta_freq, smth_coef, Fc, r;
-    SKP_int32 B_Q28[ 3 ], A_Q28[ 2 ];
-
-    /*********************************************/
-    /* Estimate low end of pitch frequency range */
-    /*********************************************/
-    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 );
-
-        /* Adjustment based on quality */
-        quality = psEncCtrl->input_quality_bands[ 0 ];
-        pitch_freq_log -= quality * quality * ( pitch_freq_log - SKP_Silk_log2( VARIABLE_HP_MIN_FREQ ) );
-        pitch_freq_log += 0.5f * ( 0.6f - quality );
-
-        delta_freq = pitch_freq_log - psEnc->variable_HP_smth1;
-        if( delta_freq < 0.0 ) {
-            /* Less smoothing for decreasing pitch frequency, to track something close to the minimum */
-            delta_freq *= 3.0f;
-        }
-
-        /* Limit delta, to reduce impact of outliers */
-        delta_freq = SKP_LIMIT_float( delta_freq, -VARIABLE_HP_MAX_DELTA_FREQ, VARIABLE_HP_MAX_DELTA_FREQ );
-    
-        /* Update smoother */
-        smth_coef = VARIABLE_HP_SMTH_COEF1 * psEnc->speech_activity;
-        psEnc->variable_HP_smth1 += smth_coef * delta_freq;
-    }
-
-    /* Second smoother */
-    psEnc->variable_HP_smth2 += VARIABLE_HP_SMTH_COEF2 * ( psEnc->variable_HP_smth1 - psEnc->variable_HP_smth2 );
-
-    /* Convert from log scale to Hertz */
-    psEncCtrl->pitch_freq_low_Hz = ( SKP_float )pow( 2.0f, psEnc->variable_HP_smth2 );
-
-    /* Limit frequency range */
-    psEncCtrl->pitch_freq_low_Hz = SKP_LIMIT_float( psEncCtrl->pitch_freq_low_Hz, VARIABLE_HP_MIN_FREQ, VARIABLE_HP_MAX_FREQ );
-
-    /*******************************/
-    /* Compute filter coefficients */
-    /*******************************/
-    /* Compute cut-off frequency, in radians */
-    Fc = ( SKP_float )( 0.45f * 2.0f * 3.14159265359 * psEncCtrl->pitch_freq_low_Hz / ( 1e3f * psEnc->sCmn.fs_kHz ) );
-
-    /* 2nd order ARMA coefficients */
-    r = 1.0f - 0.92f * Fc;
-
-    /* b = r * [1; -2; 1]; */
-    /* a = [1; -2 * r * (1 - 0.5 * Fc^2); r^2]; */
-    B_Q28[ 0 ] = SKP_float2int( ( 1 << 28 ) * r );
-    B_Q28[ 1 ] = SKP_float2int( ( 1 << 28 ) * -2.0f * r );
-    B_Q28[ 2 ] = B_Q28[ 0 ];
-    A_Q28[ 0 ] = SKP_float2int( ( 1 << 28 ) * -2.0f * r * ( 1.0f - 0.5f * Fc * Fc ) );
-    A_Q28[ 1 ] = SKP_float2int( ( 1 << 28 ) * r * r );
-
-    /********************/
-    /* High-pass filter */
-    /********************/
-    SKP_Silk_biquad_alt( in, B_Q28, A_Q28, psEnc->sCmn.In_HP_State, out, psEnc->sCmn.frame_length );
-}
-
-#endif // HIGH_PASS_INPUT
diff --git a/src_FLP/SKP_Silk_NLSF_MSVQ_decode_FLP.c b/src_FLP/SKP_Silk_NLSF_MSVQ_decode_FLP.c
deleted file mode 100644
index 6525371435aecd514089a2565a6a05448ae29d46..0000000000000000000000000000000000000000
--- a/src_FLP/SKP_Silk_NLSF_MSVQ_decode_FLP.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/***********************************************************************
-Copyright (c) 2006-2011, 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_FLP.h"
-
-/* NLSF vector decoder */
-void SKP_Silk_NLSF_MSVQ_decode_FLP(
-          SKP_float                 *pNLSF,             /* O    Decoded output vector [ LPC_ORDER ]     */
-    const SKP_Silk_NLSF_CB_struct   *psNLSF_CB,         /* I    NLSF codebook struct                    */  
-    const SKP_int8                  *NLSFIndices,       /* I    NLSF indices [ nStages ]                */
-    const SKP_int                   LPC_order           /* I    LPC order used                          */
-)
-{
-    const SKP_int8 *pCB_element;
-          SKP_int  s;
-          SKP_int  i;
-
-    /* Check that each index is within valid range */
-    SKP_assert( 0 <= NLSFIndices[ 0 ] && NLSFIndices[ 0 ] < psNLSF_CB->CBStages[ 0 ].nVectors );
-
-    /* Point to the first vector element */
-    pCB_element = &psNLSF_CB->CBStages[ 0 ].CB_NLSF_Q8[ SKP_SMULBB( (SKP_int)NLSFIndices[ 0 ], LPC_order ) ];
-
-    /* Initialize with the codebook vector from stage 0 */
-    for( i = 0; i < LPC_order; i++ ) {
-        pNLSF[ i ] = ( SKP_float )pCB_element[ i ];
-    }
-          
-    for( s = 1; s < psNLSF_CB->nStages; s++ ) {
-        /* Check that each index is within valid range */
-        SKP_assert( 0 <= NLSFIndices[ s ] && NLSFIndices[ s ] < psNLSF_CB->CBStages[ s ].nVectors );
-
-        if( LPC_order == 16 ) {
-            /* Point to the first vector element */
-            pCB_element = &psNLSF_CB->CBStages[ s ].CB_NLSF_Q8[ 16 * (SKP_int)NLSFIndices[ s ] ];
-
-            /* Add the codebook vector from the current stage */
-            pNLSF[ 0 ]  += ( SKP_float )pCB_element[ 0 ];
-            pNLSF[ 1 ]  += ( SKP_float )pCB_element[ 1 ];
-            pNLSF[ 2 ]  += ( SKP_float )pCB_element[ 2 ];
-            pNLSF[ 3 ]  += ( SKP_float )pCB_element[ 3 ];
-            pNLSF[ 4 ]  += ( SKP_float )pCB_element[ 4 ];
-            pNLSF[ 5 ]  += ( SKP_float )pCB_element[ 5 ];
-            pNLSF[ 6 ]  += ( SKP_float )pCB_element[ 6 ];
-            pNLSF[ 7 ]  += ( SKP_float )pCB_element[ 7 ];
-            pNLSF[ 8 ]  += ( SKP_float )pCB_element[ 8 ];
-            pNLSF[ 9 ]  += ( SKP_float )pCB_element[ 9 ];
-            pNLSF[ 10 ] += ( SKP_float )pCB_element[ 10 ];
-            pNLSF[ 11 ] += ( SKP_float )pCB_element[ 11 ];
-            pNLSF[ 12 ] += ( SKP_float )pCB_element[ 12 ];
-            pNLSF[ 13 ] += ( SKP_float )pCB_element[ 13 ];
-            pNLSF[ 14 ] += ( SKP_float )pCB_element[ 14 ];
-            pNLSF[ 15 ] += ( SKP_float )pCB_element[ 15 ];
-        } else {
-            /* Point to the first vector element */
-            pCB_element = &psNLSF_CB->CBStages[ s ].CB_NLSF_Q8[ (SKP_int)NLSFIndices[ s ] * LPC_order ];
-
-            /* Add the codebook vector from the current stage */
-            for( i = 0; i < LPC_order; i++ ) {
-                pNLSF[ i ] += ( SKP_float )pCB_element[ i ];
-            }
-        }
-    }
-
-    /* Add 1/2 in Q8 and convert to Q0 */
-    for( i = 0; i < LPC_order; i++ ) {
-        pNLSF[ i ] += 128.0f;
-        pNLSF[ i ] *= ( 1.0f / 256.0f );
-    }
-
-    /* NLSF stabilization */
-    SKP_Silk_NLSF_stabilize_FLP( pNLSF, psNLSF_CB->NDeltaMin_Q15, LPC_order );
-}
diff --git a/src_FLP/SKP_Silk_NLSF_MSVQ_encode_FLP.c b/src_FLP/SKP_Silk_NLSF_MSVQ_encode_FLP.c
deleted file mode 100644
index 416a1cedc2a9b4887711305a90c2c74a94fc46d9..0000000000000000000000000000000000000000
--- a/src_FLP/SKP_Silk_NLSF_MSVQ_encode_FLP.c
+++ /dev/null
@@ -1,221 +0,0 @@
-/***********************************************************************
-Copyright (c) 2006-2011, 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_FLP.h"
-
-/***********************/
-/* NLSF vector encoder */
-/***********************/
-void SKP_Silk_NLSF_MSVQ_encode_FLP(
-          SKP_int8                  *NLSFIndices,       /* O    Codebook path vector [ CB_STAGES ]      */
-          SKP_float                 *pNLSF,             /* I/O  Quantized NLSF vector [ LPC_ORDER ]     */
-    const SKP_Silk_NLSF_CB_struct   *psNLSF_CB,         /* I    Codebook object                         */
-    const SKP_float                 *pNLSF_q_prev,      /* I    Prev. quantized NLSF vector [LPC_ORDER] */
-    const SKP_float                 *pW,                /* I    NLSF weight vector [ LPC_ORDER ]        */
-    const SKP_float                 NLSF_mu,            /* I    Rate weight for the RD optimization     */
-    const SKP_float                 NLSF_mu_fluc_red,   /* I    Fluctuation reduction error weight      */
-    const SKP_int                   NLSF_MSVQ_Survivors,/* I    Max survivors from each stage           */
-    const SKP_int                   LPC_order,          /* I    LPC order                               */
-    const SKP_int                   deactivate_fluc_red /* I    Deactivate fluctuation reduction        */
-)
-{
-    SKP_int     i, s, k, cur_survivors, prev_survivors, min_survivors, input_index, cb_index, bestIndex;
-    SKP_float   rateDistThreshold;
-#if( NLSF_MSVQ_FLUCTUATION_REDUCTION == 1 )
-    SKP_float   se, wsse, bestRateDist;
-#endif
-
-    SKP_float   pRateDist[      NLSF_MSVQ_TREE_SEARCH_MAX_VECTORS_EVALUATED ];
-    SKP_float   pRate[          MAX_NLSF_MSVQ_SURVIVORS ];
-    SKP_float   pRate_new[      MAX_NLSF_MSVQ_SURVIVORS ];
-    SKP_int     pTempIndices[   MAX_NLSF_MSVQ_SURVIVORS ];
-    SKP_int8    pPath[          MAX_NLSF_MSVQ_SURVIVORS * NLSF_MSVQ_MAX_CB_STAGES ];
-    SKP_int8    pPath_new[      MAX_NLSF_MSVQ_SURVIVORS * NLSF_MSVQ_MAX_CB_STAGES ];
-    SKP_float   pRes_Q8[        MAX_NLSF_MSVQ_SURVIVORS * MAX_LPC_ORDER ];
-    SKP_float   pRes_Q8_new[    MAX_NLSF_MSVQ_SURVIVORS * MAX_LPC_ORDER ];
-
-    const SKP_float *pConstFloat;
-          SKP_float *pFloat;
-    const SKP_int8  *pConstInt8;
-          SKP_int8  *pInt8;
-    const SKP_int8  *pCB_element;
-    const SKP_Silk_NLSF_CBS *pCurrentCBStage;
-
-    SKP_assert( NLSF_MSVQ_Survivors <= MAX_NLSF_MSVQ_SURVIVORS );
-
-#ifdef SAVE_ALL_INTERNAL_DATA
-    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 ) );
-#endif
-
-    cur_survivors = NLSF_MSVQ_Survivors;
-
-    /****************************************************/
-    /* Tree search for the multi-stage vector quantizer */
-    /****************************************************/
-
-    /* Clear accumulated rates */
-    SKP_memset( pRate, 0, NLSF_MSVQ_Survivors * sizeof( SKP_float ) );
-
-    /* Subtract 1/2 from NLSF input vector to create initial residual, and scale to Q8 */
-    for( i = 0; i < LPC_order; i++ ) {
-        pRes_Q8[ i ] = ( pNLSF[ i ] - 0.5f ) * 256.0f;        
-    }
-
-    /* Set first stage values */
-    prev_survivors = 1;
-
-    /* Minimum number of survivors */
-    min_survivors = NLSF_MSVQ_Survivors / 2;
-
-    /* Loop over all stages */
-    for( s = 0; s < psNLSF_CB->nStages; s++ ) {
-
-        /* Set a pointer to the current stage codebook */
-        pCurrentCBStage = &psNLSF_CB->CBStages[ s ];
-
-        /* Calculate the number of survivors in the current stage */
-        cur_survivors = SKP_min_32( NLSF_MSVQ_Survivors, prev_survivors * pCurrentCBStage->nVectors );
-
-#if( NLSF_MSVQ_FLUCTUATION_REDUCTION == 0 )
-        /* Find a single best survivor in the last stage, if we */
-        /* do not need candidates for fluctuation reduction     */
-        if( s == psNLSF_CB->nStages - 1 ) {
-            cur_survivors = 1;
-        }
-#endif
-        /* Nearest neighbor clustering for multiple input data vectors */
-        SKP_Silk_NLSF_VQ_rate_distortion_FLP( pRateDist, pCurrentCBStage, pRes_Q8, pW, pRate, NLSF_mu, prev_survivors, LPC_order );
-
-        /* Sort the rate-distortion errors */
-        SKP_Silk_insertion_sort_increasing_FLP( pRateDist, pTempIndices, prev_survivors * pCurrentCBStage->nVectors, cur_survivors );
-
-        /* Discard survivors with rate-distortion values too far above the best one */
-        rateDistThreshold = ( 1.0f + NLSF_MSVQ_Survivors * NLSF_MSVQ_SURV_MAX_REL_RD ) * pRateDist[ 0 ];
-        while( pRateDist[ cur_survivors - 1 ] > rateDistThreshold && cur_survivors > min_survivors ) {
-            cur_survivors--;
-        }
-
-        /* Update accumulated codebook contributions for the 'cur_survivors' best codebook indices */
-        for( k = 0; k < cur_survivors; k++ ) { 
-            if( s > 0 ) {
-                /* Find the indices of the input and the codebook vector */
-                if( pCurrentCBStage->nVectors == 8 ) {
-                    input_index = SKP_RSHIFT( pTempIndices[ k ], 3 );
-                    cb_index    = pTempIndices[ k ] & 7;
-                } else {
-                    input_index = pTempIndices[ k ] / pCurrentCBStage->nVectors;  
-                    cb_index    = pTempIndices[ k ] - input_index * pCurrentCBStage->nVectors;
-                }
-            } else {
-                /* Find the indices of the input and the codebook vector */
-                input_index = 0;
-                cb_index    = pTempIndices[ k ];
-            }
-
-            /* Subtract new contribution from the previous residual vector for each of 'cur_survivors' */
-            pConstFloat = &pRes_Q8[ input_index * LPC_order ];
-            pCB_element = &pCurrentCBStage->CB_NLSF_Q8[ cb_index * LPC_order ];
-            pFloat      = &pRes_Q8_new[ k * LPC_order ];
-            for( i = 0; i < LPC_order; i++ ) {
-                pFloat[ i ] = pConstFloat[ i ] - pCB_element[ i ];
-            }
-
-            /* Update accumulated rate for stage 1 to the current */
-            pRate_new[ k ] = pRate[ input_index ] + 0.0625f * ( SKP_float )pCurrentCBStage->Rates_Q4[ cb_index ];
-
-            /* Copy paths from previous matrix, starting with the best path */
-            pConstInt8 = &pPath[ input_index * psNLSF_CB->nStages ];
-            pInt8      = &pPath_new[       k * psNLSF_CB->nStages ];
-            for( i = 0; i < s; i++ ) {
-                pInt8[ i ] = pConstInt8[ i ];
-            }
-            /* Write the current stage indices for the 'cur_survivors' to the best path matrix */
-            pInt8[ s ] = (SKP_int8)cb_index;
-        }
-
-        if( s < psNLSF_CB->nStages - 1 ) {
-            /* Copy NLSF residual matrix for next stage */
-            SKP_memcpy( pRes_Q8, pRes_Q8_new, cur_survivors * LPC_order * sizeof( SKP_float ) );
-
-            /* Copy rate vector for next stage */
-            SKP_memcpy( pRate, pRate_new, cur_survivors * sizeof( SKP_float ) );
-
-            /* Copy best path matrix for next stage */
-            SKP_memcpy( pPath, pPath_new, cur_survivors * psNLSF_CB->nStages * sizeof( SKP_int8) );
-        }
-
-        prev_survivors = cur_survivors;
-    }
-
-    /* (Preliminary) index of the best survivor, later to be decoded */
-    bestIndex = 0;
-
-#if( NLSF_MSVQ_FLUCTUATION_REDUCTION == 1 )
-    /******************************/
-    /* NLSF fluctuation reduction */
-    /******************************/
-    if( deactivate_fluc_red != 1 ) {
-    
-        /* Search among all survivors, now taking also weighted fluctuation errors into account */
-        bestRateDist = SKP_float_MAX;
-        for( s = 0; s < cur_survivors; s++ ) {
-            /* Decode survivor to compare with previous quantized NLSF vector */
-            SKP_Silk_NLSF_MSVQ_decode_FLP( pNLSF, psNLSF_CB, &pPath_new[ s * psNLSF_CB->nStages ], LPC_order );
-
-            /* Compare decoded NLSF vector with the previously quantized vector */ 
-            wsse = 0;
-            for( i = 0; i < LPC_order; i += 2 ) {
-                /* Compute weighted squared quantization error for index i */
-                se = pNLSF[ i ] - pNLSF_q_prev[ i ];
-                wsse += pW[ i ] * se * se;
-
-                /* Compute weighted squared quantization error for index i + 1 */
-                se = pNLSF[ i + 1 ] - pNLSF_q_prev[ i + 1 ];
-                wsse += pW[ i + 1 ] * se * se;
-            }
-
-            /* Add the fluctuation reduction penalty to the rate distortion error */
-            wsse = pRateDist[s] + wsse * NLSF_mu_fluc_red;
-
-            /* Keep index of best survivor */
-            if( wsse < bestRateDist ) {
-                bestRateDist = wsse;
-                bestIndex = s;
-            }
-        }
-    }
-#endif
-
-    /* Copy best path to output argument */
-    SKP_memcpy( NLSFIndices, &pPath_new[ bestIndex * psNLSF_CB->nStages ], psNLSF_CB->nStages * sizeof( SKP_int8 ) );
-
-    /* Decode and stabilize the best survivor */
-    SKP_Silk_NLSF_MSVQ_decode_FLP( pNLSF, psNLSF_CB, NLSFIndices, LPC_order );
-
-}
diff --git a/src_FLP/SKP_Silk_NLSF_VQ_rate_distortion_FLP.c b/src_FLP/SKP_Silk_NLSF_VQ_rate_distortion_FLP.c
deleted file mode 100644
index c45b683bc236aa03f58e3e474c0657c303307438..0000000000000000000000000000000000000000
--- a/src_FLP/SKP_Silk_NLSF_VQ_rate_distortion_FLP.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/***********************************************************************
-Copyright (c) 2006-2011, 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_FLP.h"
-
-/* Rate-Distortion calculations for multiple input data vectors */
-void SKP_Silk_NLSF_VQ_rate_distortion_FLP(
-          SKP_float             *pRD,               /* O   Rate-distortion values [psNLSF_CBS_FLP->nVectors*N] */
-    const SKP_Silk_NLSF_CBS     *psNLSF_CBS,        /* I   NLSF codebook stage struct                          */
-    const SKP_float             *in,                /* I   Input vectors to be quantized                       */
-    const SKP_float             *w,                 /* I   Weight vector                                       */
-    const SKP_float             *rate_acc,          /* I   Accumulated rates from previous stage               */
-    const SKP_float             mu,                 /* I   Weight between weighted error and rate              */
-    const SKP_int               N,                  /* I   Number of input vectors to be quantized             */
-    const SKP_int               LPC_order           /* I   LPC order                                           */
-)
-{
-    SKP_float *pRD_vec;
-    SKP_int   i, n;
-
-    /* Compute weighted quantization errors for all input vectors over one codebook stage */
-    SKP_Silk_NLSF_VQ_sum_error_FLP( pRD, in, w, psNLSF_CBS->CB_NLSF_Q8, N, psNLSF_CBS->nVectors, LPC_order );
-
-    /* Loop over input vectors */
-    pRD_vec = pRD;
-    for( n = 0; n < N; n++ ) {
-        /* Add rate cost to error for each codebook vector */
-        for( i = 0; i < psNLSF_CBS->nVectors; i++ ) {
-            pRD_vec[ i ] += mu * ( rate_acc[n] + 0.0625f * ( SKP_float )psNLSF_CBS->Rates_Q4[ i ] );
-        }
-        pRD_vec += psNLSF_CBS->nVectors;
-    }
-}
diff --git a/src_FLP/SKP_Silk_NLSF_VQ_sum_error_FLP.c b/src_FLP/SKP_Silk_NLSF_VQ_sum_error_FLP.c
deleted file mode 100644
index 6e4df16288d7648b8e37aee3da8b636db26c278d..0000000000000000000000000000000000000000
--- a/src_FLP/SKP_Silk_NLSF_VQ_sum_error_FLP.c
+++ /dev/null
@@ -1,132 +0,0 @@
-/***********************************************************************
-Copyright (c) 2006-2011, 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_FLP.h"
-
-/* compute weighted quantization errors for LPC_order element input vectors, over one codebook stage */
-void SKP_Silk_NLSF_VQ_sum_error_FLP(
-          SKP_float                 *err,               /* O    Weighted quantization errors [ N * K ]  */
-    const SKP_float                 *in_NLSF_Q8,        /* I    Input vectors [ N * LPC_order ]         */
-    const SKP_float                 *w,                 /* I    Weighting vectors [ N * LPC_order ]     */
-    const SKP_int8                  *pCB_NLSF_Q8,       /* I    Codebook vectors [ K * LPC_order ]      */
-    const SKP_int                   N,                  /* I    Number of input vectors                 */
-    const SKP_int                   K,                  /* I    Number of codebook vectors              */
-    const SKP_int                   LPC_order           /* I    LPC order                               */
-)
-{
-    SKP_int        i, n;
-    SKP_float      diff_Q8, sum_error_Q16;
-    SKP_float      Wcpy[ MAX_LPC_ORDER ];
-    const SKP_int8 *cb_vec_NLSF_Q8;
-
-    /* Copy to local stack */
-    SKP_memcpy( Wcpy, w, LPC_order * sizeof( SKP_float ) );
-
-    if( LPC_order == 16 ) {
-        /* Loop over input vectors */
-        for( n = 0; n < N; n++ ) {
-            /* Loop over codebook */
-            cb_vec_NLSF_Q8 = pCB_NLSF_Q8;
-            for( i = 0; i < K; i++ ) {
-                /* Compute weighted squared quantization error */
-                diff_Q8 = in_NLSF_Q8[ 0 ] - ( SKP_float )cb_vec_NLSF_Q8[ 0 ];
-                sum_error_Q16  = Wcpy[ 0 ] * diff_Q8 * diff_Q8;
-                diff_Q8 = in_NLSF_Q8[ 1 ] - ( SKP_float )cb_vec_NLSF_Q8[ 1 ];
-                sum_error_Q16 += Wcpy[ 1 ] * diff_Q8 * diff_Q8;
-                diff_Q8 = in_NLSF_Q8[ 2 ] - ( SKP_float )cb_vec_NLSF_Q8[ 2 ];
-                sum_error_Q16 += Wcpy[ 2 ] * diff_Q8 * diff_Q8;
-                diff_Q8 = in_NLSF_Q8[ 3 ] - ( SKP_float )cb_vec_NLSF_Q8[ 3 ];
-                sum_error_Q16 += Wcpy[ 3 ] * diff_Q8 * diff_Q8;
-                diff_Q8 = in_NLSF_Q8[ 4 ] - ( SKP_float )cb_vec_NLSF_Q8[ 4 ];
-                sum_error_Q16 += Wcpy[ 4 ] * diff_Q8 * diff_Q8;
-                diff_Q8 = in_NLSF_Q8[ 5 ] - ( SKP_float )cb_vec_NLSF_Q8[ 5 ];
-                sum_error_Q16 += Wcpy[ 5 ] * diff_Q8 * diff_Q8;
-                diff_Q8 = in_NLSF_Q8[ 6 ] - ( SKP_float )cb_vec_NLSF_Q8[ 6 ];
-                sum_error_Q16 += Wcpy[ 6 ] * diff_Q8 * diff_Q8;
-                diff_Q8 = in_NLSF_Q8[ 7 ] - ( SKP_float )cb_vec_NLSF_Q8[ 7 ];
-                sum_error_Q16 += Wcpy[ 7 ] * diff_Q8 * diff_Q8;
-                diff_Q8 = in_NLSF_Q8[ 8 ] - ( SKP_float )cb_vec_NLSF_Q8[ 8 ];
-                sum_error_Q16 += Wcpy[ 8 ] * diff_Q8 * diff_Q8;
-                diff_Q8 = in_NLSF_Q8[ 9 ] - ( SKP_float )cb_vec_NLSF_Q8[ 9 ];
-                sum_error_Q16 += Wcpy[ 9 ] * diff_Q8 * diff_Q8;
-                diff_Q8 = in_NLSF_Q8[ 10 ] - ( SKP_float )cb_vec_NLSF_Q8[ 10 ];
-                sum_error_Q16 += Wcpy[ 10 ] * diff_Q8 * diff_Q8;
-                diff_Q8 = in_NLSF_Q8[ 11 ] - ( SKP_float )cb_vec_NLSF_Q8[ 11 ];
-                sum_error_Q16 += Wcpy[ 11 ] * diff_Q8 * diff_Q8;
-                diff_Q8 = in_NLSF_Q8[ 12 ] - ( SKP_float )cb_vec_NLSF_Q8[ 12 ];
-                sum_error_Q16 += Wcpy[ 12 ] * diff_Q8 * diff_Q8;
-                diff_Q8 = in_NLSF_Q8[ 13 ] - ( SKP_float )cb_vec_NLSF_Q8[ 13 ];
-                sum_error_Q16 += Wcpy[ 13 ] * diff_Q8 * diff_Q8;
-                diff_Q8 = in_NLSF_Q8[ 14 ] - ( SKP_float )cb_vec_NLSF_Q8[ 14 ];
-                sum_error_Q16 += Wcpy[ 14 ] * diff_Q8 * diff_Q8;
-                diff_Q8 = in_NLSF_Q8[ 15 ] - ( SKP_float )cb_vec_NLSF_Q8[ 15 ];
-                sum_error_Q16 += Wcpy[ 15 ] * diff_Q8 * diff_Q8;
-
-                err[ i ] = ( 1.0f / 65536.0f ) * sum_error_Q16;
-                cb_vec_NLSF_Q8 += 16;
-            }
-            err        += K;
-            in_NLSF_Q8 += 16;
-        }
-    } else {
-        SKP_assert( LPC_order == 10 );
-
-        /* Loop over input vectors */
-        for( n = 0; n < N; n++ ) {
-            /* Loop over codebook */
-            cb_vec_NLSF_Q8 = pCB_NLSF_Q8;
-            for( i = 0; i < K; i++ ) {
-                /* Compute weighted squared quantization error */
-                diff_Q8 = in_NLSF_Q8[ 0 ] - ( SKP_float )cb_vec_NLSF_Q8[ 0 ];
-                sum_error_Q16  = Wcpy[ 0 ] * diff_Q8 * diff_Q8;
-                diff_Q8 = in_NLSF_Q8[ 1 ] - ( SKP_float )cb_vec_NLSF_Q8[ 1 ];
-                sum_error_Q16 += Wcpy[ 1 ] * diff_Q8 * diff_Q8;
-                diff_Q8 = in_NLSF_Q8[ 2 ] - ( SKP_float )cb_vec_NLSF_Q8[ 2 ];
-                sum_error_Q16 += Wcpy[ 2 ] * diff_Q8 * diff_Q8;
-                diff_Q8 = in_NLSF_Q8[ 3 ] - ( SKP_float )cb_vec_NLSF_Q8[ 3 ];
-                sum_error_Q16 += Wcpy[ 3 ] * diff_Q8 * diff_Q8;
-                diff_Q8 = in_NLSF_Q8[ 4 ] - ( SKP_float )cb_vec_NLSF_Q8[ 4 ];
-                sum_error_Q16 += Wcpy[ 4 ] * diff_Q8 * diff_Q8;
-                diff_Q8 = in_NLSF_Q8[ 5 ] - ( SKP_float )cb_vec_NLSF_Q8[ 5 ];
-                sum_error_Q16 += Wcpy[ 5 ] * diff_Q8 * diff_Q8;
-                diff_Q8 = in_NLSF_Q8[ 6 ] - ( SKP_float )cb_vec_NLSF_Q8[ 6 ];
-                sum_error_Q16 += Wcpy[ 6 ] * diff_Q8 * diff_Q8;
-                diff_Q8 = in_NLSF_Q8[ 7 ] - ( SKP_float )cb_vec_NLSF_Q8[ 7 ];
-                sum_error_Q16 += Wcpy[ 7 ] * diff_Q8 * diff_Q8;
-                diff_Q8 = in_NLSF_Q8[ 8 ] - ( SKP_float )cb_vec_NLSF_Q8[ 8 ];
-                sum_error_Q16 += Wcpy[ 8 ] * diff_Q8 * diff_Q8;
-                diff_Q8 = in_NLSF_Q8[ 9 ] - ( SKP_float )cb_vec_NLSF_Q8[ 9 ];
-                sum_error_Q16 += Wcpy[ 9 ] * diff_Q8 * diff_Q8;
-
-                err[ i ] = ( 1.0f / 65536.0f ) * sum_error_Q16;
-                cb_vec_NLSF_Q8 += 10;
-            }
-            err        += K;
-            in_NLSF_Q8 += 10;
-        }
-    }
-}
diff --git a/src_FLP/SKP_Silk_control_codec_FLP.c b/src_FLP/SKP_Silk_control_codec_FLP.c
index 028729c1b0e9013b1cf8f77e3472a0121f8b6c75..77de4ea04ad809698528ebd7b0c0c0f09b57efca 100644
--- a/src_FLP/SKP_Silk_control_codec_FLP.c
+++ b/src_FLP/SKP_Silk_control_codec_FLP.c
@@ -184,7 +184,7 @@ SKP_INLINE SKP_int SKP_Silk_setup_fs(
             /* Only allowed when the payload buffer is empty */
             psEnc->sCmn.nFramesPerPacket = 1;
             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 );
+            psEnc->sCmn.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 {
@@ -193,7 +193,7 @@ SKP_INLINE SKP_int SKP_Silk_setup_fs(
         } else {
             psEnc->sCmn.nFramesPerPacket = SKP_DIV32_16( PacketSize_ms, MAX_FRAME_LENGTH_MS );
             psEnc->sCmn.nb_subfr = MAX_NB_SUBFR;
-            psEnc->sPred.pitch_LPC_win_length = SKP_SMULBB( FIND_PITCH_LPC_WIN_MS, fs_kHz );
+            psEnc->sCmn.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 {
@@ -206,24 +206,14 @@ SKP_INLINE SKP_int SKP_Silk_setup_fs(
     /* 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_FLP ) );
-        SKP_memset( &psEnc->sPrefilt,        0, sizeof( SKP_Silk_prefilter_state_FLP ) );
-        SKP_memset( &psEnc->sCmn.sNSQ,       0, sizeof( SKP_Silk_nsq_state ) );
-        SKP_memset( &psEnc->sPred,           0, sizeof( SKP_Silk_predict_state_FLP ) );
-        SKP_memset( psEnc->sPred.prev_NLSFq, 0, sizeof( psEnc->sPred.prev_NLSFq ) );
-#if SWITCH_TRANSITION_FILTERING
-        SKP_memset( psEnc->sCmn.sLP.In_LP_State, 0, sizeof( psEnc->sCmn.sLP.In_LP_State ) );
-        if( psEnc->sCmn.sLP.mode == 1 ) {
-            /* Begin transition phase */
-            psEnc->sCmn.sLP.transition_frame_no = 1;
-        } else {
-            /* End transition phase */
-            psEnc->sCmn.sLP.transition_frame_no = 0;
-        }
-#endif
-        psEnc->sCmn.inputBufIx          = 0;
-        psEnc->sCmn.nFramesAnalyzed     = 0;
-        psEnc->sCmn.TargetRate_bps      = 0; /* Ensures that psEnc->SNR_dB is recomputed */
+        SKP_memset( &psEnc->sShape,               0, sizeof( SKP_Silk_shape_state_FLP ) );
+        SKP_memset( &psEnc->sPrefilt,             0, sizeof( SKP_Silk_prefilter_state_FLP ) );
+        SKP_memset( &psEnc->sCmn.sNSQ,            0, sizeof( SKP_Silk_nsq_state ) );
+        SKP_memset( psEnc->sCmn.prev_NLSFq_Q15,   0, sizeof( psEnc->sCmn.prev_NLSFq_Q15 ) );
+        SKP_memset( &psEnc->sCmn.sLP.In_LP_State, 0, sizeof( psEnc->sCmn.sLP.In_LP_State ) );
+        psEnc->sCmn.inputBufIx                  = 0;
+        psEnc->sCmn.nFramesAnalyzed             = 0;
+        psEnc->sCmn.TargetRate_bps              = 0; /* Ensures that psEnc->SNR_dB is recomputed */
 
         /* Initialize non-zero parameters */
         psEnc->sCmn.prevLag                     = 100;
@@ -263,30 +253,23 @@ SKP_INLINE SKP_int SKP_Silk_setup_fs(
         psEnc->sCmn.frame_length   = psEnc->sCmn.subfr_length * psEnc->sCmn.nb_subfr;
         psEnc->sCmn.ltp_mem_length = LTP_MEM_LENGTH_MS * fs_kHz; 
         psEnc->sCmn.la_pitch       = LA_PITCH_MS * fs_kHz;
-        psEnc->sPred.min_pitch_lag =  3 * fs_kHz;
-        psEnc->sPred.max_pitch_lag = 18 * fs_kHz;
+        psEnc->sCmn.max_pitch_lag = 18 * fs_kHz;
         if( psEnc->sCmn.nb_subfr == MAX_NB_SUBFR ){
-            psEnc->sPred.pitch_LPC_win_length = SKP_SMULBB( FIND_PITCH_LPC_WIN_MS, fs_kHz );
+            psEnc->sCmn.pitch_LPC_win_length = SKP_SMULBB( FIND_PITCH_LPC_WIN_MS, fs_kHz );
         } else if( psEnc->sCmn.nb_subfr == MAX_NB_SUBFR / 2 ){
-            psEnc->sPred.pitch_LPC_win_length = SKP_SMULBB( FIND_PITCH_LPC_WIN_MS_2_SF, fs_kHz );
+            psEnc->sCmn.pitch_LPC_win_length = SKP_SMULBB( FIND_PITCH_LPC_WIN_MS_2_SF, fs_kHz );
         } else {
             /* Unsupported number of frames */
             SKP_assert( 0 );
         }
         if( psEnc->sCmn.fs_kHz == 16 ) {
             psEnc->sCmn.mu_LTP_Q9 = SKP_FIX_CONST( MU_LTP_QUANT_WB, 9 );
-            psEnc->sCmn.bitrate_threshold_up    = SKP_int32_MAX;
-            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_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_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;
         } else {
             /* unsupported sampling rate */
diff --git a/src_FLP/SKP_Silk_encode_frame_FLP.c b/src_FLP/SKP_Silk_encode_frame_FLP.c
index eb3eac96be1631fce4b0e07e516cddbdb2607773..5d4d269ffeadb7c0b0f5c8371003aaefff3fb00d 100644
--- a/src_FLP/SKP_Silk_encode_frame_FLP.c
+++ b/src_FLP/SKP_Silk_encode_frame_FLP.c
@@ -78,13 +78,13 @@ TIC(ENCODE_FRAME)
     /* Voice Activity Detection */
     /****************************/
 TIC(VAD)
-    SKP_Silk_VAD_FLP( psEnc, &sEncCtrl, psEnc->sCmn.inputBuf );
+    ret = SKP_Silk_VAD_GetSA_Q8( &psEnc->sCmn, psEnc->sCmn.inputBuf );
 TOC(VAD)
 
     /**************************************************/
     /* Convert speech activity into VAD and DTX flags */
     /**************************************************/
-    if( psEnc->speech_activity < SPEECH_ACTIVITY_DTX_THRES ) {
+    if( psEnc->sCmn.speech_activity_Q8 < SKP_FIX_CONST( SPEECH_ACTIVITY_DTX_THRES, 8 ) ) {
         psEnc->sCmn.indices.signalType = TYPE_NO_VOICE_ACTIVITY;
         psEnc->sCmn.noSpeechCounter++;
         if( psEnc->sCmn.noSpeechCounter > NO_SPEECH_FRAMES_BEFORE_DTX ) {
@@ -98,7 +98,7 @@ TOC(VAD)
     } else {
         psEnc->sCmn.noSpeechCounter = 0;
         psEnc->sCmn.inDTX           = 0;
-        psEnc->sCmn.indices.signalType       = TYPE_UNVOICED;
+        psEnc->sCmn.indices.signalType = TYPE_UNVOICED;
         psEnc->sCmn.VAD_flags[ psEnc->sCmn.nFramesAnalyzed ] = 1;
     }
 
@@ -108,7 +108,7 @@ TOC(VAD)
 TIC(HP_IN)
 #if HIGH_PASS_INPUT
     /* Variable high-pass filter */
-    SKP_Silk_HP_variable_cutoff_FLP( psEnc, &sEncCtrl, pIn_HP, psEnc->sCmn.inputBuf );
+    SKP_Silk_HP_variable_cutoff( &psEnc->sCmn, pIn_HP, psEnc->sCmn.inputBuf, psEnc->sCmn.frame_length );
 #else
     SKP_memcpy( pIn_HP, psEnc->sCmn.inputBuf, psEnc->sCmn.frame_length * sizeof( SKP_int16 ) );
 #endif
@@ -247,7 +247,6 @@ TOC(ENCODE_FRAME)
     //DEBUG_STORE_DATA( xfw.dat,                  xfw,                                 psEnc->sCmn.frame_length * sizeof( SKP_float ) );
     DEBUG_STORE_DATA( pitchL.dat,               sEncCtrl.pitchL,                                 MAX_NB_SUBFR * sizeof( SKP_int   ) );
     DEBUG_STORE_DATA( pitchG_quantized.dat,     sEncCtrl.LTPCoef,            psEnc->sCmn.nb_subfr * LTP_ORDER * sizeof( SKP_float ) );
-    DEBUG_STORE_DATA( pitch_freq_low_Hz.dat,    &sEncCtrl.pitch_freq_low_Hz,                                    sizeof( SKP_float ) );
     DEBUG_STORE_DATA( LTPcorr.dat,              &psEnc->LTPCorr,                                                sizeof( SKP_float ) );
     DEBUG_STORE_DATA( tilt.dat,                 &sEncCtrl.input_tilt,                                           sizeof( SKP_float ) );
     DEBUG_STORE_DATA( gains.dat,                sEncCtrl.Gains,                          psEnc->sCmn.nb_subfr * sizeof( SKP_float ) );
@@ -255,7 +254,7 @@ TOC(ENCODE_FRAME)
     DEBUG_STORE_DATA( nBits.dat,                &nBits,                                                         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( speech_activity.dat,      &psEnc->speech_activity,                                        sizeof( SKP_float ) );
+    DEBUG_STORE_DATA( speech_activity_q8.dat,   &psEnc->speech_activity_Q8,                                     sizeof( SKP_in    ) );
     DEBUG_STORE_DATA( input_quality_bands.dat,  sEncCtrl.input_quality_bands,                     VAD_N_BANDS * sizeof( SKP_float ) );
     DEBUG_STORE_DATA( signalType.dat,           &sEncCtrl.sCmn.signalType,                                      sizeof( SKP_int   ) ); 
     DEBUG_STORE_DATA( ratelevel.dat,            &sEncCtrl.sCmn.RateLevelIndex,                                  sizeof( SKP_int   ) ); 
@@ -285,7 +284,7 @@ void SKP_Silk_LBRR_encode_FLP(
     /*******************************************/
     /* Control use of inband LBRR              */
     /*******************************************/
-    if( psEnc->sCmn.LBRR_enabled && psEnc->speech_activity > LBRR_SPEECH_ACTIVITY_THRES ) {
+    if( psEnc->sCmn.LBRR_enabled && psEnc->sCmn.speech_activity_Q8 > SKP_FIX_CONST( LBRR_SPEECH_ACTIVITY_THRES, 8 ) ) {
         psEnc->sCmn.LBRR_flags[ psEnc->sCmn.nFramesAnalyzed ] = 1;
 
         /* Copy noise shaping quantizer state and quantization indices from regular encoding */
diff --git a/src_FLP/SKP_Silk_find_LPC_FLP.c b/src_FLP/SKP_Silk_find_LPC_FLP.c
index 8f6be16ac4b08b35861af17141d147ae39043d3c..a3215cf3ab848274dea9683ab85d606bbb7ad704 100644
--- a/src_FLP/SKP_Silk_find_LPC_FLP.c
+++ b/src_FLP/SKP_Silk_find_LPC_FLP.c
@@ -29,9 +29,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include "SKP_Silk_tuning_parameters.h"
 
 void SKP_Silk_find_LPC_FLP(
-          SKP_float                 NLSF[],             /* O    NLSFs                                   */
+          SKP_int                   NLSF_Q15[],         /* O    NLSFs                                   */
           SKP_int8                  *interpIndex,       /* O    NLSF interp. index for NLSF interp.     */
-    const SKP_float                 prev_NLSFq[],       /* I    Previous NLSFs, for NLSF interpolation  */
+    const SKP_int                   prev_NLSFq_Q15[],   /* I    Previous NLSFs, for NLSF interpolation  */
     const SKP_int                   useInterpNLSFs,     /* I    Flag                                    */
     const SKP_int                   LPC_order,          /* I    LPC order                               */
     const SKP_float                 x[],                /* I    Input signal                            */
@@ -44,7 +44,8 @@ void SKP_Silk_find_LPC_FLP(
 
     /* Used only for NLSF interpolation */
     double      res_nrg, res_nrg_2nd, res_nrg_interp;
-    SKP_float   a_tmp[ MAX_LPC_ORDER ], NLSF0[ MAX_LPC_ORDER ];
+    SKP_int     NLSF0_Q15[ MAX_LPC_ORDER ];
+    SKP_float   a_tmp[ MAX_LPC_ORDER ];
     SKP_float   LPC_res[ ( MAX_FRAME_LENGTH + MAX_NB_SUBFR * MAX_LPC_ORDER ) / 2 ];
 
     /* Default: No interpolation */
@@ -61,16 +62,16 @@ void SKP_Silk_find_LPC_FLP(
         SKP_Silk_bwexpander_FLP( a_tmp, LPC_order, FIND_LPC_CHIRP );
 
         /* Convert to NLSFs */
-        SKP_Silk_A2NLSF_FLP( NLSF, a_tmp, LPC_order );
+        SKP_Silk_A2NLSF_FLP( NLSF_Q15, a_tmp, LPC_order );
 
         /* Search over interpolation indices to find the one with lowest residual energy */
         res_nrg_2nd = SKP_float_MAX;
         for( k = 3; k >= 0; k-- ) {
             /* Interpolate NLSFs for first half */
-            SKP_Silk_interpolate_wrapper_FLP( NLSF0, prev_NLSFq, NLSF, 0.25f * k, LPC_order );
+            SKP_Silk_interpolate( NLSF0_Q15, prev_NLSFq_Q15, NLSF_Q15, k, LPC_order );
 
             /* Convert to LPC for residual energy evaluation */
-            SKP_Silk_NLSF2A_stable_FLP( a_tmp, NLSF0, LPC_order );
+            SKP_Silk_NLSF2A_stable_FLP( a_tmp, NLSF0_Q15, LPC_order );
 
             /* Calculate residual energy with LSF interpolation */
             SKP_Silk_LPC_analysis_filter_FLP( LPC_res, a_tmp, x, 2 * subfr_length, LPC_order );
@@ -93,7 +94,7 @@ void SKP_Silk_find_LPC_FLP(
 
     if( *interpIndex == 4 ) {
         /* NLSF interpolation is currently inactive, calculate NLSFs from full frame AR coefficients */
-        SKP_Silk_A2NLSF_FLP( NLSF, a, LPC_order );
+        SKP_Silk_A2NLSF_FLP( NLSF_Q15, a, LPC_order );
     }
 
 }
diff --git a/src_FLP/SKP_Silk_find_pitch_lags_FLP.c b/src_FLP/SKP_Silk_find_pitch_lags_FLP.c
index f35899d5a606ec4e7661140b081cb17fff782be8..c8de0e26b6f9cfc9f67a24b49c5665212e7fd671 100644
--- a/src_FLP/SKP_Silk_find_pitch_lags_FLP.c
+++ b/src_FLP/SKP_Silk_find_pitch_lags_FLP.c
@@ -36,7 +36,6 @@ void SKP_Silk_find_pitch_lags_FLP(
     const SKP_float                 x[]                 /* I    Speech signal                           */
 )
 {
-    SKP_Silk_predict_state_FLP *psPredSt = &psEnc->sPred;
     SKP_int   buf_len;
     SKP_float thrhld, res_nrg;
     const SKP_float *x_buf_ptr, *x_buf;
@@ -52,7 +51,7 @@ void SKP_Silk_find_pitch_lags_FLP(
     buf_len = psEnc->sCmn.la_pitch + psEnc->sCmn.frame_length + psEnc->sCmn.ltp_mem_length;
 
     /* Safty check */
-    SKP_assert( buf_len >= psPredSt->pitch_LPC_win_length );
+    SKP_assert( buf_len >= psEnc->sCmn.pitch_LPC_win_length );
 
     x_buf = x - psEnc->sCmn.ltp_mem_length;
 
@@ -63,22 +62,22 @@ void SKP_Silk_find_pitch_lags_FLP(
     /* Calculate windowed signal */
     
     /* First LA_LTP samples */
-    x_buf_ptr = x_buf + buf_len - psPredSt->pitch_LPC_win_length;
+    x_buf_ptr = x_buf + buf_len - psEnc->sCmn.pitch_LPC_win_length;
     Wsig_ptr  = Wsig;
     SKP_Silk_apply_sine_window_FLP( Wsig_ptr, x_buf_ptr, 1, psEnc->sCmn.la_pitch );
 
     /* Middle non-windowed samples */
     Wsig_ptr  += psEnc->sCmn.la_pitch;
     x_buf_ptr += psEnc->sCmn.la_pitch;
-    SKP_memcpy( Wsig_ptr, x_buf_ptr, ( psPredSt->pitch_LPC_win_length - ( psEnc->sCmn.la_pitch << 1 ) ) * sizeof( SKP_float ) );
+    SKP_memcpy( Wsig_ptr, x_buf_ptr, ( psEnc->sCmn.pitch_LPC_win_length - ( psEnc->sCmn.la_pitch << 1 ) ) * sizeof( SKP_float ) );
 
     /* Last LA_LTP samples */
-    Wsig_ptr  += psPredSt->pitch_LPC_win_length - ( psEnc->sCmn.la_pitch << 1 );
-    x_buf_ptr += psPredSt->pitch_LPC_win_length - ( psEnc->sCmn.la_pitch << 1 );
+    Wsig_ptr  += psEnc->sCmn.pitch_LPC_win_length - ( psEnc->sCmn.la_pitch << 1 );
+    x_buf_ptr += psEnc->sCmn.pitch_LPC_win_length - ( psEnc->sCmn.la_pitch << 1 );
     SKP_Silk_apply_sine_window_FLP( Wsig_ptr, x_buf_ptr, 2, psEnc->sCmn.la_pitch );
 
     /* Calculate autocorrelation sequence */
-    SKP_Silk_autocorrelation_FLP( auto_corr, Wsig, psPredSt->pitch_LPC_win_length, psEnc->sCmn.pitchEstimationLPCOrder + 1 );
+    SKP_Silk_autocorrelation_FLP( auto_corr, Wsig, psEnc->sCmn.pitch_LPC_win_length, psEnc->sCmn.pitchEstimationLPCOrder + 1 );
 
     /* Add white noise, as a fraction of the energy */
     auto_corr[ 0 ] += auto_corr[ 0 ] * FIND_PITCH_WHITE_NOISE_FRACTION + 1;
@@ -100,13 +99,13 @@ void SKP_Silk_find_pitch_lags_FLP(
     /*****************************************/
     SKP_Silk_LPC_analysis_filter_FLP( res, A, x_buf, buf_len, psEnc->sCmn.pitchEstimationLPCOrder );
 
-    if( psEnc->sCmn.indices.signalType != TYPE_NO_VOICE_ACTIVITY ) {
+    if( psEnc->sCmn.indices.signalType != TYPE_NO_VOICE_ACTIVITY && psEnc->sCmn.first_frame_after_reset == 0 ) {
         /* Threshold for pitch estimator */
         thrhld  = 0.6f;
         thrhld -= 0.004f * psEnc->sCmn.pitchEstimationLPCOrder;
-        thrhld -= 0.1f   * psEnc->speech_activity;
+        thrhld -= 0.1f   * psEnc->sCmn.speech_activity_Q8 * ( 1.0f /  256.0f );
         thrhld -= 0.15f  * (psEnc->sCmn.prevSignalType >> 1);
-        thrhld -= 0.1f   * psEncCtrl->input_tilt;
+        thrhld -= 0.1f   * psEnc->sCmn.input_tilt_Q15 * ( 1.0f / 32768.0f );
 
         /*****************************************/
         /* Call Pitch estimator                  */
diff --git a/src_FLP/SKP_Silk_find_pred_coefs_FLP.c b/src_FLP/SKP_Silk_find_pred_coefs_FLP.c
index 5ef9a216c13732bc820cbf732790c7f65cf2090a..761ec5cf88d91dea3a1e35f1dc752219e2a88bed 100644
--- a/src_FLP/SKP_Silk_find_pred_coefs_FLP.c
+++ b/src_FLP/SKP_Silk_find_pred_coefs_FLP.c
@@ -38,7 +38,7 @@ void SKP_Silk_find_pred_coefs_FLP(
     SKP_int         i;
     SKP_float       WLTP[ MAX_NB_SUBFR * LTP_ORDER * LTP_ORDER ];
     SKP_float       invGains[ MAX_NB_SUBFR ], Wght[ MAX_NB_SUBFR ];
-    SKP_float       NLSF[ MAX_LPC_ORDER ];
+    SKP_int         NLSF_Q15[ MAX_LPC_ORDER ];
     const SKP_float *x_ptr;
     SKP_float       *x_pre_ptr, LPC_in_pre[ MAX_NB_SUBFR * MAX_LPC_ORDER + MAX_FRAME_LENGTH ];
 
@@ -94,14 +94,14 @@ void SKP_Silk_find_pred_coefs_FLP(
     }
 
     /* LPC_in_pre contains the LTP-filtered input for voiced, and the unfiltered input for unvoiced */
-    SKP_Silk_find_LPC_FLP( NLSF, &psEnc->sCmn.indices.NLSFInterpCoef_Q2, psEnc->sPred.prev_NLSFq, 
+    SKP_Silk_find_LPC_FLP( NLSF_Q15, &psEnc->sCmn.indices.NLSFInterpCoef_Q2, psEnc->sCmn.prev_NLSFq_Q15, 
         psEnc->sCmn.useInterpolatedNLSFs * ( 1 - psEnc->sCmn.first_frame_after_reset ), psEnc->sCmn.predictLPCOrder, 
         LPC_in_pre, psEnc->sCmn.subfr_length + psEnc->sCmn.predictLPCOrder, psEnc->sCmn.nb_subfr );
 
 
     /* Quantize LSFs */
 TIC(LSF_quant);
-    SKP_Silk_process_NLSFs_FLP( psEnc, psEncCtrl, NLSF );
+    SKP_Silk_process_NLSFs_FLP( &psEnc->sCmn, psEncCtrl->PredCoef, NLSF_Q15, psEnc->sCmn.prev_NLSFq_Q15 );
 TOC(LSF_quant);
 
     /* Calculate residual energy using quantized LPC coefficients */
@@ -109,6 +109,6 @@ TOC(LSF_quant);
         psEnc->sCmn.subfr_length, psEnc->sCmn.nb_subfr, psEnc->sCmn.predictLPCOrder );
 
     /* Copy to prediction struct for use in next frame for fluctuation reduction */
-    SKP_memcpy( psEnc->sPred.prev_NLSFq, NLSF, psEnc->sCmn.predictLPCOrder * sizeof( SKP_float ) );
+    SKP_memcpy( psEnc->sCmn.prev_NLSFq_Q15, NLSF_Q15, sizeof( psEnc->sCmn.prev_NLSFq_Q15 ) );
 }
 
diff --git a/src_FLP/SKP_Silk_init_encoder_FLP.c b/src_FLP/SKP_Silk_init_encoder_FLP.c
index 4b9ffdffa35f6ff8b39f40ad363da39cf623e0bf..e3eb1875878ea26b7132c67f0319e4759960cef3 100644
--- a/src_FLP/SKP_Silk_init_encoder_FLP.c
+++ b/src_FLP/SKP_Silk_init_encoder_FLP.c
@@ -40,8 +40,8 @@ SKP_int SKP_Silk_init_encoder_FLP(
     SKP_memset( psEnc, 0, sizeof( SKP_Silk_encoder_state_FLP ) );
 
 #if HIGH_PASS_INPUT
-    psEnc->variable_HP_smth1 = SKP_Silk_log2( 70.0 );
-    psEnc->variable_HP_smth2 = SKP_Silk_log2( 70.0 );
+    psEnc->sCmn.variable_HP_smth1_Q15 = 200844; /* = SKP_Silk_log2(70)_Q0; */
+    psEnc->sCmn.variable_HP_smth2_Q15 = 200844; /* = SKP_Silk_log2(70)_Q0; */
 #endif
 
     /* Used to deactivate e.g. LSF interpolation and fluctuation reduction */
diff --git a/src_FLP/SKP_Silk_main_FLP.h b/src_FLP/SKP_Silk_main_FLP.h
index d406421724cdb5fe34e87f882846f19c9e8dff1b..cbf2077bf1948a6a56052ca889aed3c064a67595 100644
--- a/src_FLP/SKP_Silk_main_FLP.h
+++ b/src_FLP/SKP_Silk_main_FLP.h
@@ -48,14 +48,6 @@ extern "C"
 /* Encoder Functions */
 /*********************/
 
-/* High-pass filter with cutoff frequency adaptation based on pitch lag statistics */
-void SKP_Silk_HP_variable_cutoff_FLP(
-    SKP_Silk_encoder_state_FLP      *psEnc,             /* I/O  Encoder state FLP                       */
-    SKP_Silk_encoder_control_FLP    *psEncCtrl,         /* I/O  Encoder control FLP                     */
-          SKP_int16                 *out,               /* O    High-pass filtered output signal        */
-    const SKP_int16                 *in                 /* I    Input signal                            */
-);
-
 /* Encoder main function */
 SKP_int SKP_Silk_encode_frame_FLP( 
     SKP_Silk_encoder_state_FLP      *psEnc,             /* I/O  Encoder state FLP                       */
@@ -141,9 +133,9 @@ void SKP_Silk_find_pred_coefs_FLP(
 
 /* LPC analysis */
 void SKP_Silk_find_LPC_FLP(
-          SKP_float                 NLSF[],             /* O    NLSFs                                   */
+          SKP_int                   NLSF_Q15[],         /* O    NLSFs                                   */
           SKP_int8                  *interpIndex,       /* O    NLSF interp. index for NLSF interp.     */
-    const SKP_float                 prev_NLSFq[],       /* I    Previous NLSFs, for NLSF interpolation  */
+    const SKP_int                   prev_NLSFq_Q15[],   /* I    Previous NLSFs, for NLSF interpolation  */
     const SKP_int                   useInterpNLSFs,     /* I    Flag                                    */
     const SKP_int                   LPC_order,          /* I    LPC order                               */
     const SKP_float                 x[],                /* I    Input signal                            */
@@ -212,54 +204,10 @@ void SKP_Silk_quant_LTP_gains_FLP(
 /******************/
 /* Limit, stabilize, and quantize NLSFs */
 void SKP_Silk_process_NLSFs_FLP(
-    SKP_Silk_encoder_state_FLP      *psEnc,             /* I/O  Encoder state FLP                       */
-    SKP_Silk_encoder_control_FLP    *psEncCtrl,         /* I/O  Encoder control FLP                     */
-    SKP_float                       *pNLSF              /* I/O  NLSFs (quantized output)                */
-);
-
-/* NLSF vector encoder */
-void SKP_Silk_NLSF_MSVQ_encode_FLP(
-          SKP_int8                  *NLSFIndices,       /* O    Codebook path vector [ CB_STAGES ]      */
-          SKP_float                 *pNLSF,             /* I/O  Quantized NLSF vector [ LPC_ORDER ]     */
-    const SKP_Silk_NLSF_CB_struct   *psNLSF_CB,         /* I    Codebook object                         */
-    const SKP_float                 *pNLSF_q_prev,      /* I    Prev. quantized NLSF vector [LPC_ORDER] */
-    const SKP_float                 *pW,                /* I    NLSF weight vector [ LPC_ORDER ]        */
-    const SKP_float                 NLSF_mu,            /* I    Rate weight for the RD optimization     */
-    const SKP_float                 NLSF_mu_fluc_red,   /* I    Fluctuation reduction error weight      */
-    const SKP_int                   NLSF_MSVQ_Survivors,/* I    Max survivors from each stage           */
-    const SKP_int                   LPC_order,          /* I    LPC order                               */
-    const SKP_int                   deactivate_fluc_red /* I    Deactivate fluctuation reduction        */
-);
-
-/* Rate-Distortion calculations for multiple input data vectors */
-void SKP_Silk_NLSF_VQ_rate_distortion_FLP(
-          SKP_float             *pRD,               /* O   Rate-distortion values [psNLSF_CBS_FLP->nVectors*N] */
-    const SKP_Silk_NLSF_CBS     *psNLSF_CBS,        /* I   NLSF codebook stage struct                          */
-    const SKP_float             *in,                /* I   Input vectors to be quantized                       */
-    const SKP_float             *w,                 /* I   Weight vector                                       */
-    const SKP_float             *rate_acc,          /* I   Accumulated rates from previous stage               */
-    const SKP_float             mu,                 /* I   Weight between weighted error and rate              */
-    const SKP_int               N,                  /* I   Number of input vectors to be quantized             */
-    const SKP_int               LPC_order           /* I   LPC order                                           */
-);
-
-/* Compute weighted quantization errors for an LPC_order element input vector, over one codebook stage */
-void SKP_Silk_NLSF_VQ_sum_error_FLP(
-          SKP_float                 *err,               /* O    Weighted quantization errors [ N * K ]  */
-    const SKP_float                 *in,                /* I    Input vectors [ N * LPC_order ]         */
-    const SKP_float                 *w,                 /* I    Weighting vectors [ N * LPC_order ]     */
-    const SKP_int8                  *pCB_NLSF_Q8,       /* I    Codebook vectors [ K * LPC_order ]      */
-    const SKP_int                   N,                  /* I    Number of input vectors                 */
-    const SKP_int                   K,                  /* I    Number of codebook vectors              */
-    const SKP_int                   LPC_order           /* I    LPC order                               */
-);
-
-/* NLSF vector decoder */
-void SKP_Silk_NLSF_MSVQ_decode_FLP(
-          SKP_float                 *pNLSF,             /* O    Decoded output vector [ LPC_ORDER ]     */
-    const SKP_Silk_NLSF_CB_struct   *psNLSF_CB,         /* I    NLSF codebook struct                    */  
-    const SKP_int8                  *NLSFIndices,       /* I    NLSF indices [ nStages ]                */
-    const SKP_int                   LPC_order           /* I    LPC order used                          */
+    SKP_Silk_encoder_state          *psEncC,                            /* I/O  Encoder state                               */
+    SKP_float                       PredCoef[ 2 ][ MAX_LPC_ORDER ],     /* O    Prediction coefficients                     */
+    SKP_int                         NLSF_Q15[      MAX_LPC_ORDER ],     /* I/O  Normalized LSFs (quant out) (0 - (2^15-1))  */
+    const SKP_int                   prev_NLSF_Q15[ MAX_LPC_ORDER ]      /* I    Previous Normalized LSFs (0 - (2^15-1))     */
 );
 
 /* Residual energy: nrg = wxx - 2 * wXx * c + c' * wXX * c */
@@ -340,7 +288,7 @@ void SKP_Silk_apply_sine_window_FLP(
 
 /* Convert AR filter coefficients to NLSF parameters */
 void SKP_Silk_A2NLSF_FLP( 
-          SKP_float                 *pNLSF,             /* O    NLSF vector      [ LPC_order ]          */
+          SKP_int                   *NLSF_Q15,          /* O    NLSF vector      [ LPC_order ]          */
     const SKP_float                 *pAR,               /* I    LPC coefficients [ LPC_order ]          */
     const SKP_int                   LPC_order           /* I    LPC order                               */
 );
@@ -348,14 +296,7 @@ void SKP_Silk_A2NLSF_FLP(
 /* Convert NLSF parameters to AR prediction filter coefficients */
 void SKP_Silk_NLSF2A_stable_FLP( 
           SKP_float                 *pAR,               /* O    LPC coefficients [ LPC_order ]          */
-    const SKP_float                 *pNLSF,             /* I    NLSF vector      [ LPC_order ]          */
-    const SKP_int                   LPC_order           /* I    LPC order                               */
-);
-
-/* NLSF stabilizer, for a single input data vector */
-void SKP_Silk_NLSF_stabilize_FLP(
-          SKP_float                 *pNLSF,            /* I/O  (Un)stable NLSF vector [ LPC_order ]    */
-    const SKP_int                   *pNDelta_min_Q15,   /* I    Normalized delta min vector[LPC_order+1]*/
+    const SKP_int                   *NLSF_Q15,          /* I    NLSF vector      [ LPC_order ]          */
     const SKP_int                   LPC_order           /* I    LPC order                               */
 );
 
@@ -368,15 +309,6 @@ void SKP_Silk_interpolate_wrapper_FLP(
     const SKP_int                   d                   /* I    Number of parameters                    */
 );
 
-/****************************************/
-/* Floating-point Silk VAD wrapper      */
-/****************************************/
-SKP_int SKP_Silk_VAD_FLP(
-    SKP_Silk_encoder_state_FLP      *psEnc,             /* I/O  Encoder state FLP                       */
-    SKP_Silk_encoder_control_FLP    *psEncCtrl,         /* I/O  Encoder control FLP                     */
-    const SKP_int16                 *pIn                /* I    Input signal                            */
-);
-
 /****************************************/
 /* Floating-point Silk NSQ wrapper      */
 /****************************************/
diff --git a/src_FLP/SKP_Silk_noise_shape_analysis_FLP.c b/src_FLP/SKP_Silk_noise_shape_analysis_FLP.c
index 17a991e6f8e81f59c10c9cce44633be1a56652c1..001c3ac5c570116a807c19b41760eae0c8896cb1 100644
--- a/src_FLP/SKP_Silk_noise_shape_analysis_FLP.c
+++ b/src_FLP/SKP_Silk_noise_shape_analysis_FLP.c
@@ -151,7 +151,7 @@ void SKP_Silk_noise_shape_analysis_FLP(
     /* GAIN CONTROL */
     /****************/
     /* Input quality is the average of the quality in the lowest two VAD bands */
-    psEncCtrl->input_quality = 0.5f * ( psEncCtrl->input_quality_bands[ 0 ] + psEncCtrl->input_quality_bands[ 1 ] );
+    psEncCtrl->input_quality = 0.5f * ( psEnc->sCmn.input_quality_bands_Q15[ 0 ] + psEnc->sCmn.input_quality_bands_Q15[ 1 ] ) * ( 1.0f / 32768.0f );
 
     /* Coding quality level, between 0.0 and 1.0 */
     psEncCtrl->coding_quality = SKP_sigmoid( 0.25f * ( psEncCtrl->current_SNR_dB - 18.0f ) );
@@ -159,7 +159,7 @@ void SKP_Silk_noise_shape_analysis_FLP(
     SNR_adj_dB = psEncCtrl->current_SNR_dB;
     if( psEnc->sCmn.useCBR == 0 ) {
         /* Reduce coding SNR during low speech activity */
-        b = 1.0f - psEnc->speech_activity;
+        b = 1.0f - psEnc->sCmn.speech_activity_Q8 * ( 1.0f /  256.0f );
         SNR_adj_dB -= BG_SNR_DECR_dB * psEncCtrl->coding_quality * ( 0.5f + 0.5f * psEncCtrl->input_quality ) * b * b;
     }
 
@@ -307,8 +307,8 @@ void SKP_Silk_noise_shape_analysis_FLP(
     /* Control low-frequency shaping and noise tilt */
     /************************************************/
     /* 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;
+    strength = LOW_FREQ_SHAPING * ( 1.0f + LOW_QUALITY_LOW_FREQ_SHAPING_DECR * ( psEnc->sCmn.input_quality_bands_Q15[ 0 ] * ( 1.0f / 32768.0f ) - 1.0f ) );
+    strength *= psEnc->sCmn.speech_activity_Q8 * ( 1.0f /  256.0f );
     if( psEnc->sCmn.indices.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])*/
@@ -318,7 +318,7 @@ void SKP_Silk_noise_shape_analysis_FLP(
             psEncCtrl->LF_AR_shp[ k ] =  1.0f - b - b * strength;
         }
         Tilt = - HP_NOISE_COEF - 
-            (1 - HP_NOISE_COEF) * HARM_HP_NOISE_COEF * psEnc->speech_activity;
+            (1 - HP_NOISE_COEF) * HARM_HP_NOISE_COEF * psEnc->sCmn.speech_activity_Q8 * ( 1.0f /  256.0f );
     } else {
         b = 1.3f / psEnc->sCmn.fs_kHz;
         psEncCtrl->LF_MA_shp[ 0 ] = -1.0f + b;
diff --git a/src_FLP/SKP_Silk_process_NLSFs_FLP.c b/src_FLP/SKP_Silk_process_NLSFs_FLP.c
deleted file mode 100644
index 0f13a47d601a1986c88357b072837a61fafa1733..0000000000000000000000000000000000000000
--- a/src_FLP/SKP_Silk_process_NLSFs_FLP.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/***********************************************************************
-Copyright (c) 2006-2011, 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 <stdlib.h>
-#include "SKP_Silk_main_FLP.h"
-
-/* Limit, stabilize, convert and quantize NLSFs */
-void SKP_Silk_process_NLSFs_FLP(
-    SKP_Silk_encoder_state_FLP      *psEnc,             /* I/O  Encoder state FLP                       */
-    SKP_Silk_encoder_control_FLP    *psEncCtrl,         /* I/O  Encoder control FLP                     */
-    SKP_float                       *pNLSF              /* I/O  NLSFs (quantized output)                */
-)
-{
-    SKP_int     doInterpolate;
-    SKP_float   pNLSFW[ MAX_LPC_ORDER ];
-    SKP_float   NLSF_mu, NLSF_mu_fluc_red, i_sqr, NLSF_interpolation_factor = 0.0f;
-    const SKP_Silk_NLSF_CB_struct *psNLSF_CB;
-
-    /* Used only for NLSF interpolation */
-    SKP_float   pNLSF0_temp[  MAX_LPC_ORDER ];
-    SKP_float   pNLSFW0_temp[ MAX_LPC_ORDER ];
-    SKP_int     i;
-
-    /***********************/
-    /* Calculate mu values */
-    /***********************/
-    if( psEnc->sCmn.indices.signalType == TYPE_VOICED ) {
-        NLSF_mu          = 0.002f - 0.001f * psEnc->speech_activity;
-        NLSF_mu_fluc_red = 0.1f   - 0.05f  * psEnc->speech_activity;
-    } else { 
-        NLSF_mu          = 0.005f - 0.004f * psEnc->speech_activity;
-        NLSF_mu_fluc_red = 0.2f   - 0.1f   * ( psEnc->speech_activity + psEncCtrl->sparseness );
-    }
-
-    /* Calculate NLSF weights */
-    SKP_Silk_NLSF_VQ_weights_laroia_FLP( pNLSFW, pNLSF, psEnc->sCmn.predictLPCOrder );
-
-    /* Update NLSF weights for interpolated NLSFs */
-    doInterpolate = ( psEnc->sCmn.useInterpolatedNLSFs == 1 ) && ( psEnc->sCmn.indices.NLSFInterpCoef_Q2 < ( 1 << 2 ) );
-    if( doInterpolate ) {
-
-        /* Calculate the interpolated NLSF vector for the first half */
-        NLSF_interpolation_factor = 0.25f * psEnc->sCmn.indices.NLSFInterpCoef_Q2;
-        SKP_Silk_interpolate_wrapper_FLP( pNLSF0_temp, psEnc->sPred.prev_NLSFq, pNLSF, 
-            NLSF_interpolation_factor, psEnc->sCmn.predictLPCOrder );
-
-        /* Calculate first half NLSF weights for the interpolated NLSFs */
-        SKP_Silk_NLSF_VQ_weights_laroia_FLP( pNLSFW0_temp, pNLSF0_temp, psEnc->sCmn.predictLPCOrder );
-
-        /* Update NLSF weights with contribution from first half */
-        i_sqr = NLSF_interpolation_factor * NLSF_interpolation_factor;
-        for( i = 0; i < psEnc->sCmn.predictLPCOrder; i++ ) {
-            pNLSFW[ i ] = 0.5f * ( pNLSFW[ i ] + i_sqr * pNLSFW0_temp[ i ] );
-        }
-    }
-
-    /* Set pointer to the NLSF codebook for the current signal type and LPC order */
-    psNLSF_CB = psEnc->sCmn.psNLSF_CB[ 1 - ( psEnc->sCmn.indices.signalType >> 1 ) ];
-
-    /* Quantize NLSF parameters given the trained NLSF codebooks */
-    SKP_Silk_NLSF_MSVQ_encode_FLP( psEnc->sCmn.indices.NLSFIndices, pNLSF, psNLSF_CB, psEnc->sPred.prev_NLSFq, pNLSFW, NLSF_mu, 
-        NLSF_mu_fluc_red, psEnc->sCmn.NLSF_MSVQ_Survivors, psEnc->sCmn.predictLPCOrder, psEnc->sCmn.first_frame_after_reset );
-
-    /* Convert quantized NLSFs back to LPC coefficients */
-    SKP_Silk_NLSF2A_stable_FLP( psEncCtrl->PredCoef[ 1 ], pNLSF, psEnc->sCmn.predictLPCOrder );
-
-    if( doInterpolate ) {
-        /* Calculate the interpolated, quantized NLSF vector for the first half */
-        SKP_Silk_interpolate_wrapper_FLP( pNLSF0_temp, psEnc->sPred.prev_NLSFq, pNLSF, 
-            NLSF_interpolation_factor, psEnc->sCmn.predictLPCOrder );
-
-        /* Convert back to LPC coefficients */
-        SKP_Silk_NLSF2A_stable_FLP( psEncCtrl->PredCoef[ 0 ], pNLSF0_temp, psEnc->sCmn.predictLPCOrder );
-
-    } else {
-        /* Copy LPC coefficients for first half from second half */
-        SKP_memcpy( psEncCtrl->PredCoef[ 0 ], psEncCtrl->PredCoef[ 1 ], psEnc->sCmn.predictLPCOrder * sizeof( SKP_float ) );
-    }
-}
-
diff --git a/src_FLP/SKP_Silk_process_gains_FLP.c b/src_FLP/SKP_Silk_process_gains_FLP.c
index 9a0d46276aa12a189bc20f48d2d6a2666eaedd98..7090933c179191634fe98033bdf2dfaf6c08914c 100644
--- a/src_FLP/SKP_Silk_process_gains_FLP.c
+++ b/src_FLP/SKP_Silk_process_gains_FLP.c
@@ -73,7 +73,7 @@ void SKP_Silk_process_gains_FLP(
 
     /* Set quantizer offset for voiced signals. Larger offset when LTP coding gain is low or tilt is high (ie low-pass) */
     if( psEnc->sCmn.indices.signalType == TYPE_VOICED ) {
-        if( psEncCtrl->LTPredCodGain + psEncCtrl->input_tilt > 1.0f ) {
+        if( psEncCtrl->LTPredCodGain + psEnc->sCmn.input_tilt_Q15 * ( 1.0f / 32768.0f ) > 1.0f ) {
             psEnc->sCmn.indices.quantOffsetType = 0;
         } else {
             psEnc->sCmn.indices.quantOffsetType = 1;
@@ -84,7 +84,7 @@ void SKP_Silk_process_gains_FLP(
     quant_offset = SKP_Silk_Quantization_Offsets_Q10[ psEnc->sCmn.indices.signalType >> 1 ][ psEnc->sCmn.indices.quantOffsetType ] / 1024.0f;
     psEncCtrl->Lambda = LAMBDA_OFFSET 
                       + LAMBDA_DELAYED_DECISIONS * psEnc->sCmn.nStatesDelayedDecision
-                      + LAMBDA_SPEECH_ACT        * psEnc->speech_activity 
+                      + LAMBDA_SPEECH_ACT        * psEnc->sCmn.speech_activity_Q8 * ( 1.0f /  256.0f ) 
                       + LAMBDA_INPUT_QUALITY     * psEncCtrl->input_quality   
                       + LAMBDA_CODING_QUALITY    * psEncCtrl->coding_quality
                       + LAMBDA_QUANT_OFFSET      * quant_offset;
diff --git a/src_FLP/SKP_Silk_structs_FLP.h b/src_FLP/SKP_Silk_structs_FLP.h
index 5a950e0caa360799edf2c5103e4fe4867857f01e..8dbf7345e16b0b92d9bad665fc8eee7d03b08bbc 100644
--- a/src_FLP/SKP_Silk_structs_FLP.h
+++ b/src_FLP/SKP_Silk_structs_FLP.h
@@ -60,35 +60,19 @@ typedef struct {
     SKP_int     lagPrev;
 } SKP_Silk_prefilter_state_FLP;
 
-/*****************************/
-/* Prediction analysis state */
-/*****************************/
-typedef struct {
-    SKP_int     pitch_LPC_win_length;
-    SKP_int     min_pitch_lag;                      /* Lowest possible pitch lag (samples)  */
-    SKP_int     max_pitch_lag;                      /* Highest possible pitch lag (samples) */
-    SKP_float   prev_NLSFq[ MAX_LPC_ORDER ];        /* Previously quantized NLSF vector     */
-} SKP_Silk_predict_state_FLP;
-
 /********************************/
 /* Encoder state FLP            */
 /********************************/
 typedef struct {
     SKP_Silk_encoder_state              sCmn;                       /* Common struct, shared with fixed-point code */
-
-    SKP_float                           variable_HP_smth1;          /* State of first smoother */
-    SKP_float                           variable_HP_smth2;          /* State of second smoother */
-
     SKP_Silk_shape_state_FLP            sShape;                     /* Noise shaping state */
     SKP_Silk_prefilter_state_FLP        sPrefilt;                   /* Prefilter State */
-    SKP_Silk_predict_state_FLP          sPred;                      /* Prediction State */
 
     /* Buffer for find pitch and noise shape analysis */
     SKP_float                           x_buf[ 2 * MAX_FRAME_LENGTH + LA_SHAPE_MAX ];/* Buffer for find pitch and noise shape analysis */
     SKP_float                           LTPCorr;                    /* Normalized correlation from pitch lag estimator */
     SKP_float                           SNR_dB;                     /* Quality setting */
     SKP_float                           BufferedInChannel_ms;       /* Simulated number of ms buffer in channel because of exceeded TargetRate_bps */
-    SKP_float                           speech_activity;            /* Speech activity */
 
     /* Parameters for LTP scaling control */
     SKP_float                           prevLTPredCodGain;
@@ -121,15 +105,12 @@ typedef struct {
 	SKP_float					Lambda;
 	SKP_float					input_quality;
 	SKP_float					coding_quality;
-	SKP_float					pitch_freq_low_Hz;
 	SKP_float					current_SNR_dB;
 
 	/* Measures */
 	SKP_float					sparseness;
     SKP_float                   predGain;
 	SKP_float					LTPredCodGain;
-	SKP_float					input_quality_bands[ VAD_N_BANDS ];
-	SKP_float					input_tilt;
 	SKP_float					ResNrg[ MAX_NB_SUBFR ];					/* Residual energy per subframe */
 } SKP_Silk_encoder_control_FLP;
 
diff --git a/src_FLP/SKP_Silk_wrappers_FLP.c b/src_FLP/SKP_Silk_wrappers_FLP.c
index 0af68130ab2567f47802bd7f0a50da889e61dca1..2347359f8b78d63a6eeb903ad46582b0970f5954 100644
--- a/src_FLP/SKP_Silk_wrappers_FLP.c
+++ b/src_FLP/SKP_Silk_wrappers_FLP.c
@@ -31,122 +31,58 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 /* Convert AR filter coefficients to NLSF parameters */
 void SKP_Silk_A2NLSF_FLP( 
-          SKP_float                 *pNLSF,             /* O    NLSF vector      [ LPC_order ]          */
+          SKP_int                   *NLSF_Q15,          /* O    NLSF vector      [ LPC_order ]          */
     const SKP_float                 *pAR,               /* I    LPC coefficients [ LPC_order ]          */
     const SKP_int                   LPC_order           /* I    LPC order                               */
 )
 {
     SKP_int   i;
-    SKP_int   NLSF_fix[  MAX_LPC_ORDER ];
     SKP_int32 a_fix_Q16[ MAX_LPC_ORDER ];
 
     for( i = 0; i < LPC_order; i++ ) {
         a_fix_Q16[ i ] = SKP_float2int( pAR[ i ] * 65536.0f );
     }
-    SKP_Silk_A2NLSF( NLSF_fix, a_fix_Q16, LPC_order );
 
-    for( i = 0; i < LPC_order; i++ ) {
-        pNLSF[ i ] = ( SKP_float )NLSF_fix[ i ] * ( 1.0f / 32768.0f );
-    }
+    SKP_Silk_A2NLSF( NLSF_Q15, a_fix_Q16, LPC_order );
 }
 
 /* Convert LSF parameters to AR prediction filter coefficients */
 void SKP_Silk_NLSF2A_stable_FLP( 
           SKP_float                 *pAR,               /* O    LPC coefficients [ LPC_order ]          */
-    const SKP_float                 *pNLSF,             /* I    NLSF vector      [ LPC_order ]          */
+    const SKP_int                   *NLSF_Q15,          /* I    NLSF vector      [ LPC_order ]          */
     const SKP_int                   LPC_order           /* I    LPC order                               */
 )
 {
     SKP_int   i;
-    SKP_int   NLSF_fix[  MAX_LPC_ORDER ];
     SKP_int16 a_fix_Q12[ MAX_LPC_ORDER ];
 
-    for( i = 0; i < LPC_order; i++ ) {
-        NLSF_fix[ i ] = ( SKP_int )SKP_CHECK_FIT16( SKP_float2int( pNLSF[ i ] * 32768.0f ) );
-    }
-
-    SKP_Silk_NLSF2A_stable( a_fix_Q12, NLSF_fix, LPC_order );
+    SKP_Silk_NLSF2A_stable( a_fix_Q12, NLSF_Q15, LPC_order );
 
     for( i = 0; i < LPC_order; i++ ) {
-        pAR[ i ] = ( SKP_float )a_fix_Q12[ i ] / 4096.0f;
+        pAR[ i ] = ( SKP_float )a_fix_Q12[ i ] * ( 1.0f / 4096.0f );
     }
 }
 
-
-/* LSF stabilizer, for a single input data vector */
-void SKP_Silk_NLSF_stabilize_FLP(
-          SKP_float                 *pNLSF,             /* I/O  (Un)stable NLSF vector [ LPC_order ]    */
-    const SKP_int                   *pNDelta_min_Q15,   /* I    Normalized delta min vector[LPC_order+1]*/
-    const SKP_int                   LPC_order           /* I    LPC order                               */
+/******************************************/
+/* Floating-point NLSF processing wrapper */
+/******************************************/
+void SKP_Silk_process_NLSFs_FLP(
+    SKP_Silk_encoder_state          *psEncC,                            /* I/O  Encoder state                               */
+    SKP_float                       PredCoef[ 2 ][ MAX_LPC_ORDER ],     /* O    Prediction coefficients                     */
+    SKP_int                         NLSF_Q15[      MAX_LPC_ORDER ],     /* I/O  Normalized LSFs (quant out) (0 - (2^15-1))  */
+    const SKP_int                   prev_NLSF_Q15[ MAX_LPC_ORDER ]      /* I    Previous Normalized LSFs (0 - (2^15-1))     */
 )
 {
-    SKP_int   i;
-    SKP_int   NLSF_Q15[ MAX_LPC_ORDER ], ndelta_min_Q15[ MAX_LPC_ORDER + 1 ];
-
-    for( i = 0; i < LPC_order; i++ ) {
-        NLSF_Q15[       i ] = ( SKP_int )SKP_float2int( pNLSF[ i ] * 32768.0f );
-        ndelta_min_Q15[ i ] = ( SKP_int )SKP_float2int( pNDelta_min_Q15[ i ] );
-    }
-    ndelta_min_Q15[ LPC_order ] = ( SKP_int )SKP_float2int( pNDelta_min_Q15[ LPC_order ] );
-
-    /* NLSF stabilizer, for a single input data vector */
-    SKP_Silk_NLSF_stabilize( NLSF_Q15, ndelta_min_Q15, LPC_order );
-
-    for( i = 0; i < LPC_order; i++ ) {
-        pNLSF[ i ] = ( SKP_float )NLSF_Q15[ i ] * ( 1.0f / 32768.0f );
-    }
-}
-
-/* Interpolation function with fixed point rounding */
-void SKP_Silk_interpolate_wrapper_FLP(
-          SKP_float                 xi[],               /* O    Interpolated vector                     */
-    const SKP_float                 x0[],               /* I    First vector                            */
-    const SKP_float                 x1[],               /* I    Second vector                           */
-    const SKP_float                 ifact,              /* I    Interp. factor, weight on second vector */
-    const SKP_int                   d                   /* I    Number of parameters                    */
-)
-{
-    SKP_int x0_int[ MAX_LPC_ORDER ], x1_int[ MAX_LPC_ORDER ], xi_int[ MAX_LPC_ORDER ];
-    SKP_int ifact_Q2 = ( SKP_int )( ifact * 4.0f );
-    SKP_int i;
-
-    /* Convert input from flp to fix */
-    for( i = 0; i < d; i++ ) {
-        x0_int[ i ] = SKP_float2int( x0[ i ] * 32768.0f );
-        x1_int[ i ] = SKP_float2int( x1[ i ] * 32768.0f );
-    }
-
-    /* Interpolate two vectors */
-    SKP_Silk_interpolate( xi_int, x0_int, x1_int, ifact_Q2, d );
-    
-    /* Convert output from fix to flp */
-    for( i = 0; i < d; i++ ) {
-        xi[ i ] = ( SKP_float )xi_int[ i ] * ( 1.0f / 32768.0f );
-    }
-}
-
-/****************************************/
-/* Floating-point Silk VAD wrapper      */
-/****************************************/
-SKP_int SKP_Silk_VAD_FLP(
-    SKP_Silk_encoder_state_FLP      *psEnc,             /* I/O  Encoder state FLP                       */
-    SKP_Silk_encoder_control_FLP    *psEncCtrl,         /* I/O  Encoder control FLP                     */
-    const SKP_int16                 *pIn                /* I    Input signal                            */
-)
-{
-    SKP_int i, ret, SA_Q8, SNR_dB_Q7, Tilt_Q15;
-    SKP_int Quality_Bands_Q15[ VAD_N_BANDS ];
+    SKP_int     i, j;
+    SKP_int16   PredCoef_Q12[ 2 ][ MAX_LPC_ORDER ];
 
-    ret = SKP_Silk_VAD_GetSA_Q8( &psEnc->sCmn.sVAD, &SA_Q8, &SNR_dB_Q7, Quality_Bands_Q15, &Tilt_Q15,
-        pIn, psEnc->sCmn.frame_length, psEnc->sCmn.fs_kHz );
+    SKP_Silk_process_NLSFs( psEncC, PredCoef_Q12, NLSF_Q15, prev_NLSF_Q15);
 
-    psEnc->speech_activity = ( SKP_float )SA_Q8 / 256.0f;
-    for( i = 0; i < VAD_N_BANDS; i++ ) {
-        psEncCtrl->input_quality_bands[ i ] = ( SKP_float )Quality_Bands_Q15[ i ] / 32768.0f;
+    for( j = 0; j < 2; j++ ) {
+        for( i = 0; i < psEncC->predictLPCOrder; i++ ) {
+            PredCoef[ j ][ i ] = ( SKP_float )PredCoef_Q12[ j ][ i ] * ( 1.0f / 4096.0f );
+        }
     }
-    psEncCtrl->input_tilt = ( SKP_float )Tilt_Q15 / 32768.0f;
-
-    return ret;
 }
 
 /****************************************/
@@ -253,6 +189,6 @@ void SKP_Silk_quant_LTP_gains_FLP(
     SKP_Silk_quant_LTP_gains( B_Q14, cbk_index, periodicity_index, W_Q18, mu_Q10, lowComplexity, nb_subfr );
 
     for( i = 0; i < nb_subfr * LTP_ORDER; i++ ) {
-        B[ i ] = ( (SKP_float)B_Q14[ i ] ) / 16384.0f;
+        B[ i ] = (SKP_float)B_Q14[ i ] * ( 1.0f / 16384.0f );
     }
 }
diff --git a/src_FLP/src_FLP.vcxproj b/src_FLP/src_FLP.vcxproj
index 8e28b7e876aca5d79d3455feac4d4648f725664f..256ba7aad33d3d339cfa4f8429a344a2cb11cd7d 100644
--- a/src_FLP/src_FLP.vcxproj
+++ b/src_FLP/src_FLP.vcxproj
@@ -87,19 +87,13 @@
     <ClCompile Include="SKP_Silk_find_LTP_FLP.c" />
     <ClCompile Include="SKP_Silk_find_pitch_lags_FLP.c" />
     <ClCompile Include="SKP_Silk_find_pred_coefs_FLP.c" />
-    <ClCompile Include="SKP_Silk_HP_variable_cutoff_FLP.c" />
     <ClCompile Include="SKP_Silk_init_encoder_FLP.c" />
     <ClCompile Include="SKP_Silk_LPC_analysis_filter_FLP.c" />
     <ClCompile Include="SKP_Silk_LTP_analysis_filter_FLP.c" />
     <ClCompile Include="SKP_Silk_LTP_scale_ctrl_FLP.c" />
-    <ClCompile Include="SKP_Silk_NLSF_MSVQ_decode_FLP.c" />
-    <ClCompile Include="SKP_Silk_NLSF_MSVQ_encode_FLP.c" />
-    <ClCompile Include="SKP_Silk_NLSF_VQ_rate_distortion_FLP.c" />
-    <ClCompile Include="SKP_Silk_NLSF_VQ_sum_error_FLP.c" />
     <ClCompile Include="SKP_Silk_noise_shape_analysis_FLP.c" />
     <ClCompile Include="SKP_Silk_prefilter_FLP.c" />
     <ClCompile Include="SKP_Silk_process_gains_FLP.c" />
-    <ClCompile Include="SKP_Silk_process_NLSFs_FLP.c" />
     <ClCompile Include="SKP_Silk_regularize_correlations_FLP.c" />
     <ClCompile Include="SKP_Silk_residual_energy_FLP.c" />
     <ClCompile Include="SKP_Silk_solve_LS_FLP.c" />
diff --git a/src_FLP/src_FLP.vcxproj.filters b/src_FLP/src_FLP.vcxproj.filters
index 781af9331b58ba2865d767eebee1eb535c664af6..d55e6073bf1df7612820e34dd37eb38cebada955 100644
--- a/src_FLP/src_FLP.vcxproj.filters
+++ b/src_FLP/src_FLP.vcxproj.filters
@@ -53,9 +53,6 @@
     <ClCompile Include="SKP_Silk_find_pred_coefs_FLP.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="SKP_Silk_HP_variable_cutoff_FLP.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="SKP_Silk_init_encoder_FLP.c">
       <Filter>Source Files</Filter>
     </ClCompile>
@@ -68,18 +65,6 @@
     <ClCompile Include="SKP_Silk_LTP_scale_ctrl_FLP.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="SKP_Silk_NLSF_MSVQ_decode_FLP.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="SKP_Silk_NLSF_MSVQ_encode_FLP.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="SKP_Silk_NLSF_VQ_rate_distortion_FLP.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="SKP_Silk_NLSF_VQ_sum_error_FLP.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="SKP_Silk_noise_shape_analysis_FLP.c">
       <Filter>Source Files</Filter>
     </ClCompile>
@@ -89,9 +74,6 @@
     <ClCompile Include="SKP_Silk_process_gains_FLP.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="SKP_Silk_process_NLSFs_FLP.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="SKP_Silk_regularize_correlations_FLP.c">
       <Filter>Source Files</Filter>
     </ClCompile>
diff --git a/src_SigProc_FIX/SKP_Silk_NLSF_VQ_weights_laroia.c b/src_SigProc_FIX/SKP_Silk_NLSF_VQ_weights_laroia.c
index b6e44bc84884ffb33292d19bfd5ed1fb74e30017..b1f05ba163b3ee69479a836f2109dfb5eefb8d7f 100644
--- a/src_SigProc_FIX/SKP_Silk_NLSF_VQ_weights_laroia.c
+++ b/src_SigProc_FIX/SKP_Silk_NLSF_VQ_weights_laroia.c
@@ -33,12 +33,11 @@ Parameters Using Structured Vector Quantization", Proc. IEEE Int. Conf. Acoust.,
 Signal Processing, pp. 641-644, 1991.
 */
 
-#define Q_OUT                       6
-#define MIN_NDELTA                  3
+#define Q_OUT                       5
 
 /* Laroia low complexity NLSF weights */
 void SKP_Silk_NLSF_VQ_weights_laroia(
-    SKP_int             *pNLSFW_Q6,         /* O: Pointer to input vector weights           [D x 1]     */
+    SKP_int             *pNLSFW_Q5,         /* O: Pointer to input vector weights           [D x 1]     */
     const SKP_int       *pNLSF_Q15,         /* I: Pointer to input vector                   [D x 1]     */ 
     const SKP_int       D                   /* I: Input vector dimension (even)                         */
 )
@@ -46,34 +45,33 @@ void SKP_Silk_NLSF_VQ_weights_laroia(
     SKP_int   k;
     SKP_int32 tmp1_int, tmp2_int;
     
-    /* Check that we are guaranteed to end up within the required range */
     SKP_assert( D > 0 );
     SKP_assert( ( D & 1 ) == 0 );
     
     /* First value */
-    tmp1_int = SKP_max_int( pNLSF_Q15[ 0 ], MIN_NDELTA );
+    tmp1_int = SKP_max_int( pNLSF_Q15[ 0 ], 1 );
     tmp1_int = SKP_DIV32_16( 1 << ( 15 + Q_OUT ), tmp1_int );
-    tmp2_int = SKP_max_int( pNLSF_Q15[ 1 ] - pNLSF_Q15[ 0 ], MIN_NDELTA );
+    tmp2_int = SKP_max_int( pNLSF_Q15[ 1 ] - pNLSF_Q15[ 0 ], 1 );
     tmp2_int = SKP_DIV32_16( 1 << ( 15 + Q_OUT ), tmp2_int );
-    pNLSFW_Q6[ 0 ] = (SKP_int)SKP_min_int( tmp1_int + tmp2_int, SKP_int16_MAX );
-    SKP_assert( pNLSFW_Q6[ 0 ] > 0 );
+    pNLSFW_Q5[ 0 ] = (SKP_int)SKP_min_int( tmp1_int + tmp2_int, SKP_int16_MAX );
+    SKP_assert( pNLSFW_Q5[ 0 ] > 0 );
     
     /* Main loop */
     for( k = 1; k < D - 1; k += 2 ) {
-        tmp1_int = SKP_max_int( pNLSF_Q15[ k + 1 ] - pNLSF_Q15[ k ], MIN_NDELTA );
+        tmp1_int = SKP_max_int( pNLSF_Q15[ k + 1 ] - pNLSF_Q15[ k ], 1 );
         tmp1_int = SKP_DIV32_16( 1 << ( 15 + Q_OUT ), tmp1_int );
-        pNLSFW_Q6[ k ] = (SKP_int)SKP_min_int( tmp1_int + tmp2_int, SKP_int16_MAX );
-        SKP_assert( pNLSFW_Q6[ k ] > 0 );
+        pNLSFW_Q5[ k ] = (SKP_int)SKP_min_int( tmp1_int + tmp2_int, SKP_int16_MAX );
+        SKP_assert( pNLSFW_Q5[ k ] > 0 );
 
-        tmp2_int = SKP_max_int( pNLSF_Q15[ k + 2 ] - pNLSF_Q15[ k + 1 ], MIN_NDELTA );
+        tmp2_int = SKP_max_int( pNLSF_Q15[ k + 2 ] - pNLSF_Q15[ k + 1 ], 1 );
         tmp2_int = SKP_DIV32_16( 1 << ( 15 + Q_OUT ), tmp2_int );
-        pNLSFW_Q6[ k + 1 ] = (SKP_int)SKP_min_int( tmp1_int + tmp2_int, SKP_int16_MAX );
-        SKP_assert( pNLSFW_Q6[ k + 1 ] > 0 );
+        pNLSFW_Q5[ k + 1 ] = (SKP_int)SKP_min_int( tmp1_int + tmp2_int, SKP_int16_MAX );
+        SKP_assert( pNLSFW_Q5[ k + 1 ] > 0 );
     }
     
     /* Last value */
-    tmp1_int = SKP_max_int( ( 1 << 15 ) - pNLSF_Q15[ D - 1 ], MIN_NDELTA );
+    tmp1_int = SKP_max_int( ( 1 << 15 ) - pNLSF_Q15[ D - 1 ], 1 );
     tmp1_int = SKP_DIV32_16( 1 << ( 15 + Q_OUT ), tmp1_int );
-    pNLSFW_Q6[ D - 1 ] = (SKP_int)SKP_min_int( tmp1_int + tmp2_int, SKP_int16_MAX );
-    SKP_assert( pNLSFW_Q6[ D - 1 ] > 0 );
+    pNLSFW_Q5[ D - 1 ] = (SKP_int)SKP_min_int( tmp1_int + tmp2_int, SKP_int16_MAX );
+    SKP_assert( pNLSFW_Q5[ D - 1 ] > 0 );
 }
diff --git a/src_SigProc_FIX/SKP_Silk_SigProc_FIX.h b/src_SigProc_FIX/SKP_Silk_SigProc_FIX.h
index eeff5808b8428efafbe12cad9711a85c2e35501b..356991460e830da329d6cfd7594797b9ab0dc7e5 100644
--- a/src_SigProc_FIX/SKP_Silk_SigProc_FIX.h
+++ b/src_SigProc_FIX/SKP_Silk_SigProc_FIX.h
@@ -55,7 +55,7 @@ extern "C"
  * Initialize/reset the resampler state for a given pair of input/output sampling rates 
 */
 SKP_int SKP_Silk_resampler_init( 
-	SKP_Silk_resampler_state_struct	*S,		        /* I/O: Resampler state 			*/
+	SKP_Silk_resampler_state_struct	    *S,         /* I/O: Resampler state 			*/
 	SKP_int32							Fs_Hz_in,	/* I:	Input sampling rate (Hz)	*/
 	SKP_int32							Fs_Hz_out	/* I:	Output sampling rate (Hz)	*/
 );
@@ -65,14 +65,14 @@ SKP_int SKP_Silk_resampler_init(
  * Clear the states of all resampling filters, without resetting sampling rate ratio 
  */
 SKP_int SKP_Silk_resampler_clear( 
-	SKP_Silk_resampler_state_struct	*S		        /* I/O: Resampler state 			*/
+	SKP_Silk_resampler_state_struct	    *S          /* I/O: Resampler state 			*/
 );
 
 /*!
  * Resampler: convert from one sampling rate to another
  */
 SKP_int SKP_Silk_resampler( 
-	SKP_Silk_resampler_state_struct	*S,		        /* I/O: Resampler state 			*/
+	SKP_Silk_resampler_state_struct	    *S,         /* I/O: Resampler state 			*/
 	SKP_int16							out[],	    /* O:	Output signal 				*/
 	const SKP_int16						in[],	    /* I:	Input signal				*/
 	SKP_int32							inLen	    /* I:	Number of input samples		*/
@@ -243,7 +243,6 @@ void SKP_Silk_ana_filt_bank_1(
     SKP_int32            *S,            /* I/O: State vector [2]        */
     SKP_int16            *outL,         /* O:   Low band [N/2]          */
     SKP_int16            *outH,         /* O:   High band [N/2]         */
-    SKP_int32            *scratch,      /* I:   Scratch memory [3*N/2]  */
     const SKP_int32      N              /* I:   Number of input samples */
 );
 
@@ -429,7 +428,7 @@ void SKP_Silk_NLSF_stabilize_multi(
 
 /* Laroia low complexity NLSF weights */
 void SKP_Silk_NLSF_VQ_weights_laroia(
-    SKP_int              *pNLSFW_Q6,     /* O:    Pointer to input vector weights            [D x 1]       */
+    SKP_int              *pNLSFW_Q5,     /* O:    Pointer to input vector weights            [D x 1]       */
     const SKP_int        *pNLSF_Q15,     /* I:    Pointer to input vector                    [D x 1]       */
     const SKP_int        D               /* I:    Input vector dimension (even)                            */
 );
@@ -575,8 +574,6 @@ SKP_INLINE SKP_int32 SKP_ROR32( SKP_int32 a32, SKP_int rot )
 #define SKP_SMLAWB_ovflw(a32, b32, c32)    SKP_SMLAWB(a32, b32, c32)
 #define SKP_SMLAWT_ovflw(a32, b32, c32)    SKP_SMLAWT(a32, b32, c32)
 
-#define SKP_DIV64_32(a64, b32)             ((a64)/(b32))        /* TODO: rewrite it as a set of SKP_DIV32.*/
-
 #define SKP_DIV32_16(a32, b16)             ((SKP_int32)((a32) / (b16)))
 #define SKP_DIV32(a32, b32)                ((SKP_int32)((a32) / (b32)))
 
diff --git a/src_SigProc_FIX/SKP_Silk_ana_filt_bank_1.c b/src_SigProc_FIX/SKP_Silk_ana_filt_bank_1.c
index 04cbe077424a8895cb5fa6e38bbea60ec21c881e..66bc6a44ae037ff5340e95d66e61e59f06391e87 100644
--- a/src_SigProc_FIX/SKP_Silk_ana_filt_bank_1.c
+++ b/src_SigProc_FIX/SKP_Silk_ana_filt_bank_1.c
@@ -46,7 +46,6 @@ void SKP_Silk_ana_filt_bank_1(
     SKP_int32            *S,         /* I/O: State vector [2]        */
     SKP_int16            *outL,      /* O:   Low band [N/2]          */
     SKP_int16            *outH,      /* O:   High band [N/2]         */
-    SKP_int32            *scratch,   /* I:   Scratch memory [3*N/2]  */   // todo: remove - no longer used
     const SKP_int32      N           /* I:   Number of input samples */
 )
 {
diff --git a/src_SigProc_FIX/src_SigProc_FIX.vcxproj b/src_SigProc_FIX/src_SigProc_FIX.vcxproj
index e34ce9793248fc61de93398366717506aa1820cb..a6921d31075108d62a9e14c44dc122003d41e7ce 100644
--- a/src_SigProc_FIX/src_SigProc_FIX.vcxproj
+++ b/src_SigProc_FIX/src_SigProc_FIX.vcxproj
@@ -45,7 +45,7 @@
       <WarningLevel>Level3</WarningLevel>
       <Optimization>Disabled</Optimization>
       <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>../interface</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>../interface;H:\Work\Codecs_silk_celt_experiments\ietfcodec\celt\libcelt</AdditionalIncludeDirectories>
     </ClCompile>
     <Link>
       <SubSystem>Windows</SubSystem>
@@ -61,7 +61,7 @@
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <IntrinsicFunctions>true</IntrinsicFunctions>
       <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>../interface</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>../interface;H:\Work\Codecs_silk_celt_experiments\ietfcodec\celt\libcelt</AdditionalIncludeDirectories>
     </ClCompile>
     <Link>
       <SubSystem>Windows</SubSystem>
diff --git a/src_SigProc_FLP/SKP_Silk_NLSF_VQ_weights_laroia_FLP.c b/src_SigProc_FLP/SKP_Silk_NLSF_VQ_weights_laroia_FLP.c
deleted file mode 100644
index f5828571d75acff2a55e9a60c6c0ec545ea45584..0000000000000000000000000000000000000000
--- a/src_SigProc_FLP/SKP_Silk_NLSF_VQ_weights_laroia_FLP.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/***********************************************************************
-Copyright (c) 2006-2011, 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_SigProc_FLP.h"
-
-/* 
-R. Laroia, N. Phamdo and N. Farvardin, "Robust and Efficient Quantization of Speech LSP
-Parameters Using Structured Vector Quantization", Proc. IEEE Int. Conf. Acoust., Speech,
-Signal Processing, pp. 641-644, 1991.
-*/
-
-#define MIN_NDELTA                  1e-4f
-
-/* Laroia low complexity NLSF weights */
-void SKP_Silk_NLSF_VQ_weights_laroia_FLP( 
-          SKP_float     *pXW,           /* 0: Pointer to input vector weights           [D x 1] */
-    const SKP_float     *pX,            /* I: Pointer to input vector                   [D x 1] */ 
-    const SKP_int        D              /* I: Input vector dimension                            */
-)
-{
-    SKP_int   k;
-    SKP_float tmp1, tmp2;
-    
-    /* Safety checks */
-    SKP_assert( D > 0 );
-    SKP_assert( ( D & 1 ) == 0 );
-    
-    /* First value */
-    tmp1 = 1.0f / SKP_max_float( pX[ 0 ],           MIN_NDELTA );
-    tmp2 = 1.0f / SKP_max_float( pX[ 1 ] - pX[ 0 ], MIN_NDELTA );
-    pXW[ 0 ] = tmp1 + tmp2;
-    
-    /* Main loop */
-    for( k = 1; k < D - 1; k += 2 ) {
-        tmp1 = 1.0f / SKP_max_float( pX[ k + 1 ] - pX[ k ], MIN_NDELTA );
-        pXW[ k ] = tmp1 + tmp2;
-
-        tmp2 = 1.0f / SKP_max_float( pX[ k + 2 ] - pX[ k + 1 ], MIN_NDELTA );
-        pXW[ k + 1 ] = tmp1 + tmp2;
-    }
-    
-    /* Last value */
-    tmp1 = 1.0f / SKP_max_float( 1.0f - pX[ D - 1 ], MIN_NDELTA );
-    pXW[ D - 1 ] = tmp1 + tmp2;
-}
diff --git a/src_SigProc_FLP/SKP_Silk_SigProc_FLP.h b/src_SigProc_FLP/SKP_Silk_SigProc_FLP.h
index 115de3a0ce8f3b4be78cc54628af471f9d6e85f3..9c37d6957c18a4163241c700ac583b633801c9ff 100644
--- a/src_SigProc_FLP/SKP_Silk_SigProc_FLP.h
+++ b/src_SigProc_FLP/SKP_Silk_SigProc_FLP.h
@@ -107,24 +107,17 @@ SKP_int SKP_Silk_pitch_analysis_core_FLP( /* O voicing estimate: 0 voiced, 1 unv
 #define PI               (3.1415926536f)
 
 void SKP_Silk_insertion_sort_decreasing_FLP(
-    SKP_float            *a,          /* I/O:  Unsorted / Sorted vector                */
-    SKP_int              *index,      /* O:    Index vector for the sorted elements    */
-    const SKP_int        L,           /* I:    Vector length                           */
-    const SKP_int        K            /* I:    Number of correctly sorted positions    */
+    SKP_float            *a,            /* I/O:  Unsorted / Sorted vector                */
+    SKP_int              *index,        /* O:    Index vector for the sorted elements    */
+    const SKP_int        L,             /* I:    Vector length                           */
+    const SKP_int        K              /* I:    Number of correctly sorted positions    */
 );
 
 void SKP_Silk_insertion_sort_increasing_FLP(
-    SKP_float            *a,          /* I/O:  Unsorted / Sorted vector                */
-    SKP_int              *index,      /* O:    Index vector for the sorted elements    */
-    const SKP_int        L,           /* I:    Vector length                           */
-    const SKP_int        K            /* I:    Number of correctly sorted positions    */
-);
-
-/* Laroia low complexity NLSF weights */
-void SKP_Silk_NLSF_VQ_weights_laroia_FLP(	
-    SKP_float            *pXW,           /* 0: Pointer to input vector weights                [D x 1]    */
-    const SKP_float      *pX,            /* I: Pointer to input vector                        [D x 1]    */ 
-    const SKP_int        D               /* I: Input vector dimension                                    */
+    SKP_float            *a,            /* I/O:  Unsorted / Sorted vector                */
+    SKP_int              *index,        /* O:    Index vector for the sorted elements    */
+    const SKP_int        L,             /* I:    Vector length                           */
+    const SKP_int        K              /* I:    Number of correctly sorted positions    */
 );
 
 /* Compute reflection coefficients from input signal */
diff --git a/src_SigProc_FLP/src_SigProc_FLP.vcxproj b/src_SigProc_FLP/src_SigProc_FLP.vcxproj
index c4e9004aa187b855d2f7a7e43ea39cea6a30f49a..9284850ded0c99e3250b8bdc3a984061c3e48f2d 100644
--- a/src_SigProc_FLP/src_SigProc_FLP.vcxproj
+++ b/src_SigProc_FLP/src_SigProc_FLP.vcxproj
@@ -45,7 +45,7 @@
       <WarningLevel>Level3</WarningLevel>
       <Optimization>Disabled</Optimization>
       <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>../interface;../src_SigProc_FIX</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>H:\Work\Codecs_silk_celt_experiments\ietfcodec\celt\libcelt;../interface;../src_SigProc_FIX</AdditionalIncludeDirectories>
     </ClCompile>
     <Link>
       <SubSystem>Windows</SubSystem>
@@ -61,7 +61,7 @@
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <IntrinsicFunctions>true</IntrinsicFunctions>
       <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>../interface;../src_SigProc_FIX</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>H:\Work\Codecs_silk_celt_experiments\ietfcodec\celt\libcelt;../interface;../src_SigProc_FIX</AdditionalIncludeDirectories>
     </ClCompile>
     <Link>
       <SubSystem>Windows</SubSystem>
@@ -85,7 +85,6 @@
     <ClCompile Include="SKP_Silk_k2a_FLP.c" />
     <ClCompile Include="SKP_Silk_levinsondurbin_FLP.c" />
     <ClCompile Include="SKP_Silk_LPC_inv_pred_gain_FLP.c" />
-    <ClCompile Include="SKP_Silk_NLSF_VQ_weights_laroia_FLP.c" />
     <ClCompile Include="SKP_Silk_pitch_analysis_core_FLP.c" />
     <ClCompile Include="SKP_Silk_scale_copy_vector_FLP.c" />
     <ClCompile Include="SKP_Silk_scale_vector_FLP.c" />
diff --git a/src_SigProc_FLP/src_SigProc_FLP.vcxproj.filters b/src_SigProc_FLP/src_SigProc_FLP.vcxproj.filters
index 4bc333487c048272ea4e81300b74f00cf4ba6120..717b1c242f4c7a20e15b0eca2639189410604597 100644
--- a/src_SigProc_FLP/src_SigProc_FLP.vcxproj.filters
+++ b/src_SigProc_FLP/src_SigProc_FLP.vcxproj.filters
@@ -47,9 +47,6 @@
     <ClCompile Include="SKP_Silk_LPC_inv_pred_gain_FLP.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="SKP_Silk_NLSF_VQ_weights_laroia_FLP.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="SKP_Silk_pitch_analysis_core_FLP.c">
       <Filter>Source Files</Filter>
     </ClCompile>
diff --git a/src_FIX/SKP_Silk_HP_variable_cutoff_FIX.c b/src_common/SKP_Silk_HP_variable_cutoff.c
similarity index 70%
rename from src_FIX/SKP_Silk_HP_variable_cutoff_FIX.c
rename to src_common/SKP_Silk_HP_variable_cutoff.c
index bfc310b64177f98144df01f94af3e9cad7019beb..48daad4cf2ff50a08276d38aba60f7ee328be4c6 100644
--- a/src_FIX/SKP_Silk_HP_variable_cutoff_FIX.c
+++ b/src_common/SKP_Silk_HP_variable_cutoff.c
@@ -34,14 +34,15 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #define SKP_LOG2_VARIABLE_HP_MIN_FREQ_Q7    809     // log(80) in Q7
 
 /* High-pass filter with cutoff frequency adaptation based on pitch lag statistics */
-void SKP_Silk_HP_variable_cutoff_FIX(
-    SKP_Silk_encoder_state_FIX      *psEnc,             /* I/O  Encoder state FIX                           */
-    SKP_Silk_encoder_control_FIX    *psEncCtrl,         /* I/O  Encoder control FIX                         */
-    SKP_int16                       *out,               /* O    high-pass filtered output signal            */
-    const SKP_int16                 *in                 /* I    input signal                                */
+void SKP_Silk_HP_variable_cutoff(
+    SKP_Silk_encoder_state          *psEncC,        /* I/O  Encoder state                               */
+    SKP_int16                       *out,           /* O    high-pass filtered output signal            */
+    const SKP_int16                 *in,            /* I    input signal                                */
+    const SKP_int                   frame_length    /* I    length of input                             */
 )
 {
     SKP_int   quality_Q15;
+	SKP_float pitch_freq_low_Hz;
     SKP_int32 B_Q28[ 3 ], A_Q28[ 2 ];
     SKP_int32 Fc_Q19, r_Q28, r_Q22;
     SKP_int32 pitch_freq_Hz_Q16, pitch_freq_log_Q7, delta_freq_Q7;
@@ -49,19 +50,19 @@ void SKP_Silk_HP_variable_cutoff_FIX(
     /*********************************************/
     /* Estimate Low End of Pitch Frequency Range */
     /*********************************************/
-    if( psEnc->sCmn.prevSignalType == TYPE_VOICED ) {
+    if( psEncC->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_Hz_Q16 = SKP_DIV32_16( SKP_LSHIFT( SKP_MUL( psEncC->fs_kHz, 1000 ), 16 ), psEncC->prevLag );
         pitch_freq_log_Q7 = SKP_Silk_lin2log( pitch_freq_Hz_Q16 ) - ( 16 << 7 ); //0x70
 
         /* adjustment based on quality */
-        quality_Q15 = psEncCtrl->input_quality_bands_Q15[ 0 ];
+        quality_Q15 = psEncC->input_quality_bands_Q15[ 0 ];
         pitch_freq_log_Q7 = SKP_SUB32( pitch_freq_log_Q7, SKP_SMULWB( SKP_SMULWB( SKP_LSHIFT( quality_Q15, 2 ), quality_Q15 ), 
             pitch_freq_log_Q7 - SKP_LOG2_VARIABLE_HP_MIN_FREQ_Q7 ) );
         pitch_freq_log_Q7 = SKP_ADD32( pitch_freq_log_Q7, SKP_RSHIFT( SKP_FIX_CONST( 0.6, 15 ) - quality_Q15, 9 ) );
 
         //delta_freq = pitch_freq_log - psEnc->variable_HP_smth1;
-        delta_freq_Q7 = pitch_freq_log_Q7 - SKP_RSHIFT( psEnc->variable_HP_smth1_Q15, 8 );
+        delta_freq_Q7 = pitch_freq_log_Q7 - SKP_RSHIFT( psEncC->variable_HP_smth1_Q15, 8 );
         if( delta_freq_Q7 < 0 ) {
             /* less smoothing for decreasing pitch frequency, to track something close to the minimum */
             delta_freq_Q7 = SKP_MUL( delta_freq_Q7, 3 );
@@ -71,28 +72,28 @@ void SKP_Silk_HP_variable_cutoff_FIX(
         delta_freq_Q7 = SKP_LIMIT_32( delta_freq_Q7, -SKP_FIX_CONST( VARIABLE_HP_MAX_DELTA_FREQ, 7 ), SKP_FIX_CONST( VARIABLE_HP_MAX_DELTA_FREQ, 7 ) );
 
         /* update smoother */
-        psEnc->variable_HP_smth1_Q15 = SKP_SMLAWB( psEnc->variable_HP_smth1_Q15, 
-            SKP_MUL( SKP_LSHIFT( psEnc->speech_activity_Q8, 1 ), delta_freq_Q7 ), SKP_FIX_CONST( VARIABLE_HP_SMTH_COEF1, 16 ) );
+        psEncC->variable_HP_smth1_Q15 = SKP_SMLAWB( psEncC->variable_HP_smth1_Q15, 
+            SKP_MUL( SKP_LSHIFT( psEncC->speech_activity_Q8, 1 ), delta_freq_Q7 ), SKP_FIX_CONST( VARIABLE_HP_SMTH_COEF1, 16 ) );
     }
+
     /* second smoother */
-    psEnc->variable_HP_smth2_Q15 = SKP_SMLAWB( psEnc->variable_HP_smth2_Q15, 
-        psEnc->variable_HP_smth1_Q15 - psEnc->variable_HP_smth2_Q15, SKP_FIX_CONST( VARIABLE_HP_SMTH_COEF2, 16 ) );
+    psEncC->variable_HP_smth2_Q15 = SKP_SMLAWB( psEncC->variable_HP_smth2_Q15, 
+        psEncC->variable_HP_smth1_Q15 - psEncC->variable_HP_smth2_Q15, SKP_FIX_CONST( VARIABLE_HP_SMTH_COEF2, 16 ) );
 
     /* convert from log scale to Hertz */
-    psEncCtrl->pitch_freq_low_Hz = SKP_Silk_log2lin( SKP_RSHIFT( psEnc->variable_HP_smth2_Q15, 8 ) );
+    pitch_freq_low_Hz = SKP_Silk_log2lin( SKP_RSHIFT( psEncC->variable_HP_smth2_Q15, 8 ) );
 
     /* limit frequency range */
-    psEncCtrl->pitch_freq_low_Hz = SKP_LIMIT_32( psEncCtrl->pitch_freq_low_Hz, 
-        SKP_FIX_CONST( VARIABLE_HP_MIN_FREQ, 0 ), SKP_FIX_CONST( VARIABLE_HP_MAX_FREQ, 0 ) );
+    pitch_freq_low_Hz = SKP_LIMIT_32( pitch_freq_low_Hz, SKP_FIX_CONST( VARIABLE_HP_MIN_FREQ, 0 ), SKP_FIX_CONST( VARIABLE_HP_MAX_FREQ, 0 ) );
 
     /********************************/
     /* Compute Filter Coefficients  */
     /********************************/
     /* compute cut-off frequency, in radians */
-    //Fc_num   = (SKP_float)( 0.45f * 2.0f * 3.14159265359 * psEncCtrl->pitch_freq_low_Hz );
-    //Fc_denom = (SKP_float)( 1e3f * psEnc->sCmn.fs_kHz );
-    SKP_assert( psEncCtrl->pitch_freq_low_Hz <= SKP_int32_MAX / SKP_RADIANS_CONSTANT_Q19 );
-    Fc_Q19 = SKP_DIV32_16( SKP_SMULBB( SKP_RADIANS_CONSTANT_Q19, psEncCtrl->pitch_freq_low_Hz ), psEnc->sCmn.fs_kHz ); // range: 3704 - 27787, 11-15 bits
+    //Fc_num   = (SKP_float)( 0.45f * 2.0f * 3.14159265359 * pitch_freq_low_Hz );
+    //Fc_denom = (SKP_float)( 1e3f * psEncC->fs_kHz );
+    SKP_assert( pitch_freq_low_Hz <= SKP_int32_MAX / SKP_RADIANS_CONSTANT_Q19 );
+    Fc_Q19 = SKP_DIV32_16( SKP_SMULBB( SKP_RADIANS_CONSTANT_Q19, pitch_freq_low_Hz ), psEncC->fs_kHz ); // range: 3704 - 27787, 11-15 bits
     SKP_assert( Fc_Q19 >=  3704 );
     SKP_assert( Fc_Q19 <= 27787 );
 
@@ -114,7 +115,7 @@ void SKP_Silk_HP_variable_cutoff_FIX(
     /********************************/
     /* High-Pass Filter             */
     /********************************/
-    SKP_Silk_biquad_alt( in, B_Q28, A_Q28, psEnc->sCmn.In_HP_State, out, psEnc->sCmn.frame_length );
+    SKP_Silk_biquad_alt( in, B_Q28, A_Q28, psEncC->In_HP_State, out, frame_length );
 }
 
 #endif // HIGH_PASS_INPUT
diff --git a/src_common/SKP_Silk_LP_variable_cutoff.c b/src_common/SKP_Silk_LP_variable_cutoff.c
index 82183ddef0f2f19cb0b6b1a444a5319e8932b963..371d35b22d465eb9a74ea06b482165610db9523b 100644
--- a/src_common/SKP_Silk_LP_variable_cutoff.c
+++ b/src_common/SKP_Silk_LP_variable_cutoff.c
@@ -48,7 +48,7 @@ SKP_INLINE void SKP_Silk_LP_interpolate_filter_taps(
 
     if( ind < TRANSITION_INT_NUM - 1 ) {
         if( fac_Q16 > 0 ) {
-            if( fac_Q16 == SKP_SAT16( fac_Q16 ) ) { /* fac_Q16 is in range of a 16-bit int */
+            if( fac_Q16 < 32768 ) { /* fac_Q16 is in range of a 16-bit int */
                 /* Piece-wise linear interpolation of B and A */
                 for( nb = 0; nb < TRANSITION_NB; nb++ ) {
                     B_Q28[ nb ] = SKP_SMLAWB(
@@ -64,38 +64,23 @@ SKP_INLINE void SKP_Silk_LP_interpolate_filter_taps(
                         SKP_Silk_Transition_LP_A_Q28[ ind     ][ na ],
                         fac_Q16 );
                 }
-            } else if( fac_Q16 == ( 1 << 15 ) ) { /* Neither fac_Q16 nor ( ( 1 << 16 ) - fac_Q16 ) is in range of a 16-bit int */
-
-                /* Piece-wise linear interpolation of B and A */
-                for( nb = 0; nb < TRANSITION_NB; nb++ ) {
-                    B_Q28[ nb ] = SKP_RSHIFT( 
-                        SKP_Silk_Transition_LP_B_Q28[ ind     ][ nb ] +
-                        SKP_Silk_Transition_LP_B_Q28[ ind + 1 ][ nb ],
-                        1 );
-                }
-                for( na = 0; na < TRANSITION_NA; na++ ) {
-                    A_Q28[ na ] = SKP_RSHIFT( 
-                        SKP_Silk_Transition_LP_A_Q28[ ind     ][ na ] + 
-                        SKP_Silk_Transition_LP_A_Q28[ ind + 1 ][ na ], 
-                        1 );
-                }
-            } else { /* ( ( 1 << 16 ) - fac_Q16 ) is in range of a 16-bit int */
+            } else { /* ( fac_Q16 - ( 1 << 16 ) ) is in range of a 16-bit int */
                 
-                SKP_assert( ( ( 1 << 16 ) - fac_Q16 ) == SKP_SAT16( ( ( 1 << 16 ) - fac_Q16) ) );
+                SKP_assert( fac_Q16 - ( 1 << 16 ) == SKP_SAT16( fac_Q16 - ( 1 << 16 ) ) );
                 /* Piece-wise linear interpolation of B and A */
                 for( nb = 0; nb < TRANSITION_NB; nb++ ) {
                     B_Q28[ nb ] = SKP_SMLAWB(
                         SKP_Silk_Transition_LP_B_Q28[ ind + 1 ][ nb ],
-                        SKP_Silk_Transition_LP_B_Q28[ ind     ][ nb ] -
-                        SKP_Silk_Transition_LP_B_Q28[ ind + 1 ][ nb ],
-                        ( 1 << 16 ) - fac_Q16 );
+                        SKP_Silk_Transition_LP_B_Q28[ ind + 1 ][ nb ] -
+                        SKP_Silk_Transition_LP_B_Q28[ ind     ][ nb ],
+                        fac_Q16 - ( 1 << 16 ) );
                 }
                 for( na = 0; na < TRANSITION_NA; na++ ) {
                     A_Q28[ na ] = SKP_SMLAWB(
                         SKP_Silk_Transition_LP_A_Q28[ ind + 1 ][ na ],
-                        SKP_Silk_Transition_LP_A_Q28[ ind     ][ na ] -
-                        SKP_Silk_Transition_LP_A_Q28[ ind + 1 ][ na ],
-                        ( 1 << 16 ) - fac_Q16 );
+                        SKP_Silk_Transition_LP_A_Q28[ ind + 1 ][ na ] -
+                        SKP_Silk_Transition_LP_A_Q28[ ind     ][ na ],
+                        fac_Q16 - ( 1 << 16 ) );
                 }
             }
         } else {
@@ -110,8 +95,8 @@ SKP_INLINE void SKP_Silk_LP_interpolate_filter_taps(
 
 /* Low-pass filter with variable cutoff frequency based on  */
 /* piece-wise linear interpolation between elliptic filters */
-/* Start by setting psEncC->transition_frame_no = 1;            */
-/* Deactivate by setting psEncC->transition_frame_no = 0;   */
+/* Start by setting psEncC->mode <> 0;                      */
+/* Deactivate by setting psEncC->mode = 0;                  */
 void SKP_Silk_LP_variable_cutoff(
     SKP_Silk_LP_state               *psLP,          /* I/O  LP filter state                     */
     SKP_int16                       *signal,        /* I/O  Low-pass filtered output signal     */
@@ -121,67 +106,28 @@ void SKP_Silk_LP_variable_cutoff(
     SKP_int32   B_Q28[ TRANSITION_NB ], A_Q28[ TRANSITION_NA ], fac_Q16 = 0;
     SKP_int     ind = 0;
 
-    SKP_assert( psLP->transition_frame_no >= 0 );
-    SKP_assert( ( ( ( psLP->transition_frame_no <= TRANSITION_FRAMES_DOWN ) && ( psLP->mode == 0 ) ) || 
-                  ( ( psLP->transition_frame_no <= TRANSITION_FRAMES_UP   ) && ( psLP->mode == 1 ) ) ) );
+    SKP_assert( psLP->transition_frame_no >= 0 && psLP->transition_frame_no <= TRANSITION_FRAMES );
 
     /* Interpolate filter coefficients if needed */
-    if( psLP->transition_frame_no > 0 ) {
-        if( psLP->mode == 0 ) {
-            if( psLP->transition_frame_no < TRANSITION_FRAMES_DOWN ) {
-                /* Calculate index and interpolation factor for interpolation */
-#if( TRANSITION_INT_STEPS_DOWN == 32 )
-                fac_Q16 = SKP_LSHIFT( psLP->transition_frame_no, 16 - 5 );
+    if( psLP->mode != 0 ) {
+        /* Calculate index and interpolation factor for interpolation */
+#if( TRANSITION_INT_STEPS == 64 )
+        fac_Q16 = SKP_LSHIFT( TRANSITION_FRAMES - psLP->transition_frame_no, 16 - 6 );
 #else
-                fac_Q16 = SKP_DIV32_16( SKP_LSHIFT( psLP->transition_frame_no, 16 ), TRANSITION_INT_STEPS_DOWN );
+        fac_Q16 = SKP_DIV32_16( SKP_LSHIFT( TRANSITION_FRAMES - psLP->transition_frame_no, 16 ), TRANSITION_FRAMES );
 #endif
-                ind      = SKP_RSHIFT( fac_Q16, 16 );
-                fac_Q16 -= SKP_LSHIFT( ind, 16 );
+        ind      = SKP_RSHIFT( fac_Q16, 16 );
+        fac_Q16 -= SKP_LSHIFT( ind, 16 );
 
-                SKP_assert( ind >= 0 );
-                SKP_assert( ind < TRANSITION_INT_NUM );
+        SKP_assert( ind >= 0 );
+        SKP_assert( ind < TRANSITION_INT_NUM );
 
-                /* Interpolate filter coefficients */
-                SKP_Silk_LP_interpolate_filter_taps( B_Q28, A_Q28, ind, fac_Q16 );
+        /* Interpolate filter coefficients */
+        SKP_Silk_LP_interpolate_filter_taps( B_Q28, A_Q28, ind, fac_Q16 );
 
-                /* Increment transition frame number for next frame */
-                psLP->transition_frame_no++;
+        /* Update transition frame number for next frame */
+        psLP->transition_frame_no = SKP_LIMIT( psLP->transition_frame_no + psLP->mode, 0, TRANSITION_FRAMES );
 
-            } else {
-                SKP_assert( psLP->transition_frame_no == TRANSITION_FRAMES_DOWN );
-                /* End of transition phase */
-                SKP_Silk_LP_interpolate_filter_taps( B_Q28, A_Q28, TRANSITION_INT_NUM - 1, 0 );
-            }
-        } else {
-            SKP_assert( psLP->mode == 1 );
-            if( psLP->transition_frame_no < TRANSITION_FRAMES_UP ) {
-                /* Calculate index and interpolation factor for interpolation */
-#if( TRANSITION_INT_STEPS_UP == 64 )
-                fac_Q16 = SKP_LSHIFT( TRANSITION_FRAMES_UP - psLP->transition_frame_no, 16 - 6 );
-#else
-                fac_Q16 = SKP_DIV32_16( SKP_LSHIFT( TRANSITION_FRAMES_UP - psLP->transition_frame_no, 16 ), TRANSITION_INT_STEPS_UP );
-#endif
-                ind      = SKP_RSHIFT( fac_Q16, 16 );
-                fac_Q16 -= SKP_LSHIFT( ind, 16 );
-
-                SKP_assert( ind >= 0 );
-                SKP_assert( ind < TRANSITION_INT_NUM );
-
-                /* Interpolate filter coefficients */
-                SKP_Silk_LP_interpolate_filter_taps( B_Q28, A_Q28, ind, fac_Q16 );
-
-                /* Increment transition frame number for next frame */
-                psLP->transition_frame_no++;
-            
-            } else {
-                SKP_assert( psLP->transition_frame_no == TRANSITION_FRAMES_UP );
-                /* End of transition phase */
-                SKP_Silk_LP_interpolate_filter_taps( B_Q28, A_Q28, 0, 0 );
-            }
-        }
-    } 
-    
-    if( psLP->transition_frame_no > 0 ) {
         /* ARMA low-pass filtering */
         SKP_assert( TRANSITION_NB == 3 && TRANSITION_NA == 2 );
         SKP_Silk_biquad_alt( signal, B_Q28, A_Q28, psLP->In_LP_State, signal, frame_length );
diff --git a/src_common/SKP_Silk_NLSF_MSVQ_decode.c b/src_common/SKP_Silk_NLSF_MSVQ_decode.c
index 3cd0a3e731f057d5e2aacb8ed59202f9d80881a6..a48448fae8e834380c98db956e86c180fbe10a44 100644
--- a/src_common/SKP_Silk_NLSF_MSVQ_decode.c
+++ b/src_common/SKP_Silk_NLSF_MSVQ_decode.c
@@ -47,7 +47,7 @@ void SKP_Silk_NLSF_MSVQ_decode(
 
     /* Initialize with the codebook vector from stage 0 */
     for( i = 0; i < LPC_order; i++ ) {
-        pNLSF_Q8[ i ] = ( SKP_int )pCB_element[ i ];
+        pNLSF_Q8[ i ] = SKP_LSHIFT( ( SKP_int )pCB_element[ i ], NLSF_Q_DOMAIN_STAGE_2_TO_LAST - NLSF_Q_DOMAIN_STAGE_0 );
     }
           
     if( LPC_order == 16 ) {
@@ -98,7 +98,7 @@ void SKP_Silk_NLSF_MSVQ_decode(
 
     /* Add 1/2 in Q15 */
     for( i = 0; i < LPC_order; i++ ) {
-        pNLSF_Q15[ i ] = SKP_LSHIFT16( pNLSF_Q8[ i ], 7 ) + SKP_FIX_CONST( 0.5f, 15 );
+        pNLSF_Q15[ i ] = SKP_LSHIFT16( pNLSF_Q8[ i ], 15 - NLSF_Q_DOMAIN_STAGE_2_TO_LAST ) + SKP_FIX_CONST( 0.5f, 15 );
     }
 
     /* NLSF stabilization */
diff --git a/src_FIX/SKP_Silk_NLSF_MSVQ_encode_FIX.c b/src_common/SKP_Silk_NLSF_MSVQ_encode.c
similarity index 91%
rename from src_FIX/SKP_Silk_NLSF_MSVQ_encode_FIX.c
rename to src_common/SKP_Silk_NLSF_MSVQ_encode.c
index 81a5edd44e5a83a6a631b9078a5b0c7c59fb5fc6..343e1fd80a4b68ad586193a2e43f284226022fa9 100644
--- a/src_FIX/SKP_Silk_NLSF_MSVQ_encode_FIX.c
+++ b/src_common/SKP_Silk_NLSF_MSVQ_encode.c
@@ -25,17 +25,17 @@ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 ***********************************************************************/
 
-#include "SKP_Silk_main_FIX.h"
+#include "SKP_Silk_main.h"
 
 /***********************/
 /* NLSF vector encoder */
 /***********************/
-void SKP_Silk_NLSF_MSVQ_encode_FIX(
+void SKP_Silk_NLSF_MSVQ_encode(
           SKP_int8                  *NLSFIndices,           /* O    Codebook path vector [ CB_STAGES ]      */
           SKP_int                   *pNLSF_Q15,             /* I/O  Quantized NLSF vector [ LPC_ORDER ]     */
     const SKP_Silk_NLSF_CB_struct   *psNLSF_CB,             /* I    Codebook object                         */
     const SKP_int                   *pNLSF_q_Q15_prev,      /* I    Prev. quantized NLSF vector [LPC_ORDER] */
-    const SKP_int                   *pW_Q6,                 /* I    NLSF weight vector [ LPC_ORDER ]        */
+    const SKP_int                   *pW_Q5,                 /* I    NLSF weight vector [ LPC_ORDER ]        */
     const SKP_int                   NLSF_mu_Q15,            /* I    Rate weight for the RD optimization     */
     const SKP_int                   NLSF_mu_fluc_red_Q16,   /* I    Fluctuation reduction error weight      */
     const SKP_int                   NLSF_MSVQ_Survivors,    /* I    Max survivors from each stage           */
@@ -50,8 +50,8 @@ void SKP_Silk_NLSF_MSVQ_encode_FIX(
 #endif
 
     SKP_int32   pRateDist_Q18[  NLSF_MSVQ_TREE_SEARCH_MAX_VECTORS_EVALUATED ];
-    SKP_int32   pRate_Q5[       MAX_NLSF_MSVQ_SURVIVORS ];
-    SKP_int32   pRate_new_Q5[   MAX_NLSF_MSVQ_SURVIVORS ];
+    SKP_int32   pRate_Q4[       MAX_NLSF_MSVQ_SURVIVORS ];
+    SKP_int32   pRate_new_Q4[   MAX_NLSF_MSVQ_SURVIVORS ];
     SKP_int     pTempIndices[   MAX_NLSF_MSVQ_SURVIVORS ];
     SKP_int8    pPath[          MAX_NLSF_MSVQ_SURVIVORS * NLSF_MSVQ_MAX_CB_STAGES ];
     SKP_int8    pPath_new[      MAX_NLSF_MSVQ_SURVIVORS * NLSF_MSVQ_MAX_CB_STAGES ];
@@ -69,7 +69,7 @@ void SKP_Silk_NLSF_MSVQ_encode_FIX(
 
 #ifdef SAVE_ALL_INTERNAL_DATA
     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( WNLSF.dat,   pW_Q5,        LPC_order * sizeof( SKP_int   ) );
     DEBUG_STORE_DATA( NLSF_mu.dat, &NLSF_mu_Q15,             sizeof( SKP_int32 ) );
 #endif
 
@@ -78,7 +78,7 @@ void SKP_Silk_NLSF_MSVQ_encode_FIX(
     /****************************************************/
 
     /* Clear accumulated rates */
-    SKP_memset( pRate_Q5, 0, NLSF_MSVQ_Survivors * sizeof( SKP_int32 ) );
+    SKP_memset( pRate_Q4, 0, NLSF_MSVQ_Survivors * sizeof( SKP_int32 ) );
 
     /* Subtract 1/2 from NLSF input vector to create initial residual */
     for( i = 0; i < LPC_order; i++ ) {
@@ -109,8 +109,8 @@ void SKP_Silk_NLSF_MSVQ_encode_FIX(
 #endif
 
         /* Nearest neighbor clustering for multiple input data vectors */
-        SKP_Silk_NLSF_VQ_rate_distortion_FIX( pRateDist_Q18, pCurrentCBStage, pRes_Q15, pW_Q6, 
-            pRate_Q5, NLSF_mu_Q15, prev_survivors, LPC_order );
+        SKP_Silk_NLSF_VQ_rate_distortion( pRateDist_Q18, pCurrentCBStage, pRes_Q15, pW_Q5, 
+            pRate_Q4, NLSF_mu_Q15, prev_survivors, s, LPC_order );
 
         /* Sort the rate-distortion errors */
         SKP_Silk_insertion_sort_increasing( pRateDist_Q18, pTempIndices, 
@@ -150,7 +150,7 @@ void SKP_Silk_NLSF_MSVQ_encode_FIX(
             }
 
             /* Update accumulated rate for stage 1 to the current */
-            pRate_new_Q5[ k ] = pRate_Q5[ input_index ] + SKP_LSHIFT32( ( SKP_int32 )pCurrentCBStage->Rates_Q4[ cb_index ], 1 );
+            pRate_new_Q4[ k ] = pRate_Q4[ input_index ] + pCurrentCBStage->Rates_Q4[ cb_index ];
 
             /* Copy paths from previous matrix, starting with the best path */
             pConstInt8 = &pPath[ SKP_SMULBB( input_index, psNLSF_CB->nStages ) ];
@@ -167,7 +167,7 @@ void SKP_Silk_NLSF_MSVQ_encode_FIX(
             SKP_memcpy( pRes_Q15, pRes_new_Q15, SKP_SMULBB( cur_survivors, LPC_order ) * sizeof( SKP_int16 ) );
 
             /* Copy rate vector for next stage */
-            SKP_memcpy( pRate_Q5, pRate_new_Q5, cur_survivors * sizeof( SKP_int32 ) );
+            SKP_memcpy( pRate_Q4, pRate_new_Q4, cur_survivors * sizeof( SKP_int32 ) );
 
             /* Copy best path matrix for next stage */
             SKP_memcpy( pPath, pPath_new, SKP_SMULBB( cur_survivors, psNLSF_CB->nStages ) * sizeof( SKP_int8) );
@@ -196,11 +196,11 @@ void SKP_Silk_NLSF_MSVQ_encode_FIX(
             for( i = 0; i < LPC_order; i += 2 ) {
                 /* Compute weighted squared quantization error for index i */
                 se_Q15 = pNLSF_Q15[ i ] - pNLSF_q_Q15_prev[ i ]; // range: [ -32767 : 32767 ]
-                wsse_Q20 = SKP_SMLAWB( wsse_Q20, SKP_SMULBB( se_Q15, se_Q15 ), pW_Q6[ i ] );
+                wsse_Q20 = SKP_SMLAWB( wsse_Q20, SKP_SMULBB( se_Q15, se_Q15 ), pW_Q5[ i ] );
 
                 /* Compute weighted squared quantization error for index i + 1 */
                 se_Q15 = pNLSF_Q15[ i + 1 ] - pNLSF_q_Q15_prev[ i + 1 ]; // range: [ -32767 : 32767 ]
-                wsse_Q20 = SKP_SMLAWB( wsse_Q20, SKP_SMULBB( se_Q15, se_Q15 ), pW_Q6[ i + 1 ] );
+                wsse_Q20 = SKP_SMLAWB( wsse_Q20, SKP_SMULBB( se_Q15, se_Q15 ), pW_Q5[ i + 1 ] );
             }
             SKP_assert( wsse_Q20 >= 0 );
 
diff --git a/src_FIX/SKP_Silk_NLSF_VQ_rate_distortion_FIX.c b/src_common/SKP_Silk_NLSF_VQ_rate_distortion.c
similarity index 75%
rename from src_FIX/SKP_Silk_NLSF_VQ_rate_distortion_FIX.c
rename to src_common/SKP_Silk_NLSF_VQ_rate_distortion.c
index 0caf4a56a526ad01ce72d9f418037b3b244a9e8c..7b16fd5256c5d6504f01d31e4c73300a6a430720 100644
--- a/src_FIX/SKP_Silk_NLSF_VQ_rate_distortion_FIX.c
+++ b/src_common/SKP_Silk_NLSF_VQ_rate_distortion.c
@@ -25,37 +25,38 @@ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 ***********************************************************************/
 
-#include "SKP_Silk_main_FIX.h"
+#include "SKP_Silk_main.h"
 
 /* Rate-Distortion calculations for multiple input data vectors */
-void SKP_Silk_NLSF_VQ_rate_distortion_FIX(
-    SKP_int32                       *pRD_Q20,           /* O    Rate-distortion values [psNLSF_CBS->nVectors*N] */
+void SKP_Silk_NLSF_VQ_rate_distortion(
+    SKP_int32                       *pRD_Q19,           /* O    Rate-distortion values [psNLSF_CBS->nVectors*N] */
     const SKP_Silk_NLSF_CBS         *psNLSF_CBS,        /* I    NLSF codebook stage struct                      */
     const SKP_int16                 *in_Q15,            /* I    Input vectors to be quantized                   */
-    const SKP_int                   *w_Q6,              /* I    Weight vector                                   */
-    const SKP_int32                 *rate_acc_Q5,       /* I    Accumulated rates from previous stage           */
+    const SKP_int                   *w_Q5,              /* I    Weight vector                                   */
+    const SKP_int32                 *rate_acc_Q4,       /* I    Accumulated rates from previous stage           */
     const SKP_int                   mu_Q15,             /* I    Weight between weighted error and rate          */
     const SKP_int                   N,                  /* I    Number of input vectors to be quantized         */
+    const SKP_int                   stage,              /* I    Stage number                                */
     const SKP_int                   LPC_order           /* I    LPC order                                       */
 )
 {
     SKP_int   i, n;
-    SKP_int32 *pRD_vec_Q20;
+    SKP_int32 *pRD_vec_Q19;
 
     /* Compute weighted quantization errors for all input vectors over one codebook stage */
-    SKP_Silk_NLSF_VQ_sum_error_FIX( pRD_Q20, in_Q15, w_Q6, psNLSF_CBS->CB_NLSF_Q8, 
-        N, psNLSF_CBS->nVectors, LPC_order );
+    SKP_Silk_NLSF_VQ_sum_error( pRD_Q19, in_Q15, w_Q5, psNLSF_CBS->CB_NLSF_Q8, 
+        N, psNLSF_CBS->nVectors, stage, LPC_order );
 
     /* Loop over input vectors */
-    pRD_vec_Q20 = pRD_Q20;
+    pRD_vec_Q19 = pRD_Q19;
     for( n = 0; n < N; n++ ) {
         /* Add rate cost to error for each codebook vector */
         for( i = 0; i < psNLSF_CBS->nVectors; i++ ) {
-            SKP_assert( rate_acc_Q5[ n ] + SKP_LSHIFT32( ( SKP_int32 )psNLSF_CBS->Rates_Q4[ i ], 1 ) >= 0 );
-            SKP_assert( rate_acc_Q5[ n ] + SKP_LSHIFT32( ( SKP_int32 )psNLSF_CBS->Rates_Q4[ i ], 1 ) <= SKP_int16_MAX );
-            pRD_vec_Q20[ i ] = SKP_SMLABB( pRD_vec_Q20[ i ], rate_acc_Q5[ n ] + SKP_LSHIFT32( ( SKP_int32 )psNLSF_CBS->Rates_Q4[ i ], 1 ), mu_Q15 );
-            SKP_assert( pRD_vec_Q20[ i ] >= 0 );
+            SKP_assert( rate_acc_Q4[ n ] + SKP_LSHIFT32( ( SKP_int32 )psNLSF_CBS->Rates_Q4[ i ], 1 ) >= 0 );
+            SKP_assert( rate_acc_Q4[ n ] + SKP_LSHIFT32( ( SKP_int32 )psNLSF_CBS->Rates_Q4[ i ], 1 ) <= SKP_int16_MAX );
+            pRD_vec_Q19[ i ] = SKP_SMLABB( pRD_vec_Q19[ i ], rate_acc_Q4[ n ] + psNLSF_CBS->Rates_Q4[ i ], mu_Q15 );
+            SKP_assert( pRD_vec_Q19[ i ] >= 0 );
         }
-        pRD_vec_Q20 += psNLSF_CBS->nVectors;
+        pRD_vec_Q19 += psNLSF_CBS->nVectors;
     }
 }
diff --git a/src_common/SKP_Silk_NLSF_VQ_sum_error.c b/src_common/SKP_Silk_NLSF_VQ_sum_error.c
new file mode 100644
index 0000000000000000000000000000000000000000..bb52c51fd7643d04da02f47a217e69c389050902
--- /dev/null
+++ b/src_common/SKP_Silk_NLSF_VQ_sum_error.c
@@ -0,0 +1,107 @@
+/***********************************************************************
+Copyright (c) 2006-2011, 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"
+
+/* Compute weighted quantization errors for an LPC_order element input vector, over one codebook stage */
+void SKP_Silk_NLSF_VQ_sum_error(
+    SKP_int32                       *err_Q19,           /* O    Weighted quantization errors  [N*K]         */
+    const SKP_int16                 *in_Q15,            /* I    Input vectors to be quantized [N*LPC_order] */
+    const SKP_int                   *w_Q5,              /* I    Weighting vectors             [LPC_order]   */
+    const SKP_int8                  *pCB_Q8,            /* I    Codebook vectors              [K*LPC_order] */
+    const SKP_int                   N,                  /* I    Number of input vectors                     */
+    const SKP_int                   K,                  /* I    Number of codebook vectors                  */
+    const SKP_int                   stage,              /* I    Stage number                                */
+    const SKP_int                   LPC_order           /* I    Number of LPCs                              */
+)
+{
+    SKP_int        i, n, m;
+    SKP_int32      diff_Q15, sum_error, Wtmp_Q5;
+    SKP_int32      Wcpy_Q5[ MAX_LPC_ORDER / 2 ];
+    const SKP_int8 *cb_vec_Q8;
+
+    SKP_assert( LPC_order <= 16 );
+    SKP_assert( ( LPC_order & 1 ) == 0 );
+
+    /* Copy to local stack and pack two weights per int32 */
+    for( m = 0; m < SKP_RSHIFT( LPC_order, 1 ); m++ ) {
+        Wcpy_Q5[ m ] = w_Q5[ 2 * m ] | SKP_LSHIFT( ( SKP_int32 )w_Q5[ 2 * m + 1 ], 16 );
+    }
+
+    if( stage == 0 ) {
+        /* Loop over input vectors */
+        for( n = 0; n < N; n++ ) {
+            /* Loop over codebook */
+            cb_vec_Q8 = pCB_Q8;
+            for( i = 0; i < K; i++ ) {
+                sum_error = 0;
+                for( m = 0; m < LPC_order; m += 2 ) {
+                    /* Get two weights packed in an int32 */
+                    Wtmp_Q5 = Wcpy_Q5[ m >> 1 ];
+
+                    /* Compute weighted squared quantization error for index m */
+                    diff_Q15 = in_Q15[ m ] - SKP_LSHIFT16( ( SKP_int16 )( *cb_vec_Q8++ ), 15 - NLSF_Q_DOMAIN_STAGE_0 ); // range: [ -32767 : 32767 ]
+                    sum_error = SKP_SMLAWB( sum_error, SKP_SMULBB( diff_Q15, diff_Q15 ), Wtmp_Q5 );
+
+                    /* Compute weighted squared quantization error for index m + 1 */
+                    diff_Q15 = in_Q15[m + 1] - SKP_LSHIFT16( ( SKP_int16 )( *cb_vec_Q8++ ), 15 - NLSF_Q_DOMAIN_STAGE_0 ); // range: [ -32767 : 32767 ]
+                    sum_error = SKP_SMLAWT( sum_error, SKP_SMULBB( diff_Q15, diff_Q15 ), Wtmp_Q5 );
+                }
+                SKP_assert( sum_error >= 0 );
+                err_Q19[ i ] = sum_error;
+            }
+            err_Q19 += K;
+            in_Q15 += LPC_order;
+        }
+    } else {
+        /* Loop over input vectors */
+        for( n = 0; n < N; n++ ) {
+            /* Loop over codebook */
+            cb_vec_Q8 = pCB_Q8;
+            for( i = 0; i < K; i++ ) {
+                sum_error = 0;
+                for( m = 0; m < LPC_order; m += 2 ) {
+                    /* Get two weights packed in an int32 */
+                    Wtmp_Q5 = Wcpy_Q5[ m >> 1 ];
+
+                    /* Compute weighted squared quantization error for index m */
+                    diff_Q15 = in_Q15[ m ] - SKP_LSHIFT16( ( SKP_int16 )( *cb_vec_Q8++ ), 15 - NLSF_Q_DOMAIN_STAGE_2_TO_LAST ); // range: [ -32767 : 32767 ]
+                    sum_error = SKP_SMLAWB( sum_error, SKP_SMULBB( diff_Q15, diff_Q15 ), Wtmp_Q5 );
+
+                    /* Compute weighted squared quantization error for index m + 1 */
+                    diff_Q15 = in_Q15[m + 1] - SKP_LSHIFT16( ( SKP_int16 )( *cb_vec_Q8++ ), 15 - NLSF_Q_DOMAIN_STAGE_2_TO_LAST ); // range: [ -32767 : 32767 ]
+                    sum_error = SKP_SMLAWT( sum_error, SKP_SMULBB( diff_Q15, diff_Q15 ), Wtmp_Q5 );
+                }
+                SKP_assert( sum_error >= 0 );
+                err_Q19[ i ] = sum_error;
+            }
+            err_Q19 += K;
+            in_Q15 += LPC_order;
+        }
+    }
+}
+
diff --git a/src_common/SKP_Silk_NSQ.c b/src_common/SKP_Silk_NSQ.c
index 8eea9014bfe29e1e1d5a9d93ceecb4822686537c..4aa918ff13090110dc221a073ced8d8a0ea65c92 100644
--- a/src_common/SKP_Silk_NSQ.c
+++ b/src_common/SKP_Silk_NSQ.c
@@ -89,10 +89,10 @@ void SKP_Silk_NSQ(
     SKP_int     offset_Q10;
     SKP_int32   x_sc_Q10[ MAX_FRAME_LENGTH / MAX_NB_SUBFR ];
 
-    NSQ->rand_seed  =  psIndices->Seed;
+    NSQ->rand_seed = psIndices->Seed;
 
     /* Set unvoiced lag to the previous one, overwrite later for voiced */
-    lag             = NSQ->lagPrev;
+    lag = NSQ->lagPrev;
 
     SKP_assert( NSQ->prev_inv_gain_Q16 != 0 );
 
diff --git a/src_common/SKP_Silk_VAD.c b/src_common/SKP_Silk_VAD.c
index 96ca24bf1f3d812e328ee7bca1e66d653df382b9..cecdce211d17be20a095ff0ac739d293a447734a 100644
--- a/src_common/SKP_Silk_VAD.c
+++ b/src_common/SKP_Silk_VAD.c
@@ -28,8 +28,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include <stdlib.h>
 #include "SKP_Silk_main.h"
 
-#define SKP_SILK_VAD_HANDLE_10MS_FRAMES     1
-
 /**********************************/
 /* Initialization of the Silk VAD */
 /**********************************/
@@ -69,55 +67,44 @@ const static SKP_int32 tiltWeights[ VAD_N_BANDS ] = { 30000, 6000, -12000, -1200
 /***************************************/
 /* Get the speech activity level in Q8 */
 /***************************************/
-SKP_int SKP_Silk_VAD_GetSA_Q8(                                  /* O    Return value, 0 if success      */
-    SKP_Silk_VAD_state          *psSilk_VAD,                    /* I/O  Silk VAD state                  */
-    SKP_int                     *pSA_Q8,                        /* O    Speech activity level in Q8     */
-    SKP_int                     *pSNR_dB_Q7,                    /* O    SNR for current frame in Q7     */
-    SKP_int                     pQuality_Q15[ VAD_N_BANDS ],    /* O    Smoothed SNR for each band      */
-    SKP_int                     *pTilt_Q15,                     /* O    current frame's frequency tilt  */
-    const SKP_int16             pIn[],                          /* I    PCM input       [framelength]   */
-    const SKP_int               framelength,                    /* I    Input frame length              */
-    const SKP_int               fs_kHz                          /* I    Input frame sample frequency    */
+SKP_int SKP_Silk_VAD_GetSA_Q8(                      /* O    Return value, 0 if success                  */
+    SKP_Silk_encoder_state      *psEncC,            /* I/O  Encoder state                               */
+    const SKP_int16             pIn[]               /* I    PCM input                                   */
 )
 {
-    SKP_int   SA_Q15, input_tilt;
-    SKP_int32 scratch[ 3 * MAX_FRAME_LENGTH / 2 ];
+    SKP_int   SA_Q15, pSNR_dB_Q7, input_tilt;
     SKP_int   decimated_framelength, dec_subframe_length, dec_subframe_offset, SNR_Q7, i, b, s;
     SKP_int32 sumSquared, smooth_coef_Q16;
     SKP_int16 HPstateTmp;
-
     SKP_int16 X[ VAD_N_BANDS ][ MAX_FRAME_LENGTH / 2 ];
     SKP_int32 Xnrg[ VAD_N_BANDS ];
     SKP_int32 NrgToNoiseRatio_Q8[ VAD_N_BANDS ];
     SKP_int32 speech_nrg, x_tmp;
     SKP_int   ret = 0;
-    
-#if SKP_SILK_VAD_HANDLE_10MS_FRAMES
-    SKP_int   normalizer;
-#endif
+    SKP_Silk_VAD_state *psSilk_VAD = &psEncC->sVAD;
 
     /* Safety checks */
     SKP_assert( VAD_N_BANDS == 4 );
-    SKP_assert( MAX_FRAME_LENGTH >= framelength );
-    SKP_assert( framelength <= 512 );
-    SKP_assert( framelength == 8 * SKP_RSHIFT( framelength, 3 ) );
+    SKP_assert( MAX_FRAME_LENGTH >= psEncC->frame_length );
+    SKP_assert( psEncC->frame_length <= 512 );
+    SKP_assert( psEncC->frame_length == 8 * SKP_RSHIFT( psEncC->frame_length, 3 ) );
 
     /***********************/
     /* Filter and Decimate */
     /***********************/
     /* 0-8 kHz to 0-4 kHz and 4-8 kHz */
-    SKP_Silk_ana_filt_bank_1( pIn,          &psSilk_VAD->AnaState[  0 ], &X[ 0 ][ 0 ], &X[ 3 ][ 0 ], &scratch[ 0 ], framelength );        
+    SKP_Silk_ana_filt_bank_1( pIn,          &psSilk_VAD->AnaState[  0 ], &X[ 0 ][ 0 ], &X[ 3 ][ 0 ], psEncC->frame_length );        
     
     /* 0-4 kHz to 0-2 kHz and 2-4 kHz */
-    SKP_Silk_ana_filt_bank_1( &X[ 0 ][ 0 ], &psSilk_VAD->AnaState1[ 0 ], &X[ 0 ][ 0 ], &X[ 2 ][ 0 ], &scratch[ 0 ], SKP_RSHIFT( framelength, 1 ) );
+    SKP_Silk_ana_filt_bank_1( &X[ 0 ][ 0 ], &psSilk_VAD->AnaState1[ 0 ], &X[ 0 ][ 0 ], &X[ 2 ][ 0 ], SKP_RSHIFT( psEncC->frame_length, 1 ) );
     
     /* 0-2 kHz to 0-1 kHz and 1-2 kHz */
-    SKP_Silk_ana_filt_bank_1( &X[ 0 ][ 0 ], &psSilk_VAD->AnaState2[ 0 ], &X[ 0 ][ 0 ], &X[ 1 ][ 0 ], &scratch[ 0 ], SKP_RSHIFT( framelength, 2 ) );
+    SKP_Silk_ana_filt_bank_1( &X[ 0 ][ 0 ], &psSilk_VAD->AnaState2[ 0 ], &X[ 0 ][ 0 ], &X[ 1 ][ 0 ], SKP_RSHIFT( psEncC->frame_length, 2 ) );
 
     /*********************************************/
     /* HP filter on lowest band (differentiator) */
     /*********************************************/
-    decimated_framelength = SKP_RSHIFT( framelength, 3 );
+    decimated_framelength = SKP_RSHIFT( psEncC->frame_length, 3 );
     X[ 0 ][ decimated_framelength - 1 ] = SKP_RSHIFT( X[ 0 ][ decimated_framelength - 1 ], 1 );
     HPstateTmp = X[ 0 ][ decimated_framelength - 1 ];
     for( i = decimated_framelength - 1; i > 0; i-- ) {
@@ -132,7 +119,7 @@ SKP_int SKP_Silk_VAD_GetSA_Q8(                                  /* O    Return v
     /*************************************/
     for( b = 0; b < VAD_N_BANDS; b++ ) {        
         /* Find the decimated framelength in the non-uniformly divided bands */
-        decimated_framelength = SKP_RSHIFT( framelength, SKP_min_int( VAD_N_BANDS - b, VAD_N_BANDS - 1 ) );
+        decimated_framelength = SKP_RSHIFT( psEncC->frame_length, SKP_min_int( VAD_N_BANDS - b, VAD_N_BANDS - 1 ) );
 
         /* Split length into subframe lengths */
         dec_subframe_length = SKP_RSHIFT( decimated_framelength, VAD_INTERNAL_SUBFRAMES_LOG2 );
@@ -207,17 +194,17 @@ SKP_int SKP_Silk_VAD_GetSA_Q8(                                  /* O    Return v
     sumSquared = SKP_DIV32_16( sumSquared, VAD_N_BANDS ); /* Q14 */
 
     /* Root-mean-square approximation, scale to dBs, and write to output pointer */
-    *pSNR_dB_Q7 = ( SKP_int16 )( 3 * SKP_Silk_SQRT_APPROX( sumSquared ) ); /* Q7 */
+    pSNR_dB_Q7 = ( SKP_int16 )( 3 * SKP_Silk_SQRT_APPROX( sumSquared ) ); /* Q7 */
 
     /*********************************/
     /* Speech Probability Estimation */
     /*********************************/
-    SA_Q15 = SKP_Silk_sigm_Q15( SKP_SMULWB( VAD_SNR_FACTOR_Q16, *pSNR_dB_Q7 ) - VAD_NEGATIVE_OFFSET_Q5 );
+    SA_Q15 = SKP_Silk_sigm_Q15( SKP_SMULWB( VAD_SNR_FACTOR_Q16, pSNR_dB_Q7 ) - VAD_NEGATIVE_OFFSET_Q5 );
 
     /**************************/
     /* Frequency Tilt Measure */
     /**************************/
-    *pTilt_Q15 = SKP_LSHIFT( SKP_Silk_sigm_Q15( input_tilt ) - 16384, 1 );
+    psEncC->input_tilt_Q15 = SKP_LSHIFT( SKP_Silk_sigm_Q15( input_tilt ) - 16384, 1 );
 
     /**************************************************/
     /* Scale the sigmoid output based on power levels */
@@ -232,24 +219,19 @@ SKP_int SKP_Silk_VAD_GetSA_Q8(                                  /* O    Return v
     if( speech_nrg <= 0 ) {
         SA_Q15 = SKP_RSHIFT( SA_Q15, 1 ); 
     } else if( speech_nrg < 32768 ) {
-        
-#if SKP_SILK_VAD_HANDLE_10MS_FRAMES
-        /* Energy normalization of frames shorter than 320 samples */
-        normalizer = 0;
-        while( SKP_LSHIFT( framelength, normalizer ) < 320 ) {
-            normalizer++;
+        if( psEncC->frame_length == 10 * psEncC->fs_kHz ) {
+            speech_nrg = SKP_LSHIFT_SAT32( speech_nrg, 16 );
+        } else {
+            speech_nrg = SKP_LSHIFT_SAT32( speech_nrg, 15 );
         }
-        speech_nrg = SKP_LSHIFT_SAT32( speech_nrg, 15 + normalizer );
-#else
-        speech_nrg = SKP_LSHIFT_SAT32( speech_nrg, 15 );
-#endif
+
         /* square-root */
         speech_nrg = SKP_Silk_SQRT_APPROX( speech_nrg );
         SA_Q15 = SKP_SMULWB( 32768 + speech_nrg, SA_Q15 ); 
     }
 
-    /* Copy the resulting speech activity in Q8 to *pSA_Q8 */
-    *pSA_Q8 = SKP_min_int( SKP_RSHIFT( SA_Q15, 7 ), SKP_uint8_MAX );
+    /* Copy the resulting speech activity in Q8 */
+    psEncC->speech_activity_Q8 = SKP_min_int( SKP_RSHIFT( SA_Q15, 7 ), SKP_uint8_MAX );
 
     /***********************************/
     /* Energy Level and SNR estimation */
@@ -257,13 +239,11 @@ SKP_int SKP_Silk_VAD_GetSA_Q8(                                  /* O    Return v
     /* Smoothing coefficient */
     smooth_coef_Q16 = SKP_SMULWB( VAD_SNR_SMOOTH_COEF_Q18, SKP_SMULWB( SA_Q15, SA_Q15 ) );
     
-#if SKP_SILK_VAD_HANDLE_10MS_FRAMES
-    if( framelength == 10 * fs_kHz ) {
+    if( psEncC->frame_length == 10 * psEncC->fs_kHz ) {
         smooth_coef_Q16 >>= 1;
     } else {
-       SKP_assert( framelength == 20 * fs_kHz );
+       SKP_assert( psEncC->frame_length == 20 * psEncC->fs_kHz );
     }
-#endif
 
     for( b = 0; b < VAD_N_BANDS; b++ ) {
         /* compute smoothed energy-to-noise ratio per band */
@@ -273,7 +253,7 @@ SKP_int SKP_Silk_VAD_GetSA_Q8(                                  /* O    Return v
         /* signal to noise ratio in dB per band */
         SNR_Q7 = 3 * ( SKP_Silk_lin2log( psSilk_VAD->NrgRatioSmth_Q8[b] ) - 8 * 128 );
         /* quality = sigmoid( 0.25 * ( SNR_dB - 16 ) ); */
-        pQuality_Q15[ b ] = SKP_Silk_sigm_Q15( SKP_RSHIFT( SNR_Q7 - 16 * 128, 4 ) );
+        psEncC->input_quality_bands_Q15[ b ] = SKP_Silk_sigm_Q15( SKP_RSHIFT( SNR_Q7 - 16 * 128, 4 ) );
     }
 
     return( ret );
diff --git a/src_common/SKP_Silk_control_audio_bandwidth.c b/src_common/SKP_Silk_control_audio_bandwidth.c
index 6b728da6184d8b03e2e5e1a86ad51c4189195b8c..efa482a4e9e59a2a61fef3889264fc6154f176c4 100644
--- a/src_common/SKP_Silk_control_audio_bandwidth.c
+++ b/src_common/SKP_Silk_control_audio_bandwidth.c
@@ -62,76 +62,51 @@ SKP_int SKP_Silk_control_audio_bandwidth(
         fs_kHz = SKP_max( fs_kHz, psEncC->minInternal_fs_kHz );
     } else {
         /* State machine for the internal sampling rate switching */
-        if( psEncC->API_fs_Hz > 8000 ) {
-            /* Accumulate the difference between the target rate and limit for switching down */
-            psEncC->bitrateDiff += SKP_MUL( psEncC->PacketSize_ms, TargetRate_bps - psEncC->bitrate_threshold_down );
-            psEncC->bitrateDiff  = SKP_min( psEncC->bitrateDiff, 0 );
+        if( psEncC->API_fs_Hz > 8000 && psEncC->prevSignalType == TYPE_NO_VOICE_ACTIVITY ) { /* Low speech activity */
+            /* Check if we should switch down */
+            if( ( psEncC->fs_kHz == 12 && TargetRate_bps < MB2NB_BITRATE_BPS && psEncC->minInternal_fs_kHz <=  8 ) ||
+                ( psEncC->fs_kHz == 16 && TargetRate_bps < WB2MB_BITRATE_BPS && psEncC->minInternal_fs_kHz <= 12 ) ) 
+            {
+                /* Switch down */
+                if( SWITCH_TRANSITION_FILTERING && psEncC->sLP.mode == 0 ) {
+                    /* New transition */
+                    psEncC->sLP.transition_frame_no = TRANSITION_FRAMES;
 
-            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 */
-                    ( psEncC->bitrateDiff <= -ACCUM_BITS_DIFF_THRESHOLD ) ) {           /* Bitrate threshold is met */
-                        psEncC->sLP.transition_frame_no = 1;                            /* Begin transition phase */
-                        psEncC->sLP.mode                = 0;                            /* Switch down */
-                } else if( 
-                    ( psEncC->sLP.transition_frame_no >= TRANSITION_FRAMES_DOWN ) &&    /* Transition phase complete */
-                    ( psEncC->sLP.mode == 0 ) ) {                                       /* Ready to switch down */
-                        psEncC->sLP.transition_frame_no = 0;                            /* Ready for new transition phase */
-#else
-                if( psEncC->bitrateDiff <= -ACCUM_BITS_DIFF_THRESHOLD ) {               /* Bitrate threshold is met */ 
-#endif            
-                    psEncC->bitrateDiff = 0;
+                    /* Reset transition filter state */
+                    SKP_memset( psEncC->sLP.In_LP_State, 0, sizeof( psEncC->sLP.In_LP_State ) );
+                } 
+                if( psEncC->sLP.transition_frame_no <= 0 ) {
+                    /* Stop transition phase */
+                    psEncC->sLP.mode = 0;
 
                     /* Switch to a lower sample frequency */
-                    if( psEncC->fs_kHz == 24 ) {
-                        fs_kHz = 16;
-                    } else if( psEncC->fs_kHz == 16 ) {
-                        fs_kHz = 12;
-                    } else {
-                        SKP_assert( psEncC->fs_kHz == 12 );
-                        fs_kHz = 8;
-                    }
-                }
-
-                /* Check if we should switch up */
-                if( ( ( psEncC->fs_kHz * 1000 < psEncC->API_fs_Hz ) &&
-                    ( TargetRate_bps > psEncC->bitrate_threshold_up ) ) && 
-                    ( ( psEncC->fs_kHz == 12 ) && ( psEncC->maxInternal_fs_kHz >= 16 ) ||
-                    ( psEncC->fs_kHz ==  8 ) && ( psEncC->maxInternal_fs_kHz >= 12 ) ) 
-#if SWITCH_TRANSITION_FILTERING
-                    && ( psEncC->sLP.transition_frame_no == 0 ) )  /* No transition phase running, ready to switch */
-                {
-                    psEncC->sLP.mode = 1; /* Switch up */
-#else
-                ) {
-#endif
-                    psEncC->bitrateDiff = 0;
-
+                    fs_kHz = psEncC->fs_kHz == 16 ? 12 : 8;
+                } else {
+                    /* Direction: down (at double speed) */
+                    psEncC->sLP.mode = -2;
+                } 
+            } 
+            else
+            if( ( psEncC->fs_kHz ==  8 && TargetRate_bps > NB2MB_BITRATE_BPS && psEncC->maxInternal_fs_kHz >= 12 && psEncC->API_fs_Hz >= 12000 ) ||
+                ( psEncC->fs_kHz == 12 && TargetRate_bps > MB2WB_BITRATE_BPS && psEncC->maxInternal_fs_kHz >= 16 && psEncC->API_fs_Hz >= 16000 ) ) 
+            {
+                /* Switch up */
+                if( SWITCH_TRANSITION_FILTERING && psEncC->sLP.mode == 0 ) {
                     /* Switch to a higher sample frequency */
-                    if( psEncC->fs_kHz == 8 ) {
-                        fs_kHz = 12;
-                    } else if( psEncC->fs_kHz == 12 ) {
-                        fs_kHz = 16;
-                    } else {
-                        SKP_assert( 0 );
-                    }
+                    fs_kHz = psEncC->fs_kHz == 8 ? 12 : 16;
+
+                    /* New transition */
+                    psEncC->sLP.transition_frame_no = 0;
+                } 
+                if( psEncC->sLP.transition_frame_no >= TRANSITION_FRAMES ) {
+                    /* Stop transition phase */
+                    psEncC->sLP.mode = 0;
+                } else {
+                    /* Direction: up */
+                    psEncC->sLP.mode = 1;
                 }
             }
         }
-
-#if SWITCH_TRANSITION_FILTERING
-        /* After switching up, stop transition filter during speech inactivity */
-        if( ( psEncC->sLP.mode == 1 ) &&
-            ( psEncC->sLP.transition_frame_no >= TRANSITION_FRAMES_UP ) && 
-            ( psEncC->prevSignalType == TYPE_NO_VOICE_ACTIVITY ) ) {
-
-                psEncC->sLP.transition_frame_no = 0;
-
-                /* Reset transition filter state */
-                SKP_memset( psEncC->sLP.In_LP_State, 0, 2 * sizeof( SKP_int32 ) );
-        }
-#endif
     }
 
 #ifdef FORCE_INTERNAL_FS_KHZ
diff --git a/src_common/SKP_Silk_decode_frame.c b/src_common/SKP_Silk_decode_frame.c
index b457b3207b8e4ed10d2d2091695dc20b7806e954..b09045026d6f1655823bf9eca863253e73ec5a6c 100644
--- a/src_common/SKP_Silk_decode_frame.c
+++ b/src_common/SKP_Silk_decode_frame.c
@@ -64,7 +64,6 @@ TIC(DECODE_FRAME)
     if( lostFlag != PACKET_LOST && psDec->nFramesDecoded == 0 ) {
         /* First decoder call for this payload */
         /* Decode VAD flags and LBRR flag */
-        SKP_uint8 iCDF[ 2 ] = { 128, 0 };
         flags = SKP_RSHIFT( psRangeDec->buf[ 0 ], 7 - psDec->nFramesPerPacket ) & 
             ( SKP_LSHIFT( 1, psDec->nFramesPerPacket + 1 ) - 1 );
         psDec->LBRR_flag = flags & 1;
@@ -73,7 +72,7 @@ TIC(DECODE_FRAME)
             psDec->VAD_flags[ i ] = flags & 1;
         }
         for( i = 0; i < psDec->nFramesPerPacket + 1; i++ ) {
-            ec_dec_icdf( psRangeDec, iCDF, 8 );
+            ec_dec_icdf( psRangeDec, SKP_Silk_uniform2_iCDF, 8 );
         }
        
         /* Decode LBRR flags */
diff --git a/src_common/SKP_Silk_define.h b/src_common/SKP_Silk_define.h
index 58f3ae4f50f14c7e91043baba53b2e8d93c527e6..61bbcbd064d832737bb9d5a77ee1110aeb594efb 100644
--- a/src_common/SKP_Silk_define.h
+++ b/src_common/SKP_Silk_define.h
@@ -58,10 +58,6 @@ extern "C"
 #define MB2WB_BITRATE_BPS                       16000
 #define MB2NB_BITRATE_BPS                        9000
 #define NB2MB_BITRATE_BPS                       12000
-
-/* Integration/hysteresis threshold for lowering internal sample frequency */
-/* 30000000 -> 6 sec if bitrate is 5000 bps below limit; 3 sec if bitrate is 10000 bps below limit */
-#define ACCUM_BITS_DIFF_THRESHOLD               30000000 
 #define TARGET_RATE_TAB_SZ                      8
 
 /* DTX settings                                 */
@@ -215,6 +211,9 @@ extern "C"
 #define NLSF_MSVQ_FLUCTUATION_REDUCTION         1
 #define MAX_NLSF_MSVQ_SURVIVORS                 16
 
+#define NLSF_Q_DOMAIN_STAGE_0                   8
+#define NLSF_Q_DOMAIN_STAGE_2_TO_LAST           8
+
 /* 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 ) )
 #   define NLSF_MSVQ_TREE_SEARCH_MAX_VECTORS_EVALUATED_LC_MODE  NLSF_MSVQ_MAX_VECTORS_IN_STAGE
@@ -232,15 +231,14 @@ extern "C"
 
 /* Transition filtering for mode switching */
 #if SWITCH_TRANSITION_FILTERING
-#  define TRANSITION_TIME_UP_MS                 5120 // 5120 = 64 * FRAME_LENGTH_MS * ( TRANSITION_INT_NUM - 1 ) = 64*(20*4)
-#  define TRANSITION_TIME_DOWN_MS               2560 // 2560 = 32 * FRAME_LENGTH_MS * ( TRANSITION_INT_NUM - 1 ) = 32*(20*4)
+#  define TRANSITION_TIME_MS                    5120 // 5120 = 64 * FRAME_LENGTH_MS * ( TRANSITION_INT_NUM - 1 ) = 64*(20*4)
 #  define TRANSITION_NB                         3 /* Hardcoded in tables */
 #  define TRANSITION_NA                         2 /* Hardcoded in tables */
 #  define TRANSITION_INT_NUM                    5 /* Hardcoded in tables */
-#  define TRANSITION_FRAMES_UP                  ( TRANSITION_TIME_UP_MS   / MAX_FRAME_LENGTH_MS ) // NB! needs to be made flexible for 10 ms frames
-#  define TRANSITION_FRAMES_DOWN                ( TRANSITION_TIME_DOWN_MS / MAX_FRAME_LENGTH_MS ) // NB! needs to be made flexible for 10 ms frames
-#  define TRANSITION_INT_STEPS_UP               ( TRANSITION_FRAMES_UP    / ( TRANSITION_INT_NUM - 1 )  )
-#  define TRANSITION_INT_STEPS_DOWN             ( TRANSITION_FRAMES_DOWN  / ( TRANSITION_INT_NUM - 1 )  )
+#  define TRANSITION_FRAMES                     ( TRANSITION_TIME_MS / MAX_FRAME_LENGTH_MS ) // todo: needs to be made flexible for 10 ms frames
+#  define TRANSITION_INT_STEPS                  ( TRANSITION_FRAMES  / ( TRANSITION_INT_NUM - 1 ) )
+#else
+#  define TRANSITION_FRAMES                     0
 #endif
 
 /* BWE factors to apply after packet loss */
diff --git a/src_common/SKP_Silk_enc_API.c b/src_common/SKP_Silk_enc_API.c
index 1c7b59cb9f443fd1a9c3bdf9fd7dec023ddf5f05..d2b6bacbe592e398113a84eb0080740fb6fc29fd 100644
--- a/src_common/SKP_Silk_enc_API.c
+++ b/src_common/SKP_Silk_enc_API.c
@@ -46,6 +46,74 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #endif
 #define SKP_Silk_EncodeControlStruct    SKP_SILK_SDK_EncControlStruct
 
+/**************************/
+/* Encode frame with Silk */
+/**************************/
+static SKP_int process_enc_control_struct( 
+    SKP_Silk_encoder_state_Fxx          *psEnc,         /* I/O: State                                           */
+    SKP_Silk_EncodeControlStruct        *encControl     /* I:   Control structure                               */
+)
+{
+    SKP_int   max_internal_fs_kHz, min_internal_fs_kHz, Complexity, PacketSize_ms, PacketLoss_perc, UseInBandFEC, ret = SKP_SILK_NO_ERROR;
+    SKP_int32 TargetRate_bps, API_fs_Hz;
+
+    SKP_assert( encControl != NULL );
+
+    /* Check sampling frequency first, to avoid divide by zero later */
+    if( ( ( encControl->API_sampleRate        !=  8000 ) &&
+          ( encControl->API_sampleRate        != 12000 ) &&
+          ( encControl->API_sampleRate        != 16000 ) &&
+          ( encControl->API_sampleRate        != 24000 ) && 
+          ( encControl->API_sampleRate        != 32000 ) &&
+          ( encControl->API_sampleRate        != 44100 ) &&
+          ( encControl->API_sampleRate        != 48000 ) ) ||
+        ( ( encControl->maxInternalSampleRate !=  8000 ) &&
+          ( encControl->maxInternalSampleRate != 12000 ) &&
+          ( encControl->maxInternalSampleRate != 16000 ) ) ||
+        ( ( encControl->minInternalSampleRate !=  8000 ) &&
+          ( encControl->minInternalSampleRate != 12000 ) &&
+          ( encControl->minInternalSampleRate != 16000 ) ) ||
+          ( encControl->minInternalSampleRate > encControl->maxInternalSampleRate ) ) {
+        ret = SKP_SILK_ENC_FS_NOT_SUPPORTED;
+        SKP_assert( 0 );
+        return( ret );
+    }
+    if( encControl->useDTX < 0 || encControl->useDTX > 1 ) {
+        ret = SKP_SILK_ENC_INVALID_DTX_SETTING;
+    }
+	if( encControl->useCBR < 0 || encControl->useCBR > 1 ) {
+        ret = SKP_SILK_ENC_INVALID_CBR_SETTING;
+    }
+
+    /* Set encoder parameters from control structure */
+    API_fs_Hz           =            encControl->API_sampleRate;
+    max_internal_fs_kHz = (SKP_int)( encControl->maxInternalSampleRate >> 10 ) + 1;   /* convert Hz -> kHz */
+    min_internal_fs_kHz = (SKP_int)( encControl->minInternalSampleRate >> 10 ) + 1;   /* convert Hz -> kHz */
+    PacketSize_ms       =            encControl->payloadSize_ms;
+    TargetRate_bps      =            encControl->bitRate;
+    PacketLoss_perc     =            encControl->packetLossPercentage;
+    UseInBandFEC        =            encControl->useInBandFEC;
+    Complexity          =            encControl->complexity;
+    psEnc->sCmn.useDTX  =            encControl->useDTX;
+	psEnc->sCmn.useCBR  =			 encControl->useCBR;
+
+    /* Save values in state */
+    psEnc->sCmn.API_fs_Hz          = API_fs_Hz;
+    psEnc->sCmn.maxInternal_fs_kHz = max_internal_fs_kHz;
+    psEnc->sCmn.minInternal_fs_kHz = min_internal_fs_kHz;
+    psEnc->sCmn.useInBandFEC       = UseInBandFEC;
+
+    TargetRate_bps = SKP_LIMIT( TargetRate_bps, MIN_TARGET_RATE_BPS, MAX_TARGET_RATE_BPS );
+    if( ( ret = SKP_Silk_control_encoder_Fxx( psEnc, PacketSize_ms, TargetRate_bps, 
+                        PacketLoss_perc, Complexity) ) != 0 ) {
+        SKP_assert( 0 );
+        return( ret );
+    }
+
+    encControl->internalSampleRate = SKP_SMULBB( psEnc->sCmn.fs_kHz, 1000 );
+    
+    return ret;
+}
 
 /****************************************/
 /* Encoder functions                    */
@@ -60,6 +128,33 @@ SKP_int SKP_Silk_SDK_Get_Encoder_Size( SKP_int32 *encSizeBytes )
     return ret;
 }
 
+/*************************/
+/* Init or Reset encoder */
+/*************************/
+SKP_int SKP_Silk_SDK_InitEncoder(
+    void                            *encState,          /* I/O: State                                           */
+    SKP_Silk_EncodeControlStruct    *encStatus          /* O:   Control structure                               */
+)
+{
+    SKP_Silk_encoder_state_Fxx *psEnc;
+    SKP_int ret = SKP_SILK_NO_ERROR;
+
+        
+    psEnc = ( SKP_Silk_encoder_state_Fxx* )encState;
+
+    /* Reset Encoder */
+    if( ret += SKP_Silk_init_encoder_Fxx( psEnc ) ) {
+        SKP_assert( 0 );
+    }
+
+    /* Read control structure */
+    if( ret += SKP_Silk_SDK_QueryEncoder( encState, encStatus ) ) {
+        SKP_assert( 0 );
+    }
+
+
+    return ret;
+}
 
 /***************************************/
 /* Read control structure from encoder */
@@ -88,30 +183,72 @@ SKP_int SKP_Silk_SDK_QueryEncoder(
     return ret;
 }
 
-/*************************/
-/* Init or Reset encoder */
-/*************************/
-SKP_int SKP_Silk_SDK_InitEncoder(
-    void                            *encState,          /* I/O: State                                           */
-    SKP_Silk_EncodeControlStruct    *encStatus          /* O:   Control structure                               */
+/*****************************/
+/* Prefill look-ahead buffer */
+/*****************************/
+#define MAX_PREFILL_LENGTH_MS       10
+SKP_int SKP_Silk_SDK_Encoder_prefill_buffer( 
+    void                                *encState,      /* I/O: State                                                       */
+    SKP_Silk_EncodeControlStruct        *encControl,    /* I:   Control structure                                           */
+    const SKP_int16                     *samplesIn,     /* I:   Speech sample input vector  (last part will be used)        */
+    SKP_int                             nSamplesIn      /* I:   Number of samples in input vector                           */
 )
 {
-    SKP_Silk_encoder_state_Fxx *psEnc;
-    SKP_int ret = SKP_SILK_NO_ERROR;
+    SKP_int start_ix, offset, nSamples, ret;
+    SKP_Silk_encoder_state_Fxx *psEnc = ( SKP_Silk_encoder_state_Fxx* )encState;
+    SKP_int16 buf[ MAX_PREFILL_LENGTH_MS * MAX_FS_KHZ ];
+    const SKP_int16 *in_ptr;
 
-        
-    psEnc = ( SKP_Silk_encoder_state_Fxx* )encState;
+    ret = process_enc_control_struct( psEnc, encControl );
 
-    /* Reset Encoder */
-    if( ret += SKP_Silk_init_encoder_Fxx( psEnc ) ) {
-        SKP_assert( 0 );
+    /* Compute some numbers at API sampling rate */
+    start_ix = nSamplesIn - SKP_DIV32_16( psEnc->sCmn.API_fs_Hz, 1000 / MAX_PREFILL_LENGTH_MS );     /* 10 ms */
+    if( start_ix < 0 ) {
+        offset = -start_ix;
+        start_ix = 0;
+    } else {
+        offset = 0;
     }
+    nSamples = nSamplesIn - start_ix;
 
-    /* Read control structure */
-    if( ret += SKP_Silk_SDK_QueryEncoder( encState, encStatus ) ) {
-        SKP_assert( 0 );
+    if( psEnc->sCmn.API_fs_Hz != SKP_SMULBB( 1000, psEnc->sCmn.fs_kHz ) ) { 
+        /* resample input */
+        ret += SKP_Silk_resampler( &psEnc->sCmn.resampler_state, buf, samplesIn + start_ix, nSamples );
+        in_ptr = buf;
+        /* Convert to internal sampling rate */
+        offset   = SKP_DIV32( SKP_MUL( offset,   SKP_SMULBB( 1000, psEnc->sCmn.fs_kHz ) ), psEnc->sCmn.API_fs_Hz );
+        nSamples = SKP_DIV32( SKP_MUL( nSamples, SKP_SMULBB( 1000, psEnc->sCmn.fs_kHz ) ), psEnc->sCmn.API_fs_Hz );
+    } else {
+        in_ptr = samplesIn + start_ix;
     }
 
+#if HIGH_PASS_INPUT
+    /* Variable high-pass filter */
+    SKP_Silk_HP_variable_cutoff( &psEnc->sCmn, buf, in_ptr, nSamples );
+#else
+    SKP_memcpy( buf, in_ptr, nSamples * sizeof( SKP_int16 ) );
+#endif
+
+#if SWITCH_TRANSITION_FILTERING
+    /* Ensure smooth bandwidth transitions */
+    SKP_Silk_LP_variable_cutoff( &psEnc->sCmn.sLP, buf, nSamples );
+#endif
+
+#if FIXED_POINT 
+{
+    SKP_int16 *buf_ptr = psEnc->x_buf + psEnc->sCmn.ltp_mem_length + ( LA_SHAPE_MS - MAX_PREFILL_LENGTH_MS ) * psEnc->sCmn.fs_kHz + offset;
+    SKP_memcpy( buf_ptr, buf, nSamples * sizeof( SKP_int16 ) );
+}
+#else
+{
+    SKP_float *buf_ptr;
+    buf_ptr = psEnc->x_buf + psEnc->sCmn.ltp_mem_length + ( LA_SHAPE_MS - MAX_PREFILL_LENGTH_MS ) * psEnc->sCmn.fs_kHz + offset;
+    SKP_short2float_array( buf_ptr, buf, nSamples );
+}
+#endif
+
+    /* Avoid using LSF interpolation or pitch prediction in first next frame */
+    psEnc->sCmn.first_frame_after_reset = 1;
 
     return ret;
 }
@@ -128,77 +265,22 @@ SKP_int SKP_Silk_SDK_Encode(
     SKP_int32                           *nBytesOut      /* I/O: Number of bytes in payload (input: Max bytes)   */
 )
 {
-    SKP_int   max_internal_fs_kHz, min_internal_fs_kHz, PacketSize_ms, PacketLoss_perc, UseInBandFEC, ret = SKP_SILK_NO_ERROR;
-    SKP_int   nSamplesToBuffer, Complexity, input_10ms, nSamplesFromInput = 0;
-    SKP_int32 TargetRate_bps, API_fs_Hz;
+    SKP_int   ret;
+    SKP_int   nSamplesToBuffer, input_10ms, nSamplesFromInput = 0;
     SKP_Silk_encoder_state_Fxx *psEnc = ( SKP_Silk_encoder_state_Fxx* )encState;
 
-    SKP_assert( encControl != NULL );
-
-    /* Check sampling frequency first, to avoid divide by zero later */
-    if( ( ( encControl->API_sampleRate        !=  8000 ) &&
-          ( encControl->API_sampleRate        != 12000 ) &&
-          ( encControl->API_sampleRate        != 16000 ) &&
-          ( encControl->API_sampleRate        != 24000 ) && 
-          ( encControl->API_sampleRate        != 32000 ) &&
-          ( encControl->API_sampleRate        != 44100 ) &&
-          ( encControl->API_sampleRate        != 48000 ) ) ||
-        ( ( encControl->maxInternalSampleRate !=  8000 ) &&
-          ( encControl->maxInternalSampleRate != 12000 ) &&
-          ( encControl->maxInternalSampleRate != 16000 ) ) ||
-        ( ( encControl->minInternalSampleRate !=  8000 ) &&
-          ( encControl->minInternalSampleRate != 12000 ) &&
-          ( encControl->minInternalSampleRate != 16000 ) ) ||
-          ( encControl->minInternalSampleRate > encControl->maxInternalSampleRate ) ) {
-        ret = SKP_SILK_ENC_FS_NOT_SUPPORTED;
-        SKP_assert( 0 );
-        return( ret );
-    }
-    if( encControl->useDTX < 0 || encControl->useDTX > 1 ) {
-        ret = SKP_SILK_ENC_INVALID_DTX_SETTING;
-    }
-	if( encControl->useCBR < 0 || encControl->useCBR > 1 ) {
-        ret = SKP_SILK_ENC_INVALID_DTX_SETTING;
-    }
-
-
-    /* Set encoder parameters from control structure */
-    API_fs_Hz           =            encControl->API_sampleRate;
-    max_internal_fs_kHz = (SKP_int)( encControl->maxInternalSampleRate >> 10 ) + 1;   /* convert Hz -> kHz */
-    min_internal_fs_kHz = (SKP_int)( encControl->minInternalSampleRate >> 10 ) + 1;   /* convert Hz -> kHz */
-    PacketSize_ms       =            encControl->payloadSize_ms;
-    TargetRate_bps      =            encControl->bitRate;
-    PacketLoss_perc     =            encControl->packetLossPercentage;
-    UseInBandFEC        =            encControl->useInBandFEC;
-    Complexity          =            encControl->complexity;
-    psEnc->sCmn.useDTX  =            encControl->useDTX;
-	psEnc->sCmn.useCBR  =			 encControl->useCBR;
-
-    /* Save values in state */
-    psEnc->sCmn.API_fs_Hz          = API_fs_Hz;
-    psEnc->sCmn.maxInternal_fs_kHz = max_internal_fs_kHz;
-    psEnc->sCmn.minInternal_fs_kHz = min_internal_fs_kHz;
-    psEnc->sCmn.useInBandFEC       = UseInBandFEC;
+    ret = process_enc_control_struct( psEnc, encControl );
 
     /* Only accept input lengths that are a multiple of 10 ms */
-    input_10ms = SKP_DIV32( 100 * nSamplesIn, API_fs_Hz );
-    if( input_10ms * API_fs_Hz != 100 * nSamplesIn || nSamplesIn < 0 ) {
+    input_10ms = SKP_DIV32( 100 * nSamplesIn, psEnc->sCmn.API_fs_Hz );
+    if( input_10ms * psEnc->sCmn.API_fs_Hz != 100 * nSamplesIn || nSamplesIn < 0 ) {
         ret = SKP_SILK_ENC_INPUT_INVALID_NO_OF_SAMPLES;
         SKP_assert( 0 );
         return( ret );
     }
 
-    TargetRate_bps = SKP_LIMIT( TargetRate_bps, MIN_TARGET_RATE_BPS, MAX_TARGET_RATE_BPS );
-    if( ( ret = SKP_Silk_control_encoder_Fxx( psEnc, PacketSize_ms, TargetRate_bps, 
-                        PacketLoss_perc, Complexity) ) != 0 ) {
-        SKP_assert( 0 );
-        return( ret );
-    }
-
-    encControl->internalSampleRate = SKP_SMULBB( psEnc->sCmn.fs_kHz, 1000 );
-    
     /* Make sure no more than one packet can be produced */
-    if( 1000 * (SKP_int32)nSamplesIn > psEnc->sCmn.PacketSize_ms * API_fs_Hz ) {
+    if( 1000 * (SKP_int32)nSamplesIn > psEnc->sCmn.PacketSize_ms * psEnc->sCmn.API_fs_Hz ) {
         ret = SKP_SILK_ENC_INPUT_INVALID_NO_OF_SAMPLES;
         SKP_assert( 0 );
         return( ret );
@@ -207,14 +289,14 @@ SKP_int SKP_Silk_SDK_Encode(
     /* Input buffering/resampling and encoding */
     while( 1 ) {
         nSamplesToBuffer = psEnc->sCmn.frame_length - psEnc->sCmn.inputBufIx;
-        if( API_fs_Hz == SKP_SMULBB( 1000, psEnc->sCmn.fs_kHz ) ) { 
+        if( psEnc->sCmn.API_fs_Hz == SKP_SMULBB( 1000, psEnc->sCmn.fs_kHz ) ) { 
             nSamplesToBuffer  = SKP_min_int( nSamplesToBuffer, nSamplesIn );
             nSamplesFromInput = nSamplesToBuffer;
             /* Copy to buffer */
             SKP_memcpy( &psEnc->sCmn.inputBuf[ psEnc->sCmn.inputBufIx ], samplesIn, nSamplesFromInput * sizeof( SKP_int16 ) );
         } else {  
             nSamplesToBuffer  = SKP_min( nSamplesToBuffer, 10 * input_10ms * psEnc->sCmn.fs_kHz );
-            nSamplesFromInput = SKP_DIV32_16( nSamplesToBuffer * API_fs_Hz, psEnc->sCmn.fs_kHz * 1000 );
+            nSamplesFromInput = SKP_DIV32_16( nSamplesToBuffer * psEnc->sCmn.API_fs_Hz, psEnc->sCmn.fs_kHz * 1000 );
             /* Resample and write to buffer */
             ret += SKP_Silk_resampler( &psEnc->sCmn.resampler_state, &psEnc->sCmn.inputBuf[ psEnc->sCmn.inputBufIx ], samplesIn, nSamplesFromInput );
         } 
diff --git a/src_common/SKP_Silk_interpolate.c b/src_common/SKP_Silk_interpolate.c
index f3adcbedab7516990b8860ffc4de9a57db7aa954..73d0ecabd3778bf5300503d917cd715cee58345f 100644
--- a/src_common/SKP_Silk_interpolate.c
+++ b/src_common/SKP_Silk_interpolate.c
@@ -39,7 +39,7 @@ void SKP_Silk_interpolate(
     SKP_int i;
 
     SKP_assert( ifact_Q2 >= 0 );
-    SKP_assert( ifact_Q2 <= ( 1 << 2 ) );
+    SKP_assert( ifact_Q2 <= 4 );
 
     for( i = 0; i < d; i++ ) {
         xi[ i ] = ( SKP_int )( ( SKP_int32 )x0[ i ] + SKP_RSHIFT( SKP_MUL( ( SKP_int32 )x1[ i ] - ( SKP_int32 )x0[ i ], ifact_Q2 ), 2 ) );
diff --git a/src_common/SKP_Silk_main.h b/src_common/SKP_Silk_main.h
index 9f12506f9afa615d0e1e2a7ad5d99c45f3331b2b..95252ea74dde0db9c90f2bd8b506d9c0b37b1ef6 100644
--- a/src_common/SKP_Silk_main.h
+++ b/src_common/SKP_Silk_main.h
@@ -213,15 +213,17 @@ void SKP_Silk_VAD_GetNoiseLevels(
 );
 
 /* Get speech activity level in Q8 */
-SKP_int SKP_Silk_VAD_GetSA_Q8(                                  /* O    Return value, 0 if success      */
-    SKP_Silk_VAD_state          *psSilk_VAD,                    /* I/O  Silk VAD state                  */
-    SKP_int                     *pSA_Q8,                        /* O    Speech activity level in Q8     */
-    SKP_int                     *pSNR_dB_Q7,                    /* O    SNR for current frame in Q7     */
-    SKP_int                     pQuality_Q15[ VAD_N_BANDS ],    /* O    Smoothed SNR for each band      */
-    SKP_int                     *pTilt_Q15,                     /* O    current frame's frequency tilt  */
-    const SKP_int16             pIn[],                          /* I    PCM input       [framelength]   */
-    const SKP_int               framelength,                    /* I    Input frame length              */
-    const SKP_int               fs_kHz                          /* I    Input frame sample frequency    */
+SKP_int SKP_Silk_VAD_GetSA_Q8(                      /* O    Return value, 0 if success                  */
+    SKP_Silk_encoder_state      *psEncC,            /* I/O  Encoder state                               */
+    const SKP_int16             pIn[]               /* I    PCM input                                   */
+);
+
+/* High-pass filter with cutoff frequency adaptation based on pitch lag statistics */
+void SKP_Silk_HP_variable_cutoff(
+    SKP_Silk_encoder_state          *psEncC,        /* I/O  Encoder state                               */
+    SKP_int16                       *out,           /* O    high-pass filtered output signal            */
+    const SKP_int16                 *in,            /* I    input signal                                */
+    const SKP_int                   frame_length    /* I    length of input                             */
 );
 
 #if SWITCH_TRANSITION_FILTERING
@@ -241,19 +243,69 @@ void SKP_Silk_LBRR_embed(
     ec_enc                      *psRangeEnc         /* I/O  Compressor data structure                   */
 );
 
+/******************/
+/* NLSF Quantizer */
+/******************/
+/* Limit, stabilize, convert and quantize NLSFs.    */ 
+void SKP_Silk_process_NLSFs(
+    SKP_Silk_encoder_state          *psEncC,                                /* I/O  Encoder state                               */
+    SKP_int16                       PredCoef_Q12[ 2 ][ MAX_LPC_ORDER ],     /* O    Prediction coefficients                     */
+    SKP_int                         pNLSF_Q15[         MAX_LPC_ORDER ],     /* I/O  Normalized LSFs (quant out) (0 - (2^15-1))  */
+    const SKP_int                   prev_NLSFq_Q15[    MAX_LPC_ORDER ]      /* I    Previous Normalized LSFs (0 - (2^15-1))     */
+);
+
+/* NLSF vector encoder */
+void SKP_Silk_NLSF_MSVQ_encode(
+          SKP_int8                  *NLSFIndices,           /* O    Codebook path vector [ CB_STAGES ]      */
+          SKP_int                   *pNLSF_Q15,             /* I/O  Quantized NLSF vector [ LPC_ORDER ]     */
+    const SKP_Silk_NLSF_CB_struct   *psNLSF_CB,             /* I    Codebook object                         */
+    const SKP_int                   *pNLSF_q_Q15_prev,      /* I    Prev. quantized NLSF vector [LPC_ORDER] */
+    const SKP_int                   *pW_Q5,                 /* I    NLSF weight vector [ LPC_ORDER ]        */
+    const SKP_int                   NLSF_mu_Q15,            /* I    Rate weight for the RD optimization     */
+    const SKP_int                   NLSF_mu_fluc_red_Q16,   /* I    Fluctuation reduction error weight      */
+    const SKP_int                   NLSF_MSVQ_Survivors,    /* I    Max survivors from each stage           */
+    const SKP_int                   LPC_order,              /* I    LPC order                               */
+    const SKP_int                   deactivate_fluc_red     /* I    Deactivate fluctuation reduction        */
+);
+
+/* Rate-Distortion calculations for multiple input data vectors */
+void SKP_Silk_NLSF_VQ_rate_distortion(
+    SKP_int32                       *pRD_Q19,           /* O    Rate-distortion values [psNLSF_CBS->nVectors*N] */
+    const SKP_Silk_NLSF_CBS         *psNLSF_CBS,        /* I    NLSF codebook stage struct                      */
+    const SKP_int16                 *in_Q15,            /* I    Input vectors to be quantized                   */
+    const SKP_int                   *w_Q5,              /* I    Weight vector                                   */
+    const SKP_int32                 *rate_acc_Q4,       /* I    Accumulated rates from previous stage           */
+    const SKP_int                   mu_Q15,             /* I    Weight between weighted error and rate          */
+    const SKP_int                   N,                  /* I    Number of input vectors to be quantized         */
+    const SKP_int                   stage,              /* I    Stage number                                    */
+    const SKP_int                   LPC_order           /* I    LPC order                                       */
+);
+
+/* Compute weighted quantization errors for an LPC_order element input vector, over one codebook stage */
+void SKP_Silk_NLSF_VQ_sum_error(
+    SKP_int32                       *err_Q19,           /* O    Weighted quantization errors  [N*K]         */
+    const SKP_int16                 *in_Q15,            /* I    Input vectors to be quantized [N*LPC_order] */
+    const SKP_int                   *w_Q5,              /* I    Weighting vectors             [N*LPC_order] */
+    const SKP_int8                  *pCB_Q9,            /* I    Codebook vectors              [K*LPC_order] */
+    const SKP_int                   N,                  /* I    Number of input vectors                     */
+    const SKP_int                   K,                  /* I    Number of codebook vectors                  */
+    const SKP_int                   stage,              /* I    Stage number                                */
+    const SKP_int                   LPC_order           /* I    Number of LPCs                              */
+);
+
 /****************************************************/
 /* Decoder Functions                                */
 /****************************************************/
 SKP_int SKP_Silk_create_decoder(
-    SKP_Silk_decoder_state      **ppsDec            /* I/O  Decoder state pointer pointer               */
+    SKP_Silk_decoder_state          **ppsDec            /* I/O  Decoder state pointer pointer               */
 );
 
 SKP_int SKP_Silk_free_decoder(
-    SKP_Silk_decoder_state      *psDec              /* I/O  Decoder state pointer                       */
+    SKP_Silk_decoder_state          *psDec              /* I/O  Decoder state pointer                       */
 );
 
 SKP_int SKP_Silk_init_decoder(
-    SKP_Silk_decoder_state      *psDec              /* I/O  Decoder state pointer                       */
+    SKP_Silk_decoder_state          *psDec              /* I/O  Decoder state pointer                       */
 );
 
 /* Set decoder sampling rate */
@@ -288,7 +340,7 @@ void SKP_Silk_decode_indices(
     SKP_int                     decode_LBRR         /* I    Flag indicating LBRR data is being decoded  */
 );
 
-/* Decode parameters from payload v4 Bitstream */
+/* Decode parameters from payload */
 void SKP_Silk_decode_parameters(
     SKP_Silk_decoder_state      *psDec,                             /* I/O  State                                    */
     SKP_Silk_decoder_control    *psDecCtrl                          /* I/O  Decoder control                          */
diff --git a/src_FIX/SKP_Silk_process_NLSFs_FIX.c b/src_common/SKP_Silk_process_NLSFs.c
similarity index 50%
rename from src_FIX/SKP_Silk_process_NLSFs_FIX.c
rename to src_common/SKP_Silk_process_NLSFs.c
index 09e7ba75bb31446eaf2cd579a4674a4a88020e1f..6c3c931222d328fe1f13588dc8e663d0dcbd9da6 100644
--- a/src_FIX/SKP_Silk_process_NLSFs_FIX.c
+++ b/src_common/SKP_Silk_process_NLSFs.c
@@ -25,98 +25,92 @@ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 ***********************************************************************/
 
-#include "SKP_Silk_main_FIX.h"
+#include "SKP_Silk_main.h"
 
 /* Limit, stabilize, convert and quantize NLSFs.    */ 
-void SKP_Silk_process_NLSFs_FIX(
-    SKP_Silk_encoder_state_FIX      *psEnc,             /* I/O  Encoder state FIX                           */
-    SKP_Silk_encoder_control_FIX    *psEncCtrl,         /* I/O  Encoder control FIX                         */
-    SKP_int                         *pNLSF_Q15          /* I/O  Normalized LSFs (quant out) (0 - (2^15-1))  */
+void SKP_Silk_process_NLSFs(
+    SKP_Silk_encoder_state          *psEncC,                                /* I/O  Encoder state                               */
+    SKP_int16                       PredCoef_Q12[ 2 ][ MAX_LPC_ORDER ],     /* O    Prediction coefficients                     */
+    SKP_int                         pNLSF_Q15[         MAX_LPC_ORDER ],     /* I/O  Normalized LSFs (quant out) (0 - (2^15-1))  */
+    const SKP_int                   prev_NLSFq_Q15[    MAX_LPC_ORDER ]      /* I    Previous Normalized LSFs (0 - (2^15-1))     */
 )
 {
-    SKP_int     doInterpolate;
-    SKP_int     pNLSFW_Q6[ MAX_LPC_ORDER ];
+    SKP_int     i, doInterpolate;
+    SKP_int     pNLSFW_Q5[ MAX_LPC_ORDER ];
     SKP_int     NLSF_mu_Q15, NLSF_mu_fluc_red_Q16;
     SKP_int32   i_sqr_Q15;
-    const SKP_Silk_NLSF_CB_struct *psNLSF_CB;
-
-    /* Used only for NLSF interpolation */
     SKP_int     pNLSF0_temp_Q15[ MAX_LPC_ORDER ];
-    SKP_int     pNLSFW0_temp_Q6[ MAX_LPC_ORDER ];
-    SKP_int     i;
+    SKP_int     pNLSFW0_temp_Q5[ MAX_LPC_ORDER ];
+    const SKP_Silk_NLSF_CB_struct *psNLSF_CB;
 
-    SKP_assert( psEnc->speech_activity_Q8 >=   0 );
-    SKP_assert( psEnc->speech_activity_Q8 <= 256 );
-    SKP_assert( psEncCtrl->sparseness_Q8  >=   0 );
-    SKP_assert( psEncCtrl->sparseness_Q8  <= 256 );
+    SKP_assert( psEncC->speech_activity_Q8 >=   0 );
+    SKP_assert( psEncC->speech_activity_Q8 <= SKP_FIX_CONST( 1.0, 8 ) );
 
     /***********************/
     /* Calculate mu values */
     /***********************/
-    if( psEnc->sCmn.indices.signalType == TYPE_VOICED ) {
+    if( psEncC->indices.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 );
-        NLSF_mu_fluc_red_Q16 = SKP_SMLAWB( 6554, -838848, psEnc->speech_activity_Q8 );
+        NLSF_mu_Q15          = SKP_SMLAWB( SKP_FIX_CONST( 0.002, 15 ), SKP_FIX_CONST( -0.001, 23 ), psEncC->speech_activity_Q8 );
+        NLSF_mu_fluc_red_Q16 = SKP_SMLAWB( SKP_FIX_CONST( 0.1,   16 ), SKP_FIX_CONST( -0.05,  24 ), psEncC->speech_activity_Q8 );
     } else { 
         /* NLSF_mu           = 0.005f - 0.004f * psEnc->speech_activity; */
         /* NLSF_mu_fluc_red  = 0.2f   - 0.1f   * psEnc->speech_activity - 0.1f * psEncCtrl->sparseness; */
-        NLSF_mu_Q15          = SKP_SMLAWB(   164,   -33554, psEnc->speech_activity_Q8 );
-        NLSF_mu_fluc_red_Q16 = SKP_SMLAWB( 13107, -1677696, psEnc->speech_activity_Q8 + psEncCtrl->sparseness_Q8 ); 
+        NLSF_mu_Q15          = SKP_SMLAWB( SKP_FIX_CONST( 0.005, 15 ), SKP_FIX_CONST( -0.004, 23 ), psEncC->speech_activity_Q8 );
+        NLSF_mu_fluc_red_Q16 = SKP_SMLAWB( SKP_FIX_CONST( 0.15,  16 ), SKP_FIX_CONST( -0.1,   24 ), psEncC->speech_activity_Q8 ); 
     }
-    SKP_assert( NLSF_mu_Q15          >= 0     );
-    SKP_assert( NLSF_mu_Q15          <= 164   );
-    SKP_assert( NLSF_mu_fluc_red_Q16 >= 0     );
-    SKP_assert( NLSF_mu_fluc_red_Q16 <= 13107 );
+    SKP_assert( NLSF_mu_Q15          >= 0 );
+    SKP_assert( NLSF_mu_Q15          <= SKP_FIX_CONST( 0.005, 15 ) );
+    SKP_assert( NLSF_mu_fluc_red_Q16 >= 0 );
+    SKP_assert( NLSF_mu_fluc_red_Q16 <= SKP_FIX_CONST( 0.15, 16 ) );
 
     NLSF_mu_Q15 = SKP_max( NLSF_mu_Q15, 1 );
 
     /* Calculate NLSF weights */
-    SKP_Silk_NLSF_VQ_weights_laroia( pNLSFW_Q6, pNLSF_Q15, psEnc->sCmn.predictLPCOrder );
+    SKP_Silk_NLSF_VQ_weights_laroia( pNLSFW_Q5, pNLSF_Q15, psEncC->predictLPCOrder );
 
     /* Update NLSF weights for interpolated NLSFs */
-    doInterpolate = ( psEnc->sCmn.useInterpolatedNLSFs == 1 ) && ( psEnc->sCmn.indices.NLSFInterpCoef_Q2 < ( 1 << 2 ) );
+    doInterpolate = ( psEncC->useInterpolatedNLSFs == 1 ) && ( psEncC->indices.NLSFInterpCoef_Q2 < 4 );
     if( doInterpolate ) {
-
         /* Calculate the interpolated NLSF vector for the first half */
-        SKP_Silk_interpolate( pNLSF0_temp_Q15, psEnc->sPred.prev_NLSFq_Q15, pNLSF_Q15, 
-            psEnc->sCmn.indices.NLSFInterpCoef_Q2, psEnc->sCmn.predictLPCOrder );
+        SKP_Silk_interpolate( pNLSF0_temp_Q15, prev_NLSFq_Q15, pNLSF_Q15, 
+            psEncC->indices.NLSFInterpCoef_Q2, psEncC->predictLPCOrder );
 
         /* Calculate first half NLSF weights for the interpolated NLSFs */
-        SKP_Silk_NLSF_VQ_weights_laroia( pNLSFW0_temp_Q6, pNLSF0_temp_Q15, psEnc->sCmn.predictLPCOrder );
+        SKP_Silk_NLSF_VQ_weights_laroia( pNLSFW0_temp_Q5, pNLSF0_temp_Q15, psEncC->predictLPCOrder );
 
         /* Update NLSF weights with contribution from first half */
-        i_sqr_Q15 = SKP_LSHIFT( SKP_SMULBB( psEnc->sCmn.indices.NLSFInterpCoef_Q2, psEnc->sCmn.indices.NLSFInterpCoef_Q2 ), 11 );
-        for( i = 0; i < psEnc->sCmn.predictLPCOrder; i++ ) {
-            pNLSFW_Q6[ i ] = SKP_SMLAWB( SKP_RSHIFT( pNLSFW_Q6[ i ], 1 ), pNLSFW0_temp_Q6[ i ], i_sqr_Q15 );
-            SKP_assert( pNLSFW_Q6[ i ] <= SKP_int16_MAX );
-            SKP_assert( pNLSFW_Q6[ i ] >= 1 );
+        i_sqr_Q15 = SKP_LSHIFT( SKP_SMULBB( psEncC->indices.NLSFInterpCoef_Q2, psEncC->indices.NLSFInterpCoef_Q2 ), 11 );
+        for( i = 0; i < psEncC->predictLPCOrder; i++ ) {
+            pNLSFW_Q5[ i ] = SKP_SMLAWB( SKP_RSHIFT( pNLSFW_Q5[ i ], 1 ), pNLSFW0_temp_Q5[ i ], i_sqr_Q15 );
+            SKP_assert( pNLSFW_Q5[ i ] <= SKP_int16_MAX );
+            SKP_assert( pNLSFW_Q5[ i ] >= 1 );
         }
     }
 
     /* Set pointer to the NLSF codebook for the current signal type and LPC order */
-    psNLSF_CB = psEnc->sCmn.psNLSF_CB[ 1 - ( psEnc->sCmn.indices.signalType >> 1 ) ];
+    psNLSF_CB = psEncC->psNLSF_CB[ 1 - ( psEncC->indices.signalType >> 1 ) ];
 
     /* Quantize NLSF parameters given the trained NLSF codebooks */
     TIC(MSVQ_encode_FIX)
-    SKP_Silk_NLSF_MSVQ_encode_FIX( psEnc->sCmn.indices.NLSFIndices, pNLSF_Q15, psNLSF_CB, 
-        psEnc->sPred.prev_NLSFq_Q15, pNLSFW_Q6, NLSF_mu_Q15, NLSF_mu_fluc_red_Q16, 
-        psEnc->sCmn.NLSF_MSVQ_Survivors, psEnc->sCmn.predictLPCOrder, psEnc->sCmn.first_frame_after_reset );
+    SKP_Silk_NLSF_MSVQ_encode( psEncC->indices.NLSFIndices, pNLSF_Q15, psNLSF_CB, prev_NLSFq_Q15, pNLSFW_Q5, NLSF_mu_Q15, 
+        NLSF_mu_fluc_red_Q16, psEncC->NLSF_MSVQ_Survivors, psEncC->predictLPCOrder, psEncC->first_frame_after_reset );
     TOC(MSVQ_encode_FIX)
 
     /* Convert quantized NLSFs back to LPC coefficients */
-    SKP_Silk_NLSF2A_stable( psEncCtrl->PredCoef_Q12[ 1 ], pNLSF_Q15, psEnc->sCmn.predictLPCOrder );
+    SKP_Silk_NLSF2A_stable( PredCoef_Q12[ 1 ], pNLSF_Q15, psEncC->predictLPCOrder );
 
     if( doInterpolate ) {
         /* Calculate the interpolated, quantized LSF vector for the first half */
-        SKP_Silk_interpolate( pNLSF0_temp_Q15, psEnc->sPred.prev_NLSFq_Q15, pNLSF_Q15, 
-            psEnc->sCmn.indices.NLSFInterpCoef_Q2, psEnc->sCmn.predictLPCOrder );
+        SKP_Silk_interpolate( pNLSF0_temp_Q15, prev_NLSFq_Q15, pNLSF_Q15, 
+            psEncC->indices.NLSFInterpCoef_Q2, psEncC->predictLPCOrder );
 
         /* Convert back to LPC coefficients */
-        SKP_Silk_NLSF2A_stable( psEncCtrl->PredCoef_Q12[ 0 ], pNLSF0_temp_Q15, psEnc->sCmn.predictLPCOrder );
+        SKP_Silk_NLSF2A_stable( PredCoef_Q12[ 0 ], pNLSF0_temp_Q15, psEncC->predictLPCOrder );
 
     } else {
         /* Copy LPC coefficients for first half from second half */
-        SKP_memcpy( psEncCtrl->PredCoef_Q12[ 0 ], psEncCtrl->PredCoef_Q12[ 1 ], psEnc->sCmn.predictLPCOrder * sizeof( SKP_int16 ) );
+        SKP_memcpy( PredCoef_Q12[ 0 ], PredCoef_Q12[ 1 ], psEncC->predictLPCOrder * sizeof( SKP_int16 ) );
     }
 }
diff --git a/src_common/SKP_Silk_structs.h b/src_common/SKP_Silk_structs.h
index 0321c21b57490cb9bdefd864d4d1c4ae114b6b15..1bcd1080d48e7e2327445f24333c992938b5da89 100644
--- a/src_common/SKP_Silk_structs.h
+++ b/src_common/SKP_Silk_structs.h
@@ -72,14 +72,12 @@ typedef struct {
     SKP_int32   counter;                        /* Frame counter used in the initial phase                  */
 } SKP_Silk_VAD_state;
 
-#if SWITCH_TRANSITION_FILTERING
 /* Variable cut-off low-pass filter state */
 typedef struct {
     SKP_int32                   In_LP_State[ 2 ];           /* Low pass filter state */
     SKP_int32                   transition_frame_no;        /* Counter which is mapped to a cut-off frequency */
-    SKP_int                     mode;                       /* Operating mode, 0: switch down, 1: switch up */
+    SKP_int                     mode;                       /* Operating mode, <0: switch down, >0: switch up; 0: do nothing */
 } SKP_Silk_LP_state;
-#endif
 
 /* Structure for one stage of MSVQ */
 typedef struct {
@@ -120,15 +118,19 @@ typedef struct {
 typedef struct {
 #if HIGH_PASS_INPUT
     SKP_int32                       In_HP_State[ 2 ];               /* High pass filter state                                               */
+    SKP_int32                       variable_HP_smth1_Q15;          /* State of first smoother                                              */
+    SKP_int32                       variable_HP_smth2_Q15;          /* State of second smoother                                             */
 #endif
-#if SWITCH_TRANSITION_FILTERING
     SKP_Silk_LP_state               sLP;                            /* Low pass filter state                                                */
-#endif
     SKP_Silk_VAD_state              sVAD;                           /* Voice activity detector state                                        */
     SKP_Silk_nsq_state              sNSQ;                           /* Noise Shape Quantizer State                                          */
+    SKP_int                         prev_NLSFq_Q15[ MAX_LPC_ORDER ];/* Previously quantized NLSF vector                                     */
+    SKP_int                         speech_activity_Q8;             /* Speech activity                                                      */
     SKP_int8                        LBRRprevLastGainIndex;
     SKP_int8                        prevSignalType;
     SKP_int                         prevLag;
+    SKP_int                         pitch_LPC_win_length;
+    SKP_int                         max_pitch_lag;                  /* Highest possible pitch lag (samples)                                 */
     SKP_int32                       API_fs_Hz;                      /* API sampling frequency (Hz)                                          */
     SKP_int32                       prev_API_fs_Hz;                 /* Previous API sampling frequency (Hz)                                 */
     SKP_int                         maxInternal_fs_kHz;             /* Maximum internal sampling frequency (kHz)                            */
@@ -164,6 +166,8 @@ typedef struct {
     const SKP_uint8                 *pitch_lag_low_bits_iCDF;       /* Pointer to iCDF table for low bits of pitch lag index                */
     const SKP_uint8                 *pitch_contour_iCDF;            /* Pointer to iCDF table for pitch contour index                        */
     const SKP_Silk_NLSF_CB_struct   *psNLSF_CB[ 2 ];                /* Pointers to voiced/unvoiced NLSF codebooks                           */
+    SKP_int                         input_quality_bands_Q15[ VAD_N_BANDS ];
+    SKP_int                         input_tilt_Q15;
 
     SKP_int8                        VAD_flags[ MAX_FRAMES_PER_PACKET ];
     SKP_int8                        LBRR_flag;
@@ -185,11 +189,6 @@ typedef struct {
     SKP_int                         ec_prevSignalType;
     SKP_int16                       ec_prevLagIndex;
 
-    /* Bitrate control */
-    SKP_int32                       bitrateDiff;                    /* Accumulated diff. between the target bitrate and the switch bitrates */
-    SKP_int32                       bitrate_threshold_up;           /* Threshold for switching to a higher internal sample frequency        */
-    SKP_int32                       bitrate_threshold_down;         /* Threshold for switching to a lower internal sample frequency         */
-
     SKP_Silk_resampler_state_struct resampler_state;
 
     /* DTX */
diff --git a/src_common/SKP_Silk_tables.h b/src_common/SKP_Silk_tables.h
index 5c510e0eda634c6d69e704ba8b2264faf06a39f5..67644723dab5998e18b59dca274a95078f4e715c 100644
--- a/src_common/SKP_Silk_tables.h
+++ b/src_common/SKP_Silk_tables.h
@@ -68,6 +68,7 @@ extern const SKP_uint8  SKP_Silk_lsb_iCDF[ 2 ];
 
 extern const SKP_uint8  SKP_Silk_sign_iCDF[ 36 ];                                                   /*  36 */
 
+extern const SKP_uint8  SKP_Silk_uniform2_iCDF[   2 ];                                              /*   2 */
 extern const SKP_uint8  SKP_Silk_uniform4_iCDF[   4 ];                                              /*   4 */
 extern const SKP_uint8  SKP_Silk_uniform6_iCDF[   6 ];                                              /*   6 */
 extern const SKP_uint8  SKP_Silk_uniform8_iCDF[   8 ];                                              /*   8 */
diff --git a/src_common/SKP_Silk_tables_other.c b/src_common/SKP_Silk_tables_other.c
index 422429dc33985a1ce268182e1a4f1501925ff344..21a03c7c6ab2e455ea960c0b8b4315e95c539e6c 100644
--- a/src_common/SKP_Silk_tables_other.c
+++ b/src_common/SKP_Silk_tables_other.c
@@ -92,6 +92,7 @@ const SKP_int16  SKP_Silk_Quantization_Offsets_Q10[ 2 ][ 2 ] = {
 const SKP_int16 SKP_Silk_LTPScales_table_Q14[ 3 ] = { 15565, 12288, 8192 };
 
 /* Uniform entropy tables */
+const SKP_uint8 SKP_Silk_uniform2_iCDF[ 2 ] = { 128, 0 };
 const SKP_uint8 SKP_Silk_uniform4_iCDF[ 4 ] = { 192, 128, 64, 0 };
 const SKP_uint8 SKP_Silk_uniform6_iCDF[ 6 ] = { 213, 171, 128, 85, 43, 0 };
 const SKP_uint8 SKP_Silk_uniform8_iCDF[ 8 ] = { 224, 192, 160, 128, 96, 64, 32, 0 };
diff --git a/src_common/src_common.vcxproj b/src_common/src_common.vcxproj
index 985c0ab5a59c21849fe7157596f98e8dbf1e12bd..ce04adb950828c1c5d4f7d66adbfc391a5bef71b 100644
--- a/src_common/src_common.vcxproj
+++ b/src_common/src_common.vcxproj
@@ -99,14 +99,19 @@
     <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_HP_variable_cutoff.c" />
     <ClCompile Include="SKP_Silk_interpolate.c" />
     <ClCompile Include="SKP_Silk_LBRR_embed.c" />
     <ClCompile Include="SKP_Silk_LP_variable_cutoff.c" />
     <ClCompile Include="SKP_Silk_NLSF2A_stable.c" />
     <ClCompile Include="SKP_Silk_NLSF_MSVQ_decode.c" />
+    <ClCompile Include="SKP_Silk_NLSF_MSVQ_encode.c" />
+    <ClCompile Include="SKP_Silk_NLSF_VQ_rate_distortion.c" />
+    <ClCompile Include="SKP_Silk_NLSF_VQ_sum_error.c" />
     <ClCompile Include="SKP_Silk_NSQ.c" />
     <ClCompile Include="SKP_Silk_NSQ_del_dec.c" />
     <ClCompile Include="SKP_Silk_PLC.c" />
+    <ClCompile Include="SKP_Silk_process_NLSFs.c" />
     <ClCompile Include="SKP_Silk_quant_LTP_gains.c" />
     <ClCompile Include="SKP_Silk_shell_coder.c" />
     <ClCompile Include="SKP_Silk_tables_gain.c" />
diff --git a/src_common/src_common.vcxproj.filters b/src_common/src_common.vcxproj.filters
index 7c9b57c389d19bb37295fb13c16299eee76f22f6..107d02d23df2fc72909dd3847b100c1da5ef7bc7 100644
--- a/src_common/src_common.vcxproj.filters
+++ b/src_common/src_common.vcxproj.filters
@@ -152,5 +152,20 @@
     <ClCompile Include="SKP_Silk_LBRR_embed.c">
       <Filter>Source Files</Filter>
     </ClCompile>
+    <ClCompile Include="SKP_Silk_NLSF_VQ_rate_distortion.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="SKP_Silk_process_NLSFs.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="SKP_Silk_NLSF_VQ_sum_error.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="SKP_Silk_NLSF_MSVQ_encode.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="SKP_Silk_HP_variable_cutoff.c">
+      <Filter>Source Files</Filter>
+    </ClCompile>
   </ItemGroup>
 </Project>
\ No newline at end of file