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
IntHalfbandFilterEO1< HBFilterOrder > Class Template Reference

#include <inthalfbandfiltereo1.h>

Public Member Functions

 IntHalfbandFilterEO1 ()
 
bool workDecimateCenter (Sample *sample)
 
bool workInterpolateCenterZeroStuffing (Sample *sampleIn, Sample *SampleOut)
 
bool workInterpolateCenter (Sample *sampleIn, Sample *SampleOut)
 
bool workDecimateCenter (int32_t *x, int32_t *y)
 
bool workDecimateLowerHalf (Sample *sample)
 
bool workInterpolateLowerHalfZeroStuffing (Sample *sampleIn, Sample *sampleOut)
 
bool workInterpolateLowerHalf (Sample *sampleIn, Sample *sampleOut)
 
bool workDecimateUpperHalf (Sample *sample)
 
bool workInterpolateUpperHalfZeroStuffing (Sample *sampleIn, Sample *sampleOut)
 
bool workInterpolateUpperHalf (Sample *sampleIn, Sample *sampleOut)
 
void myDecimate (const Sample *sample1, Sample *sample2)
 
void myDecimate (int32_t x1, int32_t y1, int32_t *x2, int32_t *y2)
 
void myInterpolateZeroStuffing (Sample *sample1, Sample *sample2)
 
