2#include <ossia/detail/config.hpp>
4#include <ossia/detail/pod_vector.hpp>
9#if defined(OSSIA_FFT_FFTW)
10#if defined(OSSIA_FFTW_SINGLE_ONLY)
11using fftw_plan =
struct fftw_plan_s*;
12using fftwf_plan =
struct fftwf_plan_s*;
15using fft_plan = fftwf_plan;
16using fft_real = float;
17using fft_complex =
float[2];
18struct fft_temp_storage
22#elif defined(OSSIA_FFTW_DOUBLE_ONLY)
23using fftw_plan =
struct fftw_plan_s*;
24using fftwf_plan =
struct fftwf_plan_s*;
27using fft_plan = fftw_plan;
28using fft_real = double;
29using fft_complex =
double[2];
30struct fft_temp_storage
35#elif defined(OSSIA_FFT_KFR)
38using fft_plan =
void*;
39using fft_real = double;
40using fft_complex =
double[2];
41using fft_temp_storage = ossia::pod_vector<uint8_t>;
46using fft_plan =
void*;
47using fft_real = double;
48using fft_complex =
double[2];
49struct fft_temp_storage
60 explicit fft(std::size_t newSize)
noexcept;
68 static constexpr double norm(std::size_t sz)
noexcept {
return 1. / sz; }
70 void reset(std::size_t newSize);
72 fft_complex* execute(
float* input, std::size_t sz)
noexcept;
73 fft_complex* execute() noexcept;
75 [[nodiscard]] fft_real* input() const noexcept {
return m_input; }
79 std::size_t m_size = 0;
81 fft_complex* m_output{};
82 fft_temp_storage m_storage;
85class OSSIA_EXPORT rfft
88 explicit rfft(std::size_t newSize)
noexcept;
91 static constexpr double norm(std::size_t sz)
noexcept {
return 1. / sz; }
93 void reset(std::size_t newSize);
95 fft_real* execute(fft_complex* input)
noexcept;
96 fft_real* execute() noexcept;
98 [[nodiscard]] fft_complex* input() const noexcept {
return m_input; }
102 std::size_t m_size = 0;
103 fft_complex* m_input{};
104 fft_real* m_output{};
105 fft_temp_storage m_storage;