From 3479559859be870043a38b48c930840ab862475a Mon Sep 17 00:00:00 2001 From: f4exb Date: Tue, 3 Jan 2017 23:25:20 +0100 Subject: [PATCH] Tx support: optimize final interpolator stages --- sdrbase/dsp/hbfiltertraits.cpp | 12 ++++++++++++ sdrbase/dsp/hbfiltertraits.h | 9 +++++++++ sdrbase/dsp/interpolators.h | 28 +++++++++++++++------------- 3 files changed, 36 insertions(+), 13 deletions(-) diff --git a/sdrbase/dsp/hbfiltertraits.cpp b/sdrbase/dsp/hbfiltertraits.cpp index 61d15f6a9..4d9241239 100644 --- a/sdrbase/dsp/hbfiltertraits.cpp +++ b/sdrbase/dsp/hbfiltertraits.cpp @@ -18,6 +18,18 @@ #include "dsp/hbfiltertraits.h" +const int16_t HBFIRFilterTraits<16>::hbMod[16+6] = { + 15,16,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,0,1,2 +}; + +const int32_t HBFIRFilterTraits<16>::hbCoeffs[4] = { + //* Firwin as in https://www.dsprelated.com/showcode/270.php */ + (int32_t)(-0.0052391810630145274965685509016566356877 * (1 << hbShift)), + (int32_t)(0.0232111017863650750947535073009930783883 * (1 << hbShift)), + (int32_t)(-0.0761058457486735451258397233686991967261 * (1 << hbShift)), + (int32_t)(0.3076987787367443383246268240327481180429 * (1 << hbShift)), +}; + const int16_t HBFIRFilterTraits<32>::hbMod[32+6] = { 31,32,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19, 20,21,22, 23,24,25,26,27,28,29,30,31,32,0,1,2 diff --git a/sdrbase/dsp/hbfiltertraits.h b/sdrbase/dsp/hbfiltertraits.h index 14bbb266c..278f202a2 100644 --- a/sdrbase/dsp/hbfiltertraits.h +++ b/sdrbase/dsp/hbfiltertraits.h @@ -31,6 +31,15 @@ struct HBFIRFilterTraits { }; +template<> +struct HBFIRFilterTraits<16> +{ + static const int32_t hbOrder = 16; + static const int32_t hbShift = 14; + static const int16_t hbMod[16+6]; + static const int32_t hbCoeffs[4] __attribute__ ((aligned (16))); +}; + template<> struct HBFIRFilterTraits<32> { diff --git a/sdrbase/dsp/interpolators.h b/sdrbase/dsp/interpolators.h index a4faae1a3..24f49a5b7 100644 --- a/sdrbase/dsp/interpolators.h +++ b/sdrbase/dsp/interpolators.h @@ -24,7 +24,9 @@ #include "dsp/inthalfbandfilterdb.h" #endif -#define INTERPOLATORS_HB_FILTER_ORDER 64 +#define INTERPOLATORS_HB_FILTER_ORDER_FIRST 64 +#define INTERPOLATORS_HB_FILTER_ORDER_SECOND 32 +#define INTERPOLATORS_HB_FILTER_ORDER_NEXT 16 template struct interpolation_shifts @@ -113,19 +115,19 @@ public: private: #ifdef USE_SSE4_1 - IntHalfbandFilterEO1 m_interpolator2; // 1st stages - IntHalfbandFilterEO1 m_interpolator4; // 2nd stages - IntHalfbandFilterEO1 m_interpolator8; // 3rd stages - IntHalfbandFilterEO1 m_interpolator16; // 4th stages - IntHalfbandFilterEO1 m_interpolator32; // 5th stages - IntHalfbandFilterEO1 m_interpolator64; // 6th stages + IntHalfbandFilterEO1 m_interpolator2; // 1st stages + IntHalfbandFilterEO1 m_interpolator4; // 2nd stages + IntHalfbandFilterEO1 m_interpolator8; // 3rd stages + IntHalfbandFilterEO1 m_interpolator16; // 4th stages + IntHalfbandFilterEO1 m_interpolator32; // 5th stages + IntHalfbandFilterEO1 m_interpolator64; // 6th stages #else - IntHalfbandFilterDB m_interpolator2; // 1st stages - IntHalfbandFilterDB m_interpolator4; // 2nd stages - IntHalfbandFilterDB m_interpolator8; // 3rd stages - IntHalfbandFilterDB m_interpolator16; // 4th stages - IntHalfbandFilterDB m_interpolator32; // 5th stages - IntHalfbandFilterDB m_interpolator64; // 6th stages + IntHalfbandFilterDB m_interpolator2; // 1st stages + IntHalfbandFilterDB m_interpolator4; // 2nd stages + IntHalfbandFilterDB m_interpolator8; // 3rd stages + IntHalfbandFilterDB m_interpolator16; // 4th stages + IntHalfbandFilterDB m_interpolator32; // 5th stages + IntHalfbandFilterDB m_interpolator64; // 6th stages #endif };