aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-12-16 22:37:29 -0800
committerChris Robinson <[email protected]>2018-12-16 22:37:29 -0800
commita359cb85e600f1b8853ec0b77496cf626f93d3a3 (patch)
tree5cd71f215243c1f87e6770fc8f8e6f13237aa51c /Alc
parent3b0fd20bee855bbd7075b34e32f2272f71e28462 (diff)
Mix each frequency band individually for ambisonic upsampling
Diffstat (limited to 'Alc')
-rw-r--r--Alc/bformatdec.cpp13
-rw-r--r--Alc/bformatdec.h2
2 files changed, 7 insertions, 8 deletions
diff --git a/Alc/bformatdec.cpp b/Alc/bformatdec.cpp
index ee3d977e..db374c8a 100644
--- a/Alc/bformatdec.cpp
+++ b/Alc/bformatdec.cpp
@@ -270,22 +270,21 @@ void AmbiUpsampler::reset(const ALCdevice *device)
ALdouble gain{0.0};
for(size_t k{0u};k < COUNTOF(Ambi3DDecoder);k++)
gain += (ALdouble)Ambi3DDecoder[k][i] * encgains[k][j];
- mGains[i][j][HF_BAND] = (ALfloat)(gain * Ambi3DDecoderHFScale[i]);
- mGains[i][j][LF_BAND] = (ALfloat)gain;
+ mGains[i][HF_BAND][j] = (ALfloat)(gain * Ambi3DDecoderHFScale[i]);
+ mGains[i][LF_BAND][j] = (ALfloat)gain;
}
}
}
void AmbiUpsampler::process(ALfloat (*RESTRICT OutBuffer)[BUFFERSIZE], const ALsizei OutChannels, const ALfloat (*RESTRICT InSamples)[BUFFERSIZE], const ALsizei SamplesToDo)
{
- ASSUME(OutChannels > 0);
- ASSUME(SamplesToDo > 0);
-
for(ALsizei i{0};i < 4;i++)
{
mXOver[i].process(mSamples[HF_BAND], mSamples[LF_BAND], InSamples[i], SamplesToDo);
- for(ALsizei j{0};j < OutChannels;j++)
- MixRowSamples(OutBuffer[j], mGains[i][j].data(), mSamples, sNumBands, 0, SamplesToDo);
+ MixSamples(mSamples[HF_BAND], OutChannels, OutBuffer, mGains[i][HF_BAND].data(),
+ mGains[i][HF_BAND].data(), 0, 0, SamplesToDo);
+ MixSamples(mSamples[LF_BAND], OutChannels, OutBuffer, mGains[i][LF_BAND].data(),
+ mGains[i][LF_BAND].data(), 0, 0, SamplesToDo);
}
}
diff --git a/Alc/bformatdec.h b/Alc/bformatdec.h
index c52472b5..14e02b4f 100644
--- a/Alc/bformatdec.h
+++ b/Alc/bformatdec.h
@@ -81,7 +81,7 @@ private:
BandSplitter mXOver[4];
- std::array<std::array<std::array<ALfloat,sNumBands>,MAX_OUTPUT_CHANNELS>,4> mGains;
+ std::array<std::array<std::array<ALfloat,MAX_OUTPUT_CHANNELS>,sNumBands>,4> mGains;
public:
void reset(const ALCdevice *device);