Index: configure.ac =================================================================== --- configure.ac (revision 14967) +++ configure.ac (working copy) @@ -121,7 +121,28 @@ 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=""]) Index: libspeex/fftwrap.c =================================================================== --- libspeex/fftwrap.c (revision 14967) +++ libspeex/fftwrap.c (working copy) @@ -40,9 +40,11 @@ #define USE_KISS_FFT #else #ifndef USE_GPL_FFTW3 +#ifndef USE_INTEL_MKL #define USE_SMALLFT #endif #endif +#endif #include "arch.h" @@ -135,6 +137,45 @@ spx_drft_backward((struct drft_lookup *)table, out); } +#elif defined(USE_INTEL_MKL) +#include + +struct mkl_config { + DFTI_DESCRIPTOR_HANDLE desc; + int N; +}; + +void *spx_fft_init(int size) +{ + struct mkl_config *table = (struct mkl_config *) speex_alloc(sizeof(struct mkl_config)); + table->N = size; + DftiCreateDescriptor(&table->desc, DFTI_SINGLE, DFTI_REAL, 1, size); + DftiSetValue(table->desc, DFTI_PACKED_FORMAT, DFTI_PACK_FORMAT); + DftiSetValue(table->desc, DFTI_PLACEMENT, DFTI_NOT_INPLACE); + DftiSetValue(table->desc, DFTI_FORWARD_SCALE, 1.0f / size); + DftiCommitDescriptor(table->desc); + return table; +} + +void spx_fft_destroy(void *table) +{ + struct mkl_config *t = (struct mkl_config *) table; + DftiFreeDescriptor(t->desc); + speex_free(table); +} + +void spx_fft(void *table, spx_word16_t *in, spx_word16_t *out) +{ + struct mkl_config *t = (struct mkl_config *) table; + DftiComputeForward(t->desc, in, out); +} + +void spx_ifft(void *table, spx_word16_t *in, spx_word16_t *out) +{ + struct mkl_config *t = (struct mkl_config *) table; + DftiComputeBackward(t->desc, in, out); +} + #elif defined(USE_GPL_FFTW3) #include