aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/mixer/mixer_sse2.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2019-01-23 11:11:41 -0800
committerChris Robinson <[email protected]>2019-01-23 11:11:41 -0800
commit23179d0bcdd27d2b5ab5ddf0e38b180e2d6969e6 (patch)
treef42d1323eada3d1f2a1f9c053eba6d6784a0a1ee /Alc/mixer/mixer_sse2.cpp
parente332ac852892327d913ce8adfbb85bf30c8ccd24 (diff)
Use a template declaration for the resampler functions
Diffstat (limited to 'Alc/mixer/mixer_sse2.cpp')
-rw-r--r--Alc/mixer/mixer_sse2.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/Alc/mixer/mixer_sse2.cpp b/Alc/mixer/mixer_sse2.cpp
index 6408c8f9..2b594d90 100644
--- a/Alc/mixer/mixer_sse2.cpp
+++ b/Alc/mixer/mixer_sse2.cpp
@@ -27,24 +27,25 @@
#include "defs.h"
-const ALfloat *Resample_lerp_SSE2(const InterpState* UNUSED(state),
+template<>
+const ALfloat *Resample_<LerpTag,SSE2Tag>(const InterpState* UNUSED(state),
const ALfloat *RESTRICT src, ALsizei frac, ALint increment,
- ALfloat *RESTRICT dst, ALsizei numsamples)
+ ALfloat *RESTRICT dst, ALsizei dstlen)
{
const __m128i increment4{_mm_set1_epi32(increment*4)};
const __m128 fracOne4{_mm_set1_ps(1.0f/FRACTIONONE)};
const __m128i fracMask4{_mm_set1_epi32(FRACTIONMASK)};
- ASSUME(numsamples > 0);
+ ASSUME(frac > 0);
ASSUME(increment > 0);
- ASSUME(frac >= 0);
+ ASSUME(dstlen >= 0);
alignas(16) ALsizei pos_[4], frac_[4];
InitiatePositionArrays(frac, increment, frac_, pos_, 4);
__m128i frac4{_mm_setr_epi32(frac_[0], frac_[1], frac_[2], frac_[3])};
__m128i pos4{_mm_setr_epi32(pos_[0], pos_[1], pos_[2], pos_[3])};
- const ALsizei todo{numsamples & ~3};
+ const ALsizei todo{dstlen & ~3};
for(ALsizei i{0};i < todo;i += 4)
{
const int pos0{_mm_cvtsi128_si32(_mm_shuffle_epi32(pos4, _MM_SHUFFLE(0, 0, 0, 0)))};
@@ -72,7 +73,7 @@ const ALfloat *Resample_lerp_SSE2(const InterpState* UNUSED(state),
ALsizei pos{_mm_cvtsi128_si32(pos4)};
frac = _mm_cvtsi128_si32(frac4);
- for(ALsizei i{todo};i < numsamples;++i)
+ for(ALsizei i{todo};i < dstlen;++i)
{
dst[i] = lerp(src[pos], src[pos+1], frac * (1.0f/FRACTIONONE));