Break out the part of the iSAC codec that's used for Voice Activity Detection

The audio processing code is using parts of the iSAC codec to do voice
activity detection (VAD), but it's undesirable for it to pull in the
entire iSAC codec as a dependency. So this CL factors out the parts of
iSAC that's needed for VAD to a separate build target.

Bug: webrtc:8396
Change-Id: I884e25d8fd0bc815fca664352b0573b4b173880e
Reviewed-on: https://webrtc-review.googlesource.com/69640
Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org>
Commit-Queue: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23110}
diff --git a/modules/audio_coding/BUILD.gn b/modules/audio_coding/BUILD.gn
index 7dfe70b..9c6ef75 100644
--- a/modules/audio_coding/BUILD.gn
+++ b/modules/audio_coding/BUILD.gn
@@ -496,11 +496,11 @@
     "codecs/isac/audio_decoder_isac_t_impl.h",
     "codecs/isac/audio_encoder_isac_t.h",
     "codecs/isac/audio_encoder_isac_t_impl.h",
-    "codecs/isac/bandwidth_info.h",
     "codecs/isac/locked_bandwidth_info.cc",
     "codecs/isac/locked_bandwidth_info.h",
   ]
   deps = [
+    ":isac_bwinfo",
     "../..:typedefs",
     "../..:webrtc_common",
     "../../api:optional",
@@ -533,6 +533,38 @@
   ]
 }
 
+rtc_source_set("isac_bwinfo") {
+  sources = [
+    "codecs/isac/bandwidth_info.h",
+  ]
+  deps = [
+    "../..:typedefs",
+  ]
+}
+
+rtc_source_set("isac_vad") {
+  visibility += webrtc_default_visibility
+  sources = [
+    "codecs/isac/main/source/filter_functions.c",
+    "codecs/isac/main/source/filter_functions.h",
+    "codecs/isac/main/source/isac_vad.c",
+    "codecs/isac/main/source/isac_vad.h",
+    "codecs/isac/main/source/os_specific_inline.h",
+    "codecs/isac/main/source/pitch_estimator.c",
+    "codecs/isac/main/source/pitch_estimator.h",
+    "codecs/isac/main/source/pitch_filter.c",
+    "codecs/isac/main/source/pitch_filter.h",
+    "codecs/isac/main/source/settings.h",
+    "codecs/isac/main/source/structs.h",
+  ]
+  deps = [
+    ":isac_bwinfo",
+    "../..:typedefs",
+    "../../rtc_base:compile_assert_c",
+    "../../rtc_base/system:ignore_warnings",
+  ]
+}
+
 rtc_static_library("isac_c") {
   poisonous = [ "audio_codecs" ]
   sources = [
@@ -555,9 +587,6 @@
     "codecs/isac/main/source/entropy_coding.h",
     "codecs/isac/main/source/fft.c",
     "codecs/isac/main/source/fft.h",
-    "codecs/isac/main/source/filter_functions.c",
-    "codecs/isac/main/source/filterbank_tables.c",
-    "codecs/isac/main/source/filterbank_tables.h",
     "codecs/isac/main/source/filterbanks.c",
     "codecs/isac/main/source/intialize.c",
     "codecs/isac/main/source/isac.c",
@@ -573,18 +602,12 @@
     "codecs/isac/main/source/lpc_shape_swb16_tables.h",
     "codecs/isac/main/source/lpc_tables.c",
     "codecs/isac/main/source/lpc_tables.h",
-    "codecs/isac/main/source/os_specific_inline.h",
-    "codecs/isac/main/source/pitch_estimator.c",
-    "codecs/isac/main/source/pitch_estimator.h",
-    "codecs/isac/main/source/pitch_filter.c",
     "codecs/isac/main/source/pitch_gain_tables.c",
     "codecs/isac/main/source/pitch_gain_tables.h",
     "codecs/isac/main/source/pitch_lag_tables.c",
     "codecs/isac/main/source/pitch_lag_tables.h",
-    "codecs/isac/main/source/settings.h",
     "codecs/isac/main/source/spectrum_ar_model_tables.c",
     "codecs/isac/main/source/spectrum_ar_model_tables.h",
-    "codecs/isac/main/source/structs.h",
     "codecs/isac/main/source/transform.c",
   ]
 
@@ -595,7 +618,8 @@
   public_configs = [ ":isac_config" ]
 
   deps = [
-    ":isac_common",
+    ":isac_bwinfo",
+    ":isac_vad",
     "../..:typedefs",
     "../..:webrtc_common",
     "../../common_audio",
@@ -649,7 +673,7 @@
   ]
   public_configs = [ ":isac_fix_config" ]
   deps = [
-    ":isac_common",
+    ":isac_bwinfo",
     "../..:typedefs",
     "../../common_audio",
     "../../common_audio:common_audio_c",
@@ -718,6 +742,7 @@
   public_configs = [ ":isac_fix_config" ]
 
   deps = [
+    ":isac_bwinfo",
     ":isac_common",
     "../..:typedefs",
     "../..:webrtc_common",
diff --git a/modules/audio_coding/codecs/isac/main/source/bandwidth_estimator.h b/modules/audio_coding/codecs/isac/main/source/bandwidth_estimator.h
index e0ecf55..fbeb849 100644
--- a/modules/audio_coding/codecs/isac/main/source/bandwidth_estimator.h
+++ b/modules/audio_coding/codecs/isac/main/source/bandwidth_estimator.h
@@ -19,6 +19,8 @@
 #ifndef MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_BANDWIDTH_ESTIMATOR_H_
 #define MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_BANDWIDTH_ESTIMATOR_H_
 
+#include <stddef.h>
+
 #include "modules/audio_coding/codecs/isac/main/source/settings.h"
 #include "modules/audio_coding/codecs/isac/main/source/structs.h"
 
diff --git a/modules/audio_coding/codecs/isac/main/source/codec.h b/modules/audio_coding/codecs/isac/main/source/codec.h
index af7efc0..96118ad 100644
--- a/modules/audio_coding/codecs/isac/main/source/codec.h
+++ b/modules/audio_coding/codecs/isac/main/source/codec.h
@@ -19,6 +19,8 @@
 #ifndef MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_CODEC_H_
 #define MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_CODEC_H_
 
+#include <stddef.h>
+
 #include "modules/audio_coding/codecs/isac/main/source/structs.h"
 
 void WebRtcIsac_ResetBitstream(Bitstr* bit_stream);
@@ -165,14 +167,8 @@
 
 void WebRtcIsac_InitMasking(MaskFiltstr* maskdata);
 
-void WebRtcIsac_InitPreFilterbank(PreFiltBankstr* prefiltdata);
-
 void WebRtcIsac_InitPostFilterbank(PostFiltBankstr* postfiltdata);
 
-void WebRtcIsac_InitPitchFilter(PitchFiltstr* pitchfiltdata);
-
-void WebRtcIsac_InitPitchAnalysis(PitchAnalysisStruct* State);
-
 
 /**************************** transform functions ****************************/
 
@@ -192,25 +188,8 @@
                           double* outre2,
                           FFTstr* fftstr_obj);
 
-/******************************* filter functions ****************************/
-
-void WebRtcIsac_AllPoleFilter(double* InOut, double* Coef, size_t lengthInOut,
-                              int orderCoef);
-
-void WebRtcIsac_AllZeroFilter(double* In, double* Coef, size_t lengthInOut,
-                              int orderCoef, double* Out);
-
-void WebRtcIsac_ZeroPoleFilter(double* In, double* ZeroCoef, double* PoleCoef,
-                               size_t lengthInOut, int orderCoef, double* Out);
-
-
 /***************************** filterbank functions **************************/
 
-void WebRtcIsac_SplitAndFilterFloat(float* in, float* LP, float* HP,
-                                    double* LP_la, double* HP_la,
-                                    PreFiltBankstr* prefiltdata);
-
-
 void WebRtcIsac_FilterAndCombineFloat(float* InLP, float* InHP, float* Out,
                                       PostFiltBankstr* postfiltdata);
 
@@ -227,6 +206,4 @@
 
 void WebRtcIsac_Dir2Lat(double* a, int orderCoef, float* sth, float* cth);
 
-void WebRtcIsac_AutoCorr(double* r, const double* x, size_t N, size_t order);
-
 #endif /* MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_CODEC_H_ */
diff --git a/modules/audio_coding/codecs/isac/main/source/decode.c b/modules/audio_coding/codecs/isac/main/source/decode.c
index e13bc55..6e114e4 100644
--- a/modules/audio_coding/codecs/isac/main/source/decode.c
+++ b/modules/audio_coding/codecs/isac/main/source/decode.c
@@ -28,6 +28,7 @@
 #include "modules/audio_coding/codecs/isac/main/source/bandwidth_estimator.h"
 #include "modules/audio_coding/codecs/isac/main/source/structs.h"
 #include "modules/audio_coding/codecs/isac/main/source/settings.h"
+#include "modules/audio_coding/codecs/isac/main/source/pitch_filter.h"
 
 /*
  * function to decode the bitstream
diff --git a/modules/audio_coding/codecs/isac/main/source/encode.c b/modules/audio_coding/codecs/isac/main/source/encode.c
index 7963820..bf92d02 100644
--- a/modules/audio_coding/codecs/isac/main/source/encode.c
+++ b/modules/audio_coding/codecs/isac/main/source/encode.c
@@ -35,6 +35,8 @@
 #include "modules/audio_coding/codecs/isac/main/source/lpc_shape_swb12_tables.h"
 #include "modules/audio_coding/codecs/isac/main/source/lpc_shape_swb16_tables.h"
 #include "modules/audio_coding/codecs/isac/main/source/lpc_gain_swb_tables.h"
+#include "modules/audio_coding/codecs/isac/main/source/isac_vad.h"
+#include "modules/audio_coding/codecs/isac/main/source/pitch_filter.h"
 
 
 #define UB_LOOKAHEAD 24
diff --git a/modules/audio_coding/codecs/isac/main/source/filter_functions.c b/modules/audio_coding/codecs/isac/main/source/filter_functions.c
index 7bd5a79..a4f297c 100644
--- a/modules/audio_coding/codecs/isac/main/source/filter_functions.c
+++ b/modules/audio_coding/codecs/isac/main/source/filter_functions.c
@@ -13,16 +13,14 @@
 #ifdef WEBRTC_ANDROID
 #include <stdlib.h>
 #endif
+
 #include "modules/audio_coding/codecs/isac/main/source/pitch_estimator.h"
-#include "modules/audio_coding/codecs/isac/main/source/lpc_analysis.h"
-#include "modules/audio_coding/codecs/isac/main/source/codec.h"
+#include "modules/audio_coding/codecs/isac/main/source/isac_vad.h"
 
-
-
-void WebRtcIsac_AllPoleFilter(double* InOut,
-                              double* Coef,
-                              size_t lengthInOut,
-                              int orderCoef) {
+static void WebRtcIsac_AllPoleFilter(double* InOut,
+                                     double* Coef,
+                                     size_t lengthInOut,
+                                     int orderCoef) {
   /* the state of filter is assumed to be in InOut[-1] to InOut[-orderCoef] */
   double scal;
   double sum;
@@ -55,12 +53,11 @@
   }
 }
 
