-
Notifications
You must be signed in to change notification settings - Fork 0
/
convolution_plan.hpp
34 lines (28 loc) · 1.03 KB
/
convolution_plan.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// SPDX-License-Identifier: GPL-2.0
// Calculate the convolution of two buffers by multiplication of two
// Fourier transforms, followed by an inverse Fourier transform.
// The input buffers can be either real or complex. If at least one
// of the input buffers is complex, so must be the output buffer.
#ifndef CONVOLUTION_PLAN_HPP
#define CONVOLUTION_PLAN_HPP
#include "aligned_buf.hpp"
#include <complex>
class FFTBuf;
class ConvolutionPlan {
FFTBuf &in1;
FFTBuf &in2;
AlignedBuf<std::complex<double>> mid1;
AlignedBuf<std::complex<double>> mid2;
AlignedBuf<std::complex<double>> temp; // Intermediate buffer for real to complex transforms
FFTBuf &out;
void *plan1; // nullptr if input is empty (i.e. generate empty output)
void *plan2; // nullptr if input is empty (i.e. generate empty output)
void *plan3; // nullptr if input is empty (i.e. generate empty output)
bool in1_is_complex;
bool in2_is_complex;
public:
ConvolutionPlan(FFTBuf &in1, FFTBuf &in2, FFTBuf &out);
~ConvolutionPlan();
void execute();
};
#endif