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 Types | Public Member Functions | Private Attributes | List of all members
sfft Class Reference

#include <fftfilt.h>

+ Collaboration diagram for sfft:

Classes

struct  vrot_bins_pair
 

Public Types

typedef std::complex< float > cmplx
 

Public Member Functions

 sfft (int len)
 
 ~sfft ()
 
void run (const cmplx &input)
 
void fetch (float *result)
 

Private Attributes

int fftlen
 
int first
 
int last
 
int ptr
 
vrot_bins_pairvrot_bins
 
cmplxdelay
 
float k2
 

Detailed Description

Definition at line 96 of file fftfilt.h.

Member Typedef Documentation

◆ cmplx

typedef std::complex<float> sfft::cmplx

Definition at line 99 of file fftfilt.h.

Constructor & Destructor Documentation

◆ sfft()

sfft::sfft ( int  len)

Definition at line 410 of file fftfilt.cpp.

References cos(), i, K1, M_PI, and sin().

411 {
412  vrot_bins = new vrot_bins_pair[len];
413  delay = new cmplx[len];
414  fftlen = len;
415  first = 0;
416  last = len - 1;
417  ptr = 0;
418  double phi = 0.0, tau = 2.0 * M_PI/ len;
419  k2 = 1.0;
420  for (int i = 0; i < len; i++) {
421  vrot_bins[i].vrot = cmplx( K1 * cos (phi), K1 * sin (phi) );
422  phi += tau;
423  delay[i] = vrot_bins[i].bins = 0.0;
424  k2 *= K1;
425  }
426 }
int last
Definition: fftfilt.h:107
int first
Definition: fftfilt.h:106
Fixed< IntType, IntBits > cos(Fixed< IntType, IntBits > const &x)
Definition: fixed.h:2271
vrot_bins_pair * vrot_bins
Definition: fftfilt.h:109
int fftlen
Definition: fftfilt.h:105
std::complex< float > cmplx
Definition: complex.h:31
#define M_PI
Definition: rdsdemod.cpp:27
#define K1
Definition: fftfilt.h:97
cmplx * delay
Definition: fftfilt.h:111
int ptr
Definition: fftfilt.h:108
Fixed< IntType, IntBits > sin(Fixed< IntType, IntBits > const &x)
Definition: fixed.h:2265
int32_t i
Definition: decimators.h:244
float k2
Definition: fftfilt.h:112
std::complex< float > cmplx
Definition: fftfilt.h:99
+ Here is the call graph for this function:

◆ ~sfft()

sfft::~sfft ( )

Definition at line 428 of file fftfilt.cpp.

429 {
430  delete [] vrot_bins;
431  delete [] delay;
432 }
vrot_bins_pair * vrot_bins
Definition: fftfilt.h:109
cmplx * delay
Definition: fftfilt.h:111

Member Function Documentation

◆ fetch()

void sfft::fetch ( float *  result)

Definition at line 451 of file fftfilt.cpp.

Referenced by LoRaDemod::detect().

452 {
453  for (vrot_bins_pair *itr = vrot_bins, *end = vrot_bins + last; itr != end; ++itr, ++result)
454  *result = itr->bins.real() * itr->bins.real()
455  + itr->bins.imag() * itr->bins.imag();
456 }
int last
Definition: fftfilt.h:107
vrot_bins_pair * vrot_bins
Definition: fftfilt.h:109
+ Here is the caller graph for this function:

◆ run()

void sfft::run ( const cmplx input)

Definition at line 437 of file fftfilt.cpp.

Referenced by LoRaDemod::detect().

438 {
439  cmplx & de = delay[ptr];
440  const cmplx z( input.real() - k2 * de.real(), input.imag() - k2 * de.imag());
441  de = input;
442 
443  if (++ptr >= fftlen)
444  ptr = 0;
445 
446  for (vrot_bins_pair *itr = vrot_bins + first, *end = vrot_bins + last; itr != end ; ++itr)
447  itr->bins = (itr->bins + z) * itr->vrot;
448 }
int last
Definition: fftfilt.h:107
int first
Definition: fftfilt.h:106
vrot_bins_pair * vrot_bins
Definition: fftfilt.h:109
int fftlen
Definition: fftfilt.h:105
std::complex< float > cmplx
Definition: complex.h:31
cmplx * delay
Definition: fftfilt.h:111
int ptr
Definition: fftfilt.h:108
float k2
Definition: fftfilt.h:112
+ Here is the caller graph for this function:

Member Data Documentation

◆ delay

cmplx* sfft::delay
private

Definition at line 111 of file fftfilt.h.

◆ fftlen

int sfft::fftlen
private

Definition at line 105 of file fftfilt.h.

◆ first

int sfft::first
private

Definition at line 106 of file fftfilt.h.

◆ k2

float sfft::k2
private

Definition at line 112 of file fftfilt.h.

◆ last

int sfft::last
private

Definition at line 107 of file fftfilt.h.

◆ ptr

int sfft::ptr
private

Definition at line 108 of file fftfilt.h.

◆ vrot_bins

vrot_bins_pair* sfft::vrot_bins
private

Definition at line 109 of file fftfilt.h.


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