diff options
author | Chris Robinson <[email protected]> | 2018-12-24 20:44:55 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-12-24 20:44:55 -0800 |
commit | 3b7f668b28dbc5ef156bad9aa79f16b32efb2eb3 (patch) | |
tree | 2e2d609422219894bd74419fb4bc2c60bea38b1b /Alc/bformatdec.cpp | |
parent | fbae41020d8968d0e65af08584df4736b5ed7239 (diff) |
Avoid an intermediate mixing buffer
Diffstat (limited to 'Alc/bformatdec.cpp')
-rw-r--r-- | Alc/bformatdec.cpp | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/Alc/bformatdec.cpp b/Alc/bformatdec.cpp index b22784c1..500cd276 100644 --- a/Alc/bformatdec.cpp +++ b/Alc/bformatdec.cpp @@ -198,10 +198,11 @@ void BFormatDec::reset(const AmbDecConf *conf, ALsizei chancount, ALuint srate, } } -void BFormatDec::process(ALfloat (*RESTRICT OutBuffer)[BUFFERSIZE], const ALsizei OutChannels, const ALfloat (*RESTRICT InSamples)[BUFFERSIZE], const ALsizei SamplesToDo) +void BFormatDec::process(ALfloat (*OutBuffer)[BUFFERSIZE], const ALsizei OutChannels, const ALfloat (*InSamples)[BUFFERSIZE], const ALsizei SamplesToDo) { ASSUME(OutChannels > 0); ASSUME(SamplesToDo > 0); + ASSUME(mNumChannels > 0); if(mDualBand) { @@ -214,18 +215,14 @@ void BFormatDec::process(ALfloat (*RESTRICT OutBuffer)[BUFFERSIZE], const ALsize if(UNLIKELY(!(mEnabled&(1<<chan)))) continue; - std::fill(std::begin(mChannelMix), std::begin(mChannelMix)+SamplesToDo, 0.0f); - MixRowSamples(mChannelMix, mMatrix.Dual[chan][HF_BAND], + MixRowSamples(OutBuffer[chan], mMatrix.Dual[chan][HF_BAND], &reinterpret_cast<ALfloat(&)[BUFFERSIZE]>(mSamplesHF[0]), mNumChannels, 0, SamplesToDo ); - MixRowSamples(mChannelMix, mMatrix.Dual[chan][LF_BAND], + MixRowSamples(OutBuffer[chan], mMatrix.Dual[chan][LF_BAND], &reinterpret_cast<ALfloat(&)[BUFFERSIZE]>(mSamplesLF[0]), mNumChannels, 0, SamplesToDo ); - - std::transform(std::begin(mChannelMix), std::begin(mChannelMix)+SamplesToDo, - OutBuffer[chan], OutBuffer[chan], std::plus<float>()); } } else @@ -235,17 +232,13 @@ void BFormatDec::process(ALfloat (*RESTRICT OutBuffer)[BUFFERSIZE], const ALsize if(UNLIKELY(!(mEnabled&(1<<chan)))) continue; - std::fill(std::begin(mChannelMix), std::begin(mChannelMix)+SamplesToDo, 0.0f); - MixRowSamples(mChannelMix, mMatrix.Single[chan], InSamples, + MixRowSamples(OutBuffer[chan], mMatrix.Single[chan], InSamples, mNumChannels, 0, SamplesToDo); - - std::transform(std::begin(mChannelMix), std::begin(mChannelMix)+SamplesToDo, - OutBuffer[chan], OutBuffer[chan], std::plus<float>()); } } } -void BFormatDec::upSample(ALfloat (*RESTRICT OutBuffer)[BUFFERSIZE], const ALfloat (*RESTRICT InSamples)[BUFFERSIZE], const ALsizei InChannels, const ALsizei SamplesToDo) +void BFormatDec::upSample(ALfloat (*OutBuffer)[BUFFERSIZE], const ALfloat (*InSamples)[BUFFERSIZE], const ALsizei InChannels, const ALsizei SamplesToDo) { ASSUME(InChannels > 0); ASSUME(SamplesToDo > 0); |