diff options
-rw-r--r-- | Alc/bformatdec.cpp | 25 | ||||
-rw-r--r-- | Alc/bformatdec.h | 4 |
2 files changed, 14 insertions, 15 deletions
diff --git a/Alc/bformatdec.cpp b/Alc/bformatdec.cpp index 089d9465..db95e406 100644 --- a/Alc/bformatdec.cpp +++ b/Alc/bformatdec.cpp @@ -235,23 +235,23 @@ void BFormatDec::upSample(ALfloat (*OutBuffer)[BUFFERSIZE], const ALsizei OutCha * subsequent higher-order decode generating the same response as a first- * order decode. */ - for(ALsizei i{0};i < InChannels;i++) - { - /* NOTE: Because we can't treat the first-order signal as completely - * decorrelated from the existing output (it may contain the reverb, - * echo, etc, portion) phase interference is a possibility if not kept - * coherent. As such, we need to apply an all-pass on the existing - * output so that it stays aligned with the upsampled signal. - */ + + /* NOTE: Because we can't treat the first-order signal as completely + * decorrelated from the existing output (it may contain the reverb, echo, + * etc, portion) phase interference is a possibility if not kept coherent. + * As such, we need to apply an all-pass on the existing output so that it + * stays aligned with the upsampled signal. + */ + for(ALsizei i{0};i < OutChannels;i++) mUpAllpass[i].process(OutBuffer[i], SamplesToDo); + for(ALsizei i{0};i < InChannels;i++) + { mUpsampler[i].Splitter.process(mSamples[sHFBand].data(), mSamples[sLFBand].data(), InSamples[i], SamplesToDo); MixRowSamples(OutBuffer[i], mUpsampler[i].Gains, &reinterpret_cast<ALfloat(&)[BUFFERSIZE]>(mSamples[0]), sNumBands, 0, SamplesToDo); } - for(ALsizei i{InChannels};i < OutChannels;i++) - mUpAllpass[i].process(OutBuffer[i], SamplesToDo); } @@ -292,13 +292,12 @@ void AmbiUpsampler::process(ALfloat (*OutBuffer)[BUFFERSIZE], const ALsizei OutC ASSUME(InChannels > 0); ASSUME(OutChannels > InChannels); + for(ALsizei i{0};i < OutChannels;i++) + mAllpass[i].process(OutBuffer[i], SamplesToDo); for(ALsizei i{0};i < InChannels;i++) { - mAllpass[i].process(OutBuffer[i], SamplesToDo); mInput[i].Splitter.process(mSamples[sHFBand], mSamples[sLFBand], InSamples[i], SamplesToDo); MixRowSamples(OutBuffer[i], mInput[i].Gains, mSamples, sNumBands, 0, SamplesToDo); } - for(ALsizei i{InChannels};i < OutChannels;i++) - mAllpass[i].process(OutBuffer[i], SamplesToDo); } diff --git a/Alc/bformatdec.h b/Alc/bformatdec.h index f807808d..2f7ef612 100644 --- a/Alc/bformatdec.h +++ b/Alc/bformatdec.h @@ -32,11 +32,11 @@ class BFormatDec { std::array<ALfloat,BUFFERSIZE> *mSamplesHF; std::array<ALfloat,BUFFERSIZE> *mSamplesLF; + SplitterAllpass mUpAllpass[MAX_OUTPUT_CHANNELS]; struct { BandSplitter Splitter; ALfloat Gains[sNumBands]; } mUpsampler[4]; - SplitterAllpass mUpAllpass[MAX_OUTPUT_CHANNELS]; ALsizei mNumChannels; ALboolean mDualBand; @@ -64,12 +64,12 @@ class AmbiUpsampler { static constexpr size_t sLFBand{1}; static constexpr size_t sNumBands{2}; + SplitterAllpass mAllpass[MAX_OUTPUT_CHANNELS]; alignas(16) ALfloat mSamples[sNumBands][BUFFERSIZE]; struct { BandSplitter Splitter; ALfloat Gains[sNumBands]; } mInput[4]; - SplitterAllpass mAllpass[MAX_OUTPUT_CHANNELS]; public: void reset(const ALsizei out_order, const ALfloat xover_norm); |