Index: src/Makefile.am =================================================================== --- src/Makefile.am (revision 14975) +++ src/Makefile.am (working copy) @@ -18,8 +18,8 @@ speexenc_SOURCES = speexenc.c wav_io.c skeleton.c speexenc_LDADD = $(top_builddir)/libspeex/libspeex.la $(top_builddir)/libspeex/libspeexdsp.la \ - $(OGG_LIBS) @FFTW3_LIBS@ + $(OGG_LIBS) @FFT_LIBS@ speexdec_SOURCES = speexdec.c wav_io.c speexdec_LDADD = $(top_builddir)/libspeex/libspeex.la \ - $(OGG_LIBS) @FFTW3_LIBS@ + $(OGG_LIBS) @FFT_LIBS@ Index: speexdsp.pc.in =================================================================== --- speexdsp.pc.in (revision 14975) +++ speexdsp.pc.in (working copy) @@ -8,7 +8,7 @@ Name: speexdsp Description: Speexdsp is a speech processing library that goes along with the Speex codec Version: @SPEEX_VERSION@ -Requires: @FFTW3_PKGCONFIG@ +Requires: @FFT_PKGCONFIG@ Conflicts: Libs: -L${libdir} -lspeexdsp Libs.private: -lm Index: configure.ac =================================================================== --- configure.ac (revision 14975) +++ configure.ac (working copy) @@ -110,39 +110,6 @@ ) AC_MSG_RESULT($has_visibility) -AC_ARG_WITH([gpl-fftw3], [AS_HELP_STRING([--with-gpl-fftw3@<:@=PATH@:>@],[enable experimental support for FFTW3 library for FFT. @<:@default=no@:>@])],[],[with_gpl_fftw3=no]) - -AS_IF([test "x$with_gpl_fftw3" != "xno"], - [if test "x$with_gpl_fftw3" != "xyes"; then - export PKG_CONFIG_PATH=$with_gpl_fftw3:$with_gpl_fftw3/lib/pkgconfig:$PKG_CONFIG_PATH - fi - PKG_CHECK_MODULES(FFTW3, fftw3f, [ - AC_DEFINE([USE_GPL_FFTW3], [], [Use FFTW3 for FFT]) - AC_SUBST([FFTW3_PKGCONFIG], [fftw3f]) - ]]) -) - -AC_ARG_WITH([intel-mkl], [AS_HELP_STRING([--with-intel-mkl],[enable experimental support for Intel Math Kernel Library for FFT])],[],[with_intel_mkl=no]) -AS_IF([test "x$with_intel_mkl" != "xno"],[ - AC_MSG_CHECKING(for valid MKL) - AC_LINK_IFELSE([ - AC_LANG_PROGRAM([[ -#include -void func() { - DFTI_DESCRIPTOR_HANDLE h; - MKL_LONG result=DftiCreateDescriptor(&h, DFTI_SINGLE, DFTI_REAL, 0); -} - ]])], - [ - AC_DEFINE([USE_INTEL_MKL], [], [Use Intel Math Kernel Library for FFT]) - AC_MSG_RESULT(yes) - ], - [ - AC_MSG_FAILURE([Failed to compile MKL test program. Make sure you set CFLAGS to include the include directory and set LDFLAGS to include the library directory and all necesarry libraries.]) - ] - ) -]) - AC_CHECK_HEADERS(sys/soundcard.h sys/audioio.h) XIPH_PATH_OGG([src="src"], [src=""]) @@ -181,18 +148,23 @@ fi ]) -if test "$has_sse" = yes; then - AC_DEFINE([_USE_SSE], , [Enable SSE support]) -fi +FFT=smallft + AC_ARG_ENABLE(fixed-point, [ --enable-fixed-point Compile as fixed-point], [if test "$enableval" = yes; then + FFT=kiss + has_sse=no AC_DEFINE([FIXED_POINT], , [Compile as fixed-point]) else AC_DEFINE([FLOATING_POINT], , [Compile as floating-point]) fi], AC_DEFINE([FLOATING_POINT], , [Compile as floating-point])) +if test "$has_sse" = yes; then + AC_DEFINE([_USE_SSE], , [Enable SSE support]) +fi + AC_ARG_ENABLE(float-api, [ --disable-float-api Disable the floating-point API], [if test "$enableval" = no; then AC_DEFINE([DISABLE_FLOAT_API], , [Disable all parts of the API that are using floats]) @@ -230,6 +202,44 @@ AC_DEFINE([TI_C55X], , [Enable support for TI C55X DSP]) fi]) +AC_ARG_WITH([fft], [AS_HELP_STRING([--with-fft=choice],[use an alternate FFT implementation. The available choices are +kiss (default fixed point), smallft (default floating point), gpl-fftw3 and proprietary-intel-mkl])], +[FFT=$withval] +) + +FFT_PKGCONFIG= +AS_CASE([$FFT], + [kiss], [ + AC_DEFINE([USE_KISS_FFT], [], [Use KISS Fast Fourier Transform]) + ], + [smallft], [ + AC_DEFINE([USE_SMALLFT], [], [Use FFT from OggVorbis]) + ], + [gpl-fftw3], [ + AC_DEFINE([USE_GPL_FFTW3], [], [Use FFTW3 for FFT]) + PKG_CHECK_MODULES(FFT, fftw3f) + ], + [proprietary-intel-mkl], [ + AC_DEFINE([USE_INTEL_MKL], [], [Use Intel Math Kernel Library for FFT]) + AC_MSG_CHECKING(for valid MKL) + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([[ +#include +void func() { + DFTI_DESCRIPTOR_HANDLE h; + MKL_LONG result=DftiCreateDescriptor(&h, DFTI_SINGLE, DFTI_REAL, 0); +}]])], + [AC_MSG_RESULT(yes)], + [AC_MSG_FAILURE([Failed to compile MKL test program. Make sure you set CFLAGS to include the include directory and set LDFLAGS to include the library directory and all necesarry libraries.])] + ) + ], + [AC_MSG_FAILURE([Unknown FFT $FFT specified for --with-fft])] +) +AM_CONDITIONAL(BUILD_KISS_FFT, [test "$FFT" = "kiss"]) +AM_CONDITIONAL(BUILD_SMALLFT, [test "$FFT" = "smallft"]) +AC_SUBST(FFT_PKGCONFIG) + + AC_CHECK_SIZEOF(short) AC_CHECK_SIZEOF(int) AC_CHECK_SIZEOF(long) Index: win32/config.h =================================================================== --- win32/config.h (revision 14975) +++ win32/config.h (working copy) @@ -11,6 +11,9 @@ /* Default to floating point */ #ifndef FIXED_POINT # define FLOATING_POINT +# define USE_SMALLFT +#else +# define USE_KISS_FFT #endif /* We don't support visibility on Win32 */ Index: libspeex/fftwrap.c =================================================================== --- libspeex/fftwrap.c (revision 14975) +++ libspeex/fftwrap.c (working copy) @@ -36,17 +36,6 @@ #include "config.h" #endif -#ifdef FIXED_POINT -#define USE_KISS_FFT -#else -#ifndef USE_GPL_FFTW3 -#ifndef USE_INTEL_MKL -#define USE_SMALLFT -#endif -#endif -#endif - - #include "arch.h" #include "os_support.h" Index: libspeex/preprocess.c =================================================================== --- libspeex/preprocess.c (revision 14975) +++ libspeex/preprocess.c (working copy) @@ -1194,7 +1194,7 @@ case SPEEX_PREPROCESS_GET_PROB: (*(spx_int32_t*)ptr) = MULT16_16_Q15(st->speech_prob, 100); break; -#ifndef DISABLE_FLOAT_API +#ifndef FIXED_POINT case SPEEX_PREPROCESS_SET_AGC_TARGET: st->agc_level = (*(spx_int32_t*)ptr); if (st->agc_level<1) @@ -1205,7 +1205,7 @@ case SPEEX_PREPROCESS_GET_AGC_TARGET: (*(spx_int32_t*)ptr) = st->agc_level; break; -#endif /* #ifndef DISABLE_FLOAT_API */ +#endif default: speex_warning_int("Unknown speex_preprocess_ctl request: ", request); return -1; Index: libspeex/Makefile.am =================================================================== --- libspeex/Makefile.am (revision 14975) +++ libspeex/Makefile.am (working copy) @@ -4,7 +4,7 @@ EXTRA_DIST=echo_diagnostic.m -INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include -I$(top_builddir) @OGG_CFLAGS@ @FFTW3_CFLAGS@ +INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include -I$(top_builddir) @OGG_CFLAGS@ @FFT_CFLAGS@ lib_LTLIBRARIES = libspeex.la libspeexdsp.la @@ -16,17 +16,25 @@ lpc.c lsp_tables_nb.c modes.c modes_wb.c nb_celp.c quant_lsp.c sb_celp.c \ speex_callbacks.c speex_header.c window.c -libspeexdsp_la_SOURCES = preprocess.c smallft.c \ - jitter.c mdf.c fftwrap.c kiss_fft.c _kiss_fft_guts.h kiss_fft.h \ - kiss_fftr.c kiss_fftr.h filterbank.c resample.c buffer.c +if BUILD_KISS_FFT + FFTSRC=kiss_fft.c _kiss_fft_guts.h kiss_fft.h kiss_fftr.c kiss_fftr.h +else +if BUILD_SMALLFT + FFTSRC=smallft.c +else + FFTSRC= +endif +endif +libspeexdsp_la_SOURCES = preprocess.c jitter.c mdf.c fftwrap.c filterbank.c resample.c buffer.c $(FFTSRC) + 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_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 + pseudofloat.h quant_lsp_bfin.h smallft.h vorbis_psy.h resample_sse.h libspeex_la_LDFLAGS = -no-undefined -version-info @SPEEX_LT_CURRENT@:@SPEEX_LT_REVISION@:@SPEEX_LT_AGE@ @@ -40,8 +48,8 @@ testenc_uwb_SOURCES = testenc_uwb.c testenc_uwb_LDADD = libspeex.la testdenoise_SOURCES = testdenoise.c -testdenoise_LDADD = libspeexdsp.la @FFTW3_LIBS@ +testdenoise_LDADD = libspeexdsp.la @FFT_LIBS@ testecho_SOURCES = testecho.c -testecho_LDADD = libspeexdsp.la @FFTW3_LIBS@ +testecho_LDADD = libspeexdsp.la @FFT_LIBS@ testjitter_SOURCES = testjitter.c -testjitter_LDADD = libspeexdsp.la @FFTW3_LIBS@ +testjitter_LDADD = libspeexdsp.la @FFT_LIBS@