void myInterpolateZeroStuffing (int32_t *x1, int32_t *y1, int32_t *x2, int32_t *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 (const FixReal &sampleI, const FixReal &sampleQ)
 
void storeSample32 (int32_t x, int32_t y)
 
void advancePointer ()
 
int32_t rand (int32_t mod)
 
void doFIR (Sample *sample)
 
void doFIR (int32_t *x, int32_t *y)
 
void doInterpolateFIR (Sample *sample)
 
void doInterpolateFIR (qint32 *x, qint32 *y)
 

Protected Attributes

int32_t m_even [2][HBFIRFilterTraits< HBFilterOrder >::hbOrder]
 
int32_t m_odd [2][HBFIRFilterTraits< HBFilterOrder >::hbOrder]
 
int32_t m_samples [HBFIRFilterTraits< HBFilterOrder >::hbOrder][2]
 
int m_ptr
 
int m_size
 
int m_state
 

Detailed Description

template<uint32_t HBFilterOrder>
class IntHalfbandFilterEO1< HBFilterOrder >

Definition at line 33 of file inthalfbandfiltereo1.h.

Constructor & Destructor Documentation

◆ IntHalfbandFilterEO1()

template<uint32_t HBFilterOrder>
IntHalfbandFilterEO1< HBFilterOrder >::IntHalfbandFilterEO1 ( )

Definition at line 835 of file inthalfbandfiltereo1.h.

References i, IntHalfbandFilterEO1< HBFilterOrder >::m_even, IntHalfbandFilterEO1< HBFilterOrder >::m_odd, IntHalfbandFilterEO1< HBFilterOrder >::m_ptr, IntHalfbandFilterEO1< HBFilterOrder >::m_samples, IntHalfbandFilterEO1< HBFilterOrder >::m_size, and IntHalfbandFilterEO1< HBFilterOrder >::m_state.

836 {
838 
839  for (int i = 0; i < 2*m_size; i++)
840  {
841  m_even[0][i] = 0;
842  m_even[1][i] = 0;
843  m_odd[0][i] = 0;
844  m_odd[1][i] = 0;
845  m_samples[i][0] = 0;
846  m_samples[i][1] = 0;
847  }
848 
849  m_ptr = 0;
850  m_state = 0;
851 }
int32_t m_even[2][HBFIRFilterTraits< HBFilterOrder >::hbOrder]
int32_t i
Definition: decimators.h:244
int32_t m_samples[HBFIRFilterTraits< HBFilterOrder >::hbOrder][2]
int32_t m_odd[2][HBFIRFilterTraits< HBFilterOrder >::hbOrder]

Member Function Documentation

◆ advancePointer()

template<uint32_t HBFilterOrder>
void IntHalfbandFilterEO1< HBFilterOrder >::advancePointer ( )
inlineprotected

◆ doFIR() [1/2]

template<uint32_t HBFilterOrder>
void IntHalfbandFilterEO1< HBFilterOrder >::doFIR ( Sample sample)
inlineprotected

Definition at line 711 of file inthalfbandfiltereo1.h.

References i, IntHalfbandFilterEO1< HBFilterOrder >::m_size, Sample::setImag(), and Sample::setReal().

Referenced by IntHalfbandFilterEO1< HBFilterOrder >::myDecimate(), IntHalfbandFilterEO1< HBFilterOrder >::myInterpolateZeroStuffing(), IntHalfbandFilterEO1< HBFilterOrder >::workDecimateCenter(), IntHalfbandFilterEO1< HBFilterOrder >::workDecimateLowerHalf(), IntHalfbandFilterEO1< HBFilterOrder >::workDecimateUpperHalf(), IntHalfbandFilterEO1< HBFilterOrder >::workInterpolateCenterZeroStuffing(), IntHalfbandFilterEO1< HBFilterOrder >::workInterpolateLowerHalfZeroStuffing(), and IntHalfbandFilterEO1< HBFilterOrder >::workInterpolateUpperHalfZeroStuffing().

712  {
713  int32_t iAcc = 0;
714  int32_t qAcc = 0;
715 
716  int a = m_ptr/2 + m_size; // tip pointer
717  int b = m_ptr/2 + 1; // tail pointer
718 
719  for (int i = 0; i < HBFIRFilterTraits<HBFilterOrder>::hbOrder / 4; i++)
720  {
721  if ((m_ptr % 2) == 0)
722  {
723  iAcc += (m_even[0][a] + m_even[0][b]) * HBFIRFilterTraits<HBFilterOrder>::hbCoeffs[i];
724  qAcc += (m_even[1][a] + m_even[1][b]) * HBFIRFilterTraits<HBFilterOrder>::hbCoeffs[i];
725  }
726  else
727  {
728  iAcc += (m_odd[0][a] + m_odd[0][b]) * HBFIRFilterTraits<HBFilterOrder>::hbCoeffs[i];
729  qAcc += (m_odd[1][a] + m_odd[1][b]) * HBFIRFilterTraits<HBFilterOrder>::hbCoeffs[i];
730  }
731 
732  a -= 1;
733  b += 1;
734  }
735 
736  if ((m_ptr % 2) == 0)
737  {
740  }
741  else
742  {
743  iAcc += ((int32_t)m_even[0][m_ptr/2 + m_size/2 + 1]) << (HBFIRFilterTraits<HBFilterOrder>::hbShift - 1);
744  qAcc += ((int32_t)m_even[1][m_ptr/2 + m_size/2 + 1]) << (HBFIRFilterTraits<HBFilterOrder>::hbShift - 1);
745  }
746 
749  }
int32_t m_even[2][HBFIRFilterTraits< HBFilterOrder >::hbOrder]
int32_t i
Definition: decimators.h:244
void setImag(FixReal v)
Definition: dsptypes.h:59
int int32_t
Definition: rtptypes_win.h:45
void setReal(FixReal v)
Definition: dsptypes.h:58
int32_t m_odd[2][HBFIRFilterTraits< HBFilterOrder >::hbOrder]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doFIR() [2/2]

template<uint32_t HBFilterOrder>
void IntHalfbandFilterEO1< HBFilterOrder >::doFIR ( int32_t x,
int32_t y 
)
inlineprotected

Definition at line 751 of file inthalfbandfiltereo1.h.

References i, and IntHalfbandFilterEO1< HBFilterOrder >::m_size.

752  {
753  int32_t iAcc = 0;
754  int32_t qAcc = 0;
755 
756  int a = m_ptr/2 + m_size; // tip pointer
757  int b = m_ptr/2 + 1; // tail pointer
758 
759  for (int i = 0; i < HBFIRFilterTraits<HBFilterOrder>::hbOrder / 4; i++)
760  {
761  if ((m_ptr % 2) == 0)
762  {
763  iAcc += (m_even[0][a] + m_even[0][b]) * HBFIRFilterTraits<HBFilterOrder>::hbCoeffs[i];
764  qAcc += (m_even[1][a] + m_even[1][b]) * HBFIRFilterTraits<HBFilterOrder>::hbCoeffs[i];
765  }
766  else
767  {
768  iAcc += (m_odd[0][a] + m_odd[0][b]) * HBFIRFilterTraits<HBFilterOrder>::hbCoeffs[i];
769  qAcc += (m_odd[1][a] + m_odd[1][b]) * HBFIRFilterTraits<HBFilterOrder>::hbCoeffs[i];
770  }
771 
772  a -= 1;
773  b += 1;
774  }
775 
776  if ((m_ptr % 2) == 0)
777  {
780  }
781  else
782  {
783  iAcc += ((int32_t)m_even[0][m_ptr/2 + m_size/2 + 1]) << (HBFIRFilterTraits<HBFilterOrder>::hbShift - 1);
784  qAcc += ((int32_t)m_even[1][m_ptr/2 + m_size/2 + 1]) << (HBFIRFilterTraits<HBFilterOrder>::hbShift - 1);
785  }
786 
787  *x = iAcc >> (HBFIRFilterTraits<HBFilterOrder>::hbShift -1); // HB_SHIFT incorrect do not loose the gained bit
789  }
int32_t m_even[2][HBFIRFilterTraits< HBFilterOrder >::hbOrder]
int32_t i
Definition: decimators.h:244
int int32_t
Definition: rtptypes_win.h:45
int32_t m_odd[2][HBFIRFilterTraits< HBFilterOrder >::hbOrder]

◆ doInterpolateFIR() [1/2]

template<uint32_t HBFilterOrder>
void IntHalfbandFilterEO1< HBFilterOrder >::doInterpolateFIR ( Sample sample)
inlineprotected

Definition at line 791 of file inthalfbandfiltereo1.h.

References i, IntHalfbandFilterEO1< HBFilterOrder >::m_ptr, Sample::setImag(), and Sample::setReal().

Referenced by IntHalfbandFilterEO1< HBFilterOrder >::myInterpolate(), IntHalfbandFilterEO1< HBFilterOrder >::workInterpolateCenter(), IntHalfbandFilterEO1< HBFilterOrder >::workInterpolateLowerHalf(), and IntHalfbandFilterEO1< HBFilterOrder >::workInterpolateUpperHalf().

792  {
793  qint32 iAcc = 0;
794  qint32 qAcc = 0;
795 
796  qint16 a = m_ptr;
797  qint16 b = m_ptr + (HBFIRFilterTraits<HBFilterOrder>::hbOrder / 2) - 1;
798 
799  // go through samples in buffer
800  for (int i = 0; i < HBFIRFilterTraits<HBFilterOrder>::hbOrder / 4; i++)
801  {
804  a++;
805  b--;
806  }
807 
810  }
int32_t i
Definition: decimators.h:244
void setImag(FixReal v)
Definition: dsptypes.h:59
int32_t m_samples[HBFIRFilterTraits< HBFilterOrder >::hbOrder][2]
void setReal(FixReal v)
Definition: dsptypes.h:58
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doInterpolateFIR() [2/2]

template<uint32_t HBFilterOrder>
void IntHalfbandFilterEO1< HBFilterOrder >::doInterpolateFIR ( qint32 *  x,
qint32 *  y 
)
inlineprotected

Definition at line 812 of file inthalfbandfiltereo1.h.

References i, and IntHalfbandFilterEO1< HBFilterOrder >::m_ptr.

813  {
814  qint32 iAcc = 0;
815  qint32 qAcc = 0;
816 
817  qint16 a = m_ptr;
818  qint16 b = m_ptr + (HBFIRFilterTraits<HBFilterOrder>::hbOrder / 2) - 1;
819 
820  // go through samples in buffer
821  for (int i = 0; i < HBFIRFilterTraits<HBFilterOrder>::hbOrder / 4; i++)
822  {
825  a++;
826  b--;
827  }
828 
831  }
int32_t i
Definition: decimators.h:244
int32_t m_samples[HBFIRFilterTraits< HBFilterOrder >::hbOrder][2]

◆ myDecimate() [1/2]

template<uint32_t HBFilterOrder>
void IntHalfbandFilterEO1< HBFilterOrder >::myDecimate ( const Sample sample1,
Sample sample2 
)
inline

Definition at line 556 of file inthalfbandfiltereo1.h.

References IntHalfbandFilterEO1< HBFilterOrder >::advancePointer(), IntHalfbandFilterEO1< HBFilterOrder >::doFIR(), Sample::imag(), Sample::real(), and IntHalfbandFilterEO1< HBFilterOrder >::storeSample().

557  {
558  storeSample((FixReal) sample1->real(), (FixReal) sample1->imag());
559  advancePointer();
560 
561  storeSample((FixReal) sample2->real(), (FixReal) sample2->imag());
562  doFIR(sample2);
563  advancePointer();
564  }
void storeSample(const FixReal &sampleI, const FixReal &sampleQ)
void doFIR(Sample *sample)
FixReal real() const
Definition: dsptypes.h:61
FixReal imag() const
Definition: dsptypes.h:62
qint16 FixReal
Definition: dsptypes.h:35
+ Here is the call graph for this function:

◆ myDecimate() [2/2]

template<uint32_t HBFilterOrder>
void IntHalfbandFilterEO1< HBFilterOrder >::myDecimate ( int32_t  x1,
int32_t  y1,
int32_t x2,
int32_t y2 
)
inline

Definition at line 566 of file inthalfbandfiltereo1.h.

References IntHalfbandFilterEO1< HBFilterOrder >::advancePointer(), IntHalfbandFilterEO1< HBFilterOrder >::doFIR(), and IntHalfbandFilterEO1< HBFilterOrder >::storeSample32().

567  {
568  storeSample32(x1, y1);
569  advancePointer();
570 
571  storeSample32(*x2, *y2);
572  doFIR(x2, y2);
573  advancePointer();
574  }
void doFIR(Sample *sample)
void storeSample32(int32_t x, int32_t y)
+ Here is the call graph for this function:

◆ myInterpolate()

template<uint32_t HBFilterOrder>
void IntHalfbandFilterEO1< 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 601 of file inthalfbandfiltereo1.h.

References IntHalfbandFilterEO1< HBFilterOrder >::doInterpolateFIR(), IntHalfbandFilterEO1< HBFilterOrder >::m_ptr, and IntHalfbandFilterEO1< HBFilterOrder >::m_samples.

Referenced by IntHalfbandFilterEO1< HBFilterOrder >::myInterpolateInf(), and IntHalfbandFilterEO1< HBFilterOrder >::myInterpolateSup().

602  {
603  // insert sample into ring double buffer
604  m_samples[m_ptr][0] = *x1;
605  m_samples[m_ptr][1] = *y1;
608 
609  // advance pointer
611  m_ptr++;
612  } else {
613  m_ptr = 0;
614  }
615 
616  // first output sample calculated with the middle peak
619 
620  // second sample calculated with the filter
621  doInterpolateFIR(x2, y2);
622  }
int32_t m_samples[HBFIRFilterTraits< HBFilterOrder >::hbOrder][2]
void doInterpolateFIR(Sample *sample)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ myInterpolateInf()

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

