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 | Protected Member Functions | Protected Attributes | List of all members
IntHalfbandFilterDBF< AccuType, SampleType, HBFilterOrder > Class Template Reference

#include <inthalfbandfilterdbf.h>

Public Member Functions

 IntHalfbandFilterDBF ()
 
void myDecimate (AccuType x1, AccuType y1, AccuType *x2, AccuType *y2)
 
void myInterpolate (qint32 *x1, qint32 *y1, qint32 *x2, qint32 *y2)
 
void myInterpolateInf (qint32 *x1, qint32 *y1, qint32 *x2, qint32 *y2, qint32 *x3, qint32 *y3, qint32 *x4, qint32 *y4)
 
void myInterpolateSup (qint32 *x1, qint32 *y1, qint32 *x2, qint32 *y2, qint32 *x3, qint32 *y3, qint32 *x4, qint32 *y4)
 

Protected Member Functions

void storeSample (AccuType x, AccuType y)
 
void advancePointer ()
 
void doFIR (AccuType *x, AccuType *y)
 
void doInterpolateFIR (qint32 *x, qint32 *y)
 

Protected Attributes

SampleType m_samplesDB [2 *(HBFIRFilterTraits< HBFilterOrder >::hbOrder - 1)][2]
 
int m_ptr
 
int m_size
 
int m_state
 

Detailed Description

template<typename AccuType, typename SampleType, uint32_t HBFilterOrder>
class IntHalfbandFilterDBF< AccuType, SampleType, HBFilterOrder >

Definition at line 31 of file inthalfbandfilterdbf.h.

Constructor & Destructor Documentation

◆ IntHalfbandFilterDBF()

template<typename AccuType , typename SampleType , uint32_t HBFilterOrder>
IntHalfbandFilterDBF< AccuType, SampleType, HBFilterOrder >::IntHalfbandFilterDBF ( )

Definition at line 165 of file inthalfbandfilterdbf.h.

References i.

166 {
168 
169  for (int i = 0; i < m_size; i++)
170  {
171  m_samplesDB[i][0] = 0;
172  m_samplesDB[i][1] = 0;
173  }
174 
175  m_ptr = 0;
176  m_state = 0;
177 }
int32_t i
Definition: decimators.h:244
SampleType m_samplesDB[2 *(HBFIRFilterTraits< HBFilterOrder >::hbOrder - 1)][2]

Member Function Documentation

◆ advancePointer()

template<typename AccuType , typename SampleType , uint32_t HBFilterOrder>
void IntHalfbandFilterDBF< AccuType, SampleType, HBFilterOrder >::advancePointer ( )
inlineprotected

Definition at line 115 of file inthalfbandfilterdbf.h.

116  {
117  m_ptr = m_ptr + 1 < m_size ? m_ptr + 1: 0;
118  }

◆ doFIR()

template<typename AccuType , typename SampleType , uint32_t HBFilterOrder>
void IntHalfbandFilterDBF< AccuType, SampleType, HBFilterOrder >::doFIR ( AccuType *  x,
AccuType *  y 
)
inlineprotected

Definition at line 120 of file inthalfbandfilterdbf.h.

References i.

121  {
122  int a = m_ptr + m_size; // tip pointer
123  int b = m_ptr + 1; // tail pointer
124  AccuType iAcc = 0;
125  AccuType qAcc = 0;
126 
127  for (int i = 0; i < HBFIRFilterTraits<HBFilterOrder>::hbOrder / 4; i++)
128  {
131  a -= 2;
132  b += 2;
133  }
134 
135  iAcc += m_samplesDB[b-1][0] / 2.0;
136  qAcc += m_samplesDB[b-1][1] / 2.0;
137 
138  *x = iAcc; // HB_SHIFT incorrect do not loose the gained bit
139  *y = qAcc;
140  }
int32_t i
Definition: decimators.h:244
SampleType m_samplesDB[2 *(HBFIRFilterTraits< HBFilterOrder >::hbOrder - 1)][2]

◆ doInterpolateFIR()

template<typename AccuType , typename SampleType , uint32_t HBFilterOrder>
void IntHalfbandFilterDBF< AccuType, SampleType, HBFilterOrder >::doInterpolateFIR ( qint32 *  x,
qint32 *  y 
)
inlineprotected

Definition at line 142 of file inthalfbandfilterdbf.h.

References i, and SDR_RX_SCALED.

143  {
144  qint16 a = m_ptr;
145  qint16 b = m_ptr + (HBFIRFilterTraits<HBFilterOrder>::hbOrder / 2) - 1;
146 
147  // go through samples in buffer
148  AccuType iAcc = 0;
149  AccuType qAcc = 0;
150 
151  for (int i = 0; i < HBFIRFilterTraits<HBFilterOrder>::hbOrder / 4; i++)
152  {
155  a++;
156  b--;
157  }
158 
159  *x = iAcc * SDR_RX_SCALED;
160  *y = qAcc * SDR_RX_SCALED;
161  }
int32_t i
Definition: decimators.h:244
SampleType m_samplesDB[2 *(HBFIRFilterTraits< HBFilterOrder >::hbOrder - 1)][2]
#define SDR_RX_SCALED
Definition: dsptypes.h:34

◆ myDecimate()

template<typename AccuType , typename SampleType , uint32_t HBFilterOrder>
void IntHalfbandFilterDBF< AccuType, SampleType, HBFilterOrder >::myDecimate ( AccuType  x1,
AccuType  y1,
AccuType *  x2,
AccuType *  y2 
)
inline

