diff options
author | Chris Robinson <[email protected]> | 2016-03-22 14:42:53 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2016-03-22 14:42:53 -0700 |
commit | 0a03596af11570f5dba473c93c67c59d285d7bc2 (patch) | |
tree | 58ef6dea7203199eba6898972e553e7ad9c8bb20 /Alc | |
parent | 3877545d8c18df7b04771e790e5faf751eb51495 (diff) |
Simplify setting the matrix coeffs
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/bformatdec.c | 56 |
1 files changed, 14 insertions, 42 deletions
diff --git a/Alc/bformatdec.c b/Alc/bformatdec.c index fff693bc..f5a8e8c4 100644 --- a/Alc/bformatdec.c +++ b/Alc/bformatdec.c @@ -183,30 +183,16 @@ void bformatdec_reset(BFormatDec *dec, const AmbDecConf *conf, ALuint chancount, { ALuint chan = chanmap[i]; ALuint j, k = 0; + ALfloat gain; - for(j = 0;j < 1;j++) + for(j = 0;j < MAX_AMBI_COEFFS;j++) { + if(j == 0) gain = conf->LFOrderGain[0] / ratio; + else if(j == 1) gain = conf->LFOrderGain[1] / ratio; + else if(j == 4) gain = conf->LFOrderGain[2] / ratio; + else if(j == 9) gain = conf->LFOrderGain[3] / ratio; if((conf->ChanMask&(1<<j))) - dec->MatrixLF[chan][j] = conf->LFMatrix[i][k++] / coeff_scale[j] * - conf->LFOrderGain[0] / ratio; - } - for(;j < 4;j++) - { - if((conf->ChanMask&(1<<j))) - dec->MatrixLF[chan][j] = conf->LFMatrix[i][k++] / coeff_scale[j] * - conf->LFOrderGain[1] / ratio; - } - for(;j < 9;j++) - { - if((conf->ChanMask&(1<<j))) - dec->MatrixLF[chan][j] = conf->LFMatrix[i][k++] / coeff_scale[j] * - conf->LFOrderGain[2] / ratio; - } - for(;j < 16;j++) - { - if((conf->ChanMask&(1<<j))) - dec->MatrixLF[chan][j] = conf->LFMatrix[i][k++] / coeff_scale[j] * - conf->LFOrderGain[3] / ratio; + dec->MatrixLF[chan][j] = conf->LFMatrix[i][k++] / coeff_scale[j] * gain; } } } @@ -216,30 +202,16 @@ void bformatdec_reset(BFormatDec *dec, const AmbDecConf *conf, ALuint chancount, { ALuint chan = chanmap[i]; ALuint j, k = 0; + ALfloat gain; - for(j = 0;j < 1;j++) - { - if((conf->ChanMask&(1<<j))) - dec->MatrixHF[chan][j] = conf->HFMatrix[i][k++] / coeff_scale[j] * - conf->HFOrderGain[0] * ratio; - } - for(;j < 4;j++) - { - if((conf->ChanMask&(1<<j))) - dec->MatrixHF[chan][j] = conf->HFMatrix[i][k++] / coeff_scale[j] * - conf->HFOrderGain[1] * ratio; - } - for(;j < 9;j++) - { - if((conf->ChanMask&(1<<j))) - dec->MatrixHF[chan][j] = conf->HFMatrix[i][k++] / coeff_scale[j] * - conf->HFOrderGain[2] * ratio; - } - for(;j < 16;j++) + for(j = 0;j < MAX_AMBI_COEFFS;j++) { + if(j == 0) gain = conf->HFOrderGain[0] * ratio; + else if(j == 1) gain = conf->HFOrderGain[1] * ratio; + else if(j == 4) gain = conf->HFOrderGain[2] * ratio; + else if(j == 9) gain = conf->HFOrderGain[3] * ratio; if((conf->ChanMask&(1<<j))) - dec->MatrixHF[chan][j] = conf->HFMatrix[i][k++] / coeff_scale[j] * - conf->HFOrderGain[3] * ratio; + dec->MatrixHF[chan][j] = conf->HFMatrix[i][k++] / coeff_scale[j] * gain; } } } |