diff options
author | Chris Robinson <[email protected]> | 2016-05-31 10:18:34 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2016-05-31 10:18:34 -0700 |
commit | 5e64882be9ad3e3a1552e41befef5a6216f4ecfe (patch) | |
tree | 47059e787d77c86a0e2575e0d5a1d6b13798b8b4 /Alc/mixer_sse.c | |
parent | 72d2febccbc670843669494fe5bc052839f54294 (diff) |
Use SSE for applying the HQ B-Format decoder matrices
Diffstat (limited to 'Alc/mixer_sse.c')
-rw-r--r-- | Alc/mixer_sse.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/Alc/mixer_sse.c b/Alc/mixer_sse.c index 942e0453..120ac4a0 100644 --- a/Alc/mixer_sse.c +++ b/Alc/mixer_sse.c @@ -260,3 +260,28 @@ void Mix_SSE(const ALfloat *data, ALuint OutChans, ALfloat (*restrict OutBuffer) OutBuffer[c][OutPos+pos] += data[pos]*gain; } } + +void MixRow_SSE(ALfloat *OutBuffer, const ALfloat *Mtx, ALfloat (*restrict data)[BUFFERSIZE], ALuint InChans, ALuint BufferSize) +{ + __m128 gain4; + ALuint c; + + for(c = 0;c < InChans;c++) + { + ALuint pos = 0; + ALfloat gain = Mtx[c]; + if(!(fabsf(gain) > GAIN_SILENCE_THRESHOLD)) + continue; + + gain4 = _mm_set1_ps(gain); + for(;BufferSize-pos > 3;pos += 4) + { + const __m128 val4 = _mm_load_ps(&data[c][pos]); + __m128 dry4 = _mm_load_ps(&OutBuffer[pos]); + dry4 = _mm_add_ps(dry4, _mm_mul_ps(val4, gain4)); + _mm_store_ps(&OutBuffer[pos], dry4); + } + for(;pos < BufferSize;pos++) + OutBuffer[pos] += data[c][pos]*gain; + } +} |