SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
Classes | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
FFTWEngine Class Reference

#include <fftwengine.h>

+ Inheritance diagram for FFTWEngine:
+ Collaboration diagram for FFTWEngine:

Classes

struct  Plan
 

Public Member Functions

 FFTWEngine ()
 
 ~FFTWEngine ()
 
void configure (int n, bool inverse)
 
void transform ()
 
Complexin ()
 
Complexout ()
 
- Public Member Functions inherited from FFTEngine
virtual ~FFTEngine ()
 

Protected Types

typedef std::list< Plan * > Plans
 

Protected Member Functions

void freeAll ()
 

Protected Attributes

Plans m_plans
 
Planm_currentPlan
 

Static Protected Attributes

static QMutex m_globalPlanMutex
 

Additional Inherited Members

- Static Public Member Functions inherited from FFTEngine
static FFTEnginecreate ()
 

Detailed Description

Definition at line 10 of file fftwengine.h.

Member Typedef Documentation

◆ Plans

typedef std::list<Plan*> FFTWEngine::Plans
protected

Definition at line 31 of file fftwengine.h.

Constructor & Destructor Documentation

◆ FFTWEngine()

FFTWEngine::FFTWEngine ( )

Definition at line 4 of file fftwengine.cpp.

4  :
5  m_plans(),
6  m_currentPlan(NULL)
7 {
8 }
Plan * m_currentPlan
Definition: fftwengine.h:33
Plans m_plans
Definition: fftwengine.h:32

◆ ~FFTWEngine()

FFTWEngine::~FFTWEngine ( )

Definition at line 10 of file fftwengine.cpp.

References freeAll().

11 {
12  freeAll();
13 }
void freeAll()
Definition: fftwengine.cpp:60
+ Here is the call graph for this function:

Member Function Documentation

◆ configure()

void FFTWEngine::configure ( int  n,
bool  inverse 
)
virtual

Implements FFTEngine.

Definition at line 15 of file fftwengine.cpp.

References FFTWEngine::Plan::in, FFTWEngine::Plan::inverse, m_currentPlan, m_globalPlanMutex, m_plans, FFTWEngine::Plan::n, FFTWEngine::Plan::out, and FFTWEngine::Plan::plan.

16 {
17  for(Plans::const_iterator it = m_plans.begin(); it != m_plans.end(); ++it) {
18  if(((*it)->n == n) && ((*it)->inverse == inverse)) {
19  m_currentPlan = *it;
20  return;
21  }
22  }
23 
24  m_currentPlan = new Plan;
25  m_currentPlan->n = n;
26  m_currentPlan->inverse = inverse;
27  m_currentPlan->in = (fftwf_complex*)fftwf_malloc(sizeof(fftwf_complex) * n);
28  m_currentPlan->out = (fftwf_complex*)fftwf_malloc(sizeof(fftwf_complex) * n);
29  QTime t;
30  t.start();
31  m_globalPlanMutex.lock();
32  m_currentPlan->plan = fftwf_plan_dft_1d(n, m_currentPlan->in, m_currentPlan->out, inverse ? FFTW_BACKWARD : FFTW_FORWARD, FFTW_PATIENT);
33  m_globalPlanMutex.unlock();
34  qDebug("FFT: creating FFTW plan (n=%d,%s) took %dms", n, inverse ? "inverse" : "forward", t.elapsed());
35  m_plans.push_back(m_currentPlan);
36 }
fftwf_complex * in
Definition: fftwengine.h:28
Plan * m_currentPlan
Definition: fftwengine.h:33
fftwf_complex * out
Definition: fftwengine.h:29
static QMutex m_globalPlanMutex
Definition: fftwengine.h:22
fftwf_plan plan
Definition: fftwengine.h:27
Plans m_plans
Definition: fftwengine.h:32

◆ freeAll()

void FFTWEngine::freeAll ( )
protected

Definition at line 60 of file fftwengine.cpp.

References m_plans.

Referenced by ~FFTWEngine().

61 {
62  for(Plans::iterator it = m_plans.begin(); it != m_plans.end(); ++it) {
63  fftwf_destroy_plan((*it)->plan);
64  fftwf_free((*it)->in);
65  fftwf_free((*it)->out);
66  delete *it;
67  }
68  m_plans.clear();
69 }
Plans m_plans
Definition: fftwengine.h:32
+ Here is the caller graph for this function:

◆ in()

Complex * FFTWEngine::in ( )
virtual

Implements FFTEngine.

Definition at line 44 of file fftwengine.cpp.

References FFTWEngine::Plan::in, and m_currentPlan.

45 {
46  if(m_currentPlan != NULL)
47  return reinterpret_cast<Complex*>(m_currentPlan->in);
48  else return NULL;
49 }
fftwf_complex * in
Definition: fftwengine.h:28
Plan * m_currentPlan
Definition: fftwengine.h:33
std::complex< Real > Complex
Definition: dsptypes.h:43

◆ out()

Complex * FFTWEngine::out ( )
virtual

Implements FFTEngine.

Definition at line 51 of file fftwengine.cpp.

References m_currentPlan, m_globalPlanMutex, and FFTWEngine::Plan::out.

52 {
53  if(m_currentPlan != NULL)
54  return reinterpret_cast<Complex*>(m_currentPlan->out);
55  else return NULL;
56 }
Plan * m_currentPlan
Definition: fftwengine.h:33
fftwf_complex * out
Definition: fftwengine.h:29
std::complex< Real > Complex
Definition: dsptypes.h:43

◆ transform()

void FFTWEngine::transform ( )
virtual

Implements FFTEngine.

Definition at line 38 of file fftwengine.cpp.

References m_currentPlan, and FFTWEngine::Plan::plan.

39 {
40  if(m_currentPlan != NULL)
41  fftwf_execute(m_currentPlan->plan);
42 }
Plan * m_currentPlan
Definition: fftwengine.h:33
fftwf_plan plan
Definition: fftwengine.h:27

Member Data Documentation

◆ m_currentPlan

Plan* FFTWEngine::m_currentPlan
protected

Definition at line 33 of file fftwengine.h.

Referenced by configure(), in(), out(), and transform().

◆ m_globalPlanMutex

QMutex FFTWEngine::m_globalPlanMutex
staticprotected

Definition at line 22 of file fftwengine.h.

Referenced by configure(), and out().

◆ m_plans

Plans FFTWEngine::m_plans
protected

Definition at line 32 of file fftwengine.h.

Referenced by configure(), and freeAll().


The documentation for this class was generated from the following files: