diff options
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/mixer_c.c | 12 | ||||
-rw-r--r-- | Alc/mixer_inc.c | 10 | ||||
-rw-r--r-- | Alc/mixer_neon.c | 19 | ||||
-rw-r--r-- | Alc/mixer_sse.c | 17 |
4 files changed, 52 insertions, 6 deletions
diff --git a/Alc/mixer_c.c b/Alc/mixer_c.c index 0fdcc087..fa87c3d4 100644 --- a/Alc/mixer_c.c +++ b/Alc/mixer_c.c @@ -59,6 +59,18 @@ void ALfilterState_processC(ALfilterState *filter, ALfloat *restrict dst, const } +static inline void SetupCoeffs(ALfloat (*restrict OutCoeffs)[2], + const HrtfParams *hrtfparams, + ALuint IrSize, ALuint Counter) +{ + ALuint c; + for(c = 0;c < IrSize;c++) + { + OutCoeffs[c][0] = hrtfparams->Coeffs[c][0] - (hrtfparams->CoeffStep[c][0]*Counter); + OutCoeffs[c][1] = hrtfparams->Coeffs[c][1] - (hrtfparams->CoeffStep[c][1]*Counter); + } +} + static inline void ApplyCoeffsStep(ALuint Offset, ALfloat (*restrict Values)[2], const ALuint IrSize, ALfloat (*restrict Coeffs)[2], diff --git a/Alc/mixer_inc.c b/Alc/mixer_inc.c index b4635b43..63003f03 100644 --- a/Alc/mixer_inc.c +++ b/Alc/mixer_inc.c @@ -14,6 +14,9 @@ #define MixHrtf MERGE(MixHrtf_,SUFFIX) +static inline void SetupCoeffs(ALfloat (*restrict OutCoeffs)[2], + const HrtfParams *hrtfparams, + ALuint IrSize, ALuint Counter); static inline void ApplyCoeffsStep(ALuint Offset, ALfloat (*restrict Values)[2], const ALuint irSize, ALfloat (*restrict Coeffs)[2], @@ -33,13 +36,8 @@ void MixHrtf(ALfloat (*restrict OutBuffer)[BUFFERSIZE], const ALfloat *data, ALuint Delay[2]; ALfloat left, right; ALuint pos; - ALuint c; - for(c = 0;c < IrSize;c++) - { - Coeffs[c][0] = hrtfparams->Coeffs[c][0] - (hrtfparams->CoeffStep[c][0]*Counter); - Coeffs[c][1] = hrtfparams->Coeffs[c][1] - (hrtfparams->CoeffStep[c][1]*Counter); - } + SetupCoeffs(Coeffs, hrtfparams, IrSize, Counter); Delay[0] = hrtfparams->Delay[0] - (hrtfparams->DelayStep[0]*Counter); Delay[1] = hrtfparams->Delay[1] - (hrtfparams->DelayStep[1]*Counter); diff --git a/Alc/mixer_neon.c b/Alc/mixer_neon.c index 8ce17644..a068d02b 100644 --- a/Alc/mixer_neon.c +++ b/Alc/mixer_neon.c @@ -9,6 +9,25 @@ #include "hrtf.h" +static inline void SetupCoeffs(ALfloat (*restrict OutCoeffs)[2], + const HrtfParams *hrtfparams, + ALuint IrSize, ALuint Counter) +{ + ALuint c; + float32x4_t counter4; + { + float32x2_t counter2 = vdup_n_f32(-(float)Counter); + counter4 = vcombine_f32(counter2, counter2); + } + for(c = 0;c < IrSize;c += 2) + { + float32x4_t step4 = vld1q_f32((float32_t*)hrtfparams->CoeffStep[c]); + float32x4_t coeffs = vld1q_f32((float32_t*)hrtfparams->Coeffs[c]); + coeffs = vmlaq_f32(coeffs, step4, counter4); + vst1q_f32((float32_t*)OutCoeffs[c], coeffs); + } +} + static inline void ApplyCoeffsStep(ALuint Offset, ALfloat (*restrict Values)[2], const ALuint IrSize, ALfloat (*restrict Coeffs)[2], diff --git a/Alc/mixer_sse.c b/Alc/mixer_sse.c index d86cf749..75f50f88 100644 --- a/Alc/mixer_sse.c +++ b/Alc/mixer_sse.c @@ -19,6 +19,23 @@ #include "mixer_defs.h" +static inline void SetupCoeffs(ALfloat (*restrict OutCoeffs)[2], + const HrtfParams *hrtfparams, + ALuint IrSize, ALuint Counter) +{ + const __m128 counter4 = _mm_set1_ps((float)Counter); + __m128 coeffs, step4; + ALuint i; + + for(i = 0;i < IrSize;i += 2) + { + step4 = _mm_load_ps(&hrtfparams->CoeffStep[i][0]); + coeffs = _mm_load_ps(&hrtfparams->Coeffs[i][0]); + coeffs = _mm_sub_ps(coeffs, _mm_mul_ps(step4, counter4)); + _mm_store_ps(&OutCoeffs[i][0], coeffs); + } +} + static inline void ApplyCoeffsStep(ALuint Offset, ALfloat (*restrict Values)[2], const ALuint IrSize, ALfloat (*restrict Coeffs)[2], |