Definition at line 624 of file inthalfbandfiltereo1.h.

References IntHalfbandFilterEO1< HBFilterOrder >::myInterpolate().

625  {
626  myInterpolate(x1, y1, x2, y2);
627  myInterpolate(x3, y3, x4, y4);
628  // rotation
629  qint32 x;
630  x = *x1;
631  *x1 = *y1;
632  *y1 = -x;
633  *x2 = -*x2;
634  *y2 = -*y2;
635  x = *x3;
636  *x3 = -*y3;
637  *y3 = x;
638  }
void myInterpolate(qint32 *x1, qint32 *y1, qint32 *x2, qint32 *y2)
+ Here is the call graph for this function:

◆ myInterpolateSup()

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

Definition at line 640 of file inthalfbandfiltereo1.h.

References IntHalfbandFilterEO1< HBFilterOrder >::myInterpolate().

641  {
642  myInterpolate(x1, y1, x2, y2);
643  myInterpolate(x3, y3, x4, y4);
644  // rotation
645  qint32 x;
646  x = *x1;
647  *x1 = -*y1;
648  *y1 = x;
649  *x2 = -*x2;
650  *y2 = -*y2;
651  x = *x3;
652  *x3 = *y3;
653  *y3 = -x;
654  }
void myInterpolate(qint32 *x1, qint32 *y1, qint32 *x2, qint32 *y2)
+ Here is the call graph for this function:

◆ myInterpolateZeroStuffing() [1/2]

template<uint32_t HBFilterOrder>
void IntHalfbandFilterEO1< HBFilterOrder >::myInterpolateZeroStuffing ( Sample sample1,
Sample sample2 
)
inline

Simple zero stuffing and filter

Definition at line 577 of file inthalfbandfiltereo1.h.

References IntHalfbandFilterEO1< HBFilterOrder >::advancePointer(), IntHalfbandFilterEO1< HBFilterOrder >::doFIR(), Sample::imag(), Sample::real(), and IntHalfbandFilterEO1< HBFilterOrder >::storeSample().

