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

math: enable modular IIR, minor update for FIR #9848

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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: 9 additions & 0 deletions src/math/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -178,15 +178,24 @@ config MATH_FIR
filter calculates a convolution of input PCM sample and a configurable
impulse response.

config MATH_IIR
tristate "Select IIR filter library build method"
default m if LIBRARY_DEFAULT_MODULAR
default y
help
A helper option for MATH_IIR_DF2T and MATH_IIR_DF1

config MATH_IIR_DF2T
bool "IIR DF2T filter library"
depends on MATH_IIR != "n"
default n
help
Select this to build IIR (Infinite Impulse Response) filter
or type 2-transposed library.

config MATH_IIR_DF1
bool "IIR DF1 filter library"
depends on MATH_IIR != "n"
default n
help
Select this to build IIR (Infinite Impulse Response) filter
Expand Down
2 changes: 1 addition & 1 deletion src/math/fir_llext/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# SPDX-License-Identifier: Apache-2.0

sof_llext_build("fir"
SOURCES ../fir_common.c
SOURCES fir_common.c
../fir_generic.c
../fir_hifi2ep.c
../fir_hifi3.c
Expand Down
File renamed without changes.
6 changes: 6 additions & 0 deletions src/math/iir.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[[module.entry]]
name = "IIR"
uuid = "B0CDCD9E-EF8B-404F-8480-0F287FC9D44D"
load_type = "3"

index = __COUNTER__
21 changes: 21 additions & 0 deletions src/math/iir_llext/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright (c) 2024 Intel Corporation.
# SPDX-License-Identifier: Apache-2.0

if(CONFIG_MATH_IIR_DF1)
set(df1 ../iir_df1.c ../iir_df1_generic.c ../iir_df1_hifi3.c ../iir_df1_hifi4.c ../iir_df1_hifi5.c)
else()
set(df1 "")
endif()

if(CONFIG_MATH_IIR_DF2T)
set(df2t ../iir_df2t.c ../iir_df2t_generic.c ../iir_df2t_hifi3.c)
else()
set(df2t "")
endif()

if(CONFIG_MATH_IIR_DF1 OR CONFIG_MATH_IIR_DF2T)
sof_llext_build("iir"
SOURCES iir.c ${df1} ${df2t}
LIB openmodules
)
endif()
17 changes: 17 additions & 0 deletions src/math/iir_llext/iir.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// SPDX-License-Identifier: BSD-3-Clause
//
// Copyright(c) 2025 Intel Corporation.

/* modular: llext dynamic link */

#include <sof/compiler_attributes.h>
#include <sof/lib/uuid.h>
#include <module/module/api_ver.h>
#include <module/module/llext.h>
#include <rimage/sof/user/manifest.h>

static const struct sof_man_module_manifest mod_manifest[] __section(".module") __used = {
SOF_LLEXT_AUX_MANIFEST("IIR", NULL, SOF_REG_UUID(iir)),
};

SOF_LLEXT_BUILDINFO;
5 changes: 5 additions & 0 deletions src/math/iir_llext/llext.toml.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#include <tools/rimage/config/platform.toml>
#include "../iir.toml"

[module]
count = __COUNTER__
1 change: 1 addition & 0 deletions uuid-registry.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ b780a0a6-269f-466f-b47723dfa05af758 google_rtc_audio_processing
a5dacb0e-88dc-415c-a1b53e8df77f1976 idc_cmd_task
b90f5a4e-5537-4375-a1df95485472ff9e idc_task
696ae2bc-2877-11eb-adc10242ac120002 igo_nr
b0cdcd9e-ef8b-404f-84800f287fc9d44d iir
fa00558c-d653-4851-a03ab21f125a9524 interrupt
2f520e85-49ba-4284-90d83def24af313b intc_mt8196
be60f97d-78df-4796-a0ee435cb56b720a ipc
Expand Down
30 changes: 18 additions & 12 deletions zephyr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -697,19 +697,25 @@ elseif(CONFIG_MATH_FIR)
)
endif()

zephyr_library_sources_ifdef(CONFIG_MATH_IIR_DF1
${SOF_MATH_PATH}/iir_df1_generic.c
${SOF_MATH_PATH}/iir_df1_hifi3.c
${SOF_MATH_PATH}/iir_df1_hifi4.c
${SOF_MATH_PATH}/iir_df1_hifi5.c
${SOF_MATH_PATH}/iir_df1.c
)
if(CONFIG_MATH_IIR STREQUAL "m")
add_subdirectory(${SOF_MATH_PATH}/iir_llext
${PROJECT_BINARY_DIR}/iir_llext)
add_dependencies(app fir)
elseif(CONFIG_MATH_IIR)
zephyr_library_sources_ifdef(CONFIG_MATH_IIR_DF1
${SOF_MATH_PATH}/iir_df1_generic.c
${SOF_MATH_PATH}/iir_df1_hifi3.c
${SOF_MATH_PATH}/iir_df1_hifi4.c
${SOF_MATH_PATH}/iir_df1_hifi5.c
${SOF_MATH_PATH}/iir_df1.c
)

zephyr_library_sources_ifdef(CONFIG_MATH_IIR_DF2T
${SOF_MATH_PATH}/iir_df2t_generic.c
${SOF_MATH_PATH}/iir_df2t_hifi3.c
${SOF_MATH_PATH}/iir_df2t.c
)
zephyr_library_sources_ifdef(CONFIG_MATH_IIR_DF2T
${SOF_MATH_PATH}/iir_df2t_generic.c
${SOF_MATH_PATH}/iir_df2t_hifi3.c
${SOF_MATH_PATH}/iir_df2t.c
)
endif()

if(CONFIG_COMP_ASRC STREQUAL "m")
add_subdirectory(${SOF_AUDIO_PATH}/asrc/llext
Expand Down
Loading