Skip to content
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
9 changes: 3 additions & 6 deletions src/audio/eq_fir/eq_fir_hifi2ep.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ void eq_fir_2x_s32(struct fir_state_32x16 fir[], struct input_stream_buffer *bso
for (i = 0; i < (frames >> 1); i++) {
x1 = x0 + nch;
y1 = y0 + nch;
fir_32x16_2x_hifiep(f, *x0, *x1, y0, y1,
lshift, rshift);
fir_32x16_2x(f, *x0, *x1, y0, y1, lshift, rshift);
x0 += inc;
y0 += inc;
}
Expand Down Expand Up @@ -107,8 +106,7 @@ void eq_fir_2x_s24(struct fir_state_32x16 fir[], struct input_stream_buffer *bso
for (i = 0; i < (frames >> 1); i++) {
x1 = x0 + nch;
y1 = y0 + nch;
fir_32x16_2x_hifiep(f, *x0 << 8, *x1 << 8, &z0, &z1,
lshift, rshift);
fir_32x16_2x(f, *x0 << 8, *x1 << 8, &z0, &z1, lshift, rshift);
*y0 = sat_int24(Q_SHIFT_RND(z0, 31, 23));
*y1 = sat_int24(Q_SHIFT_RND(z1, 31, 23));
x0 += inc;
Expand Down Expand Up @@ -155,8 +153,7 @@ void eq_fir_2x_s16(struct fir_state_32x16 fir[], struct input_stream_buffer *bso
for (i = 0; i < (frames >> 1); i++) {
x1 = x0 + nch;
y1 = y0 + nch;
fir_32x16_2x_hifiep(f, *x0 << 16, *x1 << 16, &z0, &z1,
lshift, rshift);
fir_32x16_2x(f, *x0 << 16, *x1 << 16, &z0, &z1, lshift, rshift);
*y0 = sat_int16(Q_SHIFT_RND(z0, 31, 15));
*y1 = sat_int16(Q_SHIFT_RND(z1, 31, 15));
x0 += inc;
Expand Down
6 changes: 3 additions & 3 deletions src/audio/eq_fir/eq_fir_hifi3.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ void eq_fir_2x_s32(struct fir_state_32x16 fir[], struct input_stream_buffer *bso
/* Load two input samples via input pointer x */
AE_L32_XP(d0, x, inc_nch_s);
AE_L32_XP(d1, x, inc_nch_s);
fir_32x16_2x_hifi3(f, d0, d1, y0, y1, shift);
fir_32x16_2x(f, d0, d1, y0, y1, shift);
AE_L32_XC(d0, y0, inc_2nch_s);
AE_L32_XC(d1, y1, inc_2nch_s);
}
Expand Down Expand Up @@ -131,7 +131,7 @@ void eq_fir_2x_s24(struct fir_state_32x16 fir[], struct input_stream_buffer *bso
d0 = AE_SLAA32(d0, 8);
d1 = AE_SLAA32(d1, 8);

fir_32x16_2x_hifi3(f, d0, d1, &z0, &z1, shift);
fir_32x16_2x(f, d0, d1, &z0, &z1, shift);

/* Shift and round to Q1.23 format */
d0 = AE_SRAI32R(z0, 8);
Expand Down Expand Up @@ -205,7 +205,7 @@ void eq_fir_2x_s16(struct fir_state_32x16 fir[], struct input_stream_buffer *bso
x0 = AE_CVT32X2F16_32(d0);
x1 = AE_CVT32X2F16_32(d1);

fir_32x16_2x_hifi3(f, x0, x1, &z0, &z1, shift);
fir_32x16_2x(f, x0, x1, &z0, &z1, shift);

/* Round to Q1.15 format */
d0 = AE_ROUND16X4F32SSYM(z0, z0);
Expand Down
9 changes: 3 additions & 6 deletions src/audio/tdfb/tdfb_hifi3.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ void tdfb_fir_s16(struct tdfb_comp_data *cd, struct input_stream_buffer *bsource

/* Compute FIR and mix as Q5.27*/
fir_core_setup_circular(f);
fir_32x16_2x_hifi3(f, cd->in[is], cd->in[is2], &y0, &y1,
shift);
fir_32x16_2x(f, cd->in[is], cd->in[is2], &y0, &y1, shift);
for (k = 0; k < out_nch; k++) {
if (om & 1) {
cd->out[k] += (int32_t)y0 >> 4;
Expand Down Expand Up @@ -167,8 +166,7 @@ void tdfb_fir_s24(struct tdfb_comp_data *cd, struct input_stream_buffer *bsource

/* Compute FIR and mix as Q5.27*/
fir_core_setup_circular(f);
fir_32x16_2x_hifi3(f, cd->in[is], cd->in[is2], &y0, &y1,
shift);
fir_32x16_2x(f, cd->in[is], cd->in[is2], &y0, &y1, shift);
for (k = 0; k < out_nch; k++) {
if (om & 1) {
cd->out[k] += (int32_t)y0 >> 4;
Expand Down Expand Up @@ -257,8 +255,7 @@ void tdfb_fir_s32(struct tdfb_comp_data *cd, struct input_stream_buffer *bsource

/* Compute FIR and mix as Q5.27*/
fir_core_setup_circular(f);
fir_32x16_2x_hifi3(f, cd->in[is], cd->in[is2], &y0, &y1,
shift);
fir_32x16_2x(f, cd->in[is], cd->in[is2], &y0, &y1, shift);
for (k = 0; k < out_nch; k++) {
if (om & 1) {
cd->out[k] += (int32_t)y0 >> 4;
Expand Down
2 changes: 1 addition & 1 deletion src/audio/tdfb/tdfb_hifiep.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ static inline void tdfb_core(struct tdfb_comp_data *cd, int in_nch, int out_nch)
fir_hifiep_setup_circular(f);
fir_get_lrshifts(f, &lshift, &rshift);
/* Process two samples */
fir_32x16_2x_hifiep(f, cd->in[is], cd->in[is2], &y0, &y1, lshift, rshift);
fir_32x16_2x(f, cd->in[is], cd->in[is2], &y0, &y1, lshift, rshift);
/* Mix as Q5.27 */
for (k = 0; k < out_nch; k++) {
if (om & 1) {
Expand Down
7 changes: 3 additions & 4 deletions src/include/sof/math/fir_hifi2ep.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ struct fir_state_32x16 {
ae_p16x2s *coef; /* Pointer to FIR coefficients */
int taps; /* Number of FIR taps */
int length; /* Number of FIR taps plus input length (even) */
int in_shift; /* Amount of right shifts at input */
int out_shift; /* Amount of right shifts at output */
};

Expand All @@ -53,10 +52,10 @@ static inline void fir_hifiep_setup_circular(struct fir_state_32x16 *fir)
void fir_get_lrshifts(struct fir_state_32x16 *fir, int *lshift,
int *rshift);

void fir_32x16_hifiep(struct fir_state_32x16 *fir, int32_t x, int32_t *y, int lshift, int rshift);
void fir_32x16(struct fir_state_32x16 *fir, int32_t x, int32_t *y, int lshift, int rshift);

void fir_32x16_2x_hifiep(struct fir_state_32x16 *fir, int32_t x0, int32_t x1,
int32_t *y0, int32_t *y1, int lshift, int rshift);
void fir_32x16_2x(struct fir_state_32x16 *fir, int32_t x0, int32_t x1,
int32_t *y0, int32_t *y1, int lshift, int rshift);

#endif
#endif /* __SOF_MATH_FIR_HIFI2EP_H__ */
11 changes: 4 additions & 7 deletions src/include/sof/math/fir_hifi3.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ struct fir_state_32x16 {
ae_f16x4 *coef; /* Pointer to FIR coefficients */
int taps; /* Number of FIR taps */
int length; /* Number of FIR taps plus input length (even) */
int in_shift; /* Amount of right shifts at input */
int out_shift; /* Amount of right shifts at output */
};

Expand All @@ -55,14 +54,12 @@ static inline void fir_comp_setup_circular(const struct audio_stream *buffer)
AE_SETCEND0(audio_stream_get_end_addr(buffer));
}

void fir_get_lrshifts(struct fir_state_32x16 *fir, int *lshift,
int *rshift);
void fir_get_lrshifts(struct fir_state_32x16 *fir, int *lshift, int *rshift);

void fir_32x16_hifi3(struct fir_state_32x16 *fir, ae_int32 x, ae_int32 *y,
int shift);
void fir_32x16(struct fir_state_32x16 *fir, ae_int32 x, ae_int32 *y, int shift);

void fir_32x16_2x_hifi3(struct fir_state_32x16 *fir, ae_int32 x0, ae_int32 x1,
ae_int32 *y0, ae_int32 *y1, int shift);
void fir_32x16_2x(struct fir_state_32x16 *fir, ae_int32 x0, ae_int32 x1,
ae_int32 *y0, ae_int32 *y1, int shift);

#endif
#endif /* __SOF_MATH_FIR_HIFI3_H__ */
2 changes: 1 addition & 1 deletion src/math/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ add_local_sources_ifdef(CONFIG_POWER_FIXED sof power.c)

add_local_sources_ifdef(CONFIG_BINARY_LOGARITHM_FIXED sof base2log.c)

add_local_sources_ifdef(CONFIG_MATH_FIR sof fir_generic.c fir_hifi2ep.c fir_hifi3.c)
add_local_sources_ifdef(CONFIG_MATH_FIR sof fir_generic.c fir_hifi2ep.c fir_hifi3.c fir_hifi5.c)

if(CONFIG_MATH_FFT)
add_subdirectory(fft)
Expand Down
8 changes: 4 additions & 4 deletions src/math/fir_hifi2ep.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: BSD-3-Clause
//
// Copyright(c) 2017 Intel Corporation. All rights reserved.
// Copyright(c) 2017-2025 Intel Corporation.
//
// Author: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>

Expand Down Expand Up @@ -89,7 +89,7 @@ EXPORT_SYMBOL(fir_get_lrshifts);
* 8x 48 bit registers in register file P
*/

void fir_32x16_hifiep(struct fir_state_32x16 *fir, int32_t x, int32_t *y, int lshift, int rshift)
void fir_32x16(struct fir_state_32x16 *fir, int32_t x, int32_t *y, int lshift, int rshift)
{
/* This function uses
* 1x 56 bit registers Q,
Expand Down Expand Up @@ -163,8 +163,8 @@ EXPORT_SYMBOL(fir_32x16_hifiep);
* 8x 48 bit registers in register file P
*/

void fir_32x16_2x_hifiep(struct fir_state_32x16 *fir, int32_t x0, int32_t x1,
int32_t *y0, int32_t *y1, int lshift, int rshift)
void fir_32x16_2x(struct fir_state_32x16 *fir, int32_t x0, int32_t x1,
int32_t *y0, int32_t *y1, int lshift, int rshift)
{
/* This function uses
* 2x 56 bit registers Q,
Expand Down
15 changes: 7 additions & 8 deletions src/math/fir_hifi3.c
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// SPDX-License-Identifier: BSD-3-Clause
//
// Copyright(c) 2017 Intel Corporation. All rights reserved.
// Copyright(c) 2017-2025 Intel Corporation.
//
// Author: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>

#include <sof/math/fir_config.h>
#include <sof/common.h>

#if SOF_USE_MIN_HIFI(3, FILTER)
#if SOF_USE_HIFI(3, FILTER) || SOF_USE_HIFI(4, FILTER)

#include <sof/audio/buffer.h>
#include <sof/math/fir_hifi3.h>
Expand Down Expand Up @@ -90,8 +90,7 @@ EXPORT_SYMBOL(fir_get_lrshifts);
* 8x 48 bit registers in register file P
*/

void fir_32x16_hifi3(struct fir_state_32x16 *fir, ae_int32 x, ae_int32 *y,
int shift)
void fir_32x16(struct fir_state_32x16 *fir, ae_int32 x, ae_int32 *y, int shift)
{
/* This function uses
* 1x 56 bit registers Q,
Expand Down Expand Up @@ -162,15 +161,15 @@ void fir_32x16_hifi3(struct fir_state_32x16 *fir, ae_int32 x, ae_int32 *y,
a = AE_SLAA64S(a, shift);
AE_S32_L_I(AE_ROUND32F48SSYM(a), (ae_int32 *)y, 0);
}
EXPORT_SYMBOL(fir_32x16_hifi3);
EXPORT_SYMBOL(fir_32x16);

/* HiFi EP has the follow number of reqisters that should not be exceeded
* 4x 56 bit registers in register file Q
* 8x 48 bit registers in register file P
*/

void fir_32x16_2x_hifi3(struct fir_state_32x16 *fir, ae_int32 x0, ae_int32 x1,
ae_int32 *y0, ae_int32 *y1, int shift)
void fir_32x16_2x(struct fir_state_32x16 *fir, ae_int32 x0, ae_int32 x1,
ae_int32 *y0, ae_int32 *y1, int shift)
{
/* This function uses
* 2x 56 bit registers Q,
Expand Down Expand Up @@ -252,6 +251,6 @@ void fir_32x16_2x_hifi3(struct fir_state_32x16 *fir, ae_int32 x0, ae_int32 x1,
AE_S32_L_I(AE_ROUND32F48SSYM(b), (ae_int32 *)y1, 0);
AE_S32_L_I(AE_ROUND32F48SSYM(a), (ae_int32 *)y0, 0);
}
EXPORT_SYMBOL(fir_32x16_2x_hifi3);
EXPORT_SYMBOL(fir_32x16_2x);

#endif
Loading
Loading