578  {
579  storeSample((FixReal) sample1->real(), (FixReal) sample1->imag());
580  doFIR(sample1);
581  advancePointer();
582 
583  storeSample((FixReal) 0, (FixReal) 0);
584  doFIR(sample2);
585  advancePointer();
586  }
void storeSample(const FixReal &sampleI, const FixReal &sampleQ)
void doFIR(Sample *sample)
FixReal real() const
Definition: dsptypes.h:61
FixReal imag() const
Definition: dsptypes.h:62
qint16 FixReal
Definition: dsptypes.h:35
+ Here is the call graph for this function:

◆ myInterpolateZeroStuffing() [2/2]

template<uint32_t HBFilterOrder>
void IntHalfbandFilterEO1< HBFilterOrder >::myInterpolateZeroStuffing ( int32_t x1,
int32_t y1,
int32_t x2,
int32_t y2 
)
inline

Simple zero stuffing and filter

Definition at line 589 of file inthalfbandfiltereo1.h.

References IntHalfbandFilterEO1< HBFilterOrder >::advancePointer(), IntHalfbandFilterEO1< HBFilterOrder >::doFIR(), and IntHalfbandFilterEO1< HBFilterOrder >::storeSample32().

590  {
591  storeSample32(*x1, *y1);
592  doFIR(x1, y1);
593  advancePointer();
594 
595  storeSample32(0, 0);
596  doFIR(x2, y2);
597  advancePointer();
598  }
void doFIR(Sample *sample)
void storeSample32(int32_t x, int32_t y)
+ Here is the call graph for this function:

◆ rand()

template<uint32_t HBFilterOrder>
int32_t IntHalfbandFilterEO1< HBFilterOrder >::rand ( int32_t  mod)
inlineprotected

Definition at line 706 of file inthalfbandfiltereo1.h.

707  {
708  return (RAND_MAX/2 - std::rand()) % mod;
709  }

◆ storeSample()

template<uint32_t HBFilterOrder>
void IntHalfbandFilterEO1< HBFilterOrder >::storeSample ( const FixReal sampleI,
const FixReal sampleQ 
)
inlineprotected

Definition at line 665 of file inthalfbandfiltereo1.h.

References IntHalfbandFilterEO1< HBFilterOrder >::m_size.

Referenced by IntHalfbandFilterEO1< HBFilterOrder >::myDecimate(), IntHalfbandFilterEO1< HBFilterOrder >::myInterpolateZeroStuffing(), IntHalfbandFilterEO1< HBFilterOrder >::workDecimateCenter(), IntHalfbandFilterEO1< HBFilterOrder >::workDecimateLowerHalf(), IntHalfbandFilterEO1< HBFilterOrder >::workDecimateUpperHalf(), IntHalfbandFilterEO1< HBFilterOrder >::workInterpolateCenterZeroStuffing(), IntHalfbandFilterEO1< HBFilterOrder >::workInterpolateLowerHalfZeroStuffing(), and IntHalfbandFilterEO1< HBFilterOrder >::workInterpolateUpperHalfZeroStuffing().

666  {
667  if ((m_ptr % 2) == 0)
668  {
669  m_even[0][m_ptr/2] = sampleI;
670  m_even[1][m_ptr/2] = sampleQ;
671  m_even[0][m_ptr/2 + m_size] = sampleI;
672  m_even[1][m_ptr/2 + m_size] = sampleQ;
673  }
674  else
675  {
676  m_odd[0][m_ptr/2] = sampleI;
677  m_odd[1][m_ptr/2] = sampleQ;
678  m_odd[0][m_ptr/2 + m_size] = sampleI;
679  m_odd[1][m_ptr/2 + m_size] = sampleQ;
680  }
681  }
int32_t m_even[2][HBFIRFilterTraits< HBFilterOrder >::hbOrder]
int32_t m_odd[2][HBFIRFilterTraits< HBFilterOrder >::hbOrder]
+ Here is the caller graph for this function:

◆ storeSample32()

template<uint32_t HBFilterOrder>
void IntHalfbandFilterEO1< HBFilterOrder >::storeSample32 ( int32_t  x,
int32_t  y 
)
inlineprotected

Definition at line 683 of file inthalfbandfiltereo1.h.

References IntHalfbandFilterEO1< HBFilterOrder >::m_size.

Referenced by IntHalfbandFilterEO1< HBFilterOrder >::myDecimate(), IntHalfbandFilterEO1< HBFilterOrder >::myInterpolateZeroStuffing(), and IntHalfbandFilterEO1< HBFilterOrder >::workDecimateCenter().

684  {
685  if ((m_ptr % 2) == 0)
686  {
687  m_even[0][m_ptr/2] = x;
688  m_even[1][m_ptr/2] = y;
689  m_even[0][m_ptr/2 + m_size] = x;
690  m_even[1][m_ptr/2 + m_size] = y;
691  }
692  else
693  {
694  m_odd[0][m_ptr/2] = x;
695  m_odd[1][m_ptr/2] = y;
696  m_odd[0][m_ptr/2 + m_size] = x;
697  m_odd[1][m_ptr/2 + m_size] = y;
698  }
699  }
int32_t m_even[2][HBFIRFilterTraits< HBFilterOrder >::hbOrder]
int32_t m_odd[2][HBFIRFilterTraits< HBFilterOrder >::hbOrder]
+ Here is the caller graph for this function:

◆ workDecimateCenter() [1/2]

template<uint32_t HBFilterOrder>
bool IntHalfbandFilterEO1< HBFilterOrder >::workDecimateCenter ( Sample sample)
inline

Definition at line 38 of file inthalfbandfiltereo1.h.

References IntHalfbandFilterEO1< HBFilterOrder >::advancePointer(), IntHalfbandFilterEO1< HBFilterOrder >::doFIR(), Sample::imag(), IntHalfbandFilterEO1< HBFilterOrder >::m_state, Sample::real(), and IntHalfbandFilterEO1< HBFilterOrder >::storeSample().

