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

#include <fftcorr.h>

+ Collaboration diagram for fftcorr:

Public Types

typedef std::complex< float > cmplx
 

Public Member Functions

 fftcorr (int len)
 
 ~fftcorr ()
 
int run (const cmplx &inA, const cmplx *inB, cmplx **out)
 if inB = 0 then run auto-correlation More...
 
const cmplxrun (const cmplx &inA, const cmplx *inB)
 

Private Member Functions

void init_fft ()
 

Private Attributes

int flen
 FFT length. More...
 
int flen2
 half FFT length More...
 
g_fft< float > * fftA
 
g_fft< float > * fftB
 
cmplxdataA
 
cmplxdataB
 
cmplxdataBj
 
cmplxdataP
 
int inptrA
 
int inptrB
 
int outptr
 

Detailed Description

Definition at line 33 of file fftcorr.h.

Member Typedef Documentation

◆ cmplx

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

Definition at line 35 of file fftcorr.h.

Constructor & Destructor Documentation

◆ fftcorr()

fftcorr::fftcorr ( int  len)

Definition at line 47 of file fftcorr.cpp.

References init_fft().

47  : flen(len), flen2(len>>1)
48 {
49  init_fft();
50 }
int flen2
half FFT length
Definition: fftcorr.h:45
int flen
FFT length.
Definition: fftcorr.h:44
void init_fft()
Definition: fftcorr.cpp:29
+ Here is the call graph for this function:

◆ ~fftcorr()

fftcorr::~fftcorr ( )

Definition at line 52 of file fftcorr.cpp.

References dataA, dataB, dataBj, dataP, fftA, and fftB.

53 {
54  delete fftA;
55  delete fftB;
56  delete[] dataA;
57  delete[] dataB;
58  delete[] dataBj;
59  delete[] dataP;
60 }
cmplx * dataBj
Definition: fftcorr.h:50
g_fft< float > * fftA
Definition: fftcorr.h:46
cmplx * dataA
Definition: fftcorr.h:48
g_fft< float > * fftB
Definition: fftcorr.h:47
cmplx * dataP
Definition: fftcorr.h:51
cmplx * dataB
Definition: fftcorr.h:49

Member Function Documentation

◆ init_fft()

void fftcorr::init_fft ( )
private

Definition at line 29 of file fftcorr.cpp.

References dataA, dataB, dataBj, dataP, fftA, fftB, flen, inptrA, inptrB, and outptr.

Referenced by fftcorr().

30 {
31  fftA = new g_fft<float>(flen);
32  fftB = new g_fft<float>(flen);
33 
34  dataA = new cmplx[flen];
35  dataB = new cmplx[flen];
36  dataBj = new cmplx[flen];
37  dataP = new cmplx[flen];
38 
39  std::fill(dataA, dataA+flen, 0);
40  std::fill(dataB, dataB+flen, 0);
41 
42  inptrA = 0;
43  inptrB = 0;
44  outptr = 0;
45 }
cmplx * dataBj
Definition: fftcorr.h:50
int inptrA
Definition: fftcorr.h:52
std::complex< float > cmplx
Definition: complex.h:31
int flen
FFT length.
Definition: fftcorr.h:44
g_fft< float > * fftA
Definition: fftcorr.h:46
cmplx * dataA
Definition: fftcorr.h:48
g_fft< float > * fftB
Definition: fftcorr.h:47
cmplx * dataP
Definition: fftcorr.h:51
int inptrB
Definition: fftcorr.h:53
cmplx * dataB
Definition: fftcorr.h:49
int outptr
Definition: fftcorr.h:54
+ Here is the caller graph for this function:

◆ run() [1/2]

int fftcorr::run ( const cmplx inA,
const cmplx inB,
cmplx **  out 
)

if inB = 0 then run auto-correlation

Definition at line 62 of file fftcorr.cpp.

References g_fft< FFT_TYPE >::ComplexFFT(), dataA, dataB, dataBj, dataP, fftA, fftB, flen, flen2, inptrA, inptrB, and g_fft< FFT_TYPE >::InverseComplexFFT().

Referenced by ChannelAnalyzer::feedOneSample(), and run().

