diff options
41 files changed, 96 insertions, 135 deletions
diff --git a/libspeex/Makefile.am b/libspeex/Makefile.am index 67cdb28..26297a1 100644 --- a/libspeex/Makefile.am +++ b/libspeex/Makefile.am @@ -23,7 +23,7 @@ libspeexdsp_la_SOURCES = preprocess.c smallft.c lbr_48k_tables.c \ noinst_HEADERS = arch.h cb_search_arm4.h cb_search_bfin.h cb_search_sse.h \ filters.h filters_arm4.h filters_bfin.h filters_sse.h fixed_arm4.h \ fixed_arm5e.h fixed_bfin.h fixed_debug.h lpc.h lpc_bfin.h ltp.h ltp_arm4.h \ - ltp_sse.h math_approx.h misc.h misc_bfin.h nb_celp.h quant_lsp.h sb_celp.h \ + ltp_sse.h math_approx.h misc_bfin.h nb_celp.h quant_lsp.h sb_celp.h \ stack_alloc.h vbr.h vq.h vq_arm4.h vq_bfin.h vq_sse.h cb_search.h fftwrap.h \ filterbank.h fixed_generic.h lsp.h lsp_bfin.h ltp_bfin.h modes.h os_support.h \ pseudofloat.h quant_lsp_bfin.h smallft.h vorbis_psy.h diff --git a/libspeex/_kiss_fft_guts.h b/libspeex/_kiss_fft_guts.h index 526a73b..6571e79 100644 --- a/libspeex/_kiss_fft_guts.h +++ b/libspeex/_kiss_fft_guts.h @@ -45,7 +45,7 @@ struct kiss_fft_state{ C_ADDTO( res , a) : res += a * */ #ifdef FIXED_POINT -#include "misc.h" +#include "arch.h" # define FRACBITS 15 # define SAMPPROD spx_int32_t #define SAMP_MAX 32767 diff --git a/libspeex/arch.h b/libspeex/arch.h index 1e48e93..219c90e 100644 --- a/libspeex/arch.h +++ b/libspeex/arch.h @@ -35,6 +35,39 @@ #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 _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 + +#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 @@ -192,4 +225,11 @@ typedef float spx_word32_t; #endif + + +#ifdef FIXED_DEBUG +long long spx_mips=0; +#endif + + #endif diff --git a/libspeex/bits.c b/libspeex/bits.c index 09432a3..311e812 100644 --- a/libspeex/bits.c +++ b/libspeex/bits.c @@ -37,7 +37,7 @@ #endif #include <speex/speex_bits.h> -#include "misc.h" +#include "arch.h" #include "os_support.h" /* Maximum size of the bit-stream (for fixed-size allocation) */ diff --git a/libspeex/buffer.c b/libspeex/buffer.c index 83de9a2..2f94430 100644 --- a/libspeex/buffer.c +++ b/libspeex/buffer.c @@ -37,7 +37,7 @@ #include "os_support.h" -#include "misc.h" +#include "arch.h" #include <speex/speex_buffer.h> struct SpeexBuffer_ { diff --git a/libspeex/cb_search.c b/libspeex/cb_search.c index 4c0a035..0d9f295 100644 --- a/libspeex/cb_search.c +++ b/libspeex/cb_search.c @@ -37,7 +37,7 @@ #include "filters.h" #include "stack_alloc.h" #include "vq.h" -#include "misc.h" +#include "arch.h" #include "math_approx.h" #include "os_support.h" diff --git a/libspeex/cb_search.h b/libspeex/cb_search.h index fd5c110..7687b45 100644 --- a/libspeex/cb_search.h +++ b/libspeex/cb_search.h @@ -36,7 +36,7 @@ #define CB_SEARCH_H #include <speex/speex_bits.h> -#include "misc.h" +#include "arch.h" /** Split codebook parameters. */ typedef struct split_cb_params { diff --git a/libspeex/fftwrap.c b/libspeex/fftwrap.c index f9f33b2..0b462c2 100644 --- a/libspeex/fftwrap.c +++ b/libspeex/fftwrap.c @@ -40,7 +40,7 @@ #define USE_KISS_FFT -#include "misc.h" +#include "arch.h" #include "os_support.h" #define MAX_FFT_SIZE 2048 diff --git a/libspeex/fftwrap.h b/libspeex/fftwrap.h index 826b38e..dfaf489 100644 --- a/libspeex/fftwrap.h +++ b/libspeex/fftwrap.h @@ -35,7 +35,7 @@ #ifndef FFTWRAP_H #define FFTWRAP_H -#include "misc.h" +#include "arch.h" /** Compute tables for an FFT */ void *spx_fft_init(int size); diff --git a/libspeex/filterbank.c b/libspeex/filterbank.c index a79050d..e2fb71d 100644 --- a/libspeex/filterbank.c +++ b/libspeex/filterbank.c @@ -36,7 +36,7 @@ #endif #include "filterbank.h" -#include "misc.h" +#include "arch.h" #include <math.h> #include "math_approx.h" #include "os_support.h" diff --git a/libspeex/filterbank.h b/libspeex/filterbank.h index 5ded6b9..3e889a2 100644 --- a/libspeex/filterbank.h +++ b/libspeex/filterbank.h @@ -34,7 +34,7 @@ #ifndef FILTERBANK_H #define FILTERBANK_H -#include "misc.h" +#include "arch.h" typedef struct { int *bank_left; diff --git a/libspeex/filters.c b/libspeex/filters.c index d501130..36ef4f6 100644 --- a/libspeex/filters.c +++ b/libspeex/filters.c @@ -36,7 +36,7 @@ #include "filters.h" #include "stack_alloc.h" -#include "misc.h" +#include "arch.h" #include "math_approx.h" #include "ltp.h" #include <math.h> diff --git a/libspeex/filters.h b/libspeex/filters.h index b08e94d..e3a5980 100644 --- a/libspeex/filters.h +++ b/libspeex/filters.h @@ -35,7 +35,7 @@ #ifndef FILTERS_H #define FILTERS_H -#include "misc.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); diff --git a/libspeex/jitter.c b/libspeex/jitter.c index dc6a491..f66d801 100644 --- a/libspeex/jitter.c +++ b/libspeex/jitter.c @@ -52,7 +52,7 @@ TODO: #endif -#include "misc.h" +#include "arch.h" #include <speex/speex.h> #include <speex/speex_bits.h> #include <speex/speex_jitter.h> diff --git a/libspeex/kiss_fft.c b/libspeex/kiss_fft.c index 3c6bf89..62904cd 100644 --- a/libspeex/kiss_fft.c +++ b/libspeex/kiss_fft.c @@ -19,7 +19,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND #endif #include "_kiss_fft_guts.h" -#include "misc.h" +#include "arch.h" #include "os_support.h" /* The guts header contains all the multiplication and addition macros that are defined for diff --git a/libspeex/kiss_fft.h b/libspeex/kiss_fft.h index 54627e7..fa3f2c6 100644 --- a/libspeex/kiss_fft.h +++ b/libspeex/kiss_fft.h @@ -3,7 +3,7 @@ #include <stdlib.h> #include <math.h> -#include "misc.h" +#include "arch.h" #ifdef __cplusplus extern "C" { @@ -32,7 +32,7 @@ extern "C" { #ifdef FIXED_POINT -#include "misc.h" +#include "arch.h" # define kiss_fft_scalar spx_int16_t #else # ifndef kiss_fft_scalar diff --git a/libspeex/lpc.h b/libspeex/lpc.h index d64df96..952ecdd 100644 --- a/libspeex/lpc.h +++ b/libspeex/lpc.h @@ -35,7 +35,7 @@ #ifndef LPC_H #define LPC_H -#include "misc.h" +#include "arch.h" void _spx_autocorr( const spx_word16_t * x, /* in: [0...n-1] samples x */ diff --git a/libspeex/lsp.h b/libspeex/lsp.h index 9d0345f..648652f 100644 --- a/libspeex/lsp.h +++ b/libspeex/lsp.h @@ -51,7 +51,7 @@ Modified by Jean-Marc Valin #ifndef __AK2LSPD__
#define __AK2LSPD__
-#include "misc.h"
+#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);
diff --git a/libspeex/ltp.h b/libspeex/ltp.h index bc050c6..1e435bc 100644 --- a/libspeex/ltp.h +++ b/libspeex/ltp.h @@ -33,7 +33,7 @@ */ #include <speex/speex_bits.h> -#include "misc.h" +#include "arch.h" /** LTP parameters. */ typedef struct { diff --git a/libspeex/math_approx.h b/libspeex/math_approx.h index 4f61e86..9ca8307 100644 --- a/libspeex/math_approx.h +++ b/libspeex/math_approx.h @@ -35,7 +35,7 @@ #ifndef MATH_APPROX_H #define MATH_APPROX_H -#include "misc.h" +#include "arch.h" #ifndef FIXED_POINT diff --git a/libspeex/mdf.c b/libspeex/mdf.c index ccf6860..1b63c0e 100644 --- a/libspeex/mdf.c +++ b/libspeex/mdf.c @@ -69,7 +69,7 @@ #include "config.h" #endif -#include "misc.h" +#include "arch.h" #include "speex/speex_echo.h" #include "fftwrap.h" #include "pseudofloat.h" diff --git a/libspeex/medfilter.c b/libspeex/medfilter.c index a9c0f8e..c061ea3 100644 --- a/libspeex/medfilter.c +++ b/libspeex/medfilter.c @@ -37,7 +37,7 @@ #endif #include "medfilter.h" -#include "misc.h" +#include "arch.h" MedianFilter *median_filter_new(int N) { diff --git a/libspeex/misc.h b/libspeex/misc.h deleted file mode 100644 index 30b3146..0000000 --- a/libspeex/misc.h +++ /dev/null @@ -1,95 +0,0 @@ -/* Copyright (C) 2002 Jean-Marc Valin */ -/** - @file misc.h - @brief Various compatibility routines 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 MISC_H -#define MISC_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 _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 - -#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 - -#include "arch.h" - -/** Convert little endian */ -static inline spx_int32_t le_int(spx_int32_t i) -{ -#if !defined(__LITTLE_ENDIAN__) && ( defined(WORDS_BIGENDIAN) || defined(__BIG_ENDIAN__) ) - spx_uint32_t ui, ret; - ui = i; - ret = ui>>24; - ret |= (ui>>8)&0x0000ff00; - ret |= (ui<<8)&0x00ff0000; - ret |= (ui<<24); - return ret; -#else - return i; -#endif -} - - -#ifdef FIXED_DEBUG -long long spx_mips=0; -#endif - - -#endif diff --git a/libspeex/modes.c b/libspeex/modes.c index 01f00e1..4edb539 100644 --- a/libspeex/modes.c +++ b/libspeex/modes.c @@ -43,7 +43,7 @@ #include "sb_celp.h" #include "nb_celp.h" #include "vbr.h" -#include "misc.h" +#include "arch.h" #include <math.h> #ifndef NULL diff --git a/libspeex/modes.h b/libspeex/modes.h index 730c80f..1865ff9 100644 --- a/libspeex/modes.h +++ b/libspeex/modes.h @@ -38,7 +38,7 @@ #include <speex/speex.h> #include <speex/speex_bits.h> -#include "misc.h" +#include "arch.h" #define NB_SUBMODES 16 #define NB_SUBMODE_BITS 4 diff --git a/libspeex/modes_wb.c b/libspeex/modes_wb.c index bcde5ad..2f71f08 100644 --- a/libspeex/modes_wb.c +++ b/libspeex/modes_wb.c @@ -43,7 +43,7 @@ #include "sb_celp.h" #include "nb_celp.h" #include "vbr.h" -#include "misc.h" +#include "arch.h" #include <math.h> #include "os_support.h" diff --git a/libspeex/nb_celp.c b/libspeex/nb_celp.c index 46c0027..c7504fb 100644 --- a/libspeex/nb_celp.c +++ b/libspeex/nb_celp.c @@ -45,7 +45,7 @@ #include "vq.h" #include <speex/speex_bits.h> #include "vbr.h" -#include "misc.h" +#include "arch.h" #include "math_approx.h" #include "os_support.h" #include <speex/speex_callbacks.h> diff --git a/libspeex/preprocess.c b/libspeex/preprocess.c index b007fa8..75a20be 100644 --- a/libspeex/preprocess.c +++ b/libspeex/preprocess.c @@ -62,7 +62,7 @@ #include <math.h> #include "speex/speex_preprocess.h" #include "speex/speex_echo.h" -#include "misc.h" +#include "arch.h" #include "fftwrap.h" #include "filterbank.h" #include "math_approx.h" diff --git a/libspeex/pseudofloat.h b/libspeex/pseudofloat.h index d11bb3f..fa841a0 100644 --- a/libspeex/pseudofloat.h +++ b/libspeex/pseudofloat.h @@ -44,7 +44,7 @@ #ifndef PSEUDOFLOAT_H #define PSEUDOFLOAT_H -#include "misc.h" +#include "arch.h" #include "os_support.h" #include "math_approx.h" #include <math.h> diff --git a/libspeex/quant_lsp.c b/libspeex/quant_lsp.c index f6cf462..695f078 100644 --- a/libspeex/quant_lsp.c +++ b/libspeex/quant_lsp.c @@ -41,7 +41,7 @@ #define M_PI 3.14159265358979323846 #endif -#include "misc.h" +#include "arch.h" #ifdef BFIN_ASM #include "quant_lsp_bfin.h" diff --git a/libspeex/quant_lsp.h b/libspeex/quant_lsp.h index c6d5bb3..7bdf53c 100644 --- a/libspeex/quant_lsp.h +++ b/libspeex/quant_lsp.h @@ -36,7 +36,7 @@ #define QUANT_LSP_H #include <speex/speex_bits.h> -#include "misc.h" +#include "arch.h" #define MAX_LSP_SIZE 20 diff --git a/libspeex/resample.c b/libspeex/resample.c index 0a0120b..6ca7f2e 100644 --- a/libspeex/resample.c +++ b/libspeex/resample.c @@ -70,7 +70,7 @@ static void speex_free (void *ptr) {free(ptr);} #else /* OUTSIDE_SPEEX */ #include "speex/speex_resampler.h" -#include "misc.h" +#include "arch.h" #include "os_support.h" #endif /* OUTSIDE_SPEEX */ diff --git a/libspeex/sb_celp.c b/libspeex/sb_celp.c index f04e5b4..a328ec4 100644 --- a/libspeex/sb_celp.c +++ b/libspeex/sb_celp.c @@ -43,7 +43,7 @@ #include "quant_lsp.h" #include "vq.h" #include "ltp.h" -#include "misc.h" +#include "arch.h" #include "math_approx.h" #include "os_support.h" diff --git a/libspeex/smallft.c b/libspeex/smallft.c index 369432d..5c26d01 100644 --- a/libspeex/smallft.c +++ b/libspeex/smallft.c @@ -34,7 +34,7 @@ #include <math.h> #include "smallft.h" -#include "misc.h" +#include "arch.h" #include "os_support.h" static void drfti1(int n, float *wa, int *ifac){ diff --git a/libspeex/speex_callbacks.c b/libspeex/speex_callbacks.c index 9b69dc5..b884775 100644 --- a/libspeex/speex_callbacks.c +++ b/libspeex/speex_callbacks.c @@ -37,7 +37,7 @@ #endif #include <speex/speex_callbacks.h> -#include "misc.h" +#include "arch.h" #include "os_support.h" int speex_inband_handler(SpeexBits *bits, SpeexCallback *callback_list, void *state) diff --git a/libspeex/speex_header.c b/libspeex/speex_header.c index 38dba4a..2efb3e3 100644 --- a/libspeex/speex_header.c +++ b/libspeex/speex_header.c @@ -35,7 +35,7 @@ #include "config.h" #endif -#include "misc.h" +#include "arch.h" #include <speex/speex_header.h> #include <speex/speex.h> #include "os_support.h" @@ -44,6 +44,22 @@ #define NULL 0 #endif +/** Convert little endian */ +static inline spx_int32_t le_int(spx_int32_t i) +{ +#if !defined(__LITTLE_ENDIAN__) && ( defined(WORDS_BIGENDIAN) || defined(__BIG_ENDIAN__) ) + spx_uint32_t ui, ret; + ui = i; + ret = ui>>24; + ret |= (ui>>8)&0x0000ff00; + ret |= (ui<<8)&0x00ff0000; + ret |= (ui<<24); + return ret; +#else + return i; +#endif +} + #define ENDIAN_SWITCH(x) {x=le_int(x);} diff --git a/libspeex/vbr.h b/libspeex/vbr.h index 34e1d4c..ff1e3e4 100644 --- a/libspeex/vbr.h +++ b/libspeex/vbr.h @@ -37,7 +37,7 @@ #ifndef VBR_H #define VBR_H -#include "misc.h" +#include "arch.h" #define VBR_MEMORY_SIZE 5 diff --git a/libspeex/vorbis_psy.c b/libspeex/vorbis_psy.c index 6aac56f..ec32c6e 100644 --- a/libspeex/vorbis_psy.c +++ b/libspeex/vorbis_psy.c @@ -35,7 +35,7 @@ #ifdef VORBIS_PSYCHO -#include "misc.h" +#include "arch.h" #include "smallft.h" #include "lpc.h" #include "vorbis_psy.h" diff --git a/libspeex/vq.c b/libspeex/vq.c index d40133f..aa9ca33 100644 --- a/libspeex/vq.c +++ b/libspeex/vq.c @@ -36,7 +36,7 @@ #include "vq.h" #include "stack_alloc.h" -#include "misc.h" +#include "arch.h" #ifdef _USE_SSE #include <xmmintrin.h> diff --git a/libspeex/vq.h b/libspeex/vq.h index 7ca8197..478d869 100644 --- a/libspeex/vq.h +++ b/libspeex/vq.h @@ -35,7 +35,7 @@ #ifndef VQ_H #define VQ_H -#include "misc.h" +#include "arch.h" int scal_quant(spx_word16_t in, const spx_word16_t *boundary, int entries); int scal_quant32(spx_word32_t in, const spx_word32_t *boundary, int entries); diff --git a/libspeex/window.c b/libspeex/window.c index 65b1917..35dac3b 100644 --- a/libspeex/window.c +++ b/libspeex/window.c @@ -33,7 +33,7 @@ #include "config.h" #endif -#include "misc.h" +#include "arch.h" #ifdef FIXED_POINT const spx_word16_t lpc_window[200] = { |