39  {
40  // insert sample into ring-buffer
41  storeSample((FixReal) sample->real(), (FixReal) sample->imag());
42 
43  switch(m_state)
44  {
45  case 0:
46  // advance write-pointer
48  // next state
49  m_state = 1;
50  // tell caller we don't have a new sample
51  return false;
52 
53  default:
54  // save result
55  doFIR(sample);
56  // advance write-pointer
58  // next state
59  m_state = 0;
60 
61  // tell caller we have a new sample
62  return true;
63  }
64  }
void storeSample(const FixReal &sampleI, const FixReal &sampleQ)
void doFIR(Sample *sample)
FixReal real() const
Definition: dsptypes.h:61
FixReal imag() const
Definition: dsptypes.h:62
qint16 FixReal
Definition: dsptypes.h:35
+ Here is the call graph for this function:

◆ workDecimateCenter() [2/2]

template<uint32_t HBFilterOrder>
bool IntHalfbandFilterEO1< HBFilterOrder >::workDecimateCenter ( int32_t x,
int32_t y 
)
inline

Definition at line 131 of file inthalfbandfiltereo1.h.

References IntHalfbandFilterEO1< HBFilterOrder >::advancePointer(), IntHalfbandFilterEO1< HBFilterOrder >::doFIR(), IntHalfbandFilterEO1< HBFilterOrder >::m_state, and IntHalfbandFilterEO1< HBFilterOrder >::storeSample32().

132  {
133  // insert sample into ring-buffer
134  storeSample32(*x, *y);
135 
136  switch(m_state)
137  {
138  case 0:
139  // advance write-pointer
140  advancePointer();
141  // next state
142  m_state = 1;
143  // tell caller we don't have a new sample
144  return false;
145 
146  default:
147  // save result
148  doFIR(x, y);
149  // advance write-pointer
150  advancePointer();
151  // next state
152  m_state = 0;
153  // tell caller we have a new sample
154  return true;
155  }
156  }
void doFIR(Sample *sample)
void storeSample32(int32_t x, int32_t y)
+ Here is the call graph for this function:

◆ workDecimateLowerHalf()

template<uint32_t HBFilterOrder>
bool IntHalfbandFilterEO1< HBFilterOrder >::workDecimateLowerHalf ( Sample sample)
inline

Definition at line 159 of file inthalfbandfiltereo1.h.

References IntHalfbandFilterEO1< HBFilterOrder >::advancePointer(), IntHalfbandFilterEO1< HBFilterOrder >::doFIR(), Sample::imag(), IntHalfbandFilterEO1< HBFilterOrder >::m_state, Sample::real(), and IntHalfbandFilterEO1< HBFilterOrder >::storeSample().

160  {
161  switch(m_state)
162  {
163  case 0:
164  // insert sample into ring-buffer
165  storeSample((FixReal) -sample->imag(), (FixReal) sample->real());
166  // advance write-pointer
167  advancePointer();
168  // next state
169  m_state = 1;
170  // tell caller we don't have a new sample
171  return false;
172 
173  case 1:
174  // insert sample into ring-buffer
175  storeSample((FixReal) -sample->real(), (FixReal) -sample->imag());
176  // save result
177  doFIR(sample);
178  // advance write-pointer
179  advancePointer();
180  // next state
181  m_state = 2;
182  // tell caller we have a new sample
183  return true;
184 
185  case 2:
186  // insert sample into ring-buffer
187  storeSample((FixReal) sample->imag(), (FixReal) -sample->real());
188  // advance write-pointer
189  advancePointer();
190  // next state
191  m_state = 3;
192  // tell caller we don't have a new sample
193  return false;
194 
195  default:
196  // insert sample into ring-buffer
197  storeSample((FixReal) sample->real(), (FixReal) sample->imag());
198  // save result
199  doFIR(sample);
200  // advance write-pointer
201  advancePointer();
202  // next state
203  m_state = 0;
204  // tell caller we have a new sample
205  return true;
206  }
207  }
void storeSample(const FixReal &sampleI, const FixReal &sampleQ)
void doFIR(Sample *sample)
FixReal real() const
Definition: dsptypes.h:61
FixReal imag() const
Definition: dsptypes.h:62
qint16 FixReal
Definition: dsptypes.h:35
+ Here is the call graph for this function:

◆ workDecimateUpperHalf()

template<uint32_t HBFilterOrder>
bool IntHalfbandFilterEO1< HBFilterOrder >::workDecimateUpperHalf ( Sample sample)
inline

Definition at line 358 of file inthalfbandfiltereo1.h.

References IntHalfbandFilterEO1< HBFilterOrder >::advancePointer(), IntHalfbandFilterEO1< HBFilterOrder >::doFIR(), Sample::imag(), IntHalfbandFilterEO1< HBFilterOrder >::m_state, Sample::real(), and IntHalfbandFilterEO1< HBFilterOrder >::storeSample().

359  {
360  switch(m_state)
361  {
362  case 0:
363  // insert sample into ring-buffer
364  storeSample((FixReal) sample->imag(), (FixReal) -sample->real());
365  // advance write-pointer
366  advancePointer();
367  // next state
368  m_state = 1;
369  // tell caller we don't have a new sample
370  return false;
371 
372  case 1:
373  // insert sample into ring-buffer
374  storeSample((FixReal) -sample->real(), (FixReal) -sample->imag());
375  // save result
376  doFIR(sample);
377  // advance write-pointer
378  advancePointer();
379  // next state
380  m_state = 2;
381  // tell caller we have a new sample
382  return true;
383 
384  case 2:
385  // insert sample into ring-buffer
386  storeSample((FixReal) -sample->imag(), (FixReal) sample->real());
387  // advance write-pointer
388  advancePointer();
389  // next state
390  m_state = 3;
391  // tell caller we don't have a new sample
392  return false;
393 
394  default:
395  // insert sample into ring-buffer
396  storeSample((FixReal) sample->real(), (FixReal) sample->imag());
397  // save result
398  doFIR(sample);
399  // advance write-pointer
400  advancePointer();
401  // next state
402  m_state = 0;
403  // tell caller we have a new sample
404  return true;
405  }
406  }
void storeSample(const FixReal &sampleI, const FixReal &sampleQ)
void doFIR(Sample *sample)
FixReal real() const
Definition: dsptypes.h:61
FixReal imag() const
Definition: dsptypes.h:62
qint16 FixReal
Definition: dsptypes.h:35
+ Here is the call graph for this function:

