From 7d9a3ca030b3e6a5504520deb5614ad5203d2dcb Mon Sep 17 00:00:00 2001 From: Baofeng Tian Date: Wed, 30 Aug 2023 14:10:01 +0800 Subject: [PATCH] audio: volume: move volume out from module adapter move volume from module adapter to src/audio directory, it is a critical audio component. Signed-off-by: Baofeng Tian --- src/audio/CMakeLists.txt | 9 +++--- src/audio/module_adapter/CMakeLists.txt | 16 ---------- src/audio/volume/CMakeLists.txt | 17 ++++++++++ .../module => }/volume/volume.c | 0 .../module => }/volume/volume_generic.c | 0 .../volume/volume_generic_with_peakvol.c | 0 .../module => }/volume/volume_hifi3.c | 0 .../volume/volume_hifi3_with_peakvol.c | 0 .../module => }/volume/volume_hifi4.c | 0 .../volume/volume_hifi4_with_peakvol.c | 0 .../module => }/volume/volume_ipc3.c | 0 .../module => }/volume/volume_ipc4.c | 0 test/cmocka/src/audio/volume/CMakeLists.txt | 16 +++++----- zephyr/CMakeLists.txt | 32 +++++++++---------- 14 files changed, 46 insertions(+), 44 deletions(-) create mode 100644 src/audio/volume/CMakeLists.txt rename src/audio/{module_adapter/module => }/volume/volume.c (100%) rename src/audio/{module_adapter/module => }/volume/volume_generic.c (100%) rename src/audio/{module_adapter/module => }/volume/volume_generic_with_peakvol.c (100%) rename src/audio/{module_adapter/module => }/volume/volume_hifi3.c (100%) rename src/audio/{module_adapter/module => }/volume/volume_hifi3_with_peakvol.c (100%) rename src/audio/{module_adapter/module => }/volume/volume_hifi4.c (100%) rename src/audio/{module_adapter/module => }/volume/volume_hifi4_with_peakvol.c (100%) rename src/audio/{module_adapter/module => }/volume/volume_ipc3.c (100%) rename src/audio/{module_adapter/module => }/volume/volume_ipc4.c (100%) diff --git a/src/audio/CMakeLists.txt b/src/audio/CMakeLists.txt index cbb0a7d1fb0f..f35dd917eae0 100644 --- a/src/audio/CMakeLists.txt +++ b/src/audio/CMakeLists.txt @@ -103,6 +103,9 @@ if((NOT CONFIG_LIBRARY) OR CONFIG_LIBRARY_STATIC) if(CONFIG_COMP_MFCC) add_subdirectory(mfcc) endif() + if(CONFIG_COMP_VOLUME) + add_subdirectory(volume) + endif() subdirs(pipeline) add_subdirectory(google) if(CONFIG_COMP_CHAIN_DMA) @@ -164,11 +167,9 @@ set(sof_audio_modules mixer volume src asrc eq-fir eq-iir dcblock crossover tdfb # sources for each module if(CONFIG_IPC_MAJOR_3) - set(volume_sources module_adapter/module/volume/volume.c module_adapter/module/volume/volume_generic.c - module_adapter/module/volume/volume_ipc3.c) + set(volume_sources volume/volume.c volume/volume_generic.c volume/volume_ipc3.c) elseif(CONFIG_IPC_MAJOR_4) - set(volume_sources module_adapter/module/volume/volume.c module_adapter/module/volume/volume_generic.c - module_adapter/module/volume/volume_ipc4.c) + set(volume_sources volume/volume.c volume/volume_generic.c volume/volume_ipc4.c) endif() set(mixer_sources ${mixer_src}) set(src_sources src/src.c src/src_generic.c) diff --git a/src/audio/module_adapter/CMakeLists.txt b/src/audio/module_adapter/CMakeLists.txt index 58f5aa849035..e803f78ba91a 100644 --- a/src/audio/module_adapter/CMakeLists.txt +++ b/src/audio/module_adapter/CMakeLists.txt @@ -4,22 +4,6 @@ add_local_sources(sof module_adapter.c module/generic.c) if((NOT CONFIG_LIBRARY) OR CONFIG_LIBRARY_STATIC) - if(CONFIG_COMP_VOLUME) - add_local_sources(sof - module/volume/volume_generic.c - module/volume/volume_hifi3.c - module/volume/volume_hifi4.c - module/volume/volume_generic_with_peakvol.c - module/volume/volume_hifi3_with_peakvol.c - module/volume/volume_hifi4_with_peakvol.c - module/volume/volume.c) - if(CONFIG_IPC_MAJOR_3) - add_local_sources(sof module/volume/volume_ipc3.c) - elseif(CONFIG_IPC_MAJOR_4) - add_local_sources(sof module/volume/volume_ipc4.c) - endif() - endif() - if(CONFIG_CADENCE_CODEC) add_local_sources(sof module/cadence.c) diff --git a/src/audio/volume/CMakeLists.txt b/src/audio/volume/CMakeLists.txt new file mode 100644 index 000000000000..790bd37e4d6a --- /dev/null +++ b/src/audio/volume/CMakeLists.txt @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: BSD-3-Clause + +if(CONFIG_COMP_VOLUME) + add_local_sources(sof + volume_generic.c + volume_hifi3.c + volume_hifi4.c + volume_generic_with_peakvol.c + volume_hifi3_with_peakvol.c + volume_hifi4_with_peakvol.c + volume.c) + if(CONFIG_IPC_MAJOR_3) + add_local_sources(sof volume_ipc3.c) + elseif(CONFIG_IPC_MAJOR_4) + add_local_sources(sof volume_ipc4.c) + endif() +endif() \ No newline at end of file diff --git a/src/audio/module_adapter/module/volume/volume.c b/src/audio/volume/volume.c similarity index 100% rename from src/audio/module_adapter/module/volume/volume.c rename to src/audio/volume/volume.c diff --git a/src/audio/module_adapter/module/volume/volume_generic.c b/src/audio/volume/volume_generic.c similarity index 100% rename from src/audio/module_adapter/module/volume/volume_generic.c rename to src/audio/volume/volume_generic.c diff --git a/src/audio/module_adapter/module/volume/volume_generic_with_peakvol.c b/src/audio/volume/volume_generic_with_peakvol.c similarity index 100% rename from src/audio/module_adapter/module/volume/volume_generic_with_peakvol.c rename to src/audio/volume/volume_generic_with_peakvol.c diff --git a/src/audio/module_adapter/module/volume/volume_hifi3.c b/src/audio/volume/volume_hifi3.c similarity index 100% rename from src/audio/module_adapter/module/volume/volume_hifi3.c rename to src/audio/volume/volume_hifi3.c diff --git a/src/audio/module_adapter/module/volume/volume_hifi3_with_peakvol.c b/src/audio/volume/volume_hifi3_with_peakvol.c similarity index 100% rename from src/audio/module_adapter/module/volume/volume_hifi3_with_peakvol.c rename to src/audio/volume/volume_hifi3_with_peakvol.c diff --git a/src/audio/module_adapter/module/volume/volume_hifi4.c b/src/audio/volume/volume_hifi4.c similarity index 100% rename from src/audio/module_adapter/module/volume/volume_hifi4.c rename to src/audio/volume/volume_hifi4.c diff --git a/src/audio/module_adapter/module/volume/volume_hifi4_with_peakvol.c b/src/audio/volume/volume_hifi4_with_peakvol.c similarity index 100% rename from src/audio/module_adapter/module/volume/volume_hifi4_with_peakvol.c rename to src/audio/volume/volume_hifi4_with_peakvol.c diff --git a/src/audio/module_adapter/module/volume/volume_ipc3.c b/src/audio/volume/volume_ipc3.c similarity index 100% rename from src/audio/module_adapter/module/volume/volume_ipc3.c rename to src/audio/volume/volume_ipc3.c diff --git a/src/audio/module_adapter/module/volume/volume_ipc4.c b/src/audio/volume/volume_ipc4.c similarity index 100% rename from src/audio/module_adapter/module/volume/volume_ipc4.c rename to src/audio/volume/volume_ipc4.c diff --git a/test/cmocka/src/audio/volume/CMakeLists.txt b/test/cmocka/src/audio/volume/CMakeLists.txt index 690515d98229..a1cd1fd8cab2 100644 --- a/test/cmocka/src/audio/volume/CMakeLists.txt +++ b/test/cmocka/src/audio/volume/CMakeLists.txt @@ -12,14 +12,14 @@ target_include_directories(volume_process PRIVATE ${PROJECT_SOURCE_DIR}/src/audi add_compile_options(-DUNIT_TEST) add_library(audio_for_volume STATIC - ${PROJECT_SOURCE_DIR}/src/audio/module_adapter/module/volume/volume.c - ${PROJECT_SOURCE_DIR}/src/audio/module_adapter/module/volume/volume_ipc3.c - ${PROJECT_SOURCE_DIR}/src/audio/module_adapter/module/volume/volume_generic.c - ${PROJECT_SOURCE_DIR}/src/audio/module_adapter/module/volume/volume_hifi3.c - ${PROJECT_SOURCE_DIR}/src/audio/module_adapter/module/volume/volume_hifi4.c - ${PROJECT_SOURCE_DIR}/src/audio/module_adapter/module/volume/volume_generic_with_peakvol.c - ${PROJECT_SOURCE_DIR}/src/audio/module_adapter/module/volume/volume_hifi3_with_peakvol.c - ${PROJECT_SOURCE_DIR}/src/audio/module_adapter/module/volume/volume_hifi4_with_peakvol.c + ${PROJECT_SOURCE_DIR}/src/audio/volume/volume.c + ${PROJECT_SOURCE_DIR}/src/audio/volume/volume_ipc3.c + ${PROJECT_SOURCE_DIR}/src/audio/volume/volume_generic.c + ${PROJECT_SOURCE_DIR}/src/audio/volume/volume_hifi3.c + ${PROJECT_SOURCE_DIR}/src/audio/volume/volume_hifi4.c + ${PROJECT_SOURCE_DIR}/src/audio/volume/volume_generic_with_peakvol.c + ${PROJECT_SOURCE_DIR}/src/audio/volume/volume_hifi3_with_peakvol.c + ${PROJECT_SOURCE_DIR}/src/audio/volume/volume_hifi4_with_peakvol.c ${PROJECT_SOURCE_DIR}/src/audio/module_adapter/module_adapter.c ${PROJECT_SOURCE_DIR}/src/audio/module_adapter/module/generic.c ${PROJECT_SOURCE_DIR}/src/audio/buffer.c diff --git a/zephyr/CMakeLists.txt b/zephyr/CMakeLists.txt index 5fec6d2a6e53..aa4d075614c1 100644 --- a/zephyr/CMakeLists.txt +++ b/zephyr/CMakeLists.txt @@ -499,25 +499,25 @@ zephyr_library_sources_ifdef(CONFIG_SAMPLE_KEYPHRASE if(CONFIG_IPC_MAJOR_3) zephyr_library_sources_ifdef(CONFIG_COMP_VOLUME - ${SOF_AUDIO_MODULES_PATH}/volume/volume_hifi4.c - ${SOF_AUDIO_MODULES_PATH}/volume/volume_hifi3.c - ${SOF_AUDIO_MODULES_PATH}/volume/volume_generic.c - ${SOF_AUDIO_MODULES_PATH}/volume/volume_hifi4_with_peakvol.c - ${SOF_AUDIO_MODULES_PATH}/volume/volume_hifi3_with_peakvol.c - ${SOF_AUDIO_MODULES_PATH}/volume/volume_generic_with_peakvol.c - ${SOF_AUDIO_MODULES_PATH}/volume/volume.c - ${SOF_AUDIO_MODULES_PATH}/volume/volume_ipc3.c + ${SOF_AUDIO_PATH}/volume/volume_hifi4.c + ${SOF_AUDIO_PATH}/volume/volume_hifi3.c + ${SOF_AUDIO_PATH}/volume/volume_generic.c + ${SOF_AUDIO_PATH}/volume/volume_hifi4_with_peakvol.c + ${SOF_AUDIO_PATH}/volume/volume_hifi3_with_peakvol.c + ${SOF_AUDIO_PATH}/volume/volume_generic_with_peakvol.c + ${SOF_AUDIO_PATH}/volume/volume.c + ${SOF_AUDIO_PATH}/volume/volume_ipc3.c ) elseif(CONFIG_IPC_MAJOR_4) zephyr_library_sources_ifdef(CONFIG_COMP_VOLUME - ${SOF_AUDIO_MODULES_PATH}/volume/volume_hifi4.c - ${SOF_AUDIO_MODULES_PATH}/volume/volume_hifi3.c - ${SOF_AUDIO_MODULES_PATH}/volume/volume_generic.c - ${SOF_AUDIO_MODULES_PATH}/volume/volume_hifi4_with_peakvol.c - ${SOF_AUDIO_MODULES_PATH}/volume/volume_hifi3_with_peakvol.c - ${SOF_AUDIO_MODULES_PATH}/volume/volume_generic_with_peakvol.c - ${SOF_AUDIO_MODULES_PATH}/volume/volume.c - ${SOF_AUDIO_MODULES_PATH}/volume/volume_ipc4.c + ${SOF_AUDIO_PATH}/volume/volume_hifi4.c + ${SOF_AUDIO_PATH}/volume/volume_hifi3.c + ${SOF_AUDIO_PATH}/volume/volume_generic.c + ${SOF_AUDIO_PATH}/volume/volume_hifi4_with_peakvol.c + ${SOF_AUDIO_PATH}/volume/volume_hifi3_with_peakvol.c + ${SOF_AUDIO_PATH}/volume/volume_generic_with_peakvol.c + ${SOF_AUDIO_PATH}/volume/volume.c + ${SOF_AUDIO_PATH}/volume/volume_ipc4.c ) endif()