Skip to content

Commit 51233fe

Browse files
committed
EQ FIR: Improve robustness with configuration blobs
This patch prevents an error if the EQ responses to channels mapping table in the configuration blob contains less channels than current number of channels in firmware. Without this check the lookup from blob can go past the table. Reporting an error depended on successive blob content to detect corrupt blob and was not guaranteed. The situation is not changed to stop to error but instead extrapolate the table by applying 1st channel EQ for additional channels. It e.g. helps to duplicate mono effect EQ to all channels without need to make blobs with mapping to match max. channels count of SOF. The used response index for each channel can be seen from trace. Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
1 parent 20752b7 commit 51233fe

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

src/audio/eq_fir.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,17 @@ static int eq_fir_setup(struct fir_state_32x16 fir[],
175175
/* Initialize 1st phase */
176176
trace_eq("asr");
177177
for (i = 0; i < nch; i++) {
178-
resp = assign_response[i];
178+
/* If the configuration blob contains less channels for
179+
* response assign to channels than the current channels count
180+
* use the first channel response to remaining channels. E.g.
181+
* a blob that contains just a mono EQ can be used for stereo
182+
* stream by using the same response for all channels.
183+
*/
184+
if (i < config->channels_in_config)
185+
resp = assign_response[i];
186+
else
187+
resp = assign_response[0];
188+
179189
trace_value(resp);
180190
if (resp >= config->number_of_responses || resp < 0) {
181191
trace_eq_error("eas");

0 commit comments

Comments
 (0)