◆ workInterpolateCenter()

template<uint32_t HBFilterOrder>
bool IntHalfbandFilterEO1< HBFilterOrder >::workInterpolateCenter ( Sample sampleIn,
Sample SampleOut 
)
inline

Optimized upsampler by 2 not calculating FIR with inserted null samples

Definition at line 98 of file inthalfbandfiltereo1.h.

References IntHalfbandFilterEO1< HBFilterOrder >::doInterpolateFIR(), Sample::imag(), IntHalfbandFilterEO1< HBFilterOrder >::m_ptr, IntHalfbandFilterEO1< HBFilterOrder >::m_samples, IntHalfbandFilterEO1< HBFilterOrder >::m_state, Sample::real(), Sample::setImag(), and Sample::setReal().

99  {
100  switch(m_state)
101  {
102  case 0:
103  // return the middle peak
106  m_state = 1; // next state
107  return false; // tell caller we didn't consume the sample
108 
109  default:
110  // calculate with non null samples
111  doInterpolateFIR(SampleOut);
112 
113  // insert sample into ring double buffer
114  m_samples[m_ptr][0] = sampleIn->real();
115  m_samples[m_ptr][1] = sampleIn->imag();
118 
119  // advance pointer
121  m_ptr++;
122  } else {
123  m_ptr = 0;
124  }
125 
126  m_state = 0; // next state
127  return true; // tell caller we consumed the sample
128  }
129  }
void setImag(FixReal v)
Definition: dsptypes.h:59
int32_t m_samples[HBFIRFilterTraits< HBFilterOrder >::hbOrder][2]
void setReal(FixReal v)
Definition: dsptypes.h:58
FixReal real() const
Definition: dsptypes.h:61
FixReal imag() const
Definition: dsptypes.h:62
void doInterpolateFIR(Sample *sample)
+ Here is the call graph for this function:

◆ workInterpolateCenterZeroStuffing()

template<uint32_t HBFilterOrder>
bool IntHalfbandFilterEO1< HBFilterOrder >::workInterpolateCenterZeroStuffing ( Sample sampleIn,
Sample SampleOut 
)
inline

Definition at line 67 of file inthalfbandfiltereo1.h.

References IntHalfbandFilterEO1< HBFilterOrder >::advancePointer(), IntHalfbandFilterEO1< HBFilterOrder >::doFIR(), Sample::imag(), IntHalfbandFilterEO1< HBFilterOrder >::m_state, Sample::real(), and IntHalfbandFilterEO1< HBFilterOrder >::storeSample().

68  {
69  switch(m_state)
70  {
71  case 0:
72  // insert sample into ring-buffer
73  storeSample((FixReal) 0, (FixReal) 0);
74  // save result
75  doFIR(SampleOut);
76  // advance write-pointer
78  // next state
79  m_state = 1;
80  // tell caller we didn't consume the sample
81  return false;
82 
83  default:
84  // insert sample into ring-buffer
85  storeSample((FixReal) sampleIn->real(), (FixReal) sampleIn->imag());
86  // save result
87  doFIR(SampleOut);
88  // advance write-pointer
90  // next state
91  m_state = 0;
92  // tell caller we consumed the sample
93  return true;
94  }
95  }
void storeSample(const FixReal &sampleI, const FixReal &sampleQ)
void doFIR(Sample *sample)
FixReal real() const
Definition: dsptypes.h:61
FixReal imag() const
Definition: dsptypes.h:62
qint16 FixReal
Definition: dsptypes.h:35
+ Here is the call graph for this function:

◆ workInterpolateLowerHalf()

template<uint32_t HBFilterOrder>
bool IntHalfbandFilterEO1< HBFilterOrder >::workInterpolateLowerHalf ( Sample sampleIn,
Sample sampleOut 
)
inline

Optimized upsampler by 2 not calculating FIR with inserted null samples

Definition at line 291 of file inthalfbandfiltereo1.h.

References IntHalfbandFilterEO1< HBFilterOrder >::doInterpolateFIR(), Sample::imag(), IntHalfbandFilterEO1< HBFilterOrder >::m_ptr, IntHalfbandFilterEO1< HBFilterOrder >::m_samples, IntHalfbandFilterEO1< HBFilterOrder >::m_state, Sample::real(), Sample::setImag(), and Sample::setReal().

