Skip to content

Commit 977c8cc

Browse files
singalsukv2019i
authored andcommitted
Audio: Crossover: Change to HiFi5 optimized DF1 IIR type
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 HiFi5 platform this change saves with two band crossover 0.8 MCPS, from 10.02 MCPS to 9.26 MCPS. The saving will be higher in higher order filter banks such as in multiband DRC component. Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
1 parent cb057a5 commit 977c8cc

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

src/audio/crossover/crossover.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include <rtos/alloc.h>
1919
#include <rtos/init.h>
2020
#include <sof/lib/uuid.h>
21-
#include <sof/math/iir_df2t.h>
21+
#include <sof/math/iir_df1.h>
2222
#include <sof/list.h>
2323
#include <sof/platform.h>
2424
#include <rtos/string.h>
@@ -157,13 +157,13 @@ static int crossover_assign_sinks(struct processing_module *mod,
157157
* \param[out] lr4 initialized struct
158158
*/
159159
static int crossover_init_coef_lr4(struct sof_eq_iir_biquad *coef,
160-
struct iir_state_df2t *lr4)
160+
struct iir_state_df1 *lr4)
161161
{
162162
int ret;
163163

164164
/* Only one set of coefficients is stored in config for both biquads
165165
* in series due to identity. To maintain the structure of
166-
* iir_state_df2t, it requires two copies of coefficients in a row.
166+
* iir_state_df1, it requires two copies of coefficients in a row.
167167
*/
168168
lr4->coef = rzalloc(SOF_MEM_ZONE_RUNTIME, 0, SOF_MEM_CAPS_RAM,
169169
sizeof(struct sof_eq_iir_biquad) * 2);

src/audio/crossover/crossover.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#define __SOF_AUDIO_CROSSOVER_CROSSOVER_H__
99

1010
#include <sof/audio/module_adapter/module/module_interface.h>
11-
#include <sof/math/iir_df2t.h>
11+
#include <sof/math/iir_df1.h>
1212
#include <module/crossover/crossover_common.h>
1313
#include <sof/platform.h>
1414
#include <stdint.h>
@@ -119,10 +119,10 @@ extern const size_t crossover_split_fncount;
119119
* \brief Runs input in through the LR4 filter and returns it's output.
120120
*/
121121
static inline int32_t crossover_generic_process_lr4(int32_t in,
122-
struct iir_state_df2t *lr4)
122+
struct iir_state_df1 *lr4)
123123
{
124124
/* Cascade two biquads with same coefficients in series. */
125-
return iir_df2t(lr4, in);
125+
return iir_df1(lr4, in);
126126
}
127127

128128
static inline void crossover_free_config(struct sof_crossover_config **config)

src/audio/crossover/crossover_generic.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#include <sof/audio/module_adapter/module/module_interface.h>
99
#include <sof/audio/component.h>
1010
#include <sof/audio/format.h>
11-
#include <sof/math/iir_df2t.h>
11+
#include <sof/math/iir_df1.h>
1212
#include <stdint.h>
1313

1414
#include "crossover.h"
@@ -21,8 +21,8 @@
2121
* As a side effect, this function mutates the delay values of both
2222
* filters.
2323
*/
24-
static inline void crossover_generic_lr4_split(struct iir_state_df2t *lp,
25-
struct iir_state_df2t *hp,
24+
static inline void crossover_generic_lr4_split(struct iir_state_df1 *lp,
25+
struct iir_state_df1 *hp,
2626
int32_t x, int32_t *y1,
2727
int32_t *y2)
2828
{
@@ -39,8 +39,8 @@ static inline void crossover_generic_lr4_split(struct iir_state_df2t *lp,
3939
* to be out of phase. We need to pass the signal through another set of LR4
4040
* filters to align back the phase.
4141
*/
42-
static inline void crossover_generic_lr4_merge(struct iir_state_df2t *lp,
43-
struct iir_state_df2t *hp,
42+
static inline void crossover_generic_lr4_merge(struct iir_state_df1 *lp,
43+
struct iir_state_df1 *hp,
4444
int32_t x, int32_t *y)
4545
{
4646
int32_t z1, z2;

src/include/module/crossover/crossover_common.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#ifndef __SOF_CROSSOVER_COMMON_H__
99
#define __SOF_CROSSOVER_COMMON_H__
1010

11-
#include <sof/math/iir_df2t.h>
11+
#include <sof/math/iir_df1.h>
1212
#include <user/eq.h>
1313

1414
/* Number of sinks for a 2 way crossover filter */
@@ -29,8 +29,8 @@
2929
*/
3030
struct crossover_state {
3131
/* Store the state for each LR4 filter. */
32-
struct iir_state_df2t lowpass[CROSSOVER_MAX_LR4];
33-
struct iir_state_df2t highpass[CROSSOVER_MAX_LR4];
32+
struct iir_state_df1 lowpass[CROSSOVER_MAX_LR4];
33+
struct iir_state_df1 highpass[CROSSOVER_MAX_LR4];
3434
};
3535

3636
typedef void (*crossover_split)(int32_t in, int32_t out[],
@@ -46,7 +46,7 @@ int crossover_init_coef_ch(struct sof_eq_iir_biquad *coef,
4646
/**
4747
* \brief Reset the state of an LR4 filter.
4848
*/
49-
static inline void crossover_reset_state_lr4(struct iir_state_df2t *lr4)
49+
static inline void crossover_reset_state_lr4(struct iir_state_df1 *lr4)
5050
{
5151
rfree(lr4->coef);
5252
rfree(lr4->delay);

0 commit comments

Comments
 (0)