1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-15 12:51:49 -05:00

IntHalfbandFilterEO1: simplification for SSE 4.1 only and fix

This commit is contained in:
f4exb 2016-11-07 18:23:59 +01:00
parent 5a9b461d1c
commit fa5030eac4
2 changed files with 8 additions and 50 deletions

View File

@ -516,49 +516,13 @@ protected:
qint32 qAcc = 0; qint32 qAcc = 0;
#ifdef USE_SSE4_1 #ifdef USE_SSE4_1
const __m128i* h = (const __m128i*) HBFIRFilterTraits<HBFilterOrder>::hbCoeffs; IntHalfbandFilterEO1Intrisics<HBFilterOrder>::work(
__m128i sumI = _mm_setzero_si128(); m_ptr,
__m128i sumQ = _mm_setzero_si128(); m_even,
__m128i sa, sb; m_odd,
a -= 3; iAcc,
qAcc
for (int i = 0; i < HBFIRFilterTraits<HBFilterOrder>::hbOrder / 16; i++) );
{
if ((m_ptr % 2) == 0)
{
sa = _mm_shuffle_epi32(_mm_loadu_si128((__m128i*) &(m_even[0][a])), _MM_SHUFFLE(0,1,2,3));
sb = _mm_loadu_si128((__m128i*) &(m_even[0][b]));
sumI = _mm_add_epi32(sumI, _mm_mullo_epi32(_mm_add_epi32(sa, sb), *h));
sa = _mm_shuffle_epi32(_mm_loadu_si128((__m128i*) &(m_even[1][a])), _MM_SHUFFLE(0,1,2,3));
sb = _mm_loadu_si128((__m128i*) &(m_even[1][b]));
sumQ = _mm_add_epi32(sumQ, _mm_mullo_epi32(_mm_add_epi32(sa, sb), *h));
}
else
{
sa = _mm_shuffle_epi32(_mm_loadu_si128((__m128i*) &(m_odd[0][a])), _MM_SHUFFLE(0,1,2,3));
sb = _mm_loadu_si128((__m128i*) &(m_odd[0][b]));
sumI = _mm_add_epi32(sumI, _mm_mullo_epi32(_mm_add_epi32(sa, sb), *h));
sa = _mm_shuffle_epi32(_mm_loadu_si128((__m128i*) &(m_odd[1][a])), _MM_SHUFFLE(0,1,2,3));
sb = _mm_loadu_si128((__m128i*) &(m_odd[1][b]));
sumQ = _mm_add_epi32(sumQ, _mm_mullo_epi32(_mm_add_epi32(sa, sb), *h));
}
a -= 4;
b += 4;
++h;
}
// horizontal add of four 32 bit partial sums
sumI = _mm_add_epi32(sumI, _mm_srli_si128(sumI, 8));
sumI = _mm_add_epi32(sumI, _mm_srli_si128(sumI, 4));
iAcc = _mm_cvtsi128_si32(sumI);
sumQ = _mm_add_epi32(sumQ, _mm_srli_si128(sumQ, 8));
sumQ = _mm_add_epi32(sumQ, _mm_srli_si128(sumQ, 4));
qAcc = _mm_cvtsi128_si32(sumQ);
#else #else
for (int i = 0; i < HBFIRFilterTraits<HBFilterOrder>::hbOrder / 4; i++) for (int i = 0; i < HBFIRFilterTraits<HBFilterOrder>::hbOrder / 4; i++)
{ {

View File

@ -24,12 +24,8 @@
#include <stdint.h> #include <stdint.h>
#if defined(USE_AVX2) #if defined(USE_SSE4_1)
#include <immintrin.h>
#elif defined(USE_SSE4_1)
#include <smmintrin.h> #include <smmintrin.h>
#elif defined(USE_NEON)
#include <arm_neon.h>
#endif #endif
#include "hbfiltertraits.h" #include "hbfiltertraits.h"
@ -94,6 +90,4 @@ public:
} }
}; };
#endif /* SDRBASE_DSP_INTHALFBANDFILTEREO1I_H_ */ #endif /* SDRBASE_DSP_INTHALFBANDFILTEREO1I_H_ */