-
-void WebRtcIsac_AllZeroFilter(double* In,
-                              double* Coef,
-                              size_t lengthInOut,
-                              int orderCoef,
-                              double* Out) {
+static void WebRtcIsac_AllZeroFilter(double* In,
+                                     double* Coef,
+                                     size_t lengthInOut,
+                                     int orderCoef,
+                                     double* Out) {
   /* the state of filter is assumed to be in In[-1] to In[-orderCoef] */
 
   size_t n;
@@ -80,13 +77,12 @@
   }
 }
 
-
-void WebRtcIsac_ZeroPoleFilter(double* In,
-                               double* ZeroCoef,
-                               double* PoleCoef,
-                               size_t lengthInOut,
-                               int orderCoef,
-                               double* Out) {
+static void WebRtcIsac_ZeroPoleFilter(double* In,
+                                      double* ZeroCoef,
+                                      double* PoleCoef,
+                                      size_t lengthInOut,
+                                      int orderCoef,
+                                      double* Out) {
   /* the state of the zero section is assumed to be in In[-1] to In[-orderCoef] */
   /* the state of the pole section is assumed to be in Out[-1] to Out[-orderCoef] */
 
@@ -115,8 +111,10 @@
 
 }
 
-
-void WebRtcIsac_BwExpand(double* out, double* in, double coef, size_t length) {
+static void WebRtcIsac_BwExpand(double* out,
+                                double* in,
+                                double coef,
+                                size_t length) {
   size_t i;
   double  chirp;
 
@@ -195,69 +193,3 @@
   memcpy(weiout, weoutbuf+PITCH_WLPCORDER, sizeof(double) * PITCH_FRAME_LEN);
   memcpy(whiout, whoutbuf+PITCH_WLPCORDER, sizeof(double) * PITCH_FRAME_LEN);
 }
-
-
-static const double APupper[ALLPASSSECTIONS] = {0.0347, 0.3826};
-static const double APlower[ALLPASSSECTIONS] = {0.1544, 0.744};
-
-
-void WebRtcIsac_AllpassFilterForDec(double* InOut,
-                                    const double* APSectionFactors,
-                                    size_t lengthInOut,
-                                    double* FilterState) {
-  //This performs all-pass filtering--a series of first order all-pass sections are used
-  //to filter the input in a cascade manner.
-  size_t n,j;
-  double temp;
-  for (j=0; j<ALLPASSSECTIONS; j++){
-    for (n=0;n<lengthInOut;n+=2){
-      temp = InOut[n]; //store input
-      InOut[n] = FilterState[j] + APSectionFactors[j]*temp;
-      FilterState[j] = -APSectionFactors[j]*InOut[n] + temp;
-    }
-  }
-}
-
-void WebRtcIsac_DecimateAllpass(const double* in,
-                                double* state_in,
-                                size_t N,
-                                double* out) {
-  size_t n;
-  double data_vec[PITCH_FRAME_LEN];
-
-  /* copy input */
-  memcpy(data_vec+1, in, sizeof(double) * (N-1));
-
-  data_vec[0] = state_in[2*ALLPASSSECTIONS];   //the z^(-1) state
-  state_in[2*ALLPASSSECTIONS] = in[N-1];
-
-  WebRtcIsac_AllpassFilterForDec(data_vec+1, APupper, N, state_in);
-  WebRtcIsac_AllpassFilterForDec(data_vec, APlower, N, state_in+ALLPASSSECTIONS);
-
-  for (n=0;n<N/2;n++)
-    out[n] = data_vec[2*n] + data_vec[2*n+1];
-
-}
-
-
-/* create high-pass filter ocefficients
- * z = 0.998 * exp(j*2*pi*35/8000);
- * p = 0.94 * exp(j*2*pi*140/8000);
- * HP_b = [1, -2*real(z), abs(z)^2];
- * HP_a = [1, -2*real(p), abs(p)^2]; */
-static const double a_coef[2] = { 1.86864659625574, -0.88360000000000};
-static const double b_coef[2] = {-1.99524591718270,  0.99600400000000};
-
-/* second order high-pass filter */
-void WebRtcIsac_Highpass(const double* in,
-                         double* out,
-                         double* state,
-                         size_t N) {
-  size_t k;
-
-  for (k=0; k<N; k++) {
-    *out = *in + state[1];
-    state[1] = state[0] + b_coef[0] * *in + a_coef[0] * *out;
-    state[0] = b_coef[1] * *in++ + a_coef[1] * *out++;
-  }
-}
diff --git a/modules/audio_coding/codecs/isac/main/source/filter_functions.h b/modules/audio_coding/codecs/isac/main/source/filter_functions.h
new file mode 100644
index 0000000..48a9b74
--- /dev/null
+++ b/modules/audio_coding/codecs/isac/main/source/filter_functions.h
@@ -0,0 +1,23 @@
+/*
+ *  Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
+ *
+ *  Use of this source code is governed by a BSD-style license
+ *  that can be found in the LICENSE file in the root of the source
+ *  tree. An additional intellectual property rights grant can be found
+ *  in the file PATENTS.  All contributing project authors may
+ *  be found in the AUTHORS file in the root of the source tree.
+ */
+
+#ifndef MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_FILTER_FUNCTIONS_H_
+#define MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_FILTER_FUNCTIONS_H_
+
+#include "modules/audio_coding/codecs/isac/main/source/structs.h"
+
+void WebRtcIsac_AutoCorr(double* r, const double* x, size_t N, size_t order);
+
+void WebRtcIsac_WeightingFilter(const double* in,
+                                double* weiout,
+                                double* whiout,
+                                WeightFiltstr* wfdata);
+
+#endif  // MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_FILTER_FUNCTIONS_H_
diff --git a/modules/audio_coding/codecs/isac/main/source/filterbank_tables.c b/modules/audio_coding/codecs/isac/main/source/filterbank_tables.c
deleted file mode 100644
index 12caee0..0000000
--- a/modules/audio_coding/codecs/isac/main/source/filterbank_tables.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- *  Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
- *
- *  Use of this source code is governed by a BSD-style license
- *  that can be found in the LICENSE file in the root of the source
- *  tree. An additional intellectual property rights grant can be found
- *  in the file PATENTS.  All contributing project authors may
- *  be found in the AUTHORS file in the root of the source tree.
- */
-
-/* filterbank_tables.c*/
-/* This file contains variables that are used in filterbanks.c*/
-
-#include "modules/audio_coding/codecs/isac/main/source/filterbank_tables.h"
-#include "modules/audio_coding/codecs/isac/main/source/settings.h"
-
-/* The composite all-pass filter factors */
-const float WebRtcIsac_kCompositeApFactorsFloat[4] = {
- 0.03470000000000f,  0.15440000000000f,  0.38260000000000f,  0.74400000000000f};
-
-/* The upper channel all-pass filter factors */
-const float WebRtcIsac_kUpperApFactorsFloat[2] = {
- 0.03470000000000f,  0.38260000000000f};
-
-/* The lower channel all-pass filter factors */
-const float WebRtcIsac_kLowerApFactorsFloat[2] = {
- 0.15440000000000f,  0.74400000000000f};
-
-/* The matrix for transforming the backward composite state to upper channel state */
-const float WebRtcIsac_kTransform1Float[8] = {
-  -0.00158678506084f,  0.00127157815343f, -0.00104805672709f,  0.00084837248079f,
-  0.00134467983258f, -0.00107756549387f,  0.00088814793277f, -0.00071893072525f};
-
-/* The matrix for transforming the backward composite state to lower channel state */
-const float WebRtcIsac_kTransform2Float[8] = {
- -0.00170686041697f,  0.00136780109829f, -0.00112736532350f,  0.00091257055385f,
-  0.00103094281812f, -0.00082615076557f,  0.00068092756088f, -0.00055119165484f};
diff --git a/modules/audio_coding/codecs/isac/main/source/filterbank_tables.h b/modules/audio_coding/codecs/isac/main/source/filterbank_tables.h
deleted file mode 100644
index 2edb0f0..0000000
--- a/modules/audio_coding/codecs/isac/main/source/filterbank_tables.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- *  Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
- *
- *  Use of this source code is governed by a BSD-style license
- *  that can be found in the LICENSE file in the root of the source
- *  tree. An additional intellectual property rights grant can be found
- *  in the file PATENTS.  All contributing project authors may
- *  be found in the AUTHORS file in the root of the source tree.
- */
-
-/*
- * filterbank_tables.h
- *
- * Header file for variables that are defined in
- * filterbank_tables.c.
- *
- */
-
-#ifndef MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_FILTERBANK_TABLES_H_
-#define MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_FILTERBANK_TABLES_H_
-
-#include "modules/audio_coding/codecs/isac/main/source/structs.h"
-
-/********************* Coefficient Tables ************************/
-/* The number of composite all-pass filter factors */
-#define NUMBEROFCOMPOSITEAPSECTIONS 4
-
-/* The number of all-pass filter factors in an upper or lower channel*/
-#define NUMBEROFCHANNELAPSECTIONS 2
-
-/* The composite all-pass filter factors */
-extern const float WebRtcIsac_kCompositeApFactorsFloat[4];
-
-/* The upper channel all-pass filter factors */
-extern const float WebRtcIsac_kUpperApFactorsFloat[2];
-
-/* The lower channel all-pass filter factors */
-extern const float WebRtcIsac_kLowerApFactorsFloat[2];
-
-/* The matrix for transforming the backward composite state to upper channel state */
-extern const float WebRtcIsac_kTransform1Float[8];
-
-/* The matrix for transforming the backward composite state to lower channel state */
-extern const float WebRtcIsac_kTransform2Float[8];
-
-#endif /* MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_FILTERBANK_TABLES_H_ */
diff --git a/modules/audio_coding/codecs/isac/main/source/filterbanks.c b/modules/audio_coding/codecs/isac/main/source/filterbanks.c
index 6f1e4db..d57b550 100644
--- a/modules/audio_coding/codecs/isac/main/source/filterbanks.c
+++ b/modules/audio_coding/codecs/isac/main/source/filterbanks.c
@@ -19,240 +19,8 @@
  */
 
 #include "modules/audio_coding/codecs/isac/main/source/settings.h"
-#include "modules/audio_coding/codecs/isac/main/source/filterbank_tables.h"
 #include "modules/audio_coding/codecs/isac/main/source/codec.h"
-
-/* This function performs all-pass filtering--a series of first order all-pass
- * sections are used to filter the input in a cascade manner.
- * The input is overwritten!!
- */
-static void WebRtcIsac_AllPassFilter2Float(float *InOut, const float *APSectionFactors,
-                                           int lengthInOut, int NumberOfSections,
-                                           float *FilterState)
-{
-  int n, j;
-  float temp;
-  for (j=0; j<NumberOfSections; j++){
-    for (n=0;n<lengthInOut;n++){
-      temp = FilterState[j] + APSectionFactors[j] * InOut[n];
-      FilterState[j] = -APSectionFactors[j] * temp + InOut[n];
-      InOut[n] = temp;
-    }
-  }
-}
-
-/* HPstcoeff_in = {a1, a2, b1 - b0 * a1, b2 - b0 * a2}; */
-static const float kHpStCoefInFloat[4] =
-{-1.94895953203325f, 0.94984516000000f, -0.05101826139794f, 0.05015484000000f};
-
-/* Function WebRtcIsac_SplitAndFilter
- * This function creates low-pass and high-pass decimated versions of part of
- the input signal, and part of the signal in the input 'lookahead buffer'.
-
- INPUTS:
- in: a length FRAMESAMPLES array of input samples
- prefiltdata: input data structure containing the filterbank states
- and lookahead samples from the previous encoding
- iteration.
- OUTPUTS:
- LP: a FRAMESAMPLES_HALF array of low-pass filtered samples that
- have been phase equalized.  The first QLOOKAHEAD samples are
- based on the samples in the two prefiltdata->INLABUFx arrays
- each of length QLOOKAHEAD.
- The remaining FRAMESAMPLES_HALF-QLOOKAHEAD samples are based
- on the first FRAMESAMPLES_HALF-QLOOKAHEAD samples of the input
- array in[].
- HP: a FRAMESAMPLES_HALF array of high-pass filtered samples that
- have been phase equalized.  The first QLOOKAHEAD samples are
- based on the samples in the two prefiltdata->INLABUFx arrays
- each of length QLOOKAHEAD.
- The remaining FRAMESAMPLES_HALF-QLOOKAHEAD samples are based
- on the first FRAMESAMPLES_HALF-QLOOKAHEAD samples of the input
- array in[].
-
- LP_la: a FRAMESAMPLES_HALF array of low-pass filtered samples.
- These samples are not phase equalized. They are computed
- from the samples in the in[] array.
- HP_la: a FRAMESAMPLES_HALF array of high-pass filtered samples
- that are not phase equalized. They are computed from
- the in[] vector.
- prefiltdata: this input data structure's filterbank state and
- lookahead sample buffers are updated for the next
- encoding iteration.
-*/
-void WebRtcIsac_SplitAndFilterFloat(float *pin, float *LP, float *HP,
-                                    double *LP_la, double *HP_la,
-                                    PreFiltBankstr *prefiltdata)
-{
-  int k,n;
-  float CompositeAPFilterState[NUMBEROFCOMPOSITEAPSECTIONS];
-  float ForTransform_CompositeAPFilterState[NUMBEROFCOMPOSITEAPSECTIONS];
-  float ForTransform_CompositeAPFilterState2[NUMBEROFCOMPOSITEAPSECTIONS];
-  float tempinoutvec[FRAMESAMPLES+MAX_AR_MODEL_ORDER];
-  float tempin_ch1[FRAMESAMPLES+MAX_AR_MODEL_ORDER];
-  float tempin_ch2[FRAMESAMPLES+MAX_AR_MODEL_ORDER];
-  float in[FRAMESAMPLES];
-  float ftmp;
-
-
-  /* High pass filter */
-
-  for (k=0;k<FRAMESAMPLES;k++) {
-    in[k] = pin[k] + kHpStCoefInFloat[2] * prefiltdata->HPstates_float[0] +
-        kHpStCoefInFloat[3] * prefiltdata->HPstates_float[1];
-    ftmp = pin[k] - kHpStCoefInFloat[0] * prefiltdata->HPstates_float[0] -
-        kHpStCoefInFloat[1] * prefiltdata->HPstates_float[1];
-    prefiltdata->HPstates_float[1] = prefiltdata->HPstates_float[0];
-    prefiltdata->HPstates_float[0] = ftmp;
-  }
-
-  /*
-    % backwards all-pass filtering to obtain zero-phase
-    [tmp1(N2+LA:-1:LA+1, 1), state1] = filter(Q.coef, Q.coef(end:-1:1), in(N:-2:2));
-    tmp1(LA:-1:1) = filter(Q.coef, Q.coef(end:-1:1), Q.LookAheadBuf1, state1);
-    Q.LookAheadBuf1 = in(N:-2:N-2*LA+2);
-  */
-  /*Backwards all-pass filter the odd samples of the input (upper channel)
-    to eventually obtain zero phase.  The composite all-pass filter (comprised of both
-    the upper and lower channel all-pass filsters in series) is used for the
-    filtering. */
-
-  /* First Channel */
-
-  /*initial state of composite filter is zero */
-  for (k=0;k<NUMBEROFCOMPOSITEAPSECTIONS;k++){
-    CompositeAPFilterState[k] = 0.0;
-  }
-  /* put every other sample of input into a temporary vector in reverse (backward) order*/
-  for (k=0;k<FRAMESAMPLES_HALF;k++) {
-    tempinoutvec[k] = in[FRAMESAMPLES-1-2*k];
-  }
-
-  /* now all-pass filter the backwards vector.  Output values overwrite the input vector. */
-  WebRtcIsac_AllPassFilter2Float(tempinoutvec, WebRtcIsac_kCompositeApFactorsFloat,
-                                 FRAMESAMPLES_HALF, NUMBEROFCOMPOSITEAPSECTIONS, CompositeAPFilterState);
-
-  /* save the backwards filtered output for later forward filtering,
-     but write it in forward order*/
-  for (k=0;k<FRAMESAMPLES_HALF;k++) {
-    tempin_ch1[FRAMESAMPLES_HALF+QLOOKAHEAD-1-k] = tempinoutvec[k];
-  }
-
-  /* save the backwards filter state  becaue it will be transformed
-     later into a forward state */
-  for (k=0; k<NUMBEROFCOMPOSITEAPSECTIONS; k++) {
-    ForTransform_CompositeAPFilterState[k] = CompositeAPFilterState[k];
-  }
-
-  /* now backwards filter the samples in the lookahead buffer. The samples were
-     placed there in the encoding of the previous frame.  The output samples
-     overwrite the input samples */
-  WebRtcIsac_AllPassFilter2Float(prefiltdata->INLABUF1_float,
-                                 WebRtcIsac_kCompositeApFactorsFloat, QLOOKAHEAD,
-                                 NUMBEROFCOMPOSITEAPSECTIONS, CompositeAPFilterState);
-
-  /* save the output, but write it in forward order */
-  /* write the lookahead samples for the next encoding iteration. Every other
-     sample at the end of the input frame is written in reverse order for the
-     lookahead length. Exported in the prefiltdata structure. */
-  for (k=0;k<QLOOKAHEAD;k++) {
-    tempin_ch1[QLOOKAHEAD-1-k]=prefiltdata->INLABUF1_float[k];
-    prefiltdata->INLABUF1_float[k]=in[FRAMESAMPLES-1-2*k];
-  }
-
-  /* Second Channel.  This is exactly like the first channel, except that the
-     even samples are now filtered instead (lower channel). */
-  for (k=0;k<NUMBEROFCOMPOSITEAPSECTIONS;k++){
-    CompositeAPFilterState[k] = 0.0;
-  }
-
-  for (k=0;k<FRAMESAMPLES_HALF;k++) {
-    tempinoutvec[k] = in[FRAMESAMPLES-2-2*k];
-  }
-
-  WebRtcIsac_AllPassFilter2Float(tempinoutvec, WebRtcIsac_kCompositeApFactorsFloat,
-                                 FRAMESAMPLES_HALF, NUMBEROFCOMPOSITEAPSECTIONS, CompositeAPFilterState);
-
-  for (k=0;k<FRAMESAMPLES_HALF;k++) {
-    tempin_ch2[FRAMESAMPLES_HALF+QLOOKAHEAD-1-k] = tempinoutvec[k];
-  }
-
-  for (k=0; k<NUMBEROFCOMPOSITEAPSECTIONS; k++) {
-    ForTransform_CompositeAPFilterState2[k] = CompositeAPFilterState[k];
-  }
-
-
-  WebRtcIsac_AllPassFilter2Float(prefiltdata->INLABUF2_float,
-                                 WebRtcIsac_kCompositeApFactorsFloat, QLOOKAHEAD,NUMBEROFCOMPOSITEAPSECTIONS,
-                                 CompositeAPFilterState);
-
-  for (k=0;k<QLOOKAHEAD;k++) {
-    tempin_ch2[QLOOKAHEAD-1-k]=prefiltdata->INLABUF2_float[k];
-    prefiltdata->INLABUF2_float[k]=in[FRAMESAMPLES-2-2*k];
-  }
-
-  /* Transform filter states from backward to forward */
-  /*At this point, each of the states of the backwards composite filters for the
-    two channels are transformed into forward filtering states for the corresponding
-    forward channel filters.  Each channel's forward filtering state from the previous
-    encoding iteration is added to the transformed state to get a proper forward state */
-
-  /* So the existing NUMBEROFCOMPOSITEAPSECTIONS x 1 (4x1) state vector is multiplied by a
-     NUMBEROFCHANNELAPSECTIONSxNUMBEROFCOMPOSITEAPSECTIONS (2x4) transform matrix to get the
-     new state that is added to the previous 2x1 input state */
-
-  for (k=0;k<NUMBEROFCHANNELAPSECTIONS;k++){ /* k is row variable */
-    for (n=0; n<NUMBEROFCOMPOSITEAPSECTIONS;n++){/* n is column variable */
-      prefiltdata->INSTAT1_float[k] += ForTransform_CompositeAPFilterState[n]*
-          WebRtcIsac_kTransform1Float[k*NUMBEROFCHANNELAPSECTIONS+n];
-      prefiltdata->INSTAT2_float[k] += ForTransform_CompositeAPFilterState2[n]*
-          WebRtcIsac_kTransform2Float[k*NUMBEROFCHANNELAPSECTIONS+n];
-    }
-  }
-
-  /*obtain polyphase components by forward all-pass filtering through each channel */
-  /* the backward filtered samples are now forward filtered with the corresponding channel filters */
-  /* The all pass filtering automatically updates the filter states which are exported in the
-     prefiltdata structure */
-  WebRtcIsac_AllPassFilter2Float(tempin_ch1,WebRtcIsac_kUpperApFactorsFloat,
-                                 FRAMESAMPLES_HALF, NUMBEROFCHANNELAPSECTIONS, prefiltdata->INSTAT1_float);
-  WebRtcIsac_AllPassFilter2Float(tempin_ch2,WebRtcIsac_kLowerApFactorsFloat,
-                                 FRAMESAMPLES_HALF, NUMBEROFCHANNELAPSECTIONS, prefiltdata->INSTAT2_float);
-
-  /* Now Construct low-pass and high-pass signals as combinations of polyphase components */
-  for (k=0; k<FRAMESAMPLES_HALF; k++) {
-    LP[k] = 0.5f*(tempin_ch1[k] + tempin_ch2[k]);/* low pass signal*/
-    HP[k] = 0.5f*(tempin_ch1[k] - tempin_ch2[k]);/* high pass signal*/
-  }
-
-  /* Lookahead LP and HP signals */
-  /* now create low pass and high pass signals of the input vector.  However, no
-     backwards filtering is performed, and hence no phase equalization is involved.
-     Also, the input contains some samples that are lookahead samples.  The high pass
-     and low pass signals that are created are used outside this function for analysis
-     (not encoding) purposes */
-
-  /* set up input */
-  for (k=0; k<FRAMESAMPLES_HALF; k++) {
-    tempin_ch1[k]=in[2*k+1];
-    tempin_ch2[k]=in[2*k];
-  }
-
-  /* the input filter states are passed in and updated by the all-pass filtering routine and
-     exported in the prefiltdata structure*/
-  WebRtcIsac_AllPassFilter2Float(tempin_ch1,WebRtcIsac_kUpperApFactorsFloat,
-                                 FRAMESAMPLES_HALF, NUMBEROFCHANNELAPSECTIONS, prefiltdata->INSTATLA1_float);
-  WebRtcIsac_AllPassFilter2Float(tempin_ch2,WebRtcIsac_kLowerApFactorsFloat,
-                                 FRAMESAMPLES_HALF, NUMBEROFCHANNELAPSECTIONS, prefiltdata->INSTATLA2_float);
-
-  for (k=0; k<FRAMESAMPLES_HALF; k++) {
-    LP_la[k] = (float)(0.5f*(tempin_ch1[k] + tempin_ch2[k])); /*low pass */
-    HP_la[k] = (double)(0.5f*(tempin_ch1[k] - tempin_ch2[k])); /* high pass */
-  }
-
-
-}/*end of WebRtcIsac_SplitAndFilter */
-
+#include "modules/audio_coding/codecs/isac/main/source/isac_vad.h"
 
 /* Combining */
 
diff --git a/modules/audio_coding/codecs/isac/main/source/intialize.c b/modules/audio_coding/codecs/isac/main/source/intialize.c
index 57025c6..5c951f6 100644
--- a/modules/audio_coding/codecs/isac/main/source/intialize.c
+++ b/modules/audio_coding/codecs/isac/main/source/intialize.c
@@ -43,39 +43,6 @@
   return;
 }
 
-void WebRtcIsac_InitPreFilterbank(PreFiltBankstr *prefiltdata)
-{
-  int k;
-
-  for (k = 0; k < QLOOKAHEAD; k++) {
-    prefiltdata->INLABUF1[k] = 0;
-    prefiltdata->INLABUF2[k] = 0;
-
-    prefiltdata->INLABUF1_float[k] = 0;
-    prefiltdata->INLABUF2_float[k] = 0;
-  }
-  for (k = 0; k < 2*(QORDER-1); k++) {
-    prefiltdata->INSTAT1[k] = 0;
-    prefiltdata->INSTAT2[k] = 0;
-    prefiltdata->INSTATLA1[k] = 0;
-    prefiltdata->INSTATLA2[k] = 0;
-
-    prefiltdata->INSTAT1_float[k] = 0;
-    prefiltdata->INSTAT2_float[k] = 0;
-    prefiltdata->INSTATLA1_float[k] = 0;
-    prefiltdata->INSTATLA2_float[k] = 0;
-  }
-
-  /* High pass filter states */
-  prefiltdata->HPstates[0] = 0.0;
-  prefiltdata->HPstates[1] = 0.0;
-
-  prefiltdata->HPstates_float[0] = 0.0f;
-  prefiltdata->HPstates_float[1] = 0.0f;
-
-  return;
-}
-
 void WebRtcIsac_InitPostFilterbank(PostFiltBankstr *postfiltdata)
 {
   int k;
@@ -103,69 +70,3 @@
 
   return;
 }
-
-
-void WebRtcIsac_InitPitchFilter(PitchFiltstr *pitchfiltdata)
-{
-  int k;
-
-  for (k = 0; k < PITCH_BUFFSIZE; k++) {
-    pitchfiltdata->ubuf[k] = 0.0;
-  }
-  pitchfiltdata->ystate[0] = 0.0;
-  for (k = 1; k < (PITCH_DAMPORDER); k++) {
-    pitchfiltdata->ystate[k] = 0.0;
-  }
-  pitchfiltdata->oldlagp[0] = 50.0;
-  pitchfiltdata->oldgainp[0] = 0.0;
-}
-
-void WebRtcIsac_InitWeightingFilter(WeightFiltstr *wfdata)
-{
-  int k;
-  double t, dtmp, dtmp2, denum, denum2;
-
-  for (k=0;k<PITCH_WLPCBUFLEN;k++)
-    wfdata->buffer[k]=0.0;
-
-  for (k=0;k<PITCH_WLPCORDER;k++) {
-    wfdata->istate[k]=0.0;
-    wfdata->weostate[k]=0.0;
-    wfdata->whostate[k]=0.0;
-  }
-
-  /* next part should be in Matlab, writing to a global table */
-  t = 0.5;
-  denum = 1.0 / ((double) PITCH_WLPCWINLEN);
-  denum2 = denum * denum;
-  for (k=0;k<PITCH_WLPCWINLEN;k++) {
-    dtmp = PITCH_WLPCASYM * t * denum + (1-PITCH_WLPCASYM) * t * t * denum2;
-    dtmp *= 3.14159265;
-    dtmp2 = sin(dtmp);
-    wfdata->window[k] = dtmp2 * dtmp2;
-    t++;
-  }
-}
-
-/* clear all buffers */
-void WebRtcIsac_InitPitchAnalysis(PitchAnalysisStruct *State)
-{
-  int k;
-
-  for (k = 0; k < PITCH_CORR_LEN2+PITCH_CORR_STEP2+PITCH_MAX_LAG/2-PITCH_FRAME_LEN/2+2; k++)
-    State->dec_buffer[k] = 0.0;
-  for (k = 0; k < 2*ALLPASSSECTIONS+1; k++)
-    State->decimator_state[k] = 0.0;
-  for (k = 0; k < 2; k++)
-    State->hp_state[k] = 0.0;
-  for (k = 0; k < QLOOKAHEAD; k++)
-    State->whitened_buf[k] = 0.0;
-  for (k = 0; k < QLOOKAHEAD; k++)
-    State->inbuf[k] = 0.0;
-
-  WebRtcIsac_InitPitchFilter(&(State->PFstr_wght));
-
-  WebRtcIsac_InitPitchFilter(&(State->PFstr));
-
-  WebRtcIsac_InitWeightingFilter(&(State->Wghtstr));
-}
diff --git a/modules/audio_coding/codecs/isac/main/source/isac.c b/modules/audio_coding/codecs/isac/main/source/isac.c
index 525e0f3..45eb598 100644
--- a/modules/audio_coding/codecs/isac/main/source/isac.c
+++ b/modules/audio_coding/codecs/isac/main/source/isac.c
@@ -31,6 +31,7 @@
 #include "modules/audio_coding/codecs/isac/main/source/lpc_shape_swb16_tables.h"
 #include "modules/audio_coding/codecs/isac/main/source/os_specific_inline.h"
 #include "modules/audio_coding/codecs/isac/main/source/structs.h"
+#include "modules/audio_coding/codecs/isac/main/source/isac_vad.h"
 
 #define BIT_MASK_DEC_INIT 0x0001
 #define BIT_MASK_ENC_INIT 0x0002
diff --git a/modules/audio_coding/codecs/isac/main/source/isac_vad.c b/modules/audio_coding/codecs/isac/main/source/isac_vad.c
new file mode 100644
index 0000000..57cf0c3
--- /dev/null
+++ b/modules/audio_coding/codecs/isac/main/source/isac_vad.c
@@ -0,0 +1,409 @@
+/*
+ *  Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
+ *
+ *  Use of this source code is governed by a BSD-style license
+ *  that can be found in the LICENSE file in the root of the source
+ *  tree. An additional intellectual property rights grant can be found
+ *  in the file PATENTS.  All contributing project authors may
+ *  be found in the AUTHORS file in the root of the source tree.
+ */
+
+#include "modules/audio_coding/codecs/isac/main/source/isac_vad.h"
+
+#include <math.h>
+
+void WebRtcIsac_InitPitchFilter(PitchFiltstr* pitchfiltdata) {
+  int k;
+
+  for (k = 0; k < PITCH_BUFFSIZE; k++) {
+    pitchfiltdata->ubuf[k] = 0.0;
+  }
+  pitchfiltdata->ystate[0] = 0.0;
+  for (k = 1; k < (PITCH_DAMPORDER); k++) {
+    pitchfiltdata->ystate[k] = 0.0;
+  }
+  pitchfiltdata->oldlagp[0] = 50.0;
+  pitchfiltdata->oldgainp[0] = 0.0;
+}
+
+static void WebRtcIsac_InitWeightingFilter(WeightFiltstr* wfdata) {
+  int k;
+  double t, dtmp, dtmp2, denum, denum2;
+
+  for (k = 0; k < PITCH_WLPCBUFLEN; k++)
+    wfdata->buffer[k] = 0.0;
+
+  for (k = 0; k < PITCH_WLPCORDER; k++) {
+    wfdata->istate[k] = 0.0;
+    wfdata->weostate[k] = 0.0;
+    wfdata->whostate[k] = 0.0;
+  }
+
+  /* next part should be in Matlab, writing to a global table */
+  t = 0.5;
+  denum = 1.0 / ((double)PITCH_WLPCWINLEN);
+  denum2 = denum * denum;
+  for (k = 0; k < PITCH_WLPCWINLEN; k++) {
+    dtmp = PITCH_WLPCASYM * t * denum + (1 - PITCH_WLPCASYM) * t * t * denum2;
+    dtmp *= 3.14159265;
+    dtmp2 = sin(dtmp);
+    wfdata->window[k] = dtmp2 * dtmp2;
+    t++;
+  }
+}
+
+void WebRtcIsac_InitPitchAnalysis(PitchAnalysisStruct* State) {
+  int k;
+
+  for (k = 0; k < PITCH_CORR_LEN2 + PITCH_CORR_STEP2 + PITCH_MAX_LAG / 2 -
+                      PITCH_FRAME_LEN / 2 + 2;
+       k++)
+    State->dec_buffer[k] = 0.0;
+  for (k = 0; k < 2 * ALLPASSSECTIONS + 1; k++)
+    State->decimator_state[k] = 0.0;
+  for (k = 0; k < 2; k++)
+    State->hp_state[k] = 0.0;
+  for (k = 0; k < QLOOKAHEAD; k++)
+    State->whitened_buf[k] = 0.0;
+  for (k = 0; k < QLOOKAHEAD; k++)
+    State->inbuf[k] = 0.0;
+
+  WebRtcIsac_InitPitchFilter(&(State->PFstr_wght));
+
+  WebRtcIsac_InitPitchFilter(&(State->PFstr));
+
+  WebRtcIsac_InitWeightingFilter(&(State->Wghtstr));
+}
+
+void WebRtcIsac_InitPreFilterbank(PreFiltBankstr* prefiltdata) {
+  int k;
+
+  for (k = 0; k < QLOOKAHEAD; k++) {
+    prefiltdata->INLABUF1[k] = 0;
+    prefiltdata->INLABUF2[k] = 0;
+
+    prefiltdata->INLABUF1_float[k] = 0;
+    prefiltdata->INLABUF2_float[k] = 0;
+  }
+  for (k = 0; k < 2 * (QORDER - 1); k++) {
+    prefiltdata->INSTAT1[k] = 0;
+    prefiltdata->INSTAT2[k] = 0;
+    prefiltdata->INSTATLA1[k] = 0;
+    prefiltdata->INSTATLA2[k] = 0;
+
+    prefiltdata->INSTAT1_float[k] = 0;
+    prefiltdata->INSTAT2_float[k] = 0;
+    prefiltdata->INSTATLA1_float[k] = 0;
+    prefiltdata->INSTATLA2_float[k] = 0;
+  }
+
+  /* High pass filter states */
+  prefiltdata->HPstates[0] = 0.0;
+  prefiltdata->HPstates[1] = 0.0;
+
+  prefiltdata->HPstates_float[0] = 0.0f;
+  prefiltdata->HPstates_float[1] = 0.0f;
+
+  return;
+}
+
+double WebRtcIsac_LevDurb(double* a, double* k, double* r, size_t order) {
+  const double LEVINSON_EPS = 1.0e-10;
+
+  double sum, alpha;
+  size_t m, m_h, i;
+  alpha = 0;  // warning -DH
+  a[0] = 1.0;
+  if (r[0] < LEVINSON_EPS) { /* if r[0] <= 0, set LPC coeff. to zero */
+    for (i = 0; i < order; i++) {
+      k[i] = 0;
+      a[i + 1] = 0;
+    }
+  } else {
+    a[1] = k[0] = -r[1] / r[0];
+    alpha = r[0] + r[1] * k[0];
+    for (m = 1; m < order; m++) {
+      sum = r[m + 1];
+      for (i = 0; i < m; i++) {
+        sum += a[i + 1] * r[m - i];
+      }
+      k[m] = -sum / alpha;
+      alpha += k[m] * sum;
+      m_h = (m + 1) >> 1;
+      for (i = 0; i < m_h; i++) {
+        sum = a[i + 1] + k[m] * a[m - i];
+        a[m - i] += k[m] * a[i + 1];
+        a[i + 1] = sum;
+      }
+      a[m + 1] = k[m];
+    }
+  }
+  return alpha;
+}
+
+/* The upper channel all-pass filter factors */
+const float WebRtcIsac_kUpperApFactorsFloat[2] = {0.03470000000000f,
+                                                  0.38260000000000f};
+
+/* The lower channel all-pass filter factors */
+const float WebRtcIsac_kLowerApFactorsFloat[2] = {0.15440000000000f,
+                                                  0.74400000000000f};
+
+/* This function performs all-pass filtering--a series of first order all-pass
+ * sections are used to filter the input in a cascade manner.
+ * The input is overwritten!!
+ */
+void WebRtcIsac_AllPassFilter2Float(float* InOut,
+                                    const float* APSectionFactors,
+                                    int lengthInOut,
+                                    int NumberOfSections,
+                                    float* FilterState) {
+  int n, j;
+  float temp;
+  for (j = 0; j < NumberOfSections; j++) {
+    for (n = 0; n < lengthInOut; n++) {
+      temp = FilterState[j] + APSectionFactors[j] * InOut[n];
+      FilterState[j] = -APSectionFactors[j] * temp + InOut[n];
+      InOut[n] = temp;
+    }
+  }
+}
+
+/* The number of composite all-pass filter factors */
+#define NUMBEROFCOMPOSITEAPSECTIONS 4
+
+/* Function WebRtcIsac_SplitAndFilter
+ * This function creates low-pass and high-pass decimated versions of part of
+ the input signal, and part of the signal in the input 'lookahead buffer'.
+
+ INPUTS:
+ in: a length FRAMESAMPLES array of input samples
+ prefiltdata: input data structure containing the filterbank states
+ and lookahead samples from the previous encoding
+ iteration.
+ OUTPUTS:
+ LP: a FRAMESAMPLES_HALF array of low-pass filtered samples that
+ have been phase equalized.  The first QLOOKAHEAD samples are
+ based on the samples in the two prefiltdata->INLABUFx arrays
+ each of length QLOOKAHEAD.
+ The remaining FRAMESAMPLES_HALF-QLOOKAHEAD samples are based
+ on the first FRAMESAMPLES_HALF-QLOOKAHEAD samples of the input
+ array in[].
+ HP: a FRAMESAMPLES_HALF array of high-pass filtered samples that
+ have been phase equalized.  The first QLOOKAHEAD samples are
+ based on the samples in the two prefiltdata->INLABUFx arrays
+ each of length QLOOKAHEAD.
+ The remaining FRAMESAMPLES_HALF-QLOOKAHEAD samples are based
+ on the first FRAMESAMPLES_HALF-QLOOKAHEAD samples of the input
+ array in[].
+
+ LP_la: a FRAMESAMPLES_HALF array of low-pass filtered samples.
+ These samples are not phase equalized. They are computed
+ from the samples in the in[] array.
+ HP_la: a FRAMESAMPLES_HALF array of high-pass filtered samples
+ that are not phase equalized. They are computed from
+ the in[] vector.
+ prefiltdata: this input data structure's filterbank state and
+ lookahead sample buffers are updated for the next
+ encoding iteration.
+*/
+void WebRtcIsac_SplitAndFilterFloat(float* pin,
+                                    float* LP,
+                                    float* HP,
+                                    double* LP_la,
+                                    double* HP_la,
+                                    PreFiltBankstr* prefiltdata) {
+  int k, n;
+  float CompositeAPFilterState[NUMBEROFCOMPOSITEAPSECTIONS];
+  float ForTransform_CompositeAPFilterState[NUMBEROFCOMPOSITEAPSECTIONS];
+  float ForTransform_CompositeAPFilterState2[NUMBEROFCOMPOSITEAPSECTIONS];
+  float tempinoutvec[FRAMESAMPLES + MAX_AR_MODEL_ORDER];
+  float tempin_ch1[FRAMESAMPLES + MAX_AR_MODEL_ORDER];
+  float tempin_ch2[FRAMESAMPLES + MAX_AR_MODEL_ORDER];
+  float in[FRAMESAMPLES];
+  float ftmp;
+
+  /* HPstcoeff_in = {a1, a2, b1 - b0 * a1, b2 - b0 * a2}; */
+  static const float kHpStCoefInFloat[4] = {
+      -1.94895953203325f, 0.94984516000000f, -0.05101826139794f,
+      0.05015484000000f};
+
+  /* The composite all-pass filter factors */
+  static const float WebRtcIsac_kCompositeApFactorsFloat[4] = {
+      0.03470000000000f, 0.15440000000000f, 0.38260000000000f,
+      0.74400000000000f};
+
+  // The matrix for transforming the backward composite state to upper channel
+  // state.
+  static const float WebRtcIsac_kTransform1Float[8] = {
+      -0.00158678506084f, 0.00127157815343f, -0.00104805672709f,
+      0.00084837248079f,  0.00134467983258f, -0.00107756549387f,
+      0.00088814793277f,  -0.00071893072525f};
+
+  // The matrix for transforming the backward composite state to lower channel
+  // state.
+  static const float WebRtcIsac_kTransform2Float[8] = {
+      -0.00170686041697f, 0.00136780109829f, -0.00112736532350f,
+      0.00091257055385f,  0.00103094281812f, -0.00082615076557f,
+      0.00068092756088f,  -0.00055119165484f};
+
+  /* High pass filter */
+
+  for (k = 0; k < FRAMESAMPLES; k++) {
+    in[k] = pin[k] + kHpStCoefInFloat[2] * prefiltdata->HPstates_float[0] +
+            kHpStCoefInFloat[3] * prefiltdata->HPstates_float[1];
+    ftmp = pin[k] - kHpStCoefInFloat[0] * prefiltdata->HPstates_float[0] -
+           kHpStCoefInFloat[1] * prefiltdata->HPstates_float[1];
+    prefiltdata->HPstates_float[1] = prefiltdata->HPstates_float[0];
+    prefiltdata->HPstates_float[0] = ftmp;
+  }
+
+  /* First Channel */
+
+  /*initial state of composite filter is zero */
+  for (k = 0; k < NUMBEROFCOMPOSITEAPSECTIONS; k++) {
+    CompositeAPFilterState[k] = 0.0;
+  }
+  /* put every other sample of input into a temporary vector in reverse
+   * (backward) order*/
+  for (k = 0; k < FRAMESAMPLES_HALF; k++) {
+    tempinoutvec[k] = in[FRAMESAMPLES - 1 - 2 * k];
+  }
+
+  /* now all-pass filter the backwards vector.  Output values overwrite the
+   * input vector. */
+  WebRtcIsac_AllPassFilter2Float(
+      tempinoutvec, WebRtcIsac_kCompositeApFactorsFloat, FRAMESAMPLES_HALF,
+      NUMBEROFCOMPOSITEAPSECTIONS, CompositeAPFilterState);
+
+  /* save the backwards filtered output for later forward filtering,
+     but write it in forward order*/
+  for (k = 0; k < FRAMESAMPLES_HALF; k++) {
+    tempin_ch1[FRAMESAMPLES_HALF + QLOOKAHEAD - 1 - k] = tempinoutvec[k];
+  }
+
+  /* save the backwards filter state  becaue it will be transformed
+     later into a forward state */
+  for (k = 0; k < NUMBEROFCOMPOSITEAPSECTIONS; k++) {
+    ForTransform_CompositeAPFilterState[k] = CompositeAPFilterState[k];
+  }
+
+  /* now backwards filter the samples in the lookahead buffer. The samples were
+     placed there in the encoding of the previous frame.  The output samples
+     overwrite the input samples */
+  WebRtcIsac_AllPassFilter2Float(
+      prefiltdata->INLABUF1_float, WebRtcIsac_kCompositeApFactorsFloat,
+      QLOOKAHEAD, NUMBEROFCOMPOSITEAPSECTIONS, CompositeAPFilterState);
+
+  /* save the output, but write it in forward order */
+  /* write the lookahead samples for the next encoding iteration. Every other
+     sample at the end of the input frame is written in reverse order for the
+     lookahead length. Exported in the prefiltdata structure. */
+  for (k = 0; k < QLOOKAHEAD; k++) {
+    tempin_ch1[QLOOKAHEAD - 1 - k] = prefiltdata->INLABUF1_float[k];
+    prefiltdata->INLABUF1_float[k] = in[FRAMESAMPLES - 1 - 2 * k];
+  }
+
+  /* Second Channel.  This is exactly like the first channel, except that the
+     even samples are now filtered instead (lower channel). */
+  for (k = 0; k < NUMBEROFCOMPOSITEAPSECTIONS; k++) {
+    CompositeAPFilterState[k] = 0.0;
+  }
+
+  for (k = 0; k < FRAMESAMPLES_HALF; k++) {
+    tempinoutvec[k] = in[FRAMESAMPLES - 2 - 2 * k];
+  }
+
+  WebRtcIsac_AllPassFilter2Float(
+      tempinoutvec, WebRtcIsac_kCompositeApFactorsFloat, FRAMESAMPLES_HALF,
+      NUMBEROFCOMPOSITEAPSECTIONS, CompositeAPFilterState);
+
+  for (k = 0; k < FRAMESAMPLES_HALF; k++) {
+    tempin_ch2[FRAMESAMPLES_HALF + QLOOKAHEAD - 1 - k] = tempinoutvec[k];
+  }
+
+  for (k = 0; k < NUMBEROFCOMPOSITEAPSECTIONS; k++) {
+    ForTransform_CompositeAPFilterState2[k] = CompositeAPFilterState[k];
+  }
+
+  WebRtcIsac_AllPassFilter2Float(
+      prefiltdata->INLABUF2_float, WebRtcIsac_kCompositeApFactorsFloat,
+      QLOOKAHEAD, NUMBEROFCOMPOSITEAPSECTIONS, CompositeAPFilterState);
+
+  for (k = 0; k < QLOOKAHEAD; k++) {
+    tempin_ch2[QLOOKAHEAD - 1 - k] = prefiltdata->INLABUF2_float[k];
+    prefiltdata->INLABUF2_float[k] = in[FRAMESAMPLES - 2 - 2 * k];
+  }
+
+  /* Transform filter states from backward to forward */
+  /*At this point, each of the states of the backwards composite filters for the
+    two channels are transformed into forward filtering states for the
+    corresponding forward channel filters.  Each channel's forward filtering
+    state from the previous
+    encoding iteration is added to the transformed state to get a proper forward
+    state */
+
+  /* So the existing NUMBEROFCOMPOSITEAPSECTIONS x 1 (4x1) state vector is
+     multiplied by a NUMBEROFCHANNELAPSECTIONSxNUMBEROFCOMPOSITEAPSECTIONS (2x4)
+     transform matrix to get the new state that is added to the previous 2x1
+     input state */
+
+  for (k = 0; k < NUMBEROFCHANNELAPSECTIONS; k++) { /* k is row variable */
+    for (n = 0; n < NUMBEROFCOMPOSITEAPSECTIONS;
+         n++) { /* n is column variable */
+      prefiltdata->INSTAT1_float[k] +=
+          ForTransform_CompositeAPFilterState[n] *
+          WebRtcIsac_kTransform1Float[k * NUMBEROFCHANNELAPSECTIONS + n];
+      prefiltdata->INSTAT2_float[k] +=
+          ForTransform_CompositeAPFilterState2[n] *
+          WebRtcIsac_kTransform2Float[k * NUMBEROFCHANNELAPSECTIONS + n];
+    }
+  }
+
+  /*obtain polyphase components by forward all-pass filtering through each
+   * channel */
+  /* the backward filtered samples are now forward filtered with the
+   * corresponding channel filters */
+  /* The all pass filtering automatically updates the filter states which are
+     exported in the prefiltdata structure */
+  WebRtcIsac_AllPassFilter2Float(tempin_ch1, WebRtcIsac_kUpperApFactorsFloat,
+                                 FRAMESAMPLES_HALF, NUMBEROFCHANNELAPSECTIONS,
+                                 prefiltdata->INSTAT1_float);
+  WebRtcIsac_AllPassFilter2Float(tempin_ch2, WebRtcIsac_kLowerApFactorsFloat,
+                                 FRAMESAMPLES_HALF, NUMBEROFCHANNELAPSECTIONS,
+                                 prefiltdata->INSTAT2_float);
+
+  /* Now Construct low-pass and high-pass signals as combinations of polyphase
+   * components */
+  for (k = 0; k < FRAMESAMPLES_HALF; k++) {
+    LP[k] = 0.5f * (tempin_ch1[k] + tempin_ch2[k]); /* low pass signal*/
+    HP[k] = 0.5f * (tempin_ch1[k] - tempin_ch2[k]); /* high pass signal*/
+  }
+
+  /* Lookahead LP and HP signals */
+  /* now create low pass and high pass signals of the input vector.  However, no
+     backwards filtering is performed, and hence no phase equalization is
+     involved. Also, the input contains some samples that are lookahead samples.
+     The high pass and low pass signals that are created are used outside this
+     function for analysis (not encoding) purposes */
+
+  /* set up input */
+  for (k = 0; k < FRAMESAMPLES_HALF; k++) {
+    tempin_ch1[k] = in[2 * k + 1];
+    tempin_ch2[k] = in[2 * k];
+  }
+
+  /* the input filter states are passed in and updated by the all-pass filtering
+     routine and exported in the prefiltdata structure*/
+  WebRtcIsac_AllPassFilter2Float(tempin_ch1, WebRtcIsac_kUpperApFactorsFloat,
+                                 FRAMESAMPLES_HALF, NUMBEROFCHANNELAPSECTIONS,
+                                 prefiltdata->INSTATLA1_float);
+  WebRtcIsac_AllPassFilter2Float(tempin_ch2, WebRtcIsac_kLowerApFactorsFloat,
+                                 FRAMESAMPLES_HALF, NUMBEROFCHANNELAPSECTIONS,
+                                 prefiltdata->INSTATLA2_float);
+
+  for (k = 0; k < FRAMESAMPLES_HALF; k++) {
+    LP_la[k] = (float)(0.5f * (tempin_ch1[k] + tempin_ch2[k]));  /*low pass */
+    HP_la[k] = (double)(0.5f * (tempin_ch1[k] - tempin_ch2[k])); /* high pass */
+  }
+}
diff --git a/modules/audio_coding/codecs/isac/main/source/isac_vad.h b/modules/audio_coding/codecs/isac/main/source/isac_vad.h
new file mode 100644
index 0000000..1aecfc4
--- /dev/null
+++ b/modules/audio_coding/codecs/isac/main/source/isac_vad.h
@@ -0,0 +1,45 @@
+/*
+ *  Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
+ *
+ *  Use of this source code is governed by a BSD-style license
+ *  that can be found in the LICENSE file in the root of the source
+ *  tree. An additional intellectual property rights grant can be found
+ *  in the file PATENTS.  All contributing project authors may
+ *  be found in the AUTHORS file in the root of the source tree.
+ */
+
+#ifndef MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_ISAC_VAD_H_
+#define MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_ISAC_VAD_H_
+
+#include <stddef.h>
+
+#include "modules/audio_coding/codecs/isac/main/source/structs.h"
+
+void WebRtcIsac_InitPitchFilter(PitchFiltstr* pitchfiltdata);
+void WebRtcIsac_InitPitchAnalysis(PitchAnalysisStruct* state);
+void WebRtcIsac_InitPreFilterbank(PreFiltBankstr* prefiltdata);
+
+double WebRtcIsac_LevDurb(double* a, double* k, double* r, size_t order);
+
+/* The number of all-pass filter factors in an upper or lower channel*/
+#define NUMBEROFCHANNELAPSECTIONS 2
+
+/* The upper channel all-pass filter factors */
+extern const float WebRtcIsac_kUpperApFactorsFloat[2];
+
+/* The lower channel all-pass filter factors */
+extern const float WebRtcIsac_kLowerApFactorsFloat[2];
+
+void WebRtcIsac_AllPassFilter2Float(float* InOut,
+                                    const float* APSectionFactors,
+                                    int lengthInOut,
+                                    int NumberOfSections,
+                                    float* FilterState);
+void WebRtcIsac_SplitAndFilterFloat(float* in,
+                                    float* LP,
+                                    float* HP,
+                                    double* LP_la,
+                                    double* HP_la,
+                                    PreFiltBankstr* prefiltdata);
+
+#endif  // MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_ISAC_VAD_H_
diff --git a/modules/audio_coding/codecs/isac/main/source/lpc_analysis.c b/modules/audio_coding/codecs/isac/main/source/lpc_analysis.c
index dbf33fc..0fda73b 100644
--- a/modules/audio_coding/codecs/isac/main/source/lpc_analysis.c
+++ b/modules/audio_coding/codecs/isac/main/source/lpc_analysis.c
@@ -15,9 +15,8 @@
 #include "modules/audio_coding/codecs/isac/main/source/settings.h"
 #include "modules/audio_coding/codecs/isac/main/source/codec.h"
 #include "modules/audio_coding/codecs/isac/main/source/entropy_coding.h"
-
-#define LEVINSON_EPS    1.0e-10
-
+#include "modules/audio_coding/codecs/isac/main/source/filter_functions.h"
+#include "modules/audio_coding/codecs/isac/main/source/isac_vad.h"
 
 /* window */
 /* Matlab generation code:
@@ -75,45 +74,10 @@
   0.00155690, 0.00124918, 0.00094895, 0.00066112, 0.00039320, 0.00015881
 };
 
-double WebRtcIsac_LevDurb(double *a, double *k, double *r, size_t order)
-{
-
-  double sum, alpha;
-  size_t m, m_h, i;
-  alpha = 0; //warning -DH
-  a[0] = 1.0;
-  if (r[0] < LEVINSON_EPS) { /* if r[0] <= 0, set LPC coeff. to zero */
-    for (i = 0; i < order; i++) {
-      k[i] = 0;
-      a[i+1] = 0;
-    }
-  } else {
-    a[1] = k[0] = -r[1]/r[0];
-    alpha = r[0] + r[1] * k[0];
-    for (m = 1; m < order; m++){
-      sum = r[m + 1];
-      for (i = 0; i < m; i++){
-        sum += a[i+1] * r[m - i];
-      }
-      k[m] = -sum / alpha;
-      alpha += k[m] * sum;
-      m_h = (m + 1) >> 1;
-      for (i = 0; i < m_h; i++){
-        sum = a[i+1] + k[m] * a[m - i];
-        a[m - i] += k[m] * a[i+1];
-        a[i+1] = sum;
-      }
-      a[m+1] = k[m];
-    }
-  }
-  return alpha;
-}
-
-
-//was static before, but didn't work with MEX file
-void WebRtcIsac_GetVars(const double *input, const int16_t *pitchGains_Q12,
-                       double *oldEnergy, double *varscale)
-{
+static void WebRtcIsac_GetVars(const double* input,
+                               const int16_t* pitchGains_Q12,
+                               double* oldEnergy,
+                               double* varscale) {
   double nrg[4], chng, pg;
   int k;
 
@@ -162,12 +126,9 @@
   *oldEnergy = nrg[3];
 }
 
-void
-WebRtcIsac_GetVarsUB(
-    const double* input,
-    double*       oldEnergy,
-    double*       varscale)
-{
+static void WebRtcIsac_GetVarsUB(const double* input,
+                                 double* oldEnergy,
+                                 double* varscale) {
   double nrg[4], chng;
   int k;
 
diff --git a/modules/audio_coding/codecs/isac/main/source/lpc_analysis.h b/modules/audio_coding/codecs/isac/main/source/lpc_analysis.h
index c0848ab..30f9153 100644
--- a/modules/audio_coding/codecs/isac/main/source/lpc_analysis.h
+++ b/modules/audio_coding/codecs/isac/main/source/lpc_analysis.h
@@ -21,16 +21,10 @@
 #include "modules/audio_coding/codecs/isac/main/source/settings.h"
 #include "modules/audio_coding/codecs/isac/main/source/structs.h"
 
-double WebRtcIsac_LevDurb(double *a, double *k, double *r, size_t order);
-
-void WebRtcIsac_GetVars(const double *input, const int16_t *pitchGains_Q12,
-                       double *oldEnergy, double *varscale);
-
 void WebRtcIsac_GetLpcCoefLb(double *inLo, double *inHi, MaskFiltstr *maskdata,
                              double signal_noise_ratio, const int16_t *pitchGains_Q12,
                              double *lo_coeff, double *hi_coeff);
 
-
 void WebRtcIsac_GetLpcGain(
     double         signal_noise_ratio,
     const double*  filtCoeffVecs,
diff --git a/modules/audio_coding/codecs/isac/main/source/pitch_estimator.c b/modules/audio_coding/codecs/isac/main/source/pitch_estimator.c
index 4c0a558..8a19ac1 100644
--- a/modules/audio_coding/codecs/isac/main/source/pitch_estimator.c
+++ b/modules/audio_coding/codecs/isac/main/source/pitch_estimator.c
@@ -8,6 +8,8 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
+#include "modules/audio_coding/codecs/isac/main/source/pitch_estimator.h"
+
 #include <math.h>
 #include <memory.h>
 #include <string.h>
@@ -15,7 +17,9 @@
 #include <stdlib.h>
 #endif
 
-#include "modules/audio_coding/codecs/isac/main/source/pitch_estimator.h"
+#include "modules/audio_coding/codecs/isac/main/source/filter_functions.h"
+#include "modules/audio_coding/codecs/isac/main/source/pitch_filter.h"
+#include "rtc_base/system/ignore_warnings.h"
 
 static const double kInterpolWin[8] = {-0.00067556028640,  0.02184247643159, -0.12203175715679,  0.60086484101160,
                                        0.60086484101160, -0.12203175715679,  0.02184247643159, -0.00067556028640};
@@ -122,13 +126,56 @@
   }
 }
 
+static void WebRtcIsac_AllpassFilterForDec(double* InOut,
+                                           const double* APSectionFactors,
+                                           size_t lengthInOut,
+                                           double* FilterState) {
+  // This performs all-pass filtering--a series of first order all-pass
+  // sections are used to filter the input in a cascade manner.
+  size_t n, j;
+  double temp;
+  for (j = 0; j < ALLPASSSECTIONS; j++) {
+    for (n = 0; n < lengthInOut; n += 2) {
+      temp = InOut[n];  // store input
+      InOut[n] = FilterState[j] + APSectionFactors[j] * temp;
+      FilterState[j] = -APSectionFactors[j] * InOut[n] + temp;
+    }
+  }
+}
 
-void WebRtcIsac_InitializePitch(const double *in,
-                                const double old_lag,
-                                const double old_gain,
-                                PitchAnalysisStruct *State,
-                                double *lags)
-{
+static void WebRtcIsac_DecimateAllpass(
+    const double* in,
+    double* state_in,  // array of size: 2*ALLPASSSECTIONS+1
+    size_t N,          // number of input samples
+    double* out) {     // array of size N/2
+
+  static const double APupper[ALLPASSSECTIONS] = {0.0347, 0.3826};
+  static const double APlower[ALLPASSSECTIONS] = {0.1544, 0.744};
+
+  size_t n;
+  double data_vec[PITCH_FRAME_LEN];
+
+  /* copy input */
+  memcpy(data_vec + 1, in, sizeof(double) * (N - 1));
+
+  data_vec[0] = state_in[2 * ALLPASSSECTIONS];  // the z^(-1) state
+  state_in[2 * ALLPASSSECTIONS] = in[N - 1];
+
+  WebRtcIsac_AllpassFilterForDec(data_vec + 1, APupper, N, state_in);
+  WebRtcIsac_AllpassFilterForDec(data_vec, APlower, N,
+                                 state_in + ALLPASSSECTIONS);
+
+  for (n = 0; n < N / 2; n++)
+    out[n] = data_vec[2 * n] + data_vec[2 * n + 1];
+}
+
+RTC_PUSH_IGNORING_WFRAME_LARGER_THAN()
+
+static void WebRtcIsac_InitializePitch(const double* in,
+                                       const double old_lag,
+                                       const double old_gain,
+                                       PitchAnalysisStruct* State,
+                                       double* lags) {
   double buf_dec[PITCH_CORR_LEN2+PITCH_CORR_STEP2+PITCH_MAX_LAG/2+2];
   double ratio, log_lag, gain_bias;
   double bias;
@@ -449,7 +496,7 @@
   }
 }
 
-
+RTC_POP_IGNORING_WFRAME_LARGER_THAN()
 
 /* create weighting matrix by orthogonalizing a basis of polynomials of increasing order
  * t = (0:4)';
@@ -464,6 +511,29 @@
   { 0.01714285714286,   0.05142857142857,  -0.05714285714286,  -0.30857142857143,  0.29714285714286}
 };
 
+/* second order high-pass filter */
+static void WebRtcIsac_Highpass(const double* in,
+                         double* out,
+                         double* state,
+                         size_t N) {
+  /* create high-pass filter ocefficients
+   * z = 0.998 * exp(j*2*pi*35/8000);
+   * p = 0.94 * exp(j*2*pi*140/8000);
+   * HP_b = [1, -2*real(z), abs(z)^2];
+   * HP_a = [1, -2*real(p), abs(p)^2]; */
+  static const double a_coef[2] = { 1.86864659625574, -0.88360000000000};
+  static const double b_coef[2] = {-1.99524591718270,  0.99600400000000};
+
+  size_t k;
+
+  for (k=0; k<N; k++) {
+    *out = *in + state[1];
+    state[1] = state[0] + b_coef[0] * *in + a_coef[0] * *out;
+    state[0] = b_coef[1] * *in++ + a_coef[1] * *out++;
+  }
+}
+
+RTC_PUSH_IGNORING_WFRAME_LARGER_THAN()
 
 void WebRtcIsac_PitchAnalysis(const double *in,               /* PITCH_FRAME_LEN samples */
                               double *out,                    /* PITCH_FRAME_LEN+QLOOKAHEAD samples */
@@ -621,3 +691,5 @@
   for (k = 0; k < QLOOKAHEAD; k++)
     State->inbuf[k] = inbuf[k + PITCH_FRAME_LEN];
 }
+
+RTC_POP_IGNORING_WFRAME_LARGER_THAN()
diff --git a/modules/audio_coding/codecs/isac/main/source/pitch_estimator.h b/modules/audio_coding/codecs/isac/main/source/pitch_estimator.h
index 47dab0e..c03ce62 100644
--- a/modules/audio_coding/codecs/isac/main/source/pitch_estimator.h
+++ b/modules/audio_coding/codecs/isac/main/source/pitch_estimator.h
@@ -18,6 +18,8 @@
 #ifndef MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_PITCH_ESTIMATOR_H_
 #define MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_PITCH_ESTIMATOR_H_
 
+#include <stddef.h>
+
 #include "modules/audio_coding/codecs/isac/main/source/structs.h"
 
 void WebRtcIsac_PitchAnalysis(const double *in,               /* PITCH_FRAME_LEN samples */
@@ -26,48 +28,4 @@
                               double *lags,
                               double *gains);
 
-void WebRtcIsac_InitializePitch(const double *in,
-                                const double old_lag,
-                                const double old_gain,
-                                PitchAnalysisStruct *State,
-                                double *lags);
-
-void WebRtcIsac_PitchfilterPre(double *indat,
-                               double *outdat,
-                               PitchFiltstr *pfp,
-                               double *lags,
-                               double *gains);
-
-void WebRtcIsac_PitchfilterPost(double *indat,
-                                double *outdat,
-                                PitchFiltstr *pfp,
-                                double *lags,
-                                double *gains);
-
-void WebRtcIsac_PitchfilterPre_la(double *indat,
-                                  double *outdat,
-                                  PitchFiltstr *pfp,
-                                  double *lags,
-                                  double *gains);
-
-void WebRtcIsac_PitchfilterPre_gains(double *indat,
-                                     double *outdat,
-                                     double out_dG[][PITCH_FRAME_LEN + QLOOKAHEAD],
-                                     PitchFiltstr *pfp,
-                                     double *lags,
-                                     double *gains);
-
-void WebRtcIsac_WeightingFilter(const double *in, double *weiout, double *whiout, WeightFiltstr *wfdata);
-
-void WebRtcIsac_Highpass(const double *in,
-                         double *out,
-                         double *state,
-                         size_t N);
-
-void WebRtcIsac_DecimateAllpass(const double *in,
-                                double *state_in,  /* array of size:
-                                                    *     2*ALLPASSSECTIONS+1 */
-                                size_t N,          /* number of input samples */
-                                double *out);      /* array of size N/2 */
-
 #endif /* MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_PITCH_ESTIMATOR_H_ */
diff --git a/modules/audio_coding/codecs/isac/main/source/pitch_filter.h b/modules/audio_coding/codecs/isac/main/source/pitch_filter.h
new file mode 100644
index 0000000..9a232de
--- /dev/null
+++ b/modules/audio_coding/codecs/isac/main/source/pitch_filter.h
@@ -0,0 +1,42 @@
+/*
+ *  Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
+ *
+ *  Use of this source code is governed by a BSD-style license
+ *  that can be found in the LICENSE file in the root of the source
+ *  tree. An additional intellectual property rights grant can be found
+ *  in the file PATENTS.  All contributing project authors may
+ *  be found in the AUTHORS file in the root of the source tree.
+ */
+
+#ifndef MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_PITCH_FILTER_H_
+#define MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_PITCH_FILTER_H_
+
+#include "modules/audio_coding/codecs/isac/main/source/structs.h"
+
+void WebRtcIsac_PitchfilterPre(double* indat,
+                               double* outdat,
+                               PitchFiltstr* pfp,
+                               double* lags,
+                               double* gains);
+
+void WebRtcIsac_PitchfilterPost(double* indat,
+                                double* outdat,
+                                PitchFiltstr* pfp,
+                                double* lags,
+                                double* gains);
+
+void WebRtcIsac_PitchfilterPre_la(double* indat,
+                                  double* outdat,
+                                  PitchFiltstr* pfp,
+                                  double* lags,
+                                  double* gains);
+
+void WebRtcIsac_PitchfilterPre_gains(
+    double* indat,
+    double* outdat,
+    double out_dG[][PITCH_FRAME_LEN + QLOOKAHEAD],
+    PitchFiltstr* pfp,
+    double* lags,
+    double* gains);
+
+#endif  // MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_PITCH_FILTER_H_
diff --git a/modules/audio_coding/codecs/isac/main/source/structs.h b/modules/audio_coding/codecs/isac/main/source/structs.h
index ef4282b..8197d55 100644
--- a/modules/audio_coding/codecs/isac/main/source/structs.h
+++ b/modules/audio_coding/codecs/isac/main/source/structs.h
@@ -19,7 +19,6 @@
 #define MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_STRUCTS_H_
 
 #include "modules/audio_coding/codecs/isac/bandwidth_info.h"
-#include "modules/audio_coding/codecs/isac/main/include/isac.h"
 #include "modules/audio_coding/codecs/isac/main/source/settings.h"
 #include "typedefs.h"  // NOLINT(build/include)