Skip to content

Commit d5a6d3f

Browse files
committed
google_rtc_aec: enable building as an llext module
Add support for LLEXT building to google_rtc_audio_processing. Only building in a stub configuration is supported, linking with a prebuilt library should be implemented separately. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
1 parent e539d5e commit d5a6d3f

8 files changed

Lines changed: 82 additions & 34 deletions

File tree

app/configs/lnl/modules.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ CONFIG_COMP_DCBLOCK=m
1818
CONFIG_COMP_CROSSOVER=m
1919
CONFIG_COMP_MULTIBAND_DRC=m
2020
CONFIG_COMP_GOOGLE_CTC_AUDIO_PROCESSING=m
21+
CONFIG_COMP_GOOGLE_RTC_AUDIO_PROCESSING=m

app/configs/mtl/modules.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ CONFIG_COMP_DCBLOCK=m
1818
CONFIG_COMP_CROSSOVER=m
1919
CONFIG_COMP_MULTIBAND_DRC=m
2020
CONFIG_COMP_GOOGLE_CTC_AUDIO_PROCESSING=m
21+
CONFIG_COMP_GOOGLE_RTC_AUDIO_PROCESSING=m

src/audio/google/Kconfig

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ config COMP_GOOGLE_HOTWORD_DETECT
1313
detector.
1414

1515
config COMP_GOOGLE_RTC_AUDIO_PROCESSING
16-
bool "Google Real Time Communication Audio processing"
16+
tristate "Google Real Time Communication Audio processing"
1717
select COMP_BLOB
1818
default n
1919
help
@@ -26,7 +26,6 @@ config COMP_GOOGLE_RTC_AUDIO_PROCESSING
2626
if COMP_GOOGLE_RTC_AUDIO_PROCESSING
2727

2828
config COMP_GOOGLE_RTC_AUDIO_PROCESSING_SAMPLE_RATE_HZ
29-
depends on COMP_GOOGLE_RTC_AUDIO_PROCESSING
3029
int "Sample rate for Google Real Time Communication Audio processing"
3130
default 48000
3231
help
@@ -55,23 +54,20 @@ config COMP_GOOGLE_RTC_AUDIO_REFERENCE_CHANNEL_MAX
5554
are ignored
5655

5756
config COMP_GOOGLE_RTC_AUDIO_PROCESSING_MEMORY_BUFFER_SIZE_KB
58-
depends on COMP_GOOGLE_RTC_AUDIO_PROCESSING
5957
int "Memory buffer size for Google Real Time Communication Audio processing"
6058
default 200
6159
help
6260
Sets the size of the memory buffer for the Google real-time
6361
communication audio processing.
6462

6563
config COMP_GOOGLE_RTC_AUDIO_PROCESSING_ECHO_PATH_DELAY_MS
66-
depends on COMP_GOOGLE_RTC_AUDIO_PROCESSING
6764
int "Echo path delay for Google Real Time Communication Audio processing"
6865
default 44
6966
help
7067
Sets the echo path delay to use for the Google real-time communication
7168
audio processing.
7269

7370
config COMP_GOOGLE_RTC_AUDIO_PROCESSING_MIC_HEADROOM_LINEAR
74-
depends on COMP_GOOGLE_RTC_AUDIO_PROCESSING
7571
int "Microphone headroom for Google Real Time Communication Audio processing"
7672
default 4
7773
help
@@ -81,7 +77,6 @@ config COMP_GOOGLE_RTC_AUDIO_PROCESSING_MIC_HEADROOM_LINEAR
8177
config GOOGLE_RTC_AUDIO_PROCESSING_MOCK
8278
bool "Google Real Time Communication Audio processing mock"
8379
default y if COMP_STUBS
84-
depends on COMP_GOOGLE_RTC_AUDIO_PROCESSING
8580
help
8681
Mock Google real-time communication audio processing.
8782
It allows for compilation check and basic audio flow checking.

src/audio/google/google_rtc_audio_processing.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -856,3 +856,23 @@ DECLARE_MODULE_ADAPTER(google_rtc_audio_processing_interface,
856856
google_rtc_audio_processing_uuid, google_rtc_audio_processing_tr);
857857
SOF_MODULE_INIT(google_rtc_audio_processing,
858858
sys_comp_module_google_rtc_audio_processing_interface_init);
859+
860+
#if CONFIG_COMP_GOOGLE_RTC_AUDIO_PROCESSING_MODULE
861+
/* modular: llext dynamic link */
862+
863+
#include <module/module/api_ver.h>
864+
#include <module/module/llext.h>
865+
#include <rimage/sof/user/manifest.h>
866+
867+
#define UUID_GOOGLE_RTC_AEC 0xA6, 0xA0, 0x80, 0xB7, 0x9F, 0x26, 0x6F, 0x46, 0x77, 0xB4, \
868+
0x23, 0xDF, 0xA0, 0x5A, 0xF7, 0x58
869+
870+
SOF_LLEXT_MOD_ENTRY(google_rtc_audio_processing, &google_rtc_audio_processing_interface);
871+
872+
static const struct sof_man_module_manifest mod_manifest __section(".module") __used =
873+
SOF_LLEXT_MODULE_MANIFEST("RTC_AEC", google_rtc_audio_processing_llext_entry,
874+
7, UUID_GOOGLE_RTC_AEC, 1);
875+
876+
SOF_LLEXT_BUILDINFO;
877+
878+
#endif
Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
1+
#ifndef LOAD_TYPE
2+
#define LOAD_TYPE "1"
3+
#endif
4+
15
[[module.entry]]
26
name = "RTC_AEC"
3-
uuid = "B780A0A6-269F-466F-B477-23DFA05AF758"
4-
REM # bit #i = 1 means core #i is allowed.
5-
affinity_mask = "0x7"
6-
instance_count = "1"
7-
domain_types = "1"
8-
load_type = "1"
9-
module_type = "10"
7+
uuid = "B780A0A6-269F-466F-B477-23DFA05AF758"
8+
REM # bit #i = 1 means core #i is allowed.
9+
affinity_mask = "0x7"
10+
instance_count = "1"
11+
domain_types = "1"
12+
load_type = LOAD_TYPE
13+
module_type = "10"
1014
init_config = "1"
11-
auto_start = "0"
12-
sched_caps = [1, 0x00008000]
15+
auto_start = "0"
16+
sched_caps = [1, 0x00008000]
1317

