mirror of https://github.com/hmatuschek/libsdr
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
958 B
C++
47 lines
958 B
C++
#ifndef __SDR_FFTPLAN_HH__
|
|
#define __SDR_FFTPLAN_HH__
|
|
|
|
#include "buffer.hh"
|
|
#include "node.hh"
|
|
#include "config.hh"
|
|
|
|
namespace sdr {
|
|
|
|
// Forward declaration of FFTPlan
|
|
template <class Scalar> class FFTPlan { };
|
|
|
|
/** FFT module class, provides static methods to perfrom a FFT directly. */
|
|
class FFT {
|
|
public:
|
|
/** Direction type. */
|
|
typedef enum {
|
|
FORWARD, BACKWARD
|
|
} Direction;
|
|
|
|
/** Performs a FFT transform. */
|
|
template <class Scalar>
|
|
static void exec(const Buffer< std::complex<Scalar> > &in,
|
|
const Buffer< std::complex<Scalar> > &out, FFT::Direction dir)
|
|
{
|
|
FFTPlan<Scalar> plan(in, out, dir); plan();
|
|
}
|
|
|
|
/** Performs an in-place FFT transform. */
|
|
template <class Scalar>
|
|
static void exec(const Buffer< std::complex<Scalar> > &inplace, FFT::Direction dir)
|
|
{
|
|
FFTPlan<Scalar> plan(inplace, dir); plan();
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
#ifdef SDR_WITH_FFTW
|
|
#include "fftplan_fftw3.hh"
|
|
#endif
|
|
|
|
|
|
#endif // __SDR_FFTPLAN_HH__
|