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
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
```

View File

@@ -2,7 +2,7 @@
project(
'Rubber Band Library',
'c', 'cpp',
version: '1.9.1',
version: '1.9.2-pre',
license: 'GPL-2.0-or-later',
default_options: [
# All Rubber Band code is actually C++98, but some compilers no
@@ -128,7 +128,7 @@ if fft == 'auto'
if system == 'darwin'
fft = 'vdsp'
else
fft = 'kissfft'
fft = 'builtin'
endif
endif
@@ -140,14 +140,23 @@ if resampler == 'auto'
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' }
message('For FFT: using KissFFT')
if fftw3_dep.found()
message('(to use FFTW instead, reconfigure with -Dfft=fftw)')
endif
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'
if fftw3_dep.found()

View File

@@ -1,9 +1,9 @@
option('fft',
type: 'combo',
choices: ['auto', 'kissfft', 'fftw', 'vdsp', 'ipp'],
choices: ['auto', 'builtin', 'kissfft', 'fftw', 'vdsp', 'ipp'],
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',
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 getSize() const;
void forward(const double *R__ realIn, double *R__ realOut, double *R__ imagOut);
void forwardInterleaved(const double *R__ realIn, double *R__ complexOut);
void forwardPolar(const double *R__ realIn, double *R__ magOut, double *R__ phaseOut);
@@ -121,6 +123,10 @@ protected:
FFTImpl *d;
static std::string m_implementation;
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
template<typename T>
inline void v_multiply(T *const R__ dst,
const T *const R__ src,
template<typename T, typename S>
inline void v_multiply(T *const R__ srcdst,
const S *const R__ src,
const int count)
{
for (int i = 0; i < count; ++i) {
dst[i] *= src[i];
srcdst[i] *= src[i];
}
}
#if defined HAVE_IPP
template<>
inline void v_multiply(float *const R__ dst,
inline void v_multiply(float *const R__ srcdst,
const float *const R__ src,
const int count)
{
ippsMul_32f_I(src, dst, count);
ippsMul_32f_I(src, srcdst, count);
}
template<>
inline void v_multiply(double *const R__ dst,
inline void v_multiply(double *const R__ srcdst,
const double *const R__ src,
const int count)
{
ippsMul_64f_I(src, dst, count);
ippsMul_64f_I(src, srcdst, count);
}
#endif
#endif // HAVE_IPP
template<typename T>
inline void v_multiply(T *const R__ dst,