#pragma once #include #include #include #include #include namespace engine::audio { using TensorShape = std::vector; using TensorStrideBytes = std::vector; class RealFFTPlan { public: explicit RealFFTPlan(size_t fft_size); ~RealFFTPlan(); RealFFTPlan(const RealFFTPlan &); RealFFTPlan & operator=(const RealFFTPlan &); RealFFTPlan(RealFFTPlan &&) noexcept; RealFFTPlan & operator=(RealFFTPlan &&) noexcept; size_t fft_size() const; void forward( const TensorShape & input_shape, const TensorStrideBytes & input_strides, const TensorStrideBytes & output_strides, size_t axis, const float * data_in, std::complex * data_out, float scale = 1.0f, size_t threads = 0) const; void inverse( const TensorShape & output_shape, const TensorStrideBytes & input_strides, const TensorStrideBytes & output_strides, size_t axis, const std::complex * data_in, float * data_out, float scale = 1.0f, size_t threads = 0) const; private: struct Impl; std::shared_ptr impl_; }; std::shared_ptr get_real_fft_plan(size_t fft_size); void real_fft_forward( const TensorShape & input_shape, const TensorStrideBytes & input_strides, const TensorStrideBytes & output_strides, size_t axis, const float * data_in, std::complex * data_out, float scale = 1.0f, size_t threads = 0); void real_fft_inverse( const TensorShape & output_shape, const TensorStrideBytes & input_strides, const TensorStrideBytes & output_strides, size_t axis, const std::complex * data_in, float * data_out, float scale = 1.0f, size_t threads = 0); } // namespace engine::audio