292  {
293  Sample s;
294 
295  switch(m_state)
296  {
297  case 0:
298  // return the middle peak
299  sampleOut->setReal(m_samples[m_ptr + (HBFIRFilterTraits<HBFilterOrder>::hbOrder/4) - 1][1]); // imag
300  sampleOut->setImag(-m_samples[m_ptr + (HBFIRFilterTraits<HBFilterOrder>::hbOrder/4) - 1][0]); // - real
301  m_state = 1; // next state
302  return false; // tell caller we didn't consume the sample
303 
304  case 1:
305  // calculate with non null samples
306  doInterpolateFIR(&s);
307  sampleOut->setReal(-s.real());
308  sampleOut->setImag(-s.imag());
309 
310  // insert sample into ring double buffer
311  m_samples[m_ptr][0] = sampleIn->real();
312  m_samples[m_ptr][1] = sampleIn->imag();
315 
316  // advance pointer
318  m_ptr++;
319  } else {
320  m_ptr = 0;
321  }
322 
323  m_state = 2; // next state
324  return true; // tell caller we consumed the sample
325 
326  case 2:
327  // return the middle peak
328  sampleOut->setReal(-m_samples[m_ptr + (HBFIRFilterTraits<HBFilterOrder>::hbOrder/4) - 1][1]); // - imag
329  sampleOut->setImag(m_samples[m_ptr + (HBFIRFilterTraits<HBFilterOrder>::hbOrder/4) - 1][0]); // real
330  m_state = 3; // next state
331  return false; // tell caller we didn't consume the sample
332 
333  default:
334  // calculate with non null samples
335  doInterpolateFIR(&s);
336  sampleOut->setReal(s.real());
337  sampleOut->setImag(s.imag());
338 
339  // insert sample into ring double buffer
340  m_samples[m_ptr][0] = sampleIn->real();
341  m_samples[m_ptr][1] = sampleIn->imag();
344 
345  // advance pointer
347  m_ptr++;
348  } else {
349  m_ptr = 0;
350  }
351 
352  m_state = 0; // next state
353  return true; // tell caller we consumed the sample
354  }
355  }
void setImag(FixReal v)
Definition: dsptypes.h:59
int32_t m_samples[HBFIRFilterTraits< HBFilterOrder >::hbOrder][2]
void setReal(FixReal v)
Definition: dsptypes.h:58
FixReal real() const
Definition: dsptypes.h:61
FixReal imag() const
Definition: dsptypes.h:62
void doInterpolateFIR(Sample *sample)
+ Here is the call graph for this function:

◆ workInterpolateLowerHalfZeroStuffing()

template<uint32_t HBFilterOrder>
bool IntHalfbandFilterEO1< HBFilterOrder >::workInterpolateLowerHalfZeroStuffing ( Sample sampleIn,
Sample sampleOut 
)
inline

Definition at line 210 of file inthalfbandfiltereo1.h.

References IntHalfbandFilterEO1< HBFilterOrder >::advancePointer(), IntHalfbandFilterEO1< HBFilterOrder >::doFIR(), Sample::imag(), IntHalfbandFilterEO1< HBFilterOrder >::m_state, Sample::real(), Sample::setImag(), Sample::setReal(), and IntHalfbandFilterEO1< HBFilterOrder >::storeSample().

211  {
212  Sample s;
213 
214  switch(m_state)
215  {
216  case 0:
217  // insert sample into ring-buffer
218  storeSample((FixReal) 0, (FixReal) 0);
219 
220  // save result
221  doFIR(&s);
222  sampleOut->setReal(s.imag());
223  sampleOut->setImag(-s.real());
224 
225  // advance write-pointer
226  advancePointer();
227 
228  // next state
229  m_state = 1;
230 
231  // tell caller we didn't consume the sample
232  return false;
233 
234  case 1:
235  // insert sample into ring-buffer
236  storeSample((FixReal) sampleIn->real(), (FixReal) sampleIn->imag());
237 
238  // save result
239  doFIR(&s);
240  sampleOut->setReal(-s.real());
241  sampleOut->setImag(-s.imag());
242 
243  // advance write-pointer
244  advancePointer();
245 
246  // next state
247  m_state = 2;
248 
249  // tell caller we consumed the sample
250  return true;
251 
252  case 2:
253  // insert sample into ring-buffer
254  storeSample((FixReal) 0, (FixReal) 0);
255 
256  // save result
257  doFIR(&s);
258  sampleOut->setReal(-s.imag());
259  sampleOut->setImag(s.real());
260 
261  // advance write-pointer
262  advancePointer();
263 
264  // next state
265  m_state = 3;
266 
267  // tell caller we didn't consume the sample
268  return false;
269 
270  default:
271  // insert sample into ring-buffer
272  storeSample((FixReal) sampleIn->real(), (FixReal) sampleIn->imag());
273 
274  // save result
275  doFIR(&s);
276  sampleOut->setReal(s.real());
277  sampleOut->setImag(s.imag());
278 
279  // advance write-pointer
280  advancePointer();
281 
282  // next state
283  m_state = 0;
284 
285  // tell caller we consumed the sample
286  return true;
287  }
288  }
void storeSample(const FixReal &sampleI, const FixReal &sampleQ)
void doFIR(Sample *sample)
void setImag(FixReal v)
Definition: dsptypes.h:59
void setReal(FixReal v)
Definition: dsptypes.h:58
FixReal real() const
Definition: dsptypes.h:61
FixReal imag() const
Definition: dsptypes.h:62
qint16 FixReal
Definition: dsptypes.h:35
+ Here is the call graph for this function:

◆ workInterpolateUpperHalf()

template<uint32_t HBFilterOrder>
bool IntHalfbandFilterEO1< HBFilterOrder >::workInterpolateUpperHalf ( Sample sampleIn,
Sample sampleOut 
)
inline

Optimized upsampler by 2 not calculating FIR with inserted null samples

Definition at line 490 of file inthalfbandfiltereo1.h.

References IntHalfbandFilterEO1< HBFilterOrder >::doInterpolateFIR(), Sample::imag(), IntHalfbandFilterEO1< HBFilterOrder >::m_ptr, IntHalfbandFilterEO1< HBFilterOrder >::m_samples, IntHalfbandFilterEO1< HBFilterOrder >::m_state, Sample::real(), Sample::setImag(), and Sample::setReal().

