From 362ade3892f40ee1b0360f3af1ab013a6ef32e5e Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Fri, 28 Dec 2012 14:12:18 -0500 Subject: [PATCH] Fix FS#12794 - new EQ code does not compile for the Nokia N8x0 The old GCC version currently required (sbox-arm-linux-gcc 3.4.4 release) apparently has trouble with function pointers used as static array initializers when using indexed initializers + ranges (ie. [A ... B] = fn). Change-Id: I494c2b607e4d93a9893264749d0ac257fb54ce3b --- lib/rbcodec/dsp/eq.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) 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)