aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/bformatdec.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2016-03-28 14:50:18 -0700
committerChris Robinson <[email protected]>2016-03-28 14:50:18 -0700
commit34539bc973fc6ee525a4ba21f5653820e62004ae (patch)
tree82cdad979484637344ffe227857722e27776de1e /Alc/bformatdec.c
parent33cd3834ac9b01fb4c2ef9c5497fc9926e8b8d28 (diff)
Skip unused output channels for the HQ decode
Diffstat (limited to 'Alc/bformatdec.c')
-rw-r--r--Alc/bformatdec.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/Alc/bformatdec.c b/Alc/bformatdec.c
index ce489dc1..6dd5ce9a 100644
--- a/Alc/bformatdec.c
+++ b/Alc/bformatdec.c
@@ -167,6 +167,8 @@ static void init_encoder(void)
* single-band decoding
*/
typedef struct BFormatDec {
+ ALboolean Enabled[MAX_OUTPUT_CHANNELS];
+
alignas(16) ALfloat MatrixHF[MAX_OUTPUT_CHANNELS][MAX_AMBI_COEFFS];
alignas(16) ALfloat MatrixLF[MAX_OUTPUT_CHANNELS][MAX_AMBI_COEFFS];
@@ -253,6 +255,11 @@ void bformatdec_reset(BFormatDec *dec, const AmbDecConf *conf, ALuint chancount,
dec->SamplesHF = dec->Samples;
dec->SamplesLF = dec->SamplesHF + dec->NumChannels;
+ for(i = 0;i < MAX_OUTPUT_CHANNELS;i++)
+ dec->Enabled[i] = AL_FALSE;
+ for(i = 0;i < conf->NumSpeakers;i++)
+ dec->Enabled[chanmap[i]] = AL_TRUE;
+
if(conf->CoeffScale == ADS_SN3D)
coeff_scale = SN3D2N3DScale;
else if(conf->CoeffScale == ADS_FuMa)
@@ -423,6 +430,9 @@ void bformatdec_process(struct BFormatDec *dec, ALfloat (*restrict OutBuffer)[BU
for(chan = 0;chan < OutChannels;chan++)
{
+ if(!dec->Enabled[chan])
+ continue;
+
memset(dec->ChannelMix, 0, SamplesToDo*sizeof(ALfloat));
apply_row(dec->ChannelMix, dec->MatrixHF[chan], dec->SamplesHF,
dec->NumChannels, SamplesToDo);
@@ -459,6 +469,9 @@ void bformatdec_process(struct BFormatDec *dec, ALfloat (*restrict OutBuffer)[BU
{
for(chan = 0;chan < OutChannels;chan++)
{
+ if(!dec->Enabled[chan])
+ continue;
+
memset(dec->ChannelMix, 0, SamplesToDo*sizeof(ALfloat));
apply_row(dec->ChannelMix, dec->MatrixHF[chan], InSamples,
dec->NumChannels, SamplesToDo);