Sentinel commit pointing at new location in Chromium.
diff --git a/AUTHORS b/AUTHORS
deleted file mode 100644
index 395c3fe..0000000
--- a/AUTHORS
+++ /dev/null
@@ -1,18 +0,0 @@
-Jean-Marc Valin <jean-marc.valin@usherbrooke.ca>
-   All the code except the following
-
-David Rowe <david@rowetel.com>
-   lsp.c lsp.h 
-   Also ideas and feedback
-
-John Francis Edwards
-   wave_out.[ch], some #ifdefs for windows port and MSVC project files
-
-Segher Boessenkool
-   Misc. optimizations (for QMF in particular)
-
-Atsuhiko Yamanaka <ymnk@jcraft.com>:
-   Patch to speexenc.c to add Vorbis comment format
-
-Radim Kolar <hsn@cybermail.net>:
-   Patch to speexenc.c for supporting more input formats
diff --git a/BUILD.gn b/BUILD.gn
deleted file mode 100644
index 5462673..0000000
--- a/BUILD.gn
+++ /dev/null
@@ -1,96 +0,0 @@
-# Copyright 2014 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-config("speex_config") {
-  include_dirs = [
-    "include",  # Clients expect <speex/speex.h> to be a system header.
-  ]
-}
-
-source_set("speex") {
-  sources = [
-    "libspeex/arch.h",
-    "libspeex/bits.c",
-    "libspeex/cb_search.c",
-    "libspeex/cb_search.h",
-    "libspeex/exc_10_16_table.c",
-    "libspeex/exc_10_32_table.c",
-    "libspeex/exc_20_32_table.c",
-    "libspeex/exc_5_256_table.c",
-    "libspeex/exc_5_64_table.c",
-    "libspeex/exc_8_128_table.c",
-    "libspeex/filters.c",
-    "libspeex/filters.h",
-    "libspeex/gain_table.c",
-    "libspeex/gain_table_lbr.c",
-    "libspeex/hexc_10_32_table.c",
-    "libspeex/hexc_table.c",
-    "libspeex/high_lsp_tables.c",
-    "libspeex/lpc.c",
-    "libspeex/lpc.h",
-    "libspeex/lsp.c",
-    "libspeex/lsp.h",
-    "libspeex/lsp_tables_nb.c",
-    "libspeex/ltp.c",
-    "libspeex/ltp.h",
-    "libspeex/math_approx.h",
-    "libspeex/modes.c",
-    "libspeex/modes.h",
-    "libspeex/modes_wb.c",
-    "libspeex/nb_celp.c",
-    "libspeex/nb_celp.h",
-    "libspeex/os_support.h",
-    "libspeex/pseudofloat.h",
-    "libspeex/quant_lsp.c",
-    "libspeex/quant_lsp.h",
-    "libspeex/sb_celp.c",
-    "libspeex/sb_celp.h",
-    "libspeex/speex.c",
-    "libspeex/speex_callbacks.c",
-    "libspeex/speex_header.c",
-    "libspeex/stack_alloc.h",
-    "libspeex/stereo.c",
-    "libspeex/vbr.c",
-    "libspeex/vbr.h",
-    "libspeex/vq.c",
-    "libspeex/vq.h",
-    "libspeex/window.c",
-    "include/speex/speex.h",
-    "include/speex/speex_bits.h",
-    "include/speex/speex_buffer.h",
-    "include/speex/speex_callbacks.h",
-    "include/speex/speex_echo.h",
-    "include/speex/speex_header.h",
-    "include/speex/speex_jitter.h",
-    "include/speex/speex_preprocess.h",
-    "include/speex/speex_resampler.h",
-    "include/speex/speex_stereo.h",
-    "include/speex/speex_types.h",
-  ]
-
-  configs -= [ "//build/config/compiler:chromium_code" ]
-  configs += [ "//build/config/compiler:no_chromium_code" ]
-
-  direct_dependent_configs = [ ":speex_config" ]
-
-  include_dirs = [
-    "libspeex",
-  ]
-
-  defines = [
-    "FLOATING_POINT",
-    "EXPORT=",
-    "USE_ALLOCA",
-    "inline=__inline",
-  ]
-
-  cflags = []
-
-  if (is_win) {
-    cflags += [
-      "/wd4244",
-      "/wd4305",
-    ]
-  }
-}
diff --git a/COPYING b/COPYING
deleted file mode 100644
index de6fbe2..0000000
--- a/COPYING
+++ /dev/null
@@ -1,35 +0,0 @@
-Copyright 2002-2008 	Xiph.org Foundation
-Copyright 2002-2008 	Jean-Marc Valin
-Copyright 2005-2007	Analog Devices Inc.
-Copyright 2005-2008	Commonwealth Scientific and Industrial Research 
-                        Organisation (CSIRO)
-Copyright 1993, 2002, 2006 David Rowe
-Copyright 2003 		EpicGames
-Copyright 1992-1994	Jutta Degener, Carsten Bormann
-
-Redistribution and use in source and binary forms, with or without
-modification, 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 the Xiph.org Foundation nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-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 FOUNDATION 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.
diff --git a/README b/README
index 84fe74a..350d7d8 100644
--- a/README
+++ b/README
@@ -1,9 +1,2 @@
-See INSTALL file for instruction on how to install Speex.
-
-The Speex is a patent-free, Open Source/Free Software voice codec. Unlike other codecs like MP3 and Ogg Vorbis, Speex is designed to compress voice at bitrates in the 2-45 kbps range. Possible applications include VoIP, internet audio streaming, archiving of speech data (e.g. voice mail), and audio books. In some sense, it is meant to be complementary to the Ogg Vorbis codec.
-
-To use the Speex command line tools:
-
-% speexenc [options] input_file.wav compressed_file.spx
-
-% speexdec [options] compressed_file.spx output_file.wav
+This repository has been merged directly into Chromium. You can now find it at
+https://chromium.googlesource.com/chromium/src/+/master/third_party/speex
diff --git a/README.chromium b/README.chromium
deleted file mode 100644
index 11c533d..0000000
--- a/README.chromium
+++ /dev/null
@@ -1,15 +0,0 @@
-Name: speex
-URL: http://downloads.xiph.org/releases/speex/speex-1.2rc1.tar.gz
-Version: 1.2.rc1
-License: BSD
-Security Critical: yes
-
-Description:
-This contains a copy of speex-1.2.rc1
-
-This library is required for the browser to compress and encode recorded audio
-before sending to Google servers for speech recognition. This is a straight dump
-of speex-1.2rc1 with all the unused files removed with the following changes:
-
-1. Added include/speex/speex_config_types.h generated by the configure script
-   on Linux.
diff --git a/TODO b/TODO
deleted file mode 100644
index fd3c953..0000000
--- a/TODO
+++ /dev/null
@@ -1,48 +0,0 @@
-For 1.2:
-Major points:
-- Make documentation match the actual code (especially jitter buffer, AEC and preprocessor)
-- Get AGC to work in fixed-point even if not totally converted
-- Stabilise all APIs (need feedback)
-- Short-term estimate in jitter buffer
-- Control delay in new AEC API.
-- NaN checks?
-- Better error reporting
-- Make kiss-fft 32-bit safe
-
-Minor issues:
-- Fix last frame of speexenc
-
-
-Post 1.2:
-improve float<->int conversion
-split encoder and decoder?
-Merge TriMedia stuff
-packet dump
-Do VAD properly
---enable-{aec,preprocessor,jitter,resampler}
-
-Optimisations
-- Add restrict in a few places?
-- enable 4x4 version of pitch_xcorr() at least on some archs?
-- use __builtin_expect() (likely()/unlikely())
-
-Would be nice:
-Implement wideband split as IIR instead of QMF?
-
-Allocator override (speex_lib_ctl?)
-Fixed-point:
-  - VBR
-  - Jitter buffer
-  - AGC
-Denoiser:
-  - Better noise adaptation
-AGC:
-  - Use median filtering instead of "non-linear mean"?
-
-Standards
--Complete Speex RTP profile
--MIME type registration
-
-ideas:
-Peelable stream (double codebook, higher bands, stereo)
-LPC from spectral domain
diff --git a/codereview.settings b/codereview.settings
deleted file mode 100644
index e0e79c5..0000000
--- a/codereview.settings
+++ /dev/null
@@ -1,9 +0,0 @@
-CODE_REVIEW_SERVER: codereview.chromium.org
-CC_LIST: chromium-reviews@chromium.org
-VIEW_VC: https://chromium.googlesource.com/chromium/deps/speex/+/
-STATUS: http://chromium-status.appspot.com/status
-TRY_ON_UPLOAD: False
-TRYSERVER_SVN_URL: svn://svn.chromium.org/chrome-try/try
-GITCL_PREUPLOAD: http://src.chromium.org/viewvc/chrome/trunk/tools/depot_tools/git-cl-upload-hook?revision=HEAD
-GITCL_PREDCOMMIT: http://src.chromium.org/viewvc/chrome/trunk/tools/depot_tools/git-cl-upload-hook?revision=HEAD
-PROJECT: chromium_deps
diff --git a/include/speex/speex.h b/include/speex/speex.h
deleted file mode 100644
index 82ba016..0000000
--- a/include/speex/speex.h
+++ /dev/null
@@ -1,424 +0,0 @@
-/* Copyright (C) 2002-2006 Jean-Marc Valin*/
-/**
-  @file speex.h
-  @brief Describes the different modes of the codec
-*/
-/*
-   Redistribution and use in source and binary forms, with or without
-   modification, 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 the Xiph.org Foundation nor the names of its
-   contributors may be used to endorse or promote products derived from
-   this software without specific prior written permission.
-   
-   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 FOUNDATION OR
-   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-*/
-
-#ifndef SPEEX_H
-#define SPEEX_H
-/** @defgroup Codec Speex encoder and decoder
- *  This is the Speex codec itself.
- *  @{
- */
-
-#include "speex/speex_bits.h"
-#include "speex/speex_types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Values allowed for *ctl() requests */
-
-/** Set enhancement on/off (decoder only) */
-#define SPEEX_SET_ENH 0
-/** Get enhancement state (decoder only) */
-#define SPEEX_GET_ENH 1
-
-/*Would be SPEEX_SET_FRAME_SIZE, but it's (currently) invalid*/
-/** Obtain frame size used by encoder/decoder */
-#define SPEEX_GET_FRAME_SIZE 3
-
-/** Set quality value */
-#define SPEEX_SET_QUALITY 4
-/** Get current quality setting */
-/* #define SPEEX_GET_QUALITY 5 -- Doesn't make much sense, does it? */
-
-/** Set sub-mode to use */
-#define SPEEX_SET_MODE 6
-/** Get current sub-mode in use */
-#define SPEEX_GET_MODE 7
-
-/** Set low-band sub-mode to use (wideband only)*/
-#define SPEEX_SET_LOW_MODE 8
-/** Get current low-band mode in use (wideband only)*/
-#define SPEEX_GET_LOW_MODE 9
-
-/** Set high-band sub-mode to use (wideband only)*/
-#define SPEEX_SET_HIGH_MODE 10
-/** Get current high-band mode in use (wideband only)*/
-#define SPEEX_GET_HIGH_MODE 11
-
-/** Set VBR on (1) or off (0) */
-#define SPEEX_SET_VBR 12
-/** Get VBR status (1 for on, 0 for off) */
-#define SPEEX_GET_VBR 13
-
-/** Set quality value for VBR encoding (0-10) */
-#define SPEEX_SET_VBR_QUALITY 14
-/** Get current quality value for VBR encoding (0-10) */
-#define SPEEX_GET_VBR_QUALITY 15
-
-/** Set complexity of the encoder (0-10) */
-#define SPEEX_SET_COMPLEXITY 16
-/** Get current complexity of the encoder (0-10) */
-#define SPEEX_GET_COMPLEXITY 17
-
-/** Set bit-rate used by the encoder (or lower) */
-#define SPEEX_SET_BITRATE 18
-/** Get current bit-rate used by the encoder or decoder */
-#define SPEEX_GET_BITRATE 19
-
-/** Define a handler function for in-band Speex request*/
-#define SPEEX_SET_HANDLER 20
-
-/** Define a handler function for in-band user-defined request*/
-#define SPEEX_SET_USER_HANDLER 22
-
-/** Set sampling rate used in bit-rate computation */
-#define SPEEX_SET_SAMPLING_RATE 24
-/** Get sampling rate used in bit-rate computation */
-#define SPEEX_GET_SAMPLING_RATE 25
-
-/** Reset the encoder/decoder memories to zero*/
-#define SPEEX_RESET_STATE 26
-
-/** Get VBR info (mostly used internally) */
-#define SPEEX_GET_RELATIVE_QUALITY 29
-
-/** Set VAD status (1 for on, 0 for off) */
-#define SPEEX_SET_VAD 30
-
-/** Get VAD status (1 for on, 0 for off) */
-#define SPEEX_GET_VAD 31
-
-/** Set Average Bit-Rate (ABR) to n bits per seconds */
-#define SPEEX_SET_ABR 32
-/** Get Average Bit-Rate (ABR) setting (in bps) */
-#define SPEEX_GET_ABR 33
-
-/** Set DTX status (1 for on, 0 for off) */
-#define SPEEX_SET_DTX 34
-/** Get DTX status (1 for on, 0 for off) */
-#define SPEEX_GET_DTX 35
-
-/** Set submode encoding in each frame (1 for yes, 0 for no, setting to no breaks the standard) */
-#define SPEEX_SET_SUBMODE_ENCODING 36
-/** Get submode encoding in each frame */
-#define SPEEX_GET_SUBMODE_ENCODING 37
-
-/*#define SPEEX_SET_LOOKAHEAD 38*/
-/** Returns the lookahead used by Speex */
-#define SPEEX_GET_LOOKAHEAD 39
-
-/** Sets tuning for packet-loss concealment (expected loss rate) */
-#define SPEEX_SET_PLC_TUNING 40
-/** Gets tuning for PLC */
-#define SPEEX_GET_PLC_TUNING 41
-
-/** Sets the max bit-rate allowed in VBR mode */
-#define SPEEX_SET_VBR_MAX_BITRATE 42
-/** Gets the max bit-rate allowed in VBR mode */
-#define SPEEX_GET_VBR_MAX_BITRATE 43
-
-/** Turn on/off input/output high-pass filtering */
-#define SPEEX_SET_HIGHPASS 44
-/** Get status of input/output high-pass filtering */
-#define SPEEX_GET_HIGHPASS 45
-
-/** Get "activity level" of the last decoded frame, i.e.
-    how much damage we cause if we remove the frame */
-#define SPEEX_GET_ACTIVITY 47
-
-
-/* Preserving compatibility:*/
-/** Equivalent to SPEEX_SET_ENH */
-#define SPEEX_SET_PF 0
-/** Equivalent to SPEEX_GET_ENH */
-#define SPEEX_GET_PF 1
-
-
-
-
-/* Values allowed for mode queries */
-/** Query the frame size of a mode */
-#define SPEEX_MODE_FRAME_SIZE 0
-
-/** Query the size of an encoded frame for a particular sub-mode */
-#define SPEEX_SUBMODE_BITS_PER_FRAME 1
-
-
-
-/** Get major Speex version */
-#define SPEEX_LIB_GET_MAJOR_VERSION 1
-/** Get minor Speex version */
-#define SPEEX_LIB_GET_MINOR_VERSION 3
-/** Get micro Speex version */
-#define SPEEX_LIB_GET_MICRO_VERSION 5
-/** Get extra Speex version */
-#define SPEEX_LIB_GET_EXTRA_VERSION 7
-/** Get Speex version string */
-#define SPEEX_LIB_GET_VERSION_STRING 9
-
-/*#define SPEEX_LIB_SET_ALLOC_FUNC 10
-#define SPEEX_LIB_GET_ALLOC_FUNC 11
-#define SPEEX_LIB_SET_FREE_FUNC 12
-#define SPEEX_LIB_GET_FREE_FUNC 13
-
-#define SPEEX_LIB_SET_WARNING_FUNC 14
-#define SPEEX_LIB_GET_WARNING_FUNC 15
-#define SPEEX_LIB_SET_ERROR_FUNC 16
-#define SPEEX_LIB_GET_ERROR_FUNC 17
-*/
-
-/** Number of defined modes in Speex */
-#define SPEEX_NB_MODES 3
-
-/** modeID for the defined narrowband mode */
-#define SPEEX_MODEID_NB 0
-
-/** modeID for the defined wideband mode */
-#define SPEEX_MODEID_WB 1
-
-/** modeID for the defined ultra-wideband mode */
-#define SPEEX_MODEID_UWB 2
-
-struct SpeexMode;
-
-
-/* Prototypes for mode function pointers */
-
-/** Encoder state initialization function */
-typedef void *(*encoder_init_func)(const struct SpeexMode *mode);
-
-/** Encoder state destruction function */
-typedef void (*encoder_destroy_func)(void *st);
-
-/** Main encoding function */
-typedef int (*encode_func)(void *state, void *in, SpeexBits *bits);
-
-/** Function for controlling the encoder options */
-typedef int (*encoder_ctl_func)(void *state, int request, void *ptr);
-
-/** Decoder state initialization function */
-typedef void *(*decoder_init_func)(const struct SpeexMode *mode);
-
-/** Decoder state destruction function */
-typedef void (*decoder_destroy_func)(void *st);
-
-/** Main decoding function */
-typedef int  (*decode_func)(void *state, SpeexBits *bits, void *out);
-
-/** Function for controlling the decoder options */
-typedef int (*decoder_ctl_func)(void *state, int request, void *ptr);
-
-
-/** Query function for a mode */
-typedef int (*mode_query_func)(const void *mode, int request, void *ptr);
-
-/** Struct defining a Speex mode */ 
-typedef struct SpeexMode {
-   /** Pointer to the low-level mode data */
-   const void *mode;
-
-   /** Pointer to the mode query function */
-   mode_query_func query;
-   
-   /** The name of the mode (you should not rely on this to identify the mode)*/
-   const char *modeName;
-
-   /**ID of the mode*/
-   int modeID;
-
-   /**Version number of the bitstream (incremented every time we break
-    bitstream compatibility*/
-   int bitstream_version;
-
-   /** Pointer to encoder initialization function */
-   encoder_init_func enc_init;
-
-   /** Pointer to encoder destruction function */
-   encoder_destroy_func enc_destroy;
-
-   /** Pointer to frame encoding function */
-   encode_func enc;
-
-   /** Pointer to decoder initialization function */
-   decoder_init_func dec_init;
-
-   /** Pointer to decoder destruction function */
-   decoder_destroy_func dec_destroy;
-
-   /** Pointer to frame decoding function */
-   decode_func dec;
-
-   /** ioctl-like requests for encoder */
-   encoder_ctl_func enc_ctl;
-
-   /** ioctl-like requests for decoder */
-   decoder_ctl_func dec_ctl;
-
-} SpeexMode;
-
-/**
- * Returns a handle to a newly created Speex encoder state structure. For now, 
- * the "mode" argument can be &nb_mode or &wb_mode . In the future, more modes 
- * may be added. Note that for now if you have more than one channels to 
- * encode, you need one state per channel.
- *
- * @param mode The mode to use (either speex_nb_mode or speex_wb.mode) 
- * @return A newly created encoder state or NULL if state allocation fails
- */
-void *speex_encoder_init(const SpeexMode *mode);
-
-/** Frees all resources associated to an existing Speex encoder state. 
- * @param state Encoder state to be destroyed */
-void speex_encoder_destroy(void *state);
-
-/** Uses an existing encoder state to encode one frame of speech pointed to by
-    "in". The encoded bit-stream is saved in "bits".
- @param state Encoder state
- @param in Frame that will be encoded with a +-2^15 range. This data MAY be 
-        overwritten by the encoder and should be considered uninitialised 
-        after the call.
- @param bits Bit-stream where the data will be written
- @return 0 if frame needs not be transmitted (DTX only), 1 otherwise
- */
-int speex_encode(void *state, float *in, SpeexBits *bits);
-
-/** Uses an existing encoder state to encode one frame of speech pointed to by
-    "in". The encoded bit-stream is saved in "bits".
- @param state Encoder state
- @param in Frame that will be encoded with a +-2^15 range
- @param bits Bit-stream where the data will be written
- @return 0 if frame needs not be transmitted (DTX only), 1 otherwise
- */
-int speex_encode_int(void *state, spx_int16_t *in, SpeexBits *bits);
-
-/** Used like the ioctl function to control the encoder parameters
- *
- * @param state Encoder state
- * @param request ioctl-type request (one of the SPEEX_* macros)
- * @param ptr Data exchanged to-from function
- * @return 0 if no error, -1 if request in unknown, -2 for invalid parameter
- */
-int speex_encoder_ctl(void *state, int request, void *ptr);
-
-
-/** Returns a handle to a newly created decoder state structure. For now, 
- * the mode argument can be &nb_mode or &wb_mode . In the future, more modes
- * may be added.  Note that for now if you have more than one channels to
- * decode, you need one state per channel.
- *
- * @param mode Speex mode (one of speex_nb_mode or speex_wb_mode)
- * @return A newly created decoder state or NULL if state allocation fails
- */ 
-void *speex_decoder_init(const SpeexMode *mode);
-
-/** Frees all resources associated to an existing decoder state.
- *
- * @param state State to be destroyed
- */
-void speex_decoder_destroy(void *state);
-
-/** Uses an existing decoder state to decode one frame of speech from
- * bit-stream bits. The output speech is saved written to out.
- *
- * @param state Decoder state
- * @param bits Bit-stream from which to decode the frame (NULL if the packet was lost)
- * @param out Where to write the decoded frame
- * @return return status (0 for no error, -1 for end of stream, -2 corrupt stream)
- */
-int speex_decode(void *state, SpeexBits *bits, float *out);
-
-/** Uses an existing decoder state to decode one frame of speech from
- * bit-stream bits. The output speech is saved written to out.
- *
- * @param state Decoder state
- * @param bits Bit-stream from which to decode the frame (NULL if the packet was lost)
- * @param out Where to write the decoded frame
- * @return return status (0 for no error, -1 for end of stream, -2 corrupt stream)
- */
-int speex_decode_int(void *state, SpeexBits *bits, spx_int16_t *out);
-
-/** Used like the ioctl function to control the encoder parameters
- *
- * @param state Decoder state
- * @param request ioctl-type request (one of the SPEEX_* macros)
- * @param ptr Data exchanged to-from function
- * @return 0 if no error, -1 if request in unknown, -2 for invalid parameter
- */
-int speex_decoder_ctl(void *state, int request, void *ptr);
-
-
-/** Query function for mode information
- *
- * @param mode Speex mode
- * @param request ioctl-type request (one of the SPEEX_* macros)
- * @param ptr Data exchanged to-from function
- * @return 0 if no error, -1 if request in unknown, -2 for invalid parameter
- */
-int speex_mode_query(const SpeexMode *mode, int request, void *ptr);
-
-/** Functions for controlling the behavior of libspeex
- * @param request ioctl-type request (one of the SPEEX_LIB_* macros)
- * @param ptr Data exchanged to-from function
- * @return 0 if no error, -1 if request in unknown, -2 for invalid parameter
- */
-int speex_lib_ctl(int request, void *ptr);
-
-/** Default narrowband mode */
-extern const SpeexMode speex_nb_mode;
-
-/** Default wideband mode */
-extern const SpeexMode speex_wb_mode;
-
-/** Default "ultra-wideband" mode */
-extern const SpeexMode speex_uwb_mode;
-
-/** List of all modes available */
-extern const SpeexMode * const speex_mode_list[SPEEX_NB_MODES];
-
-/** Obtain one of the modes available */
-const SpeexMode * speex_lib_get_mode (int mode);
-
-#ifndef WIN32
-/* We actually override the function in the narrowband case so that we can avoid linking in the wideband stuff */
-#define speex_lib_get_mode(mode) ((mode)==SPEEX_MODEID_NB ? &speex_nb_mode : speex_lib_get_mode (mode))
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-/** @}*/
-#endif
diff --git a/include/speex/speex_bits.h b/include/speex/speex_bits.h
deleted file mode 100644
index a26fb4c..0000000
--- a/include/speex/speex_bits.h
+++ /dev/null
@@ -1,174 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin */
-/**
-   @file speex_bits.h
-   @brief Handles bit packing/unpacking
-*/
-/*
-   Redistribution and use in source and binary forms, with or without
-   modification, 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 the Xiph.org Foundation nor the names of its
-   contributors may be used to endorse or promote products derived from
-   this software without specific prior written permission.
-   
-   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 FOUNDATION OR
-   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-*/
-
-#ifndef BITS_H
-#define BITS_H
-/** @defgroup SpeexBits SpeexBits: Bit-stream manipulations
- *  This is the structure that holds the bit-stream when encoding or decoding
- * with Speex. It allows some manipulations as well.
- *  @{
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** Bit-packing data structure representing (part of) a bit-stream. */
-typedef struct SpeexBits {
-   char *chars;   /**< "raw" data */
-   int   nbBits;  /**< Total number of bits stored in the stream*/
-   int   charPtr; /**< Position of the byte "cursor" */
-   int   bitPtr;  /**< Position of the bit "cursor" within the current char */
-   int   owner;   /**< Does the struct "own" the "raw" buffer (member "chars") */
-   int   overflow;/**< Set to one if we try to read past the valid data */
-   int   buf_size;/**< Allocated size for buffer */
-   int   reserved1; /**< Reserved for future use */
-   void *reserved2; /**< Reserved for future use */
-} SpeexBits;
-
-/** Initializes and allocates resources for a SpeexBits struct */
-void speex_bits_init(SpeexBits *bits);
-
-/** Initializes SpeexBits struct using a pre-allocated buffer*/
-void speex_bits_init_buffer(SpeexBits *bits, void *buff, int buf_size);
-
-/** Sets the bits in a SpeexBits struct to use data from an existing buffer (for decoding without copying data) */
-void speex_bits_set_bit_buffer(SpeexBits *bits, void *buff, int buf_size);
-
-/** Frees all resources associated to a SpeexBits struct. Right now this does nothing since no resources are allocated, but this could change in the future.*/
-void speex_bits_destroy(SpeexBits *bits);
-
-/** Resets bits to initial value (just after initialization, erasing content)*/
-void speex_bits_reset(SpeexBits *bits);
-
-/** Rewind the bit-stream to the beginning (ready for read) without erasing the content */
-void speex_bits_rewind(SpeexBits *bits);
-
-/** Initializes the bit-stream from the data in an area of memory */
-void speex_bits_read_from(SpeexBits *bits, char *bytes, int len);
-
-/** Append bytes to the bit-stream
- * 
- * @param bits Bit-stream to operate on
- * @param bytes pointer to the bytes what will be appended
- * @param len Number of bytes of append
- */
-void speex_bits_read_whole_bytes(SpeexBits *bits, char *bytes, int len);
-
-/** Write the content of a bit-stream to an area of memory
- * 
- * @param bits Bit-stream to operate on
- * @param bytes Memory location where to write the bits
- * @param max_len Maximum number of bytes to write (i.e. size of the "bytes" buffer)
- * @return Number of bytes written to the "bytes" buffer
-*/
-int speex_bits_write(SpeexBits *bits, char *bytes, int max_len);
-
-/** Like speex_bits_write, but writes only the complete bytes in the stream. Also removes the written bytes from the stream */
-int speex_bits_write_whole_bytes(SpeexBits *bits, char *bytes, int max_len);
-
-/** Append bits to the bit-stream
- * @param bits Bit-stream to operate on
- * @param data Value to append as integer
- * @param nbBits number of bits to consider in "data"
- */
-void speex_bits_pack(SpeexBits *bits, int data, int nbBits);
-
-/** Interpret the next bits in the bit-stream as a signed integer
- *
- * @param bits Bit-stream to operate on
- * @param nbBits Number of bits to interpret
- * @return A signed integer represented by the bits read
- */
-int speex_bits_unpack_signed(SpeexBits *bits, int nbBits);
-
-/** Interpret the next bits in the bit-stream as an unsigned integer
- *
- * @param bits Bit-stream to operate on
- * @param nbBits Number of bits to interpret
- * @return An unsigned integer represented by the bits read
- */
-unsigned int speex_bits_unpack_unsigned(SpeexBits *bits, int nbBits);
-
-/** Returns the number of bytes in the bit-stream, including the last one even if it is not "full"
- *
- * @param bits Bit-stream to operate on
- * @return Number of bytes in the stream
- */
-int speex_bits_nbytes(SpeexBits *bits);
-
-/** Same as speex_bits_unpack_unsigned, but without modifying the cursor position 
- * 
- * @param bits Bit-stream to operate on
- * @param nbBits Number of bits to look for
- * @return Value of the bits peeked, interpreted as unsigned
- */
-unsigned int speex_bits_peek_unsigned(SpeexBits *bits, int nbBits);
-
-/** Get the value of the next bit in the stream, without modifying the
- * "cursor" position 
- * 
- * @param bits Bit-stream to operate on
- * @return Value of the bit peeked (one bit only)
- */
-int speex_bits_peek(SpeexBits *bits);
-
-/** Advances the position of the "bit cursor" in the stream 
- *
- * @param bits Bit-stream to operate on
- * @param n Number of bits to advance
- */
-void speex_bits_advance(SpeexBits *bits, int n);
-
-/** Returns the number of bits remaining to be read in a stream
- *
- * @param bits Bit-stream to operate on
- * @return Number of bits that can still be read from the stream
- */
-int speex_bits_remaining(SpeexBits *bits);
-
-/** Insert a terminator so that the data can be sent as a packet while auto-detecting 
- * the number of frames in each packet 
- *
- * @param bits Bit-stream to operate on
- */
-void speex_bits_insert_terminator(SpeexBits *bits);
-
-#ifdef __cplusplus
-}
-#endif
-
-/* @} */
-#endif
diff --git a/include/speex/speex_buffer.h b/include/speex/speex_buffer.h
deleted file mode 100644
index df56f5f..0000000
--- a/include/speex/speex_buffer.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* Copyright (C) 2007 Jean-Marc Valin
-      
-   File: speex_buffer.h
-   This is a very simple ring buffer implementation. It is not thread-safe
-   so you need to do your own locking.
-
-   Redistribution and use in source and binary forms, with or without
-   modification, are permitted provided that the following conditions are
-   met:
-
-   1. Redistributions of source code must retain the above copyright notice,
-   this list of conditions and the following disclaimer.
-
-   2. 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.
-
-   3. The name of the author may not be used to endorse or promote products
-   derived from this software without specific prior written permission.
-
-   THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR BE LIABLE FOR ANY DIRECT,
-   INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-   (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-   SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-   HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-   STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-   ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-   POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef SPEEX_BUFFER_H
-#define SPEEX_BUFFER_H
-
-#include "speex/speex_types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct SpeexBuffer_;
-typedef struct SpeexBuffer_ SpeexBuffer;
-
-SpeexBuffer *speex_buffer_init(int size);
-
-void speex_buffer_destroy(SpeexBuffer *st);
-
-int speex_buffer_write(SpeexBuffer *st, void *data, int len);
-
-int speex_buffer_writezeros(SpeexBuffer *st, int len);
-
-int speex_buffer_read(SpeexBuffer *st, void *data, int len);
-
-int speex_buffer_get_available(SpeexBuffer *st);
-
-int speex_buffer_resize(SpeexBuffer *st, int len);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-
-
-
diff --git a/include/speex/speex_callbacks.h b/include/speex/speex_callbacks.h
deleted file mode 100644
index 6f450b3..0000000
--- a/include/speex/speex_callbacks.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin*/
-/**
-  @file speex_callbacks.h
-  @brief Describes callback handling and in-band signalling
-*/
-/*
-   Redistribution and use in source and binary forms, with or without
-   modification, 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 the Xiph.org Foundation nor the names of its
-   contributors may be used to endorse or promote products derived from
-   this software without specific prior written permission.
-   
-   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 FOUNDATION OR
-   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-*/
-
-#ifndef SPEEX_CALLBACKS_H
-#define SPEEX_CALLBACKS_H
-/** @defgroup SpeexCallbacks Various definitions for Speex callbacks supported by the decoder.
- *  @{
- */
-
-#include "speex.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** Total number of callbacks */
-#define SPEEX_MAX_CALLBACKS 16
-
-/* Describes all the in-band requests */
-
-/*These are 1-bit requests*/
-/** Request for perceptual enhancement (1 for on, 0 for off) */
-#define SPEEX_INBAND_ENH_REQUEST         0
-/** Reserved */
-#define SPEEX_INBAND_RESERVED1           1
-
-/*These are 4-bit requests*/
-/** Request for a mode change */
-#define SPEEX_INBAND_MODE_REQUEST        2
-/** Request for a low mode change */
-#define SPEEX_INBAND_LOW_MODE_REQUEST    3
-/** Request for a high mode change */
-#define SPEEX_INBAND_HIGH_MODE_REQUEST   4
-/** Request for VBR (1 on, 0 off) */
-#define SPEEX_INBAND_VBR_QUALITY_REQUEST 5
-/** Request to be sent acknowledge */
-#define SPEEX_INBAND_ACKNOWLEDGE_REQUEST 6
-/** Request for VBR (1 for on, 0 for off) */
-#define SPEEX_INBAND_VBR_REQUEST         7
-
-/*These are 8-bit requests*/
-/** Send a character in-band */
-#define SPEEX_INBAND_CHAR                8
-/** Intensity stereo information */
-#define SPEEX_INBAND_STEREO              9
-
-/*These are 16-bit requests*/
-/** Transmit max bit-rate allowed */
-#define SPEEX_INBAND_MAX_BITRATE         10
-
-/*These are 32-bit requests*/
-/** Acknowledge packet reception */
-#define SPEEX_INBAND_ACKNOWLEDGE         12
-
-/** Callback function type */
-typedef int (*speex_callback_func)(SpeexBits *bits, void *state, void *data);
-
-/** Callback information */
-typedef struct SpeexCallback {
-   int callback_id;             /**< ID associated to the callback */
-   speex_callback_func func;    /**< Callback handler function */
-   void *data;                  /**< Data that will be sent to the handler */
-   void *reserved1;             /**< Reserved for future use */
-   int   reserved2;             /**< Reserved for future use */
-} SpeexCallback;
-
-/** Handle in-band request */
-int speex_inband_handler(SpeexBits *bits, SpeexCallback *callback_list, void *state);
-
-/** Standard handler for mode request (change mode, no questions asked) */
-int speex_std_mode_request_handler(SpeexBits *bits, void *state, void *data);
-
-/** Standard handler for high mode request (change high mode, no questions asked) */
-int speex_std_high_mode_request_handler(SpeexBits *bits, void *state, void *data);
-
-/** Standard handler for in-band characters (write to stderr) */
-int speex_std_char_handler(SpeexBits *bits, void *state, void *data);
-
-/** Default handler for user-defined requests: in this case, just ignore */
-int speex_default_user_handler(SpeexBits *bits, void *state, void *data);
-
-
-
-/** Standard handler for low mode request (change low mode, no questions asked) */
-int speex_std_low_mode_request_handler(SpeexBits *bits, void *state, void *data);
-
-/** Standard handler for VBR request (Set VBR, no questions asked) */
-int speex_std_vbr_request_handler(SpeexBits *bits, void *state, void *data);
-
-/** Standard handler for enhancer request (Turn enhancer on/off, no questions asked) */
-int speex_std_enh_request_handler(SpeexBits *bits, void *state, void *data);
-
-/** Standard handler for VBR quality request (Set VBR quality, no questions asked) */
-int speex_std_vbr_quality_request_handler(SpeexBits *bits, void *state, void *data);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-/** @} */
-#endif
diff --git a/include/speex/speex_config_types.h b/include/speex/speex_config_types.h
deleted file mode 100644
index 9981e7d..0000000
--- a/include/speex/speex_config_types.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* Copyright (C) 2002-2006 Jean-Marc Valin*/
-/**
-  @file speex.h
-  @brief Describes the different modes of the codec
-*/
-/*
-   Redistribution and use in source and binary forms, with or without
-   modification, 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 the Xiph.org Foundation nor the names of its
-   contributors may be used to endorse or promote products derived from
-   this software without specific prior written permission.
-   
-   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 FOUNDATION OR
-   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-*/
-
-#ifndef __SPEEX_TYPES_H__
-#define __SPEEX_TYPES_H__
-
-/* these are filled in by configure */
-typedef short spx_int16_t;
-typedef unsigned short spx_uint16_t;
-typedef int spx_int32_t;
-typedef unsigned int spx_uint32_t;
-
-#endif
-
diff --git a/include/speex/speex_config_types.h.in b/include/speex/speex_config_types.h.in
deleted file mode 100644
index 3fab2ae..0000000
--- a/include/speex/speex_config_types.h.in
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef __SPEEX_TYPES_H__
-#define __SPEEX_TYPES_H__
-
-/* these are filled in by configure */
-typedef @SIZE16@ spx_int16_t;
-typedef unsigned @SIZE16@ spx_uint16_t;
-typedef @SIZE32@ spx_int32_t;
-typedef unsigned @SIZE32@ spx_uint32_t;
-
-#endif
-
diff --git a/include/speex/speex_echo.h b/include/speex/speex_echo.h
deleted file mode 100644
index 53bcd28..0000000
--- a/include/speex/speex_echo.h
+++ /dev/null
@@ -1,170 +0,0 @@
-/* Copyright (C) Jean-Marc Valin */
-/**
-   @file speex_echo.h
-   @brief Echo cancellation
-*/
-/*
-   Redistribution and use in source and binary forms, with or without
-   modification, are permitted provided that the following conditions are
-   met:
-
-   1. Redistributions of source code must retain the above copyright notice,
-   this list of conditions and the following disclaimer.
-
-   2. 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.
-
-   3. The name of the author may not be used to endorse or promote products
-   derived from this software without specific prior written permission.
-
-   THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR BE LIABLE FOR ANY DIRECT,
-   INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-   (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-   SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-   HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-   STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-   ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-   POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef SPEEX_ECHO_H
-#define SPEEX_ECHO_H
-/** @defgroup SpeexEchoState SpeexEchoState: Acoustic echo canceller
- *  This is the acoustic echo canceller module.
- *  @{
- */
-#include "speex/speex_types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** Obtain frame size used by the AEC */
-#define SPEEX_ECHO_GET_FRAME_SIZE 3
-
-/** Set sampling rate */
-#define SPEEX_ECHO_SET_SAMPLING_RATE 24
-/** Get sampling rate */
-#define SPEEX_ECHO_GET_SAMPLING_RATE 25
-
-/* Can't set window sizes */
-/** Get size of impulse response (int32) */
-#define SPEEX_ECHO_GET_IMPULSE_RESPONSE_SIZE 27
-
-/* Can't set window content */
-/** Get impulse response (int32[]) */
-#define SPEEX_ECHO_GET_IMPULSE_RESPONSE 29
-
-/** Internal echo canceller state. Should never be accessed directly. */
-struct SpeexEchoState_;
-
-/** @class SpeexEchoState
- * This holds the state of the echo canceller. You need one per channel. 
-*/
-
-/** Internal echo canceller state. Should never be accessed directly. */
-typedef struct SpeexEchoState_ SpeexEchoState;
-
-/** Creates a new echo canceller state
- * @param frame_size Number of samples to process at one time (should correspond to 10-20 ms)
- * @param filter_length Number of samples of echo to cancel (should generally correspond to 100-500 ms)
- * @return Newly-created echo canceller state
- */
-SpeexEchoState *speex_echo_state_init(int frame_size, int filter_length);
-
-/** Creates a new multi-channel echo canceller state
- * @param frame_size Number of samples to process at one time (should correspond to 10-20 ms)
- * @param filter_length Number of samples of echo to cancel (should generally correspond to 100-500 ms)
- * @param nb_mic Number of microphone channels
- * @param nb_speakers Number of speaker channels
- * @return Newly-created echo canceller state
- */
-SpeexEchoState *speex_echo_state_init_mc(int frame_size, int filter_length, int nb_mic, int nb_speakers);
-
-/** Destroys an echo canceller state 
- * @param st Echo canceller state
-*/
-void speex_echo_state_destroy(SpeexEchoState *st);
-
-/** Performs echo cancellation a frame, based on the audio sent to the speaker (no delay is added
- * to playback in this form)
- *
- * @param st Echo canceller state
- * @param rec Signal from the microphone (near end + far end echo)
- * @param play Signal played to the speaker (received from far end)
- * @param out Returns near-end signal with echo removed
- */
-void speex_echo_cancellation(SpeexEchoState *st, const spx_int16_t *rec, const spx_int16_t *play, spx_int16_t *out);
-
-/** Performs echo cancellation a frame (deprecated) */
-void speex_echo_cancel(SpeexEchoState *st, const spx_int16_t *rec, const spx_int16_t *play, spx_int16_t *out, spx_int32_t *Yout);
-
-/** Perform echo cancellation using internal playback buffer, which is delayed by two frames
- * to account for the delay introduced by most soundcards (but it could be off!)
- * @param st Echo canceller state
- * @param rec Signal from the microphone (near end + far end echo)
- * @param out Returns near-end signal with echo removed
-*/
-void speex_echo_capture(SpeexEchoState *st, const spx_int16_t *rec, spx_int16_t *out);
-
-/** Let the echo canceller know that a frame was just queued to the soundcard
- * @param st Echo canceller state
- * @param play Signal played to the speaker (received from far end)
-*/
-void speex_echo_playback(SpeexEchoState *st, const spx_int16_t *play);
-
-/** Reset the echo canceller to its original state 
- * @param st Echo canceller state
- */
-void speex_echo_state_reset(SpeexEchoState *st);
-
-/** Used like the ioctl function to control the echo canceller parameters
- *
- * @param st Echo canceller state
- * @param request ioctl-type request (one of the SPEEX_ECHO_* macros)
- * @param ptr Data exchanged to-from function
- * @return 0 if no error, -1 if request in unknown
- */
-int speex_echo_ctl(SpeexEchoState *st, int request, void *ptr);
-
-
-
-struct SpeexDecorrState_;
-
-typedef struct SpeexDecorrState_ SpeexDecorrState;
-
-
-/** Create a state for the channel decorrelation algorithm
-    This is useful for multi-channel echo cancellation only 
- * @param rate Sampling rate
- * @param channels Number of channels (it's a bit pointless if you don't have at least 2)
- * @param frame_size Size of the frame to process at ones (counting samples *per* channel)
-*/
-SpeexDecorrState *speex_decorrelate_new(int rate, int channels, int frame_size);
-
-/** Remove correlation between the channels by modifying the phase and possibly
-    adding noise in a way that is not (or little) perceptible.
- * @param st Decorrelator state
- * @param in Input audio in interleaved format
- * @param out Result of the decorrelation (out *may* alias in)
- * @param strength How much alteration of the audio to apply from 0 to 100.
-*/
-void speex_decorrelate(SpeexDecorrState *st, const spx_int16_t *in, spx_int16_t *out, int strength);
-
-/** Destroy a Decorrelation state 
- * @param st State to destroy
-*/
-void speex_decorrelate_destroy(SpeexDecorrState *st);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-/** @}*/
-#endif
diff --git a/include/speex/speex_header.h b/include/speex/speex_header.h
deleted file mode 100644
index f85b249..0000000
--- a/include/speex/speex_header.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin */
-/**
-   @file speex_header.h
-   @brief Describes the Speex header
-*/
-/*
-   Redistribution and use in source and binary forms, with or without
-   modification, 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 the Xiph.org Foundation nor the names of its
-   contributors may be used to endorse or promote products derived from
-   this software without specific prior written permission.
-   
-   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 FOUNDATION OR
-   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-*/
-
-
-#ifndef SPEEX_HEADER_H
-#define SPEEX_HEADER_H
-/** @defgroup SpeexHeader SpeexHeader: Makes it easy to write/parse an Ogg/Speex header
- *  This is the Speex header for the Ogg encapsulation. You don't need that if you just use RTP.
- *  @{
- */
-
-#include "speex/speex_types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct SpeexMode;
-
-/** Length of the Speex header identifier */
-#define SPEEX_HEADER_STRING_LENGTH 8
-
-/** Maximum number of characters for encoding the Speex version number in the header */
-#define SPEEX_HEADER_VERSION_LENGTH 20
-
-/** Speex header info for file-based formats */
-typedef struct SpeexHeader {
-   char speex_string[SPEEX_HEADER_STRING_LENGTH];   /**< Identifies a Speex bit-stream, always set to "Speex   " */
-   char speex_version[SPEEX_HEADER_VERSION_LENGTH]; /**< Speex version */ 
-   spx_int32_t speex_version_id;       /**< Version for Speex (for checking compatibility) */
-   spx_int32_t header_size;            /**< Total size of the header ( sizeof(SpeexHeader) ) */
-   spx_int32_t rate;                   /**< Sampling rate used */
-   spx_int32_t mode;                   /**< Mode used (0 for narrowband, 1 for wideband) */
-   spx_int32_t mode_bitstream_version; /**< Version ID of the bit-stream */
-   spx_int32_t nb_channels;            /**< Number of channels encoded */
-   spx_int32_t bitrate;                /**< Bit-rate used */
-   spx_int32_t frame_size;             /**< Size of frames */
-   spx_int32_t vbr;                    /**< 1 for a VBR encoding, 0 otherwise */
-   spx_int32_t frames_per_packet;      /**< Number of frames stored per Ogg packet */
-   spx_int32_t extra_headers;          /**< Number of additional headers after the comments */
-   spx_int32_t reserved1;              /**< Reserved for future use, must be zero */
-   spx_int32_t reserved2;              /**< Reserved for future use, must be zero */
-} SpeexHeader;
-
-/** Initializes a SpeexHeader using basic information */
-void speex_init_header(SpeexHeader *header, int rate, int nb_channels, const struct SpeexMode *m);
-
-/** Creates the header packet from the header itself (mostly involves endianness conversion) */
-char *speex_header_to_packet(SpeexHeader *header, int *size);
-
-/** Creates a SpeexHeader from a packet */
-SpeexHeader *speex_packet_to_header(char *packet, int size);
-
-/** Frees the memory allocated by either speex_header_to_packet() or speex_packet_to_header() */
-void speex_header_free(void *ptr);
-
-#ifdef __cplusplus
-}
-#endif
-
-/** @} */
-#endif
diff --git a/include/speex/speex_jitter.h b/include/speex/speex_jitter.h
deleted file mode 100644
index d68674b..0000000
--- a/include/speex/speex_jitter.h
+++ /dev/null
@@ -1,197 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin */
-/**
-   @file speex_jitter.h
-   @brief Adaptive jitter buffer for Speex
-*/
-/*
-   Redistribution and use in source and binary forms, with or without
-   modification, 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 the Xiph.org Foundation nor the names of its
-   contributors may be used to endorse or promote products derived from
-   this software without specific prior written permission.
-   
-   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 FOUNDATION OR
-   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-*/
-
-#ifndef SPEEX_JITTER_H
-#define SPEEX_JITTER_H
-/** @defgroup JitterBuffer JitterBuffer: Adaptive jitter buffer
- *  This is the jitter buffer that reorders UDP/RTP packets and adjusts the buffer size
- * to maintain good quality and low latency.
- *  @{
- */
-
-#include "speex/speex_types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** Generic adaptive jitter buffer state */
-struct JitterBuffer_;
-
-/** Generic adaptive jitter buffer state */
-typedef struct JitterBuffer_ JitterBuffer;
-
-/** Definition of an incoming packet */
-typedef struct _JitterBufferPacket JitterBufferPacket;
-
-/** Definition of an incoming packet */
-struct _JitterBufferPacket {
-   char        *data;       /**< Data bytes contained in the packet */
-   spx_uint32_t len;        /**< Length of the packet in bytes */
-   spx_uint32_t timestamp;  /**< Timestamp for the packet */
-   spx_uint32_t span;       /**< Time covered by the packet (same units as timestamp) */
-   spx_uint16_t sequence;   /**< RTP Sequence number if available (0 otherwise) */
-   spx_uint32_t user_data;  /**< Put whatever data you like here (it's ignored by the jitter buffer) */
-};
-
-/** Packet has been retrieved */
-#define JITTER_BUFFER_OK 0
-/** Packet is lost or is late */
-#define JITTER_BUFFER_MISSING 1
-/** A "fake" packet is meant to be inserted here to increase buffering */
-#define JITTER_BUFFER_INSERTION 2
-/** There was an error in the jitter buffer */
-#define JITTER_BUFFER_INTERNAL_ERROR -1
-/** Invalid argument */
-#define JITTER_BUFFER_BAD_ARGUMENT -2
-
-
-/** Set minimum amount of extra buffering required (margin) */
-#define JITTER_BUFFER_SET_MARGIN 0
-/** Get minimum amount of extra buffering required (margin) */
-#define JITTER_BUFFER_GET_MARGIN 1
-/* JITTER_BUFFER_SET_AVAILABLE_COUNT wouldn't make sense */
-
-/** Get the amount of available packets currently buffered */
-#define JITTER_BUFFER_GET_AVAILABLE_COUNT 3
-/** Included because of an early misspelling (will remove in next release) */
-#define JITTER_BUFFER_GET_AVALIABLE_COUNT 3
-
-/** Assign a function to destroy unused packet. When setting that, the jitter 
-    buffer no longer copies packet data. */
-#define JITTER_BUFFER_SET_DESTROY_CALLBACK 4
-/**  */
-#define JITTER_BUFFER_GET_DESTROY_CALLBACK 5
-
-/** Tell the jitter buffer to only adjust the delay in multiples of the step parameter provided */
-#define JITTER_BUFFER_SET_DELAY_STEP 6
-/**  */
-#define JITTER_BUFFER_GET_DELAY_STEP 7
-
-/** Tell the jitter buffer to only do concealment in multiples of the size parameter provided */
-#define JITTER_BUFFER_SET_CONCEALMENT_SIZE 8
-#define JITTER_BUFFER_GET_CONCEALMENT_SIZE 9
-
-/** Absolute max amount of loss that can be tolerated regardless of the delay. Typical loss 
-    should be half of that or less. */
-#define JITTER_BUFFER_SET_MAX_LATE_RATE 10
-#define JITTER_BUFFER_GET_MAX_LATE_RATE 11
-
-/** Equivalent cost of one percent late packet in timestamp units */
-#define JITTER_BUFFER_SET_LATE_COST 12
-#define JITTER_BUFFER_GET_LATE_COST 13
-
-
-/** Initialises jitter buffer 
- * 
- * @param step_size Starting value for the size of concleanment packets and delay 
-       adjustment steps. Can be changed at any time using JITTER_BUFFER_SET_DELAY_STEP
-       and JITTER_BUFFER_GET_CONCEALMENT_SIZE.
- * @return Newly created jitter buffer state
- */
-JitterBuffer *jitter_buffer_init(int step_size);
-
-/** Restores jitter buffer to its original state 
- * 
- * @param jitter Jitter buffer state
- */
-void jitter_buffer_reset(JitterBuffer *jitter);
-
-/** Destroys jitter buffer 
- * 
- * @param jitter Jitter buffer state
- */
-void jitter_buffer_destroy(JitterBuffer *jitter);
-
-/** Put one packet into the jitter buffer
- * 
- * @param jitter Jitter buffer state
- * @param packet Incoming packet
-*/
-void jitter_buffer_put(JitterBuffer *jitter, const JitterBufferPacket *packet);
-
-/** Get one packet from the jitter buffer
- * 
- * @param jitter Jitter buffer state
- * @param packet Returned packet
- * @param desired_span Number of samples (or units) we wish to get from the buffer (no guarantee)
- * @param current_timestamp Timestamp for the returned packet 
-*/
-int jitter_buffer_get(JitterBuffer *jitter, JitterBufferPacket *packet, spx_int32_t desired_span, spx_int32_t *start_offset);
-
-/** Used right after jitter_buffer_get() to obtain another packet that would have the same timestamp.
- * This is mainly useful for media where a single "frame" can be split into several packets.
- * 
- * @param jitter Jitter buffer state
- * @param packet Returned packet
- */
-int jitter_buffer_get_another(JitterBuffer *jitter, JitterBufferPacket *packet);
-
-/** Get pointer timestamp of jitter buffer
- * 
- * @param jitter Jitter buffer state
-*/
-int jitter_buffer_get_pointer_timestamp(JitterBuffer *jitter);
-
-/** Advance by one tick
- * 
- * @param jitter Jitter buffer state
-*/
-void jitter_buffer_tick(JitterBuffer *jitter);
-
-/** Telling the jitter buffer about the remaining data in the application buffer
- * @param jitter Jitter buffer state
- * @param rem Amount of data buffered by the application (timestamp units)
- */
-void jitter_buffer_remaining_span(JitterBuffer *jitter, spx_uint32_t rem);
-
-/** Used like the ioctl function to control the jitter buffer parameters
- * 
- * @param jitter Jitter buffer state
- * @param request ioctl-type request (one of the JITTER_BUFFER_* macros)
- * @param ptr Data exchanged to-from function
- * @return 0 if no error, -1 if request in unknown
-*/
-int jitter_buffer_ctl(JitterBuffer *jitter, int request, void *ptr);
-
-int jitter_buffer_update_delay(JitterBuffer *jitter, JitterBufferPacket *packet, spx_int32_t *start_offset);
-
-/* @} */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/include/speex/speex_preprocess.h b/include/speex/speex_preprocess.h
deleted file mode 100644
index f8eef2c..0000000
--- a/include/speex/speex_preprocess.h
+++ /dev/null
@@ -1,219 +0,0 @@
-/* Copyright (C) 2003 Epic Games
-   Written by Jean-Marc Valin */
-/**
- *  @file speex_preprocess.h
- *  @brief Speex preprocessor. The preprocess can do noise suppression, 
- * residual echo suppression (after using the echo canceller), automatic
- * gain control (AGC) and voice activity detection (VAD).
-*/
-/*
-   Redistribution and use in source and binary forms, with or without
-   modification, are permitted provided that the following conditions are
-   met:
-
-   1. Redistributions of source code must retain the above copyright notice,
-   this list of conditions and the following disclaimer.
-
-   2. 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.
-
-   3. The name of the author may not be used to endorse or promote products
-   derived from this software without specific prior written permission.
-
-   THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR BE LIABLE FOR ANY DIRECT,
-   INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-   (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-   SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-   HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-   STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-   ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-   POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef SPEEX_PREPROCESS_H
-#define SPEEX_PREPROCESS_H
-/** @defgroup SpeexPreprocessState SpeexPreprocessState: The Speex preprocessor
- *  This is the Speex preprocessor. The preprocess can do noise suppression, 
- * residual echo suppression (after using the echo canceller), automatic
- * gain control (AGC) and voice activity detection (VAD).
- *  @{
- */
-
-#include "speex/speex_types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-   
-/** State of the preprocessor (one per channel). Should never be accessed directly. */
-struct SpeexPreprocessState_;
-
-/** State of the preprocessor (one per channel). Should never be accessed directly. */
-typedef struct SpeexPreprocessState_ SpeexPreprocessState;
-
-
-/** Creates a new preprocessing state. You MUST create one state per channel processed.
- * @param frame_size Number of samples to process at one time (should correspond to 10-20 ms). Must be
- * the same value as that used for the echo canceller for residual echo cancellation to work.
- * @param sampling_rate Sampling rate used for the input.
- * @return Newly created preprocessor state
-*/
-SpeexPreprocessState *speex_preprocess_state_init(int frame_size, int sampling_rate);
-
-/** Destroys a preprocessor state 
- * @param st Preprocessor state to destroy
-*/
-void speex_preprocess_state_destroy(SpeexPreprocessState *st);
-
-/** Preprocess a frame 
- * @param st Preprocessor state
- * @param x Audio sample vector (in and out). Must be same size as specified in speex_preprocess_state_init().
- * @return Bool value for voice activity (1 for speech, 0 for noise/silence), ONLY if VAD turned on.
-*/
-int speex_preprocess_run(SpeexPreprocessState *st, spx_int16_t *x);
-
-/** Preprocess a frame (deprecated, use speex_preprocess_run() instead)*/
-int speex_preprocess(SpeexPreprocessState *st, spx_int16_t *x, spx_int32_t *echo);
-
-/** Update preprocessor state, but do not compute the output
- * @param st Preprocessor state
- * @param x Audio sample vector (in only). Must be same size as specified in speex_preprocess_state_init().
-*/
-void speex_preprocess_estimate_update(SpeexPreprocessState *st, spx_int16_t *x);
-
-/** Used like the ioctl function to control the preprocessor parameters 
- * @param st Preprocessor state
- * @param request ioctl-type request (one of the SPEEX_PREPROCESS_* macros)
- * @param ptr Data exchanged to-from function
- * @return 0 if no error, -1 if request in unknown
-*/
-int speex_preprocess_ctl(SpeexPreprocessState *st, int request, void *ptr);
-
-
-
-/** Set preprocessor denoiser state */
-#define SPEEX_PREPROCESS_SET_DENOISE 0
-/** Get preprocessor denoiser state */
-#define SPEEX_PREPROCESS_GET_DENOISE 1
-
-/** Set preprocessor Automatic Gain Control state */
-#define SPEEX_PREPROCESS_SET_AGC 2
-/** Get preprocessor Automatic Gain Control state */
-#define SPEEX_PREPROCESS_GET_AGC 3
-
-/** Set preprocessor Voice Activity Detection state */
-#define SPEEX_PREPROCESS_SET_VAD 4
-/** Get preprocessor Voice Activity Detection state */
-#define SPEEX_PREPROCESS_GET_VAD 5
-
-/** Set preprocessor Automatic Gain Control level (float) */
-#define SPEEX_PREPROCESS_SET_AGC_LEVEL 6
-/** Get preprocessor Automatic Gain Control level (float) */
-#define SPEEX_PREPROCESS_GET_AGC_LEVEL 7
-
-/** Set preprocessor dereverb state */
-#define SPEEX_PREPROCESS_SET_DEREVERB 8
-/** Get preprocessor dereverb state */
-#define SPEEX_PREPROCESS_GET_DEREVERB 9
-
-/** Set preprocessor dereverb level */
-#define SPEEX_PREPROCESS_SET_DEREVERB_LEVEL 10
-/** Get preprocessor dereverb level */
-#define SPEEX_PREPROCESS_GET_DEREVERB_LEVEL 11
-
-/** Set preprocessor dereverb decay */
-#define SPEEX_PREPROCESS_SET_DEREVERB_DECAY 12
-/** Get preprocessor dereverb decay */
-#define SPEEX_PREPROCESS_GET_DEREVERB_DECAY 13
-
-/** Set probability required for the VAD to go from silence to voice */
-#define SPEEX_PREPROCESS_SET_PROB_START 14
-/** Get probability required for the VAD to go from silence to voice */
-#define SPEEX_PREPROCESS_GET_PROB_START 15
-
-/** Set probability required for the VAD to stay in the voice state (integer percent) */
-#define SPEEX_PREPROCESS_SET_PROB_CONTINUE 16
-/** Get probability required for the VAD to stay in the voice state (integer percent) */
-#define SPEEX_PREPROCESS_GET_PROB_CONTINUE 17
-
-/** Set maximum attenuation of the noise in dB (negative number) */
-#define SPEEX_PREPROCESS_SET_NOISE_SUPPRESS 18
-/** Get maximum attenuation of the noise in dB (negative number) */
-#define SPEEX_PREPROCESS_GET_NOISE_SUPPRESS 19
-
-/** Set maximum attenuation of the residual echo in dB (negative number) */
-#define SPEEX_PREPROCESS_SET_ECHO_SUPPRESS 20
-/** Get maximum attenuation of the residual echo in dB (negative number) */
-#define SPEEX_PREPROCESS_GET_ECHO_SUPPRESS 21
-
-/** Set maximum attenuation of the residual echo in dB when near end is active (negative number) */
-#define SPEEX_PREPROCESS_SET_ECHO_SUPPRESS_ACTIVE 22
-/** Get maximum attenuation of the residual echo in dB when near end is active (negative number) */
-#define SPEEX_PREPROCESS_GET_ECHO_SUPPRESS_ACTIVE 23
-
-/** Set the corresponding echo canceller state so that residual echo suppression can be performed (NULL for no residual echo suppression) */
-#define SPEEX_PREPROCESS_SET_ECHO_STATE 24
-/** Get the corresponding echo canceller state */
-#define SPEEX_PREPROCESS_GET_ECHO_STATE 25
-
-/** Set maximal gain increase in dB/second (int32) */
-#define SPEEX_PREPROCESS_SET_AGC_INCREMENT 26
-
-/** Get maximal gain increase in dB/second (int32) */
-#define SPEEX_PREPROCESS_GET_AGC_INCREMENT 27
-
-/** Set maximal gain decrease in dB/second (int32) */
-#define SPEEX_PREPROCESS_SET_AGC_DECREMENT 28
-
-/** Get maximal gain decrease in dB/second (int32) */
-#define SPEEX_PREPROCESS_GET_AGC_DECREMENT 29
-
-/** Set maximal gain in dB (int32) */
-#define SPEEX_PREPROCESS_SET_AGC_MAX_GAIN 30
-
-/** Get maximal gain in dB (int32) */
-#define SPEEX_PREPROCESS_GET_AGC_MAX_GAIN 31
-
-/*  Can't set loudness */
-/** Get loudness */
-#define SPEEX_PREPROCESS_GET_AGC_LOUDNESS 33
-
-/*  Can't set gain */
-/** Get current gain (int32 percent) */
-#define SPEEX_PREPROCESS_GET_AGC_GAIN 35
-
-/*  Can't set spectrum size */
-/** Get spectrum size for power spectrum (int32) */
-#define SPEEX_PREPROCESS_GET_PSD_SIZE 37
-
-/*  Can't set power spectrum */
-/** Get power spectrum (int32[] of squared values) */
-#define SPEEX_PREPROCESS_GET_PSD 39
-
-/*  Can't set noise size */
-/** Get spectrum size for noise estimate (int32)  */
-#define SPEEX_PREPROCESS_GET_NOISE_PSD_SIZE 41
-
-/*  Can't set noise estimate */
-/** Get noise estimate (int32[] of squared values) */
-#define SPEEX_PREPROCESS_GET_NOISE_PSD 43
-
-/* Can't set speech probability */
-/** Get speech probability in last frame (int32).  */
-#define SPEEX_PREPROCESS_GET_PROB 45
-
-/** Set preprocessor Automatic Gain Control level (int32) */
-#define SPEEX_PREPROCESS_SET_AGC_TARGET 46
-/** Get preprocessor Automatic Gain Control level (int32) */
-#define SPEEX_PREPROCESS_GET_AGC_TARGET 47
-
-#ifdef __cplusplus
-}
-#endif
-
-/** @}*/
-#endif
diff --git a/include/speex/speex_resampler.h b/include/speex/speex_resampler.h
deleted file mode 100644
index 54eef8d..0000000
--- a/include/speex/speex_resampler.h
+++ /dev/null
@@ -1,340 +0,0 @@
-/* Copyright (C) 2007 Jean-Marc Valin
-      
-   File: speex_resampler.h
-   Resampling code
-      
-   The design goals of this code are:
-      - Very fast algorithm
-      - Low memory requirement
-      - Good *perceptual* quality (and not best SNR)
-
-   Redistribution and use in source and binary forms, with or without
-   modification, are permitted provided that the following conditions are
-   met:
-
-   1. Redistributions of source code must retain the above copyright notice,
-   this list of conditions and the following disclaimer.
-
-   2. 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.
-
-   3. The name of the author may not be used to endorse or promote products
-   derived from this software without specific prior written permission.
-
-   THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR BE LIABLE FOR ANY DIRECT,
-   INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-   (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-   SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-   HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-   STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-   ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-   POSSIBILITY OF SUCH DAMAGE.
-*/
-
-
-#ifndef SPEEX_RESAMPLER_H
-#define SPEEX_RESAMPLER_H
-
-#ifdef OUTSIDE_SPEEX
-
-/********* WARNING: MENTAL SANITY ENDS HERE *************/
-
-/* If the resampler is defined outside of Speex, we change the symbol names so that 
-   there won't be any clash if linking with Speex later on. */
-
-/* #define RANDOM_PREFIX your software name here */
-#ifndef RANDOM_PREFIX
-#error "Please define RANDOM_PREFIX (above) to something specific to your project to prevent symbol name clashes"
-#endif
-
-#define CAT_PREFIX2(a,b) a ## b
-#define CAT_PREFIX(a,b) CAT_PREFIX2(a, b)
-      
-#define speex_resampler_init CAT_PREFIX(RANDOM_PREFIX,_resampler_init)
-#define speex_resampler_init_frac CAT_PREFIX(RANDOM_PREFIX,_resampler_init_frac)
-#define speex_resampler_destroy CAT_PREFIX(RANDOM_PREFIX,_resampler_destroy)
-#define speex_resampler_process_float CAT_PREFIX(RANDOM_PREFIX,_resampler_process_float)
-#define speex_resampler_process_int CAT_PREFIX(RANDOM_PREFIX,_resampler_process_int)
-#define speex_resampler_process_interleaved_float CAT_PREFIX(RANDOM_PREFIX,_resampler_process_interleaved_float)
-#define speex_resampler_process_interleaved_int CAT_PREFIX(RANDOM_PREFIX,_resampler_process_interleaved_int)
-#define speex_resampler_set_rate CAT_PREFIX(RANDOM_PREFIX,_resampler_set_rate)
-#define speex_resampler_get_rate CAT_PREFIX(RANDOM_PREFIX,_resampler_get_rate)
-#define speex_resampler_set_rate_frac CAT_PREFIX(RANDOM_PREFIX,_resampler_set_rate_frac)
-#define speex_resampler_get_ratio CAT_PREFIX(RANDOM_PREFIX,_resampler_get_ratio)
-#define speex_resampler_set_quality CAT_PREFIX(RANDOM_PREFIX,_resampler_set_quality)
-#define speex_resampler_get_quality CAT_PREFIX(RANDOM_PREFIX,_resampler_get_quality)
-#define speex_resampler_set_input_stride CAT_PREFIX(RANDOM_PREFIX,_resampler_set_input_stride)
-#define speex_resampler_get_input_stride CAT_PREFIX(RANDOM_PREFIX,_resampler_get_input_stride)
-#define speex_resampler_set_output_stride CAT_PREFIX(RANDOM_PREFIX,_resampler_set_output_stride)
-#define speex_resampler_get_output_stride CAT_PREFIX(RANDOM_PREFIX,_resampler_get_output_stride)
-#define speex_resampler_get_input_latency CAT_PREFIX(RANDOM_PREFIX,_resampler_get_input_latency)
-#define speex_resampler_get_output_latency CAT_PREFIX(RANDOM_PREFIX,_resampler_get_output_latency)
-#define speex_resampler_skip_zeros CAT_PREFIX(RANDOM_PREFIX,_resampler_skip_zeros)
-#define speex_resampler_reset_mem CAT_PREFIX(RANDOM_PREFIX,_resampler_reset_mem)
-#define speex_resampler_strerror CAT_PREFIX(RANDOM_PREFIX,_resampler_strerror)
-
-#define spx_int16_t short
-#define spx_int32_t int
-#define spx_uint16_t unsigned short
-#define spx_uint32_t unsigned int
-      
-#else /* OUTSIDE_SPEEX */
-
-#include "speex/speex_types.h"
-
-#endif /* OUTSIDE_SPEEX */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define SPEEX_RESAMPLER_QUALITY_MAX 10
-#define SPEEX_RESAMPLER_QUALITY_MIN 0
-#define SPEEX_RESAMPLER_QUALITY_DEFAULT 4
-#define SPEEX_RESAMPLER_QUALITY_VOIP 3
-#define SPEEX_RESAMPLER_QUALITY_DESKTOP 5
-
-enum {
-   RESAMPLER_ERR_SUCCESS         = 0,
-   RESAMPLER_ERR_ALLOC_FAILED    = 1,
-   RESAMPLER_ERR_BAD_STATE       = 2,
-   RESAMPLER_ERR_INVALID_ARG     = 3,
-   RESAMPLER_ERR_PTR_OVERLAP     = 4,
-   
-   RESAMPLER_ERR_MAX_ERROR
-};
-
-struct SpeexResamplerState_;
-typedef struct SpeexResamplerState_ SpeexResamplerState;
-
-/** Create a new resampler with integer input and output rates.
- * @param nb_channels Number of channels to be processed
- * @param in_rate Input sampling rate (integer number of Hz).
- * @param out_rate Output sampling rate (integer number of Hz).
- * @param quality Resampling quality between 0 and 10, where 0 has poor quality
- * and 10 has very high quality.
- * @return Newly created resampler state
- * @retval NULL Error: not enough memory
- */
-SpeexResamplerState *speex_resampler_init(spx_uint32_t nb_channels, 
-                                          spx_uint32_t in_rate, 
-                                          spx_uint32_t out_rate, 
-                                          int quality,
-                                          int *err);
-
-/** Create a new resampler with fractional input/output rates. The sampling 
- * rate ratio is an arbitrary rational number with both the numerator and 
- * denominator being 32-bit integers.
- * @param nb_channels Number of channels to be processed
- * @param ratio_num Numerator of the sampling rate ratio
- * @param ratio_den Denominator of the sampling rate ratio
- * @param in_rate Input sampling rate rounded to the nearest integer (in Hz).
- * @param out_rate Output sampling rate rounded to the nearest integer (in Hz).
- * @param quality Resampling quality between 0 and 10, where 0 has poor quality
- * and 10 has very high quality.
- * @return Newly created resampler state
- * @retval NULL Error: not enough memory
- */
-SpeexResamplerState *speex_resampler_init_frac(spx_uint32_t nb_channels, 
-                                               spx_uint32_t ratio_num, 
-                                               spx_uint32_t ratio_den, 
-                                               spx_uint32_t in_rate, 
-                                               spx_uint32_t out_rate, 
-                                               int quality,
-                                               int *err);
-
-/** Destroy a resampler state.
- * @param st Resampler state
- */
-void speex_resampler_destroy(SpeexResamplerState *st);
-
-/** Resample a float array. The input and output buffers must *not* overlap.
- * @param st Resampler state
- * @param channel_index Index of the channel to process for the multi-channel 
- * base (0 otherwise)
- * @param in Input buffer
- * @param in_len Number of input samples in the input buffer. Returns the 
- * number of samples processed
- * @param out Output buffer
- * @param out_len Size of the output buffer. Returns the number of samples written
- */
-int speex_resampler_process_float(SpeexResamplerState *st, 
-                                   spx_uint32_t channel_index, 
-                                   const float *in, 
-                                   spx_uint32_t *in_len, 
-                                   float *out, 
-                                   spx_uint32_t *out_len);
-
-/** Resample an int array. The input and output buffers must *not* overlap.
- * @param st Resampler state
- * @param channel_index Index of the channel to process for the multi-channel 
- * base (0 otherwise)
- * @param in Input buffer
- * @param in_len Number of input samples in the input buffer. Returns the number
- * of samples processed
- * @param out Output buffer
- * @param out_len Size of the output buffer. Returns the number of samples written
- */
-int speex_resampler_process_int(SpeexResamplerState *st, 
-                                 spx_uint32_t channel_index, 
-                                 const spx_int16_t *in, 
-                                 spx_uint32_t *in_len, 
-                                 spx_int16_t *out, 
-                                 spx_uint32_t *out_len);
-
-/** Resample an interleaved float array. The input and output buffers must *not* overlap.
- * @param st Resampler state
- * @param in Input buffer
- * @param in_len Number of input samples in the input buffer. Returns the number
- * of samples processed. This is all per-channel.
- * @param out Output buffer
- * @param out_len Size of the output buffer. Returns the number of samples written.
- * This is all per-channel.
- */
-int speex_resampler_process_interleaved_float(SpeexResamplerState *st, 
-                                               const float *in, 
-                                               spx_uint32_t *in_len, 
-                                               float *out, 
-                                               spx_uint32_t *out_len);
-
-/** Resample an interleaved int array. The input and output buffers must *not* overlap.
- * @param st Resampler state
- * @param in Input buffer
- * @param in_len Number of input samples in the input buffer. Returns the number
- * of samples processed. This is all per-channel.
- * @param out Output buffer
- * @param out_len Size of the output buffer. Returns the number of samples written.
- * This is all per-channel.
- */
-int speex_resampler_process_interleaved_int(SpeexResamplerState *st, 
-                                             const spx_int16_t *in, 
-                                             spx_uint32_t *in_len, 
-                                             spx_int16_t *out, 
-                                             spx_uint32_t *out_len);
-
-/** Set (change) the input/output sampling rates (integer value).
- * @param st Resampler state
- * @param in_rate Input sampling rate (integer number of Hz).
- * @param out_rate Output sampling rate (integer number of Hz).
- */
-int speex_resampler_set_rate(SpeexResamplerState *st, 
-                              spx_uint32_t in_rate, 
-                              spx_uint32_t out_rate);
-
-/** Get the current input/output sampling rates (integer value).
- * @param st Resampler state
- * @param in_rate Input sampling rate (integer number of Hz) copied.
- * @param out_rate Output sampling rate (integer number of Hz) copied.
- */
-void speex_resampler_get_rate(SpeexResamplerState *st, 
-                              spx_uint32_t *in_rate, 
-                              spx_uint32_t *out_rate);
-
-/** Set (change) the input/output sampling rates and resampling ratio 
- * (fractional values in Hz supported).
- * @param st Resampler state
- * @param ratio_num Numerator of the sampling rate ratio
- * @param ratio_den Denominator of the sampling rate ratio
- * @param in_rate Input sampling rate rounded to the nearest integer (in Hz).
- * @param out_rate Output sampling rate rounded to the nearest integer (in Hz).
- */
-int speex_resampler_set_rate_frac(SpeexResamplerState *st, 
-                                   spx_uint32_t ratio_num, 
-                                   spx_uint32_t ratio_den, 
-                                   spx_uint32_t in_rate, 
-                                   spx_uint32_t out_rate);
-
-/** Get the current resampling ratio. This will be reduced to the least
- * common denominator.
- * @param st Resampler state
- * @param ratio_num Numerator of the sampling rate ratio copied
- * @param ratio_den Denominator of the sampling rate ratio copied
- */
-void speex_resampler_get_ratio(SpeexResamplerState *st, 
-                               spx_uint32_t *ratio_num, 
-                               spx_uint32_t *ratio_den);
-
-/** Set (change) the conversion quality.
- * @param st Resampler state
- * @param quality Resampling quality between 0 and 10, where 0 has poor 
- * quality and 10 has very high quality.
- */
-int speex_resampler_set_quality(SpeexResamplerState *st, 
-                                 int quality);
-
-/** Get the conversion quality.
- * @param st Resampler state
- * @param quality Resampling quality between 0 and 10, where 0 has poor 
- * quality and 10 has very high quality.
- */
-void speex_resampler_get_quality(SpeexResamplerState *st, 
-                                 int *quality);
-
-/** Set (change) the input stride.
- * @param st Resampler state
- * @param stride Input stride
- */
-void speex_resampler_set_input_stride(SpeexResamplerState *st, 
-                                      spx_uint32_t stride);
-
-/** Get the input stride.
- * @param st Resampler state
- * @param stride Input stride copied
- */
-void speex_resampler_get_input_stride(SpeexResamplerState *st, 
-                                      spx_uint32_t *stride);
-
-/** Set (change) the output stride.
- * @param st Resampler state
- * @param stride Output stride
- */
-void speex_resampler_set_output_stride(SpeexResamplerState *st, 
-                                      spx_uint32_t stride);
-
-/** Get the output stride.
- * @param st Resampler state copied
- * @param stride Output stride
- */
-void speex_resampler_get_output_stride(SpeexResamplerState *st, 
-                                      spx_uint32_t *stride);
-
-/** Get the latency in input samples introduced by the resampler.
- * @param st Resampler state
- */
-int speex_resampler_get_input_latency(SpeexResamplerState *st);
-
-/** Get the latency in output samples introduced by the resampler.
- * @param st Resampler state
- */
-int speex_resampler_get_output_latency(SpeexResamplerState *st);
-
-/** Make sure that the first samples to go out of the resamplers don't have 
- * leading zeros. This is only useful before starting to use a newly created 
- * resampler. It is recommended to use that when resampling an audio file, as
- * it will generate a file with the same length. For real-time processing,
- * it is probably easier not to use this call (so that the output duration
- * is the same for the first frame).
- * @param st Resampler state
- */
-int speex_resampler_skip_zeros(SpeexResamplerState *st);
-
-/** Reset a resampler so a new (unrelated) stream can be processed.
- * @param st Resampler state
- */
-int speex_resampler_reset_mem(SpeexResamplerState *st);
-
-/** Returns the English meaning for an error code
- * @param err Error code
- * @return English string
- */
-const char *speex_resampler_strerror(int err);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/include/speex/speex_stereo.h b/include/speex/speex_stereo.h
deleted file mode 100644
index a259713..0000000
--- a/include/speex/speex_stereo.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin*/
-/**
-   @file speex_stereo.h
-   @brief Describes the handling for intensity stereo
-*/
-/*
-   Redistribution and use in source and binary forms, with or without
-   modification, 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 the Xiph.org Foundation nor the names of its
-   contributors may be used to endorse or promote products derived from
-   this software without specific prior written permission.
-   
-   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 FOUNDATION OR
-   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef STEREO_H
-#define STEREO_H
-/** @defgroup SpeexStereoState SpeexStereoState: Handling Speex stereo files
- *  This describes the Speex intensity stereo encoding/decoding
- *  @{
- */
-
-#include "speex/speex_types.h"
-#include "speex/speex_bits.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** If you access any of these fields directly, I'll personally come and bite you */
-typedef struct SpeexStereoState {
-   float balance;      /**< Left/right balance info */
-   float e_ratio;      /**< Ratio of energies: E(left+right)/[E(left)+E(right)]  */
-   float smooth_left;  /**< Smoothed left channel gain */
-   float smooth_right; /**< Smoothed right channel gain */
-   float reserved1;    /**< Reserved for future use */
-   float reserved2;    /**< Reserved for future use */
-} SpeexStereoState;
-
-/** Deprecated. Use speex_stereo_state_init() instead. */
-#define SPEEX_STEREO_STATE_INIT {1,.5,1,1,0,0}
-
-/** Initialise/create a stereo stereo state */
-SpeexStereoState *speex_stereo_state_init();
-
-/** Reset/re-initialise an already allocated stereo state */
-void speex_stereo_state_reset(SpeexStereoState *stereo);
-
-/** Destroy a stereo stereo state */
-void speex_stereo_state_destroy(SpeexStereoState *stereo);
-
-/** Transforms a stereo frame into a mono frame and stores intensity stereo info in 'bits' */
-void speex_encode_stereo(float *data, int frame_size, SpeexBits *bits);
-
-/** Transforms a stereo frame into a mono frame and stores intensity stereo info in 'bits' */
-void speex_encode_stereo_int(spx_int16_t *data, int frame_size, SpeexBits *bits);
-
-/** Transforms a mono frame into a stereo frame using intensity stereo info */
-void speex_decode_stereo(float *data, int frame_size, SpeexStereoState *stereo);
-
-/** Transforms a mono frame into a stereo frame using intensity stereo info */
-void speex_decode_stereo_int(spx_int16_t *data, int frame_size, SpeexStereoState *stereo);
-
-/** Callback handler for intensity stereo info */
-int speex_std_stereo_request_handler(SpeexBits *bits, void *state, void *data);
-
-#ifdef __cplusplus
-}
-#endif
-
-/** @} */
-#endif
diff --git a/include/speex/speex_types.h b/include/speex/speex_types.h
deleted file mode 100644
index 852fed8..0000000
--- a/include/speex/speex_types.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/* speex_types.h taken from libogg */
-/********************************************************************
- *                                                                  *
- * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
- *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
- * by the Xiph.Org Foundation http://www.xiph.org/                  *
- *                                                                  *
- ********************************************************************
-
- function: #ifdef jail to whip a few platforms into the UNIX ideal.
- last mod: $Id: os_types.h 7524 2004-08-11 04:20:36Z conrad $
-
- ********************************************************************/
-/**
-   @file speex_types.h
-   @brief Speex types
-*/
-#ifndef _SPEEX_TYPES_H
-#define _SPEEX_TYPES_H
-
-#if defined(_WIN32) 
-
-#  if defined(__CYGWIN__)
-#    include <_G_config.h>
-     typedef _G_int32_t spx_int32_t;
-     typedef _G_uint32_t spx_uint32_t;
-     typedef _G_int16_t spx_int16_t;
-     typedef _G_uint16_t spx_uint16_t;
-#  elif defined(__MINGW32__)
-     typedef short spx_int16_t;
-     typedef unsigned short spx_uint16_t;
-     typedef int spx_int32_t;
-     typedef unsigned int spx_uint32_t;
-#  elif defined(__MWERKS__)
-     typedef int spx_int32_t;
-     typedef unsigned int spx_uint32_t;
-     typedef short spx_int16_t;
-     typedef unsigned short spx_uint16_t;
-#  else
-     /* MSVC/Borland */
-     typedef __int32 spx_int32_t;
-     typedef unsigned __int32 spx_uint32_t;
-     typedef __int16 spx_int16_t;
-     typedef unsigned __int16 spx_uint16_t;
-#  endif
-
-#elif defined(__MACOS__)
-
-#  include <sys/types.h>
-   typedef SInt16 spx_int16_t;
-   typedef UInt16 spx_uint16_t;
-   typedef SInt32 spx_int32_t;
-   typedef UInt32 spx_uint32_t;
-
-#elif (defined(__APPLE__) && defined(__MACH__)) /* MacOS X Framework build */
-
-#  include <sys/types.h>
-   typedef int16_t spx_int16_t;
-   typedef u_int16_t spx_uint16_t;
-   typedef int32_t spx_int32_t;
-   typedef u_int32_t spx_uint32_t;
-
-#elif defined(__BEOS__)
-
-   /* Be */
-#  include <inttypes.h>
-   typedef int16_t spx_int16_t;
-   typedef u_int16_t spx_uint16_t;
-   typedef int32_t spx_int32_t;
-   typedef u_int32_t spx_uint32_t;
-
-#elif defined (__EMX__)
-
-   /* OS/2 GCC */
-   typedef short spx_int16_t;
-   typedef unsigned short spx_uint16_t;
-   typedef int spx_int32_t;
-   typedef unsigned int spx_uint32_t;
-
-#elif defined (DJGPP)
-
-   /* DJGPP */
-   typedef short spx_int16_t;
-   typedef int spx_int32_t;
-   typedef unsigned int spx_uint32_t;
-
-#elif defined(R5900)
-
-   /* PS2 EE */
-   typedef int spx_int32_t;
-   typedef unsigned spx_uint32_t;
-   typedef short spx_int16_t;
-
-#elif defined(__SYMBIAN32__)
-
-   /* Symbian GCC */
-   typedef signed short spx_int16_t;
-   typedef unsigned short spx_uint16_t;
-   typedef signed int spx_int32_t;
-   typedef unsigned int spx_uint32_t;
-
-#elif defined(CONFIG_TI_C54X) || defined (CONFIG_TI_C55X)
-
-   typedef short spx_int16_t;
-   typedef unsigned short spx_uint16_t;
-   typedef long spx_int32_t;
-   typedef unsigned long spx_uint32_t;
-
-#elif defined(CONFIG_TI_C6X)
-
-   typedef short spx_int16_t;
-   typedef unsigned short spx_uint16_t;
-   typedef int spx_int32_t;
-   typedef unsigned int spx_uint32_t;
-
-#else
-
-#  include <speex/speex_config_types.h>
-
-#endif
-
-#endif  /* _SPEEX_TYPES_H */
diff --git a/libspeex/arch.h b/libspeex/arch.h
deleted file mode 100644
index d38c36c..0000000
--- a/libspeex/arch.h
+++ /dev/null
@@ -1,239 +0,0 @@
-/* Copyright (C) 2003 Jean-Marc Valin */
-/**
-   @file arch.h
-   @brief Various architecture definitions Speex
-*/
-/*
-   Redistribution and use in source and binary forms, with or without
-   modification, 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 the Xiph.org Foundation nor the names of its
-   contributors may be used to endorse or promote products derived from
-   this software without specific prior written permission.
-   
-   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 FOUNDATION OR
-   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef ARCH_H
-#define ARCH_H
-
-#ifndef SPEEX_VERSION
-#define SPEEX_MAJOR_VERSION 1         /**< Major Speex version. */
-#define SPEEX_MINOR_VERSION 1         /**< Minor Speex version. */
-#define SPEEX_MICRO_VERSION 15        /**< Micro Speex version. */
-#define SPEEX_EXTRA_VERSION ""        /**< Extra Speex version. */
-#define SPEEX_VERSION "speex-1.2beta3"  /**< Speex version string. */
-#endif
-
-/* A couple test to catch stupid option combinations */
-#ifdef FIXED_POINT
-
-#ifdef FLOATING_POINT
-#error You cannot compile as floating point and fixed point at the same time
-#endif
-#ifdef _USE_SSE
-#error SSE is only for floating-point
-#endif
-#if ((defined (ARM4_ASM)||defined (ARM4_ASM)) && defined(BFIN_ASM)) || (defined (ARM4_ASM)&&defined(ARM5E_ASM))
-#error Make up your mind. What CPU do you have?
-#endif
-#ifdef VORBIS_PSYCHO
-#error Vorbis-psy model currently not implemented in fixed-point
-#endif
-
-#else
-
-#ifndef FLOATING_POINT
-#error You now need to define either FIXED_POINT or FLOATING_POINT
-#endif
-#if defined (ARM4_ASM) || defined(ARM5E_ASM) || defined(BFIN_ASM)
-#error I suppose you can have a [ARM4/ARM5E/Blackfin] that has float instructions?
-#endif
-#ifdef FIXED_POINT_DEBUG
-#error "Don't you think enabling fixed-point is a good thing to do if you want to debug that?"
-#endif
-
-
-#endif
-
-#ifndef OUTSIDE_SPEEX
-#include "speex/speex_types.h"
-#endif
-
-#define ABS(x) ((x) < 0 ? (-(x)) : (x))      /**< Absolute integer value. */
-#define ABS16(x) ((x) < 0 ? (-(x)) : (x))    /**< Absolute 16-bit value.  */
-#define MIN16(a,b) ((a) < (b) ? (a) : (b))   /**< Maximum 16-bit value.   */
-#define MAX16(a,b) ((a) > (b) ? (a) : (b))   /**< Maximum 16-bit value.   */
-#define ABS32(x) ((x) < 0 ? (-(x)) : (x))    /**< Absolute 32-bit value.  */
-#define MIN32(a,b) ((a) < (b) ? (a) : (b))   /**< Maximum 32-bit value.   */
-#define MAX32(a,b) ((a) > (b) ? (a) : (b))   /**< Maximum 32-bit value.   */
-
-#ifdef FIXED_POINT
-
-typedef spx_int16_t spx_word16_t;
-typedef spx_int32_t   spx_word32_t;
-typedef spx_word32_t spx_mem_t;
-typedef spx_word16_t spx_coef_t;
-typedef spx_word16_t spx_lsp_t;
-typedef spx_word32_t spx_sig_t;
-
-#define Q15ONE 32767
-
-#define LPC_SCALING  8192
-#define SIG_SCALING  16384
-#define LSP_SCALING  8192.
-#define GAMMA_SCALING 32768.
-#define GAIN_SCALING 64
-#define GAIN_SCALING_1 0.015625
-
-#define LPC_SHIFT    13
-#define LSP_SHIFT    13
-#define SIG_SHIFT    14
-#define GAIN_SHIFT   6
-
-#define VERY_SMALL 0
-#define VERY_LARGE32 ((spx_word32_t)2147483647)
-#define VERY_LARGE16 ((spx_word16_t)32767)
-#define Q15_ONE ((spx_word16_t)32767)
-
-
-#ifdef FIXED_DEBUG
-#include "fixed_debug.h"
-#else
-
-#include "fixed_generic.h"
-
-#ifdef ARM5E_ASM
-#include "fixed_arm5e.h"
-#elif defined (ARM4_ASM)
-#include "fixed_arm4.h"
-#elif defined (BFIN_ASM)
-#include "fixed_bfin.h"
-#endif
-
-#endif
-
-
-#else
-
-typedef float spx_mem_t;
-typedef float spx_coef_t;
-typedef float spx_lsp_t;
-typedef float spx_sig_t;
-typedef float spx_word16_t;
-typedef float spx_word32_t;
-
-#define Q15ONE 1.0f
-#define LPC_SCALING  1.f
-#define SIG_SCALING  1.f
-#define LSP_SCALING  1.f
-#define GAMMA_SCALING 1.f
-#define GAIN_SCALING 1.f
-#define GAIN_SCALING_1 1.f
-
-
-#define VERY_SMALL 1e-15f
-#define VERY_LARGE32 1e15f
-#define VERY_LARGE16 1e15f
-#define Q15_ONE ((spx_word16_t)1.f)
-
-#define QCONST16(x,bits) (x)
-#define QCONST32(x,bits) (x)
-
-#define NEG16(x) (-(x))
-#define NEG32(x) (-(x))
-#define EXTRACT16(x) (x)
-#define EXTEND32(x) (x)
-#define SHR16(a,shift) (a)
-#define SHL16(a,shift) (a)
-#define SHR32(a,shift) (a)
-#define SHL32(a,shift) (a)
-#define PSHR16(a,shift) (a)
-#define PSHR32(a,shift) (a)
-#define VSHR32(a,shift) (a)
-#define SATURATE16(x,a) (x)
-#define SATURATE32(x,a) (x)
-
-#define PSHR(a,shift)       (a)
-#define SHR(a,shift)       (a)
-#define SHL(a,shift)       (a)
-#define SATURATE(x,a) (x)
-
-#define ADD16(a,b) ((a)+(b))
-#define SUB16(a,b) ((a)-(b))
-#define ADD32(a,b) ((a)+(b))
-#define SUB32(a,b) ((a)-(b))
-#define MULT16_16_16(a,b)     ((a)*(b))
-#define MULT16_16(a,b)     ((spx_word32_t)(a)*(spx_word32_t)(b))
-#define MAC16_16(c,a,b)     ((c)+(spx_word32_t)(a)*(spx_word32_t)(b))
-
-#define MULT16_32_Q11(a,b)     ((a)*(b))
-#define MULT16_32_Q13(a,b)     ((a)*(b))
-#define MULT16_32_Q14(a,b)     ((a)*(b))
-#define MULT16_32_Q15(a,b)     ((a)*(b))
-#define MULT16_32_P15(a,b)     ((a)*(b))
-
-#define MAC16_32_Q11(c,a,b)     ((c)+(a)*(b))
-#define MAC16_32_Q15(c,a,b)     ((c)+(a)*(b))
-
-#define MAC16_16_Q11(c,a,b)     ((c)+(a)*(b))
-#define MAC16_16_Q13(c,a,b)     ((c)+(a)*(b))
-#define MAC16_16_P13(c,a,b)     ((c)+(a)*(b))
-#define MULT16_16_Q11_32(a,b)     ((a)*(b))
-#define MULT16_16_Q13(a,b)     ((a)*(b))
-#define MULT16_16_Q14(a,b)     ((a)*(b))
-#define MULT16_16_Q15(a,b)     ((a)*(b))
-#define MULT16_16_P15(a,b)     ((a)*(b))
-#define MULT16_16_P13(a,b)     ((a)*(b))
-#define MULT16_16_P14(a,b)     ((a)*(b))
-
-#define DIV32_16(a,b)     (((spx_word32_t)(a))/(spx_word16_t)(b))
-#define PDIV32_16(a,b)     (((spx_word32_t)(a))/(spx_word16_t)(b))
-#define DIV32(a,b)     (((spx_word32_t)(a))/(spx_word32_t)(b))
-#define PDIV32(a,b)     (((spx_word32_t)(a))/(spx_word32_t)(b))
-
-
-#endif
-
-
-#if defined (CONFIG_TI_C54X) || defined (CONFIG_TI_C55X)
-
-/* 2 on TI C5x DSP */
-#define BYTES_PER_CHAR 2 
-#define BITS_PER_CHAR 16
-#define LOG2_BITS_PER_CHAR 4
-
-#else 
-
-#define BYTES_PER_CHAR 1
-#define BITS_PER_CHAR 8
-#define LOG2_BITS_PER_CHAR 3
-
-#endif
-
-
-
-#ifdef FIXED_DEBUG
-extern long long spx_mips;
-#endif
-
-
-#endif
diff --git a/libspeex/bits.c b/libspeex/bits.c
deleted file mode 100644
index 3ef7c6c..0000000
--- a/libspeex/bits.c
+++ /dev/null
@@ -1,372 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin 
-   File: speex_bits.c
-
-   Handles bit packing/unpacking
-
-   Redistribution and use in source and binary forms, with or without
-   modification, 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 the Xiph.org Foundation nor the names of its
-   contributors may be used to endorse or promote products derived from
-   this software without specific prior written permission.
-   
-   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 FOUNDATION 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.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <speex/speex_bits.h>
-#include "arch.h"
-#include "os_support.h"
-
-/* Maximum size of the bit-stream (for fixed-size allocation) */
-#ifndef MAX_CHARS_PER_FRAME
-#define MAX_CHARS_PER_FRAME (2000/BYTES_PER_CHAR)
-#endif
-
-EXPORT void speex_bits_init(SpeexBits *bits)
-{
-   bits->chars = (char*)speex_alloc(MAX_CHARS_PER_FRAME);
-   if (!bits->chars)
-      return;
-
-   bits->buf_size = MAX_CHARS_PER_FRAME;
-
-   bits->owner=1;
-
-   speex_bits_reset(bits);
-}
-
-EXPORT void speex_bits_init_buffer(SpeexBits *bits, void *buff, int buf_size)
-{
-   bits->chars = (char*)buff;
-   bits->buf_size = buf_size;
-
-   bits->owner=0;
-
-   speex_bits_reset(bits);
-}
-
-EXPORT void speex_bits_set_bit_buffer(SpeexBits *bits, void *buff, int buf_size)
-{
-   bits->chars = (char*)buff;
-   bits->buf_size = buf_size;
-
-   bits->owner=0;
-
-   bits->nbBits=buf_size<<LOG2_BITS_PER_CHAR;
-   bits->charPtr=0;
-   bits->bitPtr=0;
-   bits->overflow=0;
-   
-}
-
-EXPORT void speex_bits_destroy(SpeexBits *bits)
-{
-   if (bits->owner)
-      speex_free(bits->chars);
-   /* Will do something once the allocation is dynamic */
-}
-
-EXPORT void speex_bits_reset(SpeexBits *bits)
-{
-   /* We only need to clear the first byte now */
-   bits->chars[0]=0;
-   bits->nbBits=0;
-   bits->charPtr=0;
-   bits->bitPtr=0;
-   bits->overflow=0;
-}
-
-EXPORT void speex_bits_rewind(SpeexBits *bits)
-{
-   bits->charPtr=0;
-   bits->bitPtr=0;
-   bits->overflow=0;
-}
-
-EXPORT void speex_bits_read_from(SpeexBits *bits, char *chars, int len)
-{
-   int i;
-   int nchars = len / BYTES_PER_CHAR;
-   if (nchars > bits->buf_size)
-   {
-      speex_notify("Packet is larger than allocated buffer");
-      if (bits->owner)
-      {
-         char *tmp = (char*)speex_realloc(bits->chars, nchars);
-         if (tmp)
-         {
-            bits->buf_size=nchars;
-            bits->chars=tmp;
-         } else {
-            nchars=bits->buf_size;
-            speex_warning("Could not resize input buffer: truncating input");
-         }
-      } else {
-         speex_warning("Do not own input buffer: truncating oversize input");
-         nchars=bits->buf_size;
-      }
-   }
-#if (BYTES_PER_CHAR==2)
-/* Swap bytes to proper endian order (could be done externally) */
-#define HTOLS(A) ((((A) >> 8)&0xff)|(((A) & 0xff)<<8))
-#else
-#define HTOLS(A) (A)
-#endif
-   for (i=0;i<nchars;i++)
-      bits->chars[i]=HTOLS(chars[i]);
-
-   bits->nbBits=nchars<<LOG2_BITS_PER_CHAR;
-   bits->charPtr=0;
-   bits->bitPtr=0;
-   bits->overflow=0;
-}
-
-static void speex_bits_flush(SpeexBits *bits)
-{
-   int nchars = ((bits->nbBits+BITS_PER_CHAR-1)>>LOG2_BITS_PER_CHAR);
-   if (bits->charPtr>0)
-      SPEEX_MOVE(bits->chars, &bits->chars[bits->charPtr], nchars-bits->charPtr);
-   bits->nbBits -= bits->charPtr<<LOG2_BITS_PER_CHAR;
-   bits->charPtr=0;
-}
-
-EXPORT void speex_bits_read_whole_bytes(SpeexBits *bits, char *chars, int nbytes)
-{
-   int i,pos;
-   int nchars = nbytes/BYTES_PER_CHAR;
-
-   if (((bits->nbBits+BITS_PER_CHAR-1)>>LOG2_BITS_PER_CHAR)+nchars > bits->buf_size)
-   {
-      /* Packet is larger than allocated buffer */
-      if (bits->owner)
-      {
-         char *tmp = (char*)speex_realloc(bits->chars, (bits->nbBits>>LOG2_BITS_PER_CHAR)+nchars+1);
-         if (tmp)
-         {
-            bits->buf_size=(bits->nbBits>>LOG2_BITS_PER_CHAR)+nchars+1;
-            bits->chars=tmp;
-         } else {
-            nchars=bits->buf_size-(bits->nbBits>>LOG2_BITS_PER_CHAR)-1;
-            speex_warning("Could not resize input buffer: truncating oversize input");
-         }
-      } else {
-         speex_warning("Do not own input buffer: truncating oversize input");
-         nchars=bits->buf_size;
-      }
-   }
-
-   speex_bits_flush(bits);
-   pos=bits->nbBits>>LOG2_BITS_PER_CHAR;
-   for (i=0;i<nchars;i++)
-      bits->chars[pos+i]=HTOLS(chars[i]);
-   bits->nbBits+=nchars<<LOG2_BITS_PER_CHAR;
-}
-
-EXPORT int speex_bits_write(SpeexBits *bits, char *chars, int max_nbytes)
-{
-   int i;
-   int max_nchars = max_nbytes/BYTES_PER_CHAR;
-   int charPtr, bitPtr, nbBits;
-
-   /* Insert terminator, but save the data so we can put it back after */
-   bitPtr=bits->bitPtr;
-   charPtr=bits->charPtr;
-   nbBits=bits->nbBits;
-   speex_bits_insert_terminator(bits);
-   bits->bitPtr=bitPtr;
-   bits->charPtr=charPtr;
-   bits->nbBits=nbBits;
-
-   if (max_nchars > ((bits->nbBits+BITS_PER_CHAR-1)>>LOG2_BITS_PER_CHAR))
-      max_nchars = ((bits->nbBits+BITS_PER_CHAR-1)>>LOG2_BITS_PER_CHAR);
-
-   for (i=0;i<max_nchars;i++)
-      chars[i]=HTOLS(bits->chars[i]);
-   return max_nchars*BYTES_PER_CHAR;
-}
-
-EXPORT int speex_bits_write_whole_bytes(SpeexBits *bits, char *chars, int max_nbytes)
-{
-   int max_nchars = max_nbytes/BYTES_PER_CHAR;
-   int i;
-   if (max_nchars > ((bits->nbBits)>>LOG2_BITS_PER_CHAR))
-      max_nchars = ((bits->nbBits)>>LOG2_BITS_PER_CHAR);
-   for (i=0;i<max_nchars;i++)
-      chars[i]=HTOLS(bits->chars[i]);
-
-   if (bits->bitPtr>0)
-      bits->chars[0]=bits->chars[max_nchars];
-   else
-      bits->chars[0]=0;
-   bits->charPtr=0;
-   bits->nbBits &= (BITS_PER_CHAR-1);
-   return max_nchars*BYTES_PER_CHAR;
-}
-
-EXPORT void speex_bits_pack(SpeexBits *bits, int data, int nbBits)
-{
-   unsigned int d=data;
-
-   if (bits->charPtr+((nbBits+bits->bitPtr)>>LOG2_BITS_PER_CHAR) >= bits->buf_size)
-   {
-      speex_notify("Buffer too small to pack bits");
-      if (bits->owner)
-      {
-         int new_nchars = ((bits->buf_size+5)*3)>>1;
-         char *tmp = (char*)speex_realloc(bits->chars, new_nchars);
-         if (tmp)
-         {
-            bits->buf_size=new_nchars;
-            bits->chars=tmp;
-         } else {
-            speex_warning("Could not resize input buffer: not packing");
-            return;
-         }
-      } else {
-         speex_warning("Do not own input buffer: not packing");
-         return;
-      }
-   }
-
-   while(nbBits)
-   {
-      int bit;
-      bit = (d>>(nbBits-1))&1;
-      bits->chars[bits->charPtr] |= bit<<(BITS_PER_CHAR-1-bits->bitPtr);
-      bits->bitPtr++;
-
-      if (bits->bitPtr==BITS_PER_CHAR)
-      {
-         bits->bitPtr=0;
-         bits->charPtr++;
-         bits->chars[bits->charPtr] = 0;
-      }
-      bits->nbBits++;
-      nbBits--;
-   }
-}
-
-EXPORT int speex_bits_unpack_signed(SpeexBits *bits, int nbBits)
-{
-   unsigned int d=speex_bits_unpack_unsigned(bits,nbBits);
-   /* If number is negative */
-   if (d>>(nbBits-1))
-   {
-      d |= (-1)<<nbBits;
-   }
-   return d;
-}
-
-EXPORT unsigned int speex_bits_unpack_unsigned(SpeexBits *bits, int nbBits)
-{
-   unsigned int d=0;
-   if ((bits->charPtr<<LOG2_BITS_PER_CHAR)+bits->bitPtr+nbBits>bits->nbBits)
-      bits->overflow=1;
-   if (bits->overflow)
-      return 0;
-   while(nbBits)
-   {
-      d<<=1;
-      d |= (bits->chars[bits->charPtr]>>(BITS_PER_CHAR-1 - bits->bitPtr))&1;
-      bits->bitPtr++;
-      if (bits->bitPtr==BITS_PER_CHAR)
-      {
-         bits->bitPtr=0;
-         bits->charPtr++;
-      }
-      nbBits--;
-   }
-   return d;
-}
-
-EXPORT unsigned int speex_bits_peek_unsigned(SpeexBits *bits, int nbBits)
-{
-   unsigned int d=0;
-   int bitPtr, charPtr;
-   char *chars;
-
-   if ((bits->charPtr<<LOG2_BITS_PER_CHAR)+bits->bitPtr+nbBits>bits->nbBits)
-     bits->overflow=1;
-   if (bits->overflow)
-      return 0;
-
-   bitPtr=bits->bitPtr;
-   charPtr=bits->charPtr;
-   chars = bits->chars;
-   while(nbBits)
-   {
-      d<<=1;
-      d |= (chars[charPtr]>>(BITS_PER_CHAR-1 - bitPtr))&1;
-      bitPtr++;
-      if (bitPtr==BITS_PER_CHAR)
-      {
-         bitPtr=0;
-         charPtr++;
-      }
-      nbBits--;
-   }
-   return d;
-}
-
-EXPORT int speex_bits_peek(SpeexBits *bits)
-{
-   if ((bits->charPtr<<LOG2_BITS_PER_CHAR)+bits->bitPtr+1>bits->nbBits)
-      bits->overflow=1;
-   if (bits->overflow)
-      return 0;
-   return (bits->chars[bits->charPtr]>>(BITS_PER_CHAR-1 - bits->bitPtr))&1;
-}
-
-EXPORT void speex_bits_advance(SpeexBits *bits, int n)
-{
-    if (((bits->charPtr<<LOG2_BITS_PER_CHAR)+bits->bitPtr+n>bits->nbBits) || bits->overflow){
-      bits->overflow=1;
-      return;
-    }
-   bits->charPtr += (bits->bitPtr+n) >> LOG2_BITS_PER_CHAR; /* divide by BITS_PER_CHAR */
-   bits->bitPtr = (bits->bitPtr+n) & (BITS_PER_CHAR-1);       /* modulo by BITS_PER_CHAR */
-}
-
-EXPORT int speex_bits_remaining(SpeexBits *bits)
-{
-   if (bits->overflow)
-      return -1;
-   else
-      return bits->nbBits-((bits->charPtr<<LOG2_BITS_PER_CHAR)+bits->bitPtr);
-}
-
-EXPORT int speex_bits_nbytes(SpeexBits *bits)
-{
-   return ((bits->nbBits+BITS_PER_CHAR-1)>>LOG2_BITS_PER_CHAR);
-}
-
-EXPORT void speex_bits_insert_terminator(SpeexBits *bits)
-{
-   if (bits->bitPtr)
-      speex_bits_pack(bits, 0, 1);
-   while (bits->bitPtr)
-      speex_bits_pack(bits, 1, 1);
-}
diff --git a/libspeex/buffer.c b/libspeex/buffer.c
deleted file mode 100644
index 6cfd5a3..0000000
--- a/libspeex/buffer.c
+++ /dev/null
@@ -1,176 +0,0 @@
-/* Copyright (C) 2007 Jean-Marc Valin
-      
-   File: buffer.c
-   This is a very simple ring buffer implementation. It is not thread-safe
-   so you need to do your own locking.
-
-   Redistribution and use in source and binary forms, with or without
-   modification, are permitted provided that the following conditions are
-   met:
-
-   1. Redistributions of source code must retain the above copyright notice,
-   this list of conditions and the following disclaimer.
-
-   2. 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.
-
-   3. The name of the author may not be used to endorse or promote products
-   derived from this software without specific prior written permission.
-
-   THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-
-#include "os_support.h"
-#include "arch.h"
-#include <speex/speex_buffer.h>
-
-struct SpeexBuffer_ {
-   char *data;
-   int   size;
-   int   read_ptr;
-   int   write_ptr;
-   int   available;
-};
-
-EXPORT SpeexBuffer *speex_buffer_init(int size)
-{
-   SpeexBuffer *st = speex_alloc(sizeof(SpeexBuffer));
-   st->data = speex_alloc(size);
-   st->size = size;
-   st->read_ptr = 0;
-   st->write_ptr = 0;
-   st->available = 0;
-   return st;
-}
-
-EXPORT void speex_buffer_destroy(SpeexBuffer *st)
-{
-   speex_free(st->data);
-   speex_free(st);
-}
-
-EXPORT int speex_buffer_write(SpeexBuffer *st, void *_data, int len)
-{
-   int end;
-   int end1;
-   char *data = _data;
-   if (len > st->size)
-   {
-      data += len-st->size;
-      len = st->size;
-   }
-   end = st->write_ptr + len;
-   end1 = end;
-   if (end1 > st->size)
-      end1 = st->size;
-   SPEEX_COPY(st->data + st->write_ptr, data, end1 - st->write_ptr);
-   if (end > st->size)
-   {
-      end -= st->size;
-      SPEEX_COPY(st->data, data+end1 - st->write_ptr, end);
-   }
-   st->available += len;
-   if (st->available > st->size)
-   {
-      st->available = st->size;
-      st->read_ptr = st->write_ptr;
-   }
-   st->write_ptr += len;
-   if (st->write_ptr > st->size)
-      st->write_ptr -= st->size;
-   return len;
-}
-
-EXPORT int speex_buffer_writezeros(SpeexBuffer *st, int len)
-{
-   /* This is almost the same as for speex_buffer_write() but using 
-   SPEEX_MEMSET() instead of SPEEX_COPY(). Update accordingly. */
-   int end;
-   int end1;
-   if (len > st->size)
-   {
-      len = st->size;
-   }
-   end = st->write_ptr + len;
-   end1 = end;
-   if (end1 > st->size)
-      end1 = st->size;
-   SPEEX_MEMSET(st->data + st->write_ptr, 0, end1 - st->write_ptr);
-   if (end > st->size)
-   {
-      end -= st->size;
-      SPEEX_MEMSET(st->data, 0, end);
-   }
-   st->available += len;
-   if (st->available > st->size)
-   {
-      st->available = st->size;
-      st->read_ptr = st->write_ptr;
-   }
-   st->write_ptr += len;
-   if (st->write_ptr > st->size)
-      st->write_ptr -= st->size;
-   return len;
-}
-
-EXPORT int speex_buffer_read(SpeexBuffer *st, void *_data, int len)
-{
-   int end, end1;
-   char *data = _data;
-   if (len > st->available)
-   {
-      SPEEX_MEMSET(data+st->available, 0, st->size-st->available);
-      len = st->available;
-   }
-   end = st->read_ptr + len;
-   end1 = end;
-   if (end1 > st->size)
-      end1 = st->size;
-   SPEEX_COPY(data, st->data + st->read_ptr, end1 - st->read_ptr);
-
-   if (end > st->size)
-   {
-      end -= st->size;
-      SPEEX_COPY(data+end1 - st->read_ptr, st->data, end);
-   }
-   st->available -= len;
-   st->read_ptr += len;
-   if (st->read_ptr > st->size)
-      st->read_ptr -= st->size;
-   return len;
-}
-
-EXPORT int speex_buffer_get_available(SpeexBuffer *st)
-{
-   return st->available;
-}
-
-EXPORT int speex_buffer_resize(SpeexBuffer *st, int len)
-{
-   int old_len = st->size;
-   if (len > old_len)
-   {
-      st->data = speex_realloc(st->data, len);
-      /* FIXME: move data/pointers properly for growing the buffer */
-   } else {
-      /* FIXME: move data/pointers properly for shrinking the buffer */
-      st->data = speex_realloc(st->data, len);
-   }
-   return len;
-}
diff --git a/libspeex/cb_search.c b/libspeex/cb_search.c
deleted file mode 100644
index 63f4c6a..0000000
--- a/libspeex/cb_search.c
+++ /dev/null
@@ -1,612 +0,0 @@
-/* Copyright (C) 2002-2006 Jean-Marc Valin 
-   File: cb_search.c
-
-   Redistribution and use in source and binary forms, with or without
-   modification, 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 the Xiph.org Foundation nor the names of its
-   contributors may be used to endorse or promote products derived from
-   this software without specific prior written permission.
-   
-   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 FOUNDATION 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.
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "cb_search.h"
-#include "filters.h"
-#include "stack_alloc.h"
-#include "vq.h"
-#include "arch.h"
-#include "math_approx.h"
-#include "os_support.h"
-
-#ifdef _USE_SSE
-#include "cb_search_sse.h"
-#elif defined(ARM4_ASM) || defined(ARM5E_ASM)
-#include "cb_search_arm4.h"
-#elif defined(BFIN_ASM)
-#include "cb_search_bfin.h"
-#endif
-
-#ifndef OVERRIDE_COMPUTE_WEIGHTED_CODEBOOK
-static void compute_weighted_codebook(const signed char *shape_cb, const spx_word16_t *r, spx_word16_t *resp, spx_word16_t *resp2, spx_word32_t *E, int shape_cb_size, int subvect_size, char *stack)
-{
-   int i, j, k;
-   VARDECL(spx_word16_t *shape);
-   ALLOC(shape, subvect_size, spx_word16_t);
-   for (i=0;i<shape_cb_size;i++)
-   {
-      spx_word16_t *res;
-      
-      res = resp+i*subvect_size;
-      for (k=0;k<subvect_size;k++)
-         shape[k] = (spx_word16_t)shape_cb[i*subvect_size+k];
-      E[i]=0;
-
-      /* Compute codeword response using convolution with impulse response */
-      for(j=0;j<subvect_size;j++)
-      {
-         spx_word32_t resj=0;
-         spx_word16_t res16;
-         for (k=0;k<=j;k++)
-            resj = MAC16_16(resj,shape[k],r[j-k]);
-#ifdef FIXED_POINT
-         res16 = EXTRACT16(SHR32(resj, 13));
-#else
-         res16 = 0.03125f*resj;
-#endif
-         /* Compute codeword energy */
-         E[i]=MAC16_16(E[i],res16,res16);
-         res[j] = res16;
-         /*printf ("%d\n", (int)res[j]);*/
-      }
-   }
-
-}
-#endif
-
-#ifndef OVERRIDE_TARGET_UPDATE
-static inline void target_update(spx_word16_t *t, spx_word16_t g, spx_word16_t *r, int len)
-{
-   int n;
-   for (n=0;n<len;n++)
-      t[n] = SUB16(t[n],PSHR32(MULT16_16(g,r[n]),13));
-}
-#endif
-
-
-
-static void split_cb_search_shape_sign_N1(
-spx_word16_t target[],			/* target vector */
-spx_coef_t ak[],			/* LPCs for this subframe */
-spx_coef_t awk1[],			/* Weighted LPCs for this subframe */
-spx_coef_t awk2[],			/* Weighted LPCs for this subframe */
-const void *par,                      /* Codebook/search parameters*/
-int   p,                        /* number of LPC coeffs */
-int   nsf,                      /* number of samples in subframe */
-spx_sig_t *exc,
-spx_word16_t *r,
-SpeexBits *bits,
-char *stack,
-int   update_target
-)
-{
-   int i,j,m,q;
-   VARDECL(spx_word16_t *resp);
-#ifdef _USE_SSE
-   VARDECL(__m128 *resp2);
-   VARDECL(__m128 *E);
-#else
-   spx_word16_t *resp2;
-   VARDECL(spx_word32_t *E);
-#endif
-   VARDECL(spx_word16_t *t);
-   VARDECL(spx_sig_t *e);
-   const signed char *shape_cb;
-   int shape_cb_size, subvect_size, nb_subvect;
-   const split_cb_params *params;
-   int best_index;
-   spx_word32_t best_dist;
-   int have_sign;
-   
-   params = (const split_cb_params *) par;
-   subvect_size = params->subvect_size;
-   nb_subvect = params->nb_subvect;
-   shape_cb_size = 1<<params->shape_bits;
-   shape_cb = params->shape_cb;
-   have_sign = params->have_sign;
-   ALLOC(resp, shape_cb_size*subvect_size, spx_word16_t);
-#ifdef _USE_SSE
-   ALLOC(resp2, (shape_cb_size*subvect_size)>>2, __m128);
-   ALLOC(E, shape_cb_size>>2, __m128);
-#else
-   resp2 = resp;
-   ALLOC(E, shape_cb_size, spx_word32_t);
-#endif
-   ALLOC(t, nsf, spx_word16_t);
-   ALLOC(e, nsf, spx_sig_t);
-   
-   /* FIXME: Do we still need to copy the target? */
-   SPEEX_COPY(t, target, nsf);
-
-   compute_weighted_codebook(shape_cb, r, resp, resp2, E, shape_cb_size, subvect_size, stack);
-
-   for (i=0;i<nb_subvect;i++)
-   {
-      spx_word16_t *x=t+subvect_size*i;
-      /*Find new n-best based on previous n-best j*/
-      if (have_sign)
-         vq_nbest_sign(x, resp2, subvect_size, shape_cb_size, E, 1, &best_index, &best_dist, stack);
-      else
-         vq_nbest(x, resp2, subvect_size, shape_cb_size, E, 1, &best_index, &best_dist, stack);
-      
-      speex_bits_pack(bits,best_index,params->shape_bits+have_sign);
-      
-      {
-         int rind;
-         spx_word16_t *res;
-         spx_word16_t sign=1;
-         rind = best_index;
-         if (rind>=shape_cb_size)
-         {
-            sign=-1;
-            rind-=shape_cb_size;
-         }
-         res = resp+rind*subvect_size;
-         if (sign>0)
-            for (m=0;m<subvect_size;m++)
-               t[subvect_size*i+m] = SUB16(t[subvect_size*i+m], res[m]);
-         else
-            for (m=0;m<subvect_size;m++)
-               t[subvect_size*i+m] = ADD16(t[subvect_size*i+m], res[m]);
-
-#ifdef FIXED_POINT
-         if (sign==1)
-         {
-            for (j=0;j<subvect_size;j++)
-               e[subvect_size*i+j]=SHL32(EXTEND32(shape_cb[rind*subvect_size+j]),SIG_SHIFT-5);
-         } else {
-            for (j=0;j<subvect_size;j++)
-               e[subvect_size*i+j]=NEG32(SHL32(EXTEND32(shape_cb[rind*subvect_size+j]),SIG_SHIFT-5));
-         }
-#else
-         for (j=0;j<subvect_size;j++)
-            e[subvect_size*i+j]=sign*0.03125*shape_cb[rind*subvect_size+j];
-#endif
-      
-      }
-            
-      for (m=0;m<subvect_size;m++)
-      {
-         spx_word16_t g;
-         int rind;
-         spx_word16_t sign=1;
-         rind = best_index;
-         if (rind>=shape_cb_size)
-         {
-            sign=-1;
-            rind-=shape_cb_size;
-         }
-         
-         q=subvect_size-m;
-#ifdef FIXED_POINT
-         g=sign*shape_cb[rind*subvect_size+m];
-#else
-         g=sign*0.03125*shape_cb[rind*subvect_size+m];
-#endif
-         target_update(t+subvect_size*(i+1), g, r+q, nsf-subvect_size*(i+1));
-      }
-   }
-
-   /* Update excitation */
-   /* FIXME: We could update the excitation directly above */
-   for (j=0;j<nsf;j++)
-      exc[j]=ADD32(exc[j],e[j]);
-   
-   /* Update target: only update target if necessary */
-   if (update_target)
-   {
-      VARDECL(spx_word16_t *r2);
-      ALLOC(r2, nsf, spx_word16_t);
-      for (j=0;j<nsf;j++)
-         r2[j] = EXTRACT16(PSHR32(e[j] ,6));
-      syn_percep_zero16(r2, ak, awk1, awk2, r2, nsf,p, stack);
-      for (j=0;j<nsf;j++)
-         target[j]=SUB16(target[j],PSHR16(r2[j],2));
-   }
-}
-
-
-
-void split_cb_search_shape_sign(
-spx_word16_t target[],			/* target vector */
-spx_coef_t ak[],			/* LPCs for this subframe */
-spx_coef_t awk1[],			/* Weighted LPCs for this subframe */
-spx_coef_t awk2[],			/* Weighted LPCs for this subframe */
-const void *par,                      /* Codebook/search parameters*/
-int   p,                        /* number of LPC coeffs */
-int   nsf,                      /* number of samples in subframe */
-spx_sig_t *exc,
-spx_word16_t *r,
-SpeexBits *bits,
-char *stack,
-int   complexity,
-int   update_target
-)
-{
-   int i,j,k,m,n,q;
-   VARDECL(spx_word16_t *resp);
-#ifdef _USE_SSE
-   VARDECL(__m128 *resp2);
-   VARDECL(__m128 *E);
-#else
-   spx_word16_t *resp2;
-   VARDECL(spx_word32_t *E);
-#endif
-   VARDECL(spx_word16_t *t);
-   VARDECL(spx_sig_t *e);
-   VARDECL(spx_word16_t *tmp);
-   VARDECL(spx_word32_t *ndist);
-   VARDECL(spx_word32_t *odist);
-   VARDECL(int *itmp);
-   VARDECL(spx_word16_t **ot2);
-   VARDECL(spx_word16_t **nt2);
-   spx_word16_t **ot, **nt;
-   VARDECL(int **nind);
-   VARDECL(int **oind);
-   VARDECL(int *ind);
-   const signed char *shape_cb;
-   int shape_cb_size, subvect_size, nb_subvect;
-   const split_cb_params *params;
-   int N=2;
-   VARDECL(int *best_index);
-   VARDECL(spx_word32_t *best_dist);
-   VARDECL(int *best_nind);
-   VARDECL(int *best_ntarget);
-   int have_sign;
-   N=complexity;
-   if (N>10)
-      N=10;
-   /* Complexity isn't as important for the codebooks as it is for the pitch */
-   N=(2*N)/3;
-   if (N<1)
-      N=1;
-   if (N==1)
-   {
-      split_cb_search_shape_sign_N1(target,ak,awk1,awk2,par,p,nsf,exc,r,bits,stack,update_target);
-      return;
-   }
-   ALLOC(ot2, N, spx_word16_t*);
-   ALLOC(nt2, N, spx_word16_t*);
-   ALLOC(oind, N, int*);
-   ALLOC(nind, N, int*);
-
-   params = (const split_cb_params *) par;
-   subvect_size = params->subvect_size;
-   nb_subvect = params->nb_subvect;
-   shape_cb_size = 1<<params->shape_bits;
-   shape_cb = params->shape_cb;
-   have_sign = params->have_sign;
-   ALLOC(resp, shape_cb_size*subvect_size, spx_word16_t);
-#ifdef _USE_SSE
-   ALLOC(resp2, (shape_cb_size*subvect_size)>>2, __m128);
-   ALLOC(E, shape_cb_size>>2, __m128);
-#else
-   resp2 = resp;
-   ALLOC(E, shape_cb_size, spx_word32_t);
-#endif
-   ALLOC(t, nsf, spx_word16_t);
-   ALLOC(e, nsf, spx_sig_t);
-   ALLOC(ind, nb_subvect, int);
-
-   ALLOC(tmp, 2*N*nsf, spx_word16_t);
-   for (i=0;i<N;i++)
-   {
-      ot2[i]=tmp+2*i*nsf;
-      nt2[i]=tmp+(2*i+1)*nsf;
-   }
-   ot=ot2;
-   nt=nt2;
-   ALLOC(best_index, N, int);
-   ALLOC(best_dist, N, spx_word32_t);
-   ALLOC(best_nind, N, int);
-   ALLOC(best_ntarget, N, int);
-   ALLOC(ndist, N, spx_word32_t);
-   ALLOC(odist, N, spx_word32_t);
-   
-   ALLOC(itmp, 2*N*nb_subvect, int);
-   for (i=0;i<N;i++)
-   {
-      nind[i]=itmp+2*i*nb_subvect;
-      oind[i]=itmp+(2*i+1)*nb_subvect;
-   }
-   
-   SPEEX_COPY(t, target, nsf);
-
-   for (j=0;j<N;j++)
-      SPEEX_COPY(&ot[j][0], t, nsf);
-
-   /* Pre-compute codewords response and energy */
-   compute_weighted_codebook(shape_cb, r, resp, resp2, E, shape_cb_size, subvect_size, stack);
-
-   for (j=0;j<N;j++)
-      odist[j]=0;
-   
-   /*For all subvectors*/
-   for (i=0;i<nb_subvect;i++)
-   {
-      /*"erase" nbest list*/
-      for (j=0;j<N;j++)
-         ndist[j]=VERY_LARGE32;
-      /* This is not strictly necessary, but it provides an additonal safety 
-         to prevent crashes in case something goes wrong in the previous
-         steps (e.g. NaNs) */
-      for (j=0;j<N;j++)
-         best_nind[j] = best_ntarget[j] = 0;
-      /*For all n-bests of previous subvector*/
-      for (j=0;j<N;j++)
-      {
-         spx_word16_t *x=ot[j]+subvect_size*i;
-         spx_word32_t tener = 0;
-         for (m=0;m<subvect_size;m++)
-            tener = MAC16_16(tener, x[m],x[m]);
-#ifdef FIXED_POINT
-         tener = SHR32(tener,1);
-#else
-         tener *= .5;
-#endif
-         /*Find new n-best based on previous n-best j*/
-         if (have_sign)
-            vq_nbest_sign(x, resp2, subvect_size, shape_cb_size, E, N, best_index, best_dist, stack);
-         else
-            vq_nbest(x, resp2, subvect_size, shape_cb_size, E, N, best_index, best_dist, stack);
-
-         /*For all new n-bests*/
-         for (k=0;k<N;k++)
-         {
-            /* Compute total distance (including previous sub-vectors */
-            spx_word32_t err = ADD32(ADD32(odist[j],best_dist[k]),tener);
-            
-            /*update n-best list*/
-            if (err<ndist[N-1])
-            {
-               for (m=0;m<N;m++)
-               {
-                  if (err < ndist[m])
-                  {
-                     for (n=N-1;n>m;n--)
-                     {
-                        ndist[n] = ndist[n-1];
-                        best_nind[n] = best_nind[n-1];
-                        best_ntarget[n] = best_ntarget[n-1];
-                     }
-                     /* n is equal to m here, so they're interchangeable */
-                     ndist[m] = err;
-                     best_nind[n] = best_index[k];
-                     best_ntarget[n] = j;
-                     break;
-                  }
-               }
-            }
-         }
-         if (i==0)
-            break;
-      }
-      for (j=0;j<N;j++)
-      {
-         /*previous target (we don't care what happened before*/
-         for (m=(i+1)*subvect_size;m<nsf;m++)
-            nt[j][m]=ot[best_ntarget[j]][m];
-         
-         /* New code: update the rest of the target only if it's worth it */
-         for (m=0;m<subvect_size;m++)
-         {
-            spx_word16_t g;
-            int rind;
-            spx_word16_t sign=1;
-            rind = best_nind[j];
-            if (rind>=shape_cb_size)
-            {
-               sign=-1;
-               rind-=shape_cb_size;
-            }
-
-            q=subvect_size-m;
-#ifdef FIXED_POINT
-            g=sign*shape_cb[rind*subvect_size+m];
-#else
-            g=sign*0.03125*shape_cb[rind*subvect_size+m];
-#endif
-            target_update(nt[j]+subvect_size*(i+1), g, r+q, nsf-subvect_size*(i+1));
-         }
-
-         for (q=0;q<nb_subvect;q++)
-            nind[j][q]=oind[best_ntarget[j]][q];
-         nind[j][i]=best_nind[j];
-      }
-
-      /*update old-new data*/
-      /* just swap pointers instead of a long copy */
-      {
-         spx_word16_t **tmp2;
-         tmp2=ot;
-         ot=nt;
-         nt=tmp2;
-      }
-      for (j=0;j<N;j++)
-         for (m=0;m<nb_subvect;m++)
-            oind[j][m]=nind[j][m];
-      for (j=0;j<N;j++)
-         odist[j]=ndist[j];
-   }
-
-   /*save indices*/
-   for (i=0;i<nb_subvect;i++)
-   {
-      ind[i]=nind[0][i];
-      speex_bits_pack(bits,ind[i],params->shape_bits+have_sign);
-   }
-   
-   /* Put everything back together */
-   for (i=0;i<nb_subvect;i++)
-   {
-      int rind;
-      spx_word16_t sign=1;
-      rind = ind[i];
-      if (rind>=shape_cb_size)
-      {
-         sign=-1;
-         rind-=shape_cb_size;
-      }
-#ifdef FIXED_POINT
-      if (sign==1)
-      {
-         for (j=0;j<subvect_size;j++)
-            e[subvect_size*i+j]=SHL32(EXTEND32(shape_cb[rind*subvect_size+j]),SIG_SHIFT-5);
-      } else {
-         for (j=0;j<subvect_size;j++)
-            e[subvect_size*i+j]=NEG32(SHL32(EXTEND32(shape_cb[rind*subvect_size+j]),SIG_SHIFT-5));
-      }
-#else
-      for (j=0;j<subvect_size;j++)
-         e[subvect_size*i+j]=sign*0.03125*shape_cb[rind*subvect_size+j];
-#endif
-   }   
-   /* Update excitation */
-   for (j=0;j<nsf;j++)
-      exc[j]=ADD32(exc[j],e[j]);
-   
-   /* Update target: only update target if necessary */
-   if (update_target)
-   {
-      VARDECL(spx_word16_t *r2);
-      ALLOC(r2, nsf, spx_word16_t);
-      for (j=0;j<nsf;j++)
-         r2[j] = EXTRACT16(PSHR32(e[j] ,6));
-      syn_percep_zero16(r2, ak, awk1, awk2, r2, nsf,p, stack);
-      for (j=0;j<nsf;j++)
-         target[j]=SUB16(target[j],PSHR16(r2[j],2));
-   }
-}
-
-
-void split_cb_shape_sign_unquant(
-spx_sig_t *exc,
-const void *par,                      /* non-overlapping codebook */
-int   nsf,                      /* number of samples in subframe */
-SpeexBits *bits,
-char *stack,
-spx_int32_t *seed
-)
-{
-   int i,j;
-   VARDECL(int *ind);
-   VARDECL(int *signs);
-   const signed char *shape_cb;
-   int shape_cb_size, subvect_size, nb_subvect;
-   const split_cb_params *params;
-   int have_sign;
-
-   params = (const split_cb_params *) par;
-   subvect_size = params->subvect_size;
-   nb_subvect = params->nb_subvect;
-   shape_cb_size = 1<<params->shape_bits;
-   shape_cb = params->shape_cb;
-   have_sign = params->have_sign;
-
-   ALLOC(ind, nb_subvect, int);
-   ALLOC(signs, nb_subvect, int);
-
-   /* Decode codewords and gains */
-   for (i=0;i<nb_subvect;i++)
-   {
-      if (have_sign)
-         signs[i] = speex_bits_unpack_unsigned(bits, 1);
-      else
-         signs[i] = 0;
-      ind[i] = speex_bits_unpack_unsigned(bits, params->shape_bits);
-   }
-   /* Compute decoded excitation */
-   for (i=0;i<nb_subvect;i++)
-   {
-      spx_word16_t s=1;
-      if (signs[i])
-         s=-1;
-#ifdef FIXED_POINT
-      if (s==1)
-      {
-         for (j=0;j<subvect_size;j++)
-            exc[subvect_size*i+j]=SHL32(EXTEND32(shape_cb[ind[i]*subvect_size+j]),SIG_SHIFT-5);
-      } else {
-         for (j=0;j<subvect_size;j++)
-            exc[subvect_size*i+j]=NEG32(SHL32(EXTEND32(shape_cb[ind[i]*subvect_size+j]),SIG_SHIFT-5));
-      }
-#else
-      for (j=0;j<subvect_size;j++)
-         exc[subvect_size*i+j]+=s*0.03125*shape_cb[ind[i]*subvect_size+j];      
-#endif
-   }
-}
-
-void noise_codebook_quant(
-spx_word16_t target[],			/* target vector */
-spx_coef_t ak[],			/* LPCs for this subframe */
-spx_coef_t awk1[],			/* Weighted LPCs for this subframe */
-spx_coef_t awk2[],			/* Weighted LPCs for this subframe */
-const void *par,                      /* Codebook/search parameters*/
-int   p,                        /* number of LPC coeffs */
-int   nsf,                      /* number of samples in subframe */
-spx_sig_t *exc,
-spx_word16_t *r,
-SpeexBits *bits,
-char *stack,
-int   complexity,
-int   update_target
-)
-{
-   int i;
-   VARDECL(spx_word16_t *tmp);
-   ALLOC(tmp, nsf, spx_word16_t);
-   residue_percep_zero16(target, ak, awk1, awk2, tmp, nsf, p, stack);
-
-   for (i=0;i<nsf;i++)
-      exc[i]+=SHL32(EXTEND32(tmp[i]),8);
-   SPEEX_MEMSET(target, 0, nsf);
-}
-
-
-void noise_codebook_unquant(
-spx_sig_t *exc,
-const void *par,                      /* non-overlapping codebook */
-int   nsf,                      /* number of samples in subframe */
-SpeexBits *bits,
-char *stack,
-spx_int32_t *seed
-)
-{
-   int i;
-   /* FIXME: This is bad, but I don't think the function ever gets called anyway */
-   for (i=0;i<nsf;i++)
-      exc[i]=SHL32(EXTEND32(speex_rand(1, seed)),SIG_SHIFT);
-}
diff --git a/libspeex/cb_search.h b/libspeex/cb_search.h
deleted file mode 100644
index 7687b45..0000000
--- a/libspeex/cb_search.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin & David Rowe */
-/**
-   @file cb_search.h
-   @brief Overlapped codebook search
-*/
-/*
-   Redistribution and use in source and binary forms, with or without
-   modification, 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 the Xiph.org Foundation nor the names of its
-   contributors may be used to endorse or promote products derived from
-   this software without specific prior written permission.
-   
-   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 FOUNDATION OR
-   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef CB_SEARCH_H
-#define CB_SEARCH_H
-
-#include <speex/speex_bits.h>
-#include "arch.h"
-
-/** Split codebook parameters. */
-typedef struct split_cb_params {
-   int     subvect_size;
-   int     nb_subvect;
-   const signed char  *shape_cb;
-   int     shape_bits;
-   int     have_sign;
-} split_cb_params;
-
-
-void split_cb_search_shape_sign(
-spx_word16_t target[],             /* target vector */
-spx_coef_t ak[],                /* LPCs for this subframe */
-spx_coef_t awk1[],              /* Weighted LPCs for this subframe */
-spx_coef_t awk2[],              /* Weighted LPCs for this subframe */
-const void *par,                /* Codebook/search parameters */
-int   p,                        /* number of LPC coeffs */
-int   nsf,                      /* number of samples in subframe */
-spx_sig_t *exc,
-spx_word16_t *r,
-SpeexBits *bits,
-char *stack,
-int   complexity,
-int   update_target
-);
-
-void split_cb_shape_sign_unquant(
-spx_sig_t *exc,
-const void *par,                /* non-overlapping codebook */
-int   nsf,                      /* number of samples in subframe */
-SpeexBits *bits,
-char *stack,
-spx_int32_t *seed
-);
-
-
-void noise_codebook_quant(
-spx_word16_t target[],             /* target vector */
-spx_coef_t ak[],                /* LPCs for this subframe */
-spx_coef_t awk1[],              /* Weighted LPCs for this subframe */
-spx_coef_t awk2[],              /* Weighted LPCs for this subframe */
-const void *par,                /* Codebook/search parameters */
-int   p,                        /* number of LPC coeffs */
-int   nsf,                      /* number of samples in subframe */
-spx_sig_t *exc,
-spx_word16_t *r,
-SpeexBits *bits,
-char *stack,
-int   complexity,
-int   update_target
-);
-
-
-void noise_codebook_unquant(
-spx_sig_t *exc,
-const void *par,                /* non-overlapping codebook */
-int   nsf,                      /* number of samples in subframe */
-SpeexBits *bits,
-char *stack,
-spx_int32_t *seed
-);
-
-#endif
diff --git a/libspeex/exc_10_16_table.c b/libspeex/exc_10_16_table.c
deleted file mode 100644
index 98ae357..0000000
--- a/libspeex/exc_10_16_table.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin 
-   File: exc_10_16_table.c
-   Codebook for excitation in narrowband CELP mode (3200 bps)
-
-   Redistribution and use in source and binary forms, with or without
-   modification, 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 the Xiph.org Foundation nor the names of its
-   contributors may be used to endorse or promote products derived from
-   this software without specific prior written permission.
-   
-   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 FOUNDATION 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.
-*/
-
-
-const signed char exc_10_16_table[160] = {
-22,39,14,44,11,35,-2,23,-4,6,
-46,-28,13,-27,-23,12,4,20,-5,9,
-37,-18,-23,23,0,9,-6,-20,4,-1,
--17,-5,-4,17,0,1,9,-2,1,2,
-2,-12,8,-25,39,15,9,16,-55,-11,
-9,11,5,10,-2,-60,8,13,-6,11,
--16,27,-47,-12,11,1,16,-7,9,-3,
--29,9,-14,25,-19,34,36,12,40,-10,
--3,-24,-14,-37,-21,-35,-2,-36,3,-6,
-67,28,6,-17,-3,-12,-16,-15,-17,-7,
--59,-36,-13,1,7,1,2,10,2,11,
-13,10,8,-2,7,3,5,4,2,2,
--3,-8,4,-5,6,7,-42,15,35,-2,
--46,38,28,-20,-9,1,7,-3,0,-2,
-0,0,0,0,0,0,0,0,0,0,
--15,-28,52,32,5,-5,-17,-20,-10,-1};
diff --git a/libspeex/exc_10_32_table.c b/libspeex/exc_10_32_table.c
deleted file mode 100644
index 1ee56a2..0000000
--- a/libspeex/exc_10_32_table.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin 
-   File: exc_10_32_table.c
-   Codebook for excitation in narrowband CELP mode (4000 bps)
-
-   Redistribution and use in source and binary forms, with or without
-   modification, 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 the Xiph.org Foundation nor the names of its
-   contributors may be used to endorse or promote products derived from
-   this software without specific prior written permission.
-   
-   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 FOUNDATION 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.
-*/
-
-
-const signed char exc_10_32_table[320] = {
-7,17,17,27,25,22,12,4,-3,0,
-28,-36,39,-24,-15,3,-9,15,-5,10,
-31,-28,11,31,-21,9,-11,-11,-2,-7,
--25,14,-22,31,4,-14,19,-12,14,-5,
-4,-7,4,-5,9,0,-2,42,-47,-16,
-1,8,0,9,23,-57,0,28,-11,6,
--31,55,-45,3,-5,4,2,-2,4,-7,
--3,6,-2,7,-3,12,5,8,54,-10,
-8,-7,-8,-24,-25,-27,-14,-5,8,5,
-44,23,5,-9,-11,-11,-13,-9,-12,-8,
--29,-8,-22,6,-15,3,-12,-1,-5,-3,
-34,-1,29,-16,17,-4,12,2,1,4,
--2,-4,2,-1,11,-3,-52,28,30,-9,
--32,25,44,-20,-24,4,6,-1,0,0,
-0,0,0,0,0,0,0,0,0,0,
--25,-10,22,29,13,-13,-22,-13,-4,0,
--4,-16,10,15,-36,-24,28,25,-1,-3,
-66,-33,-11,-15,6,0,3,4,-2,5,
-24,-20,-47,29,19,-2,-4,-1,0,-1,
--2,3,1,8,-11,5,5,-57,28,28,
-0,-16,4,-4,12,-6,-1,2,-20,61,
--9,24,-22,-42,29,6,17,8,4,2,
--65,15,8,10,5,6,5,3,2,-2,
--3,5,-9,4,-5,23,13,23,-3,-63,
-3,-5,-4,-6,0,-3,23,-36,-46,9,
-5,5,8,4,9,-5,1,-3,10,1,
--6,10,-11,24,-47,31,22,-12,14,-10,
-6,11,-7,-7,7,-31,51,-12,-6,7,
-6,-17,9,-11,-20,52,-19,3,-6,-6,
--8,-5,23,-41,37,1,-21,10,-14,8,
-7,5,-15,-15,23,39,-26,-33,7,2,
--32,-30,-21,-8,4,12,17,15,14,11};
diff --git a/libspeex/exc_20_32_table.c b/libspeex/exc_20_32_table.c
deleted file mode 100644
index e4098b8..0000000
--- a/libspeex/exc_20_32_table.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin 
-   File: exc_20_32_table.c
-   Codebook for excitation in narrowband CELP mode (2000 bps)
-
-   Redistribution and use in source and binary forms, with or without
-   modification, 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 the Xiph.org Foundation nor the names of its
-   contributors may be used to endorse or promote products derived from
-   this software without specific prior written permission.
-   
-   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 FOUNDATION 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.
-*/
-
-
-const signed char exc_20_32_table[640] = {
-12,32,25,46,36,33,9,14,-3,6,1,-8,0,-10,-5,-7,-7,-7,-5,-5,
-31,-27,24,-32,-4,10,-11,21,-3,19,23,-9,22,24,-10,-1,-10,-13,-7,-11,
-42,-33,31,19,-8,0,-10,-16,1,-21,-17,10,-8,14,8,4,11,-2,5,-2,
--33,11,-16,33,11,-4,9,-4,11,2,6,-5,8,-5,11,-4,-6,26,-36,-16,
-0,4,-2,-8,12,6,-1,34,-46,-22,9,9,21,9,5,-66,-5,26,2,10,
-13,2,19,9,12,-81,3,13,13,0,-14,22,-35,6,-7,-4,6,-6,10,-6,
--31,38,-33,0,-10,-11,5,-12,12,-17,5,0,-6,13,-9,10,8,25,33,2,
--12,8,-6,10,-2,21,7,17,43,5,11,-7,-9,-20,-36,-20,-23,-4,-4,-3,
-27,-9,-9,-49,-39,-38,-11,-9,6,5,23,25,5,3,3,4,1,2,-3,-1,
-87,39,17,-21,-9,-19,-9,-15,-13,-14,-17,-11,-10,-11,-8,-6,-1,-3,-3,-1,
--54,-34,-27,-8,-11,-4,-5,0,0,4,8,6,9,7,9,7,6,5,5,5,
-48,10,19,-10,12,-1,9,-3,2,5,-3,2,-2,-2,0,-2,-26,6,9,-7,
--16,-9,2,7,7,-5,-43,11,22,-11,-9,34,37,-15,-13,-6,1,-1,1,1,
--64,56,52,-11,-27,5,4,3,1,2,1,3,-1,-4,-4,-10,-7,-4,-4,2,
--1,-7,-7,-12,-10,-15,-9,-5,-5,-11,-16,-13,6,16,4,-13,-16,-10,-4,2,
--47,-13,25,47,19,-14,-20,-8,-17,0,-3,-13,1,6,-17,-14,15,1,10,6,
--24,0,-10,19,-69,-8,14,49,17,-5,33,-29,3,-4,0,2,-8,5,-6,2,
-120,-56,-12,-47,23,-9,6,-5,1,2,-5,1,-10,4,-1,-1,4,-1,0,-3,
-30,-52,-67,30,22,11,-1,-4,3,0,7,2,0,1,-10,-4,-8,-13,5,1,
-1,-1,5,13,-9,-3,-10,-62,22,48,-4,-6,2,3,5,1,1,4,1,13,
-3,-20,10,-9,13,-2,-4,9,-20,44,-1,20,-32,-67,19,0,28,11,8,2,
--11,15,-19,-53,31,2,34,10,6,-4,-58,8,10,13,14,1,12,2,0,0,
--128,37,-8,44,-9,26,-3,18,2,6,11,-1,9,1,5,3,0,1,1,2,
-12,3,-2,-3,7,25,9,18,-6,-37,3,-8,-16,3,-10,-7,17,-34,-44,11,
-17,-15,-3,-16,-1,-13,11,-46,-65,-2,8,13,2,4,4,5,15,5,9,6,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
--9,19,-12,12,-28,38,29,-1,12,2,5,23,-10,3,4,-15,21,-4,3,3,
-6,17,-9,-4,-8,-20,26,5,-10,6,1,-19,18,-15,-12,47,-6,-2,-7,-9,
--1,-17,-2,-2,-14,30,-14,2,-7,-4,-1,-12,11,-25,16,-3,-12,11,-7,7,
--17,1,19,-28,31,-7,-10,7,-10,3,12,5,-16,6,24,41,-29,-54,0,1,
-7,-1,5,-6,13,10,-4,-8,8,-9,-27,-53,-38,-1,10,19,17,16,12,12,
-0,3,-7,-4,13,12,-31,-14,6,-5,3,5,17,43,50,25,10,1,-6,-2};
diff --git a/libspeex/exc_5_256_table.c b/libspeex/exc_5_256_table.c
deleted file mode 100644
index 4137996..0000000
--- a/libspeex/exc_5_256_table.c
+++ /dev/null
@@ -1,290 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin 
-   File: exc_5_256_table.c
-   Codebook for excitation in narrowband CELP mode (12800 bps)
-
-   Redistribution and use in source and binary forms, with or without
-   modification, 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 the Xiph.org Foundation nor the names of its
-   contributors may be used to endorse or promote products derived from
-   this software without specific prior written permission.
-   
-   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 FOUNDATION 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.
-*/
-
-
-const signed char exc_5_256_table[1280] = {
--8,-37,5,-43,5,
-73,61,39,12,-3,
--61,-32,2,42,30,
--3,17,-27,9,34,
-20,-1,-5,2,23,
--7,-46,26,53,-47,
-20,-2,-33,-89,-51,
--64,27,11,15,-34,
--5,-56,25,-9,-1,
--29,1,40,67,-23,
--16,16,33,19,7,
-14,85,22,-10,-10,
--12,-7,-1,52,89,
-29,11,-20,-37,-46,
--15,17,-24,-28,24,
-2,1,0,23,-101,
-23,14,-1,-23,-18,
-9,5,-13,38,1,
--28,-28,4,27,51,
--26,34,-40,35,47,
-54,38,-54,-26,-6,
-42,-25,13,-30,-36,
-18,41,-4,-33,23,
--32,-7,-4,51,-3,
-17,-52,56,-47,36,
--2,-21,36,10,8,
--33,31,19,9,-5,
--40,10,-9,-21,19,
-18,-78,-18,-5,0,
--26,-36,-47,-51,-44,
-18,40,27,-2,29,
-49,-26,2,32,-54,
-30,-73,54,3,-5,
-36,22,53,10,-1,
--84,-53,-29,-5,3,
--44,53,-51,4,22,
-71,-35,-1,33,-5,
--27,-7,36,17,-23,
--39,16,-9,-55,-15,
--20,39,-35,6,-39,
--14,18,48,-64,-17,
--15,9,39,81,37,
--68,37,47,-21,-6,
--104,13,6,9,-2,
-35,8,-23,18,42,
-45,21,33,-5,-49,
-9,-6,-43,-56,39,
-2,-16,-25,87,1,
--3,-9,17,-25,-11,
--9,-1,10,2,-14,
--14,4,-1,-10,28,
--23,40,-32,26,-9,
-26,4,-27,-23,3,
-42,-60,1,49,-3,
-27,10,-52,-40,-2,
-18,45,-23,17,-44,
-3,-3,17,-46,52,
--40,-47,25,75,31,
--49,53,30,-30,-32,
--36,38,-6,-15,-16,
-54,-27,-48,3,38,
--29,-32,-22,-14,-4,
--23,-13,32,-39,9,
-8,-45,-13,34,-16,
-49,40,32,31,28,
-23,23,32,47,59,
--68,8,62,44,25,
--14,-24,-65,-16,36,
-67,-25,-38,-21,4,
--33,-2,42,5,-63,
-40,11,26,-42,-23,
--61,79,-31,23,-20,
-10,-32,53,-25,-36,
-10,-26,-5,3,0,
--71,5,-10,-37,1,
--24,21,-54,-17,1,
--29,-25,-15,-27,32,
-68,45,-16,-37,-18,
--5,1,0,-77,71,
--6,3,-20,71,-67,
-29,-35,10,-30,19,
-4,16,17,5,0,
--14,19,2,28,26,
-59,3,2,24,39,
-55,-50,-45,-18,-17,
-33,-35,14,-1,1,
-8,87,-35,-29,0,
--27,13,-7,23,-13,
-37,-40,50,-35,14,
-19,-7,-14,49,54,
--5,22,-2,-29,-8,
--27,38,13,27,48,
-12,-41,-21,-15,28,
-7,-16,-24,-19,-20,
-11,-20,9,2,13,
-23,-20,11,27,-27,
-71,-69,8,2,-6,
-22,12,16,16,9,
--16,-8,-17,1,25,
-1,40,-37,-33,66,
-94,53,4,-22,-25,
--41,-42,25,35,-16,
--15,57,31,-29,-32,
-21,16,-60,45,15,
--1,7,57,-26,-47,
--29,11,8,15,19,
--105,-8,54,27,10,
--17,6,-12,-1,-10,
-4,0,23,-10,31,
-13,11,10,12,-64,
-23,-3,-8,-19,16,
-52,24,-40,16,10,
-40,5,9,0,-13,
--7,-21,-8,-6,-7,
--21,59,16,-53,18,
--60,11,-47,14,-18,
-25,-13,-24,4,-39,
-16,-28,54,26,-67,
-30,27,-20,-52,20,
--12,55,12,18,-16,
-39,-14,-6,-26,56,
--88,-55,12,25,26,
--37,6,75,0,-34,
--81,54,-30,1,-7,
-49,-23,-14,21,10,
--62,-58,-57,-47,-34,
-15,-4,34,-78,31,
-25,-11,7,50,-10,
-42,-63,14,-36,-4,
-57,55,57,53,42,
--42,-1,15,40,37,
-15,25,-11,6,1,
-31,-2,-6,-1,-7,
--64,34,28,30,-1,
-3,21,0,-88,-12,
--56,25,-28,40,8,
--28,-14,9,12,2,
--6,-17,22,49,-6,
--26,14,28,-20,4,
--12,50,35,40,13,
--38,-58,-29,17,30,
-22,60,26,-54,-39,
--12,58,-28,-63,10,
--21,-8,-12,26,-62,
-6,-10,-11,-22,-6,
--7,4,1,18,2,
--70,11,14,4,13,
-19,-24,-34,24,67,
-17,51,-21,13,23,
-54,-30,48,1,-13,
-80,26,-16,-2,13,
--4,6,-30,29,-24,
-73,-58,30,-27,20,
--2,-21,41,45,30,
--27,-3,-5,-18,-20,
--49,-3,-35,10,42,
--19,-67,-53,-11,9,
-13,-15,-33,-51,-30,
-15,7,25,-30,4,
-28,-22,-34,54,-29,
-39,-46,20,16,34,
--4,47,75,1,-44,
--55,-24,7,-1,9,
--42,50,-8,-36,41,
-68,0,-4,-10,-23,
--15,-50,64,36,-9,
--27,12,25,-38,-47,
--37,32,-49,51,-36,
-2,-4,69,-26,19,
-7,45,67,46,13,
--63,46,15,-47,4,
--41,13,-6,5,-21,
-37,26,-55,-7,33,
--1,-28,10,-17,-64,
--14,0,-36,-17,93,
--3,-9,-66,44,-21,
-3,-12,38,-6,-13,
--12,19,13,43,-43,
--10,-12,6,-5,9,
--49,32,-5,2,4,
-5,15,-16,10,-21,
-8,-62,-8,64,8,
-79,-1,-66,-49,-18,
-5,40,-5,-30,-45,
-1,-6,21,-32,93,
--18,-30,-21,32,21,
--18,22,8,5,-41,
--54,80,22,-10,-7,
--8,-23,-64,66,56,
--14,-30,-41,-46,-14,
--29,-37,27,-14,42,
--2,-9,-29,34,14,
-33,-14,22,4,10,
-26,26,28,32,23,
--72,-32,3,0,-14,
-35,-42,-78,-32,6,
-29,-18,-45,-5,7,
--33,-45,-3,-22,-34,
-8,-8,4,-51,-25,
--9,59,-78,21,-5,
--25,-48,66,-15,-17,
--24,-49,-13,25,-23,
--64,-6,40,-24,-19,
--11,57,-33,-8,1,
-10,-52,-54,28,39,
-49,34,-11,-61,-41,
--43,10,15,-15,51,
-30,15,-51,32,-34,
--2,-34,14,18,16,
-1,1,-3,-3,1,
-1,-18,6,16,48,
-12,-5,-42,7,36,
-48,7,-20,-10,7,
-12,2,54,39,-38,
-37,54,4,-11,-8,
--46,-10,5,-10,-34,
-46,-12,29,-37,39,
-36,-11,24,56,17,
-14,20,25,0,-25,
--28,55,-7,-5,27,
-3,9,-26,-8,6,
--24,-10,-30,-31,-34,
-18,4,22,21,40,
--1,-29,-37,-8,-21,
-92,-29,11,-3,11,
-73,23,22,7,4,
--44,-9,-11,21,-13,
-11,9,-78,-1,47,
-114,-12,-37,-19,-5,
--11,-22,19,12,-30,
-7,38,45,-21,-8,
--9,55,-45,56,-21,
-7,17,46,-57,-87,
--6,27,31,31,7,
--56,-12,46,21,-5,
--12,36,3,3,-21,
-43,19,12,-7,9,
--14,0,-9,-33,-91,
-7,26,3,-11,64,
-83,-31,-46,25,2,
-9,5,2,2,-1,
-20,-17,10,-5,-27,
--8,20,8,-19,16,
--21,-13,-31,5,5,
-42,24,9,34,-20,
-28,-61,22,11,-39,
-64,-20,-1,-30,-9,
--20,24,-25,-24,-29,
-22,-60,6,-5,41,
--9,-87,14,34,15,
--57,52,69,15,-3,
--102,58,16,3,6,
-60,-75,-32,26,7,
--57,-27,-32,-24,-21,
--29,-16,62,-46,31,
-30,-27,-15,7,15};
diff --git a/libspeex/exc_5_64_table.c b/libspeex/exc_5_64_table.c
deleted file mode 100644
index 2c66d51..0000000
--- a/libspeex/exc_5_64_table.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin 
-   File: exc_5_64_table.c
-   Codebook for excitation in narrowband CELP mode (9600 bps)
-
-   Redistribution and use in source and binary forms, with or without
-   modification, 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 the Xiph.org Foundation nor the names of its
-   contributors may be used to endorse or promote products derived from
-   this software without specific prior written permission.
-   
-   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 FOUNDATION 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.
-*/
-
-
-const signed char exc_5_64_table[320]={
-1,5,-15,49,-66,
--48,-4,50,-44,7,
-37,16,-18,25,-26,
--26,-15,19,19,-27,
--47,28,57,5,-17,
--32,-41,68,21,-2,
-64,56,8,-16,-13,
--26,-9,-16,11,6,
--39,25,-19,22,-31,
-20,-45,55,-43,10,
--16,47,-40,40,-20,
--51,3,-17,-14,-15,
--24,53,-20,-46,46,
-27,-68,32,3,-18,
--5,9,-31,16,-9,
--10,-1,-23,48,95,
-47,25,-41,-32,-3,
-15,-25,-55,36,41,
--27,20,5,13,14,
--22,5,2,-23,18,
-46,-15,17,-18,-34,
--5,-8,27,-55,73,
-16,2,-1,-17,40,
--78,33,0,2,19,
-4,53,-16,-15,-16,
--28,-3,-13,49,8,
--7,-29,27,-13,32,
-20,32,-61,16,14,
-41,44,40,24,20,
-7,4,48,-60,-77,
-17,-6,-48,65,-15,
-32,-30,-71,-10,-3,
--6,10,-2,-7,-29,
--56,67,-30,7,-5,
-86,-6,-10,0,5,
--31,60,34,-38,-3,
-24,10,-2,30,23,
-24,-41,12,70,-43,
-15,-17,6,13,16,
--13,8,30,-15,-8,
-5,23,-34,-98,-4,
--13,13,-48,-31,70,
-12,31,25,24,-24,
-26,-7,33,-16,8,
-5,-11,-14,-8,-65,
-13,10,-2,-9,0,
--3,-68,5,35,7,
-0,-31,-1,-17,-9,
--9,16,-37,-18,-1,
-69,-48,-28,22,-21,
--11,5,49,55,23,
--86,-36,16,2,13,
-63,-51,30,-11,13,
-24,-18,-6,14,-19,
-1,41,9,-5,27,
--36,-44,-34,-37,-21,
--26,31,-39,15,43,
-5,-8,29,20,-8,
--20,-52,-28,-1,13,
-26,-34,-10,-9,27,
--8,8,27,-66,4,
-12,-22,49,10,-77,
-32,-18,3,-38,12,
--3,-1,2,2,0};
diff --git a/libspeex/exc_8_128_table.c b/libspeex/exc_8_128_table.c
deleted file mode 100644
index 17ee64b..0000000
--- a/libspeex/exc_8_128_table.c
+++ /dev/null
@@ -1,162 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin 
-   File: exc_8_128_table.c
-   Codebook for excitation in narrowband CELP mode (7000 bps)
-
-   Redistribution and use in source and binary forms, with or without
-   modification, 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 the Xiph.org Foundation nor the names of its
-   contributors may be used to endorse or promote products derived from
-   this software without specific prior written permission.
-   
-   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 FOUNDATION 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.
-*/
-
-
-const signed char exc_8_128_table[1024] = {
--14,9,13,-32,2,-10,31,-10,
--8,-8,6,-4,-1,10,-64,23,
-6,20,13,6,8,-22,16,34,
-7,42,-49,-28,5,26,4,-15,
-41,34,41,32,33,24,23,14,
-8,40,34,4,-24,-41,-19,-15,
-13,-13,33,-54,24,27,-44,33,
-27,-15,-15,24,-19,14,-36,14,
--9,24,-12,-4,37,-5,16,-34,
-5,10,33,-15,-54,-16,12,25,
-12,1,2,0,3,-1,-4,-4,
-11,2,-56,54,27,-20,13,-6,
--46,-41,-33,-11,-5,7,12,14,
--14,-5,8,20,6,3,4,-8,
--5,-42,11,8,-14,25,-2,2,
-13,11,-22,39,-9,9,5,-45,
--9,7,-9,12,-7,34,-17,-102,
-7,2,-42,18,35,-9,-34,11,
--5,-2,3,22,46,-52,-25,-9,
--94,8,11,-5,-5,-5,4,-7,
--35,-7,54,5,-32,3,24,-9,
--22,8,65,37,-1,-12,-23,-6,
--9,-28,55,-33,14,-3,2,18,
--60,41,-17,8,-16,17,-11,0,
--11,29,-28,37,9,-53,33,-14,
--9,7,-25,-7,-11,26,-32,-8,
-24,-21,22,-19,19,-10,29,-14,
-0,0,0,0,0,0,0,0,
--5,-52,10,41,6,-30,-4,16,
-32,22,-27,-22,32,-3,-28,-3,
-3,-35,6,17,23,21,8,2,
-4,-45,-17,14,23,-4,-31,-11,
--3,14,1,19,-11,2,61,-8,
-9,-12,7,-10,12,-3,-24,99,
--48,23,50,-37,-5,-23,0,8,
--14,35,-64,-5,46,-25,13,-1,
--49,-19,-15,9,34,50,25,11,
--6,-9,-16,-20,-32,-33,-32,-27,
-10,-8,12,-15,56,-14,-32,33,
-3,-9,1,65,-9,-9,-10,-2,
--6,-23,9,17,3,-28,13,-32,
-4,-2,-10,4,-16,76,12,-52,
-6,13,33,-6,4,-14,-9,-3,
-1,-15,-16,28,1,-15,11,16,
-9,4,-21,-37,-40,-6,22,12,
--15,-23,-14,-17,-16,-9,-10,-9,
-13,-39,41,5,-9,16,-38,25,
-46,-47,4,49,-14,17,-2,6,
-18,5,-6,-33,-22,44,50,-2,
-1,3,-6,7,7,-3,-21,38,
--18,34,-14,-41,60,-13,6,16,
--24,35,19,-13,-36,24,3,-17,
--14,-10,36,44,-44,-29,-3,3,
--54,-8,12,55,26,4,-2,-5,
-2,-11,22,-23,2,22,1,-25,
--39,66,-49,21,-8,-2,10,-14,
--60,25,6,10,27,-25,16,5,
--2,-9,26,-13,-20,58,-2,7,
-52,-9,2,5,-4,-15,23,-1,
--38,23,8,27,-6,0,-27,-7,
-39,-10,-14,26,11,-45,-12,9,
--5,34,4,-35,10,43,-22,-11,
-56,-7,20,1,10,1,-26,9,
-94,11,-27,-14,-13,1,-11,0,
-14,-5,-6,-10,-4,-15,-8,-41,
-21,-5,1,-28,-8,22,-9,33,
--23,-4,-4,-12,39,4,-7,3,
--60,80,8,-17,2,-6,12,-5,
-1,9,15,27,31,30,27,23,
-61,47,26,10,-5,-8,-12,-13,
-5,-18,25,-15,-4,-15,-11,12,
--2,-2,-16,-2,-6,24,12,11,
--4,9,1,-9,14,-45,57,12,
-20,-35,26,11,-64,32,-10,-10,
-42,-4,-9,-16,32,24,7,10,
-52,-11,-57,29,0,8,0,-6,
-17,-17,-56,-40,7,20,18,12,
--6,16,5,7,-1,9,1,10,
-29,12,16,13,-2,23,7,9,
--3,-4,-5,18,-64,13,55,-25,
-9,-9,24,14,-25,15,-11,-40,
--30,37,1,-19,22,-5,-31,13,
--2,0,7,-4,16,-67,12,66,
--36,24,-8,18,-15,-23,19,0,
--45,-7,4,3,-13,13,35,5,
-13,33,10,27,23,0,-7,-11,
-43,-74,36,-12,2,5,-8,6,
--33,11,-16,-14,-5,-7,-3,17,
--34,27,-16,11,-9,15,33,-31,
-8,-16,7,-6,-7,63,-55,-17,
-11,-1,20,-46,34,-30,6,9,
-19,28,-9,5,-24,-8,-23,-2,
-31,-19,-16,-5,-15,-18,0,26,
-18,37,-5,-15,-2,17,5,-27,
-21,-33,44,12,-27,-9,17,11,
-25,-21,-31,-7,13,33,-8,-25,
--7,7,-10,4,-6,-9,48,-82,
--23,-8,6,11,-23,3,-3,49,
--29,25,31,4,14,16,9,-4,
--18,10,-26,3,5,-44,-9,9,
--47,-55,15,9,28,1,4,-3,
-46,6,-6,-38,-29,-31,-15,-6,
-3,0,14,-6,8,-54,-50,33,
--5,1,-14,33,-48,26,-4,-5,
--3,-5,-3,-5,-28,-22,77,55,
--1,2,10,10,-9,-14,-66,-49,
-11,-36,-6,-20,10,-10,16,12,
-4,-1,-16,45,-44,-50,31,-2,
-25,42,23,-32,-22,0,11,20,
--40,-35,-40,-36,-32,-26,-21,-13,
-52,-22,6,-24,-20,17,-5,-8,
-36,-25,-11,21,-26,6,34,-8,
-7,20,-3,5,-25,-8,18,-5,
--9,-4,1,-9,20,20,39,48,
--24,9,5,-65,22,29,4,3,
--43,-11,32,-6,9,19,-27,-10,
--47,-14,24,10,-7,-36,-7,-1,
--4,-5,-5,16,53,25,-26,-29,
--4,-12,45,-58,-34,33,-5,2,
--1,27,-48,31,-15,22,-5,4,
-7,7,-25,-3,11,-22,16,-12,
-8,-3,7,-11,45,14,-73,-19,
-56,-46,24,-20,28,-12,-2,-1,
--36,-3,-33,19,-6,7,2,-15,
-5,-31,-45,8,35,13,20,0,
--9,48,-13,-43,-3,-13,2,-5,
-72,-68,-27,2,1,-2,-7,5,
-36,33,-40,-12,-4,-5,23,19};
diff --git a/libspeex/filters.c b/libspeex/filters.c
deleted file mode 100644
index 36ef4f6..0000000
--- a/libspeex/filters.c
+++ /dev/null
@@ -1,821 +0,0 @@
-/* Copyright (C) 2002-2006 Jean-Marc Valin 
-   File: filters.c
-   Various analysis/synthesis filters
-
-   Redistribution and use in source and binary forms, with or without
-   modification, 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 the Xiph.org Foundation nor the names of its
-   contributors may be used to endorse or promote products derived from
-   this software without specific prior written permission.
-   
-   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 FOUNDATION 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.
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "filters.h"
-#include "stack_alloc.h"
-#include "arch.h"
-#include "math_approx.h"
-#include "ltp.h"
-#include <math.h>
-
-#ifdef _USE_SSE
-#include "filters_sse.h"
-#elif defined (ARM4_ASM) || defined(ARM5E_ASM)
-#include "filters_arm4.h"
-#elif defined (BFIN_ASM)
-#include "filters_bfin.h"
-#endif
-
-
-
-void bw_lpc(spx_word16_t gamma, const spx_coef_t *lpc_in, spx_coef_t *lpc_out, int order)
-{
-   int i;
-   spx_word16_t tmp=gamma;
-   for (i=0;i<order;i++)
-   {
-      lpc_out[i] = MULT16_16_P15(tmp,lpc_in[i]);
-      tmp = MULT16_16_P15(tmp, gamma);
-   }
-}
-
-void sanitize_values32(spx_word32_t *vec, spx_word32_t min_val, spx_word32_t max_val, int len)
-{
-   int i;
-   for (i=0;i<len;i++)
-   {
-      /* It's important we do the test that way so we can catch NaNs, which are neither greater nor smaller */
-      if (!(vec[i]>=min_val && vec[i] <= max_val))
-      {
-         if (vec[i] < min_val)
-            vec[i] = min_val;
-         else if (vec[i] > max_val)
-            vec[i] = max_val;
-         else /* Has to be NaN */
-            vec[i] = 0;
-      }
-   }
-}
-
-void highpass(const spx_word16_t *x, spx_word16_t *y, int len, int filtID, spx_mem_t *mem)
-{
-   int i;
-#ifdef FIXED_POINT
-   const spx_word16_t Pcoef[5][3] = {{16384, -31313, 14991}, {16384, -31569, 15249}, {16384, -31677, 15328}, {16384, -32313, 15947}, {16384, -22446, 6537}};
-   const spx_word16_t Zcoef[5][3] = {{15672, -31344, 15672}, {15802, -31601, 15802}, {15847, -31694, 15847}, {16162, -32322, 16162}, {14418, -28836, 14418}};
-#else
-   const spx_word16_t Pcoef[5][3] = {{1.00000f, -1.91120f, 0.91498f}, {1.00000f, -1.92683f, 0.93071f}, {1.00000f, -1.93338f, 0.93553f}, {1.00000f, -1.97226f, 0.97332f}, {1.00000f, -1.37000f, 0.39900f}};
-   const spx_word16_t Zcoef[5][3] = {{0.95654f, -1.91309f, 0.95654f}, {0.96446f, -1.92879f, 0.96446f}, {0.96723f, -1.93445f, 0.96723f}, {0.98645f, -1.97277f, 0.98645f}, {0.88000f, -1.76000f, 0.88000f}};
-#endif
-   const spx_word16_t *den, *num;
-   if (filtID>4)
-      filtID=4;
-   
-   den = Pcoef[filtID]; num = Zcoef[filtID];
-   /*return;*/
-   for (i=0;i<len;i++)
-   {
-      spx_word16_t yi;
-      spx_word32_t vout = ADD32(MULT16_16(num[0], x[i]),mem[0]);
-      yi = EXTRACT16(SATURATE(PSHR32(vout,14),32767));
-      mem[0] = ADD32(MAC16_16(mem[1], num[1],x[i]), SHL32(MULT16_32_Q15(-den[1],vout),1));
-      mem[1] = ADD32(MULT16_16(num[2],x[i]), SHL32(MULT16_32_Q15(-den[2],vout),1));
-      y[i] = yi;
-   }
-}
-
-#ifdef FIXED_POINT
-
-/* FIXME: These functions are ugly and probably introduce too much error */
-void signal_mul(const spx_sig_t *x, spx_sig_t *y, spx_word32_t scale, int len)
-{
-   int i;
-   for (i=0;i<len;i++)
-   {
-      y[i] = SHL32(MULT16_32_Q14(EXTRACT16(SHR32(x[i],7)),scale),7);
-   }
-}
-
-void signal_div(const spx_word16_t *x, spx_word16_t *y, spx_word32_t scale, int len)
-{
-   int i;
-   if (scale > SHL32(EXTEND32(SIG_SCALING), 8))
-   {
-      spx_word16_t scale_1;
-      scale = PSHR32(scale, SIG_SHIFT);
-      scale_1 = EXTRACT16(PDIV32_16(SHL32(EXTEND32(SIG_SCALING),7),scale));
-      for (i=0;i<len;i++)
-      {
-         y[i] = MULT16_16_P15(scale_1, x[i]);
-      }
-   } else if (scale > SHR32(EXTEND32(SIG_SCALING), 2)) {
-      spx_word16_t scale_1;
-      scale = PSHR32(scale, SIG_SHIFT-5);
-      scale_1 = DIV32_16(SHL32(EXTEND32(SIG_SCALING),3),scale);
-      for (i=0;i<len;i++)
-      {
-         y[i] = PSHR32(MULT16_16(scale_1, SHL16(x[i],2)),8);
-      }
-   } else {
-      spx_word16_t scale_1;
-      scale = PSHR32(scale, SIG_SHIFT-7);
-      if (scale < 5)
-         scale = 5;
-      scale_1 = DIV32_16(SHL32(EXTEND32(SIG_SCALING),3),scale);
-      for (i=0;i<len;i++)
-      {
-         y[i] = PSHR32(MULT16_16(scale_1, SHL16(x[i],2)),6);
-      }
-   }
-}
-
-#else
-
-void signal_mul(const spx_sig_t *x, spx_sig_t *y, spx_word32_t scale, int len)
-{
-   int i;
-   for (i=0;i<len;i++)
-      y[i] = scale*x[i];
-}
-
-void signal_div(const spx_sig_t *x, spx_sig_t *y, spx_word32_t scale, int len)
-{
-   int i;
-   float scale_1 = 1/scale;
-   for (i=0;i<len;i++)
-      y[i] = scale_1*x[i];
-}
-#endif
-
-
-
-#ifdef FIXED_POINT
-
-
-
-spx_word16_t compute_rms(const spx_sig_t *x, int len)
-{
-   int i;
-   spx_word32_t sum=0;
-   spx_sig_t max_val=1;
-   int sig_shift;
-
-   for (i=0;i<len;i++)
-   {
-      spx_sig_t tmp = x[i];
-      if (tmp<0)
-         tmp = -tmp;
-      if (tmp > max_val)
-         max_val = tmp;
-   }
-
-   sig_shift=0;
-   while (max_val>16383)
-   {
-      sig_shift++;
-      max_val >>= 1;
-   }
-
-   for (i=0;i<len;i+=4)
-   {
-      spx_word32_t sum2=0;
-      spx_word16_t tmp;
-      tmp = EXTRACT16(SHR32(x[i],sig_shift));
-      sum2 = MAC16_16(sum2,tmp,tmp);
-      tmp = EXTRACT16(SHR32(x[i+1],sig_shift));
-      sum2 = MAC16_16(sum2,tmp,tmp);
-      tmp = EXTRACT16(SHR32(x[i+2],sig_shift));
-      sum2 = MAC16_16(sum2,tmp,tmp);
-      tmp = EXTRACT16(SHR32(x[i+3],sig_shift));
-      sum2 = MAC16_16(sum2,tmp,tmp);
-      sum = ADD32(sum,SHR32(sum2,6));
-   }
-   
-   return EXTRACT16(PSHR32(SHL32(EXTEND32(spx_sqrt(DIV32(sum,len))),(sig_shift+3)),SIG_SHIFT));
-}
-
-spx_word16_t compute_rms16(const spx_word16_t *x, int len)
-{
-   int i;
-   spx_word16_t max_val=10; 
-
-   for (i=0;i<len;i++)
-   {
-      spx_sig_t tmp = x[i];
-      if (tmp<0)
-         tmp = -tmp;
-      if (tmp > max_val)
-         max_val = tmp;
-   }
-   if (max_val>16383)
-   {
-      spx_word32_t sum=0;
-      for (i=0;i<len;i+=4)
-      {
-         spx_word32_t sum2=0;
-         sum2 = MAC16_16(sum2,SHR16(x[i],1),SHR16(x[i],1));
-         sum2 = MAC16_16(sum2,SHR16(x[i+1],1),SHR16(x[i+1],1));
-         sum2 = MAC16_16(sum2,SHR16(x[i+2],1),SHR16(x[i+2],1));
-         sum2 = MAC16_16(sum2,SHR16(x[i+3],1),SHR16(x[i+3],1));
-         sum = ADD32(sum,SHR32(sum2,6));
-      }
-      return SHL16(spx_sqrt(DIV32(sum,len)),4);
-   } else {
-      spx_word32_t sum=0;
-      int sig_shift=0;
-      if (max_val < 8192)
-         sig_shift=1;
-      if (max_val < 4096)
-         sig_shift=2;
-      if (max_val < 2048)
-         sig_shift=3;
-      for (i=0;i<len;i+=4)
-      {
-         spx_word32_t sum2=0;
-         sum2 = MAC16_16(sum2,SHL16(x[i],sig_shift),SHL16(x[i],sig_shift));
-         sum2 = MAC16_16(sum2,SHL16(x[i+1],sig_shift),SHL16(x[i+1],sig_shift));
-         sum2 = MAC16_16(sum2,SHL16(x[i+2],sig_shift),SHL16(x[i+2],sig_shift));
-         sum2 = MAC16_16(sum2,SHL16(x[i+3],sig_shift),SHL16(x[i+3],sig_shift));
-         sum = ADD32(sum,SHR32(sum2,6));
-      }
-      return SHL16(spx_sqrt(DIV32(sum,len)),3-sig_shift);   
-   }
-}
-
-#ifndef OVERRIDE_NORMALIZE16
-int normalize16(const spx_sig_t *x, spx_word16_t *y, spx_sig_t max_scale, int len)
-{
-   int i;
-   spx_sig_t max_val=1;
-   int sig_shift;
-   
-   for (i=0;i<len;i++)
-   {
-      spx_sig_t tmp = x[i];
-      if (tmp<0)
-         tmp = NEG32(tmp);
-      if (tmp >= max_val)
-         max_val = tmp;
-   }
-
-   sig_shift=0;
-   while (max_val>max_scale)
-   {
-      sig_shift++;
-      max_val >>= 1;
-   }
-
-   for (i=0;i<len;i++)
-      y[i] = EXTRACT16(SHR32(x[i], sig_shift));
-   
-   return sig_shift;
-}
-#endif
-
-#else
-
-spx_word16_t compute_rms(const spx_sig_t *x, int len)
-{
-   int i;
-   float sum=0;
-   for (i=0;i<len;i++)
-   {
-      sum += x[i]*x[i];
-   }
-   return sqrt(.1+sum/len);
-}
-spx_word16_t compute_rms16(const spx_word16_t *x, int len)
-{
-   return compute_rms(x, len);
-}
-#endif
-
-
-
-#ifndef OVERRIDE_FILTER_MEM16
-void filter_mem16(const spx_word16_t *x, const spx_coef_t *num, const spx_coef_t *den, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack)
-{
-   int i,j;
-   spx_word16_t xi,yi,nyi;
-   for (i=0;i<N;i++)
-   {
-      xi= x[i];
-      yi = EXTRACT16(SATURATE(ADD32(EXTEND32(x[i]),PSHR32(mem[0],LPC_SHIFT)),32767));
-      nyi = NEG16(yi);
-      for (j=0;j<ord-1;j++)
-      {
-         mem[j] = MAC16_16(MAC16_16(mem[j+1], num[j],xi), den[j],nyi);
-      }
-      mem[ord-1] = ADD32(MULT16_16(num[ord-1],xi), MULT16_16(den[ord-1],nyi));
-      y[i] = yi;
-   }
-}
-#endif
-
-#ifndef OVERRIDE_IIR_MEM16
-void iir_mem16(const spx_word16_t *x, const spx_coef_t *den, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack)
-{
-   int i,j;
-   spx_word16_t yi,nyi;
-
-   for (i=0;i<N;i++)
-   {
-      yi = EXTRACT16(SATURATE(ADD32(EXTEND32(x[i]),PSHR32(mem[0],LPC_SHIFT)),32767));
-      nyi = NEG16(yi);
-      for (j=0;j<ord-1;j++)
-      {
-         mem[j] = MAC16_16(mem[j+1],den[j],nyi);
-      }
-      mem[ord-1] = MULT16_16(den[ord-1],nyi);
-      y[i] = yi;
-   }
-}
-#endif
-
-#ifndef OVERRIDE_FIR_MEM16
-void fir_mem16(const spx_word16_t *x, const spx_coef_t *num, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack)
-{
-   int i,j;
-   spx_word16_t xi,yi;
-
-   for (i=0;i<N;i++)
-   {
-      xi=x[i];
-      yi = EXTRACT16(SATURATE(ADD32(EXTEND32(x[i]),PSHR32(mem[0],LPC_SHIFT)),32767));
-      for (j=0;j<ord-1;j++)
-      {
-         mem[j] = MAC16_16(mem[j+1], num[j],xi);
-      }
-      mem[ord-1] = MULT16_16(num[ord-1],xi);
-      y[i] = yi;
-   }
-}
-#endif
-
-
-void syn_percep_zero16(const spx_word16_t *xx, const spx_coef_t *ak, const spx_coef_t *awk1, const spx_coef_t *awk2, spx_word16_t *y, int N, int ord, char *stack)
-{
-   int i;
-   VARDECL(spx_mem_t *mem);
-   ALLOC(mem, ord, spx_mem_t);
-   for (i=0;i<ord;i++)
-      mem[i]=0;
-   iir_mem16(xx, ak, y, N, ord, mem, stack);
-   for (i=0;i<ord;i++)
-      mem[i]=0;
-   filter_mem16(y, awk1, awk2, y, N, ord, mem, stack);
-}
-void residue_percep_zero16(const spx_word16_t *xx, const spx_coef_t *ak, const spx_coef_t *awk1, const spx_coef_t *awk2, spx_word16_t *y, int N, int ord, char *stack)
-{
-   int i;
-   VARDECL(spx_mem_t *mem);
-   ALLOC(mem, ord, spx_mem_t);
-   for (i=0;i<ord;i++)
-      mem[i]=0;
-   filter_mem16(xx, ak, awk1, y, N, ord, mem, stack);
-   for (i=0;i<ord;i++)
-      mem[i]=0;
-   fir_mem16(y, awk2, y, N, ord, mem, stack);
-}
-
-
-#ifndef OVERRIDE_COMPUTE_IMPULSE_RESPONSE
-void compute_impulse_response(const spx_coef_t *ak, const spx_coef_t *awk1, const spx_coef_t *awk2, spx_word16_t *y, int N, int ord, char *stack)
-{
-   int i,j;
-   spx_word16_t y1, ny1i, ny2i;
-   VARDECL(spx_mem_t *mem1);
-   VARDECL(spx_mem_t *mem2);
-   ALLOC(mem1, ord, spx_mem_t);
-   ALLOC(mem2, ord, spx_mem_t);
-   
-   y[0] = LPC_SCALING;
-   for (i=0;i<ord;i++)
-      y[i+1] = awk1[i];
-   i++;
-   for (;i<N;i++)
-      y[i] = VERY_SMALL;
-   for (i=0;i<ord;i++)
-      mem1[i] = mem2[i] = 0;
-   for (i=0;i<N;i++)
-   {
-      y1 = ADD16(y[i], EXTRACT16(PSHR32(mem1[0],LPC_SHIFT)));
-      ny1i = NEG16(y1);
-      y[i] = PSHR32(ADD32(SHL32(EXTEND32(y1),LPC_SHIFT+1),mem2[0]),LPC_SHIFT);
-      ny2i = NEG16(y[i]);
-      for (j=0;j<ord-1;j++)
-      {
-         mem1[j] = MAC16_16(mem1[j+1], awk2[j],ny1i);
-         mem2[j] = MAC16_16(mem2[j+1], ak[j],ny2i);
-      }
-      mem1[ord-1] = MULT16_16(awk2[ord-1],ny1i);
-      mem2[ord-1] = MULT16_16(ak[ord-1],ny2i);
-   }
-}
-#endif
-
-/* Decomposes a signal into low-band and high-band using a QMF */
-void qmf_decomp(const spx_word16_t *xx, const spx_word16_t *aa, spx_word16_t *y1, spx_word16_t *y2, int N, int M, spx_word16_t *mem, char *stack)
-{
-   int i,j,k,M2;
-   VARDECL(spx_word16_t *a);
-   VARDECL(spx_word16_t *x);
-   spx_word16_t *x2;
-   
-   ALLOC(a, M, spx_word16_t);
-   ALLOC(x, N+M-1, spx_word16_t);
-   x2=x+M-1;
-   M2=M>>1;
-   for (i=0;i<M;i++)
-      a[M-i-1]= aa[i];
-   for (i=0;i<M-1;i++)
-      x[i]=mem[M-i-2];
-   for (i=0;i<N;i++)
-      x[i+M-1]=SHR16(xx[i],1);
-   for (i=0;i<M-1;i++)
-      mem[i]=SHR16(xx[N-i-1],1);
-   for (i=0,k=0;i<N;i+=2,k++)
-   {
-      spx_word32_t y1k=0, y2k=0;
-      for (j=0;j<M2;j++)
-      {
-         y1k=ADD32(y1k,MULT16_16(a[j],ADD16(x[i+j],x2[i-j])));
-         y2k=SUB32(y2k,MULT16_16(a[j],SUB16(x[i+j],x2[i-j])));
-         j++;
-         y1k=ADD32(y1k,MULT16_16(a[j],ADD16(x[i+j],x2[i-j])));
-         y2k=ADD32(y2k,MULT16_16(a[j],SUB16(x[i+j],x2[i-j])));
-      }
-      y1[k] = EXTRACT16(SATURATE(PSHR32(y1k,15),32767));
-      y2[k] = EXTRACT16(SATURATE(PSHR32(y2k,15),32767));
-   }
-}
-
-/* Re-synthesised a signal from the QMF low-band and high-band signals */
-void qmf_synth(const spx_word16_t *x1, const spx_word16_t *x2, const spx_word16_t *a, spx_word16_t *y, int N, int M, spx_word16_t *mem1, spx_word16_t *mem2, char *stack)
-   /* assumptions:
-      all odd x[i] are zero -- well, actually they are left out of the array now
-      N and M are multiples of 4 */
-{
-   int i, j;
-   int M2, N2;
-   VARDECL(spx_word16_t *xx1);
-   VARDECL(spx_word16_t *xx2);
-   
-   M2 = M>>1;
-   N2 = N>>1;
-   ALLOC(xx1, M2+N2, spx_word16_t);
-   ALLOC(xx2, M2+N2, spx_word16_t);
-
-   for (i = 0; i < N2; i++)
-      xx1[i] = x1[N2-1-i];
-   for (i = 0; i < M2; i++)
-      xx1[N2+i] = mem1[2*i+1];
-   for (i = 0; i < N2; i++)
-      xx2[i] = x2[N2-1-i];
-   for (i = 0; i < M2; i++)
-      xx2[N2+i] = mem2[2*i+1];
-
-   for (i = 0; i < N2; i += 2) {
-      spx_sig_t y0, y1, y2, y3;
-      spx_word16_t x10, x20;
-
-      y0 = y1 = y2 = y3 = 0;
-      x10 = xx1[N2-2-i];
-      x20 = xx2[N2-2-i];
-
-      for (j = 0; j < M2; j += 2) {
-         spx_word16_t x11, x21;
-         spx_word16_t a0, a1;
-
-         a0 = a[2*j];
-         a1 = a[2*j+1];
-         x11 = xx1[N2-1+j-i];
-         x21 = xx2[N2-1+j-i];
-
-#ifdef FIXED_POINT
-         /* We multiply twice by the same coef to avoid overflows */
-         y0 = MAC16_16(MAC16_16(y0, a0, x11), NEG16(a0), x21);
-         y1 = MAC16_16(MAC16_16(y1, a1, x11), a1, x21);
-         y2 = MAC16_16(MAC16_16(y2, a0, x10), NEG16(a0), x20);
-         y3 = MAC16_16(MAC16_16(y3, a1, x10), a1, x20);
-#else
-         y0 = ADD32(y0,MULT16_16(a0, x11-x21));
-         y1 = ADD32(y1,MULT16_16(a1, x11+x21));
-         y2 = ADD32(y2,MULT16_16(a0, x10-x20));
-         y3 = ADD32(y3,MULT16_16(a1, x10+x20));
-#endif
-         a0 = a[2*j+2];
-         a1 = a[2*j+3];
-         x10 = xx1[N2+j-i];
-         x20 = xx2[N2+j-i];
-
-#ifdef FIXED_POINT
-         /* We multiply twice by the same coef to avoid overflows */
-         y0 = MAC16_16(MAC16_16(y0, a0, x10), NEG16(a0), x20);
-         y1 = MAC16_16(MAC16_16(y1, a1, x10), a1, x20);
-         y2 = MAC16_16(MAC16_16(y2, a0, x11), NEG16(a0), x21);
-         y3 = MAC16_16(MAC16_16(y3, a1, x11), a1, x21);
-#else
-         y0 = ADD32(y0,MULT16_16(a0, x10-x20));
-         y1 = ADD32(y1,MULT16_16(a1, x10+x20));
-         y2 = ADD32(y2,MULT16_16(a0, x11-x21));
-         y3 = ADD32(y3,MULT16_16(a1, x11+x21));
-#endif
-      }
-#ifdef FIXED_POINT
-      y[2*i] = EXTRACT16(SATURATE32(PSHR32(y0,15),32767));
-      y[2*i+1] = EXTRACT16(SATURATE32(PSHR32(y1,15),32767));
-      y[2*i+2] = EXTRACT16(SATURATE32(PSHR32(y2,15),32767));
-      y[2*i+3] = EXTRACT16(SATURATE32(PSHR32(y3,15),32767));
-#else
-      /* Normalize up explicitly if we're in float */
-      y[2*i] = 2.f*y0;
-      y[2*i+1] = 2.f*y1;
-      y[2*i+2] = 2.f*y2;
-      y[2*i+3] = 2.f*y3;
-#endif
-   }
-
-   for (i = 0; i < M2; i++)
-      mem1[2*i+1] = xx1[i];
-   for (i = 0; i < M2; i++)
-      mem2[2*i+1] = xx2[i];
-}
-
-#ifdef FIXED_POINT
-#if 0
-const spx_word16_t shift_filt[3][7] = {{-33,    1043,   -4551,   19959,   19959,   -4551,    1043},
-                                 {-98,    1133,   -4425,   29179,    8895,   -2328,     444},
-                                 {444,   -2328,    8895,   29179,   -4425,    1133,     -98}};
-#else
-const spx_word16_t shift_filt[3][7] = {{-390,    1540,   -4993,   20123,   20123,   -4993,    1540},
-                                {-1064,    2817,   -6694,   31589,    6837,    -990,    -209},
-                                 {-209,    -990,    6837,   31589,   -6694,    2817,   -1064}};
-#endif
-#else
-#if 0
-const float shift_filt[3][7] = {{-9.9369e-04, 3.1831e-02, -1.3889e-01, 6.0910e-01, 6.0910e-01, -1.3889e-01, 3.1831e-02},
-                          {-0.0029937, 0.0345613, -0.1350474, 0.8904793, 0.2714479, -0.0710304, 0.0135403},
-                          {0.0135403, -0.0710304, 0.2714479, 0.8904793, -0.1350474, 0.0345613,  -0.0029937}};
-#else
-const float shift_filt[3][7] = {{-0.011915f, 0.046995f, -0.152373f, 0.614108f, 0.614108f, -0.152373f, 0.046995f},
-                          {-0.0324855f, 0.0859768f, -0.2042986f, 0.9640297f, 0.2086420f, -0.0302054f, -0.0063646f},
-                          {-0.0063646f, -0.0302054f, 0.2086420f, 0.9640297f, -0.2042986f, 0.0859768f, -0.0324855f}};
-#endif
-#endif
-
-int interp_pitch(
-spx_word16_t *exc,          /*decoded excitation*/
-spx_word16_t *interp,          /*decoded excitation*/
-int pitch,               /*pitch period*/
-int len
-)
-{
-   int i,j,k;
-   spx_word32_t corr[4][7];
-   spx_word32_t maxcorr;
-   int maxi, maxj;
-   for (i=0;i<7;i++)
-   {
-      corr[0][i] = inner_prod(exc, exc-pitch-3+i, len);
-   }
-   for (i=0;i<3;i++)
-   {
-      for (j=0;j<7;j++)
-      {
-         int i1, i2;
-         spx_word32_t tmp=0;
-         i1 = 3-j;
-         if (i1<0)
-            i1 = 0;
-         i2 = 10-j;
-         if (i2>7)
-            i2 = 7;
-         for (k=i1;k<i2;k++)
-            tmp += MULT16_32_Q15(shift_filt[i][k],corr[0][j+k-3]);
-         corr[i+1][j] = tmp;
-      }
-   }
-   maxi=maxj=0;
-   maxcorr = corr[0][0];
-   for (i=0;i<4;i++)
-   {
-      for (j=0;j<7;j++)
-      {
-         if (corr[i][j] > maxcorr)
-         {
-            maxcorr = corr[i][j];
-            maxi=i;
-            maxj=j;
-         }
-      }
-   }
-   for (i=0;i<len;i++)
-   {
-      spx_word32_t tmp = 0;
-      if (maxi>0)
-      {
-         for (k=0;k<7;k++)
-         {
-            tmp += MULT16_16(exc[i-(pitch-maxj+3)+k-3],shift_filt[maxi-1][k]);
-         }
-      } else {
-         tmp = SHL32(exc[i-(pitch-maxj+3)],15);
-      }
-      interp[i] = PSHR32(tmp,15);
-   }
-   return pitch-maxj+3;
-}
-
-void multicomb(
-spx_word16_t *exc,          /*decoded excitation*/
-spx_word16_t *new_exc,      /*enhanced excitation*/
-spx_coef_t *ak,           /*LPC filter coefs*/
-int p,               /*LPC order*/
-int nsf,             /*sub-frame size*/
-int pitch,           /*pitch period*/
-int max_pitch,
-spx_word16_t  comb_gain,    /*gain of comb filter*/
-char *stack
-)
-{
-   int i; 
-   VARDECL(spx_word16_t *iexc);
-   spx_word16_t old_ener, new_ener;
-   int corr_pitch;
-   
-   spx_word16_t iexc0_mag, iexc1_mag, exc_mag;
-   spx_word32_t corr0, corr1;
-   spx_word16_t gain0, gain1;
-   spx_word16_t pgain1, pgain2;
-   spx_word16_t c1, c2;
-   spx_word16_t g1, g2;
-   spx_word16_t ngain;
-   spx_word16_t gg1, gg2;
-#ifdef FIXED_POINT
-   int scaledown=0;
-#endif
-#if 0 /* Set to 1 to enable full pitch search */
-   int nol_pitch[6];
-   spx_word16_t nol_pitch_coef[6];
-   spx_word16_t ol_pitch_coef;
-   open_loop_nbest_pitch(exc, 20, 120, nsf, 
-                         nol_pitch, nol_pitch_coef, 6, stack);
-   corr_pitch=nol_pitch[0];
-   ol_pitch_coef = nol_pitch_coef[0];
-   /*Try to remove pitch multiples*/
-   for (i=1;i<6;i++)
-   {
-#ifdef FIXED_POINT
-      if ((nol_pitch_coef[i]>MULT16_16_Q15(nol_pitch_coef[0],19661)) && 
-#else
-      if ((nol_pitch_coef[i]>.6*nol_pitch_coef[0]) && 
-#endif
-         (ABS(2*nol_pitch[i]-corr_pitch)<=2 || ABS(3*nol_pitch[i]-corr_pitch)<=3 || 
-         ABS(4*nol_pitch[i]-corr_pitch)<=4 || ABS(5*nol_pitch[i]-corr_pitch)<=5))
-      {
-         corr_pitch = nol_pitch[i];
-      }
-   }
-#else
-   corr_pitch = pitch;
-#endif
-   
-   ALLOC(iexc, 2*nsf, spx_word16_t);
-   
-   interp_pitch(exc, iexc, corr_pitch, 80);
-   if (corr_pitch>max_pitch)
-      interp_pitch(exc, iexc+nsf, 2*corr_pitch, 80);
-   else
-      interp_pitch(exc, iexc+nsf, -corr_pitch, 80);
-
-#ifdef FIXED_POINT
-   for (i=0;i<nsf;i++)
-   {
-      if (ABS16(exc[i])>16383)
-      {
-         scaledown = 1;
-         break;
-      }
-   }
-   if (scaledown)
-   {
-      for (i=0;i<nsf;i++)
-         exc[i] = SHR16(exc[i],1);
-      for (i=0;i<2*nsf;i++)
-         iexc[i] = SHR16(iexc[i],1);
-   }
-#endif
-   /*interp_pitch(exc, iexc+2*nsf, 2*corr_pitch, 80);*/
-   
-   /*printf ("%d %d %f\n", pitch, corr_pitch, max_corr*ener_1);*/
-   iexc0_mag = spx_sqrt(1000+inner_prod(iexc,iexc,nsf));
-   iexc1_mag = spx_sqrt(1000+inner_prod(iexc+nsf,iexc+nsf,nsf));
-   exc_mag = spx_sqrt(1+inner_prod(exc,exc,nsf));
-   corr0  = inner_prod(iexc,exc,nsf);
-   if (corr0<0)
-      corr0=0;
-   corr1 = inner_prod(iexc+nsf,exc,nsf);
-   if (corr1<0)
-      corr1=0;
-#ifdef FIXED_POINT
-   /* Doesn't cost much to limit the ratio and it makes the rest easier */
-   if (SHL32(EXTEND32(iexc0_mag),6) < EXTEND32(exc_mag))
-      iexc0_mag = ADD16(1,PSHR16(exc_mag,6));
-   if (SHL32(EXTEND32(iexc1_mag),6) < EXTEND32(exc_mag))
-      iexc1_mag = ADD16(1,PSHR16(exc_mag,6));
-#endif
-   if (corr0 > MULT16_16(iexc0_mag,exc_mag))
-      pgain1 = QCONST16(1., 14);
-   else
-      pgain1 = PDIV32_16(SHL32(PDIV32(corr0, exc_mag),14),iexc0_mag);
-   if (corr1 > MULT16_16(iexc1_mag,exc_mag))
-      pgain2 = QCONST16(1., 14);
-   else
-      pgain2 = PDIV32_16(SHL32(PDIV32(corr1, exc_mag),14),iexc1_mag);
-   gg1 = PDIV32_16(SHL32(EXTEND32(exc_mag),8), iexc0_mag);
-   gg2 = PDIV32_16(SHL32(EXTEND32(exc_mag),8), iexc1_mag);
-   if (comb_gain>0)
-   {
-#ifdef FIXED_POINT
-      c1 = (MULT16_16_Q15(QCONST16(.4,15),comb_gain)+QCONST16(.07,15));
-      c2 = QCONST16(.5,15)+MULT16_16_Q14(QCONST16(1.72,14),(c1-QCONST16(.07,15)));
-#else
-      c1 = .4*comb_gain+.07;
-      c2 = .5+1.72*(c1-.07);
-#endif
-   } else 
-   {
-      c1=c2=0;
-   }
-#ifdef FIXED_POINT
-   g1 = 32767 - MULT16_16_Q13(MULT16_16_Q15(c2, pgain1),pgain1);
-   g2 = 32767 - MULT16_16_Q13(MULT16_16_Q15(c2, pgain2),pgain2);
-#else
-   g1 = 1-c2*pgain1*pgain1;
-   g2 = 1-c2*pgain2*pgain2;
-#endif
-   if (g1<c1)
-      g1 = c1;
-   if (g2<c1)
-      g2 = c1;
-   g1 = (spx_word16_t)PDIV32_16(SHL32(EXTEND32(c1),14),(spx_word16_t)g1);
-   g2 = (spx_word16_t)PDIV32_16(SHL32(EXTEND32(c1),14),(spx_word16_t)g2);
-   if (corr_pitch>max_pitch)
-   {
-      gain0 = MULT16_16_Q15(QCONST16(.7,15),MULT16_16_Q14(g1,gg1));
-      gain1 = MULT16_16_Q15(QCONST16(.3,15),MULT16_16_Q14(g2,gg2));
-   } else {
-      gain0 = MULT16_16_Q15(QCONST16(.6,15),MULT16_16_Q14(g1,gg1));
-      gain1 = MULT16_16_Q15(QCONST16(.6,15),MULT16_16_Q14(g2,gg2));
-   }
-   for (i=0;i<nsf;i++)
-      new_exc[i] = ADD16(exc[i], EXTRACT16(PSHR32(ADD32(MULT16_16(gain0,iexc[i]), MULT16_16(gain1,iexc[i+nsf])),8)));
-   /* FIXME: compute_rms16 is currently not quite accurate enough (but close) */
-   new_ener = compute_rms16(new_exc, nsf);
-   old_ener = compute_rms16(exc, nsf);
-   
-   if (old_ener < 1)
-      old_ener = 1;
-   if (new_ener < 1)
-      new_ener = 1;
-   if (old_ener > new_ener)
-      old_ener = new_ener;
-   ngain = PDIV32_16(SHL32(EXTEND32(old_ener),14),new_ener);
-   
-   for (i=0;i<nsf;i++)
-      new_exc[i] = MULT16_16_Q14(ngain, new_exc[i]);
-#ifdef FIXED_POINT
-   if (scaledown)
-   {
-      for (i=0;i<nsf;i++)
-         exc[i] = SHL16(exc[i],1);
-      for (i=0;i<nsf;i++)
-         new_exc[i] = SHL16(SATURATE16(new_exc[i],16383),1);
-   }
-#endif
-}
-
diff --git a/libspeex/filters.h b/libspeex/filters.h
deleted file mode 100644
index e3a5980..0000000
--- a/libspeex/filters.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin */
-/**
-   @file filters.h
-   @brief Various analysis/synthesis filters
-*/
-/*
-   Redistribution and use in source and binary forms, with or without
-   modification, 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 the Xiph.org Foundation nor the names of its
-   contributors may be used to endorse or promote products derived from
-   this software without specific prior written permission.
-   
-   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 FOUNDATION OR
-   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef FILTERS_H
-#define FILTERS_H
-
-#include "arch.h"
-
-spx_word16_t compute_rms(const spx_sig_t *x, int len);
-spx_word16_t compute_rms16(const spx_word16_t *x, int len);
-void signal_mul(const spx_sig_t *x, spx_sig_t *y, spx_word32_t scale, int len);
-void signal_div(const spx_word16_t *x, spx_word16_t *y, spx_word32_t scale, int len);
-
-#ifdef FIXED_POINT
-
-int normalize16(const spx_sig_t *x, spx_word16_t *y, spx_sig_t max_scale, int len);
-
-#endif
-
-
-#define HIGHPASS_NARROWBAND 0
-#define HIGHPASS_WIDEBAND 2
-#define HIGHPASS_INPUT 0
-#define HIGHPASS_OUTPUT 1
-#define HIGHPASS_IRS 4
-
-void highpass(const spx_word16_t *x, spx_word16_t *y, int len, int filtID, spx_mem_t *mem);
-
-
-void qmf_decomp(const spx_word16_t *xx, const spx_word16_t *aa, spx_word16_t *, spx_word16_t *y2, int N, int M, spx_word16_t *mem, char *stack);
-void qmf_synth(const spx_word16_t *x1, const spx_word16_t *x2, const spx_word16_t *a, spx_word16_t *y, int N, int M, spx_word16_t *mem1, spx_word16_t *mem2, char *stack);
-
-void filter_mem16(const spx_word16_t *x, const spx_coef_t *num, const spx_coef_t *den, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack);
-void iir_mem16(const spx_word16_t *x, const spx_coef_t *den, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack);
-void fir_mem16(const spx_word16_t *x, const spx_coef_t *num, spx_word16_t *y, int N, int ord, spx_mem_t *mem, char *stack);
-
-/* Apply bandwidth expansion on LPC coef */
-void bw_lpc(spx_word16_t , const spx_coef_t *lpc_in, spx_coef_t *lpc_out, int order);
-void sanitize_values32(spx_word32_t *vec, spx_word32_t min_val, spx_word32_t max_val, int len);
-
-
-void syn_percep_zero16(const spx_word16_t *xx, const spx_coef_t *ak, const spx_coef_t *awk1, const spx_coef_t *awk2, spx_word16_t *y, int N, int ord, char *stack);
-void residue_percep_zero16(const spx_word16_t *xx, const spx_coef_t *ak, const spx_coef_t *awk1, const spx_coef_t *awk2, spx_word16_t *y, int N, int ord, char *stack);
-
-void compute_impulse_response(const spx_coef_t *ak, const spx_coef_t *awk1, const spx_coef_t *awk2, spx_word16_t *y, int N, int ord, char *stack);
-
-void multicomb(
-spx_word16_t *exc,          /*decoded excitation*/
-spx_word16_t *new_exc,      /*enhanced excitation*/
-spx_coef_t *ak,           /*LPC filter coefs*/
-int p,               /*LPC order*/
-int nsf,             /*sub-frame size*/
-int pitch,           /*pitch period*/
-int max_pitch,   /*pitch gain (3-tap)*/
-spx_word16_t  comb_gain,    /*gain of comb filter*/
-char *stack
-);
-
-#endif
diff --git a/libspeex/gain_table.c b/libspeex/gain_table.c
deleted file mode 100644
index 00b8244..0000000
--- a/libspeex/gain_table.c
+++ /dev/null
@@ -1,160 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin 
-   File: gain_table.c
-   Codebook for 3-tap pitch prediction gain (128 entries)
-  
-   Redistribution and use in source and binary forms, with or without
-   modification, are permitted provided that the following conditions are
-   met:
-
-   1. Redistributions of source code must retain the above copyright notice,
-   this list of conditions and the following disclaimer.  
-
-   2. 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.
-
-   3. The name of the author may not be used to endorse or promote products
-   derived from this software without specific prior written permission.
-
-   THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
-*/
-
-const signed char gain_cdbk_nb[512] = {
--32, -32, -32, 0,
--28, -67, -5, 33,
--42, -6, -32, 18,
--57, -10, -54, 35,
--16, 27, -41, 42,
-19, -19, -40, 36,
--45, 24, -21, 40,
--8, -14, -18, 28,
-1, 14, -58, 53,
--18, -88, -39, 39,
--38, 21, -18, 37,
--19, 20, -43, 38,
-10, 17, -48, 54,
--52, -58, -13, 33,
--44, -1, -11, 32,
--12, -11, -34, 22,
-14, 0, -46, 46,
--37, -35, -34, 5,
--25, 44, -30, 43,
-6, -4, -63, 49,
--31, 43, -41, 43,
--23, 30, -43, 41,
--43, 26, -14, 44,
--33, 1, -13, 27,
--13, 18, -37, 37,
--46, -73, -45, 34,
--36, 24, -25, 34,
--36, -11, -20, 19,
--25, 12, -18, 33,
--36, -69, -59, 34,
--45, 6, 8, 46,
--22, -14, -24, 18,
--1, 13, -44, 44,
--39, -48, -26, 15,
--32, 31, -37, 34,
--33, 15, -46, 31,
--24, 30, -36, 37,
--41, 31, -23, 41,
--50, 22, -4, 50,
--22, 2, -21, 28,
--17, 30, -34, 40,
--7, -60, -28, 29,
--38, 42, -28, 42,
--44, -11, 21, 43,
--16, 8, -44, 34,
--39, -55, -43, 21,
--11, -35, 26, 41,
--9, 0, -34, 29,
--8, 121, -81, 113,
-7, -16, -22, 33,
--37, 33, -31, 36,
--27, -7, -36, 17,
--34, 70, -57, 65,
--37, -11, -48, 21,
--40, 17, -1, 44,
--33, 6, -6, 33,
--9, 0, -20, 34,
--21, 69, -33, 57,
--29, 33, -31, 35,
--55, 12, -1, 49,
--33, 27, -22, 35,
--50, -33, -47, 17,
--50, 54, 51, 94,
--1, -5, -44, 35,
--4, 22, -40, 45,
--39, -66, -25, 24,
--33, 1, -26, 20,
--24, -23, -25, 12,
--11, 21, -45, 44,
--25, -45, -19, 17,
--43, 105, -16, 82,
-5, -21, 1, 41,
--16, 11, -33, 30,
--13, -99, -4, 57,
--37, 33, -15, 44,
--25, 37, -63, 54,
--36, 24, -31, 31,
--53, -56, -38, 26,
--41, -4, 4, 37,
--33, 13, -30, 24,
-49, 52, -94, 114,
--5, -30, -15, 23,
-1, 38, -40, 56,
--23, 12, -36, 29,
--17, 40, -47, 51,
--37, -41, -39, 11,
--49, 34, 0, 58,
--18, -7, -4, 34,
--16, 17, -27, 35,
-30, 5, -62, 65,
-4, 48, -68, 76,
--43, 11, -11, 38,
--18, 19, -15, 41,
--23, -62, -39, 23,
--42, 10, -2, 41,
--21, -13, -13, 25,
--9, 13, -47, 42,
--23, -62, -24, 24,
--44, 60, -21, 58,
--18, -3, -52, 32,
--22, 22, -36, 34,
--75, 57, 16, 90,
--19, 3, 10, 45,
--29, 23, -38, 32,
--5, -62, -51, 38,
--51, 40, -18, 53,
--42, 13, -24, 32,
--34, 14, -20, 30,
--56, -75, -26, 37,
--26, 32, 15, 59,
--26, 17, -29, 29,
--7, 28, -52, 53,
--12, -30, 5, 30,
--5, -48, -5, 35,
-2, 2, -43, 40,
-21, 16, 16, 75,
--25, -45, -32, 10,
--43, 18, -10, 42,
-9, 0, -1, 52,
--1, 7, -30, 36,
-19, -48, -4, 48,
--28, 25, -29, 32,
--22, 0, -31, 22,
--32, 17, -10, 36,
--64, -41, -62, 36,
--52, 15, 16, 58,
--30, -22, -32, 6,
--7, 9, -38, 36};
diff --git a/libspeex/gain_table_lbr.c b/libspeex/gain_table_lbr.c
deleted file mode 100644
index 3c1c3db..0000000
--- a/libspeex/gain_table_lbr.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin 
-   File: gain_table_lbr.c
-   Codebook for 3-tap pitch prediction gain (32 entries)
-  
-   Redistribution and use in source and binary forms, with or without
-   modification, are permitted provided that the following conditions are
-   met:
-
-   1. Redistributions of source code must retain the above copyright notice,
-   this list of conditions and the following disclaimer.  
-
-   2. 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.
-
-   3. The name of the author may not be used to endorse or promote products
-   derived from this software without specific prior written permission.
-
-   THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
-*/
-
-const signed char gain_cdbk_lbr[128] = {
--32, -32, -32, 0,
--31, -58, -16, 22,
--41, -24, -43, 14,
--56, -22, -55, 29,
--13, 33, -41, 47,
--4, -39, -9, 29,
--41, 15, -12, 38,
--8, -15, -12, 31,
-1, 2, -44, 40,
--22, -66, -42, 27,
--38, 28, -23, 38,
--21, 14, -37, 31,
-0, 21, -50, 52,
--53, -71, -27, 33,
--37, -1, -19, 25,
--19, -5, -28, 22,
-6, 65, -44, 74,
--33, -48, -33, 9,
--40, 57, -14, 58,
--17, 4, -45, 32,
--31, 38, -33, 36,
--23, 28, -40, 39,
--43, 29, -12, 46,
--34, 13, -23, 28,
--16, 15, -27, 34,
--14, -82, -15, 43,
--31, 25, -32, 29,
--21, 5, -5, 38,
--47, -63, -51, 33,
--46, 12, 3, 47,
--28, -17, -29, 11,
--10, 14, -40, 38};
diff --git a/libspeex/hexc_10_32_table.c b/libspeex/hexc_10_32_table.c
deleted file mode 100644
index 8dd408f..0000000
--- a/libspeex/hexc_10_32_table.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin 
-   File: hexc_10_32_table.c
-   Codebook for high-band excitation in SB-CELP mode (4000 bps)
-
-   Redistribution and use in source and binary forms, with or without
-   modification, 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 the Xiph.org Foundation nor the names of its
-   contributors may be used to endorse or promote products derived from
-   this software without specific prior written permission.
-   
-   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 FOUNDATION 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.
-*/
-
-const signed char hexc_10_32_table[320] = {
--3, -2, -1, 0, -4, 5, 35, -40, -9, 13, 
--44, 5, -27, -1, -7, 6, -11, 7, -8, 7, 
-19, -14, 15, -4, 9, -10, 10, -8, 10, -9, 
--1, 1, 0, 0, 2, 5, -18, 22, -53, 50, 
-1, -23, 50, -36, 15, 3, -13, 14, -10, 6, 
-1, 5, -3, 4, -2, 5, -32, 25, 5, -2, 
--1, -4, 1, 11, -29, 26, -6, -15, 30, -18, 
-0, 15, -17, 40, -41, 3, 9, -2, -2, 3, 
--3, -1, -5, 2, 21, -6, -16, -21, 23, 2, 
-60, 15, 16, -16, -9, 14, 9, -1, 7, -9, 
-0, 1, 1, 0, -1, -6, 17, -28, 54, -45, 
--1, 1, -1, -6, -6, 2, 11, 26, -29, -2, 
-46, -21, 34, 12, -23, 32, -23, 16, -10, 3, 
-66, 19, -20, 24, 7, 11, -3, 0, -3, -1, 
--50, -46, 2, -18, -3, 4, -1, -2, 3, -3, 
--19, 41, -36, 9, 11, -24, 21, -16, 9, -3, 
--25, -3, 10, 18, -9, -2, -5, -1, -5, 6, 
--4, -3, 2, -26, 21, -19, 35, -15, 7, -13, 
-17, -19, 39, -43, 48, -31, 16, -9, 7, -2, 
--5, 3, -4, 9, -19, 27, -55, 63, -35, 10, 
-26, -44, -2, 9, 4, 1, -6, 8, -9, 5, 
--8, -1, -3, -16, 45, -42, 5, 15, -16, 10, 
-0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
--16, 24, -55, 47, -38, 27, -19, 7, -3, 1, 
-16, 27, 20, -19, 18, 5, -7, 1, -5, 2, 
--6, 8, -22, 0, -3, -3, 8, -1, 7, -8, 
-1, -3, 5, 0, 17, -48, 58, -52, 29, -7, 
--2, 3, -10, 6, -26, 58, -31, 1, -6, 3, 
-93, -29, 39, 3, 17, 5, 6, -1, -1, -1, 
-27, 13, 10, 19, -7, -34, 12, 10, -4, 9, 
--76, 9, 8, -28, -2, -11, 2, -1, 3, 1, 
--83, 38, -39, 4, -16, -6, -2, -5, 5, -2, 
-};
diff --git a/libspeex/hexc_table.c b/libspeex/hexc_table.c
deleted file mode 100644
index 268408a..0000000
--- a/libspeex/hexc_table.c
+++ /dev/null
@@ -1,162 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin 
-   File: hexc_table.c
-   Codebook for high-band excitation in SB-CELP mode (8000 bps with sign)
-
-   Redistribution and use in source and binary forms, with or without
-   modification, 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 the Xiph.org Foundation nor the names of its
-   contributors may be used to endorse or promote products derived from
-   this software without specific prior written permission.
-   
-   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 FOUNDATION 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.
-*/
-
-const signed char hexc_table[1024] = {
--24, 21, -20, 5, -5, -7, 14, -10, 
-2, -27, 16, -20, 0, -32, 26, 19, 
-8, -11, -41, 31, 28, -27, -32, 34, 
-42, 34, -17, 22, -10, 13, -29, 18, 
--12, -26, -24, 11, 22, 5, -5, -5, 
-54, -68, -43, 57, -25, 24, 4, 4, 
-26, -8, -12, -17, 54, 30, -45, 1, 
-10, -15, 18, -41, 11, 68, -67, 37, 
--16, -24, -16, 38, -22, 6, -29, 30, 
-66, -27, 5, 7, -16, 13, 2, -12, 
--7, -3, -20, 36, 4, -28, 9, 3, 
-32, 48, 26, 39, 3, 0, 7, -21, 
--13, 5, -82, -7, 73, -20, 34, -9, 
--5, 1, -1, 10, -5, -10, -1, 9, 
-1, -9, 10, 0, -14, 11, -1, -2, 
--1, 11, 20, 96, -81, -22, -12, -9, 
--58, 9, 24, -30, 26, -35, 27, -12, 
-13, -18, 56, -59, 15, -7, 23, -15, 
--1, 6, -25, 14, -22, -20, 47, -11, 
-16, 2, 38, -23, -19, -30, -9, 40, 
--11, 5, 4, -6, 8, 26, -21, -11, 
-127, 4, 1, 6, -9, 2, -7, -2, 
--3, 7, -5, 10, -19, 7, -106, 91, 
--3, 9, -4, 21, -8, 26, -80, 8, 
-1, -2, -10, -17, -17, -27, 32, 71, 
-6, -29, 11, -23, 54, -38, 29, -22, 
-39, 87, -31, -12, -20, 3, -2, -2, 
-2, 20, 0, -1, -35, 27, 9, -6, 
--12, 3, -12, -6, 13, 1, 14, -22, 
--59, -15, -17, -25, 13, -7, 7, 3, 
-0, 1, -7, 6, -3, 61, -37, -23, 
--23, -29, 38, -31, 27, 1, -8, 2, 
--27, 23, -26, 36, -34, 5, 24, -24, 
--6, 7, 3, -59, 78, -62, 44, -16, 
-1, 6, 0, 17, 8, 45, 0, -110, 
-6, 14, -2, 32, -77, -56, 62, -3, 
-3, -13, 4, -16, 102, -15, -36, -1, 
-9, -113, 6, 23, 0, 9, 9, 5, 
--8, -1, -14, 5, -12, 121, -53, -27, 
--8, -9, 22, -13, 3, 2, -3, 1, 
--2, -71, 95, 38, -19, 15, -16, -5, 
-71, 10, 2, -32, -13, -5, 15, -1, 
--2, -14, -85, 30, 29, 6, 3, 2, 
-0, 0, 0, 0, 0, 0, 0, 0, 
-2, -65, -56, -9, 18, 18, 23, -14, 
--2, 0, 12, -29, 26, -12, 1, 2, 
--12, -64, 90, -6, 4, 1, 5, -5, 
--110, -3, -31, 22, -29, 9, 0, 8, 
--40, -5, 21, -5, -5, 13, 10, -18, 
-40, 1, 35, -20, 30, -28, 11, -6, 
-19, 7, 14, 18, -64, 9, -6, 16, 
-51, 68, 8, 16, 12, -8, 0, -9, 
-20, -22, 25, 7, -4, -13, 41, -35, 
-93, -18, -54, 11, -1, 1, -9, 4, 
--66, 66, -31, 20, -22, 25, -23, 11, 
-10, 9, 19, 15, 11, -5, -31, -10, 
--23, -28, -6, -6, -3, -4, 5, 3, 
--28, 22, -11, -42, 25, -25, -16, 41, 
-34, 47, -6, 2, 42, -19, -22, 5, 
--39, 32, 6, -35, 22, 17, -30, 8, 
--26, -11, -11, 3, -12, 33, 33, -37, 
-21, -1, 6, -4, 3, 0, -5, 5, 
-12, -12, 57, 27, -61, -3, 20, -17, 
-2, 0, 4, 0, -2, -33, -58, 81, 
--23, 39, -10, -5, 2, 6, -7, 5, 
-4, -3, -2, -13, -23, -72, 107, 15, 
--5, 0, -7, -3, -6, 5, -4, 15, 
-47, 12, -31, 25, -16, 8, 22, -25, 
--62, -56, -18, 14, 28, 12, 2, -11, 
-74, -66, 41, -20, -7, 16, -20, 16, 
--8, 0, -16, 4, -19, 92, 12, -59, 
--14, -39, 49, -25, -16, 23, -27, 19, 
--3, -33, 19, 85, -29, 6, -7, -10, 
-16, -7, -12, 1, -6, 2, 4, -2, 
-64, 10, -25, 41, -2, -31, 15, 0, 
-110, 50, 69, 35, 28, 19, -10, 2, 
--43, -49, -56, -15, -16, 10, 3, 12, 
--1, -8, 1, 26, -12, -1, 7, -11, 
--27, 41, 25, 1, -11, -18, 22, -7, 
--1, -47, -8, 23, -3, -17, -7, 18, 
--125, 59, -5, 3, 18, 1, 2, 3, 
-27, -35, 65, -53, 50, -46, 37, -21, 
--28, 7, 14, -37, -5, -5, 12, 5, 
--8, 78, -19, 21, -6, -16, 8, -7, 
-5, 2, 7, 2, 10, -6, 12, -60, 
-44, 11, -36, -32, 31, 0, 2, -2, 
-2, 1, -3, 7, -10, 17, -21, 10, 
-6, -2, 19, -2, 59, -38, -86, 38, 
-8, -41, -30, -45, -33, 7, 15, 28, 
-29, -7, 24, -40, 7, 7, 5, -2, 
-9, 24, -23, -18, 6, -29, 30, 2, 
-28, 49, -11, -46, 10, 43, -13, -9, 
--1, -3, -7, -7, -17, -6, 97, -33, 
--21, 3, 5, 1, 12, -43, -8, 28, 
-7, -43, -7, 17, -20, 19, -1, 2, 
--13, 9, 54, 34, 9, -28, -11, -9, 
--17, 110, -59, 44, -26, 0, 3, -12, 
--47, 73, -34, -43, 38, -33, 16, -5, 
--46, -4, -6, -2, -25, 19, -29, 28, 
--13, 5, 14, 27, -40, -43, 4, 32, 
--13, -2, -35, -4, 112, -42, 9, -12, 
-37, -28, 17, 14, -19, 35, -39, 23, 
-3, -14, -1, -57, -5, 94, -9, 3, 
--39, 5, 30, -10, -32, 42, -13, -14, 
--97, -63, 30, -9, 1, -7, 12, 5, 
-20, 17, -9, -36, -30, 25, 47, -9, 
--15, 12, -22, 98, -8, -50, 15, -27, 
-21, -16, -11, 2, 12, -10, 10, -3, 
-33, 36, -96, 0, -17, 31, -9, 9, 
-3, -20, 13, -11, 8, -4, 10, -10, 
-9, 1, 112, -70, -27, 5, -21, 2, 
--57, -3, -29, 10, 19, -21, 21, -10, 
--66, -3, 91, -35, 30, -12, 0, -7, 
-59, -28, 26, 2, 14, -18, 1, 1, 
-11, 17, 20, -54, -59, 27, 4, 29, 
-32, 5, 19, 12, -4, 1, 7, -10, 
-5, -2, 10, 0, 23, -5, 28, -104, 
-46, 11, 16, 3, 29, 1, -8, -14, 
-1, 7, -50, 88, -62, 26, 8, -17, 
--14, 50, 0, 32, -12, -3, -27, 18, 
--8, -5, 8, 3, -20, -11, 37, -12, 
-9, 33, 46, -101, -1, -4, 1, 6, 
--1, 28, -42, -15, 16, 5, -1, -2, 
--55, 85, 38, -9, -4, 11, -2, -9, 
--6, 3, -20, -10, -77, 89, 24, -3, 
--104, -57, -26, -31, -20, -6, -9, 14, 
-20, -23, 46, -15, -31, 28, 1, -15, 
--2, 6, -2, 31, 45, -76, 23, -25, 
-};
diff --git a/libspeex/high_lsp_tables.c b/libspeex/high_lsp_tables.c
deleted file mode 100644
index e82e875..0000000
--- a/libspeex/high_lsp_tables.c
+++ /dev/null
@@ -1,163 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin 
-   File: high_lsp_tables.c
-   Codebooks for high-band LSPs in SB-CELP mode
-  
-   Redistribution and use in source and binary forms, with or without
-   modification, are permitted provided that the following conditions are
-   met:
-
-   1. Redistributions of source code must retain the above copyright notice,
-   this list of conditions and the following disclaimer.  
-
-   2. 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.
-
-   3. The name of the author may not be used to endorse or promote products
-   derived from this software without specific prior written permission.
-
-   THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
-*/
- 
-const signed char high_lsp_cdbk[512]={
-39,12,-14,-20,-29,-61,-67,-76,
--32,-71,-67,68,77,46,34,5,
--13,-48,-46,-72,-81,-84,-60,-58,
--40,-28,82,93,68,45,29,3,
--19,-47,-28,-43,-35,-30,-8,-13,
--39,-91,-91,-123,-96,10,10,-6,
--18,-55,-60,-91,-56,-36,-27,-16,
--48,-75,40,28,-10,-28,35,9,
-37,19,1,-20,-31,-41,-18,-25,
--35,-68,-80,45,27,-1,47,13,
-0,-29,-35,-57,-50,-79,-73,-38,
--19,5,35,14,-10,-23,16,-8,
-5,-24,-40,-62,-23,-27,-22,-16,
--18,-46,-72,-77,43,21,33,1,
--80,-70,-70,-64,-56,-52,-39,-33,
--31,-38,-19,-19,-15,32,33,-2,
-7,-15,-15,-24,-23,-33,-41,-56,
--24,-57,5,89,64,41,27,5,
--9,-47,-60,-97,-97,-124,-20,-9,
--44,-73,31,29,-4,64,48,7,
--35,-57,0,-3,-26,-47,-3,-6,
--40,-76,-79,-48,12,81,55,10,
-9,-24,-43,-73,-57,-69,16,5,
--28,-53,18,29,20,0,-4,-11,
-6,-13,23,7,-17,-35,-37,-37,
--30,-68,-63,6,24,-9,-14,3,
-21,-13,-27,-57,-49,-80,-24,-41,
--5,-16,-5,1,45,25,12,-7,
-3,-15,-6,-16,-15,-8,6,-13,
--42,-81,-80,-87,14,1,-10,-3,
--43,-69,-46,-24,-28,-29,36,6,
--43,-56,-12,12,54,79,43,9,
-54,22,2,8,-12,-43,-46,-52,
--38,-69,-89,-5,75,38,33,5,
--13,-53,-62,-87,-89,-113,-99,-55,
--34,-37,62,55,33,16,21,-2,
--17,-46,-29,-38,-38,-48,-39,-42,
--36,-75,-72,-88,-48,-30,21,2,
--15,-57,-64,-98,-84,-76,25,1,
--46,-80,-12,18,-7,3,34,6,
-38,31,23,4,-1,20,14,-15,
--43,-78,-91,-24,14,-3,54,16,
-0,-27,-28,-44,-56,-83,-92,-89,
--3,34,56,41,36,22,20,-8,
--7,-35,-42,-62,-49,3,12,-10,
--50,-87,-96,-66,92,70,38,9,
--70,-71,-62,-42,-39,-43,-11,-7,
--50,-79,-58,-50,-31,32,31,-6,
--4,-25,7,-17,-38,-70,-58,-27,
--43,-83,-28,59,36,20,31,2,
--27,-71,-80,-109,-98,-75,-33,-32,
--31,-2,33,15,-6,43,33,-5,
-0,-22,-10,-27,-34,-49,-11,-20,
--41,-91,-100,-121,-39,57,41,10,
--19,-50,-38,-59,-60,-70,-18,-20,
--8,-31,-8,-15,1,-14,-26,-25,
-33,21,32,17,1,-19,-19,-26,
--58,-81,-35,-22,45,30,11,-11,
-3,-26,-48,-87,-67,-83,-58,3,
--1,-26,-20,44,10,25,39,5,
--9,-35,-27,-38,7,10,4,-9,
--42,-85,-102,-127,52,44,28,10,
--47,-61,-40,-39,-17,-1,-10,-33,
--42,-74,-48,21,-4,70,52,10};
-
-
-const signed char high_lsp_cdbk2[512]={
--36,-62,6,-9,-10,-14,-56,23,
-1,-26,23,-48,-17,12,8,-7,
-23,29,-36,-28,-6,-29,-17,-5,
-40,23,10,10,-46,-13,36,6,
-4,-30,-29,62,32,-32,-1,22,
--14,1,-4,-22,-45,2,54,4,
--30,-57,-59,-12,27,-3,-31,8,
--9,5,10,-14,32,66,19,9,
-2,-25,-37,23,-15,18,-38,-31,
-5,-9,-21,15,0,22,62,30,
-15,-12,-14,-46,77,21,33,3,
-34,29,-19,50,2,11,9,-38,
--12,-37,62,1,-15,54,32,6,
-2,-24,20,35,-21,2,19,24,
--13,55,4,9,39,-19,30,-1,
--21,73,54,33,8,18,3,15,
-6,-19,-47,6,-3,-48,-50,1,
-26,20,8,-23,-50,65,-14,-55,
--17,-31,-37,-28,53,-1,-17,-53,
-1,57,11,-8,-25,-30,-37,64,
-5,-52,-45,15,23,31,15,14,
--25,24,33,-2,-44,-56,-18,6,
--21,-43,4,-12,17,-37,20,-10,
-34,15,2,15,55,21,-11,-31,
--6,46,25,16,-9,-25,-8,-62,
-28,17,20,-32,-29,26,30,25,
--19,2,-16,-17,26,-51,2,50,
-42,19,-66,23,29,-2,3,19,
--19,-37,32,15,6,30,-34,13,
-11,-5,40,31,10,-42,4,-9,
-26,-9,-70,17,-2,-23,20,-22,
--55,51,-24,-31,22,-22,15,-13,
-3,-10,-28,-16,56,4,-63,11,
--18,-15,-18,-38,-35,16,-7,34,
--1,-21,-49,-47,9,-37,7,8,
-69,55,20,6,-33,-45,-10,-9,
-6,-9,12,71,15,-3,-42,-7,
--24,32,-35,-2,-42,-17,-5,0,
--2,-33,-54,13,-12,-34,47,23,
-19,55,7,-8,74,31,14,16,
--23,-26,19,12,-18,-49,-28,-31,
--20,2,-14,-20,-47,78,40,13,
--23,-11,21,-6,18,1,47,5,
-38,35,32,46,22,8,13,16,
--14,18,51,19,40,39,11,-26,
--1,-17,47,2,-53,-15,31,-22,
-38,21,-15,-16,5,-33,53,15,
--38,86,11,-3,-24,49,13,-4,
--11,-18,28,20,-12,-27,-26,35,
--25,-35,-3,-20,-61,30,10,-55,
--12,-22,-52,-54,-14,19,-32,-12,
-45,15,-8,-48,-9,11,-32,8,
--16,-34,-13,51,18,38,-2,-32,
--17,22,-2,-18,-28,-70,59,27,
--28,-19,-10,-20,-9,-9,-8,-21,
-21,-8,35,-2,45,-3,-9,12,
-0,30,7,-39,43,27,-38,-91,
-30,26,19,-55,-4,63,14,-17,
-13,9,13,2,7,4,6,61,
-72,-1,-17,29,-1,-22,-17,8,
--28,-37,63,44,41,3,2,14,
-9,-6,75,-8,-7,-12,-15,-12,
-13,9,-4,30,-22,-65,15,0,
--45,4,-4,1,5,22,11,23};
diff --git a/libspeex/lpc.c b/libspeex/lpc.c
deleted file mode 100644
index fd5d382..0000000
--- a/libspeex/lpc.c
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
-  Copyright 1992, 1993, 1994 by Jutta Degener and Carsten Bormann,
-  Technische Universitaet Berlin
-
-  Any use of this software is permitted provided that this notice is not
-  removed and that neither the authors nor the Technische Universitaet Berlin
-  are deemed to have made any representations as to the suitability of this
-  software for any purpose nor are held responsible for any defects of
-  this software.  THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
-
-  As a matter of courtesy, the authors request to be informed about uses
-  this software has found, about bugs in this software, and about any
-  improvements that may be of general interest.
-
-  Berlin, 28.11.1994
-  Jutta Degener
-  Carsten Bormann
-
-
-   Code modified by Jean-Marc Valin
-
-   Speex License:
-
-   Redistribution and use in source and binary forms, with or without
-   modification, 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 the Xiph.org Foundation nor the names of its
-   contributors may be used to endorse or promote products derived from
-   this software without specific prior written permission.
-   
-   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 FOUNDATION 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.
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "lpc.h"
-
-#ifdef BFIN_ASM
-#include "lpc_bfin.h"
-#endif
-
-/* LPC analysis
- *
- * The next two functions calculate linear prediction coefficients
- * and/or the related reflection coefficients from the first P_MAX+1
- * values of the autocorrelation function.
- */
-
-/* Invented by N. Levinson in 1947, modified by J. Durbin in 1959.
- */
-
-/* returns minimum mean square error    */
-spx_word32_t _spx_lpc(
-spx_coef_t       *lpc, /* out: [0...p-1] LPC coefficients      */
-const spx_word16_t *ac,  /* in:  [0...p] autocorrelation values  */
-int          p
-)
-{
-   int i, j;  
-   spx_word16_t r;
-   spx_word16_t error = ac[0];
-
-   if (ac[0] == 0)
-   {
-      for (i = 0; i < p; i++)
-         lpc[i] = 0;
-      return 0;
-   }
-
-   for (i = 0; i < p; i++) {
-
-      /* Sum up this iteration's reflection coefficient */
-      spx_word32_t rr = NEG32(SHL32(EXTEND32(ac[i + 1]),13));
-      for (j = 0; j < i; j++) 
-         rr = SUB32(rr,MULT16_16(lpc[j],ac[i - j]));
-#ifdef FIXED_POINT
-      r = DIV32_16(rr+PSHR32(error,1),ADD16(error,8));
-#else
-      r = rr/(error+.003*ac[0]);
-#endif
-      /*  Update LPC coefficients and total error */
-      lpc[i] = r;
-      for (j = 0; j < i>>1; j++) 
-      {
-         spx_word16_t tmp  = lpc[j];
-         lpc[j]     = MAC16_16_P13(lpc[j],r,lpc[i-1-j]);
-         lpc[i-1-j] = MAC16_16_P13(lpc[i-1-j],r,tmp);
-      }
-      if (i & 1) 
-         lpc[j] = MAC16_16_P13(lpc[j],lpc[j],r);
-
-      error = SUB16(error,MULT16_16_Q13(r,MULT16_16_Q13(error,r)));
-   }
-   return error;
-}
-
-
-#ifdef FIXED_POINT
-
-/* Compute the autocorrelation
- *                      ,--,
- *              ac(i) = >  x(n) * x(n-i)  for all n
- *                      `--'
- * for lags between 0 and lag-1, and x == 0 outside 0...n-1
- */
-
-#ifndef OVERRIDE_SPEEX_AUTOCORR
-void _spx_autocorr(
-const spx_word16_t *x,   /*  in: [0...n-1] samples x   */
-spx_word16_t       *ac,  /* out: [0...lag-1] ac values */
-int          lag, 
-int          n
-)
-{
-   spx_word32_t d;
-   int i, j;
-   spx_word32_t ac0=1;
-   int shift, ac_shift;
-   
-   for (j=0;j<n;j++)
-      ac0 = ADD32(ac0,SHR32(MULT16_16(x[j],x[j]),8));
-   ac0 = ADD32(ac0,n);
-   shift = 8;
-   while (shift && ac0<0x40000000)
-   {
-      shift--;
-      ac0 <<= 1;
-   }
-   ac_shift = 18;
-   while (ac_shift && ac0<0x40000000)
-   {
-      ac_shift--;
-      ac0 <<= 1;
-   }
-   
-   
-   for (i=0;i<lag;i++)
-   {
-      d=0;
-      for (j=i;j<n;j++)
-      {
-         d = ADD32(d,SHR32(MULT16_16(x[j],x[j-i]), shift));
-      }
-      
-      ac[i] = SHR32(d, ac_shift);
-   }
-}
-#endif
-
-
-#else
-
-
-
-/* Compute the autocorrelation
- *                      ,--,
- *              ac(i) = >  x(n) * x(n-i)  for all n
- *                      `--'
- * for lags between 0 and lag-1, and x == 0 outside 0...n-1
- */
-void _spx_autocorr(
-const spx_word16_t *x,   /*  in: [0...n-1] samples x   */
-float       *ac,  /* out: [0...lag-1] ac values */
-int          lag, 
-int          n
-)
-{
-   float d;
-   int i;
-   while (lag--) 
-   {
-      for (i = lag, d = 0; i < n; i++) 
-         d += x[i] * x[i-lag];
-      ac[lag] = d;
-   }
-   ac[0] += 10;
-}
-
-#endif
-
-
diff --git a/libspeex/lpc.h b/libspeex/lpc.h
deleted file mode 100644
index 952ecdd..0000000
--- a/libspeex/lpc.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin */
-/**
-   @file lpc.h
-   @brief Functions for LPC (Linear Prediction Coefficients) analysis
-*/
-/*
-   Redistribution and use in source and binary forms, with or without
-   modification, 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 the Xiph.org Foundation nor the names of its
-   contributors may be used to endorse or promote products derived from
-   this software without specific prior written permission.
-   
-   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 FOUNDATION OR
-   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef LPC_H
-#define LPC_H
-
-#include "arch.h"
-
-void _spx_autocorr(
-              const spx_word16_t * x,   /*  in: [0...n-1] samples x   */
-              spx_word16_t *ac,   /* out: [0...lag-1] ac values */
-              int lag, int   n);
-
-spx_word32_t                      /* returns minimum mean square error    */
-_spx_lpc(
-    spx_coef_t       * lpc, /*      [0...p-1] LPC coefficients      */
-    const spx_word16_t * ac,  /*  in: [0...p] autocorrelation values  */
-    int p
-    );
-
-
-#endif
diff --git a/libspeex/lsp.c b/libspeex/lsp.c
deleted file mode 100644
index a73d883..0000000
--- a/libspeex/lsp.c
+++ /dev/null
@@ -1,656 +0,0 @@
-/*---------------------------------------------------------------------------*\
-Original copyright
-	FILE........: lsp.c
-	AUTHOR......: David Rowe
-	DATE CREATED: 24/2/93
-
-Heavily modified by Jean-Marc Valin (c) 2002-2006 (fixed-point, 
-                       optimizations, additional functions, ...)
-
-   This file contains functions for converting Linear Prediction
-   Coefficients (LPC) to Line Spectral Pair (LSP) and back. Note that the
-   LSP coefficients are not in radians format but in the x domain of the
-   unit circle.
-
-   Speex License:
-
-   Redistribution and use in source and binary forms, with or without
-   modification, 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 the Xiph.org Foundation nor the names of its
-   contributors may be used to endorse or promote products derived from
-   this software without specific prior written permission.
-   
-   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 FOUNDATION 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.
-*/
-
-/*---------------------------------------------------------------------------*\
-
-  Introduction to Line Spectrum Pairs (LSPs)
-  ------------------------------------------
-
-  LSPs are used to encode the LPC filter coefficients {ak} for
-  transmission over the channel.  LSPs have several properties (like
-  less sensitivity to quantisation noise) that make them superior to
-  direct quantisation of {ak}.
-
-  A(z) is a polynomial of order lpcrdr with {ak} as the coefficients.
-
-  A(z) is transformed to P(z) and Q(z) (using a substitution and some
-  algebra), to obtain something like:
-
-    A(z) = 0.5[P(z)(z+z^-1) + Q(z)(z-z^-1)]  (1)
-
-  As you can imagine A(z) has complex zeros all over the z-plane. P(z)
-  and Q(z) have the very neat property of only having zeros _on_ the
-  unit circle.  So to find them we take a test point z=exp(jw) and
-  evaluate P (exp(jw)) and Q(exp(jw)) using a grid of points between 0
-  and pi.
-
-  The zeros (roots) of P(z) also happen to alternate, which is why we
-  swap coefficients as we find roots.  So the process of finding the
-  LSP frequencies is basically finding the roots of 5th order
-  polynomials.
-
-  The root so P(z) and Q(z) occur in symmetrical pairs at +/-w, hence
-  the name Line Spectrum Pairs (LSPs).
-
-  To convert back to ak we just evaluate (1), "clocking" an impulse
-  thru it lpcrdr times gives us the impulse response of A(z) which is
-  {ak}.
-
-\*---------------------------------------------------------------------------*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <math.h>
-#include "lsp.h"
-#include "stack_alloc.h"
-#include "math_approx.h"
-
-#ifndef M_PI
-#define M_PI           3.14159265358979323846  /* pi */
-#endif
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-#ifdef FIXED_POINT
-
-#define FREQ_SCALE 16384
-
-/*#define ANGLE2X(a) (32768*cos(((a)/8192.)))*/
-#define ANGLE2X(a) (SHL16(spx_cos(a),2))
-
-/*#define X2ANGLE(x) (acos(.00006103515625*(x))*LSP_SCALING)*/
-#define X2ANGLE(x) (spx_acos(x))
-
-#ifdef BFIN_ASM
-#include "lsp_bfin.h"
-#endif
-
-#else
-
-/*#define C1 0.99940307
-#define C2 -0.49558072
-#define C3 0.03679168*/
-
-#define FREQ_SCALE 1.
-#define ANGLE2X(a) (spx_cos(a))
-#define X2ANGLE(x) (acos(x))
-
-#endif
-
-
-/*---------------------------------------------------------------------------*\
-
-   FUNCTION....: cheb_poly_eva()
-
-   AUTHOR......: David Rowe
-   DATE CREATED: 24/2/93
-
-   This function evaluates a series of Chebyshev polynomials
-
-\*---------------------------------------------------------------------------*/
-
-#ifdef FIXED_POINT
-
-#ifndef OVERRIDE_CHEB_POLY_EVA
-static inline spx_word32_t cheb_poly_eva(
-  spx_word16_t *coef, /* P or Q coefs in Q13 format               */
-  spx_word16_t     x, /* cos of freq (-1.0 to 1.0) in Q14 format  */
-  int              m, /* LPC order/2                              */
-  char         *stack
-)
-{
-    int i;
-    spx_word16_t b0, b1;
-    spx_word32_t sum;
-
-    /*Prevents overflows*/
-    if (x>16383)
-       x = 16383;
-    if (x<-16383)
-       x = -16383;
-
-    /* Initialise values */
-    b1=16384;
-    b0=x;
-
-    /* Evaluate Chebyshev series formulation usin g iterative approach  */
-    sum = ADD32(EXTEND32(coef[m]), EXTEND32(MULT16_16_P14(coef[m-1],x)));
-    for(i=2;i<=m;i++)
-    {
-       spx_word16_t tmp=b0;
-       b0 = SUB16(MULT16_16_Q13(x,b0), b1);
-       b1 = tmp;
-       sum = ADD32(sum, EXTEND32(MULT16_16_P14(coef[m-i],b0)));
-    }
-    
-    return sum;
-}
-#endif
-
-#else
-
-static float cheb_poly_eva(spx_word32_t *coef, spx_word16_t x, int m, char *stack)
-{
-   int k;
-   float b0, b1, tmp;
-
-   /* Initial conditions */
-   b0=0; /* b_(m+1) */
-   b1=0; /* b_(m+2) */
-
-   x*=2;
-
-   /* Calculate the b_(k) */
-   for(k=m;k>0;k--)
-   {
-      tmp=b0;                           /* tmp holds the previous value of b0 */
-      b0=x*b0-b1+coef[m-k];    /* b0 holds its new value based on b0 and b1 */
-      b1=tmp;                           /* b1 holds the previous value of b0 */
-   }
-
-   return(-b1+.5*x*b0+coef[m]);
-}
-#endif
-
-/*---------------------------------------------------------------------------*\
-
-    FUNCTION....: lpc_to_lsp()
-
-    AUTHOR......: David Rowe
-    DATE CREATED: 24/2/93
-
-    This function converts LPC coefficients to LSP
-    coefficients.
-
-\*---------------------------------------------------------------------------*/
-
-#ifdef FIXED_POINT
-#define SIGN_CHANGE(a,b) (((a)&0x70000000)^((b)&0x70000000)||(b==0))
-#else
-#define SIGN_CHANGE(a,b) (((a)*(b))<0.0)
-#endif
-
-
-int lpc_to_lsp (spx_coef_t *a,int lpcrdr,spx_lsp_t *freq,int nb,spx_word16_t delta, char *stack)
-/*  float *a 		     	lpc coefficients			*/
-/*  int lpcrdr			order of LPC coefficients (10) 		*/
-/*  float *freq 	      	LSP frequencies in the x domain       	*/
-/*  int nb			number of sub-intervals (4) 		*/
-/*  float delta			grid spacing interval (0.02) 		*/
-
-
-{
-    spx_word16_t temp_xr,xl,xr,xm=0;
-    spx_word32_t psuml,psumr,psumm,temp_psumr/*,temp_qsumr*/;
-    int i,j,m,flag,k;
-    VARDECL(spx_word32_t *Q);                 	/* ptrs for memory allocation 		*/
-    VARDECL(spx_word32_t *P);
-    VARDECL(spx_word16_t *Q16);         /* ptrs for memory allocation 		*/
-    VARDECL(spx_word16_t *P16);
-    spx_word32_t *px;                	/* ptrs of respective P'(z) & Q'(z)	*/
-    spx_word32_t *qx;
-    spx_word32_t *p;
-    spx_word32_t *q;
-    spx_word16_t *pt;                	/* ptr used for cheb_poly_eval()
-				whether P' or Q' 			*/
-    int roots=0;              	/* DR 8/2/94: number of roots found 	*/
-    flag = 1;                	/*  program is searching for a root when,
-				1 else has found one 			*/
-    m = lpcrdr/2;            	/* order of P'(z) & Q'(z) polynomials 	*/
-
-    /* Allocate memory space for polynomials */
-    ALLOC(Q, (m+1), spx_word32_t);
-    ALLOC(P, (m+1), spx_word32_t);
-
-    /* determine P'(z)'s and Q'(z)'s coefficients where
-      P'(z) = P(z)/(1 + z^(-1)) and Q'(z) = Q(z)/(1-z^(-1)) */
-
-    px = P;                      /* initialise ptrs 			*/
-    qx = Q;
-    p = px;
-    q = qx;
-
-#ifdef FIXED_POINT
-    *px++ = LPC_SCALING;
-    *qx++ = LPC_SCALING;
-    for(i=0;i<m;i++){
-       *px++ = SUB32(ADD32(EXTEND32(a[i]),EXTEND32(a[lpcrdr-i-1])), *p++);
-       *qx++ = ADD32(SUB32(EXTEND32(a[i]),EXTEND32(a[lpcrdr-i-1])), *q++);
-    }
-    px = P;
-    qx = Q;
-    for(i=0;i<m;i++)
-    {
-       /*if (fabs(*px)>=32768)
-          speex_warning_int("px", *px);
-       if (fabs(*qx)>=32768)
-       speex_warning_int("qx", *qx);*/
-       *px = PSHR32(*px,2);
-       *qx = PSHR32(*qx,2);
-       px++;
-       qx++;
-    }
-    /* The reason for this lies in the way cheb_poly_eva() is implemented for fixed-point */
-    P[m] = PSHR32(P[m],3);
-    Q[m] = PSHR32(Q[m],3);
-#else
-    *px++ = LPC_SCALING;
-    *qx++ = LPC_SCALING;
-    for(i=0;i<m;i++){
-       *px++ = (a[i]+a[lpcrdr-1-i]) - *p++;
-       *qx++ = (a[i]-a[lpcrdr-1-i]) + *q++;
-    }
-    px = P;
-    qx = Q;
-    for(i=0;i<m;i++){
-       *px = 2**px;
-       *qx = 2**qx;
-       px++;
-       qx++;
-    }
-#endif
-
-    px = P;             	/* re-initialise ptrs 			*/
-    qx = Q;
-
-    /* now that we have computed P and Q convert to 16 bits to
-       speed up cheb_poly_eval */
-
-    ALLOC(P16, m+1, spx_word16_t);
-    ALLOC(Q16, m+1, spx_word16_t);
-
-    for (i=0;i<m+1;i++)
-    {
-       P16[i] = P[i];
-       Q16[i] = Q[i];
-    }
-
-    /* Search for a zero in P'(z) polynomial first and then alternate to Q'(z).
-    Keep alternating between the two polynomials as each zero is found 	*/
-
-    xr = 0;             	/* initialise xr to zero 		*/
-    xl = FREQ_SCALE;               	/* start at point xl = 1 		*/
-
-    for(j=0;j<lpcrdr;j++){
-	if(j&1)            	/* determines whether P' or Q' is eval. */
-	    pt = Q16;
-	else
-	    pt = P16;
-
-	psuml = cheb_poly_eva(pt,xl,m,stack);	/* evals poly. at xl 	*/
-	flag = 1;
-	while(flag && (xr >= -FREQ_SCALE)){
-           spx_word16_t dd;
-           /* Modified by JMV to provide smaller steps around x=+-1 */
-#ifdef FIXED_POINT
-           dd = MULT16_16_Q15(delta,SUB16(FREQ_SCALE, MULT16_16_Q14(MULT16_16_Q14(xl,xl),14000)));
-           if (psuml<512 && psuml>-512)
-              dd = PSHR16(dd,1);
-#else
-           dd=delta*(1-.9*xl*xl);
-           if (fabs(psuml)<.2)
-              dd *= .5;
-#endif
-           xr = SUB16(xl, dd);                        	/* interval spacing 	*/
-	    psumr = cheb_poly_eva(pt,xr,m,stack);/* poly(xl-delta_x) 	*/
-	    temp_psumr = psumr;
-	    temp_xr = xr;
-
-    /* if no sign change increment xr and re-evaluate poly(xr). Repeat til
-    sign change.
-    if a sign change has occurred the interval is bisected and then
-    checked again for a sign change which determines in which
-    interval the zero lies in.
-    If there is no sign change between poly(xm) and poly(xl) set interval
-    between xm and xr else set interval between xl and xr and repeat till
-    root is located within the specified limits 			*/
-
-	    if(SIGN_CHANGE(psumr,psuml))
-            {
-		roots++;
-
-		psumm=psuml;
-		for(k=0;k<=nb;k++){
-#ifdef FIXED_POINT
-		    xm = ADD16(PSHR16(xl,1),PSHR16(xr,1));        	/* bisect the interval 	*/
-#else
-                    xm = .5*(xl+xr);        	/* bisect the interval 	*/
-#endif
-		    psumm=cheb_poly_eva(pt,xm,m,stack);
-		    /*if(psumm*psuml>0.)*/
-		    if(!SIGN_CHANGE(psumm,psuml))
-                    {
-			psuml=psumm;
-			xl=xm;
-		    } else {
-			psumr=psumm;
-			xr=xm;
-		    }
-		}
-
-	       /* once zero is found, reset initial interval to xr 	*/
-	       freq[j] = X2ANGLE(xm);
-	       xl = xm;
-	       flag = 0;       		/* reset flag for next search 	*/
-	    }
-	    else{
-		psuml=temp_psumr;
-		xl=temp_xr;
-	    }
-	}
-    }
-    return(roots);
-}
-
-/*---------------------------------------------------------------------------*\
-
-	FUNCTION....: lsp_to_lpc()
-
-	AUTHOR......: David Rowe
-	DATE CREATED: 24/2/93
-
-        Converts LSP coefficients to LPC coefficients.
-
-\*---------------------------------------------------------------------------*/
-
-#ifdef FIXED_POINT
-
-void lsp_to_lpc(spx_lsp_t *freq,spx_coef_t *ak,int lpcrdr, char *stack)
-/*  float *freq 	array of LSP frequencies in the x domain	*/
-/*  float *ak 		array of LPC coefficients 			*/
-/*  int lpcrdr  	order of LPC coefficients 			*/
-{
-    int i,j;
-    spx_word32_t xout1,xout2,xin;
-    spx_word32_t mult, a;
-    VARDECL(spx_word16_t *freqn);
-    VARDECL(spx_word32_t **xp);
-    VARDECL(spx_word32_t *xpmem);
-    VARDECL(spx_word32_t **xq);
-    VARDECL(spx_word32_t *xqmem);
-    int m = lpcrdr>>1;
-
-    /* 
-    
-       Reconstruct P(z) and Q(z) by cascading second order polynomials
-       in form 1 - 2cos(w)z(-1) + z(-2), where w is the LSP frequency.
-       In the time domain this is:
-
-       y(n) = x(n) - 2cos(w)x(n-1) + x(n-2)
-    
-       This is what the ALLOCS below are trying to do:
-
-         int xp[m+1][lpcrdr+1+2]; // P matrix in QIMP
-         int xq[m+1][lpcrdr+1+2]; // Q matrix in QIMP
-
-       These matrices store the output of each stage on each row.  The
-       final (m-th) row has the output of the final (m-th) cascaded
-       2nd order filter.  The first row is the impulse input to the
-       system (not written as it is known).
-
-       The version below takes advantage of the fact that a lot of the
-       outputs are zero or known, for example if we put an inpulse
-       into the first section the "clock" it 10 times only the first 3
-       outputs samples are non-zero (it's an FIR filter).
-    */
-
-    ALLOC(xp, (m+1), spx_word32_t*);
-    ALLOC(xpmem, (m+1)*(lpcrdr+1+2), spx_word32_t);
-
-    ALLOC(xq, (m+1), spx_word32_t*);
-    ALLOC(xqmem, (m+1)*(lpcrdr+1+2), spx_word32_t);
-    
-    for(i=0; i<=m; i++) {
-      xp[i] = xpmem + i*(lpcrdr+1+2);
-      xq[i] = xqmem + i*(lpcrdr+1+2);
-    }
-
-    /* work out 2cos terms in Q14 */
-
-    ALLOC(freqn, lpcrdr, spx_word16_t);
-    for (i=0;i<lpcrdr;i++) 
-       freqn[i] = ANGLE2X(freq[i]);
-
-    #define QIMP  21   /* scaling for impulse */
-
-    xin = SHL32(EXTEND32(1), (QIMP-1)); /* 0.5 in QIMP format */
-   
-    /* first col and last non-zero values of each row are trivial */
-    
-    for(i=0;i<=m;i++) {
-     xp[i][1] = 0;
-     xp[i][2] = xin;
-     xp[i][2+2*i] = xin;
-     xq[i][1] = 0;
-     xq[i][2] = xin;
-     xq[i][2+2*i] = xin;
-    }
-
-    /* 2nd row (first output row) is trivial */
-
-    xp[1][3] = -MULT16_32_Q14(freqn[0],xp[0][2]);
-    xq[1][3] = -MULT16_32_Q14(freqn[1],xq[0][2]);
-
-    xout1 = xout2 = 0;
-
-    /* now generate remaining rows */
-
-    for(i=1;i<m;i++) {
-
-      for(j=1;j<2*(i+1)-1;j++) {
-	mult = MULT16_32_Q14(freqn[2*i],xp[i][j+1]);
-	xp[i+1][j+2] = ADD32(SUB32(xp[i][j+2], mult), xp[i][j]);
-	mult = MULT16_32_Q14(freqn[2*i+1],xq[i][j+1]);
-	xq[i+1][j+2] = ADD32(SUB32(xq[i][j+2], mult), xq[i][j]);
-      }
-
-      /* for last col xp[i][j+2] = xq[i][j+2] = 0 */
-
-      mult = MULT16_32_Q14(freqn[2*i],xp[i][j+1]);
-      xp[i+1][j+2] = SUB32(xp[i][j], mult);
-      mult = MULT16_32_Q14(freqn[2*i+1],xq[i][j+1]);
-      xq[i+1][j+2] = SUB32(xq[i][j], mult);
-    }
-
-    /* process last row to extra a{k} */
-
-    for(j=1;j<=lpcrdr;j++) {
-      int shift = QIMP-13;
-
-      /* final filter sections */
-      a = PSHR32(xp[m][j+2] + xout1 + xq[m][j+2] - xout2, shift); 
-      xout1 = xp[m][j+2];
-      xout2 = xq[m][j+2];
-      
-      /* hard limit ak's to +/- 32767 */
-
-      if (a < -32767) a = -32767;
-      if (a > 32767) a = 32767;
-      ak[j-1] = (short)a;
-     
-    }
-
-}
-
-#else
-
-void lsp_to_lpc(spx_lsp_t *freq,spx_coef_t *ak,int lpcrdr, char *stack)
-/*  float *freq 	array of LSP frequencies in the x domain	*/
-/*  float *ak 		array of LPC coefficients 			*/
-/*  int lpcrdr  	order of LPC coefficients 			*/
-
-
-{
-    int i,j;
-    float xout1,xout2,xin1,xin2;
-    VARDECL(float *Wp);
-    float *pw,*n1,*n2,*n3,*n4=NULL;
-    VARDECL(float *x_freq);
-    int m = lpcrdr>>1;
-
-    ALLOC(Wp, 4*m+2, float);
-    pw = Wp;
-
-    /* initialise contents of array */
-
-    for(i=0;i<=4*m+1;i++){       	/* set contents of buffer to 0 */
-	*pw++ = 0.0;
-    }
-
-    /* Set pointers up */
-
-    pw = Wp;
-    xin1 = 1.0;
-    xin2 = 1.0;
-
-    ALLOC(x_freq, lpcrdr, float);
-    for (i=0;i<lpcrdr;i++)
-       x_freq[i] = ANGLE2X(freq[i]);
-
-    /* reconstruct P(z) and Q(z) by  cascading second order
-      polynomials in form 1 - 2xz(-1) +z(-2), where x is the
-      LSP coefficient */
-
-    for(j=0;j<=lpcrdr;j++){
-       int i2=0;
-	for(i=0;i<m;i++,i2+=2){
-	    n1 = pw+(i*4);
-	    n2 = n1 + 1;
-	    n3 = n2 + 1;
-	    n4 = n3 + 1;
-	    xout1 = xin1 - 2.f*x_freq[i2] * *n1 + *n2;
-	    xout2 = xin2 - 2.f*x_freq[i2+1] * *n3 + *n4;
-	    *n2 = *n1;
-	    *n4 = *n3;
-	    *n1 = xin1;
-	    *n3 = xin2;
-	    xin1 = xout1;
-	    xin2 = xout2;
-	}
-	xout1 = xin1 + *(n4+1);
-	xout2 = xin2 - *(n4+2);
-	if (j>0)
-	   ak[j-1] = (xout1 + xout2)*0.5f;
-	*(n4+1) = xin1;
-	*(n4+2) = xin2;
-
-	xin1 = 0.0;
-	xin2 = 0.0;
-    }
-
-}
-#endif
-
-
-#ifdef FIXED_POINT
-
-/*Makes sure the LSPs are stable*/
-void lsp_enforce_margin(spx_lsp_t *lsp, int len, spx_word16_t margin)
-{
-   int i;
-   spx_word16_t m = margin;
-   spx_word16_t m2 = 25736-margin;
-  
-   if (lsp[0]<m)
-      lsp[0]=m;
-   if (lsp[len-1]>m2)
-      lsp[len-1]=m2;
-   for (i=1;i<len-1;i++)
-   {
-      if (lsp[i]<lsp[i-1]+m)
-         lsp[i]=lsp[i-1]+m;
-
-      if (lsp[i]>lsp[i+1]-m)
-         lsp[i]= SHR16(lsp[i],1) + SHR16(lsp[i+1]-m,1);
-   }
-}
-
-
-void lsp_interpolate(spx_lsp_t *old_lsp, spx_lsp_t *new_lsp, spx_lsp_t *interp_lsp, int len, int subframe, int nb_subframes)
-{
-   int i;
-   spx_word16_t tmp = DIV32_16(SHL32(EXTEND32(1 + subframe),14),nb_subframes);
-   spx_word16_t tmp2 = 16384-tmp;
-   for (i=0;i<len;i++)
-   {
-      interp_lsp[i] = MULT16_16_P14(tmp2,old_lsp[i]) + MULT16_16_P14(tmp,new_lsp[i]);
-   }
-}
-
-#else
-
-/*Makes sure the LSPs are stable*/
-void lsp_enforce_margin(spx_lsp_t *lsp, int len, spx_word16_t margin)
-{
-   int i;
-   if (lsp[0]<LSP_SCALING*margin)
-      lsp[0]=LSP_SCALING*margin;
-   if (lsp[len-1]>LSP_SCALING*(M_PI-margin))
-      lsp[len-1]=LSP_SCALING*(M_PI-margin);
-   for (i=1;i<len-1;i++)
-   {
-      if (lsp[i]<lsp[i-1]+LSP_SCALING*margin)
-         lsp[i]=lsp[i-1]+LSP_SCALING*margin;
-
-      if (lsp[i]>lsp[i+1]-LSP_SCALING*margin)
-         lsp[i]= .5f* (lsp[i] + lsp[i+1]-LSP_SCALING*margin);
-   }
-}
-
-
-void lsp_interpolate(spx_lsp_t *old_lsp, spx_lsp_t *new_lsp, spx_lsp_t *interp_lsp, int len, int subframe, int nb_subframes)
-{
-   int i;
-   float tmp = (1.0f + subframe)/nb_subframes;
-   for (i=0;i<len;i++)
-   {
-      interp_lsp[i] = (1-tmp)*old_lsp[i] + tmp*new_lsp[i];
-   }
-}
-
-#endif
diff --git a/libspeex/lsp.h b/libspeex/lsp.h
deleted file mode 100644
index 648652f..0000000
--- a/libspeex/lsp.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*---------------------------------------------------------------------------*\

-Original Copyright

-	FILE........: AK2LSPD.H

-	TYPE........: Turbo C header file

-	COMPANY.....: Voicetronix

-	AUTHOR......: James Whitehall

-	DATE CREATED: 21/11/95

-

-Modified by Jean-Marc Valin

-

-    This file contains functions for converting Linear Prediction

-    Coefficients (LPC) to Line Spectral Pair (LSP) and back. Note that the

-    LSP coefficients are not in radians format but in the x domain of the

-    unit circle.

-

-\*---------------------------------------------------------------------------*/

-/**

-   @file lsp.h

-   @brief Line Spectral Pair (LSP) functions.

-*/

-/* Speex License:

-

-   Redistribution and use in source and binary forms, with or without

-   modification, 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 the Xiph.org Foundation nor the names of its

-   contributors may be used to endorse or promote products derived from

-   this software without specific prior written permission.

-   

-   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 FOUNDATION OR

-   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,

-   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,

-   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR

-   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF

-   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING

-   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS

-   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

-*/

-

-#ifndef __AK2LSPD__

-#define __AK2LSPD__

-

-#include "arch.h"

-

-int lpc_to_lsp (spx_coef_t *a, int lpcrdr, spx_lsp_t *freq, int nb, spx_word16_t delta, char *stack);

-void lsp_to_lpc(spx_lsp_t *freq, spx_coef_t *ak, int lpcrdr, char *stack);

-

-/*Added by JMV*/

-void lsp_enforce_margin(spx_lsp_t *lsp, int len, spx_word16_t margin);

-

-void lsp_interpolate(spx_lsp_t *old_lsp, spx_lsp_t *new_lsp, spx_lsp_t *interp_lsp, int len, int subframe, int nb_subframes);

-

-#endif	/* __AK2LSPD__ */

diff --git a/libspeex/lsp_tables_nb.c b/libspeex/lsp_tables_nb.c
deleted file mode 100644
index 16f2e1b..0000000
--- a/libspeex/lsp_tables_nb.c
+++ /dev/null
@@ -1,360 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin 
-   File: lsp_tables_nb.c
-   Codebooks for LSPs in narrowband CELP mode
-  
-   Redistribution and use in source and binary forms, with or without
-   modification, are permitted provided that the following conditions are
-   met:
-
-   1. Redistributions of source code must retain the above copyright notice,
-   this list of conditions and the following disclaimer.  
-
-   2. 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.
-
-   3. The name of the author may not be used to endorse or promote products
-   derived from this software without specific prior written permission.
-
-   THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
-*/
-
-const signed char cdbk_nb[640]={
-30,19,38,34,40,32,46,43,58,43,
-5,-18,-25,-40,-33,-55,-52,20,34,28,
--20,-63,-97,-92,61,53,47,49,53,75,
--14,-53,-77,-79,0,-3,-5,19,22,26,
--9,-53,-55,66,90,72,85,68,74,52,
--4,-41,-58,-31,-18,-31,27,32,30,18,
-24,3,8,5,-12,-3,26,28,74,63,
--2,-39,-67,-77,-106,-74,59,59,73,65,
-44,40,71,72,82,83,98,88,89,60,
--6,-31,-47,-48,-13,-39,-9,7,2,79,
--1,-39,-60,-17,87,81,65,50,45,19,
--21,-67,-91,-87,-41,-50,7,18,39,74,
-10,-31,-28,39,24,13,23,5,56,45,
-29,10,-5,-13,-11,-35,-18,-8,-10,-8,
--25,-71,-77,-21,2,16,50,63,87,87,
-5,-32,-40,-51,-68,0,12,6,54,34,
-5,-12,32,52,68,64,69,59,65,45,
-14,-16,-31,-40,-65,-67,41,49,47,37,
--11,-52,-75,-84,-4,57,48,42,42,33,
--11,-51,-68,-6,13,0,8,-8,26,32,
--23,-53,0,36,56,76,97,105,111,97,
--1,-28,-39,-40,-43,-54,-44,-40,-18,35,
-16,-20,-19,-28,-42,29,47,38,74,45,
-3,-29,-48,-62,-80,-104,-33,56,59,59,
-10,17,46,72,84,101,117,123,123,106,
--7,-33,-49,-51,-70,-67,-27,-31,70,67,
--16,-62,-85,-20,82,71,86,80,85,74,
--19,-58,-75,-45,-29,-33,-18,-25,45,57,
--12,-42,-5,12,28,36,52,64,81,82,
-13,-9,-27,-28,22,3,2,22,26,6,
--6,-44,-51,2,15,10,48,43,49,34,
--19,-62,-84,-89,-102,-24,8,17,61,68,
-39,24,23,19,16,-5,12,15,27,15,
--8,-44,-49,-60,-18,-32,-28,52,54,62,
--8,-48,-77,-70,66,101,83,63,61,37,
--12,-50,-75,-64,33,17,13,25,15,77,
-1,-42,-29,72,64,46,49,31,61,44,
--8,-47,-54,-46,-30,19,20,-1,-16,0,
-16,-12,-18,-9,-26,-27,-10,-22,53,45,
--10,-47,-75,-82,-105,-109,8,25,49,77,
-50,65,114,117,124,118,115,96,90,61,
--9,-45,-63,-60,-75,-57,8,11,20,29,
-0,-35,-49,-43,40,47,35,40,55,38,
--24,-76,-103,-112,-27,3,23,34,52,75,
-8,-29,-43,12,63,38,35,29,24,8,
-25,11,1,-15,-18,-43,-7,37,40,21,
--20,-56,-19,-19,-4,-2,11,29,51,63,
--2,-44,-62,-75,-89,30,57,51,74,51,
-50,46,68,64,65,52,63,55,65,43,
-18,-9,-26,-35,-55,-69,3,6,8,17,
--15,-61,-86,-97,1,86,93,74,78,67,
--1,-38,-66,-48,48,39,29,25,17,-1,
-13,13,29,39,50,51,69,82,97,98,
--2,-36,-46,-27,-16,-30,-13,-4,-7,-4,
-25,-5,-11,-6,-25,-21,33,12,31,29,
--8,-38,-52,-63,-68,-89,-33,-1,10,74,
--2,-15,59,91,105,105,101,87,84,62,
--7,-33,-50,-35,-54,-47,25,17,82,81,
--13,-56,-83,21,58,31,42,25,72,65,
--24,-66,-91,-56,9,-2,21,10,69,75,
-2,-24,11,22,25,28,38,34,48,33,
-7,-29,-26,17,15,-1,14,0,-2,0,
--6,-41,-67,6,-2,-9,19,2,85,74,
--22,-67,-84,-71,-50,3,11,-9,2,62};
-
-const signed char cdbk_nb_low1[320]={
--34,-52,-15,45,2,
-23,21,52,24,-33,
--9,-1,9,-44,-41,
--13,-17,44,22,-17,
--6,-4,-1,22,38,
-26,16,2,50,27,
--35,-34,-9,-41,6,
-0,-16,-34,51,8,
--14,-31,-49,15,-33,
-45,49,33,-11,-37,
--62,-54,45,11,-5,
--72,11,-1,-12,-11,
-24,27,-11,-43,46,
-43,33,-12,-9,-1,
-1,-4,-23,-57,-71,
-11,8,16,17,-8,
--20,-31,-41,53,48,
--16,3,65,-24,-8,
--23,-32,-37,-32,-49,
--10,-17,6,38,5,
--9,-17,-46,8,52,
-3,6,45,40,39,
--7,-6,-34,-74,31,
-8,1,-16,43,68,
--11,-19,-31,4,6,
-0,-6,-17,-16,-38,
--16,-30,2,9,-39,
--16,-1,43,-10,48,
-3,3,-16,-31,-3,
-62,68,43,13,3,
--10,8,20,-56,12,
-12,-2,-18,22,-15,
--40,-36,1,7,41,
-0,1,46,-6,-62,
--4,-12,-2,-11,-83,
--13,-2,91,33,-10,
-0,4,-11,-16,79,
-32,37,14,9,51,
--21,-28,-56,-34,0,
-21,9,-26,11,28,
--42,-54,-23,-2,-15,
-31,30,8,-39,-66,
--39,-36,31,-28,-40,
--46,35,40,22,24,
-33,48,23,-34,14,
-40,32,17,27,-3,
-25,26,-13,-61,-17,
-11,4,31,60,-6,
--26,-41,-64,13,16,
--26,54,31,-11,-23,
--9,-11,-34,-71,-21,
--34,-35,55,50,29,
--22,-27,-50,-38,57,
-33,42,57,48,26,
-11,0,-49,-31,26,
--4,-14,5,78,37,
-17,0,-49,-12,-23,
-26,14,2,2,-43,
--17,-12,10,-8,-4,
-8,18,12,-6,20,
--12,-6,-13,-25,34,
-15,40,49,7,8,
-13,20,20,-19,-22,
--2,-8,2,51,-51};
-
-const signed char cdbk_nb_low2[320]={
--6,53,-21,-24,4,
-26,17,-4,-37,25,
-17,-36,-13,31,3,
--6,27,15,-10,31,
-28,26,-10,-10,-40,
-16,-7,15,13,41,
--9,0,-4,50,-6,
--7,14,38,22,0,
--48,2,1,-13,-19,
-32,-3,-60,11,-17,
--1,-24,-34,-1,35,
--5,-27,28,44,13,
-25,15,42,-11,15,
-51,35,-36,20,8,
--4,-12,-29,19,-47,
-49,-15,-4,16,-29,
--39,14,-30,4,25,
--9,-5,-51,-14,-3,
--40,-32,38,5,-9,
--8,-4,-1,-22,71,
--3,14,26,-18,-22,
-24,-41,-25,-24,6,
-23,19,-10,39,-26,
--27,65,45,2,-7,
--26,-8,22,-12,16,
-15,16,-35,-5,33,
--21,-8,0,23,33,
-34,6,21,36,6,
--7,-22,8,-37,-14,
-31,38,11,-4,-3,
--39,-32,-8,32,-23,
--6,-12,16,20,-28,
--4,23,13,-52,-1,
-22,6,-33,-40,-6,
-4,-62,13,5,-26,
-35,39,11,2,57,
--11,9,-20,-28,-33,
-52,-5,-6,-2,22,
--14,-16,-48,35,1,
--58,20,13,33,-1,
--74,56,-18,-22,-31,
-12,6,-14,4,-2,
--9,-47,10,-3,29,
--17,-5,61,14,47,
--12,2,72,-39,-17,
-92,64,-53,-51,-15,
--30,-38,-41,-29,-28,
-27,9,36,9,-35,
--42,81,-21,20,25,
--16,-5,-17,-35,21,
-15,-28,48,2,-2,
-9,-19,29,-40,30,
--18,-18,18,-16,-57,
-15,-20,-12,-15,-37,
--15,33,-39,21,-22,
--13,35,11,13,-38,
--63,29,23,-27,32,
-18,3,-26,42,33,
--64,-66,-17,16,56,
-2,36,3,31,21,
--41,-39,8,-57,14,
-37,-2,19,-36,-19,
--23,-29,-16,1,-3,
--8,-10,31,64,-65};
-
-const signed char cdbk_nb_high1[320]={
--26,-8,29,21,4,
-19,-39,33,-7,-36,
-56,54,48,40,29,
--4,-24,-42,-66,-43,
--60,19,-2,37,41,
--10,-37,-60,-64,18,
--22,77,73,40,25,
-4,19,-19,-66,-2,
-11,5,21,14,26,
--25,-86,-4,18,1,
-26,-37,10,37,-1,
-24,-12,-59,-11,20,
--6,34,-16,-16,42,
-19,-28,-51,53,32,
-4,10,62,21,-12,
--34,27,4,-48,-48,
--50,-49,31,-7,-21,
--42,-25,-4,-43,-22,
-59,2,27,12,-9,
--6,-16,-8,-32,-58,
--16,-29,-5,41,23,
--30,-33,-46,-13,-10,
--38,52,52,1,-17,
--9,10,26,-25,-6,
-33,-20,53,55,25,
--32,-5,-42,23,21,
-66,5,-28,20,9,
-75,29,-7,-42,-39,
-15,3,-23,21,6,
-11,1,-29,14,63,
-10,54,26,-24,-51,
--49,7,-23,-51,15,
--66,1,60,25,10,
-0,-30,-4,-15,17,
-19,59,40,4,-5,
-33,6,-22,-58,-70,
--5,23,-6,60,44,
--29,-16,-47,-29,52,
--19,50,28,16,35,
-31,36,0,-21,6,
-21,27,22,42,7,
--66,-40,-8,7,19,
-46,0,-4,60,36,
-45,-7,-29,-6,-32,
--39,2,6,-9,33,
-20,-51,-34,18,-6,
-19,6,11,5,-19,
--29,-2,42,-11,-45,
--21,-55,57,37,2,
--14,-67,-16,-27,-38,
-69,48,19,2,-17,
-20,-20,-16,-34,-17,
--25,-61,10,73,45,
-16,-40,-64,-17,-29,
--22,56,17,-39,8,
--11,8,-25,-18,-13,
--19,8,54,57,36,
--17,-26,-4,6,-21,
-40,42,-4,20,31,
-53,10,-34,-53,31,
--17,35,0,15,-6,
--20,-63,-73,22,25,
-29,17,8,-29,-39,
--69,18,15,-15,-5};
-
-const signed char cdbk_nb_high2[320]={
-11,47,16,-9,-46,
--32,26,-64,34,-5,
-38,-7,47,20,2,
--73,-99,-3,-45,20,
-70,-52,15,-6,-7,
--82,31,21,47,51,
-39,-3,9,0,-41,
--7,-15,-54,2,0,
-27,-31,9,-45,-22,
--38,-24,-24,8,-33,
-23,5,50,-36,-17,
--18,-51,-2,13,19,
-43,12,-15,-12,61,
-38,38,7,13,0,
-6,-1,3,62,9,
-27,22,-33,38,-35,
--9,30,-43,-9,-32,
--1,4,-4,1,-5,
--11,-8,38,31,11,
--10,-42,-21,-37,1,
-43,15,-13,-35,-19,
--18,15,23,-26,59,
-1,-21,53,8,-41,
--50,-14,-28,4,21,
-25,-28,-40,5,-40,
--41,4,51,-33,-8,
--8,1,17,-60,12,
-25,-41,17,34,43,
-19,45,7,-37,24,
--15,56,-2,35,-10,
-48,4,-47,-2,5,
--5,-54,5,-3,-33,
--10,30,-2,-44,-24,
--38,9,-9,42,4,
-6,-56,44,-16,9,
--40,-26,18,-20,10,
-28,-41,-21,-4,13,
--18,32,-30,-3,37,
-15,22,28,50,-40,
-3,-29,-64,7,51,
--19,-11,17,-27,-40,
--64,24,-12,-7,-27,
-3,37,48,-1,2,
--9,-38,-34,46,1,
-27,-6,19,-13,26,
-10,34,20,25,40,
-50,-6,-7,30,9,
--24,0,-23,71,-61,
-22,58,-34,-4,2,
--49,-33,25,30,-8,
--6,-16,77,2,38,
--8,-35,-6,-30,56,
-78,31,33,-20,13,
--39,20,22,4,21,
--8,4,-6,10,-83,
--41,9,-25,-43,15,
--7,-12,-34,-39,-37,
--33,19,30,16,-33,
-42,-25,25,-68,44,
--15,-11,-4,23,50,
-14,4,-39,-43,20,
--30,60,9,-20,7,
-16,19,-33,37,29,
-16,-35,7,38,-27};
diff --git a/libspeex/ltp.c b/libspeex/ltp.c
deleted file mode 100644
index 0129c95..0000000
--- a/libspeex/ltp.c
+++ /dev/null
@@ -1,839 +0,0 @@
-/* Copyright (C) 2002-2006 Jean-Marc Valin 
-   File: ltp.c
-   Long-Term Prediction functions
-
-   Redistribution and use in source and binary forms, with or without
-   modification, 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 the Xiph.org Foundation nor the names of its
-   contributors may be used to endorse or promote products derived from
-   this software without specific prior written permission.
-   
-   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 FOUNDATION 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.
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <math.h>
-#include "ltp.h"
-#include "stack_alloc.h"
-#include "filters.h"
-#include <speex/speex_bits.h>
-#include "math_approx.h"
-#include "os_support.h"
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-
-#ifdef _USE_SSE
-#include "ltp_sse.h"
-#elif defined (ARM4_ASM) || defined(ARM5E_ASM)
-#include "ltp_arm4.h"
-#elif defined (BFIN_ASM)
-#include "ltp_bfin.h"
-#endif
-
-#ifndef OVERRIDE_INNER_PROD
-spx_word32_t inner_prod(const spx_word16_t *x, const spx_word16_t *y, int len)
-{
-   spx_word32_t sum=0;
-   len >>= 2;
-   while(len--)
-   {
-      spx_word32_t part=0;
-      part = MAC16_16(part,*x++,*y++);
-      part = MAC16_16(part,*x++,*y++);
-      part = MAC16_16(part,*x++,*y++);
-      part = MAC16_16(part,*x++,*y++);
-      /* HINT: If you had a 40-bit accumulator, you could shift only at the end */
-      sum = ADD32(sum,SHR32(part,6));
-   }
-   return sum;
-}
-#endif
-
-#ifndef OVERRIDE_PITCH_XCORR
-#if 0 /* HINT: Enable this for machines with enough registers (i.e. not x86) */
-void pitch_xcorr(const spx_word16_t *_x, const spx_word16_t *_y, spx_word32_t *corr, int len, int nb_pitch, char *stack)
-{
-   int i,j;
-   for (i=0;i<nb_pitch;i+=4)
-   {
-      /* Compute correlation*/
-      /*corr[nb_pitch-1-i]=inner_prod(x, _y+i, len);*/
-      spx_word32_t sum1=0;
-      spx_word32_t sum2=0;
-      spx_word32_t sum3=0;
-      spx_word32_t sum4=0;
-      const spx_word16_t *y = _y+i;
-      const spx_word16_t *x = _x;
-      spx_word16_t y0, y1, y2, y3;
-      /*y0=y[0];y1=y[1];y2=y[2];y3=y[3];*/
-      y0=*y++;
-      y1=*y++;
-      y2=*y++;
-      y3=*y++;
-      for (j=0;j<len;j+=4)
-      {
-         spx_word32_t part1;
-         spx_word32_t part2;
-         spx_word32_t part3;
-         spx_word32_t part4;
-         part1 = MULT16_16(*x,y0);
-         part2 = MULT16_16(*x,y1);
-         part3 = MULT16_16(*x,y2);
-         part4 = MULT16_16(*x,y3);
-         x++;
-         y0=*y++;
-         part1 = MAC16_16(part1,*x,y1);
-         part2 = MAC16_16(part2,*x,y2);
-         part3 = MAC16_16(part3,*x,y3);
-         part4 = MAC16_16(part4,*x,y0);
-         x++;
-         y1=*y++;
-         part1 = MAC16_16(part1,*x,y2);
-         part2 = MAC16_16(part2,*x,y3);
-         part3 = MAC16_16(part3,*x,y0);
-         part4 = MAC16_16(part4,*x,y1);
-         x++;
-         y2=*y++;
-         part1 = MAC16_16(part1,*x,y3);
-         part2 = MAC16_16(part2,*x,y0);
-         part3 = MAC16_16(part3,*x,y1);
-         part4 = MAC16_16(part4,*x,y2);
-         x++;
-         y3=*y++;
-         
-         sum1 = ADD32(sum1,SHR32(part1,6));
-         sum2 = ADD32(sum2,SHR32(part2,6));
-         sum3 = ADD32(sum3,SHR32(part3,6));
-         sum4 = ADD32(sum4,SHR32(part4,6));
-      }
-      corr[nb_pitch-1-i]=sum1;
-      corr[nb_pitch-2-i]=sum2;
-      corr[nb_pitch-3-i]=sum3;
-      corr[nb_pitch-4-i]=sum4;
-   }
-
-}
-#else
-void pitch_xcorr(const spx_word16_t *_x, const spx_word16_t *_y, spx_word32_t *corr, int len, int nb_pitch, char *stack)
-{
-   int i;
-   for (i=0;i<nb_pitch;i++)
-   {
-      /* Compute correlation*/
-      corr[nb_pitch-1-i]=inner_prod(_x, _y+i, len);
-   }
-
-}
-#endif
-#endif
-
-#ifndef OVERRIDE_COMPUTE_PITCH_ERROR
-static inline spx_word32_t compute_pitch_error(spx_word16_t *C, spx_word16_t *g, spx_word16_t pitch_control)
-{
-   spx_word32_t sum = 0;
-   sum = ADD32(sum,MULT16_16(MULT16_16_16(g[0],pitch_control),C[0]));
-   sum = ADD32(sum,MULT16_16(MULT16_16_16(g[1],pitch_control),C[1]));
-   sum = ADD32(sum,MULT16_16(MULT16_16_16(g[2],pitch_control),C[2]));
-   sum = SUB32(sum,MULT16_16(MULT16_16_16(g[0],g[1]),C[3]));
-   sum = SUB32(sum,MULT16_16(MULT16_16_16(g[2],g[1]),C[4]));
-   sum = SUB32(sum,MULT16_16(MULT16_16_16(g[2],g[0]),C[5]));
-   sum = SUB32(sum,MULT16_16(MULT16_16_16(g[0],g[0]),C[6]));
-   sum = SUB32(sum,MULT16_16(MULT16_16_16(g[1],g[1]),C[7]));
-   sum = SUB32(sum,MULT16_16(MULT16_16_16(g[2],g[2]),C[8]));
-   return sum;
-}
-#endif
-
-#ifndef OVERRIDE_OPEN_LOOP_NBEST_PITCH
-void open_loop_nbest_pitch(spx_word16_t *sw, int start, int end, int len, int *pitch, spx_word16_t *gain, int N, char *stack)
-{
-   int i,j,k;
-   VARDECL(spx_word32_t *best_score);
-   VARDECL(spx_word32_t *best_ener);
-   spx_word32_t e0;
-   VARDECL(spx_word32_t *corr);
-#ifdef FIXED_POINT
-   /* In fixed-point, we need only one (temporary) array of 32-bit values and two (corr16, ener16) 
-      arrays for (normalized) 16-bit values */
-   VARDECL(spx_word16_t *corr16);
-   VARDECL(spx_word16_t *ener16);
-   spx_word32_t *energy;
-   int cshift=0, eshift=0;
-   int scaledown = 0;
-   ALLOC(corr16, end-start+1, spx_word16_t);
-   ALLOC(ener16, end-start+1, spx_word16_t);
-   ALLOC(corr, end-start+1, spx_word32_t);
-   energy = corr;
-#else
-   /* In floating-point, we need to float arrays and no normalized copies */
-   VARDECL(spx_word32_t *energy);
-   spx_word16_t *corr16;
-   spx_word16_t *ener16;
-   ALLOC(energy, end-start+2, spx_word32_t);
-   ALLOC(corr, end-start+1, spx_word32_t);
-   corr16 = corr;
-   ener16 = energy;
-#endif
-   
-   ALLOC(best_score, N, spx_word32_t);
-   ALLOC(best_ener, N, spx_word32_t);
-   for (i=0;i<N;i++)
-   {
-        best_score[i]=-1;
-        best_ener[i]=0;
-        pitch[i]=start;
-   }
-   
-#ifdef FIXED_POINT
-   for (i=-end;i<len;i++)
-   {
-      if (ABS16(sw[i])>16383)
-      {
-         scaledown=1;
-         break;
-      }
-   }
-   /* If the weighted input is close to saturation, then we scale it down */
-   if (scaledown)
-   {
-      for (i=-end;i<len;i++)
-      {
-         sw[i]=SHR16(sw[i],1);
-      }
-   }      
-#endif
-   energy[0]=inner_prod(sw-start, sw-start, len);
-   e0=inner_prod(sw, sw, len);
-   for (i=start;i<end;i++)
-   {
-      /* Update energy for next pitch*/
-      energy[i-start+1] = SUB32(ADD32(energy[i-start],SHR32(MULT16_16(sw[-i-1],sw[-i-1]),6)), SHR32(MULT16_16(sw[-i+len-1],sw[-i+len-1]),6));
-      if (energy[i-start+1] < 0)
-         energy[i-start+1] = 0;
-   }
-   
-#ifdef FIXED_POINT
-   eshift = normalize16(energy, ener16, 32766, end-start+1);
-#endif
-   
-   /* In fixed-point, this actually overrites the energy array (aliased to corr) */
-   pitch_xcorr(sw, sw-end, corr, len, end-start+1, stack);
-   
-#ifdef FIXED_POINT
-   /* Normalize to 180 so we can square it and it still fits in 16 bits */
-   cshift = normalize16(corr, corr16, 180, end-start+1);
-   /* If we scaled weighted input down, we need to scale it up again (OK, so we've just lost the LSB, who cares?) */
-   if (scaledown)
-   {
-      for (i=-end;i<len;i++)
-      {
-         sw[i]=SHL16(sw[i],1);
-      }
-   }      
-#endif
-
-   /* Search for the best pitch prediction gain */
-   for (i=start;i<=end;i++)
-   {
-      spx_word16_t tmp = MULT16_16_16(corr16[i-start],corr16[i-start]);
-      /* Instead of dividing the tmp by the energy, we multiply on the other side */
-      if (MULT16_16(tmp,best_ener[N-1])>MULT16_16(best_score[N-1],ADD16(1,ener16[i-start])))
-      {
-         /* We can safely put it last and then check */
-         best_score[N-1]=tmp;
-         best_ener[N-1]=ener16[i-start]+1;
-         pitch[N-1]=i;
-         /* Check if it comes in front of others */
-         for (j=0;j<N-1;j++)
-         {
-            if (MULT16_16(tmp,best_ener[j])>MULT16_16(best_score[j],ADD16(1,ener16[i-start])))
-            {
-               for (k=N-1;k>j;k--)
-               {
-                  best_score[k]=best_score[k-1];
-                  best_ener[k]=best_ener[k-1];
-                  pitch[k]=pitch[k-1];
-               }
-               best_score[j]=tmp;
-               best_ener[j]=ener16[i-start]+1;
-               pitch[j]=i;
-               break;
-            }
-         }
-      }
-   }
-   
-   /* Compute open-loop gain if necessary */
-   if (gain)
-   {
-      for (j=0;j<N;j++)
-      {
-         spx_word16_t g;
-         i=pitch[j];
-         g = DIV32(SHL32(EXTEND32(corr16[i-start]),cshift), 10+SHR32(MULT16_16(spx_sqrt(e0),spx_sqrt(SHL32(EXTEND32(ener16[i-start]),eshift))),6));
-         /* FIXME: g = max(g,corr/energy) */
-         if (g<0)
-            g = 0;
-         gain[j]=g;
-      }
-   }
-
-
-}
-#endif
-
-#ifndef OVERRIDE_PITCH_GAIN_SEARCH_3TAP_VQ
-static int pitch_gain_search_3tap_vq(
-  const signed char *gain_cdbk,
-  int                gain_cdbk_size,
-  spx_word16_t      *C16,
-  spx_word16_t       max_gain
-)
-{
-  const signed char *ptr=gain_cdbk;
-  int                best_cdbk=0;
-  spx_word32_t       best_sum=-VERY_LARGE32;
-  spx_word32_t       sum=0;
-  spx_word16_t       g[3];
-  spx_word16_t       pitch_control=64;
-  spx_word16_t       gain_sum;
-  int                i;
-
-  for (i=0;i<gain_cdbk_size;i++) {
-         
-    ptr = gain_cdbk+4*i;
-    g[0]=ADD16((spx_word16_t)ptr[0],32);
-    g[1]=ADD16((spx_word16_t)ptr[1],32);
-    g[2]=ADD16((spx_word16_t)ptr[2],32);
-    gain_sum = (spx_word16_t)ptr[3];
-         
-    sum = compute_pitch_error(C16, g, pitch_control);
-         
-    if (sum>best_sum && gain_sum<=max_gain) {
-      best_sum=sum;
-      best_cdbk=i;
-    }
-  }
-
-  return best_cdbk;
-}
-#endif
-
-/** Finds the best quantized 3-tap pitch predictor by analysis by synthesis */
-static spx_word32_t pitch_gain_search_3tap(
-const spx_word16_t target[],       /* Target vector */
-const spx_coef_t ak[],          /* LPCs for this subframe */
-const spx_coef_t awk1[],        /* Weighted LPCs #1 for this subframe */
-const spx_coef_t awk2[],        /* Weighted LPCs #2 for this subframe */
-spx_sig_t exc[],                /* Excitation */
-const signed char *gain_cdbk,
-int gain_cdbk_size,
-int   pitch,                    /* Pitch value */
-int   p,                        /* Number of LPC coeffs */
-int   nsf,                      /* Number of samples in subframe */
-SpeexBits *bits,
-char *stack,
-const spx_word16_t *exc2,
-const spx_word16_t *r,
-spx_word16_t *new_target,
-int  *cdbk_index,
-int plc_tuning,
-spx_word32_t cumul_gain,
-int scaledown
-)
-{
-   int i,j;
-   VARDECL(spx_word16_t *tmp1);
-   VARDECL(spx_word16_t *e);
-   spx_word16_t *x[3];
-   spx_word32_t corr[3];
-   spx_word32_t A[3][3];
-   spx_word16_t gain[3];
-   spx_word32_t err;
-   spx_word16_t max_gain=128;
-   int          best_cdbk=0;
-
-   ALLOC(tmp1, 3*nsf, spx_word16_t);
-   ALLOC(e, nsf, spx_word16_t);
-
-   if (cumul_gain > 262144)
-      max_gain = 31;
-   
-   x[0]=tmp1;
-   x[1]=tmp1+nsf;
-   x[2]=tmp1+2*nsf;
-   
-   for (j=0;j<nsf;j++)
-      new_target[j] = target[j];
-
-   {
-      VARDECL(spx_mem_t *mm);
-      int pp=pitch-1;
-      ALLOC(mm, p, spx_mem_t);
-      for (j=0;j<nsf;j++)
-      {
-         if (j-pp<0)
-            e[j]=exc2[j-pp];
-         else if (j-pp-pitch<0)
-            e[j]=exc2[j-pp-pitch];
-         else
-            e[j]=0;
-      }
-#ifdef FIXED_POINT
-      /* Scale target and excitation down if needed (avoiding overflow) */
-      if (scaledown)
-      {
-         for (j=0;j<nsf;j++)
-            e[j] = SHR16(e[j],1);
-         for (j=0;j<nsf;j++)
-            new_target[j] = SHR16(new_target[j],1);
-      }
-#endif
-      for (j=0;j<p;j++)
-         mm[j] = 0;
-      iir_mem16(e, ak, e, nsf, p, mm, stack);
-      for (j=0;j<p;j++)
-         mm[j] = 0;
-      filter_mem16(e, awk1, awk2, e, nsf, p, mm, stack);
-      for (j=0;j<nsf;j++)
-         x[2][j] = e[j];
-   }
-   for (i=1;i>=0;i--)
-   {
-      spx_word16_t e0=exc2[-pitch-1+i];
-#ifdef FIXED_POINT
-      /* Scale excitation down if needed (avoiding overflow) */
-      if (scaledown)
-         e0 = SHR16(e0,1);
-#endif
-      x[i][0]=MULT16_16_Q14(r[0], e0);
-      for (j=0;j<nsf-1;j++)
-         x[i][j+1]=ADD32(x[i+1][j],MULT16_16_P14(r[j+1], e0));
-   }
-
-   for (i=0;i<3;i++)
-      corr[i]=inner_prod(x[i],new_target,nsf);
-   for (i=0;i<3;i++)
-      for (j=0;j<=i;j++)
-         A[i][j]=A[j][i]=inner_prod(x[i],x[j],nsf);
-
-   {
-      spx_word32_t C[9];
-#ifdef FIXED_POINT
-      spx_word16_t C16[9];
-#else
-      spx_word16_t *C16=C;
-#endif      
-      C[0]=corr[2];
-      C[1]=corr[1];
-      C[2]=corr[0];
-      C[3]=A[1][2];
-      C[4]=A[0][1];
-      C[5]=A[0][2];      
-      C[6]=A[2][2];
-      C[7]=A[1][1];
-      C[8]=A[0][0];
-      
-      /*plc_tuning *= 2;*/
-      if (plc_tuning<2)
-         plc_tuning=2;
-      if (plc_tuning>30)
-         plc_tuning=30;
-#ifdef FIXED_POINT
-      C[0] = SHL32(C[0],1);
-      C[1] = SHL32(C[1],1);
-      C[2] = SHL32(C[2],1);
-      C[3] = SHL32(C[3],1);
-      C[4] = SHL32(C[4],1);
-      C[5] = SHL32(C[5],1);
-      C[6] = MAC16_32_Q15(C[6],MULT16_16_16(plc_tuning,655),C[6]);
-      C[7] = MAC16_32_Q15(C[7],MULT16_16_16(plc_tuning,655),C[7]);
-      C[8] = MAC16_32_Q15(C[8],MULT16_16_16(plc_tuning,655),C[8]);
-      normalize16(C, C16, 32767, 9);
-#else
-      C[6]*=.5*(1+.02*plc_tuning);
-      C[7]*=.5*(1+.02*plc_tuning);
-      C[8]*=.5*(1+.02*plc_tuning);
-#endif
-
-      best_cdbk = pitch_gain_search_3tap_vq(gain_cdbk, gain_cdbk_size, C16, max_gain);
-
-#ifdef FIXED_POINT
-      gain[0] = ADD16(32,(spx_word16_t)gain_cdbk[best_cdbk*4]);
-      gain[1] = ADD16(32,(spx_word16_t)gain_cdbk[best_cdbk*4+1]);
-      gain[2] = ADD16(32,(spx_word16_t)gain_cdbk[best_cdbk*4+2]);
-      /*printf ("%d %d %d %d\n",gain[0],gain[1],gain[2], best_cdbk);*/
-#else
-      gain[0] = 0.015625*gain_cdbk[best_cdbk*4]  + .5;
-      gain[1] = 0.015625*gain_cdbk[best_cdbk*4+1]+ .5;
-      gain[2] = 0.015625*gain_cdbk[best_cdbk*4+2]+ .5;
-#endif
-      *cdbk_index=best_cdbk;
-   }
-
-   SPEEX_MEMSET(exc, 0, nsf);
-   for (i=0;i<3;i++)
-   {
-      int j;
-      int tmp1, tmp3;
-      int pp=pitch+1-i;
-      tmp1=nsf;
-      if (tmp1>pp)
-         tmp1=pp;
-      for (j=0;j<tmp1;j++)
-         exc[j]=MAC16_16(exc[j],SHL16(gain[2-i],7),exc2[j-pp]);
-      tmp3=nsf;
-      if (tmp3>pp+pitch)
-         tmp3=pp+pitch;
-      for (j=tmp1;j<tmp3;j++)
-         exc[j]=MAC16_16(exc[j],SHL16(gain[2-i],7),exc2[j-pp-pitch]);
-   }
-   for (i=0;i<nsf;i++)
-   {
-      spx_word32_t tmp = ADD32(ADD32(MULT16_16(gain[0],x[2][i]),MULT16_16(gain[1],x[1][i])),
-                            MULT16_16(gain[2],x[0][i]));
-      new_target[i] = SUB16(new_target[i], EXTRACT16(PSHR32(tmp,6)));
-   }
-   err = inner_prod(new_target, new_target, nsf);
-
-   return err;
-}
-
-/** Finds the best quantized 3-tap pitch predictor by analysis by synthesis */
-int pitch_search_3tap(
-spx_word16_t target[],                 /* Target vector */
-spx_word16_t *sw,
-spx_coef_t ak[],                     /* LPCs for this subframe */
-spx_coef_t awk1[],                   /* Weighted LPCs #1 for this subframe */
-spx_coef_t awk2[],                   /* Weighted LPCs #2 for this subframe */
-spx_sig_t exc[],                    /* Excitation */
-const void *par,
-int   start,                    /* Smallest pitch value allowed */
-int   end,                      /* Largest pitch value allowed */
-spx_word16_t pitch_coef,               /* Voicing (pitch) coefficient */
-int   p,                        /* Number of LPC coeffs */
-int   nsf,                      /* Number of samples in subframe */
-SpeexBits *bits,
-char *stack,
-spx_word16_t *exc2,
-spx_word16_t *r,
-int complexity,
-int cdbk_offset,
-int plc_tuning,
-spx_word32_t *cumul_gain
-)
-{
-   int i;
-   int cdbk_index, pitch=0, best_gain_index=0;
-   VARDECL(spx_sig_t *best_exc);
-   VARDECL(spx_word16_t *new_target);
-   VARDECL(spx_word16_t *best_target);
-   int best_pitch=0;
-   spx_word32_t err, best_err=-1;
-   int N;
-   const ltp_params *params;
-   const signed char *gain_cdbk;
-   int   gain_cdbk_size;
-   int scaledown=0;
-         
-   VARDECL(int *nbest);
-   
-   params = (const ltp_params*) par;
-   gain_cdbk_size = 1<<params->gain_bits;
-   gain_cdbk = params->gain_cdbk + 4*gain_cdbk_size*cdbk_offset;
-   
-   N=complexity;
-   if (N>10)
-      N=10;
-   if (N<1)
-      N=1;
-
-   ALLOC(nbest, N, int);
-   params = (const ltp_params*) par;
-
-   if (end<start)
-   {
-      speex_bits_pack(bits, 0, params->pitch_bits);
-      speex_bits_pack(bits, 0, params->gain_bits);
-      SPEEX_MEMSET(exc, 0, nsf);
-      return start;
-   }
-   
-#ifdef FIXED_POINT
-   /* Check if we need to scale everything down in the pitch search to avoid overflows */
-   for (i=0;i<nsf;i++)
-   {
-      if (ABS16(target[i])>16383)
-      {
-         scaledown=1;
-         break;
-      }
-   }
-   for (i=-end;i<nsf;i++)
-   {
-      if (ABS16(exc2[i])>16383)
-      {
-         scaledown=1;
-         break;
-      }
-   }
-#endif
-   if (N>end-start+1)
-      N=end-start+1;
-   if (end != start)
-      open_loop_nbest_pitch(sw, start, end, nsf, nbest, NULL, N, stack);
-   else
-      nbest[0] = start;
-   
-   ALLOC(best_exc, nsf, spx_sig_t);
-   ALLOC(new_target, nsf, spx_word16_t);
-   ALLOC(best_target, nsf, spx_word16_t);
-   
-   for (i=0;i<N;i++)
-   {
-      pitch=nbest[i];
-      SPEEX_MEMSET(exc, 0, nsf);
-      err=pitch_gain_search_3tap(target, ak, awk1, awk2, exc, gain_cdbk, gain_cdbk_size, pitch, p, nsf,
-                                 bits, stack, exc2, r, new_target, &cdbk_index, plc_tuning, *cumul_gain, scaledown);
-      if (err<best_err || best_err<0)
-      {
-         SPEEX_COPY(best_exc, exc, nsf);
-         SPEEX_COPY(best_target, new_target, nsf);
-         best_err=err;
-         best_pitch=pitch;
-         best_gain_index=cdbk_index;
-      }
-   }
-   /*printf ("pitch: %d %d\n", best_pitch, best_gain_index);*/
-   speex_bits_pack(bits, best_pitch-start, params->pitch_bits);
-   speex_bits_pack(bits, best_gain_index, params->gain_bits);
-#ifdef FIXED_POINT
-   *cumul_gain = MULT16_32_Q13(SHL16(params->gain_cdbk[4*best_gain_index+3],8), MAX32(1024,*cumul_gain));
-#else
-   *cumul_gain = 0.03125*MAX32(1024,*cumul_gain)*params->gain_cdbk[4*best_gain_index+3];
-#endif
-   /*printf ("%f\n", cumul_gain);*/
-   /*printf ("encode pitch: %d %d\n", best_pitch, best_gain_index);*/
-   SPEEX_COPY(exc, best_exc, nsf);
-   SPEEX_COPY(target, best_target, nsf);
-#ifdef FIXED_POINT
-   /* Scale target back up if needed */
-   if (scaledown)
-   {
-      for (i=0;i<nsf;i++)
-         target[i]=SHL16(target[i],1);
-   }
-#endif
-   return pitch;
-}
-
-void pitch_unquant_3tap(
-spx_word16_t exc[],             /* Input excitation */
-spx_word32_t exc_out[],         /* Output excitation */
-int   start,                    /* Smallest pitch value allowed */
-int   end,                      /* Largest pitch value allowed */
-spx_word16_t pitch_coef,        /* Voicing (pitch) coefficient */
-const void *par,
-int   nsf,                      /* Number of samples in subframe */
-int *pitch_val,
-spx_word16_t *gain_val,
-SpeexBits *bits,
-char *stack,
-int count_lost,
-int subframe_offset,
-spx_word16_t last_pitch_gain,
-int cdbk_offset
-)
-{
-   int i;
-   int pitch;
-   int gain_index;
-   spx_word16_t gain[3];
-   const signed char *gain_cdbk;
-   int gain_cdbk_size;
-   const ltp_params *params;
-
-   params = (const ltp_params*) par;
-   gain_cdbk_size = 1<<params->gain_bits;
-   gain_cdbk = params->gain_cdbk + 4*gain_cdbk_size*cdbk_offset;
-
-   pitch = speex_bits_unpack_unsigned(bits, params->pitch_bits);
-   pitch += start;
-   gain_index = speex_bits_unpack_unsigned(bits, params->gain_bits);
-   /*printf ("decode pitch: %d %d\n", pitch, gain_index);*/
-#ifdef FIXED_POINT
-   gain[0] = ADD16(32,(spx_word16_t)gain_cdbk[gain_index*4]);
-   gain[1] = ADD16(32,(spx_word16_t)gain_cdbk[gain_index*4+1]);
-   gain[2] = ADD16(32,(spx_word16_t)gain_cdbk[gain_index*4+2]);
-#else
-   gain[0] = 0.015625*gain_cdbk[gain_index*4]+.5;
-   gain[1] = 0.015625*gain_cdbk[gain_index*4+1]+.5;
-   gain[2] = 0.015625*gain_cdbk[gain_index*4+2]+.5;
-#endif
-
-   if (count_lost && pitch > subframe_offset)
-   {
-      spx_word16_t gain_sum;
-      if (1) {
-#ifdef FIXED_POINT
-         spx_word16_t tmp = count_lost < 4 ? last_pitch_gain : SHR16(last_pitch_gain,1);
-         if (tmp>62)
-            tmp=62;
-#else
-         spx_word16_t tmp = count_lost < 4 ? last_pitch_gain : 0.5 * last_pitch_gain;
-         if (tmp>.95)
-            tmp=.95;
-#endif
-         gain_sum = gain_3tap_to_1tap(gain);
-
-         if (gain_sum > tmp)
-         {
-            spx_word16_t fact = DIV32_16(SHL32(EXTEND32(tmp),14),gain_sum);
-            for (i=0;i<3;i++)
-               gain[i]=MULT16_16_Q14(fact,gain[i]);
-         }
-
-      }
-
-   }
-
-   *pitch_val = pitch;
-   gain_val[0]=gain[0];
-   gain_val[1]=gain[1];
-   gain_val[2]=gain[2];
-   gain[0] = SHL16(gain[0],7);
-   gain[1] = SHL16(gain[1],7);
-   gain[2] = SHL16(gain[2],7);
-   SPEEX_MEMSET(exc_out, 0, nsf);
-   for (i=0;i<3;i++)
-   {
-      int j;
-      int tmp1, tmp3;
-      int pp=pitch+1-i;
-      tmp1=nsf;
-      if (tmp1>pp)
-         tmp1=pp;
-      for (j=0;j<tmp1;j++)
-         exc_out[j]=MAC16_16(exc_out[j],gain[2-i],exc[j-pp]);
-      tmp3=nsf;
-      if (tmp3>pp+pitch)
-         tmp3=pp+pitch;
-      for (j=tmp1;j<tmp3;j++)
-         exc_out[j]=MAC16_16(exc_out[j],gain[2-i],exc[j-pp-pitch]);
-   }
-   /*for (i=0;i<nsf;i++)
-   exc[i]=PSHR32(exc32[i],13);*/
-}
-
-
-/** Forced pitch delay and gain */
-int forced_pitch_quant(
-spx_word16_t target[],                 /* Target vector */
-spx_word16_t *sw,
-spx_coef_t ak[],                     /* LPCs for this subframe */
-spx_coef_t awk1[],                   /* Weighted LPCs #1 for this subframe */
-spx_coef_t awk2[],                   /* Weighted LPCs #2 for this subframe */
-spx_sig_t exc[],                    /* Excitation */
-const void *par,
-int   start,                    /* Smallest pitch value allowed */
-int   end,                      /* Largest pitch value allowed */
-spx_word16_t pitch_coef,               /* Voicing (pitch) coefficient */
-int   p,                        /* Number of LPC coeffs */
-int   nsf,                      /* Number of samples in subframe */
-SpeexBits *bits,
-char *stack,
-spx_word16_t *exc2,
-spx_word16_t *r,
-int complexity,
-int cdbk_offset,
-int plc_tuning,
-spx_word32_t *cumul_gain
-)
-{
-   int i;
-   VARDECL(spx_word16_t *res);
-   ALLOC(res, nsf, spx_word16_t);
-#ifdef FIXED_POINT
-   if (pitch_coef>63)
-      pitch_coef=63;
-#else
-   if (pitch_coef>.99)
-      pitch_coef=.99;
-#endif
-   for (i=0;i<nsf&&i<start;i++)
-   {
-      exc[i]=MULT16_16(SHL16(pitch_coef, 7),exc2[i-start]);
-   }
-   for (;i<nsf;i++)
-   {
-      exc[i]=MULT16_32_Q15(SHL16(pitch_coef, 9),exc[i-start]);
-   }
-   for (i=0;i<nsf;i++)
-      res[i] = EXTRACT16(PSHR32(exc[i], SIG_SHIFT-1));
-   syn_percep_zero16(res, ak, awk1, awk2, res, nsf, p, stack);
-   for (i=0;i<nsf;i++)
-      target[i]=EXTRACT16(SATURATE(SUB32(EXTEND32(target[i]),EXTEND32(res[i])),32700));
-   return start;
-}
-
-/** Unquantize forced pitch delay and gain */
-void forced_pitch_unquant(
-spx_word16_t exc[],             /* Input excitation */
-spx_word32_t exc_out[],         /* Output excitation */
-int   start,                    /* Smallest pitch value allowed */
-int   end,                      /* Largest pitch value allowed */
-spx_word16_t pitch_coef,        /* Voicing (pitch) coefficient */
-const void *par,
-int   nsf,                      /* Number of samples in subframe */
-int *pitch_val,
-spx_word16_t *gain_val,
-SpeexBits *bits,
-char *stack,
-int count_lost,
-int subframe_offset,
-spx_word16_t last_pitch_gain,
-int cdbk_offset
-)
-{
-   int i;
-#ifdef FIXED_POINT
-   if (pitch_coef>63)
-      pitch_coef=63;
-#else
-   if (pitch_coef>.99)
-      pitch_coef=.99;
-#endif
-   for (i=0;i<nsf;i++)
-   {
-      exc_out[i]=MULT16_16(exc[i-start],SHL16(pitch_coef,7));
-      exc[i] = EXTRACT16(PSHR32(exc_out[i],13));
-   }
-   *pitch_val = start;
-   gain_val[0]=gain_val[2]=0;
-   gain_val[1] = pitch_coef;
-}
diff --git a/libspeex/ltp.h b/libspeex/ltp.h
deleted file mode 100644
index 1e435bc..0000000
--- a/libspeex/ltp.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin */
-/**
-   @file ltp.h
-   @brief Long-Term Prediction functions
-*/
-/*
-   Redistribution and use in source and binary forms, with or without
-   modification, 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 the Xiph.org Foundation nor the names of its
-   contributors may be used to endorse or promote products derived from
-   this software without specific prior written permission.
-   
-   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 FOUNDATION 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 <speex/speex_bits.h>
-#include "arch.h"
-
-/** LTP parameters. */
-typedef struct {
-   const signed char *gain_cdbk;
-   int     gain_bits;
-   int     pitch_bits;
-} ltp_params;
-
-#ifdef FIXED_POINT
-#define gain_3tap_to_1tap(g) (ABS(g[1]) + (g[0]>0 ? g[0] : -SHR16(g[0],1)) + (g[2]>0 ? g[2] : -SHR16(g[2],1)))
-#else
-#define gain_3tap_to_1tap(g) (ABS(g[1]) + (g[0]>0 ? g[0] : -.5*g[0]) + (g[2]>0 ? g[2] : -.5*g[2]))
-#endif
-
-spx_word32_t inner_prod(const spx_word16_t *x, const spx_word16_t *y, int len);
-void pitch_xcorr(const spx_word16_t *_x, const spx_word16_t *_y, spx_word32_t *corr, int len, int nb_pitch, char *stack);
-
-void open_loop_nbest_pitch(spx_word16_t *sw, int start, int end, int len, int *pitch, spx_word16_t *gain, int N, char *stack);
-
-
-/** Finds the best quantized 3-tap pitch predictor by analysis by synthesis */
-int pitch_search_3tap(
-spx_word16_t target[],                 /* Target vector */
-spx_word16_t *sw,
-spx_coef_t ak[],                     /* LPCs for this subframe */
-spx_coef_t awk1[],                   /* Weighted LPCs #1 for this subframe */
-spx_coef_t awk2[],                   /* Weighted LPCs #2 for this subframe */
-spx_sig_t exc[],                    /* Overlapping codebook */
-const void *par,
-int   start,                    /* Smallest pitch value allowed */
-int   end,                      /* Largest pitch value allowed */
-spx_word16_t pitch_coef,               /* Voicing (pitch) coefficient */
-int   p,                        /* Number of LPC coeffs */
-int   nsf,                      /* Number of samples in subframe */
-SpeexBits *bits,
-char *stack,
-spx_word16_t *exc2,
-spx_word16_t *r,
-int   complexity,
-int   cdbk_offset,
-int plc_tuning,
-spx_word32_t *cumul_gain
-);
-
-/*Unquantize adaptive codebook and update pitch contribution*/
-void pitch_unquant_3tap(
-spx_word16_t exc[],             /* Input excitation */
-spx_word32_t exc_out[],         /* Output excitation */
-int   start,                    /* Smallest pitch value allowed */
-int   end,                      /* Largest pitch value allowed */
-spx_word16_t pitch_coef,        /* Voicing (pitch) coefficient */
-const void *par,
-int   nsf,                      /* Number of samples in subframe */
-int *pitch_val,
-spx_word16_t *gain_val,
-SpeexBits *bits,
-char *stack,
-int lost,
-int subframe_offset,
-spx_word16_t last_pitch_gain,
-int cdbk_offset
-);
-
-/** Forced pitch delay and gain */
-int forced_pitch_quant(
-spx_word16_t target[],                 /* Target vector */
-spx_word16_t *sw,
-spx_coef_t ak[],                     /* LPCs for this subframe */
-spx_coef_t awk1[],                   /* Weighted LPCs #1 for this subframe */
-spx_coef_t awk2[],                   /* Weighted LPCs #2 for this subframe */
-spx_sig_t exc[],                    /* Excitation */
-const void *par,
-int   start,                    /* Smallest pitch value allowed */
-int   end,                      /* Largest pitch value allowed */
-spx_word16_t pitch_coef,               /* Voicing (pitch) coefficient */
-int   p,                        /* Number of LPC coeffs */
-int   nsf,                      /* Number of samples in subframe */
-SpeexBits *bits,
-char *stack,
-spx_word16_t *exc2,
-spx_word16_t *r,
-int complexity,
-int cdbk_offset,
-int plc_tuning,
-spx_word32_t *cumul_gain
-);
-
-/** Unquantize forced pitch delay and gain */
-void forced_pitch_unquant(
-spx_word16_t exc[],             /* Input excitation */
-spx_word32_t exc_out[],         /* Output excitation */
-int   start,                    /* Smallest pitch value allowed */
-int   end,                      /* Largest pitch value allowed */
-spx_word16_t pitch_coef,        /* Voicing (pitch) coefficient */
-const void *par,
-int   nsf,                      /* Number of samples in subframe */
-int *pitch_val,
-spx_word16_t *gain_val,
-SpeexBits *bits,
-char *stack,
-int lost,
-int subframe_offset,
-spx_word16_t last_pitch_gain,
-int cdbk_offset
-);
diff --git a/libspeex/math_approx.h b/libspeex/math_approx.h
deleted file mode 100644
index 9ca8307..0000000
--- a/libspeex/math_approx.h
+++ /dev/null
@@ -1,332 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin */
-/**
-   @file math_approx.h
-   @brief Various math approximation functions for Speex
-*/
-/*
-   Redistribution and use in source and binary forms, with or without
-   modification, 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 the Xiph.org Foundation nor the names of its
-   contributors may be used to endorse or promote products derived from
-   this software without specific prior written permission.
-   
-   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 FOUNDATION OR
-   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef MATH_APPROX_H
-#define MATH_APPROX_H
-
-#include "arch.h"
-
-#ifndef FIXED_POINT
-
-#define spx_sqrt sqrt
-#define spx_acos acos
-#define spx_exp exp
-#define spx_cos_norm(x) (cos((.5f*M_PI)*(x)))
-#define spx_atan atan
-
-/** Generate a pseudo-random number */
-static inline spx_word16_t speex_rand(spx_word16_t std, spx_int32_t *seed)
-{
-   const unsigned int jflone = 0x3f800000;
-   const unsigned int jflmsk = 0x007fffff;
-   union {int i; float f;} ran;
-   *seed = 1664525 * *seed + 1013904223;
-   ran.i = jflone | (jflmsk & *seed);
-   ran.f -= 1.5;
-   return 3.4642*std*ran.f;
-}
-
-
-#endif
-
-
-static inline spx_int16_t spx_ilog2(spx_uint32_t x)
-{
-   int r=0;
-   if (x>=(spx_int32_t)65536)
-   {
-      x >>= 16;
-      r += 16;
-   }
-   if (x>=256)
-   {
-      x >>= 8;
-      r += 8;
-   }
-   if (x>=16)
-   {
-      x >>= 4;
-      r += 4;
-   }
-   if (x>=4)
-   {
-      x >>= 2;
-      r += 2;
-   }
-   if (x>=2)
-   {
-      r += 1;
-   }
-   return r;
-}
-
-static inline spx_int16_t spx_ilog4(spx_uint32_t x)
-{
-   int r=0;
-   if (x>=(spx_int32_t)65536)
-   {
-      x >>= 16;
-      r += 8;
-   }
-   if (x>=256)
-   {
-      x >>= 8;
-      r += 4;
-   }
-   if (x>=16)
-   {
-      x >>= 4;
-      r += 2;
-   }
-   if (x>=4)
-   {
-      r += 1;
-   }
-   return r;
-}
-
-#ifdef FIXED_POINT
-
-/** Generate a pseudo-random number */
-static inline spx_word16_t speex_rand(spx_word16_t std, spx_int32_t *seed)
-{
-   spx_word32_t res;
-   *seed = 1664525 * *seed + 1013904223;
-   res = MULT16_16(EXTRACT16(SHR32(*seed,16)),std);
-   return EXTRACT16(PSHR32(SUB32(res, SHR32(res, 3)),14));
-}
-
-/* sqrt(x) ~= 0.22178 + 1.29227*x - 0.77070*x^2 + 0.25723*x^3 (for .25 < x < 1) */
-/*#define C0 3634
-#define C1 21173
-#define C2 -12627
-#define C3 4215*/
-
-/* sqrt(x) ~= 0.22178 + 1.29227*x - 0.77070*x^2 + 0.25659*x^3 (for .25 < x < 1) */
-#define C0 3634
-#define C1 21173
-#define C2 -12627
-#define C3 4204
-
-static inline spx_word16_t spx_sqrt(spx_word32_t x)
-{
-   int k;
-   spx_word32_t rt;
-   k = spx_ilog4(x)-6;
-   x = VSHR32(x, (k<<1));
-   rt = ADD16(C0, MULT16_16_Q14(x, ADD16(C1, MULT16_16_Q14(x, ADD16(C2, MULT16_16_Q14(x, (C3)))))));
-   rt = VSHR32(rt,7-k);
-   return rt;
-}
-
-/* log(x) ~= -2.18151 + 4.20592*x - 2.88938*x^2 + 0.86535*x^3 (for .5 < x < 1) */
-
-
-#define A1 16469
-#define A2 2242
-#define A3 1486
-
-static inline spx_word16_t spx_acos(spx_word16_t x)
-{
-   int s=0;
-   spx_word16_t ret;
-   spx_word16_t sq;
-   if (x<0)
-   {
-      s=1;
-      x = NEG16(x);
-   }
-   x = SUB16(16384,x);
-   
-   x = x >> 1;
-   sq = MULT16_16_Q13(x, ADD16(A1, MULT16_16_Q13(x, ADD16(A2, MULT16_16_Q13(x, (A3))))));
-   ret = spx_sqrt(SHL32(EXTEND32(sq),13));
-   
-   /*ret = spx_sqrt(67108864*(-1.6129e-04 + 2.0104e+00*f + 2.7373e-01*f*f + 1.8136e-01*f*f*f));*/
-   if (s)
-      ret = SUB16(25736,ret);
-   return ret;
-}
-
-
-#define K1 8192
-#define K2 -4096
-#define K3 340
-#define K4 -10
-
-static inline spx_word16_t spx_cos(spx_word16_t x)
-{
-   spx_word16_t x2;
-
-   if (x<12868)
-   {
-      x2 = MULT16_16_P13(x,x);
-      return ADD32(K1, MULT16_16_P13(x2, ADD32(K2, MULT16_16_P13(x2, ADD32(K3, MULT16_16_P13(K4, x2))))));
-   } else {
-      x = SUB16(25736,x);
-      x2 = MULT16_16_P13(x,x);
-      return SUB32(-K1, MULT16_16_P13(x2, ADD32(K2, MULT16_16_P13(x2, ADD32(K3, MULT16_16_P13(K4, x2))))));
-   }
-}
-
-#define L1 32767
-#define L2 -7651
-#define L3 8277
-#define L4 -626
-
-static inline spx_word16_t _spx_cos_pi_2(spx_word16_t x)
-{
-   spx_word16_t x2;
-   
-   x2 = MULT16_16_P15(x,x);
-   return ADD16(1,MIN16(32766,ADD32(SUB16(L1,x2), MULT16_16_P15(x2, ADD32(L2, MULT16_16_P15(x2, ADD32(L3, MULT16_16_P15(L4, x2))))))));
-}
-
-static inline spx_word16_t spx_cos_norm(spx_word32_t x)
-{
-   x = x&0x0001ffff;
-   if (x>SHL32(EXTEND32(1), 16))
-      x = SUB32(SHL32(EXTEND32(1), 17),x);
-   if (x&0x00007fff)
-   {
-      if (x<SHL32(EXTEND32(1), 15))
-      {
-         return _spx_cos_pi_2(EXTRACT16(x));
-      } else {
-         return NEG32(_spx_cos_pi_2(EXTRACT16(65536-x)));
-      }
-   } else {
-      if (x&0x0000ffff)
-         return 0;
-      else if (x&0x0001ffff)
-         return -32767;
-      else
-         return 32767;
-   }
-}
-
-/*
- K0 = 1
- K1 = log(2)
- K2 = 3-4*log(2)
- K3 = 3*log(2) - 2
-*/
-#define D0 16384
-#define D1 11356
-#define D2 3726
-#define D3 1301
-/* Input in Q11 format, output in Q16 */
-static inline spx_word32_t spx_exp2(spx_word16_t x)
-{
-   int integer;
-   spx_word16_t frac;
-   integer = SHR16(x,11);
-   if (integer>14)
-      return 0x7fffffff;
-   else if (integer < -15)
-      return 0;
-   frac = SHL16(x-SHL16(integer,11),3);
-   frac = ADD16(D0, MULT16_16_Q14(frac, ADD16(D1, MULT16_16_Q14(frac, ADD16(D2 , MULT16_16_Q14(D3,frac))))));
-   return VSHR32(EXTEND32(frac), -integer-2);
-}
-
-/* Input in Q11 format, output in Q16 */
-static inline spx_word32_t spx_exp(spx_word16_t x)
-{
-   if (x>21290)
-      return 0x7fffffff;
-   else if (x<-21290)
-      return 0;
-   else
-      return spx_exp2(MULT16_16_P14(23637,x));
-}
-#define M1 32767
-#define M2 -21
-#define M3 -11943
-#define M4 4936
-
-static inline spx_word16_t spx_atan01(spx_word16_t x)
-{
-   return MULT16_16_P15(x, ADD32(M1, MULT16_16_P15(x, ADD32(M2, MULT16_16_P15(x, ADD32(M3, MULT16_16_P15(M4, x)))))));
-}
-
-#undef M1
-#undef M2
-#undef M3
-#undef M4
-
-/* Input in Q15, output in Q14 */
-static inline spx_word16_t spx_atan(spx_word32_t x)
-{
-   if (x <= 32767)
-   {
-      return SHR16(spx_atan01(x),1);
-   } else {
-      int e = spx_ilog2(x);
-      if (e>=29)
-         return 25736;
-      x = DIV32_16(SHL32(EXTEND32(32767),29-e), EXTRACT16(SHR32(x, e-14)));
-      return SUB16(25736, SHR16(spx_atan01(x),1));
-   }
-}
-#else
-
-#ifndef M_PI
-#define M_PI           3.14159265358979323846  /* pi */
-#endif
-
-#define C1 0.9999932946f
-#define C2 -0.4999124376f
-#define C3 0.0414877472f
-#define C4 -0.0012712095f
-
-
-#define SPX_PI_2 1.5707963268
-static inline spx_word16_t spx_cos(spx_word16_t x)
-{
-   if (x<SPX_PI_2)
-   {
-      x *= x;
-      return C1 + x*(C2+x*(C3+C4*x));
-   } else {
-      x = M_PI-x;
-      x *= x;
-      return NEG16(C1 + x*(C2+x*(C3+C4*x)));
-   }
-}
-
-#endif
-
-
-#endif
diff --git a/libspeex/modes.c b/libspeex/modes.c
deleted file mode 100644
index e10a32e..0000000
--- a/libspeex/modes.c
+++ /dev/null
@@ -1,366 +0,0 @@
-/* Copyright (C) 2002-2006 Jean-Marc Valin 
-   File: modes.c
-
-   Describes the different modes of the codec
-
-   Redistribution and use in source and binary forms, with or without
-   modification, 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 the Xiph.org Foundation nor the names of its
-   contributors may be used to endorse or promote products derived from
-   this software without specific prior written permission.
-   
-   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 FOUNDATION 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.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "modes.h"
-#include "ltp.h"
-#include "quant_lsp.h"
-#include "cb_search.h"
-#include "sb_celp.h"
-#include "nb_celp.h"
-#include "vbr.h"
-#include "arch.h"
-#include <math.h>
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-
-/* Extern declarations for all codebooks we use here */
-extern const signed char gain_cdbk_nb[];
-extern const signed char gain_cdbk_lbr[];
-extern const signed char exc_5_256_table[];
-extern const signed char exc_5_64_table[];
-extern const signed char exc_8_128_table[];
-extern const signed char exc_10_32_table[];
-extern const signed char exc_10_16_table[];
-extern const signed char exc_20_32_table[];
-
-
-/* Parameters for Long-Term Prediction (LTP)*/
-static const ltp_params ltp_params_nb = {
-   gain_cdbk_nb,
-   7,
-   7
-};
-
-/* Parameters for Long-Term Prediction (LTP)*/
-static const ltp_params ltp_params_vlbr = {
-   gain_cdbk_lbr,
-   5,
-   0
-};
-
-/* Parameters for Long-Term Prediction (LTP)*/
-static const ltp_params ltp_params_lbr = {
-   gain_cdbk_lbr,
-   5,
-   7
-};
-
-/* Parameters for Long-Term Prediction (LTP)*/
-static const ltp_params ltp_params_med = {
-   gain_cdbk_lbr,
-   5,
-   7
-};
-
-/* Split-VQ innovation parameters for very low bit-rate narrowband */
-static const split_cb_params split_cb_nb_vlbr = {
-   10,               /*subvect_size*/
-   4,               /*nb_subvect*/
-   exc_10_16_table, /*shape_cb*/
-   4,               /*shape_bits*/
-   0,
-};
-
-/* Split-VQ innovation parameters for very low bit-rate narrowband */
-static const split_cb_params split_cb_nb_ulbr = {
-   20,               /*subvect_size*/
-   2,               /*nb_subvect*/
-   exc_20_32_table, /*shape_cb*/
-   5,               /*shape_bits*/
-   0,
-};
-
-/* Split-VQ innovation parameters for low bit-rate narrowband */
-static const split_cb_params split_cb_nb_lbr = {
-   10,              /*subvect_size*/
-   4,               /*nb_subvect*/
-   exc_10_32_table, /*shape_cb*/
-   5,               /*shape_bits*/
-   0,
-};
-
-
-/* Split-VQ innovation parameters narrowband */
-static const split_cb_params split_cb_nb = {
-   5,               /*subvect_size*/
-   8,               /*nb_subvect*/
-   exc_5_64_table, /*shape_cb*/
-   6,               /*shape_bits*/
-   0,
-};
-
-/* Split-VQ innovation parameters narrowband */
-static const split_cb_params split_cb_nb_med = {
-   8,               /*subvect_size*/
-   5,               /*nb_subvect*/
-   exc_8_128_table, /*shape_cb*/
-   7,               /*shape_bits*/
-   0,
-};
-
-/* Split-VQ innovation for low-band wideband */
-static const split_cb_params split_cb_sb = {
-   5,               /*subvect_size*/
-   8,              /*nb_subvect*/
-   exc_5_256_table,    /*shape_cb*/
-   8,               /*shape_bits*/
-   0,
-};
-
-
-
-/* 2150 bps "vocoder-like" mode for comfort noise */
-static const SpeexSubmode nb_submode1 = {
-   0,
-   1,
-   0,
-   0,
-   /* LSP quantization */
-   lsp_quant_lbr,
-   lsp_unquant_lbr,
-   /* No pitch quantization */
-   forced_pitch_quant,
-   forced_pitch_unquant,
-   NULL,
-   /* No innovation quantization (noise only) */
-   noise_codebook_quant,
-   noise_codebook_unquant,
-   NULL,
-   -1,
-   43
-};
-
-/* 3.95 kbps very low bit-rate mode */
-static const SpeexSubmode nb_submode8 = {
-   0,
-   1,
-   0,
-   0,
-   /*LSP quantization*/
-   lsp_quant_lbr,
-   lsp_unquant_lbr,
-   /*No pitch quantization*/
-   forced_pitch_quant,
-   forced_pitch_unquant,
-   NULL,
-   /*Innovation quantization*/
-   split_cb_search_shape_sign,
-   split_cb_shape_sign_unquant,
-   &split_cb_nb_ulbr,
-   QCONST16(.5,15),
-   79
-};
-
-/* 5.95 kbps very low bit-rate mode */
-static const SpeexSubmode nb_submode2 = {
-   0,
-   0,
-   0,
-   0,
-   /*LSP quantization*/
-   lsp_quant_lbr,
-   lsp_unquant_lbr,
-   /*No pitch quantization*/
-   pitch_search_3tap,
-   pitch_unquant_3tap,
-   &ltp_params_vlbr,
-   /*Innovation quantization*/
-   split_cb_search_shape_sign,
-   split_cb_shape_sign_unquant,
-   &split_cb_nb_vlbr,
-   QCONST16(.6,15),
-   119
-};
-
-/* 8 kbps low bit-rate mode */
-static const SpeexSubmode nb_submode3 = {
-   -1,
-   0,
-   1,
-   0,
-   /*LSP quantization*/
-   lsp_quant_lbr,
-   lsp_unquant_lbr,
-   /*Pitch quantization*/
-   pitch_search_3tap,
-   pitch_unquant_3tap,
-   &ltp_params_lbr,
-   /*Innovation quantization*/
-   split_cb_search_shape_sign,
-   split_cb_shape_sign_unquant,
-   &split_cb_nb_lbr,
-   QCONST16(.55,15),
-   160
-};
-
-/* 11 kbps medium bit-rate mode */
-static const SpeexSubmode nb_submode4 = {
-   -1,
-   0,
-   1,
-   0,
-   /*LSP quantization*/
-   lsp_quant_lbr,
-   lsp_unquant_lbr,
-   /*Pitch quantization*/
-   pitch_search_3tap,
-   pitch_unquant_3tap,
-   &ltp_params_med,
-   /*Innovation quantization*/
-   split_cb_search_shape_sign,
-   split_cb_shape_sign_unquant,
-   &split_cb_nb_med,
-   QCONST16(.45,15),
-   220
-};
-
-/* 15 kbps high bit-rate mode */
-static const SpeexSubmode nb_submode5 = {
-   -1,
-   0,
-   3,
-   0,
-   /*LSP quantization*/
-   lsp_quant_nb,
-   lsp_unquant_nb,
-   /*Pitch quantization*/
-   pitch_search_3tap,
-   pitch_unquant_3tap,
-   &ltp_params_nb,
-   /*Innovation quantization*/
-   split_cb_search_shape_sign,
-   split_cb_shape_sign_unquant,
-   &split_cb_nb,
-   QCONST16(.3,15),
-   300
-};
-
-/* 18.2 high bit-rate mode */
-static const SpeexSubmode nb_submode6 = {
-   -1,
-   0,
-   3,
-   0,
-   /*LSP quantization*/
-   lsp_quant_nb,
-   lsp_unquant_nb,
-   /*Pitch quantization*/
-   pitch_search_3tap,
-   pitch_unquant_3tap,
-   &ltp_params_nb,
-   /*Innovation quantization*/
-   split_cb_search_shape_sign,
-   split_cb_shape_sign_unquant,
-   &split_cb_sb,
-   QCONST16(.2,15),
-   364
-};
-
-/* 24.6 kbps high bit-rate mode */
-static const SpeexSubmode nb_submode7 = {
-   -1,
-   0,
-   3,
-   1,
-   /*LSP quantization*/
-   lsp_quant_nb,
-   lsp_unquant_nb,
-   /*Pitch quantization*/
-   pitch_search_3tap,
-   pitch_unquant_3tap,
-   &ltp_params_nb,
-   /*Innovation quantization*/
-   split_cb_search_shape_sign,
-   split_cb_shape_sign_unquant,
-   &split_cb_nb,
-   QCONST16(.1,15),
-   492
-};
-
-
-/* Default mode for narrowband */
-static const SpeexNBMode nb_mode = {
-   160,    /*frameSize*/
-   40,     /*subframeSize*/
-   10,     /*lpcSize*/
-   17,     /*pitchStart*/
-   144,    /*pitchEnd*/
-#ifdef FIXED_POINT
-   29491, 19661, /* gamma1, gamma2 */
-#else
-   0.9, 0.6, /* gamma1, gamma2 */
-#endif
-   QCONST16(.0002,15), /*lpc_floor*/
-   {NULL, &nb_submode1, &nb_submode2, &nb_submode3, &nb_submode4, &nb_submode5, &nb_submode6, &nb_submode7,
-   &nb_submode8, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
-   5,
-   {1, 8, 2, 3, 3, 4, 4, 5, 5, 6, 7}
-};
-
-
-/* Default mode for narrowband */
-EXPORT const SpeexMode speex_nb_mode = {
-   &nb_mode,
-   nb_mode_query,
-   "narrowband",
-   0,
-   4,
-   &nb_encoder_init,
-   &nb_encoder_destroy,
-   &nb_encode,
-   &nb_decoder_init,
-   &nb_decoder_destroy,
-   &nb_decode,
-   &nb_encoder_ctl,
-   &nb_decoder_ctl,
-};
-
-
-
-EXPORT int speex_mode_query(const SpeexMode *mode, int request, void *ptr)
-{
-   return mode->query(mode->mode, request, ptr);
-}
-
-#ifdef FIXED_DEBUG
-long long spx_mips=0;
-#endif
-
diff --git a/libspeex/modes.h b/libspeex/modes.h
deleted file mode 100644
index 26e2d86..0000000
--- a/libspeex/modes.h
+++ /dev/null
@@ -1,161 +0,0 @@
-/* Copyright (C) 2002-2006 Jean-Marc Valin */
-/**
-   @file modes.h
-   @brief Describes the different modes of the codec
-*/
-/*
-   Redistribution and use in source and binary forms, with or without
-   modification, 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 the Xiph.org Foundation nor the names of its
-   contributors may be used to endorse or promote products derived from
-   this software without specific prior written permission.
-   
-   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 FOUNDATION OR
-   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-*/
-
-#ifndef MODES_H
-#define MODES_H
-
-#include <speex/speex.h>
-#include <speex/speex_bits.h>
-#include "arch.h"
-
-#define NB_SUBMODES 16
-#define NB_SUBMODE_BITS 4
-
-#define SB_SUBMODES 8
-#define SB_SUBMODE_BITS 3
-
-/* Used internally, NOT TO BE USED in applications */
-/** Used internally*/
-#define SPEEX_GET_PI_GAIN 100
-/** Used internally*/
-#define SPEEX_GET_EXC     101
-/** Used internally*/
-#define SPEEX_GET_INNOV   102
-/** Used internally*/
-#define SPEEX_GET_DTX_STATUS   103
-/** Used internally*/
-#define SPEEX_SET_INNOVATION_SAVE   104
-/** Used internally*/
-#define SPEEX_SET_WIDEBAND   105
-
-/** Used internally*/
-#define SPEEX_GET_STACK   106
-
-
-/** Quantizes LSPs */
-typedef void (*lsp_quant_func)(spx_lsp_t *, spx_lsp_t *, int, SpeexBits *);
-
-/** Decodes quantized LSPs */
-typedef void (*lsp_unquant_func)(spx_lsp_t *, int, SpeexBits *);
-
-
-/** Long-term predictor quantization */
-typedef int (*ltp_quant_func)(spx_word16_t *, spx_word16_t *, spx_coef_t *, spx_coef_t *, 
-                              spx_coef_t *, spx_sig_t *, const void *, int, int, spx_word16_t, 
-                              int, int, SpeexBits*, char *, spx_word16_t *, spx_word16_t *, int, int, int, spx_word32_t *);
-
-/** Long-term un-quantize */
-typedef void (*ltp_unquant_func)(spx_word16_t *, spx_word32_t *, int, int, spx_word16_t, const void *, int, int *,
-                                 spx_word16_t *, SpeexBits*, char*, int, int, spx_word16_t, int);
-
-
-/** Innovation quantization function */
-typedef void (*innovation_quant_func)(spx_word16_t *, spx_coef_t *, spx_coef_t *, spx_coef_t *, const void *, int, int, 
-                                      spx_sig_t *, spx_word16_t *, SpeexBits *, char *, int, int);
-
-/** Innovation unquantization function */
-typedef void (*innovation_unquant_func)(spx_sig_t *, const void *, int, SpeexBits*, char *, spx_int32_t *);
-
-/** Description of a Speex sub-mode (wither narrowband or wideband */
-typedef struct SpeexSubmode {
-   int     lbr_pitch;          /**< Set to -1 for "normal" modes, otherwise encode pitch using a global pitch and allowing a +- lbr_pitch variation (for low not-rates)*/
-   int     forced_pitch_gain;  /**< Use the same (forced) pitch gain for all sub-frames */
-   int     have_subframe_gain; /**< Number of bits to use as sub-frame innovation gain */
-   int     double_codebook;    /**< Apply innovation quantization twice for higher quality (and higher bit-rate)*/
-   /*LSP functions*/
-   lsp_quant_func    lsp_quant; /**< LSP quantization function */
-   lsp_unquant_func  lsp_unquant; /**< LSP unquantization function */
-
-   /*Long-term predictor functions*/
-   ltp_quant_func    ltp_quant; /**< Long-term predictor (pitch) quantizer */
-   ltp_unquant_func  ltp_unquant; /**< Long-term predictor (pitch) un-quantizer */
-   const void       *ltp_params; /**< Pitch parameters (options) */
-
-   /*Quantization of innovation*/
-   innovation_quant_func innovation_quant; /**< Innovation quantization */
-   innovation_unquant_func innovation_unquant; /**< Innovation un-quantization */
-   const void             *innovation_params; /**< Innovation quantization parameters*/
-
-   spx_word16_t      comb_gain;  /**< Gain of enhancer comb filter */
-
-   int               bits_per_frame; /**< Number of bits per frame after encoding*/
-} SpeexSubmode;
-
-/** Struct defining the encoding/decoding mode*/
-typedef struct SpeexNBMode {
-   int     frameSize;      /**< Size of frames used for encoding */
-   int     subframeSize;   /**< Size of sub-frames used for encoding */
-   int     lpcSize;        /**< Order of LPC filter */
-   int     pitchStart;     /**< Smallest pitch value allowed */
-   int     pitchEnd;       /**< Largest pitch value allowed */
-
-   spx_word16_t gamma1;    /**< Perceptual filter parameter #1 */
-   spx_word16_t gamma2;    /**< Perceptual filter parameter #2 */
-   spx_word16_t   lpc_floor;      /**< Noise floor for LPC analysis */
-
-   const SpeexSubmode *submodes[NB_SUBMODES]; /**< Sub-mode data for the mode */
-   int     defaultSubmode; /**< Default sub-mode to use when encoding */
-   int     quality_map[11]; /**< Mode corresponding to each quality setting */
-} SpeexNBMode;
-
-
-/** Struct defining the encoding/decoding mode for SB-CELP (wideband) */
-typedef struct SpeexSBMode {
-   const SpeexMode *nb_mode;    /**< Embedded narrowband mode */
-   int     frameSize;     /**< Size of frames used for encoding */
-   int     subframeSize;  /**< Size of sub-frames used for encoding */
-   int     lpcSize;       /**< Order of LPC filter */
-   spx_word16_t gamma1;   /**< Perceptual filter parameter #1 */
-   spx_word16_t gamma2;   /**< Perceptual filter parameter #1 */
-   spx_word16_t   lpc_floor;     /**< Noise floor for LPC analysis */
-   spx_word16_t   folding_gain;
-
-   const SpeexSubmode *submodes[SB_SUBMODES]; /**< Sub-mode data for the mode */
-   int     defaultSubmode; /**< Default sub-mode to use when encoding */
-   int     low_quality_map[11]; /**< Mode corresponding to each quality setting */
-   int     quality_map[11]; /**< Mode corresponding to each quality setting */
-#ifndef DISABLE_VBR
-   const float (*vbr_thresh)[11];
-#endif
-   int     nb_modes;
-} SpeexSBMode;
-
-int speex_encode_native(void *state, spx_word16_t *in, SpeexBits *bits);
-int speex_decode_native(void *state, SpeexBits *bits, spx_word16_t *out);
-
-int nb_mode_query(const void *mode, int request, void *ptr);
-int wb_mode_query(const void *mode, int request, void *ptr);
-
-#endif
diff --git a/libspeex/modes_wb.c b/libspeex/modes_wb.c
deleted file mode 100644
index e3b4842..0000000
--- a/libspeex/modes_wb.c
+++ /dev/null
@@ -1,300 +0,0 @@
-/* Copyright (C) 2002-2007 Jean-Marc Valin 
-   File: modes.c
-
-   Describes the wideband modes of the codec
-
-   Redistribution and use in source and binary forms, with or without
-   modification, 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 the Xiph.org Foundation nor the names of its
-   contributors may be used to endorse or promote products derived from
-   this software without specific prior written permission.
-   
-   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 FOUNDATION 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.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "modes.h"
-#include "ltp.h"
-#include "quant_lsp.h"
-#include "cb_search.h"
-#include "sb_celp.h"
-#include "nb_celp.h"
-#include "vbr.h"
-#include "arch.h"
-#include <math.h>
-#include "os_support.h"
-
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-EXPORT const SpeexMode * const speex_mode_list[SPEEX_NB_MODES] = {&speex_nb_mode, &speex_wb_mode, &speex_uwb_mode};
-
-extern const signed char hexc_table[];
-extern const signed char hexc_10_32_table[];
-
-#ifndef DISABLE_WIDEBAND
-
-/* Split-VQ innovation for high-band wideband */
-static const split_cb_params split_cb_high = {
-   8,               /*subvect_size*/
-   5,               /*nb_subvect*/
-   hexc_table,       /*shape_cb*/
-   7,               /*shape_bits*/
-   1,
-};
-
-
-/* Split-VQ innovation for high-band wideband */
-static const split_cb_params split_cb_high_lbr = {
-   10,               /*subvect_size*/
-   4,               /*nb_subvect*/
-   hexc_10_32_table,       /*shape_cb*/
-   5,               /*shape_bits*/
-   0,
-};
-
-#endif
-
-
-static const SpeexSubmode wb_submode1 = {
-   0,
-   0,
-   1,
-   0,
-   /*LSP quantization*/
-   lsp_quant_high,
-   lsp_unquant_high,
-   /*Pitch quantization*/
-   NULL,
-   NULL,
-   NULL,
-   /*No innovation quantization*/
-   NULL,
-   NULL,
-   NULL,
-   -1,
-   36
-};
-
-
-static const SpeexSubmode wb_submode2 = {
-   0,
-   0,
-   1,
-   0,
-   /*LSP quantization*/
-   lsp_quant_high,
-   lsp_unquant_high,
-   /*Pitch quantization*/
-   NULL,
-   NULL,
-   NULL,
-   /*Innovation quantization*/
-   split_cb_search_shape_sign,
-   split_cb_shape_sign_unquant,
-#ifdef DISABLE_WIDEBAND
-   NULL,
-#else
-   &split_cb_high_lbr,
-#endif
-   -1,
-   112
-};
-
-
-static const SpeexSubmode wb_submode3 = {
-   0,
-   0,
-   1,
-   0,
-   /*LSP quantization*/
-   lsp_quant_high,
-   lsp_unquant_high,
-   /*Pitch quantization*/
-   NULL,
-   NULL,
-   NULL,
-   /*Innovation quantization*/
-   split_cb_search_shape_sign,
-   split_cb_shape_sign_unquant,
-#ifdef DISABLE_WIDEBAND
-   NULL,
-#else
-   &split_cb_high,
-#endif
-   -1,
-   192
-};
-
-static const SpeexSubmode wb_submode4 = {
-   0,
-   0,
-   1,
-   1,
-   /*LSP quantization*/
-   lsp_quant_high,
-   lsp_unquant_high,
-   /*Pitch quantization*/
-   NULL,
-   NULL,
-   NULL,
-   /*Innovation quantization*/
-   split_cb_search_shape_sign,
-   split_cb_shape_sign_unquant,
-#ifdef DISABLE_WIDEBAND
-   NULL,
-#else
-   &split_cb_high,
-#endif
-   -1,
-   352
-};
-
-
-/* Split-band wideband CELP mode*/
-static const SpeexSBMode sb_wb_mode = {
-   &speex_nb_mode,
-   160,    /*frameSize*/
-   40,     /*subframeSize*/
-   8,     /*lpcSize*/
-#ifdef FIXED_POINT
-   29491, 19661, /* gamma1, gamma2 */
-#else
-   0.9, 0.6, /* gamma1, gamma2 */
-#endif
-   QCONST16(.0002,15), /*lpc_floor*/
-   QCONST16(0.9f,15),
-   {NULL, &wb_submode1, &wb_submode2, &wb_submode3, &wb_submode4, NULL, NULL, NULL},
-   3,
-   {1, 8, 2, 3, 4, 5, 5, 6, 6, 7, 7},
-   {1, 1, 1, 1, 1, 1, 2, 2, 3, 3, 4},
-#ifndef DISABLE_VBR
-   vbr_hb_thresh,
-#endif
-   5
-};
-
-
-EXPORT const SpeexMode speex_wb_mode = {
-   &sb_wb_mode,
-   wb_mode_query,
-   "wideband (sub-band CELP)",
-   1,
-   4,
-   &sb_encoder_init,
-   &sb_encoder_destroy,
-   &sb_encode,
-   &sb_decoder_init,
-   &sb_decoder_destroy,
-   &sb_decode,
-   &sb_encoder_ctl,
-   &sb_decoder_ctl,
-};
-
-
-
-/* "Ultra-wideband" mode stuff */
-
-
-
-/* Split-band "ultra-wideband" (32 kbps) CELP mode*/
-static const SpeexSBMode sb_uwb_mode = {
-   &speex_wb_mode,
-   320,    /*frameSize*/
-   80,     /*subframeSize*/
-   8,     /*lpcSize*/
-#ifdef FIXED_POINT
-   29491, 19661, /* gamma1, gamma2 */
-#else
-   0.9, 0.6, /* gamma1, gamma2 */
-#endif
-   QCONST16(.0002,15), /*lpc_floor*/
-   QCONST16(0.7f,15),
-   {NULL, &wb_submode1, NULL, NULL, NULL, NULL, NULL, NULL},
-   1,
-   {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
-   {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
-#ifndef DISABLE_VBR
-   vbr_uhb_thresh,
-#endif
-   2
-};
-
-int wb_mode_query(const void *mode, int request, void *ptr)
-{
-   const SpeexSBMode *m = (const SpeexSBMode*)mode;
-
-   switch (request)
-   {
-      case SPEEX_MODE_FRAME_SIZE:
-         *((int*)ptr)=2*m->frameSize;
-         break;
-      case SPEEX_SUBMODE_BITS_PER_FRAME:
-         if (*((int*)ptr)==0)
-            *((int*)ptr) = SB_SUBMODE_BITS+1;
-         else if (m->submodes[*((int*)ptr)]==NULL)
-            *((int*)ptr) = -1;
-         else
-            *((int*)ptr) = m->submodes[*((int*)ptr)]->bits_per_frame;
-         break;
-      default:
-         speex_warning_int("Unknown wb_mode_query request: ", request);
-         return -1;
-   }
-   return 0;
-}
-
-
-EXPORT const SpeexMode speex_uwb_mode = {
-   &sb_uwb_mode,
-   wb_mode_query,
-   "ultra-wideband (sub-band CELP)",
-   2,
-   4,
-   &sb_encoder_init,
-   &sb_encoder_destroy,
-   &sb_encode,
-   &sb_decoder_init,
-   &sb_decoder_destroy,
-   &sb_decode,
-   &sb_encoder_ctl,
-   &sb_decoder_ctl,
-};
-
-/* We have defined speex_lib_get_mode() as a macro in speex.h */
-#undef speex_lib_get_mode
-
-EXPORT const SpeexMode * speex_lib_get_mode (int mode)
-{
-   if (mode < 0 || mode >= SPEEX_NB_MODES) return NULL;
-
-   return speex_mode_list[mode];
-}
-
-
-
diff --git a/libspeex/nb_celp.c b/libspeex/nb_celp.c
deleted file mode 100644
index 9dd726a..0000000
--- a/libspeex/nb_celp.c
+++ /dev/null
@@ -1,1903 +0,0 @@
-/* Copyright (C) 2002-2006 Jean-Marc Valin 
-   File: nb_celp.c
-
-   Redistribution and use in source and binary forms, with or without
-   modification, 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 the Xiph.org Foundation nor the names of its
-   contributors may be used to endorse or promote products derived from
-   this software without specific prior written permission.
-   
-   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 FOUNDATION 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.
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <math.h>
-#include "nb_celp.h"
-#include "lpc.h"
-#include "lsp.h"
-#include "ltp.h"
-#include "quant_lsp.h"
-#include "cb_search.h"
-#include "filters.h"
-#include "stack_alloc.h"
-#include "vq.h"
-#include <speex/speex_bits.h>
-#include "vbr.h"
-#include "arch.h"
-#include "math_approx.h"
-#include "os_support.h"
-#include <speex/speex_callbacks.h>
-
-#ifdef VORBIS_PSYCHO
-#include "vorbis_psy.h"
-#endif
-
-#ifndef M_PI
-#define M_PI           3.14159265358979323846  /* pi */
-#endif
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-#define SUBMODE(x) st->submodes[st->submodeID]->x
-
-/* Default size for the encoder and decoder stack (can be changed at compile time).
-   This does not apply when using variable-size arrays or alloca. */
-#ifndef NB_ENC_STACK
-#define NB_ENC_STACK (8000*sizeof(spx_sig_t))
-#endif
-
-#ifndef NB_DEC_STACK
-#define NB_DEC_STACK (4000*sizeof(spx_sig_t))
-#endif
-
-
-#ifdef FIXED_POINT
-const spx_word32_t ol_gain_table[32]={18900, 25150, 33468, 44536, 59265, 78865, 104946, 139653, 185838, 247297, 329081, 437913, 582736, 775454, 1031906, 1373169, 1827293, 2431601, 3235761, 4305867, 5729870, 7624808, 10146425, 13501971, 17967238, 23909222, 31816294, 42338330, 56340132, 74972501, 99766822, 132760927};
-const spx_word16_t exc_gain_quant_scal3_bound[7]={1841, 3883, 6051, 8062, 10444, 13580, 18560};
-const spx_word16_t exc_gain_quant_scal3[8]={1002, 2680, 5086, 7016, 9108, 11781, 15380, 21740};
-const spx_word16_t exc_gain_quant_scal1_bound[1]={14385};
-const spx_word16_t exc_gain_quant_scal1[2]={11546, 17224};
-
-#define LSP_MARGIN 16
-#define LSP_DELTA1 6553
-#define LSP_DELTA2 1638
-
-#else
-
-const float exc_gain_quant_scal3_bound[7]={0.112338f, 0.236980f, 0.369316f, 0.492054f, 0.637471f, 0.828874f, 1.132784f};
-const float exc_gain_quant_scal3[8]={0.061130f, 0.163546f, 0.310413f, 0.428220f, 0.555887f, 0.719055f, 0.938694f, 1.326874f};
-const float exc_gain_quant_scal1_bound[1]={0.87798f};
-const float exc_gain_quant_scal1[2]={0.70469f, 1.05127f};
-
-#define LSP_MARGIN .002f
-#define LSP_DELTA1 .2f
-#define LSP_DELTA2 .05f
-
-#endif
-
-#ifdef VORBIS_PSYCHO
-#define EXTRA_BUFFER 100
-#else
-#define EXTRA_BUFFER 0
-#endif
-
-
-#define sqr(x) ((x)*(x))
-
-extern const spx_word16_t lag_window[];
-extern const spx_word16_t lpc_window[];
-
-void *nb_encoder_init(const SpeexMode *m)
-{
-   EncState *st;
-   const SpeexNBMode *mode;
-   int i;
-
-   mode=(const SpeexNBMode *)m->mode;
-   st = (EncState*)speex_alloc(sizeof(EncState));
-   if (!st)
-      return NULL;
-#if defined(VAR_ARRAYS) || defined (USE_ALLOCA)
-   st->stack = NULL;
-#else
-   st->stack = (char*)speex_alloc_scratch(NB_ENC_STACK);
-#endif
-   
-   st->mode=m;
-
-   st->frameSize = mode->frameSize;
-   st->nbSubframes=mode->frameSize/mode->subframeSize;
-   st->subframeSize=mode->subframeSize;
-   st->windowSize = st->frameSize+st->subframeSize;
-   st->lpcSize = mode->lpcSize;
-   st->gamma1=mode->gamma1;
-   st->gamma2=mode->gamma2;
-   st->min_pitch=mode->pitchStart;
-   st->max_pitch=mode->pitchEnd;
-   st->lpc_floor = mode->lpc_floor;
-  
-   st->submodes=mode->submodes;
-   st->submodeID=st->submodeSelect=mode->defaultSubmode;
-   st->bounded_pitch = 1;
-
-   st->encode_submode = 1;
-
-#ifdef VORBIS_PSYCHO
-   st->psy = vorbis_psy_init(8000, 256);
-   st->curve = (float*)speex_alloc(128*sizeof(float));
-   st->old_curve = (float*)speex_alloc(128*sizeof(float));
-   st->psy_window = (float*)speex_alloc(256*sizeof(float));
-#endif
-
-   st->cumul_gain = 1024;
-
-   /* Allocating input buffer */
-   st->winBuf = (spx_word16_t*)speex_alloc((st->windowSize-st->frameSize)*sizeof(spx_word16_t));
-   /* Allocating excitation buffer */
-   st->excBuf = (spx_word16_t*)speex_alloc((mode->frameSize+mode->pitchEnd+2)*sizeof(spx_word16_t));
-   st->exc = st->excBuf + mode->pitchEnd + 2;
-   st->swBuf = (spx_word16_t*)speex_alloc((mode->frameSize+mode->pitchEnd+2)*sizeof(spx_word16_t));
-   st->sw = st->swBuf + mode->pitchEnd + 2;
-
-   st->window= lpc_window;
-   
-   /* Create the window for autocorrelation (lag-windowing) */
-   st->lagWindow = lag_window;
-
-   st->old_lsp = (spx_lsp_t*)speex_alloc((st->lpcSize)*sizeof(spx_lsp_t));
-   st->old_qlsp = (spx_lsp_t*)speex_alloc((st->lpcSize)*sizeof(spx_lsp_t));
-   st->first = 1;
-   for (i=0;i<st->lpcSize;i++)
-      st->old_lsp[i]= DIV32(MULT16_16(QCONST16(3.1415927f, LSP_SHIFT), i+1), st->lpcSize+1);
-
-   st->mem_sp = (spx_mem_t*)speex_alloc((st->lpcSize)*sizeof(spx_mem_t));
-   st->mem_sw = (spx_mem_t*)speex_alloc((st->lpcSize)*sizeof(spx_mem_t));
-   st->mem_sw_whole = (spx_mem_t*)speex_alloc((st->lpcSize)*sizeof(spx_mem_t));
-   st->mem_exc = (spx_mem_t*)speex_alloc((st->lpcSize)*sizeof(spx_mem_t));
-   st->mem_exc2 = (spx_mem_t*)speex_alloc((st->lpcSize)*sizeof(spx_mem_t));
-
-   st->pi_gain = (spx_word32_t*)speex_alloc((st->nbSubframes)*sizeof(spx_word32_t));
-   st->innov_rms_save = NULL;
-   
-   st->pitch = (int*)speex_alloc((st->nbSubframes)*sizeof(int));
-
-#ifndef DISABLE_VBR
-   st->vbr = (VBRState*)speex_alloc(sizeof(VBRState));
-   vbr_init(st->vbr);
-   st->vbr_quality = 8;
-   st->vbr_enabled = 0;
-   st->vbr_max = 0;
-   st->vad_enabled = 0;
-   st->dtx_enabled = 0;
-   st->dtx_count=0;
-   st->abr_enabled = 0;
-   st->abr_drift = 0;
-   st->abr_drift2 = 0;
-#endif /* #ifndef DISABLE_VBR */
-
-   st->plc_tuning = 2;
-   st->complexity=2;
-   st->sampling_rate=8000;
-   st->isWideband = 0;
-   st->highpass_enabled = 1;
-   
-#ifdef ENABLE_VALGRIND
-   VALGRIND_MAKE_READABLE(st, NB_ENC_STACK);
-#endif
-   return st;
-}
-
-void nb_encoder_destroy(void *state)
-{
-   EncState *st=(EncState *)state;
-   /* Free all allocated memory */
-#if !(defined(VAR_ARRAYS) || defined (USE_ALLOCA))
-   speex_free_scratch(st->stack);
-#endif
-
-   speex_free (st->winBuf);
-   speex_free (st->excBuf);
-   speex_free (st->old_qlsp);
-   speex_free (st->swBuf);
-
-   speex_free (st->old_lsp);
-   speex_free (st->mem_sp);
-   speex_free (st->mem_sw);
-   speex_free (st->mem_sw_whole);
-   speex_free (st->mem_exc);
-   speex_free (st->mem_exc2);
-   speex_free (st->pi_gain);
-   speex_free (st->pitch);
-
-#ifndef DISABLE_VBR
-   vbr_destroy(st->vbr);
-   speex_free (st->vbr);
-#endif /* #ifndef DISABLE_VBR */
-
-#ifdef VORBIS_PSYCHO
-   vorbis_psy_destroy(st->psy);
-   speex_free (st->curve);
-   speex_free (st->old_curve);
-   speex_free (st->psy_window);
-#endif
-
-   /*Free state memory... should be last*/
-   speex_free(st);
-}
-
-int nb_encode(void *state, void *vin, SpeexBits *bits)
-{
-   EncState *st;
-   int i, sub, roots;
-   int ol_pitch;
-   spx_word16_t ol_pitch_coef;
-   spx_word32_t ol_gain;
-   VARDECL(spx_word16_t *ringing);
-   VARDECL(spx_word16_t *target);
-   VARDECL(spx_sig_t *innov);
-   VARDECL(spx_word32_t *exc32);
-   VARDECL(spx_mem_t *mem);
-   VARDECL(spx_coef_t *bw_lpc1);
-   VARDECL(spx_coef_t *bw_lpc2);
-   VARDECL(spx_coef_t *lpc);
-   VARDECL(spx_lsp_t *lsp);
-   VARDECL(spx_lsp_t *qlsp);
-   VARDECL(spx_lsp_t *interp_lsp);
-   VARDECL(spx_lsp_t *interp_qlsp);
-   VARDECL(spx_coef_t *interp_lpc);
-   VARDECL(spx_coef_t *interp_qlpc);
-   char *stack;
-   VARDECL(spx_word16_t *syn_resp);
-   VARDECL(spx_word16_t *real_exc);
-   
-   spx_word32_t ener=0;
-   spx_word16_t fine_gain;
-   spx_word16_t *in = (spx_word16_t*)vin;
-
-   st=(EncState *)state;
-   stack=st->stack;
-
-   ALLOC(lpc, st->lpcSize, spx_coef_t);
-   ALLOC(bw_lpc1, st->lpcSize, spx_coef_t);
-   ALLOC(bw_lpc2, st->lpcSize, spx_coef_t);
-   ALLOC(lsp, st->lpcSize, spx_lsp_t);
-   ALLOC(qlsp, st->lpcSize, spx_lsp_t);
-   ALLOC(interp_lsp, st->lpcSize, spx_lsp_t);
-   ALLOC(interp_qlsp, st->lpcSize, spx_lsp_t);
-   ALLOC(interp_lpc, st->lpcSize, spx_coef_t);
-   ALLOC(interp_qlpc, st->lpcSize, spx_coef_t);
-
-   /* Move signals 1 frame towards the past */
-   SPEEX_MOVE(st->excBuf, st->excBuf+st->frameSize, st->max_pitch+2);
-   SPEEX_MOVE(st->swBuf, st->swBuf+st->frameSize, st->max_pitch+2);
-
-   if (st->highpass_enabled)
-      highpass(in, in, st->frameSize, (st->isWideband?HIGHPASS_WIDEBAND:HIGHPASS_NARROWBAND)|HIGHPASS_INPUT, st->mem_hp);
-   
-   {
-      VARDECL(spx_word16_t *w_sig);
-      VARDECL(spx_word16_t *autocorr);
-      ALLOC(w_sig, st->windowSize, spx_word16_t);
-      ALLOC(autocorr, st->lpcSize+1, spx_word16_t);
-      /* Window for analysis */
-      for (i=0;i<st->windowSize-st->frameSize;i++)
-         w_sig[i] = EXTRACT16(SHR32(MULT16_16(st->winBuf[i],st->window[i]),SIG_SHIFT));
-      for (;i<st->windowSize;i++)
-         w_sig[i] = EXTRACT16(SHR32(MULT16_16(in[i-st->windowSize+st->frameSize],st->window[i]),SIG_SHIFT));
-      /* Compute auto-correlation */
-      _spx_autocorr(w_sig, autocorr, st->lpcSize+1, st->windowSize);
-      autocorr[0] = ADD16(autocorr[0],MULT16_16_Q15(autocorr[0],st->lpc_floor)); /* Noise floor in auto-correlation domain */
-
-      /* Lag windowing: equivalent to filtering in the power-spectrum domain */
-      for (i=0;i<st->lpcSize+1;i++)
-         autocorr[i] = MULT16_16_Q14(autocorr[i],st->lagWindow[i]);
-
-      /* Levinson-Durbin */
-      _spx_lpc(lpc, autocorr, st->lpcSize);
-      /* LPC to LSPs (x-domain) transform */
-      roots=lpc_to_lsp (lpc, st->lpcSize, lsp, 10, LSP_DELTA1, stack);
-      /* Check if we found all the roots */
-      if (roots!=st->lpcSize)
-      {
-         /*If we can't find all LSP's, do some damage control and use previous filter*/
-         for (i=0;i<st->lpcSize;i++)
-         {
-            lsp[i]=st->old_lsp[i];
-         }
-      }
-   }
-
-
-
-
-   /* Whole frame analysis (open-loop estimation of pitch and excitation gain) */
-   {
-      int diff = st->windowSize-st->frameSize;
-      if (st->first)
-         for (i=0;i<st->lpcSize;i++)
-            interp_lsp[i] = lsp[i];
-      else
-         lsp_interpolate(st->old_lsp, lsp, interp_lsp, st->lpcSize, st->nbSubframes, st->nbSubframes<<1);
-
-      lsp_enforce_margin(interp_lsp, st->lpcSize, LSP_MARGIN);
-
-      /* Compute interpolated LPCs (unquantized) for whole frame*/
-      lsp_to_lpc(interp_lsp, interp_lpc, st->lpcSize,stack);
-
-
-      /*Open-loop pitch*/
-      if (!st->submodes[st->submodeID] || (st->complexity>2 && SUBMODE(have_subframe_gain)<3) || SUBMODE(forced_pitch_gain) || SUBMODE(lbr_pitch) != -1 
-#ifndef DISABLE_VBR
-           || st->vbr_enabled || st->vad_enabled
-#endif
-                  )
-      {
-         int nol_pitch[6];
-         spx_word16_t nol_pitch_coef[6];
-         
-         bw_lpc(st->gamma1, interp_lpc, bw_lpc1, st->lpcSize);
-         bw_lpc(st->gamma2, interp_lpc, bw_lpc2, st->lpcSize);
-
-         SPEEX_COPY(st->sw, st->winBuf, diff);
-         SPEEX_COPY(st->sw+diff, in, st->frameSize-diff);
-         filter_mem16(st->sw, bw_lpc1, bw_lpc2, st->sw, st->frameSize, st->lpcSize, st->mem_sw_whole, stack);
-
-         open_loop_nbest_pitch(st->sw, st->min_pitch, st->max_pitch, st->frameSize, 
-                               nol_pitch, nol_pitch_coef, 6, stack);
-         ol_pitch=nol_pitch[0];
-         ol_pitch_coef = nol_pitch_coef[0];
-         /*Try to remove pitch multiples*/
-         for (i=1;i<6;i++)
-         {
-#ifdef FIXED_POINT
-            if ((nol_pitch_coef[i]>MULT16_16_Q15(nol_pitch_coef[0],27853)) && 
-#else
-            if ((nol_pitch_coef[i]>.85*nol_pitch_coef[0]) && 
-#endif
-                (ABS(2*nol_pitch[i]-ol_pitch)<=2 || ABS(3*nol_pitch[i]-ol_pitch)<=3 || 
-                 ABS(4*nol_pitch[i]-ol_pitch)<=4 || ABS(5*nol_pitch[i]-ol_pitch)<=5))
-            {
-               /*ol_pitch_coef=nol_pitch_coef[i];*/
-               ol_pitch = nol_pitch[i];
-            }
-         }
-         /*if (ol_pitch>50)
-           ol_pitch/=2;*/
-         /*ol_pitch_coef = sqrt(ol_pitch_coef);*/
-
-      } else {
-         ol_pitch=0;
-         ol_pitch_coef=0;
-      }
-      
-      /*Compute "real" excitation*/
-      SPEEX_COPY(st->exc, st->winBuf, diff);
-      SPEEX_COPY(st->exc+diff, in, st->frameSize-diff);
-      fir_mem16(st->exc, interp_lpc, st->exc, st->frameSize, st->lpcSize, st->mem_exc, stack);
-
-      /* Compute open-loop excitation gain */
-      {
-         spx_word16_t g = compute_rms16(st->exc, st->frameSize);
-         if (st->submodeID!=1 && ol_pitch>0)
-            ol_gain = MULT16_16(g, MULT16_16_Q14(QCONST16(1.1,14),
-                                spx_sqrt(QCONST32(1.,28)-MULT16_32_Q15(QCONST16(.8,15),SHL32(MULT16_16(ol_pitch_coef,ol_pitch_coef),16)))));
-         else
-            ol_gain = SHL32(EXTEND32(g),SIG_SHIFT);
-      }
-   }
-
-#ifdef VORBIS_PSYCHO
-   SPEEX_MOVE(st->psy_window, st->psy_window+st->frameSize, 256-st->frameSize);
-   SPEEX_COPY(&st->psy_window[256-st->frameSize], in, st->frameSize);
-   compute_curve(st->psy, st->psy_window, st->curve);
-   /*print_vec(st->curve, 128, "curve");*/
-   if (st->first)
-      SPEEX_COPY(st->old_curve, st->curve, 128);
-#endif
-
-   /*VBR stuff*/
-#ifndef DISABLE_VBR
-   if (st->vbr && (st->vbr_enabled||st->vad_enabled))
-   {
-      float lsp_dist=0;
-      for (i=0;i<st->lpcSize;i++)
-         lsp_dist += (st->old_lsp[i] - lsp[i])*(st->old_lsp[i] - lsp[i]);
-      lsp_dist /= LSP_SCALING*LSP_SCALING;
-      
-      if (st->abr_enabled)
-      {
-         float qual_change=0;
-         if (st->abr_drift2 * st->abr_drift > 0)
-         {
-            /* Only adapt if long-term and short-term drift are the same sign */
-            qual_change = -.00001*st->abr_drift/(1+st->abr_count);
-            if (qual_change>.05)
-               qual_change=.05;
-            if (qual_change<-.05)
-               qual_change=-.05;
-         }
-         st->vbr_quality += qual_change;
-         if (st->vbr_quality>10)
-            st->vbr_quality=10;
-         if (st->vbr_quality<0)
-            st->vbr_quality=0;
-      }
-
-      st->relative_quality = vbr_analysis(st->vbr, in, st->frameSize, ol_pitch, GAIN_SCALING_1*ol_pitch_coef);
-      /*if (delta_qual<0)*/
-      /*  delta_qual*=.1*(3+st->vbr_quality);*/
-      if (st->vbr_enabled) 
-      {
-         spx_int32_t mode;
-         int choice=0;
-         float min_diff=100;
-         mode = 8;
-         while (mode)
-         {
-            int v1;
-            float thresh;
-            v1=(int)floor(st->vbr_quality);
-            if (v1==10)
-               thresh = vbr_nb_thresh[mode][v1];
-            else
-               thresh = (st->vbr_quality-v1)*vbr_nb_thresh[mode][v1+1] + (1+v1-st->vbr_quality)*vbr_nb_thresh[mode][v1];
-            if (st->relative_quality > thresh && 
-                st->relative_quality-thresh<min_diff)
-            {
-               choice = mode;
-               min_diff = st->relative_quality-thresh;
-            }
-            mode--;
-         }
-         mode=choice;
-         if (mode==0)
-         {
-            if (st->dtx_count==0 || lsp_dist>.05 || !st->dtx_enabled || st->dtx_count>20)
-            {
-               mode=1;
-               st->dtx_count=1;
-            } else {
-               mode=0;
-               st->dtx_count++;
-            }
-         } else {
-            st->dtx_count=0;
-         }
-
-         speex_encoder_ctl(state, SPEEX_SET_MODE, &mode);
-         if (st->vbr_max>0)
-         {
-            spx_int32_t rate;
-            speex_encoder_ctl(state, SPEEX_GET_BITRATE, &rate);
-            if (rate > st->vbr_max)
-            {
-               rate = st->vbr_max;
-               speex_encoder_ctl(state, SPEEX_SET_BITRATE, &rate);
-            }
-         }
-         
-         if (st->abr_enabled)
-         {
-            spx_int32_t bitrate;
-            speex_encoder_ctl(state, SPEEX_GET_BITRATE, &bitrate);
-            st->abr_drift+=(bitrate-st->abr_enabled);
-            st->abr_drift2 = .95*st->abr_drift2 + .05*(bitrate-st->abr_enabled);
-            st->abr_count += 1.0;
-         }
-
-      } else {
-         /*VAD only case*/
-         int mode;
-         if (st->relative_quality<2)
-         {
-            if (st->dtx_count==0 || lsp_dist>.05 || !st->dtx_enabled || st->dtx_count>20)
-            {
-               st->dtx_count=1;
-               mode=1;
-            } else {
-               mode=0;
-               st->dtx_count++;
-            }
-         } else {
-            st->dtx_count = 0;
-            mode=st->submodeSelect;
-         }
-         /*speex_encoder_ctl(state, SPEEX_SET_MODE, &mode);*/
-         st->submodeID=mode;
-      } 
-   } else {
-      st->relative_quality = -1;
-   }
-#endif /* #ifndef DISABLE_VBR */
-
-   if (st->encode_submode)
-   {
-      /* First, transmit a zero for narrowband */
-      speex_bits_pack(bits, 0, 1);
-
-      /* Transmit the sub-mode we use for this frame */
-      speex_bits_pack(bits, st->submodeID, NB_SUBMODE_BITS);
-
-   }
-
-   /* If null mode (no transmission), just set a couple things to zero*/
-   if (st->submodes[st->submodeID] == NULL)
-   {
-      for (i=0;i<st->frameSize;i++)
-         st->exc[i]=st->sw[i]=VERY_SMALL;
-
-      for (i=0;i<st->lpcSize;i++)
-         st->mem_sw[i]=0;
-      st->first=1;
-      st->bounded_pitch = 1;
-
-      SPEEX_COPY(st->winBuf, in+2*st->frameSize-st->windowSize, st->windowSize-st->frameSize);
-
-      /* Clear memory (no need to really compute it) */
-      for (i=0;i<st->lpcSize;i++)
-         st->mem_sp[i] = 0;
-      return 0;
-
-   }
-
-   /* LSP Quantization */
-   if (st->first)
-   {
-      for (i=0;i<st->lpcSize;i++)
-         st->old_lsp[i] = lsp[i];
-   }
-
-
-   /*Quantize LSPs*/
-#if 1 /*0 for unquantized*/
-   SUBMODE(lsp_quant)(lsp, qlsp, st->lpcSize, bits);
-#else
-   for (i=0;i<st->lpcSize;i++)
-     qlsp[i]=lsp[i];
-#endif
-
-   /*If we use low bit-rate pitch mode, transmit open-loop pitch*/
-   if (SUBMODE(lbr_pitch)!=-1)
-   {
-      speex_bits_pack(bits, ol_pitch-st->min_pitch, 7);
-   } 
-
-   if (SUBMODE(forced_pitch_gain))
-   {
-      int quant;
-      /* This just damps the pitch a bit, because it tends to be too aggressive when forced */
-      ol_pitch_coef = MULT16_16_Q15(QCONST16(.9,15), ol_pitch_coef);
-#ifdef FIXED_POINT
-      quant = PSHR16(MULT16_16_16(15, ol_pitch_coef),GAIN_SHIFT);
-#else
-      quant = (int)floor(.5+15*ol_pitch_coef*GAIN_SCALING_1);
-#endif
-      if (quant>15)
-         quant=15;
-      if (quant<0)
-         quant=0;
-      speex_bits_pack(bits, quant, 4);
-      ol_pitch_coef=MULT16_16_P15(QCONST16(0.066667,15),SHL16(quant,GAIN_SHIFT));
-   }
-   
-   
-   /*Quantize and transmit open-loop excitation gain*/
-#ifdef FIXED_POINT
-   {
-      int qe = scal_quant32(ol_gain, ol_gain_table, 32);
-      /*ol_gain = exp(qe/3.5)*SIG_SCALING;*/
-      ol_gain = MULT16_32_Q15(28406,ol_gain_table[qe]);
-      speex_bits_pack(bits, qe, 5);
-   }
-#else
-   {
-      int qe = (int)(floor(.5+3.5*log(ol_gain*1.0/SIG_SCALING)));
-      if (qe<0)
-         qe=0;
-      if (qe>31)
-         qe=31;
-      ol_gain = exp(qe/3.5)*SIG_SCALING;
-      speex_bits_pack(bits, qe, 5);
-   }
-#endif
-
-
-
-   /* Special case for first frame */
-   if (st->first)
-   {
-      for (i=0;i<st->lpcSize;i++)
-         st->old_qlsp[i] = qlsp[i];
-   }
-
-   /* Target signal */
-   ALLOC(target, st->subframeSize, spx_word16_t);
-   ALLOC(innov, st->subframeSize, spx_sig_t);
-   ALLOC(exc32, st->subframeSize, spx_word32_t);
-   ALLOC(ringing, st->subframeSize, spx_word16_t);
-   ALLOC(syn_resp, st->subframeSize, spx_word16_t);
-   ALLOC(real_exc, st->subframeSize, spx_word16_t);
-   ALLOC(mem, st->lpcSize, spx_mem_t);
-
-   /* Loop on sub-frames */
-   for (sub=0;sub<st->nbSubframes;sub++)
-   {
-      int   offset;
-      spx_word16_t *sw;
-      spx_word16_t *exc;
-      int pitch;
-      int response_bound = st->subframeSize;
-
-      /* Offset relative to start of frame */
-      offset = st->subframeSize*sub;
-      /* Excitation */
-      exc=st->exc+offset;
-      /* Weighted signal */
-      sw=st->sw+offset;
-      
-      /* LSP interpolation (quantized and unquantized) */
-      lsp_interpolate(st->old_lsp, lsp, interp_lsp, st->lpcSize, sub, st->nbSubframes);
-      lsp_interpolate(st->old_qlsp, qlsp, interp_qlsp, st->lpcSize, sub, st->nbSubframes);
-
-      /* Make sure the filters are stable */
-      lsp_enforce_margin(interp_lsp, st->lpcSize, LSP_MARGIN);
-      lsp_enforce_margin(interp_qlsp, st->lpcSize, LSP_MARGIN);
-
-      /* Compute interpolated LPCs (quantized and unquantized) */
-      lsp_to_lpc(interp_lsp, interp_lpc, st->lpcSize,stack);
-
-      lsp_to_lpc(interp_qlsp, interp_qlpc, st->lpcSize, stack);
-
-      /* Compute analysis filter gain at w=pi (for use in SB-CELP) */
-      {
-         spx_word32_t pi_g=LPC_SCALING;
-         for (i=0;i<st->lpcSize;i+=2)
-         {
-            /*pi_g += -st->interp_qlpc[i] +  st->interp_qlpc[i+1];*/
-            pi_g = ADD32(pi_g, SUB32(EXTEND32(interp_qlpc[i+1]),EXTEND32(interp_qlpc[i])));
-         }
-         st->pi_gain[sub] = pi_g;
-      }
-
-#ifdef VORBIS_PSYCHO
-      {
-         float curr_curve[128];
-         float fact = ((float)sub+1.0f)/st->nbSubframes;
-         for (i=0;i<128;i++)
-            curr_curve[i] = (1.0f-fact)*st->old_curve[i] + fact*st->curve[i];
-         curve_to_lpc(st->psy, curr_curve, bw_lpc1, bw_lpc2, 10);
-      }
-#else
-      /* Compute bandwidth-expanded (unquantized) LPCs for perceptual weighting */
-      bw_lpc(st->gamma1, interp_lpc, bw_lpc1, st->lpcSize);
-      if (st->gamma2>=0)
-         bw_lpc(st->gamma2, interp_lpc, bw_lpc2, st->lpcSize);
-      else
-      {
-         for (i=0;i<st->lpcSize;i++)
-            bw_lpc2[i]=0;
-      }
-      /*print_vec(st->bw_lpc1, 10, "bw_lpc");*/
-#endif
-
-      /*FIXME: This will break if we change the window size */
-      speex_assert(st->windowSize-st->frameSize == st->subframeSize);
-      if (sub==0)
-      {
-         for (i=0;i<st->subframeSize;i++)
-            real_exc[i] = sw[i] = st->winBuf[i];
-      } else {
-         for (i=0;i<st->subframeSize;i++)
-            real_exc[i] = sw[i] = in[i+((sub-1)*st->subframeSize)];
-      }
-      fir_mem16(real_exc, interp_qlpc, real_exc, st->subframeSize, st->lpcSize, st->mem_exc2, stack);
-      
-      if (st->complexity==0)
-         response_bound >>= 1;
-      compute_impulse_response(interp_qlpc, bw_lpc1, bw_lpc2, syn_resp, response_bound, st->lpcSize, stack);
-      for (i=response_bound;i<st->subframeSize;i++)
-         syn_resp[i]=VERY_SMALL;
-      
-      /* Compute zero response of A(z/g1) / ( A(z/g2) * A(z) ) */
-      for (i=0;i<st->lpcSize;i++)
-         mem[i]=SHL32(st->mem_sp[i],1);
-      for (i=0;i<st->subframeSize;i++)
-         ringing[i] = VERY_SMALL;
-#ifdef SHORTCUTS2
-      iir_mem16(ringing, interp_qlpc, ringing, response_bound, st->lpcSize, mem, stack);
-      for (i=0;i<st->lpcSize;i++)
-         mem[i]=SHL32(st->mem_sw[i],1);
-      filter_mem16(ringing, st->bw_lpc1, st->bw_lpc2, ringing, response_bound, st->lpcSize, mem, stack);
-      SPEEX_MEMSET(&ringing[response_bound], 0, st->subframeSize-response_bound);
-#else
-      iir_mem16(ringing, interp_qlpc, ringing, st->subframeSize, st->lpcSize, mem, stack);
-      for (i=0;i<st->lpcSize;i++)
-         mem[i]=SHL32(st->mem_sw[i],1);
-      filter_mem16(ringing, bw_lpc1, bw_lpc2, ringing, st->subframeSize, st->lpcSize, mem, stack);
-#endif
-      
-      /* Compute weighted signal */
-      for (i=0;i<st->lpcSize;i++)
-         mem[i]=st->mem_sw[i];
-      filter_mem16(sw, bw_lpc1, bw_lpc2, sw, st->subframeSize, st->lpcSize, mem, stack);
-      
-      if (st->complexity==0)
-         for (i=0;i<st->lpcSize;i++)
-            st->mem_sw[i]=mem[i];
-      
-      /* Compute target signal (saturation prevents overflows on clipped input speech) */
-      for (i=0;i<st->subframeSize;i++)
-         target[i]=EXTRACT16(SATURATE(SUB32(sw[i],PSHR32(ringing[i],1)),32767));
-
-      /* Reset excitation */
-      SPEEX_MEMSET(exc, 0, st->subframeSize);
-
-      /* If we have a long-term predictor (otherwise, something's wrong) */
-      speex_assert (SUBMODE(ltp_quant));
-      {
-         int pit_min, pit_max;
-         /* Long-term prediction */
-         if (SUBMODE(lbr_pitch) != -1)
-         {
-            /* Low bit-rate pitch handling */
-            int margin;
-            margin = SUBMODE(lbr_pitch);
-            if (margin)
-            {
-               if (ol_pitch < st->min_pitch+margin-1)
-                  ol_pitch=st->min_pitch+margin-1;
-               if (ol_pitch > st->max_pitch-margin)
-                  ol_pitch=st->max_pitch-margin;
-               pit_min = ol_pitch-margin+1;
-               pit_max = ol_pitch+margin;
-            } else {
-               pit_min=pit_max=ol_pitch;
-            }
-         } else {
-            pit_min = st->min_pitch;
-            pit_max = st->max_pitch;
-         }
-         
-         /* Force pitch to use only the current frame if needed */
-         if (st->bounded_pitch && pit_max>offset)
-            pit_max=offset;
-
-         /* Perform pitch search */
-         pitch = SUBMODE(ltp_quant)(target, sw, interp_qlpc, bw_lpc1, bw_lpc2,
-                                    exc32, SUBMODE(ltp_params), pit_min, pit_max, ol_pitch_coef,
-                                    st->lpcSize, st->subframeSize, bits, stack, 
-                                    exc, syn_resp, st->complexity, 0, st->plc_tuning, &st->cumul_gain);
-
-         st->pitch[sub]=pitch;
-      }
-      /* Quantization of innovation */
-      SPEEX_MEMSET(innov, 0, st->subframeSize);
-      
-      /* FIXME: Make sure this is save from overflows (so far so good) */
-      for (i=0;i<st->subframeSize;i++)
-         real_exc[i] = EXTRACT16(SUB32(EXTEND32(real_exc[i]), PSHR32(exc32[i],SIG_SHIFT-1)));
-      
-      ener = SHL32(EXTEND32(compute_rms16(real_exc, st->subframeSize)),SIG_SHIFT);
-      
-      /*FIXME: Should use DIV32_16 and make sure result fits in 16 bits */
-#ifdef FIXED_POINT
-      {
-         spx_word32_t f = PDIV32(ener,PSHR32(ol_gain,SIG_SHIFT));
-         if (f<=32767)
-            fine_gain = f;
-         else
-            fine_gain = 32767;
-      }
-#else
-      fine_gain = PDIV32_16(ener,PSHR32(ol_gain,SIG_SHIFT));
-#endif
-      /* Calculate gain correction for the sub-frame (if any) */
-      if (SUBMODE(have_subframe_gain)) 
-      {
-         int qe;
-         if (SUBMODE(have_subframe_gain)==3)
-         {
-            qe = scal_quant(fine_gain, exc_gain_quant_scal3_bound, 8);
-            speex_bits_pack(bits, qe, 3);
-            ener=MULT16_32_Q14(exc_gain_quant_scal3[qe],ol_gain);
-         } else {
-            qe = scal_quant(fine_gain, exc_gain_quant_scal1_bound, 2);
-            speex_bits_pack(bits, qe, 1);
-            ener=MULT16_32_Q14(exc_gain_quant_scal1[qe],ol_gain);               
-         }
-      } else {
-         ener=ol_gain;
-      }
-      
-      /*printf ("%f %f\n", ener, ol_gain);*/
-      
-      /* Normalize innovation */
-      signal_div(target, target, ener, st->subframeSize);
-      
-      /* Quantize innovation */
-      speex_assert (SUBMODE(innovation_quant));
-      {
-         /* Codebook search */
-         SUBMODE(innovation_quant)(target, interp_qlpc, bw_lpc1, bw_lpc2, 
-                  SUBMODE(innovation_params), st->lpcSize, st->subframeSize, 
-                  innov, syn_resp, bits, stack, st->complexity, SUBMODE(double_codebook));
-         
-         /* De-normalize innovation and update excitation */
-         signal_mul(innov, innov, ener, st->subframeSize);
-         
-         for (i=0;i<st->subframeSize;i++)
-            exc[i] = EXTRACT16(SATURATE32(PSHR32(ADD32(SHL32(exc32[i],1),innov[i]),SIG_SHIFT),32767));
-
-         /* In some (rare) modes, we do a second search (more bits) to reduce noise even more */
-         if (SUBMODE(double_codebook)) {
-            char *tmp_stack=stack;
-            VARDECL(spx_sig_t *innov2);
-            ALLOC(innov2, st->subframeSize, spx_sig_t);
-            SPEEX_MEMSET(innov2, 0, st->subframeSize);
-            for (i=0;i<st->subframeSize;i++)
-               target[i]=MULT16_16_P13(QCONST16(2.2f,13), target[i]);
-            SUBMODE(innovation_quant)(target, interp_qlpc, bw_lpc1, bw_lpc2, 
-                                      SUBMODE(innovation_params), st->lpcSize, st->subframeSize, 
-                                      innov2, syn_resp, bits, stack, st->complexity, 0);
-            signal_mul(innov2, innov2, MULT16_32_Q15(QCONST16(0.454545f,15),ener), st->subframeSize);
-            for (i=0;i<st->subframeSize;i++)
-               innov[i] = ADD32(innov[i],innov2[i]);
-            stack = tmp_stack;
-         }
-         for (i=0;i<st->subframeSize;i++)
-            exc[i] = EXTRACT16(SATURATE32(PSHR32(ADD32(SHL32(exc32[i],1),innov[i]),SIG_SHIFT),32767));
-         if (st->innov_rms_save)
-         {
-            st->innov_rms_save[sub] = compute_rms(innov, st->subframeSize);
-         }
-      }
-
-      /* Final signal synthesis from excitation */
-      iir_mem16(exc, interp_qlpc, sw, st->subframeSize, st->lpcSize, st->mem_sp, stack);
-
-      /* Compute weighted signal again, from synthesized speech (not sure it's the right thing) */
-      if (st->complexity!=0)
-         filter_mem16(sw, bw_lpc1, bw_lpc2, sw, st->subframeSize, st->lpcSize, st->mem_sw, stack);
-      
-   }
-
-   /* Store the LSPs for interpolation in the next frame */
-   if (st->submodeID>=1)
-   {
-      for (i=0;i<st->lpcSize;i++)
-         st->old_lsp[i] = lsp[i];
-      for (i=0;i<st->lpcSize;i++)
-         st->old_qlsp[i] = qlsp[i];
-   }
-
-#ifdef VORBIS_PSYCHO
-   if (st->submodeID>=1)
-      SPEEX_COPY(st->old_curve, st->curve, 128);
-#endif
-
-   if (st->submodeID==1)
-   {
-#ifndef DISABLE_VBR
-      if (st->dtx_count)
-         speex_bits_pack(bits, 15, 4);
-      else
-#endif
-         speex_bits_pack(bits, 0, 4);
-   }
-
-   /* The next frame will not be the first (Duh!) */
-   st->first = 0;
-   SPEEX_COPY(st->winBuf, in+2*st->frameSize-st->windowSize, st->windowSize-st->frameSize);
-
-   if (SUBMODE(innovation_quant) == noise_codebook_quant || st->submodeID==0)
-      st->bounded_pitch = 1;
-   else
-      st->bounded_pitch = 0;
-
-   return 1;
-}
-
-void *nb_decoder_init(const SpeexMode *m)
-{
-   DecState *st;
-   const SpeexNBMode *mode;
-   int i;
-
-   mode=(const SpeexNBMode*)m->mode;
-   st = (DecState *)speex_alloc(sizeof(DecState));
-   if (!st)
-      return NULL;
-#if defined(VAR_ARRAYS) || defined (USE_ALLOCA)
-   st->stack = NULL;
-#else
-   st->stack = (char*)speex_alloc_scratch(NB_DEC_STACK);
-#endif
-
-   st->mode=m;
-
-
-   st->encode_submode = 1;
-
-   st->first=1;
-   /* Codec parameters, should eventually have several "modes"*/
-   st->frameSize = mode->frameSize;
-   st->nbSubframes=mode->frameSize/mode->subframeSize;
-   st->subframeSize=mode->subframeSize;
-   st->lpcSize = mode->lpcSize;
-   st->min_pitch=mode->pitchStart;
-   st->max_pitch=mode->pitchEnd;
-
-   st->submodes=mode->submodes;
-   st->submodeID=mode->defaultSubmode;
-
-   st->lpc_enh_enabled=1;
-
-   st->excBuf = (spx_word16_t*)speex_alloc((st->frameSize + 2*st->max_pitch + st->subframeSize + 12)*sizeof(spx_word16_t));
-   st->exc = st->excBuf + 2*st->max_pitch + st->subframeSize + 6;
-   SPEEX_MEMSET(st->excBuf, 0, st->frameSize + st->max_pitch);
-
-   st->interp_qlpc = (spx_coef_t*)speex_alloc(st->lpcSize*sizeof(spx_coef_t));
-   st->old_qlsp = (spx_lsp_t*)speex_alloc(st->lpcSize*sizeof(spx_lsp_t));
-   st->mem_sp = (spx_mem_t*)speex_alloc(st->lpcSize*sizeof(spx_mem_t));
-   st->pi_gain = (spx_word32_t*)speex_alloc((st->nbSubframes)*sizeof(spx_word32_t));
-   st->last_pitch = 40;
-   st->count_lost=0;
-   st->pitch_gain_buf[0] = st->pitch_gain_buf[1] = st->pitch_gain_buf[2] = 0;
-   st->pitch_gain_buf_idx = 0;
-   st->seed = 1000;
-   
-   st->sampling_rate=8000;
-   st->last_ol_gain = 0;
-
-   st->user_callback.func = &speex_default_user_handler;
-   st->user_callback.data = NULL;
-   for (i=0;i<16;i++)
-      st->speex_callbacks[i].func = NULL;
-
-   st->voc_m1=st->voc_m2=st->voc_mean=0;
-   st->voc_offset=0;
-   st->dtx_enabled=0;
-   st->isWideband = 0;
-   st->highpass_enabled = 1;
-
-#ifdef ENABLE_VALGRIND
-   VALGRIND_MAKE_READABLE(st, NB_DEC_STACK);
-#endif
-   return st;
-}
-
-void nb_decoder_destroy(void *state)
-{
-   DecState *st;
-   st=(DecState*)state;
-   
-#if !(defined(VAR_ARRAYS) || defined (USE_ALLOCA))
-   speex_free_scratch(st->stack);
-#endif
-
-   speex_free (st->excBuf);
-   speex_free (st->interp_qlpc);
-   speex_free (st->old_qlsp);
-   speex_free (st->mem_sp);
-   speex_free (st->pi_gain);
-
-   speex_free(state);
-}
-
-#define median3(a, b, c)	((a) < (b) ? ((b) < (c) ? (b) : ((a) < (c) ? (c) : (a))) : ((c) < (b) ? (b) : ((c) < (a) ? (c) : (a))))
-
-#ifdef FIXED_POINT
-const spx_word16_t attenuation[10] = {32767, 31483, 27923, 22861, 17278, 12055, 7764, 4616, 2533, 1283};
-#else
-const spx_word16_t attenuation[10] = {1., 0.961, 0.852, 0.698, 0.527, 0.368, 0.237, 0.141, 0.077, 0.039};
-
-#endif
-
-static void nb_decode_lost(DecState *st, spx_word16_t *out, char *stack)
-{
-   int i;
-   int pitch_val;
-   spx_word16_t pitch_gain;
-   spx_word16_t fact;
-   spx_word16_t gain_med;
-   spx_word16_t innov_gain;
-   spx_word16_t noise_gain;
-   
-   if (st->count_lost<10)
-      fact = attenuation[st->count_lost];
-   else
-      fact = 0;
-
-   gain_med = median3(st->pitch_gain_buf[0], st->pitch_gain_buf[1], st->pitch_gain_buf[2]);
-   if (gain_med < st->last_pitch_gain)
-      st->last_pitch_gain = gain_med;
-   
-#ifdef FIXED_POINT
-   pitch_gain = st->last_pitch_gain;
-   if (pitch_gain>54)
-      pitch_gain = 54;
-   pitch_gain = SHL16(pitch_gain, 9);
-#else   
-   pitch_gain = GAIN_SCALING_1*st->last_pitch_gain;
-   if (pitch_gain>.85)
-      pitch_gain=.85;
-#endif
-   pitch_gain = MULT16_16_Q15(fact,pitch_gain) + VERY_SMALL;
-   /* FIXME: This was rms of innovation (not exc) */
-   innov_gain = compute_rms16(st->exc, st->frameSize);
-   noise_gain = MULT16_16_Q15(innov_gain, MULT16_16_Q15(fact, SUB16(Q15ONE,MULT16_16_Q15(pitch_gain,pitch_gain))));
-   /* Shift all buffers by one frame */
-   SPEEX_MOVE(st->excBuf, st->excBuf+st->frameSize, 2*st->max_pitch + st->subframeSize + 12);
-   
-
-   pitch_val = st->last_pitch + SHR32((spx_int32_t)speex_rand(1+st->count_lost, &st->seed),SIG_SHIFT);
-   if (pitch_val > st->max_pitch)
-      pitch_val = st->max_pitch;
-   if (pitch_val < st->min_pitch)
-      pitch_val = st->min_pitch;
-   for (i=0;i<st->frameSize;i++)
-   {
-      st->exc[i]= MULT16_16_Q15(pitch_gain, (st->exc[i-pitch_val]+VERY_SMALL)) + 
-            speex_rand(noise_gain, &st->seed);
-   }
-
-   bw_lpc(QCONST16(.98,15), st->interp_qlpc, st->interp_qlpc, st->lpcSize);
-   iir_mem16(&st->exc[-st->subframeSize], st->interp_qlpc, out, st->frameSize,
-             st->lpcSize, st->mem_sp, stack);
-   highpass(out, out, st->frameSize, HIGHPASS_NARROWBAND|HIGHPASS_OUTPUT, st->mem_hp);
-   
-   st->first = 0;
-   st->count_lost++;
-   st->pitch_gain_buf[st->pitch_gain_buf_idx++] = PSHR16(pitch_gain,9);
-   if (st->pitch_gain_buf_idx > 2) /* rollover */
-      st->pitch_gain_buf_idx = 0;
-}
-
-/* Just so we don't need to carry the complete wideband mode information */
-static const int wb_skip_table[8] = {0, 36, 112, 192, 352, 0, 0, 0};
-   
-int nb_decode(void *state, SpeexBits *bits, void *vout)
-{
-   DecState *st;
-   int i, sub;
-   int pitch;
-   spx_word16_t pitch_gain[3];
-   spx_word32_t ol_gain=0;
-   int ol_pitch=0;
-   spx_word16_t ol_pitch_coef=0;
-   int best_pitch=40;
-   spx_word16_t best_pitch_gain=0;
-   int wideband;
-   int m;
-   char *stack;
-   VARDECL(spx_sig_t *innov);
-   VARDECL(spx_word32_t *exc32);
-   VARDECL(spx_coef_t *ak);
-   VARDECL(spx_lsp_t *qlsp);
-   spx_word16_t pitch_average=0;
-   
-   spx_word16_t *out = (spx_word16_t*)vout;
-   VARDECL(spx_lsp_t *interp_qlsp);
-
-   st=(DecState*)state;
-   stack=st->stack;
-
-   /* Check if we're in DTX mode*/
-   if (!bits && st->dtx_enabled)
-   {
-      st->submodeID=0;
-   } else 
-   {
-      /* If bits is NULL, consider the packet to be lost (what could we do anyway) */
-      if (!bits)
-      {
-         nb_decode_lost(st, out, stack);
-         return 0;
-      }
-
-      if (st->encode_submode)
-      {
-
-      /* Search for next narrowband block (handle requests, skip wideband blocks) */
-      do {
-         if (speex_bits_remaining(bits)<5)
-            return -1;
-         wideband = speex_bits_unpack_unsigned(bits, 1);
-         if (wideband) /* Skip wideband block (for compatibility) */
-         {
-            int submode;
-            int advance;
-            advance = submode = speex_bits_unpack_unsigned(bits, SB_SUBMODE_BITS);
-            /*speex_mode_query(&speex_wb_mode, SPEEX_SUBMODE_BITS_PER_FRAME, &advance);*/
-            advance = wb_skip_table[submode];
-            if (advance < 0)
-            {
-               speex_notify("Invalid mode encountered. The stream is corrupted.");
-               return -2;
-            } 
-            advance -= (SB_SUBMODE_BITS+1);
-            speex_bits_advance(bits, advance);
-            
-            if (speex_bits_remaining(bits)<5)
-               return -1;
-            wideband = speex_bits_unpack_unsigned(bits, 1);
-            if (wideband)
-            {
-               advance = submode = speex_bits_unpack_unsigned(bits, SB_SUBMODE_BITS);
-               /*speex_mode_query(&speex_wb_mode, SPEEX_SUBMODE_BITS_PER_FRAME, &advance);*/
-               advance = wb_skip_table[submode];
-               if (advance < 0)
-               {
-                  speex_notify("Invalid mode encountered. The stream is corrupted.");
-                  return -2;
-               } 
-               advance -= (SB_SUBMODE_BITS+1);
-               speex_bits_advance(bits, advance);
-               wideband = speex_bits_unpack_unsigned(bits, 1);
-               if (wideband)
-               {
-                  speex_notify("More than two wideband layers found. The stream is corrupted.");
-                  return -2;
-               }
-
-            }
-         }
-         if (speex_bits_remaining(bits)<4)
-            return -1;
-         /* FIXME: Check for overflow */
-         m = speex_bits_unpack_unsigned(bits, 4);
-         if (m==15) /* We found a terminator */
-         {
-            return -1;
-         } else if (m==14) /* Speex in-band request */
-         {
-            int ret = speex_inband_handler(bits, st->speex_callbacks, state);
-            if (ret)
-               return ret;
-         } else if (m==13) /* User in-band request */
-         {
-            int ret = st->user_callback.func(bits, state, st->user_callback.data);
-            if (ret)
-               return ret;
-         } else if (m>8) /* Invalid mode */
-         {
-            speex_notify("Invalid mode encountered. The stream is corrupted.");
-            return -2;
-         }
-      
-      } while (m>8);
-
-      /* Get the sub-mode that was used */
-      st->submodeID = m;
-      }
-
-   }
-
-   /* Shift all buffers by one frame */
-   SPEEX_MOVE(st->excBuf, st->excBuf+st->frameSize, 2*st->max_pitch + st->subframeSize + 12);
-
-   /* If null mode (no transmission), just set a couple things to zero*/
-   if (st->submodes[st->submodeID] == NULL)
-   {
-      VARDECL(spx_coef_t *lpc);
-      ALLOC(lpc, st->lpcSize, spx_coef_t);
-      bw_lpc(QCONST16(0.93f,15), st->interp_qlpc, lpc, st->lpcSize);
-      {
-         spx_word16_t innov_gain=0;
-         /* FIXME: This was innov, not exc */
-         innov_gain = compute_rms16(st->exc, st->frameSize);
-         for (i=0;i<st->frameSize;i++)
-            st->exc[i]=speex_rand(innov_gain, &st->seed);
-      }
-
-
-      st->first=1;
-
-      /* Final signal synthesis from excitation */
-      iir_mem16(st->exc, lpc, out, st->frameSize, st->lpcSize, st->mem_sp, stack);
-
-      st->count_lost=0;
-      return 0;
-   }
-
-   ALLOC(qlsp, st->lpcSize, spx_lsp_t);
-
-   /* Unquantize LSPs */
-   SUBMODE(lsp_unquant)(qlsp, st->lpcSize, bits);
-
-   /*Damp memory if a frame was lost and the LSP changed too much*/
-   if (st->count_lost)
-   {
-      spx_word16_t fact;
-      spx_word32_t lsp_dist=0;
-      for (i=0;i<st->lpcSize;i++)
-         lsp_dist = ADD32(lsp_dist, EXTEND32(ABS(st->old_qlsp[i] - qlsp[i])));
-#ifdef FIXED_POINT
-      fact = SHR16(19661,SHR32(lsp_dist,LSP_SHIFT+2));      
-#else
-      fact = .6*exp(-.2*lsp_dist);
-#endif
-      for (i=0;i<st->lpcSize;i++)
-         st->mem_sp[i] = MULT16_32_Q15(fact,st->mem_sp[i]);
-   }
-
-
-   /* Handle first frame and lost-packet case */
-   if (st->first || st->count_lost)
-   {
-      for (i=0;i<st->lpcSize;i++)
-         st->old_qlsp[i] = qlsp[i];
-   }
-
-   /* Get open-loop pitch estimation for low bit-rate pitch coding */
-   if (SUBMODE(lbr_pitch)!=-1)
-   {
-      ol_pitch = st->min_pitch+speex_bits_unpack_unsigned(bits, 7);
-   } 
-   
-   if (SUBMODE(forced_pitch_gain))
-   {
-      int quant;
-      quant = speex_bits_unpack_unsigned(bits, 4);
-      ol_pitch_coef=MULT16_16_P15(QCONST16(0.066667,15),SHL16(quant,GAIN_SHIFT));
-   }
-   
-   /* Get global excitation gain */
-   {
-      int qe;
-      qe = speex_bits_unpack_unsigned(bits, 5);
-#ifdef FIXED_POINT
-      /* FIXME: Perhaps we could slightly lower the gain here when the output is going to saturate? */
-      ol_gain = MULT16_32_Q15(28406,ol_gain_table[qe]);
-#else
-      ol_gain = SIG_SCALING*exp(qe/3.5);
-#endif
-   }
-
-   ALLOC(ak, st->lpcSize, spx_coef_t);
-   ALLOC(innov, st->subframeSize, spx_sig_t);
-   ALLOC(exc32, st->subframeSize, spx_word32_t);
-
-   if (st->submodeID==1)
-   {
-      int extra;
-      extra = speex_bits_unpack_unsigned(bits, 4);
-
-      if (extra==15)
-         st->dtx_enabled=1;
-      else
-         st->dtx_enabled=0;
-   }
-   if (st->submodeID>1)
-      st->dtx_enabled=0;
-
-   /*Loop on subframes */
-   for (sub=0;sub<st->nbSubframes;sub++)
-   {
-      int offset;
-      spx_word16_t *exc;
-      spx_word16_t *sp;
-      spx_word16_t *innov_save = NULL;
-      spx_word16_t tmp;
-
-      /* Offset relative to start of frame */
-      offset = st->subframeSize*sub;
-      /* Excitation */
-      exc=st->exc+offset;
-      /* Original signal */
-      sp=out+offset;
-      if (st->innov_save)
-         innov_save = st->innov_save+offset;
-
-
-      /* Reset excitation */
-      SPEEX_MEMSET(exc, 0, st->subframeSize);
-
-      /*Adaptive codebook contribution*/
-      speex_assert (SUBMODE(ltp_unquant));
-      {
-         int pit_min, pit_max;
-         /* Handle pitch constraints if any */
-         if (SUBMODE(lbr_pitch) != -1)
-         {
-            int margin;
-            margin = SUBMODE(lbr_pitch);
-            if (margin)
-            {
-/* GT - need optimization?
-               if (ol_pitch < st->min_pitch+margin-1)
-                  ol_pitch=st->min_pitch+margin-1;
-               if (ol_pitch > st->max_pitch-margin)
-                  ol_pitch=st->max_pitch-margin;
-               pit_min = ol_pitch-margin+1;
-               pit_max = ol_pitch+margin;
-*/
-               pit_min = ol_pitch-margin+1;
-               if (pit_min < st->min_pitch)
-		  pit_min = st->min_pitch;
-               pit_max = ol_pitch+margin;
-               if (pit_max > st->max_pitch)
-		  pit_max = st->max_pitch;
-            } else {
-               pit_min = pit_max = ol_pitch;
-            }
-         } else {
-            pit_min = st->min_pitch;
-            pit_max = st->max_pitch;
-         }
-
-
-
-         SUBMODE(ltp_unquant)(exc, exc32, pit_min, pit_max, ol_pitch_coef, SUBMODE(ltp_params), 
-                 st->subframeSize, &pitch, &pitch_gain[0], bits, stack, 
-                 st->count_lost, offset, st->last_pitch_gain, 0);
-
-         /* Ensuring that things aren't blowing up as would happen if e.g. an encoder is 
-         crafting packets to make us produce NaNs and slow down the decoder (vague DoS threat).
-         We can probably be even more aggressive and limit to 15000 or so. */
-         sanitize_values32(exc32, NEG32(QCONST32(32000,SIG_SHIFT-1)), QCONST32(32000,SIG_SHIFT-1), st->subframeSize);
-         
-         tmp = gain_3tap_to_1tap(pitch_gain);
-
-         pitch_average += tmp;
-         if ((tmp>best_pitch_gain&&ABS(2*best_pitch-pitch)>=3&&ABS(3*best_pitch-pitch)>=4&&ABS(4*best_pitch-pitch)>=5) 
-              || (tmp>MULT16_16_Q15(QCONST16(.6,15),best_pitch_gain)&&(ABS(best_pitch-2*pitch)<3||ABS(best_pitch-3*pitch)<4||ABS(best_pitch-4*pitch)<5)) 
-              || (MULT16_16_Q15(QCONST16(.67,15),tmp)>best_pitch_gain&&(ABS(2*best_pitch-pitch)<3||ABS(3*best_pitch-pitch)<4||ABS(4*best_pitch-pitch)<5)) )
-         {
-            best_pitch = pitch;
-            if (tmp > best_pitch_gain)
-               best_pitch_gain = tmp;
-         }
-      }
-      
-      /* Unquantize the innovation */
-      {
-         int q_energy;
-         spx_word32_t ener;
-         
-         SPEEX_MEMSET(innov, 0, st->subframeSize);
-
-         /* Decode sub-frame gain correction */
-         if (SUBMODE(have_subframe_gain)==3)
-         {
-            q_energy = speex_bits_unpack_unsigned(bits, 3);
-            ener = MULT16_32_Q14(exc_gain_quant_scal3[q_energy],ol_gain);
-         } else if (SUBMODE(have_subframe_gain)==1)
-         {
-            q_energy = speex_bits_unpack_unsigned(bits, 1);
-            ener = MULT16_32_Q14(exc_gain_quant_scal1[q_energy],ol_gain);
-         } else {
-            ener = ol_gain;
-         }
-                  
-         speex_assert (SUBMODE(innovation_unquant));
-         {
-            /*Fixed codebook contribution*/
-            SUBMODE(innovation_unquant)(innov, SUBMODE(innovation_params), st->subframeSize, bits, stack, &st->seed);
-            /* De-normalize innovation and update excitation */
-
-            signal_mul(innov, innov, ener, st->subframeSize);
-
-            /* Decode second codebook (only for some modes) */
-            if (SUBMODE(double_codebook))
-            {
-               char *tmp_stack=stack;
-               VARDECL(spx_sig_t *innov2);
-               ALLOC(innov2, st->subframeSize, spx_sig_t);
-               SPEEX_MEMSET(innov2, 0, st->subframeSize);
-               SUBMODE(innovation_unquant)(innov2, SUBMODE(innovation_params), st->subframeSize, bits, stack, &st->seed);
-               signal_mul(innov2, innov2, MULT16_32_Q15(QCONST16(0.454545f,15),ener), st->subframeSize);
-               for (i=0;i<st->subframeSize;i++)
-                  innov[i] = ADD32(innov[i], innov2[i]);
-               stack = tmp_stack;
-            }
-            for (i=0;i<st->subframeSize;i++)
-               exc[i]=EXTRACT16(SATURATE32(PSHR32(ADD32(SHL32(exc32[i],1),innov[i]),SIG_SHIFT),32767));
-            /*print_vec(exc, 40, "innov");*/
-            if (innov_save)
-            {
-               for (i=0;i<st->subframeSize;i++)
-                  innov_save[i] = EXTRACT16(PSHR32(innov[i], SIG_SHIFT));
-            }
-         }
-
-         /*Vocoder mode*/
-         if (st->submodeID==1) 
-         {
-            spx_word16_t g=ol_pitch_coef;
-            g=MULT16_16_P14(QCONST16(1.5f,14),(g-QCONST16(.2f,6)));
-            if (g<0)
-               g=0;
-            if (g>GAIN_SCALING)
-               g=GAIN_SCALING;
-            
-            SPEEX_MEMSET(exc, 0, st->subframeSize);
-            while (st->voc_offset<st->subframeSize)
-            {
-               /* exc[st->voc_offset]= g*sqrt(2*ol_pitch)*ol_gain;
-                  Not quite sure why we need the factor of two in the sqrt */
-               if (st->voc_offset>=0)
-                  exc[st->voc_offset]=MULT16_16(spx_sqrt(MULT16_16_16(2,ol_pitch)),EXTRACT16(PSHR32(MULT16_16(g,PSHR32(ol_gain,SIG_SHIFT)),6)));
-               st->voc_offset+=ol_pitch;
-            }
-            st->voc_offset -= st->subframeSize;
-            
-            for (i=0;i<st->subframeSize;i++)
-            {
-               spx_word16_t exci=exc[i];
-               exc[i]= ADD16(ADD16(MULT16_16_Q15(QCONST16(.7f,15),exc[i]) , MULT16_16_Q15(QCONST16(.3f,15),st->voc_m1)),
-                             SUB16(MULT16_16_Q15(Q15_ONE-MULT16_16_16(QCONST16(.85f,9),g),EXTRACT16(PSHR32(innov[i],SIG_SHIFT))),
-                                   MULT16_16_Q15(MULT16_16_16(QCONST16(.15f,9),g),EXTRACT16(PSHR32(st->voc_m2,SIG_SHIFT)))
-                                  ));
-               st->voc_m1 = exci;
-               st->voc_m2=innov[i];
-               st->voc_mean = EXTRACT16(PSHR32(ADD32(MULT16_16(QCONST16(.8f,15),st->voc_mean), MULT16_16(QCONST16(.2f,15),exc[i])), 15));
-               exc[i]-=st->voc_mean;
-            }
-         }
-
-      }
-   }
-   
-   ALLOC(interp_qlsp, st->lpcSize, spx_lsp_t);
-
-   if (st->lpc_enh_enabled && SUBMODE(comb_gain)>0 && !st->count_lost)
-   {
-      multicomb(st->exc-st->subframeSize, out, st->interp_qlpc, st->lpcSize, 2*st->subframeSize, best_pitch, 40, SUBMODE(comb_gain), stack);
-      multicomb(st->exc+st->subframeSize, out+2*st->subframeSize, st->interp_qlpc, st->lpcSize, 2*st->subframeSize, best_pitch, 40, SUBMODE(comb_gain), stack);
-   } else {
-      SPEEX_COPY(out, &st->exc[-st->subframeSize], st->frameSize);
-   }
-   
-   /* If the last packet was lost, re-scale the excitation to obtain the same energy as encoded in ol_gain */
-   if (st->count_lost) 
-   {
-      spx_word16_t exc_ener;
-      spx_word32_t gain32;
-      spx_word16_t gain;
-      exc_ener = compute_rms16 (st->exc, st->frameSize);
-      gain32 = PDIV32(ol_gain, ADD16(exc_ener,1));
-#ifdef FIXED_POINT
-      if (gain32 > 32767)
-         gain32 = 32767;
-      gain = EXTRACT16(gain32);
-#else
-      if (gain32 > 2)
-         gain32=2;
-      gain = gain32;
-#endif
-      for (i=0;i<st->frameSize;i++)
-      {
-         st->exc[i] = MULT16_16_Q14(gain, st->exc[i]);
-         out[i]=st->exc[i-st->subframeSize];
-      }
-   }
-
-   /*Loop on subframes */
-   for (sub=0;sub<st->nbSubframes;sub++)
-   {
-      int offset;
-      spx_word16_t *sp;
-      spx_word16_t *exc;
-      /* Offset relative to start of frame */
-      offset = st->subframeSize*sub;
-      /* Original signal */
-      sp=out+offset;
-      /* Excitation */
-      exc=st->exc+offset;
-
-      /* LSP interpolation (quantized and unquantized) */
-      lsp_interpolate(st->old_qlsp, qlsp, interp_qlsp, st->lpcSize, sub, st->nbSubframes);
-
-      /* Make sure the LSP's are stable */
-      lsp_enforce_margin(interp_qlsp, st->lpcSize, LSP_MARGIN);
-
-      /* Compute interpolated LPCs (unquantized) */
-      lsp_to_lpc(interp_qlsp, ak, st->lpcSize, stack);
-
-      /* Compute analysis filter at w=pi */
-      {
-         spx_word32_t pi_g=LPC_SCALING;
-         for (i=0;i<st->lpcSize;i+=2)
-         {
-            /*pi_g += -st->interp_qlpc[i] +  st->interp_qlpc[i+1];*/
-            pi_g = ADD32(pi_g, SUB32(EXTEND32(ak[i+1]),EXTEND32(ak[i])));
-         }
-         st->pi_gain[sub] = pi_g;
-      }
-      
-      iir_mem16(sp, st->interp_qlpc, sp, st->subframeSize, st->lpcSize, 
-                st->mem_sp, stack);
-      
-      for (i=0;i<st->lpcSize;i++)
-         st->interp_qlpc[i] = ak[i];
-
-   }
-
-   if (st->highpass_enabled)
-      highpass(out, out, st->frameSize, (st->isWideband?HIGHPASS_WIDEBAND:HIGHPASS_NARROWBAND)|HIGHPASS_OUTPUT, st->mem_hp);
-   /*for (i=0;i<st->frameSize;i++)
-     printf ("%d\n", (int)st->frame[i]);*/
-
-   /* Tracking output level */
-   st->level = 1+PSHR32(ol_gain,SIG_SHIFT);
-   st->max_level = MAX16(MULT16_16_Q15(QCONST16(.99f,15), st->max_level), st->level);
-   st->min_level = MIN16(ADD16(1,MULT16_16_Q14(QCONST16(1.01f,14), st->min_level)), st->level);
-   if (st->max_level < st->min_level+1)
-      st->max_level = st->min_level+1;
-   /*printf ("%f %f %f %d\n", og, st->min_level, st->max_level, update);*/
-   
-   /* Store the LSPs for interpolation in the next frame */
-   for (i=0;i<st->lpcSize;i++)
-      st->old_qlsp[i] = qlsp[i];
-
-   /* The next frame will not be the first (Duh!) */
-   st->first = 0;
-   st->count_lost=0;
-   st->last_pitch = best_pitch;
-#ifdef FIXED_POINT
-   st->last_pitch_gain = PSHR16(pitch_average,2);
-#else
-   st->last_pitch_gain = .25*pitch_average;   
-#endif
-   st->pitch_gain_buf[st->pitch_gain_buf_idx++] = st->last_pitch_gain;
-   if (st->pitch_gain_buf_idx > 2) /* rollover */
-      st->pitch_gain_buf_idx = 0;
-
-   st->last_ol_gain = ol_gain;
-
-   return 0;
-}
-
-int nb_encoder_ctl(void *state, int request, void *ptr)
-{
-   EncState *st;
-   st=(EncState*)state;     
-   switch(request)
-   {
-   case SPEEX_GET_FRAME_SIZE:
-      (*(spx_int32_t*)ptr) = st->frameSize;
-      break;
-   case SPEEX_SET_LOW_MODE:
-   case SPEEX_SET_MODE:
-      st->submodeSelect = st->submodeID = (*(spx_int32_t*)ptr);
-      break;
-   case SPEEX_GET_LOW_MODE:
-   case SPEEX_GET_MODE:
-      (*(spx_int32_t*)ptr) = st->submodeID;
-      break;
-#ifndef DISABLE_VBR
-      case SPEEX_SET_VBR:
-      st->vbr_enabled = (*(spx_int32_t*)ptr);
-      break;
-   case SPEEX_GET_VBR:
-      (*(spx_int32_t*)ptr) = st->vbr_enabled;
-      break;
-   case SPEEX_SET_VAD:
-      st->vad_enabled = (*(spx_int32_t*)ptr);
-      break;
-   case SPEEX_GET_VAD:
-      (*(spx_int32_t*)ptr) = st->vad_enabled;
-      break;
-   case SPEEX_SET_DTX:
-      st->dtx_enabled = (*(spx_int32_t*)ptr);
-      break;
-   case SPEEX_GET_DTX:
-      (*(spx_int32_t*)ptr) = st->dtx_enabled;
-      break;
-   case SPEEX_SET_ABR:
-      st->abr_enabled = (*(spx_int32_t*)ptr);
-      st->vbr_enabled = st->abr_enabled!=0;
-      if (st->vbr_enabled) 
-      {
-         spx_int32_t i=10;
-         spx_int32_t rate, target;
-         float vbr_qual;
-         target = (*(spx_int32_t*)ptr);
-         while (i>=0)
-         {
-            speex_encoder_ctl(st, SPEEX_SET_QUALITY, &i);
-            speex_encoder_ctl(st, SPEEX_GET_BITRATE, &rate);
-            if (rate <= target)
-               break;
-            i--;
-         }
-         vbr_qual=i;
-         if (vbr_qual<0)
-            vbr_qual=0;
-         speex_encoder_ctl(st, SPEEX_SET_VBR_QUALITY, &vbr_qual);
-         st->abr_count=0;
-         st->abr_drift=0;
-         st->abr_drift2=0;
-      }
-      
-      break;
-   case SPEEX_GET_ABR:
-      (*(spx_int32_t*)ptr) = st->abr_enabled;
-      break;
-#endif /* #ifndef DISABLE_VBR */
-#if !defined(DISABLE_VBR) && !defined(DISABLE_FLOAT_API)
-   case SPEEX_SET_VBR_QUALITY:
-      st->vbr_quality = (*(float*)ptr);
-      break;
-   case SPEEX_GET_VBR_QUALITY:
-      (*(float*)ptr) = st->vbr_quality;
-      break;
-#endif /* !defined(DISABLE_VBR) && !defined(DISABLE_FLOAT_API) */
-   case SPEEX_SET_QUALITY:
-      {
-         int quality = (*(spx_int32_t*)ptr);
-         if (quality < 0)
-            quality = 0;
-         if (quality > 10)
-            quality = 10;
-         st->submodeSelect = st->submodeID = ((const SpeexNBMode*)(st->mode->mode))->quality_map[quality];
-      }
-      break;
-   case SPEEX_SET_COMPLEXITY:
-      st->complexity = (*(spx_int32_t*)ptr);
-      if (st->complexity<0)
-         st->complexity=0;
-      break;
-   case SPEEX_GET_COMPLEXITY:
-      (*(spx_int32_t*)ptr) = st->complexity;
-      break;
-   case SPEEX_SET_BITRATE:
-      {
-         spx_int32_t i=10;
-         spx_int32_t rate, target;
-         target = (*(spx_int32_t*)ptr);
-         while (i>=0)
-         {
-            speex_encoder_ctl(st, SPEEX_SET_QUALITY, &i);
-            speex_encoder_ctl(st, SPEEX_GET_BITRATE, &rate);
-            if (rate <= target)
-               break;
-            i--;
-         }
-      }
-      break;
-   case SPEEX_GET_BITRATE:
-      if (st->submodes[st->submodeID])
-         (*(spx_int32_t*)ptr) = st->sampling_rate*SUBMODE(bits_per_frame)/st->frameSize;
-      else
-         (*(spx_int32_t*)ptr) = st->sampling_rate*(NB_SUBMODE_BITS+1)/st->frameSize;
-      break;
-   case SPEEX_SET_SAMPLING_RATE:
-      st->sampling_rate = (*(spx_int32_t*)ptr);
-      break;
-   case SPEEX_GET_SAMPLING_RATE:
-      (*(spx_int32_t*)ptr)=st->sampling_rate;
-      break;
-   case SPEEX_RESET_STATE:
-      {
-         int i;
-         st->bounded_pitch = 1;
-         st->first = 1;
-         for (i=0;i<st->lpcSize;i++)
-            st->old_lsp[i]= DIV32(MULT16_16(QCONST16(3.1415927f, LSP_SHIFT), i+1), st->lpcSize+1);
-         for (i=0;i<st->lpcSize;i++)
-            st->mem_sw[i]=st->mem_sw_whole[i]=st->mem_sp[i]=st->mem_exc[i]=0;
-         for (i=0;i<st->frameSize+st->max_pitch+1;i++)
-            st->excBuf[i]=st->swBuf[i]=0;
-         for (i=0;i<st->windowSize-st->frameSize;i++)
-            st->winBuf[i]=0;
-      }
-      break;
-   case SPEEX_SET_SUBMODE_ENCODING:
-      st->encode_submode = (*(spx_int32_t*)ptr);
-      break;
-   case SPEEX_GET_SUBMODE_ENCODING:
-      (*(spx_int32_t*)ptr) = st->encode_submode;
-      break;
-   case SPEEX_GET_LOOKAHEAD:
-      (*(spx_int32_t*)ptr)=(st->windowSize-st->frameSize);
-      break;
-   case SPEEX_SET_PLC_TUNING:
-      st->plc_tuning = (*(spx_int32_t*)ptr);
-      if (st->plc_tuning>100)
-         st->plc_tuning=100;
-      break;
-   case SPEEX_GET_PLC_TUNING:
-      (*(spx_int32_t*)ptr)=(st->plc_tuning);
-      break;
-#ifndef DISABLE_VBR
-   case SPEEX_SET_VBR_MAX_BITRATE:
-      st->vbr_max = (*(spx_int32_t*)ptr);
-      break;
-   case SPEEX_GET_VBR_MAX_BITRATE:
-      (*(spx_int32_t*)ptr) = st->vbr_max;
-      break;
-#endif /* #ifndef DISABLE_VBR */
-   case SPEEX_SET_HIGHPASS:
-      st->highpass_enabled = (*(spx_int32_t*)ptr);
-      break;
-   case SPEEX_GET_HIGHPASS:
-      (*(spx_int32_t*)ptr) = st->highpass_enabled;
-      break;
-
-   /* This is all internal stuff past this point */
-   case SPEEX_GET_PI_GAIN:
-      {
-         int i;
-         spx_word32_t *g = (spx_word32_t*)ptr;
-         for (i=0;i<st->nbSubframes;i++)
-            g[i]=st->pi_gain[i];
-      }
-      break;
-   case SPEEX_GET_EXC:
-      {
-         int i;
-         for (i=0;i<st->nbSubframes;i++)
-            ((spx_word16_t*)ptr)[i] = compute_rms16(st->exc+i*st->subframeSize, st->subframeSize);
-      }
-      break;
-#ifndef DISABLE_VBR
-   case SPEEX_GET_RELATIVE_QUALITY:
-      (*(float*)ptr)=st->relative_quality;
-      break;
-#endif /* #ifndef DISABLE_VBR */
-   case SPEEX_SET_INNOVATION_SAVE:
-      st->innov_rms_save = (spx_word16_t*)ptr;
-      break;
-   case SPEEX_SET_WIDEBAND:
-      st->isWideband = *((spx_int32_t*)ptr);
-      break;
-   case SPEEX_GET_STACK:
-      *((char**)ptr) = st->stack;
-      break;
-   default:
-      speex_warning_int("Unknown nb_ctl request: ", request);
-      return -1;
-   }
-   return 0;
-}
-
-int nb_decoder_ctl(void *state, int request, void *ptr)
-{
-   DecState *st;
-   st=(DecState*)state;
-   switch(request)
-   {
-   case SPEEX_SET_LOW_MODE:
-   case SPEEX_SET_MODE:
-      st->submodeID = (*(spx_int32_t*)ptr);
-      break;
-   case SPEEX_GET_LOW_MODE:
-   case SPEEX_GET_MODE:
-      (*(spx_int32_t*)ptr) = st->submodeID;
-      break;
-   case SPEEX_SET_ENH:
-      st->lpc_enh_enabled = *((spx_int32_t*)ptr);
-      break;
-   case SPEEX_GET_ENH:
-      *((spx_int32_t*)ptr) = st->lpc_enh_enabled;
-      break;
-   case SPEEX_GET_FRAME_SIZE:
-      (*(spx_int32_t*)ptr) = st->frameSize;
-      break;
-   case SPEEX_GET_BITRATE:
-      if (st->submodes[st->submodeID])
-         (*(spx_int32_t*)ptr) = st->sampling_rate*SUBMODE(bits_per_frame)/st->frameSize;
-      else
-         (*(spx_int32_t*)ptr) = st->sampling_rate*(NB_SUBMODE_BITS+1)/st->frameSize;
-      break;
-   case SPEEX_SET_SAMPLING_RATE:
-      st->sampling_rate = (*(spx_int32_t*)ptr);
-      break;
-   case SPEEX_GET_SAMPLING_RATE:
-      (*(spx_int32_t*)ptr)=st->sampling_rate;
-      break;
-   case SPEEX_SET_HANDLER:
-      {
-         SpeexCallback *c = (SpeexCallback*)ptr;
-         st->speex_callbacks[c->callback_id].func=c->func;
-         st->speex_callbacks[c->callback_id].data=c->data;
-         st->speex_callbacks[c->callback_id].callback_id=c->callback_id;
-      }
-      break;
-   case SPEEX_SET_USER_HANDLER:
-      {
-         SpeexCallback *c = (SpeexCallback*)ptr;
-         st->user_callback.func=c->func;
-         st->user_callback.data=c->data;
-         st->user_callback.callback_id=c->callback_id;
-      }
-      break;
-   case SPEEX_RESET_STATE:
-      {
-         int i;
-         for (i=0;i<st->lpcSize;i++)
-            st->mem_sp[i]=0;
-         for (i=0;i<st->frameSize + st->max_pitch + 1;i++)
-            st->excBuf[i]=0;
-      }
-      break;
-   case SPEEX_SET_SUBMODE_ENCODING:
-      st->encode_submode = (*(spx_int32_t*)ptr);
-      break;
-   case SPEEX_GET_SUBMODE_ENCODING:
-      (*(spx_int32_t*)ptr) = st->encode_submode;
-      break;
-   case SPEEX_GET_LOOKAHEAD:
-      (*(spx_int32_t*)ptr)=st->subframeSize;
-      break;
-   case SPEEX_SET_HIGHPASS:
-      st->highpass_enabled = (*(spx_int32_t*)ptr);
-      break;
-   case SPEEX_GET_HIGHPASS:
-      (*(spx_int32_t*)ptr) = st->highpass_enabled;
-      break;
-      /* FIXME: Convert to fixed-point and re-enable even when float API is disabled */
-#ifndef DISABLE_FLOAT_API
-   case SPEEX_GET_ACTIVITY:
-   {
-      float ret;
-      ret = log(st->level/st->min_level)/log(st->max_level/st->min_level);
-      if (ret>1)
-         ret = 1;
-      /* Done in a strange way to catch NaNs as well */
-      if (!(ret > 0))
-         ret = 0;
-      /*printf ("%f %f %f %f\n", st->level, st->min_level, st->max_level, ret);*/
-      (*(spx_int32_t*)ptr) = (int)(100*ret);
-   }
-   break;
-#endif
-   case SPEEX_GET_PI_GAIN:
-      {
-         int i;
-         spx_word32_t *g = (spx_word32_t*)ptr;
-         for (i=0;i<st->nbSubframes;i++)
-            g[i]=st->pi_gain[i];
-      }
-      break;
-   case SPEEX_GET_EXC:
-      {
-         int i;
-         for (i=0;i<st->nbSubframes;i++)
-            ((spx_word16_t*)ptr)[i] = compute_rms16(st->exc+i*st->subframeSize, st->subframeSize);
-      }
-      break;
-   case SPEEX_GET_DTX_STATUS:
-      *((spx_int32_t*)ptr) = st->dtx_enabled;
-      break;
-   case SPEEX_SET_INNOVATION_SAVE:
-      st->innov_save = (spx_word16_t*)ptr;
-      break;
-   case SPEEX_SET_WIDEBAND:
-      st->isWideband = *((spx_int32_t*)ptr);
-      break;
-   case SPEEX_GET_STACK:
-      *((char**)ptr) = st->stack;
-      break;
-   default:
-      speex_warning_int("Unknown nb_ctl request: ", request);
-      return -1;
-   }
-   return 0;
-}
diff --git a/libspeex/nb_celp.h b/libspeex/nb_celp.h
deleted file mode 100644
index 14c776f..0000000
--- a/libspeex/nb_celp.h
+++ /dev/null
@@ -1,203 +0,0 @@
-/* Copyright (C) 2002-2006 Jean-Marc Valin */
-/**
-    @file nb_celp.h
-    @brief Narrowband CELP encoder/decoder
-*/
-/*
-   Redistribution and use in source and binary forms, with or without
-   modification, 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 the Xiph.org Foundation nor the names of its
-   contributors may be used to endorse or promote products derived from
-   this software without specific prior written permission.
-   
-   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 FOUNDATION OR
-   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-*/
-
-#ifndef NB_CELP_H
-#define NB_CELP_H
-
-#include "modes.h"
-#include <speex/speex_bits.h>
-#include <speex/speex_callbacks.h>
-#include "vbr.h"
-#include "filters.h"
-
-#ifdef VORBIS_PSYCHO
-#include "vorbis_psy.h"
-#endif
-
-/**Structure representing the full state of the narrowband encoder*/
-typedef struct EncState {
-   const SpeexMode *mode;        /**< Mode corresponding to the state */
-   int    first;                 /**< Is this the first frame? */
-   int    frameSize;             /**< Size of frames */
-   int    subframeSize;          /**< Size of sub-frames */
-   int    nbSubframes;           /**< Number of sub-frames */
-   int    windowSize;            /**< Analysis (LPC) window length */
-   int    lpcSize;               /**< LPC order */
-   int    min_pitch;             /**< Minimum pitch value allowed */
-   int    max_pitch;             /**< Maximum pitch value allowed */
-
-   spx_word32_t cumul_gain;      /**< Product of previously used pitch gains (Q10) */
-   int    bounded_pitch;         /**< Next frame should not rely on previous frames for pitch */
-   int    ol_pitch;              /**< Open-loop pitch */
-   int    ol_voiced;             /**< Open-loop voiced/non-voiced decision */
-   int   *pitch;
-
-#ifdef VORBIS_PSYCHO
-   VorbisPsy *psy;
-   float *psy_window;
-   float *curve;
-   float *old_curve;
-#endif
-
-   spx_word16_t  gamma1;         /**< Perceptual filter: A(z/gamma1) */
-   spx_word16_t  gamma2;         /**< Perceptual filter: A(z/gamma2) */
-   spx_word16_t  lpc_floor;      /**< Noise floor multiplier for A[0] in LPC analysis*/
-   char  *stack;                 /**< Pseudo-stack allocation for temporary memory */
-   spx_word16_t *winBuf;         /**< Input buffer (original signal) */
-   spx_word16_t *excBuf;         /**< Excitation buffer */
-   spx_word16_t *exc;            /**< Start of excitation frame */
-   spx_word16_t *swBuf;          /**< Weighted signal buffer */
-   spx_word16_t *sw;             /**< Start of weighted signal frame */
-   const spx_word16_t *window;   /**< Temporary (Hanning) window */
-   const spx_word16_t *lagWindow;      /**< Window applied to auto-correlation */
-   spx_lsp_t *old_lsp;           /**< LSPs for previous frame */
-   spx_lsp_t *old_qlsp;          /**< Quantized LSPs for previous frame */
-   spx_mem_t *mem_sp;            /**< Filter memory for signal synthesis */
-   spx_mem_t *mem_sw;            /**< Filter memory for perceptually-weighted signal */
-   spx_mem_t *mem_sw_whole;      /**< Filter memory for perceptually-weighted signal (whole frame)*/
-   spx_mem_t *mem_exc;           /**< Filter memory for excitation (whole frame) */
-   spx_mem_t *mem_exc2;          /**< Filter memory for excitation (whole frame) */
-   spx_mem_t mem_hp[2];          /**< High-pass filter memory */
-   spx_word32_t *pi_gain;        /**< Gain of LPC filter at theta=pi (fe/2) */
-   spx_word16_t *innov_rms_save; /**< If non-NULL, innovation RMS is copied here */
-
-#ifndef DISABLE_VBR
-   VBRState *vbr;                /**< State of the VBR data */
-   float  vbr_quality;           /**< Quality setting for VBR encoding */
-   float  relative_quality;      /**< Relative quality that will be needed by VBR */
-   spx_int32_t vbr_enabled;      /**< 1 for enabling VBR, 0 otherwise */
-   spx_int32_t vbr_max;          /**< Max bit-rate allowed in VBR mode */
-   int    vad_enabled;           /**< 1 for enabling VAD, 0 otherwise */
-   int    dtx_enabled;           /**< 1 for enabling DTX, 0 otherwise */
-   int    dtx_count;             /**< Number of consecutive DTX frames */
-   spx_int32_t abr_enabled;      /**< ABR setting (in bps), 0 if off */
-   float  abr_drift;
-   float  abr_drift2;
-   float  abr_count;
-#endif /* #ifndef DISABLE_VBR */
-   
-   int    complexity;            /**< Complexity setting (0-10 from least complex to most complex) */
-   spx_int32_t sampling_rate;
-   int    plc_tuning;
-   int    encode_submode;
-   const SpeexSubmode * const *submodes; /**< Sub-mode data */
-   int    submodeID;             /**< Activated sub-mode */
-   int    submodeSelect;         /**< Mode chosen by the user (may differ from submodeID if VAD is on) */
-   int    isWideband;            /**< Is this used as part of the embedded wideband codec */
-   int    highpass_enabled;        /**< Is the input filter enabled */
-} EncState;
-
-/**Structure representing the full state of the narrowband decoder*/
-typedef struct DecState {
-   const SpeexMode *mode;       /**< Mode corresponding to the state */
-   int    first;                /**< Is this the first frame? */
-   int    count_lost;           /**< Was the last frame lost? */
-   int    frameSize;            /**< Size of frames */
-   int    subframeSize;         /**< Size of sub-frames */
-   int    nbSubframes;          /**< Number of sub-frames */
-   int    lpcSize;              /**< LPC order */
-   int    min_pitch;            /**< Minimum pitch value allowed */
-   int    max_pitch;            /**< Maximum pitch value allowed */
-   spx_int32_t sampling_rate;
-
-   spx_word16_t  last_ol_gain;  /**< Open-loop gain for previous frame */
-
-   char  *stack;                /**< Pseudo-stack allocation for temporary memory */
-   spx_word16_t *excBuf;        /**< Excitation buffer */
-   spx_word16_t *exc;           /**< Start of excitation frame */
-   spx_lsp_t *old_qlsp;         /**< Quantized LSPs for previous frame */
-   spx_coef_t *interp_qlpc;     /**< Interpolated quantized LPCs */
-   spx_mem_t *mem_sp;           /**< Filter memory for synthesis signal */
-   spx_mem_t mem_hp[2];         /**< High-pass filter memory */
-   spx_word32_t *pi_gain;       /**< Gain of LPC filter at theta=pi (fe/2) */
-   spx_word16_t *innov_save;    /** If non-NULL, innovation is copied here */
-   
-   spx_word16_t level;
-   spx_word16_t max_level;
-   spx_word16_t min_level;
-   
-   /* This is used in packet loss concealment */
-   int    last_pitch;           /**< Pitch of last correctly decoded frame */
-   spx_word16_t  last_pitch_gain; /**< Pitch gain of last correctly decoded frame */
-   spx_word16_t  pitch_gain_buf[3]; /**< Pitch gain of last decoded frames */
-   int    pitch_gain_buf_idx;   /**< Tail of the buffer */
-   spx_int32_t seed;            /** Seed used for random number generation */
-   
-   int    encode_submode;
-   const SpeexSubmode * const *submodes; /**< Sub-mode data */
-   int    submodeID;            /**< Activated sub-mode */
-   int    lpc_enh_enabled;      /**< 1 when LPC enhancer is on, 0 otherwise */
-   SpeexCallback speex_callbacks[SPEEX_MAX_CALLBACKS];
-
-   SpeexCallback user_callback;
-
-   /*Vocoder data*/
-   spx_word16_t  voc_m1;
-   spx_word32_t  voc_m2;
-   spx_word16_t  voc_mean;
-   int    voc_offset;
-
-   int    dtx_enabled;
-   int    isWideband;            /**< Is this used as part of the embedded wideband codec */
-   int    highpass_enabled;        /**< Is the input filter enabled */
-} DecState;
-
-/** Initializes encoder state*/
-void *nb_encoder_init(const SpeexMode *m);
-
-/** De-allocates encoder state resources*/
-void nb_encoder_destroy(void *state);
-
-/** Encodes one frame*/
-int nb_encode(void *state, void *in, SpeexBits *bits);
-
-
-/** Initializes decoder state*/
-void *nb_decoder_init(const SpeexMode *m);
-
-/** De-allocates decoder state resources*/
-void nb_decoder_destroy(void *state);
-
-/** Decodes one frame*/
-int nb_decode(void *state, SpeexBits *bits, void *out);
-
-/** ioctl-like function for controlling a narrowband encoder */
-int nb_encoder_ctl(void *state, int request, void *ptr);
-
-/** ioctl-like function for controlling a narrowband decoder */
-int nb_decoder_ctl(void *state, int request, void *ptr);
-
-
-#endif
diff --git a/libspeex/os_support.h b/libspeex/os_support.h
deleted file mode 100644
index 6b74b0c..0000000
--- a/libspeex/os_support.h
+++ /dev/null
@@ -1,169 +0,0 @@
-/* Copyright (C) 2007 Jean-Marc Valin
-      
-   File: os_support.h
-   This is the (tiny) OS abstraction layer. Aside from math.h, this is the
-   only place where system headers are allowed.
-
-   Redistribution and use in source and binary forms, with or without
-   modification, are permitted provided that the following conditions are
-   met:
-
-   1. Redistributions of source code must retain the above copyright notice,
-   this list of conditions and the following disclaimer.
-
-   2. 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.
-
-   3. The name of the author may not be used to endorse or promote products
-   derived from this software without specific prior written permission.
-
-   THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR BE LIABLE FOR ANY DIRECT,
-   INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-   (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-   SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-   HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-   STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-   ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-   POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef OS_SUPPORT_H
-#define OS_SUPPORT_H
-
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-#ifdef OS_SUPPORT_CUSTOM
-#include "os_support_custom.h"
-#endif
-
-/** Speex wrapper for calloc. To do your own dynamic allocation, all you need to do is replace this function, speex_realloc and speex_free 
-    NOTE: speex_alloc needs to CLEAR THE MEMORY */
-#ifndef OVERRIDE_SPEEX_ALLOC
-static inline void *speex_alloc (int size)
-{
-   /* WARNING: this is not equivalent to malloc(). If you want to use malloc() 
-      or your own allocator, YOU NEED TO CLEAR THE MEMORY ALLOCATED. Otherwise
-      you will experience strange bugs */
-   return calloc(size,1);
-}
-#endif
-
-/** Same as speex_alloc, except that the area is only needed inside a Speex call (might cause problem with wideband though) */
-#ifndef OVERRIDE_SPEEX_ALLOC_SCRATCH
-static inline void *speex_alloc_scratch (int size)
-{
-   /* Scratch space doesn't need to be cleared */
-   return calloc(size,1);
-}
-#endif
-
-/** Speex wrapper for realloc. To do your own dynamic allocation, all you need to do is replace this function, speex_alloc and speex_free */
-#ifndef OVERRIDE_SPEEX_REALLOC
-static inline void *speex_realloc (void *ptr, int size)
-{
-   return realloc(ptr, size);
-}
-#endif
-
-/** Speex wrapper for calloc. To do your own dynamic allocation, all you need to do is replace this function, speex_realloc and speex_alloc */
-#ifndef OVERRIDE_SPEEX_FREE
-static inline void speex_free (void *ptr)
-{
-   free(ptr);
-}
-#endif
-
-/** Same as speex_free, except that the area is only needed inside a Speex call (might cause problem with wideband though) */
-#ifndef OVERRIDE_SPEEX_FREE_SCRATCH
-static inline void speex_free_scratch (void *ptr)
-{
-   free(ptr);
-}
-#endif
-
-/** Copy n bytes of memory from src to dst. The 0* term provides compile-time type checking  */
-#ifndef OVERRIDE_SPEEX_COPY
-#define SPEEX_COPY(dst, src, n) (memcpy((dst), (src), (n)*sizeof(*(dst)) + 0*((dst)-(src)) ))
-#endif
-
-/** Copy n bytes of memory from src to dst, allowing overlapping regions. The 0* term 
-    provides compile-time type checking */
-#ifndef OVERRIDE_SPEEX_MOVE
-#define SPEEX_MOVE(dst, src, n) (memmove((dst), (src), (n)*sizeof(*(dst)) + 0*((dst)-(src)) ))
-#endif
-
-/** Set n bytes of memory to value of c, starting at address s */
-#ifndef OVERRIDE_SPEEX_MEMSET
-#define SPEEX_MEMSET(dst, c, n) (memset((dst), (c), (n)*sizeof(*(dst))))
-#endif
-
-
-#ifndef OVERRIDE_SPEEX_FATAL
-static inline void _speex_fatal(const char *str, const char *file, int line)
-{
-   fprintf (stderr, "Fatal (internal) error in %s, line %d: %s\n", file, line, str);
-   exit(1);
-}
-#endif
-
-#ifndef OVERRIDE_SPEEX_WARNING
-static inline void speex_warning(const char *str)
-{
-#ifndef DISABLE_WARNINGS
-   fprintf (stderr, "warning: %s\n", str);
-#endif
-}
-#endif
-
-#ifndef OVERRIDE_SPEEX_WARNING_INT
-static inline void speex_warning_int(const char *str, int val)
-{
-#ifndef DISABLE_WARNINGS
-   fprintf (stderr, "warning: %s %d\n", str, val);
-#endif
-}
-#endif
-
-#ifndef OVERRIDE_SPEEX_NOTIFY
-static inline void speex_notify(const char *str)
-{
-#ifndef DISABLE_NOTIFICATIONS
-   fprintf (stderr, "notification: %s\n", str);
-#endif
-}
-#endif
-
-#ifndef OVERRIDE_SPEEX_PUTC
-/** Speex wrapper for putc */
-static inline void _speex_putc(int ch, void *file)
-{
-   FILE *f = (FILE *)file;
-   fprintf(f, "%c", ch);
-}
-#endif
-
-#define speex_fatal(str) _speex_fatal(str, __FILE__, __LINE__);
-#define speex_assert(cond) {if (!(cond)) {speex_fatal("assertion failed: " #cond);}}
-
-#ifndef RELEASE
-static inline void print_vec(float *vec, int len, char *name)
-{
-   int i;
-   printf ("%s ", name);
-   for (i=0;i<len;i++)
-      printf (" %f", vec[i]);
-   printf ("\n");
-}
-#endif
-
-#endif
-
diff --git a/libspeex/pseudofloat.h b/libspeex/pseudofloat.h
deleted file mode 100644
index fa841a0..0000000
--- a/libspeex/pseudofloat.h
+++ /dev/null
@@ -1,379 +0,0 @@
-/* Copyright (C) 2005 Jean-Marc Valin */
-/**
-   @file pseudofloat.h
-   @brief Pseudo-floating point
- * This header file provides a lightweight floating point type for
- * use on fixed-point platforms when a large dynamic range is 
- * required. The new type is not compatible with the 32-bit IEEE format,
- * it is not even remotely as accurate as 32-bit floats, and is not
- * even guaranteed to produce even remotely correct results for code
- * other than Speex. It makes all kinds of shortcuts that are acceptable
- * for Speex, but may not be acceptable for your application. You're
- * quite welcome to reuse this code and improve it, but don't assume
- * it works out of the box. Most likely, it doesn't.
- */
-/*
-   Redistribution and use in source and binary forms, with or without
-   modification, 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 the Xiph.org Foundation nor the names of its
-   contributors may be used to endorse or promote products derived from
-   this software without specific prior written permission.
-   
-   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 FOUNDATION OR
-   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef PSEUDOFLOAT_H
-#define PSEUDOFLOAT_H
-
-#include "arch.h"
-#include "os_support.h"
-#include "math_approx.h"
-#include <math.h>
-
-#ifdef FIXED_POINT
-
-typedef struct {
-   spx_int16_t m;
-   spx_int16_t e;
-} spx_float_t;
-
-static const spx_float_t FLOAT_ZERO = {0,0};
-static const spx_float_t FLOAT_ONE = {16384,-14};
-static const spx_float_t FLOAT_HALF = {16384,-15};
-
-#define MIN(a,b) ((a)<(b)?(a):(b))
-static inline spx_float_t PSEUDOFLOAT(spx_int32_t x)
-{
-   int e=0;
-   int sign=0;
-   if (x<0)
-   {
-      sign = 1;
-      x = -x;
-   }
-   if (x==0)
-   {
-      spx_float_t r = {0,0};
-      return r;
-   }
-   e = spx_ilog2(ABS32(x))-14;
-   x = VSHR32(x, e);
-   if (sign)
-   {
-      spx_float_t r;
-      r.m = -x;
-      r.e = e;
-      return r;
-   }
-   else      
-   {
-      spx_float_t r;
-      r.m = x;
-      r.e = e;
-      return r;
-   }
-}
-
-
-static inline spx_float_t FLOAT_ADD(spx_float_t a, spx_float_t b)
-{
-   spx_float_t r;
-   if (a.m==0)
-      return b;
-   else if (b.m==0)
-      return a;
-   if ((a).e > (b).e) 
-   {
-      r.m = ((a).m>>1) + ((b).m>>MIN(15,(a).e-(b).e+1));
-      r.e = (a).e+1;
-   }
-   else 
-   {
-      r.m = ((b).m>>1) + ((a).m>>MIN(15,(b).e-(a).e+1));
-      r.e = (b).e+1;
-   }
-   if (r.m>0)
-   {
-      if (r.m<16384)
-      {
-         r.m<<=1;
-         r.e-=1;
-      }
-   } else {
-      if (r.m>-16384)
-      {
-         r.m<<=1;
-         r.e-=1;
-      }
-   }
-   /*printf ("%f + %f = %f\n", REALFLOAT(a), REALFLOAT(b), REALFLOAT(r));*/
-   return r;
-}
-
-static inline spx_float_t FLOAT_SUB(spx_float_t a, spx_float_t b)
-{
-   spx_float_t r;
-   if (a.m==0)
-      return b;
-   else if (b.m==0)
-      return a;
-   if ((a).e > (b).e)
-   {
-      r.m = ((a).m>>1) - ((b).m>>MIN(15,(a).e-(b).e+1));
-      r.e = (a).e+1;
-   }
-   else 
-   {
-      r.m = ((a).m>>MIN(15,(b).e-(a).e+1)) - ((b).m>>1);
-      r.e = (b).e+1;
-   }
-   if (r.m>0)
-   {
-      if (r.m<16384)
-      {
-         r.m<<=1;
-         r.e-=1;
-      }
-   } else {
-      if (r.m>-16384)
-      {
-         r.m<<=1;
-         r.e-=1;
-      }
-   }
-   /*printf ("%f + %f = %f\n", REALFLOAT(a), REALFLOAT(b), REALFLOAT(r));*/
-   return r;
-}
-
-static inline int FLOAT_LT(spx_float_t a, spx_float_t b)
-{
-   if (a.m==0)
-      return b.m>0;
-   else if (b.m==0)
-      return a.m<0;   
-   if ((a).e > (b).e)
-      return ((a).m>>1) < ((b).m>>MIN(15,(a).e-(b).e+1));
-   else 
-      return ((b).m>>1) > ((a).m>>MIN(15,(b).e-(a).e+1));
-
-}
-
-static inline int FLOAT_GT(spx_float_t a, spx_float_t b)
-{
-   return FLOAT_LT(b,a);
-}
-
-static inline spx_float_t FLOAT_MULT(spx_float_t a, spx_float_t b)
-{
-   spx_float_t r;
-   r.m = (spx_int16_t)((spx_int32_t)(a).m*(b).m>>15);
-   r.e = (a).e+(b).e+15;
-   if (r.m>0)
-   {
-      if (r.m<16384)
-      {
-         r.m<<=1;
-         r.e-=1;
-      }
-   } else {
-      if (r.m>-16384)
-      {
-         r.m<<=1;
-         r.e-=1;
-      }
-   }
-   /*printf ("%f * %f = %f\n", REALFLOAT(a), REALFLOAT(b), REALFLOAT(r));*/
-   return r;   
-}
-
-static inline spx_float_t FLOAT_AMULT(spx_float_t a, spx_float_t b)
-{
-   spx_float_t r;
-   r.m = (spx_int16_t)((spx_int32_t)(a).m*(b).m>>15);
-   r.e = (a).e+(b).e+15;
-   return r;   
-}
-
-
-static inline spx_float_t FLOAT_SHL(spx_float_t a, int b)
-{
-   spx_float_t r;
-   r.m = a.m;
-   r.e = a.e+b;
-   return r;
-}
-
-static inline spx_int16_t FLOAT_EXTRACT16(spx_float_t a)
-{
-   if (a.e<0)
-      return EXTRACT16((EXTEND32(a.m)+(EXTEND32(1)<<(-a.e-1)))>>-a.e);
-   else
-      return a.m<<a.e;
-}
-
-static inline spx_int32_t FLOAT_EXTRACT32(spx_float_t a)
-{
-   if (a.e<0)
-      return (EXTEND32(a.m)+(EXTEND32(1)<<(-a.e-1)))>>-a.e;
-   else
-      return EXTEND32(a.m)<<a.e;
-}
-
-static inline spx_int32_t FLOAT_MUL32(spx_float_t a, spx_word32_t b)
-{
-   return VSHR32(MULT16_32_Q15(a.m, b),-a.e-15);
-}
-
-static inline spx_float_t FLOAT_MUL32U(spx_word32_t a, spx_word32_t b)
-{
-   int e1, e2;
-   spx_float_t r;
-   if (a==0 || b==0)
-   {
-      return FLOAT_ZERO;
-   }
-   e1 = spx_ilog2(ABS32(a));
-   a = VSHR32(a, e1-14);
-   e2 = spx_ilog2(ABS32(b));
-   b = VSHR32(b, e2-14);
-   r.m = MULT16_16_Q15(a,b);
-   r.e = e1+e2-13;
-   return r;
-}
-
-/* Do NOT attempt to divide by a negative number */
-static inline spx_float_t FLOAT_DIV32_FLOAT(spx_word32_t a, spx_float_t b)
-{
-   int e=0;
-   spx_float_t r;
-   if (a==0)
-   {
-      return FLOAT_ZERO;
-   }
-   e = spx_ilog2(ABS32(a))-spx_ilog2(b.m-1)-15;
-   a = VSHR32(a, e);
-   if (ABS32(a)>=SHL32(EXTEND32(b.m-1),15))
-   {
-      a >>= 1;
-      e++;
-   }
-   r.m = DIV32_16(a,b.m);
-   r.e = e-b.e;
-   return r;
-}
-
-
-/* Do NOT attempt to divide by a negative number */
-static inline spx_float_t FLOAT_DIV32(spx_word32_t a, spx_word32_t b)
-{
-   int e0=0,e=0;
-   spx_float_t r;
-   if (a==0)
-   {
-      return FLOAT_ZERO;
-   }
-   if (b>32767)
-   {
-      e0 = spx_ilog2(b)-14;
-      b = VSHR32(b, e0);
-      e0 = -e0;
-   }
-   e = spx_ilog2(ABS32(a))-spx_ilog2(b-1)-15;
-   a = VSHR32(a, e);
-   if (ABS32(a)>=SHL32(EXTEND32(b-1),15))
-   {
-      a >>= 1;
-      e++;
-   }
-   e += e0;
-   r.m = DIV32_16(a,b);
-   r.e = e;
-   return r;
-}
-
-/* Do NOT attempt to divide by a negative number */
-static inline spx_float_t FLOAT_DIVU(spx_float_t a, spx_float_t b)
-{
-   int e=0;
-   spx_int32_t num;
-   spx_float_t r;
-   if (b.m<=0)
-   {
-      speex_warning_int("Attempted to divide by", b.m);
-      return FLOAT_ONE;
-   }
-   num = a.m;
-   a.m = ABS16(a.m);
-   while (a.m >= b.m)
-   {
-      e++;
-      a.m >>= 1;
-   }
-   num = num << (15-e);
-   r.m = DIV32_16(num,b.m);
-   r.e = a.e-b.e-15+e;
-   return r;
-}
-
-static inline spx_float_t FLOAT_SQRT(spx_float_t a)
-{
-   spx_float_t r;
-   spx_int32_t m;
-   m = SHL32(EXTEND32(a.m), 14);
-   r.e = a.e - 14;
-   if (r.e & 1)
-   {
-      r.e -= 1;
-      m <<= 1;
-   }
-   r.e >>= 1;
-   r.m = spx_sqrt(m);
-   return r;
-}
-
-#else
-
-#define spx_float_t float
-#define FLOAT_ZERO 0.f
-#define FLOAT_ONE 1.f
-#define FLOAT_HALF 0.5f
-#define PSEUDOFLOAT(x) (x)
-#define FLOAT_MULT(a,b) ((a)*(b))
-#define FLOAT_AMULT(a,b) ((a)*(b))
-#define FLOAT_MUL32(a,b) ((a)*(b))
-#define FLOAT_DIV32(a,b) ((a)/(b))
-#define FLOAT_EXTRACT16(a) (a)
-#define FLOAT_EXTRACT32(a) (a)
-#define FLOAT_ADD(a,b) ((a)+(b))
-#define FLOAT_SUB(a,b) ((a)-(b))
-#define REALFLOAT(x) (x)
-#define FLOAT_DIV32_FLOAT(a,b) ((a)/(b))
-#define FLOAT_MUL32U(a,b) ((a)*(b))
-#define FLOAT_SHL(a,b) (a)
-#define FLOAT_LT(a,b) ((a)<(b))
-#define FLOAT_GT(a,b) ((a)>(b))
-#define FLOAT_DIVU(a,b) ((a)/(b))
-#define FLOAT_SQRT(a) (spx_sqrt(a))
-
-#endif
-
-#endif
diff --git a/libspeex/quant_lsp.c b/libspeex/quant_lsp.c
deleted file mode 100644
index e624d1a..0000000
--- a/libspeex/quant_lsp.c
+++ /dev/null
@@ -1,385 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin 
-   File: quant_lsp.c
-   LSP vector quantization
-
-   Redistribution and use in source and binary forms, with or without
-   modification, 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 the Xiph.org Foundation nor the names of its
-   contributors may be used to endorse or promote products derived from
-   this software without specific prior written permission.
-   
-   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 FOUNDATION 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.
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "quant_lsp.h"
-#include "os_support.h"
-#include <math.h>
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
-
-#include "arch.h"
-
-#ifdef BFIN_ASM
-#include "quant_lsp_bfin.h"
-#endif
-
-#ifdef FIXED_POINT
-
-#define LSP_LINEAR(i) (SHL16(i+1,11))
-#define LSP_LINEAR_HIGH(i) (ADD16(MULT16_16_16(i,2560),6144))
-#define LSP_DIV_256(x) (SHL16((spx_word16_t)x, 5))
-#define LSP_DIV_512(x) (SHL16((spx_word16_t)x, 4))
-#define LSP_DIV_1024(x) (SHL16((spx_word16_t)x, 3))
-#define LSP_PI 25736
-
-#else
-
-#define LSP_LINEAR(i) (.25*(i)+.25)
-#define LSP_LINEAR_HIGH(i) (.3125*(i)+.75)
-#define LSP_SCALE 256.
-#define LSP_DIV_256(x) (0.0039062*(x))
-#define LSP_DIV_512(x) (0.0019531*(x))
-#define LSP_DIV_1024(x) (0.00097656*(x))
-#define LSP_PI M_PI
-
-#endif
-
-static void compute_quant_weights(spx_lsp_t *qlsp, spx_word16_t *quant_weight, int order)
-{
-   int i;
-   spx_word16_t tmp1, tmp2;
-   for (i=0;i<order;i++)
-   {
-      if (i==0)
-         tmp1 = qlsp[i];
-      else
-         tmp1 = qlsp[i]-qlsp[i-1];
-      if (i==order-1)
-         tmp2 = LSP_PI-qlsp[i];
-      else
-         tmp2 = qlsp[i+1]-qlsp[i];
-      if (tmp2<tmp1)
-         tmp1 = tmp2;
-#ifdef FIXED_POINT
-      quant_weight[i] = DIV32_16(81920,ADD16(300,tmp1));
-#else
-      quant_weight[i] = 10/(.04+tmp1);
-#endif
-   }
-
-}
-
-/* Note: x is modified*/
-#ifndef OVERRIDE_LSP_QUANT
-static int lsp_quant(spx_word16_t *x, const signed char *cdbk, int nbVec, int nbDim)
-{
-   int i,j;
-   spx_word32_t dist;
-   spx_word16_t tmp;
-   spx_word32_t best_dist=VERY_LARGE32;
-   int best_id=0;
-   const signed char *ptr=cdbk;
-   for (i=0;i<nbVec;i++)
-   {
-      dist=0;
-      for (j=0;j<nbDim;j++)
-      {
-         tmp=SUB16(x[j],SHL16((spx_word16_t)*ptr++,5));
-         dist=MAC16_16(dist,tmp,tmp);
-      } 
-      if (dist<best_dist)
-      {
-         best_dist=dist;
-         best_id=i;
-      }
-   }
-
-   for (j=0;j<nbDim;j++)
-      x[j] = SUB16(x[j],SHL16((spx_word16_t)cdbk[best_id*nbDim+j],5));
-    
-   return best_id;
-}
-#endif
-
-/* Note: x is modified*/
-#ifndef OVERRIDE_LSP_WEIGHT_QUANT
-static int lsp_weight_quant(spx_word16_t *x, spx_word16_t *weight, const signed char *cdbk, int nbVec, int nbDim)
-{
-   int i,j;
-   spx_word32_t dist;
-   spx_word16_t tmp;
-   spx_word32_t best_dist=VERY_LARGE32;
-   int best_id=0;
-   const signed char *ptr=cdbk;
-   for (i=0;i<nbVec;i++)
-   {
-      dist=0;
-      for (j=0;j<nbDim;j++)
-      {
-         tmp=SUB16(x[j],SHL16((spx_word16_t)*ptr++,5));
-         dist=MAC16_32_Q15(dist,weight[j],MULT16_16(tmp,tmp));
-      }
-      if (dist<best_dist)
-      {
-         best_dist=dist;
-         best_id=i;
-      }
-   }
-   
-   for (j=0;j<nbDim;j++)
-      x[j] = SUB16(x[j],SHL16((spx_word16_t)cdbk[best_id*nbDim+j],5));
-   return best_id;
-}
-#endif
-
-void lsp_quant_nb(spx_lsp_t *lsp, spx_lsp_t *qlsp, int order, SpeexBits *bits)
-{
-   int i;
-   int id;
-   spx_word16_t quant_weight[10];
-   
-   for (i=0;i<order;i++)
-      qlsp[i]=lsp[i];
-
-   compute_quant_weights(qlsp, quant_weight, order);
-
-   for (i=0;i<order;i++)
-      qlsp[i]=SUB16(qlsp[i],LSP_LINEAR(i));
-
-#ifndef FIXED_POINT
-   for (i=0;i<order;i++)
-      qlsp[i] = LSP_SCALE*qlsp[i];
-#endif
-   id = lsp_quant(qlsp, cdbk_nb, NB_CDBK_SIZE, order);
-   speex_bits_pack(bits, id, 6);
-
-   for (i=0;i<order;i++)
-      qlsp[i]*=2;
- 
-   id = lsp_weight_quant(qlsp, quant_weight, cdbk_nb_low1, NB_CDBK_SIZE_LOW1, 5);
-   speex_bits_pack(bits, id, 6);
-
-   for (i=0;i<5;i++)
-      qlsp[i]*=2;
-
-   id = lsp_weight_quant(qlsp, quant_weight, cdbk_nb_low2, NB_CDBK_SIZE_LOW2, 5);
-   speex_bits_pack(bits, id, 6);
-
-   id = lsp_weight_quant(qlsp+5, quant_weight+5, cdbk_nb_high1, NB_CDBK_SIZE_HIGH1, 5);
-   speex_bits_pack(bits, id, 6);
-
-   for (i=5;i<10;i++)
-      qlsp[i]*=2;
-
-   id = lsp_weight_quant(qlsp+5, quant_weight+5, cdbk_nb_high2, NB_CDBK_SIZE_HIGH2, 5);
-   speex_bits_pack(bits, id, 6);
-
-#ifdef FIXED_POINT
-   for (i=0;i<order;i++)
-      qlsp[i]=PSHR16(qlsp[i],2);
-#else
-   for (i=0;i<order;i++)
-      qlsp[i]=qlsp[i] * .00097656;
-#endif
-
-   for (i=0;i<order;i++)
-      qlsp[i]=lsp[i]-qlsp[i];
-}
-
-void lsp_unquant_nb(spx_lsp_t *lsp, int order, SpeexBits *bits)
-{
-   int i, id;
-   for (i=0;i<order;i++)
-      lsp[i]=LSP_LINEAR(i);
-
-
-   id=speex_bits_unpack_unsigned(bits, 6);
-   for (i=0;i<10;i++)
-      lsp[i] = ADD32(lsp[i], LSP_DIV_256(cdbk_nb[id*10+i]));
-
-   id=speex_bits_unpack_unsigned(bits, 6);
-   for (i=0;i<5;i++)
-      lsp[i] = ADD16(lsp[i], LSP_DIV_512(cdbk_nb_low1[id*5+i]));
-
-   id=speex_bits_unpack_unsigned(bits, 6);
-   for (i=0;i<5;i++)
-      lsp[i] = ADD32(lsp[i], LSP_DIV_1024(cdbk_nb_low2[id*5+i]));
-
-   id=speex_bits_unpack_unsigned(bits, 6);
-   for (i=0;i<5;i++)
-      lsp[i+5] = ADD32(lsp[i+5], LSP_DIV_512(cdbk_nb_high1[id*5+i]));
-   
-   id=speex_bits_unpack_unsigned(bits, 6);
-   for (i=0;i<5;i++)
-      lsp[i+5] = ADD32(lsp[i+5], LSP_DIV_1024(cdbk_nb_high2[id*5+i]));
-}
-
-
-void lsp_quant_lbr(spx_lsp_t *lsp, spx_lsp_t *qlsp, int order, SpeexBits *bits)
-{
-   int i;
-   int id;
-   spx_word16_t quant_weight[10];
-
-   for (i=0;i<order;i++)
-      qlsp[i]=lsp[i];
-
-   compute_quant_weights(qlsp, quant_weight, order);
-
-   for (i=0;i<order;i++)
-      qlsp[i]=SUB16(qlsp[i],LSP_LINEAR(i));
-#ifndef FIXED_POINT
-   for (i=0;i<order;i++)
-      qlsp[i]=qlsp[i]*LSP_SCALE;
-#endif
-   id = lsp_quant(qlsp, cdbk_nb, NB_CDBK_SIZE, order);
-   speex_bits_pack(bits, id, 6);
-   
-   for (i=0;i<order;i++)
-      qlsp[i]*=2;
-   
-   id = lsp_weight_quant(qlsp, quant_weight, cdbk_nb_low1, NB_CDBK_SIZE_LOW1, 5);
-   speex_bits_pack(bits, id, 6);
-
-   id = lsp_weight_quant(qlsp+5, quant_weight+5, cdbk_nb_high1, NB_CDBK_SIZE_HIGH1, 5);
-   speex_bits_pack(bits, id, 6);
-
-#ifdef FIXED_POINT
-   for (i=0;i<order;i++)
-      qlsp[i] = PSHR16(qlsp[i],1);
-#else
-   for (i=0;i<order;i++)
-      qlsp[i] = qlsp[i]*0.0019531;
-#endif
-
-   for (i=0;i<order;i++)
-      qlsp[i]=lsp[i]-qlsp[i];
-}
-
-void lsp_unquant_lbr(spx_lsp_t *lsp, int order, SpeexBits *bits)
-{
-   int i, id;
-   for (i=0;i<order;i++)
-      lsp[i]=LSP_LINEAR(i);
-
-
-   id=speex_bits_unpack_unsigned(bits, 6);
-   for (i=0;i<10;i++)
-      lsp[i] += LSP_DIV_256(cdbk_nb[id*10+i]);
-
-   id=speex_bits_unpack_unsigned(bits, 6);
-   for (i=0;i<5;i++)
-      lsp[i] += LSP_DIV_512(cdbk_nb_low1[id*5+i]);
-
-   id=speex_bits_unpack_unsigned(bits, 6);
-   for (i=0;i<5;i++)
-      lsp[i+5] += LSP_DIV_512(cdbk_nb_high1[id*5+i]);
-   
-}
-
-
-#ifdef DISABLE_WIDEBAND
-void lsp_quant_high(spx_lsp_t *lsp, spx_lsp_t *qlsp, int order, SpeexBits *bits)
-{
-   speex_fatal("Wideband and Ultra-wideband are disabled");
-}
-void lsp_unquant_high(spx_lsp_t *lsp, int order, SpeexBits *bits)
-{
-   speex_fatal("Wideband and Ultra-wideband are disabled");
-}
-#else
-extern const signed char high_lsp_cdbk[];
-extern const signed char high_lsp_cdbk2[];
-
-
-void lsp_quant_high(spx_lsp_t *lsp, spx_lsp_t *qlsp, int order, SpeexBits *bits)
-{
-   int i;
-   int id;
-   spx_word16_t quant_weight[10];
-
-   for (i=0;i<order;i++)
-      qlsp[i]=lsp[i];
-
-   compute_quant_weights(qlsp, quant_weight, order);
-
-   /*   quant_weight[0] = 10/(qlsp[1]-qlsp[0]);
-   quant_weight[order-1] = 10/(qlsp[order-1]-qlsp[order-2]);
-   for (i=1;i<order-1;i++)
-   {
-      tmp1 = 10/(qlsp[i]-qlsp[i-1]);
-      tmp2 = 10/(qlsp[i+1]-qlsp[i]);
-      quant_weight[i] = tmp1 > tmp2 ? tmp1 : tmp2;
-      }*/
-
-   for (i=0;i<order;i++)
-      qlsp[i]=SUB16(qlsp[i],LSP_LINEAR_HIGH(i));
-#ifndef FIXED_POINT
-   for (i=0;i<order;i++)
-      qlsp[i] = qlsp[i]*LSP_SCALE;
-#endif
-   id = lsp_quant(qlsp, high_lsp_cdbk, 64, order);
-   speex_bits_pack(bits, id, 6);
-
-   for (i=0;i<order;i++)
-      qlsp[i]*=2;
-
-   id = lsp_weight_quant(qlsp, quant_weight, high_lsp_cdbk2, 64, order);
-   speex_bits_pack(bits, id, 6);
-
-#ifdef FIXED_POINT
-   for (i=0;i<order;i++)
-      qlsp[i] = PSHR16(qlsp[i],1);
-#else
-   for (i=0;i<order;i++)
-      qlsp[i] = qlsp[i]*0.0019531;
-#endif
-
-   for (i=0;i<order;i++)
-      qlsp[i]=lsp[i]-qlsp[i];
-}
-
-void lsp_unquant_high(spx_lsp_t *lsp, int order, SpeexBits *bits)
-{
-
-   int i, id;
-   for (i=0;i<order;i++)
-      lsp[i]=LSP_LINEAR_HIGH(i);
-
-
-   id=speex_bits_unpack_unsigned(bits, 6);
-   for (i=0;i<order;i++)
-      lsp[i] += LSP_DIV_256(high_lsp_cdbk[id*order+i]);
-
-
-   id=speex_bits_unpack_unsigned(bits, 6);
-   for (i=0;i<order;i++)
-      lsp[i] += LSP_DIV_512(high_lsp_cdbk2[id*order+i]);
-}
-
-#endif
-
diff --git a/libspeex/quant_lsp.h b/libspeex/quant_lsp.h
deleted file mode 100644
index 3bf4d40..0000000
--- a/libspeex/quant_lsp.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin */
-/**
-   @file quant_lsp.h
-   @brief LSP vector quantization
-*/
-/*
-   Redistribution and use in source and binary forms, with or without
-   modification, 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 the Xiph.org Foundation nor the names of its
-   contributors may be used to endorse or promote products derived from
-   this software without specific prior written permission.
-   
-   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 FOUNDATION OR
-   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef QUANT_LSP_H
-#define QUANT_LSP_H
-
-#include <speex/speex_bits.h>
-#include "arch.h"
-
-#define MAX_LSP_SIZE 20
-
-#define NB_CDBK_SIZE 64
-#define NB_CDBK_SIZE_LOW1 64
-#define NB_CDBK_SIZE_LOW2 64
-#define NB_CDBK_SIZE_HIGH1 64
-#define NB_CDBK_SIZE_HIGH2 64
-
-/*Narrowband codebooks*/
-extern const signed char cdbk_nb[];
-extern const signed char cdbk_nb_low1[];
-extern const signed char cdbk_nb_low2[];
-extern const signed char cdbk_nb_high1[];
-extern const signed char cdbk_nb_high2[];
-
-/* Quantizes narrowband LSPs with 30 bits */
-void lsp_quant_nb(spx_lsp_t *lsp, spx_lsp_t *qlsp, int order, SpeexBits *bits);
-
-/* Decodes quantized narrowband LSPs */
-void lsp_unquant_nb(spx_lsp_t *lsp, int order, SpeexBits *bits);
-
-/* Quantizes low bit-rate narrowband LSPs with 18 bits */
-void lsp_quant_lbr(spx_lsp_t *lsp, spx_lsp_t *qlsp, int order, SpeexBits *bits);
-
-/* Decodes quantized low bit-rate narrowband LSPs */
-void lsp_unquant_lbr(spx_lsp_t *lsp, int order, SpeexBits *bits);
-
-/* Quantizes high-band LSPs with 12 bits */
-void lsp_quant_high(spx_lsp_t *lsp, spx_lsp_t *qlsp, int order, SpeexBits *bits);
-
-/* Decodes high-band LSPs */
-void lsp_unquant_high(spx_lsp_t *lsp, int order, SpeexBits *bits);
-
-#endif
diff --git a/libspeex/resample.c b/libspeex/resample.c
deleted file mode 100644
index bebd1a8..0000000
--- a/libspeex/resample.c
+++ /dev/null
@@ -1,1131 +0,0 @@
-/* Copyright (C) 2007-2008 Jean-Marc Valin
-   Copyright (C) 2008      Thorvald Natvig
-      
-   File: resample.c
-   Arbitrary resampling code
-
-   Redistribution and use in source and binary forms, with or without
-   modification, are permitted provided that the following conditions are
-   met:
-
-   1. Redistributions of source code must retain the above copyright notice,
-   this list of conditions and the following disclaimer.
-
-   2. 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.
-
-   3. The name of the author may not be used to endorse or promote products
-   derived from this software without specific prior written permission.
-
-   THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
-*/
-
-/*
-   The design goals of this code are:
-      - Very fast algorithm
-      - SIMD-friendly algorithm
-      - Low memory requirement
-      - Good *perceptual* quality (and not best SNR)
-
-   Warning: This resampler is relatively new. Although I think I got rid of 
-   all the major bugs and I don't expect the API to change anymore, there
-   may be something I've missed. So use with caution.
-
-   This algorithm is based on this original resampling algorithm:
-   Smith, Julius O. Digital Audio Resampling Home Page
-   Center for Computer Research in Music and Acoustics (CCRMA), 
-   Stanford University, 2007.
-   Web published at http://www-ccrma.stanford.edu/~jos/resample/.
-
-   There is one main difference, though. This resampler uses cubic 
-   interpolation instead of linear interpolation in the above paper. This
-   makes the table much smaller and makes it possible to compute that table
-   on a per-stream basis. In turn, being able to tweak the table for each 
-   stream makes it possible to both reduce complexity on simple ratios 
-   (e.g. 2/3), and get rid of the rounding operations in the inner loop. 
-   The latter both reduces CPU time and makes the algorithm more SIMD-friendly.
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#ifdef OUTSIDE_SPEEX
-#include <stdlib.h>
-static void *speex_alloc (int size) {return calloc(size,1);}
-static void *speex_realloc (void *ptr, int size) {return realloc(ptr, size);}
-static void speex_free (void *ptr) {free(ptr);}
-#include "speex_resampler.h"
-#include "arch.h"
-#else /* OUTSIDE_SPEEX */
-               
-#include "speex/speex_resampler.h"
-#include "arch.h"
-#include "os_support.h"
-#endif /* OUTSIDE_SPEEX */
-
-#include "stack_alloc.h"
-#include <math.h>
-
-#ifndef M_PI
-#define M_PI 3.14159263
-#endif
-
-#ifdef FIXED_POINT
-#define WORD2INT(x) ((x) < -32767 ? -32768 : ((x) > 32766 ? 32767 : (x)))  
-#else
-#define WORD2INT(x) ((x) < -32767.5f ? -32768 : ((x) > 32766.5f ? 32767 : floor(.5+(x))))  
-#endif
-               
-#define IMAX(a,b) ((a) > (b) ? (a) : (b))
-#define IMIN(a,b) ((a) < (b) ? (a) : (b))
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-#ifdef _USE_SSE
-#include "resample_sse.h"
-#endif
-
-/* Numer of elements to allocate on the stack */
-#ifdef VAR_ARRAYS
-#define FIXED_STACK_ALLOC 8192
-#else
-#define FIXED_STACK_ALLOC 1024
-#endif
-
-typedef int (*resampler_basic_func)(SpeexResamplerState *, spx_uint32_t , const spx_word16_t *, spx_uint32_t *, spx_word16_t *, spx_uint32_t *);
-
-struct SpeexResamplerState_ {
-   spx_uint32_t in_rate;
-   spx_uint32_t out_rate;
-   spx_uint32_t num_rate;
-   spx_uint32_t den_rate;
-   
-   int    quality;
-   spx_uint32_t nb_channels;
-   spx_uint32_t filt_len;
-   spx_uint32_t mem_alloc_size;
-   spx_uint32_t buffer_size;
-   int          int_advance;
-   int          frac_advance;
-   float  cutoff;
-   spx_uint32_t oversample;
-   int          initialised;
-   int          started;
-   
-   /* These are per-channel */
-   spx_int32_t  *last_sample;
-   spx_uint32_t *samp_frac_num;
-   spx_uint32_t *magic_samples;
-   
-   spx_word16_t *mem;
-   spx_word16_t *sinc_table;
-   spx_uint32_t sinc_table_length;
-   resampler_basic_func resampler_ptr;
-         
-   int    in_stride;
-   int    out_stride;
-} ;
-
-static double kaiser12_table[68] = {
-   0.99859849, 1.00000000, 0.99859849, 0.99440475, 0.98745105, 0.97779076,
-   0.96549770, 0.95066529, 0.93340547, 0.91384741, 0.89213598, 0.86843014,
-   0.84290116, 0.81573067, 0.78710866, 0.75723148, 0.72629970, 0.69451601,
-   0.66208321, 0.62920216, 0.59606986, 0.56287762, 0.52980938, 0.49704014,
-   0.46473455, 0.43304576, 0.40211431, 0.37206735, 0.34301800, 0.31506490,
-   0.28829195, 0.26276832, 0.23854851, 0.21567274, 0.19416736, 0.17404546,
-   0.15530766, 0.13794294, 0.12192957, 0.10723616, 0.09382272, 0.08164178,
-   0.07063950, 0.06075685, 0.05193064, 0.04409466, 0.03718069, 0.03111947,
-   0.02584161, 0.02127838, 0.01736250, 0.01402878, 0.01121463, 0.00886058,
-   0.00691064, 0.00531256, 0.00401805, 0.00298291, 0.00216702, 0.00153438,
-   0.00105297, 0.00069463, 0.00043489, 0.00025272, 0.00013031, 0.0000527734,
-   0.00001000, 0.00000000};
-/*
-static double kaiser12_table[36] = {
-   0.99440475, 1.00000000, 0.99440475, 0.97779076, 0.95066529, 0.91384741,
-   0.86843014, 0.81573067, 0.75723148, 0.69451601, 0.62920216, 0.56287762,
-   0.49704014, 0.43304576, 0.37206735, 0.31506490, 0.26276832, 0.21567274,
-   0.17404546, 0.13794294, 0.10723616, 0.08164178, 0.06075685, 0.04409466,
-   0.03111947, 0.02127838, 0.01402878, 0.00886058, 0.00531256, 0.00298291,
-   0.00153438, 0.00069463, 0.00025272, 0.0000527734, 0.00000500, 0.00000000};
-*/
-static double kaiser10_table[36] = {
-   0.99537781, 1.00000000, 0.99537781, 0.98162644, 0.95908712, 0.92831446,
-   0.89005583, 0.84522401, 0.79486424, 0.74011713, 0.68217934, 0.62226347,
-   0.56155915, 0.50119680, 0.44221549, 0.38553619, 0.33194107, 0.28205962,
-   0.23636152, 0.19515633, 0.15859932, 0.12670280, 0.09935205, 0.07632451,
-   0.05731132, 0.04193980, 0.02979584, 0.02044510, 0.01345224, 0.00839739,
-   0.00488951, 0.00257636, 0.00115101, 0.00035515, 0.00000000, 0.00000000};
-
-static double kaiser8_table[36] = {
-   0.99635258, 1.00000000, 0.99635258, 0.98548012, 0.96759014, 0.94302200,
-   0.91223751, 0.87580811, 0.83439927, 0.78875245, 0.73966538, 0.68797126,
-   0.63451750, 0.58014482, 0.52566725, 0.47185369, 0.41941150, 0.36897272,
-   0.32108304, 0.27619388, 0.23465776, 0.19672670, 0.16255380, 0.13219758,
-   0.10562887, 0.08273982, 0.06335451, 0.04724088, 0.03412321, 0.02369490,
-   0.01563093, 0.00959968, 0.00527363, 0.00233883, 0.00050000, 0.00000000};
-   
-static double kaiser6_table[36] = {
-   0.99733006, 1.00000000, 0.99733006, 0.98935595, 0.97618418, 0.95799003,
-   0.93501423, 0.90755855, 0.87598009, 0.84068475, 0.80211977, 0.76076565,
-   0.71712752, 0.67172623, 0.62508937, 0.57774224, 0.53019925, 0.48295561,
-   0.43647969, 0.39120616, 0.34752997, 0.30580127, 0.26632152, 0.22934058,
-   0.19505503, 0.16360756, 0.13508755, 0.10953262, 0.08693120, 0.06722600,
-   0.05031820, 0.03607231, 0.02432151, 0.01487334, 0.00752000, 0.00000000};
-
-struct FuncDef {
-   double *table;
-   int oversample;
-};
-      
-static struct FuncDef _KAISER12 = {kaiser12_table, 64};
-#define KAISER12 (&_KAISER12)
-/*static struct FuncDef _KAISER12 = {kaiser12_table, 32};
-#define KAISER12 (&_KAISER12)*/
-static struct FuncDef _KAISER10 = {kaiser10_table, 32};
-#define KAISER10 (&_KAISER10)
-static struct FuncDef _KAISER8 = {kaiser8_table, 32};
-#define KAISER8 (&_KAISER8)
-static struct FuncDef _KAISER6 = {kaiser6_table, 32};
-#define KAISER6 (&_KAISER6)
-
-struct QualityMapping {
-   int base_length;
-   int oversample;
-   float downsample_bandwidth;
-   float upsample_bandwidth;
-   struct FuncDef *window_func;
-};
-
-
-/* This table maps conversion quality to internal parameters. There are two
-   reasons that explain why the up-sampling bandwidth is larger than the 
-   down-sampling bandwidth:
-   1) When up-sampling, we can assume that the spectrum is already attenuated
-      close to the Nyquist rate (from an A/D or a previous resampling filter)
-   2) Any aliasing that occurs very close to the Nyquist rate will be masked
-      by the sinusoids/noise just below the Nyquist rate (guaranteed only for
-      up-sampling).
-*/
-static const struct QualityMapping quality_map[11] = {
-   {  8,  4, 0.830f, 0.860f, KAISER6 }, /* Q0 */
-   { 16,  4, 0.850f, 0.880f, KAISER6 }, /* Q1 */
-   { 32,  4, 0.882f, 0.910f, KAISER6 }, /* Q2 */  /* 82.3% cutoff ( ~60 dB stop) 6  */
-   { 48,  8, 0.895f, 0.917f, KAISER8 }, /* Q3 */  /* 84.9% cutoff ( ~80 dB stop) 8  */
-   { 64,  8, 0.921f, 0.940f, KAISER8 }, /* Q4 */  /* 88.7% cutoff ( ~80 dB stop) 8  */
-   { 80, 16, 0.922f, 0.940f, KAISER10}, /* Q5 */  /* 89.1% cutoff (~100 dB stop) 10 */
-   { 96, 16, 0.940f, 0.945f, KAISER10}, /* Q6 */  /* 91.5% cutoff (~100 dB stop) 10 */
-   {128, 16, 0.950f, 0.950f, KAISER10}, /* Q7 */  /* 93.1% cutoff (~100 dB stop) 10 */
-   {160, 16, 0.960f, 0.960f, KAISER10}, /* Q8 */  /* 94.5% cutoff (~100 dB stop) 10 */
-   {192, 32, 0.968f, 0.968f, KAISER12}, /* Q9 */  /* 95.5% cutoff (~100 dB stop) 10 */
-   {256, 32, 0.975f, 0.975f, KAISER12}, /* Q10 */ /* 96.6% cutoff (~100 dB stop) 10 */
-};
-/*8,24,40,56,80,104,128,160,200,256,320*/
-static double compute_func(float x, struct FuncDef *func)
-{
-   float y, frac;
-   double interp[4];
-   int ind; 
-   y = x*func->oversample;
-   ind = (int)floor(y);
-   frac = (y-ind);
-   /* CSE with handle the repeated powers */
-   interp[3] =  -0.1666666667*frac + 0.1666666667*(frac*frac*frac);
-   interp[2] = frac + 0.5*(frac*frac) - 0.5*(frac*frac*frac);
-   /*interp[2] = 1.f - 0.5f*frac - frac*frac + 0.5f*frac*frac*frac;*/
-   interp[0] = -0.3333333333*frac + 0.5*(frac*frac) - 0.1666666667*(frac*frac*frac);
-   /* Just to make sure we don't have rounding problems */
-   interp[1] = 1.f-interp[3]-interp[2]-interp[0];
-   
-   /*sum = frac*accum[1] + (1-frac)*accum[2];*/
-   return interp[0]*func->table[ind] + interp[1]*func->table[ind+1] + interp[2]*func->table[ind+2] + interp[3]*func->table[ind+3];
-}
-
-#if 0
-#include <stdio.h>
-int main(int argc, char **argv)
-{
-   int i;
-   for (i=0;i<256;i++)
-   {
-      printf ("%f\n", compute_func(i/256., KAISER12));
-   }
-   return 0;
-}
-#endif
-
-#ifdef FIXED_POINT
-/* The slow way of computing a sinc for the table. Should improve that some day */
-static spx_word16_t sinc(float cutoff, float x, int N, struct FuncDef *window_func)
-{
-   /*fprintf (stderr, "%f ", x);*/
-   float xx = x * cutoff;
-   if (fabs(x)<1e-6f)
-      return WORD2INT(32768.*cutoff);
-   else if (fabs(x) > .5f*N)
-      return 0;
-   /*FIXME: Can it really be any slower than this? */
-   return WORD2INT(32768.*cutoff*sin(M_PI*xx)/(M_PI*xx) * compute_func(fabs(2.*x/N), window_func));
-}
-#else
-/* The slow way of computing a sinc for the table. Should improve that some day */
-static spx_word16_t sinc(float cutoff, float x, int N, struct FuncDef *window_func)
-{
-   /*fprintf (stderr, "%f ", x);*/
-   float xx = x * cutoff;
-   if (fabs(x)<1e-6)
-      return cutoff;
-   else if (fabs(x) > .5*N)
-      return 0;
-   /*FIXME: Can it really be any slower than this? */
-   return cutoff*sin(M_PI*xx)/(M_PI*xx) * compute_func(fabs(2.*x/N), window_func);
-}
-#endif
-
-#ifdef FIXED_POINT
-static void cubic_coef(spx_word16_t x, spx_word16_t interp[4])
-{
-   /* Compute interpolation coefficients. I'm not sure whether this corresponds to cubic interpolation
-   but I know it's MMSE-optimal on a sinc */
-   spx_word16_t x2, x3;
-   x2 = MULT16_16_P15(x, x);
-   x3 = MULT16_16_P15(x, x2);
-   interp[0] = PSHR32(MULT16_16(QCONST16(-0.16667f, 15),x) + MULT16_16(QCONST16(0.16667f, 15),x3),15);
-   interp[1] = EXTRACT16(EXTEND32(x) + SHR32(SUB32(EXTEND32(x2),EXTEND32(x3)),1));
-   interp[3] = PSHR32(MULT16_16(QCONST16(-0.33333f, 15),x) + MULT16_16(QCONST16(.5f,15),x2) - MULT16_16(QCONST16(0.16667f, 15),x3),15);
-   /* Just to make sure we don't have rounding problems */
-   interp[2] = Q15_ONE-interp[0]-interp[1]-interp[3];
-   if (interp[2]<32767)
-      interp[2]+=1;
-}
-#else
-static void cubic_coef(spx_word16_t frac, spx_word16_t interp[4])
-{
-   /* Compute interpolation coefficients. I'm not sure whether this corresponds to cubic interpolation
-   but I know it's MMSE-optimal on a sinc */
-   interp[0] =  -0.16667f*frac + 0.16667f*frac*frac*frac;
-   interp[1] = frac + 0.5f*frac*frac - 0.5f*frac*frac*frac;
-   /*interp[2] = 1.f - 0.5f*frac - frac*frac + 0.5f*frac*frac*frac;*/
-   interp[3] = -0.33333f*frac + 0.5f*frac*frac - 0.16667f*frac*frac*frac;
-   /* Just to make sure we don't have rounding problems */
-   interp[2] = 1.-interp[0]-interp[1]-interp[3];
-}
-#endif
-
-static int resampler_basic_direct_single(SpeexResamplerState *st, spx_uint32_t channel_index, const spx_word16_t *in, spx_uint32_t *in_len, spx_word16_t *out, spx_uint32_t *out_len)
-{
-   const int N = st->filt_len;
-   int out_sample = 0;
-   int last_sample = st->last_sample[channel_index];
-   spx_uint32_t samp_frac_num = st->samp_frac_num[channel_index];
-   const spx_word16_t *sinc_table = st->sinc_table;
-   const int out_stride = st->out_stride;
-   const int int_advance = st->int_advance;
-   const int frac_advance = st->frac_advance;
-   const spx_uint32_t den_rate = st->den_rate;
-   spx_word32_t sum;
-   int j;
-
-   while (!(last_sample >= (spx_int32_t)*in_len || out_sample >= (spx_int32_t)*out_len))
-   {
-      const spx_word16_t *sinc = & sinc_table[samp_frac_num*N];
-      const spx_word16_t *iptr = & in[last_sample];
-
-#ifndef OVERRIDE_INNER_PRODUCT_SINGLE
-      float accum[4] = {0,0,0,0};
-
-      for(j=0;j<N;j+=4) {
-        accum[0] += sinc[j]*iptr[j];
-        accum[1] += sinc[j+1]*iptr[j+1];
-        accum[2] += sinc[j+2]*iptr[j+2];
-        accum[3] += sinc[j+3]*iptr[j+3];
-      }
-      sum = accum[0] + accum[1] + accum[2] + accum[3];
-#else
-      sum = inner_product_single(sinc, iptr, N);
-#endif
-
-      out[out_stride * out_sample++] = PSHR32(sum, 15);
-      last_sample += int_advance;
-      samp_frac_num += frac_advance;
-      if (samp_frac_num >= den_rate)
-      {
-         samp_frac_num -= den_rate;
-         last_sample++;
-      }
-   }
-
-   st->last_sample[channel_index] = last_sample;
-   st->samp_frac_num[channel_index] = samp_frac_num;
-   return out_sample;
-}
-
-#ifdef FIXED_POINT
-#else
-/* This is the same as the previous function, except with a double-precision accumulator */
-static int resampler_basic_direct_double(SpeexResamplerState *st, spx_uint32_t channel_index, const spx_word16_t *in, spx_uint32_t *in_len, spx_word16_t *out, spx_uint32_t *out_len)
-{
-   const int N = st->filt_len;
-   int out_sample = 0;
-   int last_sample = st->last_sample[channel_index];
-   spx_uint32_t samp_frac_num = st->samp_frac_num[channel_index];
-   const spx_word16_t *sinc_table = st->sinc_table;
-   const int out_stride = st->out_stride;
-   const int int_advance = st->int_advance;
-   const int frac_advance = st->frac_advance;
-   const spx_uint32_t den_rate = st->den_rate;
-   double sum;
-   int j;
-
-   while (!(last_sample >= (spx_int32_t)*in_len || out_sample >= (spx_int32_t)*out_len))
-   {
-      const spx_word16_t *sinc = & sinc_table[samp_frac_num*N];
-      const spx_word16_t *iptr = & in[last_sample];
-
-#ifndef OVERRIDE_INNER_PRODUCT_DOUBLE
-      double accum[4] = {0,0,0,0};
-
-      for(j=0;j<N;j+=4) {
-        accum[0] += sinc[j]*iptr[j];
-        accum[1] += sinc[j+1]*iptr[j+1];
-        accum[2] += sinc[j+2]*iptr[j+2];
-        accum[3] += sinc[j+3]*iptr[j+3];
-      }
-      sum = accum[0] + accum[1] + accum[2] + accum[3];
-#else
-      sum = inner_product_double(sinc, iptr, N);
-#endif
-
-      out[out_stride * out_sample++] = PSHR32(sum, 15);
-      last_sample += int_advance;
-      samp_frac_num += frac_advance;
-      if (samp_frac_num >= den_rate)
-      {
-         samp_frac_num -= den_rate;
-         last_sample++;
-      }
-   }
-
-   st->last_sample[channel_index] = last_sample;
-   st->samp_frac_num[channel_index] = samp_frac_num;
-   return out_sample;
-}
-#endif
-
-static int resampler_basic_interpolate_single(SpeexResamplerState *st, spx_uint32_t channel_index, const spx_word16_t *in, spx_uint32_t *in_len, spx_word16_t *out, spx_uint32_t *out_len)
-{
-   const int N = st->filt_len;
-   int out_sample = 0;
-   int last_sample = st->last_sample[channel_index];
-   spx_uint32_t samp_frac_num = st->samp_frac_num[channel_index];
-   const int out_stride = st->out_stride;
-   const int int_advance = st->int_advance;
-   const int frac_advance = st->frac_advance;
-   const spx_uint32_t den_rate = st->den_rate;
-   int j;
-   spx_word32_t sum;
-
-   while (!(last_sample >= (spx_int32_t)*in_len || out_sample >= (spx_int32_t)*out_len))
-   {
-      const spx_word16_t *iptr = & in[last_sample];
-
-      const int offset = samp_frac_num*st->oversample/st->den_rate;
-#ifdef FIXED_POINT
-      const spx_word16_t frac = PDIV32(SHL32((samp_frac_num*st->oversample) % st->den_rate,15),st->den_rate);
-#else
-      const spx_word16_t frac = ((float)((samp_frac_num*st->oversample) % st->den_rate))/st->den_rate;
-#endif
-      spx_word16_t interp[4];
-
-
-#ifndef OVERRIDE_INTERPOLATE_PRODUCT_SINGLE
-      spx_word32_t accum[4] = {0,0,0,0};
-
-      for(j=0;j<N;j++) {
-        const spx_word16_t curr_in=iptr[j];
-        accum[0] += MULT16_16(curr_in,st->sinc_table[4+(j+1)*st->oversample-offset-2]);
-        accum[1] += MULT16_16(curr_in,st->sinc_table[4+(j+1)*st->oversample-offset-1]);
-        accum[2] += MULT16_16(curr_in,st->sinc_table[4+(j+1)*st->oversample-offset]);
-        accum[3] += MULT16_16(curr_in,st->sinc_table[4+(j+1)*st->oversample-offset+1]);
-      }
-
-      cubic_coef(frac, interp);
-      sum = MULT16_32_Q15(interp[0],accum[0]) + MULT16_32_Q15(interp[1],accum[1]) + MULT16_32_Q15(interp[2],accum[2]) + MULT16_32_Q15(interp[3],accum[3]);
-#else
-      cubic_coef(frac, interp);
-      sum = interpolate_product_single(iptr, st->sinc_table + st->oversample + 4 - offset - 2, N, st->oversample, interp);
-#endif
-      
-      out[out_stride * out_sample++] = PSHR32(sum,15);
-      last_sample += int_advance;
-      samp_frac_num += frac_advance;
-      if (samp_frac_num >= den_rate)
-      {
-         samp_frac_num -= den_rate;
-         last_sample++;
-      }
-   }
-
-   st->last_sample[channel_index] = last_sample;
-   st->samp_frac_num[channel_index] = samp_frac_num;
-   return out_sample;
-}
-
-#ifdef FIXED_POINT
-#else
-/* This is the same as the previous function, except with a double-precision accumulator */
-static int resampler_basic_interpolate_double(SpeexResamplerState *st, spx_uint32_t channel_index, const spx_word16_t *in, spx_uint32_t *in_len, spx_word16_t *out, spx_uint32_t *out_len)
-{
-   const int N = st->filt_len;
-   int out_sample = 0;
-   int last_sample = st->last_sample[channel_index];
-   spx_uint32_t samp_frac_num = st->samp_frac_num[channel_index];
-   const int out_stride = st->out_stride;
-   const int int_advance = st->int_advance;
-   const int frac_advance = st->frac_advance;
-   const spx_uint32_t den_rate = st->den_rate;
-   int j;
-   spx_word32_t sum;
-
-   while (!(last_sample >= (spx_int32_t)*in_len || out_sample >= (spx_int32_t)*out_len))
-   {
-      const spx_word16_t *iptr = & in[last_sample];
-
-      const int offset = samp_frac_num*st->oversample/st->den_rate;
-#ifdef FIXED_POINT
-      const spx_word16_t frac = PDIV32(SHL32((samp_frac_num*st->oversample) % st->den_rate,15),st->den_rate);
-#else
-      const spx_word16_t frac = ((float)((samp_frac_num*st->oversample) % st->den_rate))/st->den_rate;
-#endif
-      spx_word16_t interp[4];
-
-
-#ifndef OVERRIDE_INTERPOLATE_PRODUCT_DOUBLE
-      double accum[4] = {0,0,0,0};
-
-      for(j=0;j<N;j++) {
-        const double curr_in=iptr[j];
-        accum[0] += MULT16_16(curr_in,st->sinc_table[4+(j+1)*st->oversample-offset-2]);
-        accum[1] += MULT16_16(curr_in,st->sinc_table[4+(j+1)*st->oversample-offset-1]);
-        accum[2] += MULT16_16(curr_in,st->sinc_table[4+(j+1)*st->oversample-offset]);
-        accum[3] += MULT16_16(curr_in,st->sinc_table[4+(j+1)*st->oversample-offset+1]);
-      }
-
-      cubic_coef(frac, interp);
-      sum = MULT16_32_Q15(interp[0],accum[0]) + MULT16_32_Q15(interp[1],accum[1]) + MULT16_32_Q15(interp[2],accum[2]) + MULT16_32_Q15(interp[3],accum[3]);
-#else
-      cubic_coef(frac, interp);
-      sum = interpolate_product_double(iptr, st->sinc_table + st->oversample + 4 - offset - 2, N, st->oversample, interp);
-#endif
-      
-      out[out_stride * out_sample++] = PSHR32(sum,15);
-      last_sample += int_advance;
-      samp_frac_num += frac_advance;
-      if (samp_frac_num >= den_rate)
-      {
-         samp_frac_num -= den_rate;
-         last_sample++;
-      }
-   }
-
-   st->last_sample[channel_index] = last_sample;
-   st->samp_frac_num[channel_index] = samp_frac_num;
-   return out_sample;
-}
-#endif
-
-static void update_filter(SpeexResamplerState *st)
-{
-   spx_uint32_t old_length;
-   
-   old_length = st->filt_len;
-   st->oversample = quality_map[st->quality].oversample;
-   st->filt_len = quality_map[st->quality].base_length;
-   
-   if (st->num_rate > st->den_rate)
-   {
-      /* down-sampling */
-      st->cutoff = quality_map[st->quality].downsample_bandwidth * st->den_rate / st->num_rate;
-      /* FIXME: divide the numerator and denominator by a certain amount if they're too large */
-      st->filt_len = st->filt_len*st->num_rate / st->den_rate;
-      /* Round down to make sure we have a multiple of 4 */
-      st->filt_len &= (~0x3);
-      if (2*st->den_rate < st->num_rate)
-         st->oversample >>= 1;
-      if (4*st->den_rate < st->num_rate)
-         st->oversample >>= 1;
-      if (8*st->den_rate < st->num_rate)
-         st->oversample >>= 1;
-      if (16*st->den_rate < st->num_rate)
-         st->oversample >>= 1;
-      if (st->oversample < 1)
-         st->oversample = 1;
-   } else {
-      /* up-sampling */
-      st->cutoff = quality_map[st->quality].upsample_bandwidth;
-   }
-   
-   /* Choose the resampling type that requires the least amount of memory */
-   if (st->den_rate <= st->oversample)
-   {
-      spx_uint32_t i;
-      if (!st->sinc_table)
-         st->sinc_table = (spx_word16_t *)speex_alloc(st->filt_len*st->den_rate*sizeof(spx_word16_t));
-      else if (st->sinc_table_length < st->filt_len*st->den_rate)
-      {
-         st->sinc_table = (spx_word16_t *)speex_realloc(st->sinc_table,st->filt_len*st->den_rate*sizeof(spx_word16_t));
-         st->sinc_table_length = st->filt_len*st->den_rate;
-      }
-      for (i=0;i<st->den_rate;i++)
-      {
-         spx_int32_t j;
-         for (j=0;j<st->filt_len;j++)
-         {
-            st->sinc_table[i*st->filt_len+j] = sinc(st->cutoff,((j-(spx_int32_t)st->filt_len/2+1)-((float)i)/st->den_rate), st->filt_len, quality_map[st->quality].window_func);
-         }
-      }
-#ifdef FIXED_POINT
-      st->resampler_ptr = resampler_basic_direct_single;
-#else
-      if (st->quality>8)
-         st->resampler_ptr = resampler_basic_direct_double;
-      else
-         st->resampler_ptr = resampler_basic_direct_single;
-#endif
-      /*fprintf (stderr, "resampler uses direct sinc table and normalised cutoff %f\n", cutoff);*/
-   } else {
-      spx_int32_t i;
-      if (!st->sinc_table)
-         st->sinc_table = (spx_word16_t *)speex_alloc((st->filt_len*st->oversample+8)*sizeof(spx_word16_t));
-      else if (st->sinc_table_length < st->filt_len*st->oversample+8)
-      {
-         st->sinc_table = (spx_word16_t *)speex_realloc(st->sinc_table,(st->filt_len*st->oversample+8)*sizeof(spx_word16_t));
-         st->sinc_table_length = st->filt_len*st->oversample+8;
-      }
-      for (i=-4;i<(spx_int32_t)(st->oversample*st->filt_len+4);i++)
-         st->sinc_table[i+4] = sinc(st->cutoff,(i/(float)st->oversample - st->filt_len/2), st->filt_len, quality_map[st->quality].window_func);
-#ifdef FIXED_POINT
-      st->resampler_ptr = resampler_basic_interpolate_single;
-#else
-      if (st->quality>8)
-         st->resampler_ptr = resampler_basic_interpolate_double;
-      else
-         st->resampler_ptr = resampler_basic_interpolate_single;
-#endif
-      /*fprintf (stderr, "resampler uses interpolated sinc table and normalised cutoff %f\n", cutoff);*/
-   }
-   st->int_advance = st->num_rate/st->den_rate;
-   st->frac_advance = st->num_rate%st->den_rate;
-
-   
-   /* Here's the place where we update the filter memory to take into account
-      the change in filter length. It's probably the messiest part of the code
-      due to handling of lots of corner cases. */
-   if (!st->mem)
-   {
-      spx_uint32_t i;
-      st->mem_alloc_size = st->filt_len-1 + st->buffer_size;
-      st->mem = (spx_word16_t*)speex_alloc(st->nb_channels*st->mem_alloc_size * sizeof(spx_word16_t));
-      for (i=0;i<st->nb_channels*st->mem_alloc_size;i++)
-         st->mem[i] = 0;
-      /*speex_warning("init filter");*/
-   } else if (!st->started)
-   {
-      spx_uint32_t i;
-      st->mem_alloc_size = st->filt_len-1 + st->buffer_size;
-      st->mem = (spx_word16_t*)speex_realloc(st->mem, st->nb_channels*st->mem_alloc_size * sizeof(spx_word16_t));
-      for (i=0;i<st->nb_channels*st->mem_alloc_size;i++)
-         st->mem[i] = 0;
-      /*speex_warning("reinit filter");*/
-   } else if (st->filt_len > old_length)
-   {
-      spx_int32_t i;
-      /* Increase the filter length */
-      /*speex_warning("increase filter size");*/
-      int old_alloc_size = st->mem_alloc_size;
-      if ((st->filt_len-1 + st->buffer_size) > st->mem_alloc_size)
-      {
-         st->mem_alloc_size = st->filt_len-1 + st->buffer_size;
-         st->mem = (spx_word16_t*)speex_realloc(st->mem, st->nb_channels*st->mem_alloc_size * sizeof(spx_word16_t));
-      }
-      for (i=st->nb_channels-1;i>=0;i--)
-      {
-         spx_int32_t j;
-         spx_uint32_t olen = old_length;
-         /*if (st->magic_samples[i])*/
-         {
-            /* Try and remove the magic samples as if nothing had happened */
-            
-            /* FIXME: This is wrong but for now we need it to avoid going over the array bounds */
-            olen = old_length + 2*st->magic_samples[i];
-            for (j=old_length-2+st->magic_samples[i];j>=0;j--)
-               st->mem[i*st->mem_alloc_size+j+st->magic_samples[i]] = st->mem[i*old_alloc_size+j];
-            for (j=0;j<st->magic_samples[i];j++)
-               st->mem[i*st->mem_alloc_size+j] = 0;
-            st->magic_samples[i] = 0;
-         }
-         if (st->filt_len > olen)
-         {
-            /* If the new filter length is still bigger than the "augmented" length */
-            /* Copy data going backward */
-            for (j=0;j<olen-1;j++)
-               st->mem[i*st->mem_alloc_size+(st->filt_len-2-j)] = st->mem[i*st->mem_alloc_size+(olen-2-j)];
-            /* Then put zeros for lack of anything better */
-            for (;j<st->filt_len-1;j++)
-               st->mem[i*st->mem_alloc_size+(st->filt_len-2-j)] = 0;
-            /* Adjust last_sample */
-            st->last_sample[i] += (st->filt_len - olen)/2;
-         } else {
-            /* Put back some of the magic! */
-            st->magic_samples[i] = (olen - st->filt_len)/2;
-            for (j=0;j<st->filt_len-1+st->magic_samples[i];j++)
-               st->mem[i*st->mem_alloc_size+j] = st->mem[i*st->mem_alloc_size+j+st->magic_samples[i]];
-         }
-      }
-   } else if (st->filt_len < old_length)
-   {
-      spx_uint32_t i;
-      /* Reduce filter length, this a bit tricky. We need to store some of the memory as "magic"
-         samples so they can be used directly as input the next time(s) */
-      for (i=0;i<st->nb_channels;i++)
-      {
-         spx_uint32_t j;
-         spx_uint32_t old_magic = st->magic_samples[i];
-         st->magic_samples[i] = (old_length - st->filt_len)/2;
-         /* We must copy some of the memory that's no longer used */
-         /* Copy data going backward */
-         for (j=0;j<st->filt_len-1+st->magic_samples[i]+old_magic;j++)
-            st->mem[i*st->mem_alloc_size+j] = st->mem[i*st->mem_alloc_size+j+st->magic_samples[i]];
-         st->magic_samples[i] += old_magic;
-      }
-   }
-
-}
-
-EXPORT SpeexResamplerState *speex_resampler_init(spx_uint32_t nb_channels, spx_uint32_t in_rate, spx_uint32_t out_rate, int quality, int *err)
-{
-   return speex_resampler_init_frac(nb_channels, in_rate, out_rate, in_rate, out_rate, quality, err);
-}
-
-EXPORT SpeexResamplerState *speex_resampler_init_frac(spx_uint32_t nb_channels, spx_uint32_t ratio_num, spx_uint32_t ratio_den, spx_uint32_t in_rate, spx_uint32_t out_rate, int quality, int *err)
-{
-   spx_uint32_t i;
-   SpeexResamplerState *st;
-   if (quality > 10 || quality < 0)
-   {
-      if (err)
-         *err = RESAMPLER_ERR_INVALID_ARG;
-      return NULL;
-   }
-   st = (SpeexResamplerState *)speex_alloc(sizeof(SpeexResamplerState));
-   st->initialised = 0;
-   st->started = 0;
-   st->in_rate = 0;
-   st->out_rate = 0;
-   st->num_rate = 0;
-   st->den_rate = 0;
-   st->quality = -1;
-   st->sinc_table_length = 0;
-   st->mem_alloc_size = 0;
-   st->filt_len = 0;
-   st->mem = 0;
-   st->resampler_ptr = 0;
-         
-   st->cutoff = 1.f;
-   st->nb_channels = nb_channels;
-   st->in_stride = 1;
-   st->out_stride = 1;
-   
-#ifdef FIXED_POINT
-   st->buffer_size = 160;
-#else
-   st->buffer_size = 160;
-#endif
-   
-   /* Per channel data */
-   st->last_sample = (spx_int32_t*)speex_alloc(nb_channels*sizeof(int));
-   st->magic_samples = (spx_uint32_t*)speex_alloc(nb_channels*sizeof(int));
-   st->samp_frac_num = (spx_uint32_t*)speex_alloc(nb_channels*sizeof(int));
-   for (i=0;i<nb_channels;i++)
-   {
-      st->last_sample[i] = 0;
-      st->magic_samples[i] = 0;
-      st->samp_frac_num[i] = 0;
-   }
-
-   speex_resampler_set_quality(st, quality);
-   speex_resampler_set_rate_frac(st, ratio_num, ratio_den, in_rate, out_rate);
-
-   
-   update_filter(st);
-   
-   st->initialised = 1;
-   if (err)
-      *err = RESAMPLER_ERR_SUCCESS;
-
-   return st;
-}
-
-EXPORT void speex_resampler_destroy(SpeexResamplerState *st)
-{
-   speex_free(st->mem);
-   speex_free(st->sinc_table);
-   speex_free(st->last_sample);
-   speex_free(st->magic_samples);
-   speex_free(st->samp_frac_num);
-   speex_free(st);
-}
-
-static int speex_resampler_process_native(SpeexResamplerState *st, spx_uint32_t channel_index, spx_uint32_t *in_len, spx_word16_t *out, spx_uint32_t *out_len)
-{
-   int j=0;
-   const int N = st->filt_len;
-   int out_sample = 0;
-   spx_word16_t *mem = st->mem + channel_index * st->mem_alloc_size;
-   spx_uint32_t ilen;
-   
-   st->started = 1;
-   
-   /* Call the right resampler through the function ptr */
-   out_sample = st->resampler_ptr(st, channel_index, mem, in_len, out, out_len);
-   
-   if (st->last_sample[channel_index] < (spx_int32_t)*in_len)
-      *in_len = st->last_sample[channel_index];
-   *out_len = out_sample;
-   st->last_sample[channel_index] -= *in_len;
-   
-   ilen = *in_len;
-
-   for(j=0;j<N-1;++j)
-     mem[j] = mem[j+ilen];
-
-   return RESAMPLER_ERR_SUCCESS;
-}
-
-static int speex_resampler_magic(SpeexResamplerState *st, spx_uint32_t channel_index, spx_word16_t **out, spx_uint32_t out_len) {
-   spx_uint32_t tmp_in_len = st->magic_samples[channel_index];
-   spx_word16_t *mem = st->mem + channel_index * st->mem_alloc_size;
-   const int N = st->filt_len;
-   
-   speex_resampler_process_native(st, channel_index, &tmp_in_len, *out, &out_len);
-
-   st->magic_samples[channel_index] -= tmp_in_len;
-   
-   /* If we couldn't process all "magic" input samples, save the rest for next time */
-   if (st->magic_samples[channel_index])
-   {
-      spx_uint32_t i;
-      for (i=0;i<st->magic_samples[channel_index];i++)
-         mem[N-1+i]=mem[N-1+i+tmp_in_len];
-   }
-   *out += out_len*st->out_stride;
-   return out_len;
-}
-
-#ifdef FIXED_POINT
-EXPORT int speex_resampler_process_int(SpeexResamplerState *st, spx_uint32_t channel_index, const spx_int16_t *in, spx_uint32_t *in_len, spx_int16_t *out, spx_uint32_t *out_len)
-#else
-EXPORT int speex_resampler_process_float(SpeexResamplerState *st, spx_uint32_t channel_index, const float *in, spx_uint32_t *in_len, float *out, spx_uint32_t *out_len)
-#endif
-{
-   int j;
-   spx_uint32_t ilen = *in_len;
-   spx_uint32_t olen = *out_len;
-   spx_word16_t *x = st->mem + channel_index * st->mem_alloc_size;
-   const int filt_offs = st->filt_len - 1;
-   const spx_uint32_t xlen = st->mem_alloc_size - filt_offs;
-   const int istride = st->in_stride;
-
-   if (st->magic_samples[channel_index]) 
-      olen -= speex_resampler_magic(st, channel_index, &out, olen);
-   if (! st->magic_samples[channel_index]) {
-      while (ilen && olen) {
-        spx_uint32_t ichunk = (ilen > xlen) ? xlen : ilen;
-        spx_uint32_t ochunk = olen;
- 
-        if (in) {
-           for(j=0;j<ichunk;++j)
-              x[j+filt_offs]=in[j*istride];
-        } else {
-          for(j=0;j<ichunk;++j)
-            x[j+filt_offs]=0;
-        }
-        speex_resampler_process_native(st, channel_index, &ichunk, out, &ochunk);
-        ilen -= ichunk;
-        olen -= ochunk;
-        out += ochunk * st->out_stride;
-        if (in)
-           in += ichunk * istride;
-      }
-   }
-   *in_len -= ilen;
-   *out_len -= olen;
-   return RESAMPLER_ERR_SUCCESS;
-}
-
-#ifdef FIXED_POINT
-EXPORT int speex_resampler_process_float(SpeexResamplerState *st, spx_uint32_t channel_index, const float *in, spx_uint32_t *in_len, float *out, spx_uint32_t *out_len)
-#else
-EXPORT int speex_resampler_process_int(SpeexResamplerState *st, spx_uint32_t channel_index, const spx_int16_t *in, spx_uint32_t *in_len, spx_int16_t *out, spx_uint32_t *out_len)
-#endif
-{
-   int j;
-   const int istride_save = st->in_stride;
-   const int ostride_save = st->out_stride;
-   spx_uint32_t ilen = *in_len;
-   spx_uint32_t olen = *out_len;
-   spx_word16_t *x = st->mem + channel_index * st->mem_alloc_size;
-   const spx_uint32_t xlen = st->mem_alloc_size - (st->filt_len - 1);
-#ifdef VAR_ARRAYS
-   const unsigned int ylen = (olen < FIXED_STACK_ALLOC) ? olen : FIXED_STACK_ALLOC;
-   VARDECL(spx_word16_t *ystack);
-   ALLOC(ystack, ylen, spx_word16_t);
-#else
-   const unsigned int ylen = FIXED_STACK_ALLOC;
-   spx_word16_t ystack[FIXED_STACK_ALLOC];
-#endif
-
-   st->out_stride = 1;
-   
-   while (ilen && olen) {
-     spx_word16_t *y = ystack;
-     spx_uint32_t ichunk = (ilen > xlen) ? xlen : ilen;
-     spx_uint32_t ochunk = (olen > ylen) ? ylen : olen;
-     spx_uint32_t omagic = 0;
-
-     if (st->magic_samples[channel_index]) {
-       omagic = speex_resampler_magic(st, channel_index, &y, ochunk);
-       ochunk -= omagic;
-       olen -= omagic;
-     }
-     if (! st->magic_samples[channel_index]) {
-       if (in) {
-         for(j=0;j<ichunk;++j)
-#ifdef FIXED_POINT
-           x[j+st->filt_len-1]=WORD2INT(in[j*istride_save]);
-#else
-           x[j+st->filt_len-1]=in[j*istride_save];
-#endif
-       } else {
-         for(j=0;j<ichunk;++j)
-           x[j+st->filt_len-1]=0;
-       }
-
-       speex_resampler_process_native(st, channel_index, &ichunk, y, &ochunk);
-     } else {
-       ichunk = 0;
-       ochunk = 0;
-     }
-
-     for (j=0;j<ochunk+omagic;++j)
-#ifdef FIXED_POINT
-        out[j*ostride_save] = ystack[j];
-#else
-        out[j*ostride_save] = WORD2INT(ystack[j]);
-#endif
-     
-     ilen -= ichunk;
-     olen -= ochunk;
-     out += (ochunk+omagic) * ostride_save;
-     if (in)
-       in += ichunk * istride_save;
-   }
-   st->out_stride = ostride_save;
-   *in_len -= ilen;
-   *out_len -= olen;
-
-   return RESAMPLER_ERR_SUCCESS;
-}
-
-EXPORT int speex_resampler_process_interleaved_float(SpeexResamplerState *st, const float *in, spx_uint32_t *in_len, float *out, spx_uint32_t *out_len)
-{
-   spx_uint32_t i;
-   int istride_save, ostride_save;
-   spx_uint32_t bak_len = *out_len;
-   istride_save = st->in_stride;
-   ostride_save = st->out_stride;
-   st->in_stride = st->out_stride = st->nb_channels;
-   for (i=0;i<st->nb_channels;i++)
-   {
-      *out_len = bak_len;
-      if (in != NULL)
-         speex_resampler_process_float(st, i, in+i, in_len, out+i, out_len);
-      else
-         speex_resampler_process_float(st, i, NULL, in_len, out+i, out_len);
-   }
-   st->in_stride = istride_save;
-   st->out_stride = ostride_save;
-   return RESAMPLER_ERR_SUCCESS;
-}
-               
-EXPORT int speex_resampler_process_interleaved_int(SpeexResamplerState *st, const spx_int16_t *in, spx_uint32_t *in_len, spx_int16_t *out, spx_uint32_t *out_len)
-{
-   spx_uint32_t i;
-   int istride_save, ostride_save;
-   spx_uint32_t bak_len = *out_len;
-   istride_save = st->in_stride;
-   ostride_save = st->out_stride;
-   st->in_stride = st->out_stride = st->nb_channels;
-   for (i=0;i<st->nb_channels;i++)
-   {
-      *out_len = bak_len;
-      if (in != NULL)
-         speex_resampler_process_int(st, i, in+i, in_len, out+i, out_len);
-      else
-         speex_resampler_process_int(st, i, NULL, in_len, out+i, out_len);
-   }
-   st->in_stride = istride_save;
-   st->out_stride = ostride_save;
-   return RESAMPLER_ERR_SUCCESS;
-}
-
-EXPORT int speex_resampler_set_rate(SpeexResamplerState *st, spx_uint32_t in_rate, spx_uint32_t out_rate)
-{
-   return speex_resampler_set_rate_frac(st, in_rate, out_rate, in_rate, out_rate);
-}
-
-EXPORT void speex_resampler_get_rate(SpeexResamplerState *st, spx_uint32_t *in_rate, spx_uint32_t *out_rate)
-{
-   *in_rate = st->in_rate;
-   *out_rate = st->out_rate;
-}
-
-EXPORT int speex_resampler_set_rate_frac(SpeexResamplerState *st, spx_uint32_t ratio_num, spx_uint32_t ratio_den, spx_uint32_t in_rate, spx_uint32_t out_rate)
-{
-   spx_uint32_t fact;
-   spx_uint32_t old_den;
-   spx_uint32_t i;
-   if (st->in_rate == in_rate && st->out_rate == out_rate && st->num_rate == ratio_num && st->den_rate == ratio_den)
-      return RESAMPLER_ERR_SUCCESS;
-   
-   old_den = st->den_rate;
-   st->in_rate = in_rate;
-   st->out_rate = out_rate;
-   st->num_rate = ratio_num;
-   st->den_rate = ratio_den;
-   /* FIXME: This is terribly inefficient, but who cares (at least for now)? */
-   for (fact=2;fact<=IMIN(st->num_rate, st->den_rate);fact++)
-   {
-      while ((st->num_rate % fact == 0) && (st->den_rate % fact == 0))
-      {
-         st->num_rate /= fact;
-         st->den_rate /= fact;
-      }
-   }
-      
-   if (old_den > 0)
-   {
-      for (i=0;i<st->nb_channels;i++)
-      {
-         st->samp_frac_num[i]=st->samp_frac_num[i]*st->den_rate/old_den;
-         /* Safety net */
-         if (st->samp_frac_num[i] >= st->den_rate)
-            st->samp_frac_num[i] = st->den_rate-1;
-      }
-   }
-   
-   if (st->initialised)
-      update_filter(st);
-   return RESAMPLER_ERR_SUCCESS;
-}
-
-EXPORT void speex_resampler_get_ratio(SpeexResamplerState *st, spx_uint32_t *ratio_num, spx_uint32_t *ratio_den)
-{
-   *ratio_num = st->num_rate;
-   *ratio_den = st->den_rate;
-}
-
-EXPORT int speex_resampler_set_quality(SpeexResamplerState *st, int quality)
-{
-   if (quality > 10 || quality < 0)
-      return RESAMPLER_ERR_INVALID_ARG;
-   if (st->quality == quality)
-      return RESAMPLER_ERR_SUCCESS;
-   st->quality = quality;
-   if (st->initialised)
-      update_filter(st);
-   return RESAMPLER_ERR_SUCCESS;
-}
-
-EXPORT void speex_resampler_get_quality(SpeexResamplerState *st, int *quality)
-{
-   *quality = st->quality;
-}
-
-EXPORT void speex_resampler_set_input_stride(SpeexResamplerState *st, spx_uint32_t stride)
-{
-   st->in_stride = stride;
-}
-
-EXPORT void speex_resampler_get_input_stride(SpeexResamplerState *st, spx_uint32_t *stride)
-{
-   *stride = st->in_stride;
-}
-
-EXPORT void speex_resampler_set_output_stride(SpeexResamplerState *st, spx_uint32_t stride)
-{
-   st->out_stride = stride;
-}
-
-EXPORT void speex_resampler_get_output_stride(SpeexResamplerState *st, spx_uint32_t *stride)
-{
-   *stride = st->out_stride;
-}
-
-EXPORT int speex_resampler_get_input_latency(SpeexResamplerState *st)
-{
-  return st->filt_len / 2;
-}
-
-EXPORT int speex_resampler_get_output_latency(SpeexResamplerState *st)
-{
-  return ((st->filt_len / 2) * st->den_rate + (st->num_rate >> 1)) / st->num_rate;
-}
-
-EXPORT int speex_resampler_skip_zeros(SpeexResamplerState *st)
-{
-   spx_uint32_t i;
-   for (i=0;i<st->nb_channels;i++)
-      st->last_sample[i] = st->filt_len/2;
-   return RESAMPLER_ERR_SUCCESS;
-}
-
-EXPORT int speex_resampler_reset_mem(SpeexResamplerState *st)
-{
-   spx_uint32_t i;
-   for (i=0;i<st->nb_channels*(st->filt_len-1);i++)
-      st->mem[i] = 0;
-   return RESAMPLER_ERR_SUCCESS;
-}
-
-EXPORT const char *speex_resampler_strerror(int err)
-{
-   switch (err)
-   {
-      case RESAMPLER_ERR_SUCCESS:
-         return "Success.";
-      case RESAMPLER_ERR_ALLOC_FAILED:
-         return "Memory allocation failed.";
-      case RESAMPLER_ERR_BAD_STATE:
-         return "Bad resampler state.";
-      case RESAMPLER_ERR_INVALID_ARG:
-         return "Invalid argument.";
-      case RESAMPLER_ERR_PTR_OVERLAP:
-         return "Input and output buffers overlap.";
-      default:
-         return "Unknown error. Bad error code or strange version mismatch.";
-   }
-}
diff --git a/libspeex/sb_celp.c b/libspeex/sb_celp.c
deleted file mode 100644
index 6c19ff8..0000000
--- a/libspeex/sb_celp.c
+++ /dev/null
@@ -1,1488 +0,0 @@
-/* Copyright (C) 2002-2006 Jean-Marc Valin 
-   File: sb_celp.c
-
-   Redistribution and use in source and binary forms, with or without
-   modification, 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 the Xiph.org Foundation nor the names of its
-   contributors may be used to endorse or promote products derived from
-   this software without specific prior written permission.
-   
-   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 FOUNDATION 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.
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <math.h>
-#include "sb_celp.h"
-#include "filters.h"
-#include "lpc.h"
-#include "lsp.h"
-#include "stack_alloc.h"
-#include "cb_search.h"
-#include "quant_lsp.h"
-#include "vq.h"
-#include "ltp.h"
-#include "arch.h"
-#include "math_approx.h"
-#include "os_support.h"
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-/* Default size for the encoder and decoder stack (can be changed at compile time).
-   This does not apply when using variable-size arrays or alloca. */
-#ifndef SB_ENC_STACK
-#define SB_ENC_STACK (10000*sizeof(spx_sig_t))
-#endif
-
-#ifndef SB_DEC_STACK
-#define SB_DEC_STACK (6000*sizeof(spx_sig_t))
-#endif
-
-
-#ifdef DISABLE_WIDEBAND
-void *sb_encoder_init(const SpeexMode *m)
-{
-   speex_fatal("Wideband and Ultra-wideband are disabled");
-   return NULL;
-}
-void sb_encoder_destroy(void *state)
-{
-   speex_fatal("Wideband and Ultra-wideband are disabled");
-}
-int sb_encode(void *state, void *vin, SpeexBits *bits)
-{
-   speex_fatal("Wideband and Ultra-wideband are disabled");
-   return -2;
-}
-void *sb_decoder_init(const SpeexMode *m)
-{
-   speex_fatal("Wideband and Ultra-wideband are disabled");
-   return NULL;
-}
-void sb_decoder_destroy(void *state)
-{
-   speex_fatal("Wideband and Ultra-wideband are disabled");
-}
-int sb_decode(void *state, SpeexBits *bits, void *vout)
-{
-   speex_fatal("Wideband and Ultra-wideband are disabled");
-   return -2;
-}
-int sb_encoder_ctl(void *state, int request, void *ptr)
-{
-   speex_fatal("Wideband and Ultra-wideband are disabled");
-   return -2;
-}
-int sb_decoder_ctl(void *state, int request, void *ptr)
-{
-   speex_fatal("Wideband and Ultra-wideband are disabled");
-   return -2;
-}
-#else
-
-
-#ifndef M_PI
-#define M_PI           3.14159265358979323846  /* pi */
-#endif
-
-#define sqr(x) ((x)*(x))
-
-#define SUBMODE(x) st->submodes[st->submodeID]->x
-
-#ifdef FIXED_POINT
-static const spx_word16_t gc_quant_bound[16] = {125, 164, 215, 282, 370, 484, 635, 832, 1090, 1428, 1871, 2452, 3213, 4210, 5516, 7228};
-static const spx_word16_t fold_quant_bound[32] = {
-   39, 44, 50, 57, 64, 73, 83, 94,
-   106, 120, 136, 154, 175, 198, 225, 255,
-   288, 327, 370, 420, 476, 539, 611, 692,
-   784, 889, 1007, 1141, 1293, 1465, 1660, 1881};
-#define LSP_MARGIN 410
-#define LSP_DELTA1 6553
-#define LSP_DELTA2 1638
-
-#else
-
-static const spx_word16_t gc_quant_bound[16] = {
-      0.97979, 1.28384, 1.68223, 2.20426, 2.88829, 3.78458, 4.95900, 6.49787, 
-      8.51428, 11.15642, 14.61846, 19.15484, 25.09895, 32.88761, 43.09325, 56.46588};
-static const spx_word16_t fold_quant_bound[32] = {
-   0.30498, 0.34559, 0.39161, 0.44375, 0.50283, 0.56979, 0.64565, 0.73162,
-   0.82903, 0.93942, 1.06450, 1.20624, 1.36685, 1.54884, 1.75506, 1.98875,
-   2.25355, 2.55360, 2.89361, 3.27889, 3.71547, 4.21018, 4.77076, 5.40598,
-   6.12577, 6.94141, 7.86565, 8.91295, 10.09969, 11.44445, 12.96826, 14.69497};
-
-#define LSP_MARGIN .05
-#define LSP_DELTA1 .2
-#define LSP_DELTA2 .05
-
-#endif
-
-#define QMF_ORDER 64
-
-#ifdef FIXED_POINT
-static const spx_word16_t h0[64] = {2, -7, -7, 18, 15, -39, -25, 75, 35, -130, -41, 212, 38, -327, -17, 483, -32, -689, 124, 956, -283, -1307, 543, 1780, -973, -2467, 1733, 3633, -3339, -6409, 9059, 30153, 30153, 9059, -6409, -3339, 3633, 1733, -2467, -973, 1780, 543, -1307, -283, 956, 124, -689, -32, 483, -17, -327, 38, 212, -41, -130, 35, 75, -25, -39, 15, 18, -7, -7, 2};
-
-#else
-static const float h0[64] = {
-   3.596189e-05f, -0.0001123515f,
-   -0.0001104587f, 0.0002790277f,
-   0.0002298438f, -0.0005953563f,
-   -0.0003823631f, 0.00113826f,
-   0.0005308539f, -0.001986177f,
-   -0.0006243724f, 0.003235877f,
-   0.0005743159f, -0.004989147f,
-   -0.0002584767f, 0.007367171f,
-   -0.0004857935f, -0.01050689f,
-   0.001894714f, 0.01459396f,
-   -0.004313674f, -0.01994365f,
-   0.00828756f, 0.02716055f,
-   -0.01485397f, -0.03764973f,
-   0.026447f, 0.05543245f,
-   -0.05095487f, -0.09779096f,
-   0.1382363f, 0.4600981f,
-   0.4600981f, 0.1382363f,
-   -0.09779096f, -0.05095487f,
-   0.05543245f, 0.026447f,
-   -0.03764973f, -0.01485397f,
-   0.02716055f, 0.00828756f,
-   -0.01994365f, -0.004313674f,
-   0.01459396f, 0.001894714f,
-   -0.01050689f, -0.0004857935f,
-   0.007367171f, -0.0002584767f,
-   -0.004989147f, 0.0005743159f,
-   0.003235877f, -0.0006243724f,
-   -0.001986177f, 0.0005308539f,
-   0.00113826f, -0.0003823631f,
-   -0.0005953563f, 0.0002298438f,
-   0.0002790277f, -0.0001104587f,
-   -0.0001123515f, 3.596189e-05f
-};
-
-#endif
-
-extern const spx_word16_t lag_window[];
-extern const spx_word16_t lpc_window[];
-
-
-void *sb_encoder_init(const SpeexMode *m)
-{
-   int i;
-   spx_int32_t tmp;
-   SBEncState *st;
-   const SpeexSBMode *mode;
-
-   st = (SBEncState*)speex_alloc(sizeof(SBEncState));
-   if (!st)
-      return NULL;
-   st->mode = m;
-   mode = (const SpeexSBMode*)m->mode;
-
-
-   st->st_low = speex_encoder_init(mode->nb_mode);
-#if defined(VAR_ARRAYS) || defined (USE_ALLOCA)
-   st->stack = NULL;
-#else
-   /*st->stack = (char*)speex_alloc_scratch(SB_ENC_STACK);*/
-   speex_encoder_ctl(st->st_low, SPEEX_GET_STACK, &st->stack);
-#endif
-
-   st->full_frame_size = 2*mode->frameSize;
-   st->frame_size = mode->frameSize;
-   st->subframeSize = mode->subframeSize;
-   st->nbSubframes = mode->frameSize/mode->subframeSize;
-   st->windowSize = st->frame_size+st->subframeSize;
-   st->lpcSize=mode->lpcSize;
-
-   st->encode_submode = 1;
-   st->submodes=mode->submodes;
-   st->submodeSelect = st->submodeID=mode->defaultSubmode;
-   
-   tmp=9;
-   speex_encoder_ctl(st->st_low, SPEEX_SET_QUALITY, &tmp);
-   tmp=1;
-   speex_encoder_ctl(st->st_low, SPEEX_SET_WIDEBAND, &tmp);
-
-   st->lpc_floor = mode->lpc_floor;
-   st->gamma1=mode->gamma1;
-   st->gamma2=mode->gamma2;
-   st->first=1;
-
-   st->high=(spx_word16_t*)speex_alloc((st->windowSize-st->frame_size)*sizeof(spx_word16_t));
-
-   st->h0_mem=(spx_word16_t*)speex_alloc((QMF_ORDER)*sizeof(spx_word16_t));
-   st->h1_mem=(spx_word16_t*)speex_alloc((QMF_ORDER)*sizeof(spx_word16_t));
-
-   st->window= lpc_window;
-
-   st->lagWindow = lag_window;
-
-   st->old_lsp = (spx_lsp_t*)speex_alloc(st->lpcSize*sizeof(spx_lsp_t));
-   st->old_qlsp = (spx_lsp_t*)speex_alloc(st->lpcSize*sizeof(spx_lsp_t));
-   st->interp_qlpc = (spx_coef_t*)speex_alloc(st->lpcSize*sizeof(spx_coef_t));
-   st->pi_gain = (spx_word32_t*)speex_alloc((st->nbSubframes)*sizeof(spx_word32_t));
-   st->exc_rms = (spx_word16_t*)speex_alloc((st->nbSubframes)*sizeof(spx_word16_t));
-   st->innov_rms_save = NULL;
-   
-   st->mem_sp = (spx_mem_t*)speex_alloc((st->lpcSize)*sizeof(spx_mem_t));
-   st->mem_sp2 = (spx_mem_t*)speex_alloc((st->lpcSize)*sizeof(spx_mem_t));
-   st->mem_sw = (spx_mem_t*)speex_alloc((st->lpcSize)*sizeof(spx_mem_t));
-
-   for (i=0;i<st->lpcSize;i++)
-      st->old_lsp[i]= DIV32(MULT16_16(QCONST16(3.1415927f, LSP_SHIFT), i+1), st->lpcSize+1);
-
-#ifndef DISABLE_VBR
-   st->vbr_quality = 8;
-   st->vbr_enabled = 0;
-   st->vbr_max = 0;
-   st->vbr_max_high = 20000;  /* We just need a big value here */
-   st->vad_enabled = 0;
-   st->abr_enabled = 0;
-   st->relative_quality=0;
-#endif /* #ifndef DISABLE_VBR */
-
-   st->complexity=2;
-   speex_encoder_ctl(st->st_low, SPEEX_GET_SAMPLING_RATE, &st->sampling_rate);
-   st->sampling_rate*=2;
-#ifdef ENABLE_VALGRIND
-   VALGRIND_MAKE_READABLE(st, (st->stack-(char*)st));
-#endif
-   return st;
-}
-
-void sb_encoder_destroy(void *state)
-{
-   SBEncState *st=(SBEncState*)state;
-
-   speex_encoder_destroy(st->st_low);
-#if !(defined(VAR_ARRAYS) || defined (USE_ALLOCA))
-   /*speex_free_scratch(st->stack);*/
-#endif
-
-   speex_free(st->high);
-
-   speex_free(st->h0_mem);
-   speex_free(st->h1_mem);
-
-   speex_free(st->old_lsp);
-   speex_free(st->old_qlsp);
-   speex_free(st->interp_qlpc);
-   speex_free(st->pi_gain);
-   speex_free(st->exc_rms);
-
-   speex_free(st->mem_sp);
-   speex_free(st->mem_sp2);
-   speex_free(st->mem_sw);
-
-   
-   speex_free(st);
-}
-
-
-int sb_encode(void *state, void *vin, SpeexBits *bits)
-{
-   SBEncState *st;
-   int i, roots, sub;
-   char *stack;
-   VARDECL(spx_mem_t *mem);
-   VARDECL(spx_sig_t *innov);
-   VARDECL(spx_word16_t *target);
-   VARDECL(spx_word16_t *syn_resp);
-   VARDECL(spx_word32_t *low_pi_gain);
-   spx_word16_t *low;
-   spx_word16_t *high;
-   VARDECL(spx_word16_t *low_exc_rms);
-   VARDECL(spx_word16_t *low_innov_rms);
-   const SpeexSBMode *mode;
-   spx_int32_t dtx;
-   spx_word16_t *in = (spx_word16_t*)vin;
-   spx_word16_t e_low=0, e_high=0;
-   VARDECL(spx_coef_t *lpc);
-   VARDECL(spx_coef_t *interp_lpc);
-   VARDECL(spx_coef_t *bw_lpc1);
-   VARDECL(spx_coef_t *bw_lpc2);
-   VARDECL(spx_lsp_t *lsp);
-   VARDECL(spx_lsp_t *qlsp);
-   VARDECL(spx_lsp_t *interp_lsp);
-   VARDECL(spx_lsp_t *interp_qlsp);
-      
-   st = (SBEncState*)state;
-   stack=st->stack;
-   mode = (const SpeexSBMode*)(st->mode->mode);
-   low = in;
-   high = in+st->frame_size;
-   
-   /* High-band buffering / sync with low band */
-   /* Compute the two sub-bands by filtering with QMF h0*/
-   qmf_decomp(in, h0, low, high, st->full_frame_size, QMF_ORDER, st->h0_mem, stack);
-   
-#ifndef DISABLE_VBR
-   if (st->vbr_enabled || st->vad_enabled)
-   {
-      /* Need to compute things here before the signal is trashed by the encoder */
-      /*FIXME: Are the two signals (low, high) in sync? */
-      e_low = compute_rms16(low, st->frame_size);
-      e_high = compute_rms16(high, st->frame_size);
-   }
-#endif /* #ifndef DISABLE_VBR */
-
-   ALLOC(low_innov_rms, st->nbSubframes, spx_word16_t);
-   speex_encoder_ctl(st->st_low, SPEEX_SET_INNOVATION_SAVE, low_innov_rms);
-   /* Encode the narrowband part*/
-   speex_encode_native(st->st_low, low, bits);
-
-   high = high - (st->windowSize-st->frame_size);
-   SPEEX_COPY(high, st->high, st->windowSize-st->frame_size);
-   SPEEX_COPY(st->high, &high[st->frame_size], st->windowSize-st->frame_size);
-   
-
-   ALLOC(low_pi_gain, st->nbSubframes, spx_word32_t);
-   ALLOC(low_exc_rms, st->nbSubframes, spx_word16_t);
-   speex_encoder_ctl(st->st_low, SPEEX_GET_PI_GAIN, low_pi_gain);
-   speex_encoder_ctl(st->st_low, SPEEX_GET_EXC, low_exc_rms);
-   
-   speex_encoder_ctl(st->st_low, SPEEX_GET_LOW_MODE, &dtx);
-
-   if (dtx==0)
-      dtx=1;
-   else
-      dtx=0;
-
-   ALLOC(lpc, st->lpcSize, spx_coef_t);
-   ALLOC(interp_lpc, st->lpcSize, spx_coef_t);
-   ALLOC(bw_lpc1, st->lpcSize, spx_coef_t);
-   ALLOC(bw_lpc2, st->lpcSize, spx_coef_t);
-   
-   ALLOC(lsp, st->lpcSize, spx_lsp_t);
-   ALLOC(qlsp, st->lpcSize, spx_lsp_t);
-   ALLOC(interp_lsp, st->lpcSize, spx_lsp_t);
-   ALLOC(interp_qlsp, st->lpcSize, spx_lsp_t);
-   
-   {
-      VARDECL(spx_word16_t *autocorr);
-      VARDECL(spx_word16_t *w_sig);
-      ALLOC(autocorr, st->lpcSize+1, spx_word16_t);
-      ALLOC(w_sig, st->windowSize, spx_word16_t);
-      /* Window for analysis */
-      /* FIXME: This is a kludge */
-      if (st->subframeSize==80)
-      {
-         for (i=0;i<st->windowSize;i++)
-            w_sig[i] = EXTRACT16(SHR32(MULT16_16(high[i],st->window[i>>1]),SIG_SHIFT));
-      } else {
-         for (i=0;i<st->windowSize;i++)
-            w_sig[i] = EXTRACT16(SHR32(MULT16_16(high[i],st->window[i]),SIG_SHIFT));
-      }
-      /* Compute auto-correlation */
-      _spx_autocorr(w_sig, autocorr, st->lpcSize+1, st->windowSize);
-      autocorr[0] = ADD16(autocorr[0],MULT16_16_Q15(autocorr[0],st->lpc_floor)); /* Noise floor in auto-correlation domain */
-
-      /* Lag windowing: equivalent to filtering in the power-spectrum domain */
-      for (i=0;i<st->lpcSize+1;i++)
-         autocorr[i] = MULT16_16_Q14(autocorr[i],st->lagWindow[i]);
-
-      /* Levinson-Durbin */
-      _spx_lpc(lpc, autocorr, st->lpcSize);
-   }
-
-   /* LPC to LSPs (x-domain) transform */
-   roots=lpc_to_lsp (lpc, st->lpcSize, lsp, 10, LSP_DELTA1, stack);
-   if (roots!=st->lpcSize)
-   {
-      roots = lpc_to_lsp (lpc, st->lpcSize, lsp, 10, LSP_DELTA2, stack);
-      if (roots!=st->lpcSize) {
-         /*If we can't find all LSP's, do some damage control and use a flat filter*/
-         for (i=0;i<st->lpcSize;i++)
-         {
-            lsp[i]=st->old_lsp[i];
-         }
-      }
-   }
-
-#ifndef DISABLE_VBR
-   /* VBR code */
-   if ((st->vbr_enabled || st->vad_enabled) && !dtx)
-   {
-      float ratio;
-      if (st->abr_enabled)
-      {
-         float qual_change=0;
-         if (st->abr_drift2 * st->abr_drift > 0)
-         {
-            /* Only adapt if long-term and short-term drift are the same sign */
-            qual_change = -.00001*st->abr_drift/(1+st->abr_count);
-            if (qual_change>.1)
-               qual_change=.1;
-            if (qual_change<-.1)
-               qual_change=-.1;
-         }
-         st->vbr_quality += qual_change;
-         if (st->vbr_quality>10)
-            st->vbr_quality=10;
-         if (st->vbr_quality<0)
-            st->vbr_quality=0;
-      }
-
-
-      ratio = 2*log((1.f+e_high)/(1.f+e_low));
-      
-      speex_encoder_ctl(st->st_low, SPEEX_GET_RELATIVE_QUALITY, &st->relative_quality);
-      if (ratio<-4)
-         ratio=-4;
-      if (ratio>2)
-         ratio=2;
-      /*if (ratio>-2)*/
-      if (st->vbr_enabled) 
-      {
-         spx_int32_t modeid;
-         modeid = mode->nb_modes-1;
-         st->relative_quality+=1.0*(ratio+2);
-	 if (st->relative_quality<-1)
-            st->relative_quality=-1;
-         while (modeid)
-         {
-            int v1;
-            float thresh;
-            v1=(int)floor(st->vbr_quality);
-            if (v1==10)
-               thresh = mode->vbr_thresh[modeid][v1];
-            else
-               thresh = (st->vbr_quality-v1)   * mode->vbr_thresh[modeid][v1+1] + 
-                        (1+v1-st->vbr_quality) * mode->vbr_thresh[modeid][v1];
-            if (st->relative_quality >= thresh && st->sampling_rate*st->submodes[modeid]->bits_per_frame/st->full_frame_size <= st->vbr_max_high)
-               break;
-            modeid--;
-         }
-         speex_encoder_ctl(state, SPEEX_SET_HIGH_MODE, &modeid);
-         if (st->abr_enabled)
-         {
-            spx_int32_t bitrate;
-            speex_encoder_ctl(state, SPEEX_GET_BITRATE, &bitrate);
-            st->abr_drift+=(bitrate-st->abr_enabled);
-            st->abr_drift2 = .95*st->abr_drift2 + .05*(bitrate-st->abr_enabled);
-            st->abr_count += 1.0;
-         }
-
-      } else {
-         /* VAD only */
-         int modeid;
-         if (st->relative_quality<2.0)
-            modeid=1;
-         else
-            modeid=st->submodeSelect;
-         /*speex_encoder_ctl(state, SPEEX_SET_MODE, &mode);*/
-         st->submodeID=modeid;
-
-      }
-      /*fprintf (stderr, "%f %f\n", ratio, low_qual);*/
-   }
-#endif /* #ifndef DISABLE_VBR */
-
-   if (st->encode_submode)
-   {
-      speex_bits_pack(bits, 1, 1);
-      if (dtx)
-         speex_bits_pack(bits, 0, SB_SUBMODE_BITS);
-      else
-         speex_bits_pack(bits, st->submodeID, SB_SUBMODE_BITS);
-   }
-
-   /* If null mode (no transmission), just set a couple things to zero*/
-   if (dtx || st->submodes[st->submodeID] == NULL)
-   {
-      for (i=0;i<st->frame_size;i++)
-         high[i]=VERY_SMALL;
-
-      for (i=0;i<st->lpcSize;i++)
-         st->mem_sw[i]=0;
-      st->first=1;
-
-      /* Final signal synthesis from excitation */
-      iir_mem16(high, st->interp_qlpc, high, st->frame_size, st->lpcSize, st->mem_sp, stack);
-
-      if (dtx)
-         return 0;
-      else
-         return 1;
-   }
-
-
-   /* LSP quantization */
-   SUBMODE(lsp_quant)(lsp, qlsp, st->lpcSize, bits);   
-
-   if (st->first)
-   {
-      for (i=0;i<st->lpcSize;i++)
-         st->old_lsp[i] = lsp[i];
-      for (i=0;i<st->lpcSize;i++)
-         st->old_qlsp[i] = qlsp[i];
-   }
-   
-   ALLOC(mem, st->lpcSize, spx_mem_t);
-   ALLOC(syn_resp, st->subframeSize, spx_word16_t);
-   ALLOC(innov, st->subframeSize, spx_sig_t);
-   ALLOC(target, st->subframeSize, spx_word16_t);
-
-   for (sub=0;sub<st->nbSubframes;sub++)
-   {
-      VARDECL(spx_word16_t *exc);
-      VARDECL(spx_word16_t *res);
-      VARDECL(spx_word16_t *sw);
-      spx_word16_t *sp;
-      spx_word16_t filter_ratio;     /*Q7*/
-      int offset;
-      spx_word32_t rl, rh;           /*Q13*/
-      spx_word16_t eh=0;
-
-      offset = st->subframeSize*sub;
-      sp=high+offset;
-      ALLOC(exc, st->subframeSize, spx_word16_t);
-      ALLOC(res, st->subframeSize, spx_word16_t);
-      ALLOC(sw, st->subframeSize, spx_word16_t);
-      
-      /* LSP interpolation (quantized and unquantized) */
-      lsp_interpolate(st->old_lsp, lsp, interp_lsp, st->lpcSize, sub, st->nbSubframes);
-      lsp_interpolate(st->old_qlsp, qlsp, interp_qlsp, st->lpcSize, sub, st->nbSubframes);
-
-      lsp_enforce_margin(interp_lsp, st->lpcSize, LSP_MARGIN);
-      lsp_enforce_margin(interp_qlsp, st->lpcSize, LSP_MARGIN);
-
-      lsp_to_lpc(interp_lsp, interp_lpc, st->lpcSize,stack);
-      lsp_to_lpc(interp_qlsp, st->interp_qlpc, st->lpcSize, stack);
-
-      bw_lpc(st->gamma1, interp_lpc, bw_lpc1, st->lpcSize);
-      bw_lpc(st->gamma2, interp_lpc, bw_lpc2, st->lpcSize);
-
-      /* Compute mid-band (4000 Hz for wideband) response of low-band and high-band
-         filters */
-      st->pi_gain[sub]=LPC_SCALING;
-      rh = LPC_SCALING;
-      for (i=0;i<st->lpcSize;i+=2)
-      {
-         rh += st->interp_qlpc[i+1] - st->interp_qlpc[i];
-         st->pi_gain[sub] += st->interp_qlpc[i] + st->interp_qlpc[i+1];
-      }
-      
-      rl = low_pi_gain[sub];
-#ifdef FIXED_POINT
-      filter_ratio=EXTRACT16(SATURATE(PDIV32(SHL32(ADD32(rl,82),7),ADD32(82,rh)),32767));
-#else
-      filter_ratio=(rl+.01)/(rh+.01);
-#endif
-      
-      /* Compute "real excitation" */
-      fir_mem16(sp, st->interp_qlpc, exc, st->subframeSize, st->lpcSize, st->mem_sp2, stack);
-      /* Compute energy of low-band and high-band excitation */
-
-      eh = compute_rms16(exc, st->subframeSize);
-
-      if (!SUBMODE(innovation_quant)) {/* 1 for spectral folding excitation, 0 for stochastic */
-         spx_word32_t g;   /*Q7*/
-         spx_word16_t el;  /*Q0*/
-         el = low_innov_rms[sub];
-
-         /* Gain to use if we want to use the low-band excitation for high-band */
-         g=PDIV32(MULT16_16(filter_ratio,eh),EXTEND32(ADD16(1,el)));
-         
-#if 0
-         {
-            char *tmp_stack=stack;
-            float *tmp_sig;
-            float g2;
-            ALLOC(tmp_sig, st->subframeSize, spx_sig_t);
-            for (i=0;i<st->lpcSize;i++)
-               mem[i]=st->mem_sp[i];
-            iir_mem2(st->low_innov+offset, st->interp_qlpc, tmp_sig, st->subframeSize, st->lpcSize, mem);
-            g2 = compute_rms(sp, st->subframeSize)/(.01+compute_rms(tmp_sig, st->subframeSize));
-            /*fprintf (stderr, "gains: %f %f\n", g, g2);*/
-            g = g2;
-            stack = tmp_stack;
-         }
-#endif
-
-         /*print_vec(&g, 1, "gain factor");*/
-         /* Gain quantization */
-         {
-            int quant = scal_quant(g, fold_quant_bound, 32);
-            /*speex_warning_int("tata", quant);*/
-            if (quant<0)
-               quant=0;
-            if (quant>31)
-               quant=31;
-            speex_bits_pack(bits, quant, 5);
-         }
-         if (st->innov_rms_save)
-         {
-            st->innov_rms_save[sub] = eh;
-         }
-         st->exc_rms[sub] = eh;
-      } else {
-         spx_word16_t gc;       /*Q7*/
-         spx_word32_t scale;    /*Q14*/
-         spx_word16_t el;       /*Q0*/
-         el = low_exc_rms[sub]; /*Q0*/
-
-         gc = PDIV32_16(MULT16_16(filter_ratio,1+eh),1+el);
-
-         /* This is a kludge that cleans up a historical bug */
-         if (st->subframeSize==80)
-            gc = MULT16_16_P15(QCONST16(0.70711f,15),gc);
-         /*printf ("%f %f %f %f\n", el, eh, filter_ratio, gc);*/
-         {
-            int qgc = scal_quant(gc, gc_quant_bound, 16);
-            speex_bits_pack(bits, qgc, 4);
-            gc = MULT16_16_Q15(QCONST16(0.87360,15),gc_quant_bound[qgc]);
-         }
-         if (st->subframeSize==80)
-            gc = MULT16_16_P14(QCONST16(1.4142f,14), gc);
-
-         scale = SHL32(MULT16_16(PDIV32_16(SHL32(EXTEND32(gc),SIG_SHIFT-6),filter_ratio),(1+el)),6);
-
-         compute_impulse_response(st->interp_qlpc, bw_lpc1, bw_lpc2, syn_resp, st->subframeSize, st->lpcSize, stack);
-
-         
-         /* Reset excitation */
-         for (i=0;i<st->subframeSize;i++)
-            res[i]=VERY_SMALL;
-         
-         /* Compute zero response (ringing) of A(z/g1) / ( A(z/g2) * Aq(z) ) */
-         for (i=0;i<st->lpcSize;i++)
-            mem[i]=st->mem_sp[i];
-         iir_mem16(res, st->interp_qlpc, res, st->subframeSize, st->lpcSize, mem, stack);
-
-         for (i=0;i<st->lpcSize;i++)
-            mem[i]=st->mem_sw[i];
-         filter_mem16(res, bw_lpc1, bw_lpc2, res, st->subframeSize, st->lpcSize, mem, stack);
-
-         /* Compute weighted signal */
-         for (i=0;i<st->lpcSize;i++)
-            mem[i]=st->mem_sw[i];
-         filter_mem16(sp, bw_lpc1, bw_lpc2, sw, st->subframeSize, st->lpcSize, mem, stack);
-
-         /* Compute target signal */
-         for (i=0;i<st->subframeSize;i++)
-            target[i]=SUB16(sw[i],res[i]);
-
-         signal_div(target, target, scale, st->subframeSize);
-
-         /* Reset excitation */
-         SPEEX_MEMSET(innov, 0, st->subframeSize);
-
-         /*print_vec(target, st->subframeSize, "\ntarget");*/
-         SUBMODE(innovation_quant)(target, st->interp_qlpc, bw_lpc1, bw_lpc2, 
-                                   SUBMODE(innovation_params), st->lpcSize, st->subframeSize, 
-                                   innov, syn_resp, bits, stack, st->complexity, SUBMODE(double_codebook));
-         /*print_vec(target, st->subframeSize, "after");*/
-
-         signal_mul(innov, innov, scale, st->subframeSize);
-
-         if (SUBMODE(double_codebook)) {
-            char *tmp_stack=stack;
-            VARDECL(spx_sig_t *innov2);
-            ALLOC(innov2, st->subframeSize, spx_sig_t);
-            SPEEX_MEMSET(innov2, 0, st->subframeSize);
-            for (i=0;i<st->subframeSize;i++)
-               target[i]=MULT16_16_P13(QCONST16(2.5f,13), target[i]);
-
-            SUBMODE(innovation_quant)(target, st->interp_qlpc, bw_lpc1, bw_lpc2, 
-                                      SUBMODE(innovation_params), st->lpcSize, st->subframeSize, 
-                                      innov2, syn_resp, bits, stack, st->complexity, 0);
-            signal_mul(innov2, innov2, MULT16_32_P15(QCONST16(0.4f,15),scale), st->subframeSize);
-
-            for (i=0;i<st->subframeSize;i++)
-               innov[i] = ADD32(innov[i],innov2[i]);
-            stack = tmp_stack;
-         }
-         for (i=0;i<st->subframeSize;i++)
-            exc[i] = PSHR32(innov[i],SIG_SHIFT);
-
-         if (st->innov_rms_save)
-         {
-            st->innov_rms_save[sub] = MULT16_16_Q15(QCONST16(.70711f, 15), compute_rms(innov, st->subframeSize));
-         }
-         st->exc_rms[sub] = compute_rms16(exc, st->subframeSize);
-         
-
-      }
-
-      
-      /*Keep the previous memory*/
-      for (i=0;i<st->lpcSize;i++)
-         mem[i]=st->mem_sp[i];
-      /* Final signal synthesis from excitation */
-      iir_mem16(exc, st->interp_qlpc, sp, st->subframeSize, st->lpcSize, st->mem_sp, stack);
-      
-      /* Compute weighted signal again, from synthesized speech (not sure it's the right thing) */
-      filter_mem16(sp, bw_lpc1, bw_lpc2, sw, st->subframeSize, st->lpcSize, st->mem_sw, stack);
-   }
-
-   for (i=0;i<st->lpcSize;i++)
-      st->old_lsp[i] = lsp[i];
-   for (i=0;i<st->lpcSize;i++)
-      st->old_qlsp[i] = qlsp[i];
-
-   st->first=0;
-
-   return 1;
-}
-
-
-
-
-
-void *sb_decoder_init(const SpeexMode *m)
-{
-   spx_int32_t tmp;
-   SBDecState *st;
-   const SpeexSBMode *mode;
-   st = (SBDecState*)speex_alloc(sizeof(SBDecState));
-   if (!st)
-      return NULL;
-   st->mode = m;
-   mode=(const SpeexSBMode*)m->mode;
-   st->encode_submode = 1;
-
-   st->st_low = speex_decoder_init(mode->nb_mode);
-#if defined(VAR_ARRAYS) || defined (USE_ALLOCA)
-   st->stack = NULL;
-#else
-   /*st->stack = (char*)speex_alloc_scratch(SB_DEC_STACK);*/
-   speex_decoder_ctl(st->st_low, SPEEX_GET_STACK, &st->stack);
-#endif
-
-   st->full_frame_size = 2*mode->frameSize;
-   st->frame_size = mode->frameSize;
-   st->subframeSize = mode->subframeSize;
-   st->nbSubframes = mode->frameSize/mode->subframeSize;
-   st->lpcSize=mode->lpcSize;
-   speex_decoder_ctl(st->st_low, SPEEX_GET_SAMPLING_RATE, &st->sampling_rate);
-   st->sampling_rate*=2;
-   tmp=1;
-   speex_decoder_ctl(st->st_low, SPEEX_SET_WIDEBAND, &tmp);
-
-   st->submodes=mode->submodes;
-   st->submodeID=mode->defaultSubmode;
-
-   st->first=1;
-
-   st->g0_mem = (spx_word16_t*)speex_alloc((QMF_ORDER)*sizeof(spx_word16_t));
-   st->g1_mem = (spx_word16_t*)speex_alloc((QMF_ORDER)*sizeof(spx_word16_t));
-
-   st->excBuf = (spx_word16_t*)speex_alloc((st->subframeSize)*sizeof(spx_word16_t));
-
-   st->old_qlsp = (spx_lsp_t*)speex_alloc((st->lpcSize)*sizeof(spx_lsp_t));
-   st->interp_qlpc = (spx_coef_t*)speex_alloc(st->lpcSize*sizeof(spx_coef_t));
-
-   st->pi_gain = (spx_word32_t*)speex_alloc((st->nbSubframes)*sizeof(spx_word32_t));
-   st->exc_rms = (spx_word16_t*)speex_alloc((st->nbSubframes)*sizeof(spx_word16_t));
-   st->mem_sp = (spx_mem_t*)speex_alloc((2*st->lpcSize)*sizeof(spx_mem_t));
-   
-   st->innov_save = NULL;
-
-
-   st->lpc_enh_enabled=0;
-   st->seed = 1000;
-
-#ifdef ENABLE_VALGRIND
-   VALGRIND_MAKE_READABLE(st, (st->stack-(char*)st));
-#endif
-   return st;
-}
-
-void sb_decoder_destroy(void *state)
-{
-   SBDecState *st;
-   st = (SBDecState*)state;
-   speex_decoder_destroy(st->st_low);
-#if !(defined(VAR_ARRAYS) || defined (USE_ALLOCA))
-   /*speex_free_scratch(st->stack);*/
-#endif
-
-   speex_free(st->g0_mem);
-   speex_free(st->g1_mem);
-   speex_free(st->excBuf);
-   speex_free(st->old_qlsp);
-   speex_free(st->interp_qlpc);
-   speex_free(st->pi_gain);
-   speex_free(st->exc_rms);
-   speex_free(st->mem_sp);
-
-   speex_free(state);
-}
-
-static void sb_decode_lost(SBDecState *st, spx_word16_t *out, int dtx, char *stack)
-{
-   int i;
-   int saved_modeid=0;
-
-   if (dtx)
-   {
-      saved_modeid=st->submodeID;
-      st->submodeID=1;
-   } else {
-      bw_lpc(QCONST16(0.99f,15), st->interp_qlpc, st->interp_qlpc, st->lpcSize);
-   }
-
-   st->first=1;
-   
-   
-   /* Final signal synthesis from excitation */
-   if (!dtx)
-   {
-      st->last_ener =  MULT16_16_Q15(QCONST16(.9f,15),st->last_ener);
-   }
-   for (i=0;i<st->frame_size;i++)
-      out[i+st->frame_size] = speex_rand(st->last_ener, &st->seed);
-
-   iir_mem16(out+st->frame_size, st->interp_qlpc, out+st->frame_size, st->frame_size, st->lpcSize, 
-            st->mem_sp, stack);
-   
-   
-   /* Reconstruct the original */
-   qmf_synth(out, out+st->frame_size, h0, out, st->full_frame_size, QMF_ORDER, st->g0_mem, st->g1_mem, stack);
-   if (dtx)
-   {
-      st->submodeID=saved_modeid;
-   }
-
-   return;
-}
-
-int sb_decode(void *state, SpeexBits *bits, void *vout)
-{
-   int i, sub;
-   SBDecState *st;
-   int wideband;
-   int ret;
-   char *stack;
-   VARDECL(spx_word32_t *low_pi_gain);
-   VARDECL(spx_word16_t *low_exc_rms);
-   VARDECL(spx_coef_t *ak);
-   VARDECL(spx_lsp_t *qlsp);
-   VARDECL(spx_lsp_t *interp_qlsp);
-   spx_int32_t dtx;
-   const SpeexSBMode *mode;
-   spx_word16_t *out = (spx_word16_t*)vout;
-   spx_word16_t *low_innov_alias;
-   spx_word32_t exc_ener_sum = 0;
-   
-   st = (SBDecState*)state;
-   stack=st->stack;
-   mode = (const SpeexSBMode*)(st->mode->mode);
-
-   low_innov_alias = out+st->frame_size;
-   speex_decoder_ctl(st->st_low, SPEEX_SET_INNOVATION_SAVE, low_innov_alias);
-   /* Decode the low-band */
-   ret = speex_decode_native(st->st_low, bits, out);
-
-   speex_decoder_ctl(st->st_low, SPEEX_GET_DTX_STATUS, &dtx);
-
-   /* If error decoding the narrowband part, propagate error */
-   if (ret!=0)
-   {
-      return ret;
-   }
-
-   if (!bits)
-   {
-      sb_decode_lost(st, out, dtx, stack);
-      return 0;
-   }
-
-   if (st->encode_submode)
-   {
-
-      /*Check "wideband bit"*/
-      if (speex_bits_remaining(bits)>0)
-         wideband = speex_bits_peek(bits);
-      else
-         wideband = 0;
-      if (wideband)
-      {
-         /*Regular wideband frame, read the submode*/
-         wideband = speex_bits_unpack_unsigned(bits, 1);
-         st->submodeID = speex_bits_unpack_unsigned(bits, SB_SUBMODE_BITS);
-      } else
-      {
-         /*Was a narrowband frame, set "null submode"*/
-         st->submodeID = 0;
-      }
-      if (st->submodeID != 0 && st->submodes[st->submodeID] == NULL)
-      {
-         speex_notify("Invalid mode encountered. The stream is corrupted.");
-         return -2;
-      }
-   }
-
-   /* If null mode (no transmission), just set a couple things to zero*/
-   if (st->submodes[st->submodeID] == NULL)
-   {
-      if (dtx)
-      {
-         sb_decode_lost(st, out, 1, stack);
-         return 0;
-      }
-
-      for (i=0;i<st->frame_size;i++)
-         out[st->frame_size+i]=VERY_SMALL;
-
-      st->first=1;
-
-      /* Final signal synthesis from excitation */
-      iir_mem16(out+st->frame_size, st->interp_qlpc, out+st->frame_size, st->frame_size, st->lpcSize, st->mem_sp, stack);
-
-      qmf_synth(out, out+st->frame_size, h0, out, st->full_frame_size, QMF_ORDER, st->g0_mem, st->g1_mem, stack);
-
-      return 0;
-
-   }
-
-   ALLOC(low_pi_gain, st->nbSubframes, spx_word32_t);
-   ALLOC(low_exc_rms, st->nbSubframes, spx_word16_t);
-   speex_decoder_ctl(st->st_low, SPEEX_GET_PI_GAIN, low_pi_gain);
-   speex_decoder_ctl(st->st_low, SPEEX_GET_EXC, low_exc_rms);
-
-   ALLOC(qlsp, st->lpcSize, spx_lsp_t);
-   ALLOC(interp_qlsp, st->lpcSize, spx_lsp_t);
-   SUBMODE(lsp_unquant)(qlsp, st->lpcSize, bits);
-   
-   if (st->first)
-   {
-      for (i=0;i<st->lpcSize;i++)
-         st->old_qlsp[i] = qlsp[i];
-   }
-   
-   ALLOC(ak, st->lpcSize, spx_coef_t);
-
-   for (sub=0;sub<st->nbSubframes;sub++)
-   {
-      VARDECL(spx_word32_t *exc);
-      spx_word16_t *innov_save=NULL;
-      spx_word16_t *sp;
-      spx_word16_t filter_ratio;
-      spx_word16_t el=0;
-      int offset;
-      spx_word32_t rl=0,rh=0;
-      
-      offset = st->subframeSize*sub;
-      sp=out+st->frame_size+offset;
-      ALLOC(exc, st->subframeSize, spx_word32_t);
-      /* Pointer for saving innovation */
-      if (st->innov_save)
-      {
-         innov_save = st->innov_save+2*offset;
-         SPEEX_MEMSET(innov_save, 0, 2*st->subframeSize);
-      }
-      
-      /* LSP interpolation */
-      lsp_interpolate(st->old_qlsp, qlsp, interp_qlsp, st->lpcSize, sub, st->nbSubframes);
-
-      lsp_enforce_margin(interp_qlsp, st->lpcSize, LSP_MARGIN);
-
-      /* LSP to LPC */
-      lsp_to_lpc(interp_qlsp, ak, st->lpcSize, stack);
-
-      /* Calculate reponse ratio between the low and high filter in the middle
-         of the band (4000 Hz) */
-      
-         st->pi_gain[sub]=LPC_SCALING;
-         rh = LPC_SCALING;
-         for (i=0;i<st->lpcSize;i+=2)
-         {
-            rh += ak[i+1] - ak[i];
-            st->pi_gain[sub] += ak[i] + ak[i+1];
-         }
-
-         rl = low_pi_gain[sub];
-#ifdef FIXED_POINT
-         filter_ratio=EXTRACT16(SATURATE(PDIV32(SHL32(ADD32(rl,82),7),ADD32(82,rh)),32767));
-#else
-         filter_ratio=(rl+.01)/(rh+.01);
-#endif
-      
-      SPEEX_MEMSET(exc, 0, st->subframeSize);
-      if (!SUBMODE(innovation_unquant))
-      {
-         spx_word32_t g;
-         int quant;
-
-         quant = speex_bits_unpack_unsigned(bits, 5);
-         g= spx_exp(MULT16_16(QCONST16(.125f,11),(quant-10)));
-         
-         g = PDIV32(g, filter_ratio);
-         
-         for (i=0;i<st->subframeSize;i+=2)
-         {
-            exc[i]=SHL32(MULT16_32_P15(MULT16_16_Q15(mode->folding_gain,low_innov_alias[offset+i]),SHL32(g,6)),SIG_SHIFT);
-            exc[i+1]=NEG32(SHL32(MULT16_32_P15(MULT16_16_Q15(mode->folding_gain,low_innov_alias[offset+i+1]),SHL32(g,6)),SIG_SHIFT));
-         }
-         
-      } else {
-         spx_word16_t gc;
-         spx_word32_t scale;
-         int qgc = speex_bits_unpack_unsigned(bits, 4);
-         
-         el = low_exc_rms[sub];
-         gc = MULT16_16_Q15(QCONST16(0.87360,15),gc_quant_bound[qgc]);
-
-         if (st->subframeSize==80)
-            gc = MULT16_16_P14(QCONST16(1.4142f,14),gc);
-
-         scale = SHL32(PDIV32(SHL32(MULT16_16(gc, el),3), filter_ratio),SIG_SHIFT-3);
-         SUBMODE(innovation_unquant)(exc, SUBMODE(innovation_params), st->subframeSize, 
-                                     bits, stack, &st->seed);
-
-         signal_mul(exc,exc,scale,st->subframeSize);
-
-         if (SUBMODE(double_codebook)) {
-            char *tmp_stack=stack;
-            VARDECL(spx_sig_t *innov2);
-            ALLOC(innov2, st->subframeSize, spx_sig_t);
-            SPEEX_MEMSET(innov2, 0, st->subframeSize);
-            SUBMODE(innovation_unquant)(innov2, SUBMODE(innovation_params), st->subframeSize, 
-                                        bits, stack, &st->seed);
-            signal_mul(innov2, innov2, MULT16_32_P15(QCONST16(0.4f,15),scale), st->subframeSize);
-            for (i=0;i<st->subframeSize;i++)
-               exc[i] = ADD32(exc[i],innov2[i]);
-            stack = tmp_stack;
-         }
-
-      }
-      
-      if (st->innov_save)
-      {
-         for (i=0;i<st->subframeSize;i++)
-            innov_save[2*i]=EXTRACT16(PSHR32(exc[i],SIG_SHIFT));
-      }
-      
-      iir_mem16(st->excBuf, st->interp_qlpc, sp, st->subframeSize, st->lpcSize, 
-               st->mem_sp, stack);
-      for (i=0;i<st->subframeSize;i++)
-         st->excBuf[i]=EXTRACT16(PSHR32(exc[i],SIG_SHIFT));
-      for (i=0;i<st->lpcSize;i++)
-         st->interp_qlpc[i] = ak[i];
-      st->exc_rms[sub] = compute_rms16(st->excBuf, st->subframeSize);
-      exc_ener_sum = ADD32(exc_ener_sum, DIV32(MULT16_16(st->exc_rms[sub],st->exc_rms[sub]), st->nbSubframes));
-   }
-   st->last_ener = spx_sqrt(exc_ener_sum);
-   
-   qmf_synth(out, out+st->frame_size, h0, out, st->full_frame_size, QMF_ORDER, st->g0_mem, st->g1_mem, stack);
-   for (i=0;i<st->lpcSize;i++)
-      st->old_qlsp[i] = qlsp[i];
-
-   st->first=0;
-
-   return 0;
-}
-
-
-int sb_encoder_ctl(void *state, int request, void *ptr)
-{
-   SBEncState *st;
-   st=(SBEncState*)state;
-   switch(request)
-   {
-   case SPEEX_GET_FRAME_SIZE:
-      (*(spx_int32_t*)ptr) = st->full_frame_size;
-      break;
-   case SPEEX_SET_HIGH_MODE:
-      st->submodeSelect = st->submodeID = (*(spx_int32_t*)ptr);
-      break;
-   case SPEEX_SET_LOW_MODE:
-      speex_encoder_ctl(st->st_low, SPEEX_SET_LOW_MODE, ptr);
-      break;
-   case SPEEX_SET_DTX:
-      speex_encoder_ctl(st->st_low, SPEEX_SET_DTX, ptr);
-      break;
-   case SPEEX_GET_DTX:
-      speex_encoder_ctl(st->st_low, SPEEX_GET_DTX, ptr);
-      break;
-   case SPEEX_GET_LOW_MODE:
-      speex_encoder_ctl(st->st_low, SPEEX_GET_LOW_MODE, ptr);
-      break;
-   case SPEEX_SET_MODE:
-      speex_encoder_ctl(st, SPEEX_SET_QUALITY, ptr);
-      break;
-#ifndef DISABLE_VBR
-   case SPEEX_SET_VBR:
-      st->vbr_enabled = (*(spx_int32_t*)ptr);
-      speex_encoder_ctl(st->st_low, SPEEX_SET_VBR, ptr);
-      break;
-   case SPEEX_GET_VBR:
-      (*(spx_int32_t*)ptr) = st->vbr_enabled;
-      break;
-   case SPEEX_SET_VAD:
-      st->vad_enabled = (*(spx_int32_t*)ptr);
-      speex_encoder_ctl(st->st_low, SPEEX_SET_VAD, ptr);
-      break;
-   case SPEEX_GET_VAD:
-      (*(spx_int32_t*)ptr) = st->vad_enabled;
-      break;
-#endif /* #ifndef DISABLE_VBR */
-#if !defined(DISABLE_VBR) && !defined(DISABLE_FLOAT_API)
-   case SPEEX_SET_VBR_QUALITY:
-      {
-         spx_int32_t q;
-         float qual = (*(float*)ptr)+.6;
-         st->vbr_quality = (*(float*)ptr);
-         if (qual>10)
-            qual=10;
-         q=(int)floor(.5+*(float*)ptr);
-         if (q>10)
-            q=10;
-         speex_encoder_ctl(st->st_low, SPEEX_SET_VBR_QUALITY, &qual);
-         speex_encoder_ctl(state, SPEEX_SET_QUALITY, &q);
-         break;
-      }
-   case SPEEX_GET_VBR_QUALITY:
-      (*(float*)ptr) = st->vbr_quality;
-      break;
-#endif /* #if !defined(DISABLE_VBR) && !defined(DISABLE_FLOAT_API) */
-#ifndef DISABLE_VBR
-   case SPEEX_SET_ABR:
-      st->abr_enabled = (*(spx_int32_t*)ptr);
-      st->vbr_enabled = st->abr_enabled!=0;
-      speex_encoder_ctl(st->st_low, SPEEX_SET_VBR, &st->vbr_enabled);
-      if (st->vbr_enabled) 
-      {
-         spx_int32_t i=10, rate, target;
-         float vbr_qual;
-         target = (*(spx_int32_t*)ptr);
-         while (i>=0)
-         {
-            speex_encoder_ctl(st, SPEEX_SET_QUALITY, &i);
-            speex_encoder_ctl(st, SPEEX_GET_BITRATE, &rate);
-            if (rate <= target)
-               break;
-            i--;
-         }
-         vbr_qual=i;
-         if (vbr_qual<0)
-            vbr_qual=0;
-         speex_encoder_ctl(st, SPEEX_SET_VBR_QUALITY, &vbr_qual);
-         st->abr_count=0;
-         st->abr_drift=0;
-         st->abr_drift2=0;
-      }
-      
-      break;
-   case SPEEX_GET_ABR:
-      (*(spx_int32_t*)ptr) = st->abr_enabled;
-      break;
-#endif /* #ifndef DISABLE_VBR */
-
-   case SPEEX_SET_QUALITY:
-      {
-         spx_int32_t nb_qual;
-         int quality = (*(spx_int32_t*)ptr);
-         if (quality < 0)
-            quality = 0;
-         if (quality > 10)
-            quality = 10;
-         st->submodeSelect = st->submodeID = ((const SpeexSBMode*)(st->mode->mode))->quality_map[quality];
-         nb_qual = ((const SpeexSBMode*)(st->mode->mode))->low_quality_map[quality];
-         speex_encoder_ctl(st->st_low, SPEEX_SET_MODE, &nb_qual);
-      }
-      break;
-   case SPEEX_SET_COMPLEXITY:
-      speex_encoder_ctl(st->st_low, SPEEX_SET_COMPLEXITY, ptr);
-      st->complexity = (*(spx_int32_t*)ptr);
-      if (st->complexity<1)
-         st->complexity=1;
-      break;
-   case SPEEX_GET_COMPLEXITY:
-      (*(spx_int32_t*)ptr) = st->complexity;
-      break;
-   case SPEEX_SET_BITRATE:
-      {
-         spx_int32_t i=10;
-         spx_int32_t rate, target;
-         target = (*(spx_int32_t*)ptr);
-         while (i>=0)
-         {
-            speex_encoder_ctl(st, SPEEX_SET_QUALITY, &i);
-            speex_encoder_ctl(st, SPEEX_GET_BITRATE, &rate);
-            if (rate <= target)
-               break;
-            i--;
-         }
-      }
-      break;
-   case SPEEX_GET_BITRATE:
-      speex_encoder_ctl(st->st_low, request, ptr);
-      /*fprintf (stderr, "before: %d\n", (*(int*)ptr));*/
-      if (st->submodes[st->submodeID])
-         (*(spx_int32_t*)ptr) += st->sampling_rate*SUBMODE(bits_per_frame)/st->full_frame_size;
-      else
-         (*(spx_int32_t*)ptr) += st->sampling_rate*(SB_SUBMODE_BITS+1)/st->full_frame_size;
-      /*fprintf (stderr, "after: %d\n", (*(int*)ptr));*/
-      break;
-   case SPEEX_SET_SAMPLING_RATE:
-      {
-         spx_int32_t tmp=(*(spx_int32_t*)ptr);
-         st->sampling_rate = tmp;
-         tmp>>=1;
-         speex_encoder_ctl(st->st_low, SPEEX_SET_SAMPLING_RATE, &tmp);
-      }
-      break;
-   case SPEEX_GET_SAMPLING_RATE:
-      (*(spx_int32_t*)ptr)=st->sampling_rate;
-      break;
-   case SPEEX_RESET_STATE:
-      {
-         int i;
-         st->first = 1;
-         for (i=0;i<st->lpcSize;i++)
-            st->old_lsp[i]= DIV32(MULT16_16(QCONST16(3.1415927f, LSP_SHIFT), i+1), st->lpcSize+1);
-         for (i=0;i<st->lpcSize;i++)
-            st->mem_sw[i]=st->mem_sp[i]=st->mem_sp2[i]=0;
-         for (i=0;i<QMF_ORDER;i++)
-            st->h0_mem[i]=st->h1_mem[i]=0;
-      }
-      break;
-   case SPEEX_SET_SUBMODE_ENCODING:
-      st->encode_submode = (*(spx_int32_t*)ptr);
-      speex_encoder_ctl(st->st_low, SPEEX_SET_SUBMODE_ENCODING, ptr);
-      break;
-   case SPEEX_GET_SUBMODE_ENCODING:
-      (*(spx_int32_t*)ptr) = st->encode_submode;
-      break;
-   case SPEEX_GET_LOOKAHEAD:
-      speex_encoder_ctl(st->st_low, SPEEX_GET_LOOKAHEAD, ptr);
-      (*(spx_int32_t*)ptr) = 2*(*(spx_int32_t*)ptr) + QMF_ORDER - 1;
-      break;
-   case SPEEX_SET_PLC_TUNING:
-      speex_encoder_ctl(st->st_low, SPEEX_SET_PLC_TUNING, ptr);
-      break;
-   case SPEEX_GET_PLC_TUNING:
-      speex_encoder_ctl(st->st_low, SPEEX_GET_PLC_TUNING, ptr);
-      break;
-#ifndef DISABLE_VBR
-   case SPEEX_SET_VBR_MAX_BITRATE:
-      {
-         st->vbr_max = (*(spx_int32_t*)ptr);
-         if (SPEEX_SET_VBR_MAX_BITRATE<1)
-         {
-            speex_encoder_ctl(st->st_low, SPEEX_SET_VBR_MAX_BITRATE, &st->vbr_max);
-            st->vbr_max_high = 17600;
-         } else {
-            spx_int32_t low_rate;
-            if (st->vbr_max >= 42200)
-            {
-               st->vbr_max_high = 17600;
-            } else if (st->vbr_max >= 27800)
-            {
-               st->vbr_max_high = 9600;
-            } else if (st->vbr_max > 20600)
-            {
-               st->vbr_max_high = 5600;
-            } else {
-               st->vbr_max_high = 1800;
-            }
-            if (st->subframeSize==80)
-               st->vbr_max_high = 1800;
-            low_rate = st->vbr_max - st->vbr_max_high;
-            speex_encoder_ctl(st->st_low, SPEEX_SET_VBR_MAX_BITRATE, &low_rate);
-         }
-      }
-      break;
-   case SPEEX_GET_VBR_MAX_BITRATE:
-      (*(spx_int32_t*)ptr) = st->vbr_max;
-      break;
-#endif /* #ifndef DISABLE_VBR */
-   case SPEEX_SET_HIGHPASS:
-      speex_encoder_ctl(st->st_low, SPEEX_SET_HIGHPASS, ptr);
-      break;
-   case SPEEX_GET_HIGHPASS:
-      speex_encoder_ctl(st->st_low, SPEEX_GET_HIGHPASS, ptr);
-      break;
-
-
-   /* This is all internal stuff past this point */
-   case SPEEX_GET_PI_GAIN:
-      {
-         int i;
-         spx_word32_t *g = (spx_word32_t*)ptr;
-         for (i=0;i<st->nbSubframes;i++)
-            g[i]=st->pi_gain[i];
-      }
-      break;
-   case SPEEX_GET_EXC:
-      {
-         int i;
-         for (i=0;i<st->nbSubframes;i++)
-            ((spx_word16_t*)ptr)[i] = st->exc_rms[i];
-      }
-      break;
-#ifndef DISABLE_VBR
-   case SPEEX_GET_RELATIVE_QUALITY:
-      (*(float*)ptr)=st->relative_quality;
-      break;
-#endif /* #ifndef DISABLE_VBR */
-   case SPEEX_SET_INNOVATION_SAVE:
-      st->innov_rms_save = (spx_word16_t*)ptr;
-      break;
-   case SPEEX_SET_WIDEBAND:
-      speex_encoder_ctl(st->st_low, SPEEX_SET_WIDEBAND, ptr);
-      break;
-   case SPEEX_GET_STACK:
-      *((char**)ptr) = st->stack;
-      break;
-   default:
-      speex_warning_int("Unknown nb_ctl request: ", request);
-      return -1;
-   }
-   return 0;
-}
-
-int sb_decoder_ctl(void *state, int request, void *ptr)
-{
-   SBDecState *st;
-   st=(SBDecState*)state;
-   switch(request)
-   {
-   case SPEEX_SET_HIGH_MODE:
-      st->submodeID = (*(spx_int32_t*)ptr);
-      break;
-   case SPEEX_SET_LOW_MODE:
-      speex_decoder_ctl(st->st_low, SPEEX_SET_LOW_MODE, ptr);
-      break;
-   case SPEEX_GET_LOW_MODE:
-      speex_decoder_ctl(st->st_low, SPEEX_GET_LOW_MODE, ptr);
-      break;
-   case SPEEX_GET_FRAME_SIZE:
-      (*(spx_int32_t*)ptr) = st->full_frame_size;
-      break;
-   case SPEEX_SET_ENH:
-      speex_decoder_ctl(st->st_low, request, ptr);
-      st->lpc_enh_enabled = *((spx_int32_t*)ptr);
-      break;
-   case SPEEX_GET_ENH:
-      *((spx_int32_t*)ptr) = st->lpc_enh_enabled;
-      break;
-   case SPEEX_SET_MODE:
-   case SPEEX_SET_QUALITY:
-      {
-         spx_int32_t nb_qual;
-         int quality = (*(spx_int32_t*)ptr);
-         if (quality < 0)
-            quality = 0;
-         if (quality > 10)
-            quality = 10;
-         st->submodeID = ((const SpeexSBMode*)(st->mode->mode))->quality_map[quality];
-         nb_qual = ((const SpeexSBMode*)(st->mode->mode))->low_quality_map[quality];
-         speex_decoder_ctl(st->st_low, SPEEX_SET_MODE, &nb_qual);
-      }
-      break;
-   case SPEEX_GET_BITRATE:
-      speex_decoder_ctl(st->st_low, request, ptr);
-      if (st->submodes[st->submodeID])
-         (*(spx_int32_t*)ptr) += st->sampling_rate*SUBMODE(bits_per_frame)/st->full_frame_size;
-      else
-         (*(spx_int32_t*)ptr) += st->sampling_rate*(SB_SUBMODE_BITS+1)/st->full_frame_size;
-      break;
-   case SPEEX_SET_SAMPLING_RATE:
-      {
-         spx_int32_t tmp=(*(spx_int32_t*)ptr);
-         st->sampling_rate = tmp;
-         tmp>>=1;
-         speex_decoder_ctl(st->st_low, SPEEX_SET_SAMPLING_RATE, &tmp);
-      }
-      break;
-   case SPEEX_GET_SAMPLING_RATE:
-      (*(spx_int32_t*)ptr)=st->sampling_rate;
-      break;
-   case SPEEX_SET_HANDLER:
-      speex_decoder_ctl(st->st_low, SPEEX_SET_HANDLER, ptr);
-      break;
-   case SPEEX_SET_USER_HANDLER:
-      speex_decoder_ctl(st->st_low, SPEEX_SET_USER_HANDLER, ptr);
-      break;
-   case SPEEX_RESET_STATE:
-      {
-         int i;
-         for (i=0;i<2*st->lpcSize;i++)
-            st->mem_sp[i]=0;
-         for (i=0;i<QMF_ORDER;i++)
-            st->g0_mem[i]=st->g1_mem[i]=0;
-         st->last_ener=0;
-      }
-      break;
-   case SPEEX_SET_SUBMODE_ENCODING:
-      st->encode_submode = (*(spx_int32_t*)ptr);
-      speex_decoder_ctl(st->st_low, SPEEX_SET_SUBMODE_ENCODING, ptr);
-      break;
-   case SPEEX_GET_SUBMODE_ENCODING:
-      (*(spx_int32_t*)ptr) = st->encode_submode;
-      break;
-   case SPEEX_GET_LOOKAHEAD:
-      speex_decoder_ctl(st->st_low, SPEEX_GET_LOOKAHEAD, ptr);
-      (*(spx_int32_t*)ptr) = 2*(*(spx_int32_t*)ptr);
-      break;
-   case SPEEX_SET_HIGHPASS:
-      speex_decoder_ctl(st->st_low, SPEEX_SET_HIGHPASS, ptr);
-      break;
-   case SPEEX_GET_HIGHPASS:
-      speex_decoder_ctl(st->st_low, SPEEX_GET_HIGHPASS, ptr);
-      break;
-   case SPEEX_GET_ACTIVITY:
-      speex_decoder_ctl(st->st_low, SPEEX_GET_ACTIVITY, ptr);
-      break;
-   case SPEEX_GET_PI_GAIN:
-      {
-         int i;
-         spx_word32_t *g = (spx_word32_t*)ptr;
-         for (i=0;i<st->nbSubframes;i++)
-            g[i]=st->pi_gain[i];
-      }
-      break;
-   case SPEEX_GET_EXC:
-      {
-         int i;
-         for (i=0;i<st->nbSubframes;i++)
-            ((spx_word16_t*)ptr)[i] = st->exc_rms[i];
-      }
-      break;
-   case SPEEX_GET_DTX_STATUS:
-      speex_decoder_ctl(st->st_low, SPEEX_GET_DTX_STATUS, ptr);
-      break;
-   case SPEEX_SET_INNOVATION_SAVE:
-      st->innov_save = (spx_word16_t*)ptr;
-      break;
-   case SPEEX_SET_WIDEBAND:
-      speex_decoder_ctl(st->st_low, SPEEX_SET_WIDEBAND, ptr);
-      break;
-   case SPEEX_GET_STACK:
-      *((char**)ptr) = st->stack;
-      break;
-   default:
-      speex_warning_int("Unknown nb_ctl request: ", request);
-      return -1;
-   }
-   return 0;
-}
-
-#endif
-
diff --git a/libspeex/sb_celp.h b/libspeex/sb_celp.h
deleted file mode 100644
index e8c3761..0000000
--- a/libspeex/sb_celp.h
+++ /dev/null
@@ -1,155 +0,0 @@
-/* Copyright (C) 2002-2006 Jean-Marc Valin */
-/**
-   @file sb_celp.h
-   @brief Sub-band CELP mode used for wideband encoding
-*/
-/*
-   Redistribution and use in source and binary forms, with or without
-   modification, 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 the Xiph.org Foundation nor the names of its
-   contributors may be used to endorse or promote products derived from
-   this software without specific prior written permission.
-   
-   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 FOUNDATION OR
-   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-*/
-
-#ifndef SB_CELP_H
-#define SB_CELP_H
-
-#include "modes.h"
-#include <speex/speex_bits.h>
-#include "nb_celp.h"
-
-/**Structure representing the full state of the sub-band encoder*/
-typedef struct SBEncState {
-   const SpeexMode *mode;         /**< Pointer to the mode (containing for vtable info) */
-   void *st_low;                  /**< State of the low-band (narrowband) encoder */
-   int    full_frame_size;        /**< Length of full-band frames*/
-   int    frame_size;             /**< Length of high-band frames*/
-   int    subframeSize;           /**< Length of high-band sub-frames*/
-   int    nbSubframes;            /**< Number of high-band sub-frames*/
-   int    windowSize;             /**< Length of high-band LPC window*/
-   int    lpcSize;                /**< Order of high-band LPC analysis */
-   int    first;                  /**< First frame? */
-   spx_word16_t  lpc_floor;       /**< Controls LPC analysis noise floor */
-   spx_word16_t  gamma1;          /**< Perceptual weighting coef 1 */
-   spx_word1