Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audio: Crossover / Multiband DRC: Change to HiFi4 and HiFi5 optimized IIR DF1 core type #9806

Merged
merged 2 commits into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/audio/crossover/crossover.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <rtos/alloc.h>
#include <rtos/init.h>
#include <sof/lib/uuid.h>
#include <sof/math/iir_df2t.h>
#include <sof/math/iir_df1.h>
#include <sof/list.h>
#include <sof/platform.h>
#include <rtos/string.h>
Expand Down Expand Up @@ -157,13 +157,13 @@ static int crossover_assign_sinks(struct processing_module *mod,
* \param[out] lr4 initialized struct
*/
static int crossover_init_coef_lr4(struct sof_eq_iir_biquad *coef,
struct iir_state_df2t *lr4)
struct iir_state_df1 *lr4)
{
int ret;

/* Only one set of coefficients is stored in config for both biquads
* in series due to identity. To maintain the structure of
* iir_state_df2t, it requires two copies of coefficients in a row.
* iir_state_df1, it requires two copies of coefficients in a row.
*/
lr4->coef = rzalloc(SOF_MEM_ZONE_RUNTIME, 0, SOF_MEM_CAPS_RAM,
sizeof(struct sof_eq_iir_biquad) * 2);
Expand Down
6 changes: 3 additions & 3 deletions src/audio/crossover/crossover.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define __SOF_AUDIO_CROSSOVER_CROSSOVER_H__

#include <sof/audio/module_adapter/module/module_interface.h>
#include <sof/math/iir_df2t.h>
#include <sof/math/iir_df1.h>
#include <module/crossover/crossover_common.h>
#include <sof/platform.h>
#include <stdint.h>
Expand Down Expand Up @@ -119,10 +119,10 @@ extern const size_t crossover_split_fncount;
* \brief Runs input in through the LR4 filter and returns it's output.
*/
static inline int32_t crossover_generic_process_lr4(int32_t in,
struct iir_state_df2t *lr4)
struct iir_state_df1 *lr4)
{
/* Cascade two biquads with same coefficients in series. */
return iir_df2t(lr4, in);
return iir_df1(lr4, in);
}

static inline void crossover_free_config(struct sof_crossover_config **config)
Expand Down
10 changes: 5 additions & 5 deletions src/audio/crossover/crossover_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <sof/audio/module_adapter/module/module_interface.h>
#include <sof/audio/component.h>
#include <sof/audio/format.h>
#include <sof/math/iir_df2t.h>
#include <sof/math/iir_df1.h>
#include <stdint.h>

#include "crossover.h"
Expand All @@ -21,8 +21,8 @@
* As a side effect, this function mutates the delay values of both
* filters.
*/
static inline void crossover_generic_lr4_split(struct iir_state_df2t *lp,
struct iir_state_df2t *hp,
static inline void crossover_generic_lr4_split(struct iir_state_df1 *lp,
struct iir_state_df1 *hp,
int32_t x, int32_t *y1,
int32_t *y2)
{
Expand All @@ -39,8 +39,8 @@ static inline void crossover_generic_lr4_split(struct iir_state_df2t *lp,
* to be out of phase. We need to pass the signal through another set of LR4
* filters to align back the phase.
*/
static inline void crossover_generic_lr4_merge(struct iir_state_df2t *lp,
struct iir_state_df2t *hp,
static inline void crossover_generic_lr4_merge(struct iir_state_df1 *lp,
struct iir_state_df1 *hp,
int32_t x, int32_t *y)
{
int32_t z1, z2;
Expand Down
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
8 changes: 4 additions & 4 deletions src/include/module/crossover/crossover_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#ifndef __SOF_CROSSOVER_COMMON_H__
#define __SOF_CROSSOVER_COMMON_H__

#include <sof/math/iir_df2t.h>
#include <sof/math/iir_df1.h>
#include <user/eq.h>

/* Number of sinks for a 2 way crossover filter */
Expand All @@ -29,8 +29,8 @@
*/
struct crossover_state {
/* Store the state for each LR4 filter. */
struct iir_state_df2t lowpass[CROSSOVER_MAX_LR4];
struct iir_state_df2t highpass[CROSSOVER_MAX_LR4];
struct iir_state_df1 lowpass[CROSSOVER_MAX_LR4];
struct iir_state_df1 highpass[CROSSOVER_MAX_LR4];
};

typedef void (*crossover_split)(int32_t in, int32_t out[],
Expand All @@ -46,7 +46,7 @@ int crossover_init_coef_ch(struct sof_eq_iir_biquad *coef,
/**
* \brief Reset the state of an LR4 filter.
*/
static inline void crossover_reset_state_lr4(struct iir_state_df2t *lr4)
static inline void crossover_reset_state_lr4(struct iir_state_df1 *lr4)
{
rfree(lr4->coef);
rfree(lr4->delay);
Expand Down
Loading