Definition at line 35 of file inthalfbandfilterdbf.h.

36  {
37  storeSample(x1, y1);
39 
40  storeSample(*x2, *y2);
41  doFIR(x2, y2);
43  }
void storeSample(AccuType x, AccuType y)
void doFIR(AccuType *x, AccuType *y)

◆ myInterpolate()

template<typename AccuType , typename SampleType , uint32_t HBFilterOrder>
void IntHalfbandFilterDBF< AccuType, SampleType, HBFilterOrder >::myInterpolate ( qint32 *  x1,
qint32 *  y1,
qint32 *  x2,
qint32 *  y2 
)
inline

Optimized upsampler by 2 not calculating FIR with inserted null samples

Definition at line 46 of file inthalfbandfilterdbf.h.

47  {
48  // insert sample into ring double buffer
49  m_samplesDB[m_ptr][0] = *x1;
50  m_samplesDB[m_ptr][1] = *y1;
53 
54  // advance pointer
56  m_ptr++;
57  } else {
58  m_ptr = 0;
59  }
60 
61  // first output sample calculated with the middle peak
64 
65  // second sample calculated with the filter
66  doInterpolateFIR(x2, y2);
67  }
void doInterpolateFIR(qint32 *x, qint32 *y)
SampleType m_samplesDB[2 *(HBFIRFilterTraits< HBFilterOrder >::hbOrder - 1)][2]

◆ myInterpolateInf()

template<typename AccuType , typename SampleType , uint32_t HBFilterOrder>
void IntHalfbandFilterDBF< AccuType, SampleType, HBFilterOrder >::myInterpolateInf ( qint32 *  x1,
qint32 *  y1,
qint32 *  x2,
qint32 *  y2,
qint32 *  x3,
qint32 *  y3,
qint32 *  x4,
qint32 *  y4 
)
inline

Definition at line 69 of file inthalfbandfilterdbf.h.

70  {
71  myInterpolate(x1, y1, x2, y2);
72  myInterpolate(x3, y3, x4, y4);
73  // rotation
74  qint32 x;
75  x = *x1;
76  *x1 = *y1;
77  *y1 = -x;
78  *x2 = -*x2;
79  *y2 = -*y2;
80  x = *x3;
81  *x3 = -*y3;
82  *y3 = x;
83  }
void myInterpolate(qint32 *x1, qint32 *y1, qint32 *x2, qint32 *y2)

◆ myInterpolateSup()

template<typename AccuType , typename SampleType , uint32_t HBFilterOrder>
void IntHalfbandFilterDBF< AccuType, SampleType, HBFilterOrder >::myInterpolateSup ( qint32 *  x1,
qint32 *  y1,
qint32 *  x2,
qint32 *  y2,
qint32 *  x3,
qint32 *  y3,
qint32 *  x4,
qint32 *  y4 
)
inline

Definition at line 85 of file inthalfbandfilterdbf.h.

86  {
87  myInterpolate(x1, y1, x2, y2);
88  myInterpolate(x3, y3, x4, y4);
89  // rotation
90  qint32 x;
91  x = *x1;
92  *x1 = -*y1;
93  *y1 = x;
94  *x2 = -*x2;
95  *y2 = -*y2;
96  x = *x3;
97  *x3 = *y3;
98  *y3 = -x;
99  }
void myInterpolate(qint32 *x1, qint32 *y1, qint32 *x2, qint32 *y2)

◆ storeSample()

template<typename AccuType , typename SampleType , uint32_t HBFilterOrder>
void IntHalfbandFilterDBF< AccuType, SampleType, HBFilterOrder >::storeSample ( AccuType  x,
AccuType  y 
)
inlineprotected

Definition at line 107 of file inthalfbandfilterdbf.h.

108  {
109  m_samplesDB[m_ptr][0] = x;
110  m_samplesDB[m_ptr][1] = y;
111  m_samplesDB[m_ptr + m_size][0] = x;
112  m_samplesDB[m_ptr + m_size][1] = y;
113  }
SampleType m_samplesDB[2 *(HBFIRFilterTraits< HBFilterOrder >::hbOrder - 1)][2]

Member Data Documentation

◆ m_ptr

template<typename AccuType , typename SampleType , uint32_t HBFilterOrder>
int IntHalfbandFilterDBF< AccuType, SampleType, HBFilterOrder >::m_ptr
protected

Definition at line 103 of file inthalfbandfilterdbf.h.

◆ m_samplesDB

template<typename AccuType , typename SampleType , uint32_t HBFilterOrder>
SampleType IntHalfbandFilterDBF< AccuType, SampleType, HBFilterOrder >::m_samplesDB[2 *(HBFIRFilterTraits< HBFilterOrder >::hbOrder - 1)][2]
protected

Definition at line 102 of file inthalfbandfilterdbf.h.

◆ m_size

template<typename AccuType , typename SampleType , uint32_t HBFilterOrder>
int IntHalfbandFilterDBF< AccuType, SampleType, HBFilterOrder >::m_size
protected

Definition at line 104 of file inthalfbandfilterdbf.h.

◆ m_state

template<typename AccuType , typename SampleType , uint32_t HBFilterOrder>
int IntHalfbandFilterDBF< AccuType, SampleType, HBFilterOrder >::m_state
protected

Definition at line 105 of file inthalfbandfilterdbf.h.


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