| CODENOTIFIER | HelpYou are not signed inSign in |
Project: Speex
Revision: 14975
Author: jm
Date: 28 May 2008 08:43:15
Changes:Patch by Thorvald Natvig to add Intel MKL support for the FFT
Files:| ... | ...@@ -121,7 +121,28 @@ | |
| 121 | 121 | AC_SUBST([FFTW3_PKGCONFIG], [fftw3f]) |
| 122 | 122 | ]]) |
| 123 | 123 | ) |
| 124 | ||
| 124 | ||
| 125 | 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]) | |
| 126 | AS_IF([test "x$with_intel_mkl" != "xno"],[ | |
| 127 | AC_MSG_CHECKING(for valid MKL) | |
| 128 | AC_LINK_IFELSE([ | |
| 129 | AC_LANG_PROGRAM([[ | |
| 130 | #include <mkl.h> | |
| 131 | void func() { | |
| 132 | DFTI_DESCRIPTOR_HANDLE h; | |
| 133 | MKL_LONG result=DftiCreateDescriptor(&h, DFTI_SINGLE, DFTI_REAL, 0); | |
| 134 | } | |
| 135 | ]])], | |
| 136 | [ | |
| 137 | AC_DEFINE([USE_INTEL_MKL], [], [Use Intel Math Kernel Library for FFT]) | |
| 138 | AC_MSG_RESULT(yes) | |
| 139 | ], | |
| 140 | [ | |
| 141 | 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.]) | |
| 142 | ] | |
| 143 | ) | |
| 144 | ]) | |
| 145 | ||
| 125 | 146 | AC_CHECK_HEADERS(sys/soundcard.h sys/audioio.h) |
| 126 | 147 | |
| 127 | 148 | XIPH_PATH_OGG([src="src"], [src=""]) |
| ... | ...@@ -40,9 +40,11 @@ | |
| 40 | 40 | #define USE_KISS_FFT |
| 41 | 41 | #else |
| 42 | 42 | #ifndef USE_GPL_FFTW3 |
| 43 | #ifndef USE_INTEL_MKL | |
| 43 | 44 | #define USE_SMALLFT |
| 44 | 45 | #endif |
| 45 | 46 | #endif |
| 47 | #endif | |
| 46 | 48 | |
| 47 | 49 | |
| 48 | 50 | #include "arch.h" |
| ... | ...@@ -135,6 +137,45 @@ | |
| 135 | 137 | spx_drft_backward((struct drft_lookup *)table, out); |
| 136 | 138 | } |
| 137 | 139 | |
| 140 | #elif defined(USE_INTEL_MKL) | |
| 141 | #include <mkl.h> | |
| 142 | ||
| 143 | struct mkl_config { | |
| 144 | DFTI_DESCRIPTOR_HANDLE desc; | |
| 145 | int N; | |
| 146 | }; | |
| 147 | ||
| 148 | void *spx_fft_init(int size) | |
| 149 | { | |
| 150 | struct mkl_config *table = (struct mkl_config *) speex_alloc(sizeof(struct mkl_config)); | |
| 151 | table->N = size; | |
| 152 | DftiCreateDescriptor(&table->desc, DFTI_SINGLE, DFTI_REAL, 1, size); | |
| 153 | DftiSetValue(table->desc, DFTI_PACKED_FORMAT, DFTI_PACK_FORMAT); | |
| 154 | DftiSetValue(table->desc, DFTI_PLACEMENT, DFTI_NOT_INPLACE); | |
| 155 | DftiSetValue(table->desc, DFTI_FORWARD_SCALE, 1.0f / size); | |
| 156 | DftiCommitDescriptor(table->desc); | |
| 157 | return table; | |
| 158 | } | |
| 159 | ||
| 160 | void spx_fft_destroy(void *table) | |
| 161 | { | |
| 162 | struct mkl_config *t = (struct mkl_config *) table; | |
| 163 | DftiFreeDescriptor(t->desc); | |
| 164 | speex_free(table); | |
| 165 | } | |
| 166 | ||
| 167 | void spx_fft(void *table, spx_word16_t *in, spx_word16_t *out) | |
| 168 | { | |
| 169 | struct mkl_config *t = (struct mkl_config *) table; | |
| 170 | DftiComputeForward(t->desc, in, out); | |
| 171 | } | |
| 172 | ||
| 173 | void spx_ifft(void *table, spx_word16_t *in, spx_word16_t *out) | |
| 174 | { | |
| 175 | struct mkl_config *t = (struct mkl_config *) table; | |
| 176 | DftiComputeBackward(t->desc, in, out); | |
| 177 | } | |
| 178 | ||
| 138 | 179 | #elif defined(USE_GPL_FFTW3) |
| 139 | 180 | |
| 140 | 181 | #include <fftw3.h> |