From 3505e1b0959c942e16c1c8b51f4945ab92804813 Mon Sep 17 00:00:00 2001 From: f4exb Date: Mon, 7 Nov 2016 18:51:32 +0100 Subject: [PATCH] Allow SSE 4.1 optimization on the down channelizer --- sdrbase/dsp/downchannelizer.cpp | 21 +++++++++++++++++++++ sdrbase/dsp/downchannelizer.h | 9 +++++++++ 2 files changed, 30 insertions(+) diff --git a/sdrbase/dsp/downchannelizer.cpp b/sdrbase/dsp/downchannelizer.cpp index b8dd868a4..4adb43628 100644 --- a/sdrbase/dsp/downchannelizer.cpp +++ b/sdrbase/dsp/downchannelizer.cpp @@ -186,6 +186,26 @@ void DownChannelizer::applyConfiguration() } } +#ifdef USE_SSE4_1 +DownChannelizer::FilterStage::FilterStage(Mode mode) : + m_filter(new IntHalfbandFilterEO1), + m_workFunction(0) +{ + switch(mode) { + case ModeCenter: + m_workFunction = &IntHalfbandFilterEO1::workDecimateCenter; + break; + + case ModeLowerHalf: + m_workFunction = &IntHalfbandFilterEO1::workDecimateLowerHalf; + break; + + case ModeUpperHalf: + m_workFunction = &IntHalfbandFilterEO1::workDecimateUpperHalf; + break; + } +} +#else DownChannelizer::FilterStage::FilterStage(Mode mode) : m_filter(new IntHalfbandFilterDB), m_workFunction(0) @@ -204,6 +224,7 @@ DownChannelizer::FilterStage::FilterStage(Mode mode) : break; } } +#endif DownChannelizer::FilterStage::~FilterStage() { diff --git a/sdrbase/dsp/downchannelizer.h b/sdrbase/dsp/downchannelizer.h index f7e84218f..d17810e73 100644 --- a/sdrbase/dsp/downchannelizer.h +++ b/sdrbase/dsp/downchannelizer.h @@ -23,7 +23,11 @@ #include #include "util/export.h" #include "util/message.h" +#ifdef USE_SSE4_1 +#include "dsp/inthalfbandfiltereo1.h" +#else #include "dsp/inthalfbandfilterdb.h" +#endif #define DOWNCHANNELIZER_HB_FILTER_ORDER 48 @@ -69,8 +73,13 @@ protected: ModeUpperHalf }; +#ifdef USE_SSE4_1 + typedef bool (IntHalfbandFilterEO1::*WorkFunction)(Sample* s); + IntHalfbandFilterEO1* m_filter; +#else typedef bool (IntHalfbandFilterDB::*WorkFunction)(Sample* s); IntHalfbandFilterDB* m_filter; +#endif WorkFunction m_workFunction; FilterStage(Mode mode);