SatDump
2.0.0-alpha-76a915210
Loading...
Searching...
No Matches
fft_helper.h
1
#pragma once
2
3
#include <fftw3.h>
4
5
namespace
satdump
6
{
7
namespace
ndsp
8
{
9
template
<
typename
T>
10
class
FFTHelper
11
{
12
public
:
13
fftwf_plan fft;
14
T *fft_in;
15
T *fft_out;
16
17
public
:
18
FFTHelper(
int
fft_size,
bool
forward,
unsigned
int
flags = FFTW_ESTIMATE)
19
{
20
fft_in = (T *)fftwf_malloc(
sizeof
(T) * fft_size);
21
fft_out = (T *)fftwf_malloc(
sizeof
(T) * fft_size);
22
fft = fftwf_plan_dft_1d(fft_size, (fftwf_complex *)fft_in, (fftwf_complex *)fft_out, forward ? FFTW_FORWARD : FFTW_BACKWARD, flags);
23
}
24
25
~FFTHelper()
26
{
27
fftwf_free(fft);
28
fftwf_free(fft_in);
29
fftwf_free(fft_out);
30
}
31
32
inline
void
execute() { fftwf_execute(fft); }
33
};
34
}
// namespace ndsp
35
}
// namespace satdump
src-core
dsp
fft
fft_helper.h
Generated by
1.14.0