491  {
492  Sample s;
493 
494  switch(m_state)
495  {
496  case 0:
497  // return the middle peak
498  sampleOut->setReal(-m_samples[m_ptr + (HBFIRFilterTraits<HBFilterOrder>::hbOrder/4) - 1][1]); // - imag
499  sampleOut->setImag(m_samples[m_ptr + (HBFIRFilterTraits<HBFilterOrder>::hbOrder/4) - 1][0]); // + real
500  m_state = 1; // next state
501  return false; // tell caller we didn't consume the sample
502 
503  case 1:
504  // calculate with non null samples
505  doInterpolateFIR(&s);
506  sampleOut->setReal(-s.real());
507  sampleOut->setImag(-s.imag());
508 
509  // insert sample into ring double buffer
510  m_samples[m_ptr][0] = sampleIn->real();
511  m_samples[m_ptr][1] = sampleIn->imag();
514 
515  // advance pointer
517  m_ptr++;
518  } else {
519  m_ptr = 0;
520  }
521 
522  m_state = 2; // next state
523  return true; // tell caller we consumed the sample
524 
525  case 2:
526  // return the middle peak
527  sampleOut->setReal(m_samples[m_ptr + (HBFIRFilterTraits<HBFilterOrder>::hbOrder/4) - 1][1]); // + imag
528  sampleOut->setImag(-m_samples[m_ptr + (HBFIRFilterTraits<HBFilterOrder>::hbOrder/4) - 1][0]); // - real
529  m_state = 3; // next state
530  return false; // tell caller we didn't consume the sample
531 
532  default:
533  // calculate with non null samples
534  doInterpolateFIR(&s);
535  sampleOut->setReal(s.real());
536  sampleOut->setImag(s.imag());
537 
538  // insert sample into ring double buffer
539  m_samples[m_ptr][0] = sampleIn->real();
540  m_samples[m_ptr][1] = sampleIn->imag();
543 
544  // advance pointer
546  m_ptr++;
547  } else {
548  m_ptr = 0;
549  }
550 
551  m_state = 0; // next state
552  return true; // tell caller we consumed the sample
553  }
554  }
void setImag(FixReal v)
Definition: dsptypes.h:59
int32_t m_samples[HBFIRFilterTraits< HBFilterOrder >::hbOrder][2]
void setReal(FixReal v)
Definition: dsptypes.h:58
FixReal real() const
Definition: dsptypes.h:61
FixReal imag() const
Definition: dsptypes.h:62
void doInterpolateFIR(Sample *sample)
+ Here is the call graph for this function:

◆ workInterpolateUpperHalfZeroStuffing()

template<uint32_t HBFilterOrder>
bool IntHalfbandFilterEO1< HBFilterOrder >::workInterpolateUpperHalfZeroStuffing ( Sample sampleIn,
Sample sampleOut 
)
inline

Definition at line 409 of file inthalfbandfiltereo1.h.

References IntHalfbandFilterEO1< HBFilterOrder >::advancePointer(), IntHalfbandFilterEO1< HBFilterOrder >::doFIR(), Sample::imag(), IntHalfbandFilterEO1< HBFilterOrder >::m_state, Sample::real(), Sample::setImag(), Sample::setReal(), and IntHalfbandFilterEO1< HBFilterOrder >::storeSample().

410  {
411  Sample s;
412 
413  switch(m_state)
414  {
415  case 0:
416  // insert sample into ring-buffer
417  storeSample((FixReal) 0, (FixReal) 0);
418 
419  // save result
420  doFIR(&s);
421  sampleOut->setReal(-s.imag());
422  sampleOut->setImag(s.real());
423 
424  // advance write-pointer
425  advancePointer();
426 
427  // next state
428  m_state = 1;
429 
430  // tell caller we didn't consume the sample
431  return false;
432 
433  case 1:
434  // insert sample into ring-buffer
435  storeSample((FixReal) sampleIn->real(), (FixReal) sampleIn->imag());
436 
437  // save result
438  doFIR(&s);
439  sampleOut->setReal(-s.real());
440  sampleOut->setImag(-s.imag());
441 
442  // advance write-pointer
443  advancePointer();
444 
445  // next state
446  m_state = 2;
447 
448  // tell caller we consumed the sample
449  return true;
450 
451  case 2:
452  // insert sample into ring-buffer
453  storeSample((FixReal) 0, (FixReal) 0);
454 
455  // save result
456  doFIR(&s);
457  sampleOut->setReal(s.imag());
458  sampleOut->setImag(-s.real());
459 
460  // advance write-pointer
461  advancePointer();
462 
463  // next state
464  m_state = 3;
465 
466  // tell caller we didn't consume the sample
467  return false;
468 
469  default:
470  // insert sample into ring-buffer
471  storeSample((FixReal) sampleIn->real(), (FixReal) sampleIn->imag());
472 
473  // save result
474  doFIR(&s);
475  sampleOut->setReal(s.real());
476  sampleOut->setImag(s.imag());
477 
478  // advance write-pointer
479  advancePointer();
480 
481  // next state
482  m_state = 0;
483 
484  // tell caller we consumed the sample
485  return true;
486  }
487  }
void storeSample(const FixReal &sampleI, const FixReal &sampleQ)
void doFIR(Sample *sample)
void setImag(FixReal v)
Definition: dsptypes.h:59
void setReal(FixReal v)
Definition: dsptypes.h:58
FixReal real() const
Definition: dsptypes.h:61
FixReal imag() const
Definition: dsptypes.h:62
qint16 FixReal
Definition: dsptypes.h:35
+ Here is the call graph for this function:

Member Data Documentation

◆ m_even

template<uint32_t HBFilterOrder>
int32_t IntHalfbandFilterEO1< HBFilterOrder >::m_even[2][HBFIRFilterTraits< HBFilterOrder >::hbOrder]
protected

◆ m_odd

template<uint32_t HBFilterOrder>
int32_t IntHalfbandFilterEO1< HBFilterOrder >::m_odd[2][HBFIRFilterTraits< HBFilterOrder >::hbOrder]
protected

◆ m_ptr

template<uint32_t HBFilterOrder>
int IntHalfbandFilterEO1< HBFilterOrder >::m_ptr
protected

◆ m_samples

template<uint32_t HBFilterOrder>
int32_t IntHalfbandFilterEO1< HBFilterOrder >::m_samples[HBFIRFilterTraits< HBFilterOrder >::hbOrder][2]
protected

◆ m_size

template<uint32_t HBFilterOrder>
int IntHalfbandFilterEO1< HBFilterOrder >::m_size
protected

◆ m_state

template<uint32_t HBFilterOrder>
int IntHalfbandFilterEO1< HBFilterOrder >::m_state
protected

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