Introduce built-in fft; drop no-longer-supported ffts

This commit is contained in:
Chris Cannam
2021-04-08 14:23:27 +01:00
parent 109c321370
commit e7f47b4b98
6 changed files with 1034 additions and 1834 deletions

View File

@@ -369,6 +369,9 @@ options (Speex or KissFFT), please be sure to review the terms for
those libraries in `src/speex/COPYING` and `src/kissfft/COPYING` as those libraries in `src/speex/COPYING` and `src/kissfft/COPYING` as
applicable. applicable.
If you are proposing to package Rubber Band for a Linux distribution,
using other packaged libraries, please select FFTW and libsamplerate.
#### FFT libraries supported #### FFT libraries supported
``` ```

View File

@@ -2,7 +2,7 @@
project( project(
'Rubber Band Library', 'Rubber Band Library',
'c', 'cpp', 'c', 'cpp',
version: '1.9.1', version: '1.9.2-pre',
license: 'GPL-2.0-or-later', license: 'GPL-2.0-or-later',
default_options: [ default_options: [
# All Rubber Band code is actually C++98, but some compilers no # All Rubber Band code is actually C++98, but some compilers no
@@ -128,7 +128,7 @@ if fft == 'auto'
if system == 'darwin' if system == 'darwin'
fft = 'vdsp' fft = 'vdsp'
else else
fft = 'kissfft' fft = 'builtin'
endif endif
endif endif
@@ -140,14 +140,23 @@ if resampler == 'auto'
endif endif
endif endif
if fft == 'kissfft' if fft == 'builtin'
config_summary += { 'FFT': 'Built-in' }
message('For FFT: using built-in implementation')
if fftw3_dep.found()
message('(to use FFTW instead, reconfigure with -Dfft=fftw)')
endif
feature_defines += ['-DUSE_BUILTIN_FFT']
elif fft == 'kissfft'
config_summary += { 'FFT': 'KissFFT' } config_summary += { 'FFT': 'KissFFT' }
message('For FFT: using KissFFT') message('For FFT: using KissFFT')
if fftw3_dep.found() if fftw3_dep.found()
message('(to use FFTW instead, reconfigure with -Dfft=fftw)') message('(to use FFTW instead, reconfigure with -Dfft=fftw)')
endif endif
feature_sources += ['src/kissfft/kiss_fft.c', 'src/kissfft/kiss_fftr.c'] feature_sources += ['src/kissfft/kiss_fft.c', 'src/kissfft/kiss_fftr.c']
feature_defines += ['-DUSE_KISSFFT'] feature_defines += ['-DHAVE_KISSFFT']
general_include_dirs += 'src/kissfft'
elif fft == 'fftw' elif fft == 'fftw'
if fftw3_dep.found() if fftw3_dep.found()

View File

@@ -1,9 +1,9 @@
option('fft', option('fft',
type: 'combo', type: 'combo',
choices: ['auto', 'kissfft', 'fftw', 'vdsp', 'ipp'], choices: ['auto', 'builtin', 'kissfft', 'fftw', 'vdsp', 'ipp'],
value: 'auto', value: 'auto',
description: 'FFT library to use. The default (auto) will use vDSP if available, KissFFT otherwise.') description: 'FFT library to use. The default (auto) will use vDSP if available, the builtin implementation otherwise.')
option('resampler', option('resampler',
type: 'combo', type: 'combo',

File diff suppressed because it is too large Load Diff

View File

@@ -64,6 +64,8 @@ public:
FFT(int size, int debugLevel = 0); // may throw InvalidSize FFT(int size, int debugLevel = 0); // may throw InvalidSize
~FFT(); ~FFT();
int getSize() const;
void forward(const double *R__ realIn, double *R__ realOut, double *R__ imagOut); void forward(const double *R__ realIn, double *R__ realOut, double *R__ imagOut);
void forwardInterleaved(const double *R__ realIn, double *R__ complexOut); void forwardInterleaved(const double *R__ realIn, double *R__ complexOut);
void forwardPolar(const double *R__ realIn, double *R__ magOut, double *R__ phaseOut); void forwardPolar(const double *R__ realIn, double *R__ magOut, double *R__ phaseOut);
@@ -121,6 +123,10 @@ protected:
FFTImpl *d; FFTImpl *d;
static std::string m_implementation; static std::string m_implementation;
static void pickDefaultImplementation(); static void pickDefaultImplementation();
private:
FFT(const FFT &); // not provided
FFT &operator=(const FFT &); // not provided
}; };
} }

View File

@@ -366,32 +366,32 @@ inline void v_scale(double *const R__ dst,
} }
#endif #endif
template<typename T> template<typename T, typename S>
inline void v_multiply(T *const R__ dst, inline void v_multiply(T *const R__ srcdst,
const T *const R__ src, const S *const R__ src,
const int count) const int count)
{ {
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
dst[i] *= src[i]; srcdst[i] *= src[i];
} }
} }
#if defined HAVE_IPP #if defined HAVE_IPP
template<> template<>
inline void v_multiply(float *const R__ dst, inline void v_multiply(float *const R__ srcdst,
const float *const R__ src, const float *const R__ src,
const int count) const int count)
{ {
ippsMul_32f_I(src, dst, count); ippsMul_32f_I(src, srcdst, count);
} }
template<> template<>
inline void v_multiply(double *const R__ dst, inline void v_multiply(double *const R__ srcdst,
const double *const R__ src, const double *const R__ src,
const int count) const int count)
{ {
ippsMul_64f_I(src, dst, count); ippsMul_64f_I(src, srcdst, count);
} }
#endif #endif // HAVE_IPP
template<typename T> template<typename T>
inline void v_multiply(T *const R__ dst, inline void v_multiply(T *const R__ dst,