diff --git a/lib/rbcodec/dsp/eq.c b/lib/rbcodec/dsp/eq.c index a9e200f786..2e4b9af37b 100644 --- a/lib/rbcodec/dsp/eq.c +++ b/lib/rbcodec/dsp/eq.c @@ -71,15 +71,6 @@ void dsp_set_eq_precut(int precut) /* Update the filter configuration for the band */ void dsp_set_eq_coefs(int band, const struct eq_band_setting *setting) { - static void (* const coef_gen[EQ_NUM_BANDS])(unsigned long cutoff, - unsigned long Q, long db, - struct dsp_filter *f) = - { - [0] = filter_ls_coefs, - [1 ... EQ_NUM_BANDS-2] = filter_pk_coefs, - [EQ_NUM_BANDS-1] = filter_hs_coefs, - }; - if (band < 0 || band >= EQ_NUM_BANDS) return; @@ -98,8 +89,17 @@ void dsp_set_eq_coefs(int band, const struct eq_band_setting *setting) /* Convert user settings to format required by coef generator functions */ - coef_gen[band](0xffffffff / NATIVE_FREQUENCY * setting->cutoff, - setting->q ?: 1, setting->gain, filter); + void (* coef_gen)(unsigned long cutoff, unsigned long Q, long db, + struct dsp_filter *f) = filter_pk_coefs; + + /* Only first and last bands are not peaking filters */ + if (band == 0) + coef_gen = filter_ls_coefs; + else if (band == EQ_NUM_BANDS-1) + coef_gen = filter_hs_coefs; + + coef_gen(0xffffffff / NATIVE_FREQUENCY * setting->cutoff, + setting->q ?: 1, setting->gain, filter); } if (mask == eq_data.enabled)