14-
REM # pin = [dir, type, sample rate, size, container, channel-cfg]
15-
pin = [0, 0, 0x8, 0x2, 0x2, 0x1,
16-
0, 0, 0x8, 0x2, 0x2, 0x4,
17-
1, 0, 0x8, 0x2, 0x2, 0x1]
18+
REM # pin = [dir, type, sample rate, size, container, channel-cfg]
19+
pin = [0, 0, 0x8, 0x2, 0x2, 0x1,
20+
0, 0, 0x8, 0x2, 0x2, 0x4,
21+
1, 0, 0x8, 0x2, 0x2, 0x1]
1822

1923
index = __COUNTER__
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
if(CONFIG_GOOGLE_RTC_AUDIO_PROCESSING_MOCK)
2+
sof_llext_build("google_rtc_audio_processing"
3+
SOURCES ../google_rtc_audio_processing.c
4+
../google_rtc_audio_processing_mock.c
5+
)
6+
target_include_directories(google_rtc_audio_processing_llext_lib PRIVATE
7+
"${sof_top_dir}/third_party/include"
8+
)
9+
else()
10+
message(FATAL_ERROR "Add library linking support in src/audio/google/llext/CMakeLists.txt")
11+
endif()
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/* SPDX-License-Identifier: BSD-3-Clause
2+
*
3+
* Copyright(c) 2021 Intel Corporation. All rights reserved.
4+
*/
5+
#include <tools/rimage/config/platform.toml>
6+
#define LOAD_TYPE "2"
7+
#include "../google_rtc_audio_processing.toml"
8+
9+
[module]
10+
count = __COUNTER__

zephyr/CMakeLists.txt

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -887,23 +887,29 @@ elseif(CONFIG_COMP_MULTIBAND_DRC)
887887
)
888888
endif()
889889

890-
zephyr_library_sources_ifdef(CONFIG_COMP_GOOGLE_RTC_AUDIO_PROCESSING
891-
${SOF_AUDIO_PATH}/google/google_rtc_audio_processing.c
892-
)
890+
if(CONFIG_COMP_GOOGLE_RTC_AUDIO_PROCESSING STREQUAL "m")
891+
add_subdirectory(${SOF_AUDIO_PATH}/google/llext_rtc
892+
${PROJECT_BINARY_DIR}/google_rtc_audio_processing_llext)
893+
add_dependencies(app google_rtc_audio_processing)
894+
elseif(CONFIG_COMP_GOOGLE_RTC_AUDIO_PROCESSING)
895+
zephyr_library_sources(
896+
${SOF_AUDIO_PATH}/google/google_rtc_audio_processing.c
897+
)
893898

894-
zephyr_library_sources_ifdef(CONFIG_GOOGLE_RTC_AUDIO_PROCESSING_MOCK
895-
${SOF_AUDIO_PATH}/google/google_rtc_audio_processing_mock.c
896-
)
899+
zephyr_library_sources_ifdef(CONFIG_GOOGLE_RTC_AUDIO_PROCESSING_MOCK
900+
${SOF_AUDIO_PATH}/google/google_rtc_audio_processing_mock.c
901+
)
897902

898-
if(CONFIG_COMP_GOOGLE_RTC_AUDIO_PROCESSING AND NOT CONFIG_GOOGLE_RTC_AUDIO_PROCESSING_MOCK)
899-
zephyr_include_directories(../third_party/include)
900-
target_link_directories(SOF INTERFACE ../third_party/lib)
901-
target_link_libraries(SOF INTERFACE google_rtc_audio_processing)
902-
target_link_libraries(SOF INTERFACE c++)
903-
target_link_libraries(SOF INTERFACE c++abi)
904-
target_link_libraries(SOF INTERFACE m)
905-
target_link_libraries(SOF INTERFACE c)
906-
target_link_libraries(SOF INTERFACE gcc)
903+
if(NOT CONFIG_GOOGLE_RTC_AUDIO_PROCESSING_MOCK)
904+
zephyr_include_directories(../third_party/include)
905+
target_link_directories(SOF INTERFACE ../third_party/lib)
906+
target_link_libraries(SOF INTERFACE google_rtc_audio_processing)
907+
target_link_libraries(SOF INTERFACE c++)
908+
target_link_libraries(SOF INTERFACE c++abi)
909+
target_link_libraries(SOF INTERFACE m)
910+
target_link_libraries(SOF INTERFACE c)
911+
target_link_libraries(SOF INTERFACE gcc)
912+
endif()
907913
endif()
908914

909915
if(CONFIG_COMP_GOOGLE_CTC_AUDIO_PROCESSING STREQUAL "m")

0 commit comments

Comments
 (0)