Apply the all-pass separately from the upsampling mix

This commit is contained in:
Chris Robinson
2019-01-08 18:34:45 -08:00
parent edba7da8ab
commit 0763dfa954
2 changed files with 14 additions and 15 deletions
+12 -13
View File
@@ -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);
}
+2 -2
View File
@@ -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);