63 {
64  dataA[inptrA++] = inA;
65 
66  if (inB) {
67  dataB[inptrB++] = *inB;
68  }
69 
70  if (inptrA < flen2) {
71  return 0;
72  }
73 
75 
76  if (inB) {
78  }
79 
80  if (inB) {
81  std::transform(dataB, dataB+flen, dataBj, [](const cmplx& c) -> cmplx { return std::conj(c); });
82  } else {
83  std::transform(dataA, dataA+flen, dataBj, [](const cmplx& c) -> cmplx { return std::conj(c); });
84  }
85 
86  std::transform(dataA, dataA+flen, dataBj, dataP, [](const cmplx& a, const cmplx& b) -> cmplx { return a*b; });
87 
89 
90  std::fill(dataA, dataA+flen, 0);
91  inptrA = 0;
92 
93  if (inB)
94  {
95  std::fill(dataB, dataB+flen, 0);
96  inptrB = 0;
97  }
98 
99  *out = dataP;
100  return flen2;
101 }
cmplx * dataBj
Definition: fftcorr.h:50
int inptrA
Definition: fftcorr.h:52
int flen2
half FFT length
Definition: fftcorr.h:45
void InverseComplexFFT(std::complex< FFT_TYPE > *buf)
Definition: gfft.h:3325
std::complex< float > cmplx
Definition: complex.h:31
void ComplexFFT(std::complex< FFT_TYPE > *buf)
Definition: gfft.h:3309
int flen
FFT length.
Definition: fftcorr.h:44
g_fft< float > * fftA
Definition: fftcorr.h:46
cmplx * dataA
Definition: fftcorr.h:48
g_fft< float > * fftB
Definition: fftcorr.h:47
cmplx * dataP
Definition: fftcorr.h:51
int inptrB
Definition: fftcorr.h:53
cmplx * dataB
Definition: fftcorr.h:49
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ run() [2/2]

const fftcorr::cmplx & fftcorr::run ( const cmplx inA,
const cmplx inB 
)

Definition at line 103 of file fftcorr.cpp.

References dataP, outptr, and run().

104 {
105  cmplx *dummy;
106 
107  if (run(inA, inB, &dummy)) {
108  outptr = 0;
109  }
110 
111  return dataP[outptr++];
112 }
std::complex< float > cmplx
Definition: complex.h:31
cmplx * dataP
Definition: fftcorr.h:51
int run(const cmplx &inA, const cmplx *inB, cmplx **out)
if inB = 0 then run auto-correlation
Definition: fftcorr.cpp:62
int outptr
Definition: fftcorr.h:54
+ Here is the call graph for this function:

Member Data Documentation

◆ dataA

cmplx* fftcorr::dataA
private

Definition at line 48 of file fftcorr.h.

Referenced by init_fft(), run(), and ~fftcorr().

◆ dataB

cmplx* fftcorr::dataB
private

Definition at line 49 of file fftcorr.h.

Referenced by init_fft(), run(), and ~fftcorr().

◆ dataBj

cmplx* fftcorr::dataBj
private

Definition at line 50 of file fftcorr.h.

Referenced by init_fft(), run(), and ~fftcorr().

◆ dataP

cmplx* fftcorr::dataP
private

Definition at line 51 of file fftcorr.h.

Referenced by init_fft(), run(), and ~fftcorr().

◆ fftA

g_fft<float>* fftcorr::fftA
private

Definition at line 46 of file fftcorr.h.

Referenced by init_fft(), run(), and ~fftcorr().

◆ fftB

g_fft<float>* fftcorr::fftB
private

Definition at line 47 of file fftcorr.h.

Referenced by init_fft(), run(), and ~fftcorr().

◆ flen

int fftcorr::flen
private

FFT length.

Definition at line 44 of file fftcorr.h.

Referenced by init_fft(), and run().

◆ flen2

int fftcorr::flen2
private

half FFT length

Definition at line 45 of file fftcorr.h.

Referenced by run().

◆ inptrA

int fftcorr::inptrA
private

Definition at line 52 of file fftcorr.h.

Referenced by init_fft(), and run().

◆ inptrB

int fftcorr::inptrB
private

Definition at line 53 of file fftcorr.h.

Referenced by init_fft(), and run().

◆ outptr

int fftcorr::outptr
private

Definition at line 54 of file fftcorr.h.

Referenced by init_fft(), and run().


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