Skip to content

Commit

Permalink
Audio: Multiband DRC: Switch to HiFi5 optimized IIR DF1 type
Browse files Browse the repository at this point in the history
The direct-form I (DF1) is compatible with direct-form-transposed
(DF2T). The filter type is changed since DF1 is better potential
for optimization for SIMD.

In a build for a HiFi5 platform this and previous patch
for crossover filterbank gives with three bands DRC a saving
of 6.1 MCPS, from 96.5 MCPS to 90.4 MCPS.

Signed-off-by: Seppo Ingalsuo <[email protected]>
  • Loading branch information
singalsu authored and kv2019i committed Feb 3, 2025
1 parent 977c8cc commit f3ac6ed
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/audio/multiband_drc/multiband_drc.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ static void multiband_drc_reset_state(struct multiband_drc_state *state)
}

static int multiband_drc_eq_init_coef_ch(struct sof_eq_iir_biquad *coef,
struct iir_state_df2t *eq)
struct iir_state_df1 *eq)
{
int ret;

Expand Down
8 changes: 4 additions & 4 deletions src/audio/multiband_drc/multiband_drc.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include <sof/audio/module_adapter/module/generic.h>
#include <module/crossover/crossover_common.h>
#include <sof/math/iir_df2t.h>
#include <sof/math/iir_df1.h>
#include <sof/audio/component.h>
#include <sof/audio/data_blob.h>
#include <sof/platform.h>
Expand All @@ -22,10 +22,10 @@
* Stores the state of the sub-components in Multiband DRC
*/
struct multiband_drc_state {
struct iir_state_df2t emphasis[PLATFORM_MAX_CHANNELS];
struct iir_state_df1 emphasis[PLATFORM_MAX_CHANNELS];
struct crossover_state crossover[PLATFORM_MAX_CHANNELS];
struct drc_state drc[SOF_MULTIBAND_DRC_MAX_BANDS];
struct iir_state_df2t deemphasis[PLATFORM_MAX_CHANNELS];
struct iir_state_df1 deemphasis[PLATFORM_MAX_CHANNELS];
};

typedef void (*multiband_drc_func)(const struct processing_module *mod,
Expand Down Expand Up @@ -89,7 +89,7 @@ static inline multiband_drc_func multiband_drc_find_proc_func_pass(enum sof_ipc_
return NULL;
}

static inline void multiband_drc_iir_reset_state_ch(struct iir_state_df2t *iir)
static inline void multiband_drc_iir_reset_state_ch(struct iir_state_df1 *iir)
{
rfree(iir->coef);
rfree(iir->delay);
Expand Down
10 changes: 5 additions & 5 deletions src/audio/multiband_drc/multiband_drc_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include <stdint.h>
#include <sof/audio/format.h>
#include <sof/math/iir_df2t.h>
#include <sof/math/iir_df1.h>

#include "multiband_drc.h"
#include "../drc/drc_algorithm.h"
Expand All @@ -27,7 +27,7 @@ static void multiband_drc_process_emp_crossover(struct multiband_drc_state *stat
int nch,
int nband)
{
struct iir_state_df2t *emp_s;
struct iir_state_df1 *emp_s;
struct crossover_state *crossover_s;
int32_t *buf_sink_band;
int ch, band;
Expand All @@ -39,7 +39,7 @@ static void multiband_drc_process_emp_crossover(struct multiband_drc_state *stat
crossover_s = &state->crossover[ch];

if (enable_emp)
emp_out = iir_df2t(emp_s, *buf_src);
emp_out = iir_df1(emp_s, *buf_src);
else
emp_out = *buf_src;

Expand Down Expand Up @@ -162,7 +162,7 @@ static void multiband_drc_process_deemp(struct multiband_drc_state *state,
int nch,
int nband)
{
struct iir_state_df2t *deemp_s;
struct iir_state_df1 *deemp_s;
int32_t *buf_src_band;
int ch, band;
int32_t mix_out;
Expand All @@ -178,7 +178,7 @@ static void multiband_drc_process_deemp(struct multiband_drc_state *state,
}

if (enable_deemp)
*buf_sink = iir_df2t(deemp_s, mix_out);
*buf_sink = iir_df1(deemp_s, mix_out);
else
*buf_sink = mix_out;

Expand Down

0 comments on commit f3ac6ed

Please sign in to comment.