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

#include <recursivefilters.h>

Public Member Functions

 SecondOrderRecursiveFilter (float samplingFrequency, float centerFrequency, float r)
 
 ~SecondOrderRecursiveFilter ()
 
void setFrequencies (float samplingFrequency, float centerFrequency)
 
void setR (float r)
 
short run (short sample)
 
float run (float sample)
 

Private Member Functions

void init ()
 

Private Attributes

float m_r
 
float m_frequencyRatio
 
float m_f
 
float m_v [3]
 

Detailed Description

: This is a second order bandpass filter using recursive method. r is in range ]0..1[ the higher the steeper the filter. inspired by:http://www.ece.umd.edu/~tretter/commlab/c6713slides/FSKSlides.pdf

Definition at line 27 of file recursivefilters.h.

Constructor & Destructor Documentation

◆ SecondOrderRecursiveFilter()

SecondOrderRecursiveFilter::SecondOrderRecursiveFilter ( float  samplingFrequency,
float  centerFrequency,
float  r 
)

Definition at line 24 of file recursivefilters.cpp.

References init().

24  :
25  m_r(r),
26  m_frequencyRatio(centerFrequency/samplingFrequency),
28 {
29  init();
30 }
Fixed< IntType, IntBits > cos(Fixed< IntType, IntBits > const &x)
Definition: fixed.h:2271
#define M_PI
+ Here is the call graph for this function:

◆ ~SecondOrderRecursiveFilter()

SecondOrderRecursiveFilter::~SecondOrderRecursiveFilter ( )

Definition at line 32 of file recursivefilters.cpp.

33 {}

Member Function Documentation

◆ init()

void SecondOrderRecursiveFilter::init ( )
private

Definition at line 68 of file recursivefilters.cpp.

References i, and m_v.

Referenced by SecondOrderRecursiveFilter(), setFrequencies(), and setR().

69 {
70  for (int i = 0; i < 3; i++)
71  {
72  m_v[i] = 0.0f;
73  }
74 }
int32_t i
Definition: decimators.h:244
+ Here is the caller graph for this function:

◆ run() [1/2]

short SecondOrderRecursiveFilter::run ( short  sample)

Definition at line 48 of file recursivefilters.cpp.

References m_f, m_r, and m_v.

Referenced by ATVDemod::demod().

49 {
50  m_v[0] = ((1.0f - m_r) * (float) sample) + (2.0f * m_r * m_f * m_v[1]) - (m_r * m_r * m_v[2]);
51  float y = m_v[0] - m_v[2];
52  m_v[2] = m_v[1];
53  m_v[1] = m_v[0];
54 
55  return (short) y;
56 }
+ Here is the caller graph for this function:

◆ run() [2/2]

float SecondOrderRecursiveFilter::run ( float  sample)

Definition at line 58 of file recursivefilters.cpp.

References m_f, m_r, and m_v.

59 {
60  m_v[0] = ((1.0f - m_r) * sample) + (2.0f * m_r * m_f * m_v[1]) - (m_r * m_r * m_v[2]);
61  float y = m_v[0] - m_v[2];
62  m_v[2] = m_v[1];
63  m_v[1] = m_v[0];
64 
65  return y;
66 }

◆ setFrequencies()

void SecondOrderRecursiveFilter::setFrequencies ( float  samplingFrequency,
float  centerFrequency 
)

Definition at line 35 of file recursivefilters.cpp.

References cos(), init(), m_f, m_frequencyRatio, and M_PI.

Referenced by ATVDemod::applySettings().

36 {
37  m_frequencyRatio = centerFrequency / samplingFrequency;
39  init();
40 }
Fixed< IntType, IntBits > cos(Fixed< IntType, IntBits > const &x)
Definition: fixed.h:2271
#define M_PI
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setR()

void SecondOrderRecursiveFilter::setR ( float  r)

Definition at line 42 of file recursivefilters.cpp.

References init(), and m_r.

43 {
44  m_r = r;
45  init();
46 }
+ Here is the call graph for this function:

Member Data Documentation

◆ m_f

float SecondOrderRecursiveFilter::m_f
private

Definition at line 43 of file recursivefilters.h.

Referenced by run(), and setFrequencies().

◆ m_frequencyRatio

float SecondOrderRecursiveFilter::m_frequencyRatio
private

Definition at line 42 of file recursivefilters.h.

Referenced by setFrequencies().

◆ m_r

float SecondOrderRecursiveFilter::m_r
private

Definition at line 41 of file recursivefilters.h.

Referenced by run(), and setR().

◆ m_v

float SecondOrderRecursiveFilter::m_v[3]
private

Definition at line 44 of file recursivefilters.h.

Referenced by init(), and run().


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