Skip to content

Commit

Permalink
Volume: Add volume simd build option
Browse files Browse the repository at this point in the history
With common header file change merged, this patch is using the
new HIFI definition to build different volume modules based on toolchain.

Signed-off-by: Baofeng Tian <[email protected]>
  • Loading branch information
btian1 committed Jan 29, 2024
1 parent 3930270 commit 5c7db5b
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 20 deletions.
2 changes: 2 additions & 0 deletions src/audio/volume/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

if COMP_VOLUME

rsource "Kconfig.simd"

config COMP_VOLUME_WINDOWS_FADE
bool "Windows Fade shape volume transitions support"
help
Expand Down
34 changes: 34 additions & 0 deletions src/audio/volume/Kconfig.simd
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# SPDX-License-Identifier: BSD-3-Clause

comment "volume optimization level select"

choice "VOLUME_SIMD_LEVEL_SELECT"
prompt "choose which SIMD level used for volume module"
depends on COMP_VOLUME
default VOLUME_HIFI_MAX

config VOLUME_HIFI_MAX
prompt "SIMD will selected by toolchain pre-defined header"
bool
help
When this was selected, optimization level will be determined
by toolchain pre-defined macros in core isa header file.

config VOLUME_HIFI_4
prompt "choose HIFI4 intrinsic optimized volume module"
bool
help
This option used to build HIFI4 optimized volume code

config VOLUME_HIFI_3
prompt "choose HIFI3 intrinsic optimized volume module"
bool
help
This option used to build HIFI3 intrinsic optimized volume code

config VOLUME_HIFI_NONE
prompt "choose generic C volume module, no HIFI SIMD involved"
bool
help
This option used to build volume generic code.
endchoice
2 changes: 1 addition & 1 deletion src/audio/volume/volume.c
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ static int volume_process(struct processing_module *mod,
cd->peak_cnt = 0;
peak_vol_update(cd);
memset(cd->peak_regs.peak_meter, 0, sizeof(cd->peak_regs.peak_meter));
#ifdef VOLUME_HIFI4
#if CONFIG_VOLUME_HIFI4
memset(cd->peak_vol, 0, sizeof(int32_t) * SOF_IPC_MAX_CHANNELS * 4);
#endif
}
Expand Down
13 changes: 0 additions & 13 deletions src/audio/volume/volume.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,6 @@
struct comp_buffer;
struct sof_ipc_ctrl_value_chan;

#if defined(__XCC__)
# include <xtensa/config/core-isa.h>
# if XCHAL_HAVE_HIFI4
# define VOLUME_HIFI4
# elif XCHAL_HAVE_HIFI3
# define VOLUME_HIFI3
# else
# define VOLUME_GENERIC
# endif
#else
# define VOLUME_GENERIC
#endif

/**
* \brief In IPC3 volume is in Q8.16 format, in IPC4 in Q1.31, but is converted
* by firmware to Q1.23 format.
Expand Down
2 changes: 1 addition & 1 deletion src/audio/volume/volume_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ LOG_MODULE_DECLARE(volume_generic, CONFIG_SOF_LOG_LEVEL);

#include "volume.h"

#ifdef VOLUME_GENERIC
#if SOF_USE_HIFI(NONE, VOLUME)

#if (!CONFIG_COMP_PEAK_VOL)

Expand Down
2 changes: 1 addition & 1 deletion src/audio/volume/volume_generic_with_peakvol.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ LOG_MODULE_DECLARE(volume_generic, CONFIG_SOF_LOG_LEVEL);

#include "volume.h"

#ifdef VOLUME_GENERIC
#if SOF_USE_HIFI(NONE, VOLUME)

#if CONFIG_COMP_PEAK_VOL

Expand Down
2 changes: 1 addition & 1 deletion src/audio/volume/volume_hifi3.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ LOG_MODULE_DECLARE(volume_hifi3, CONFIG_SOF_LOG_LEVEL);

#include "volume.h"

#ifdef VOLUME_HIFI3
#if SOF_USE_HIFI(3, VOLUME)

#if (!CONFIG_COMP_PEAK_VOL)

Expand Down
2 changes: 1 addition & 1 deletion src/audio/volume/volume_hifi3_with_peakvol.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ LOG_MODULE_DECLARE(volume_hifi3, CONFIG_SOF_LOG_LEVEL);

#include "volume.h"

#ifdef VOLUME_HIFI3
#if SOF_USE_HIFI(3, VOLUME)

#if CONFIG_COMP_PEAK_VOL

Expand Down
2 changes: 1 addition & 1 deletion src/audio/volume/volume_hifi4.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ LOG_MODULE_DECLARE(volume_hifi4, CONFIG_SOF_LOG_LEVEL);

#include "volume.h"

#ifdef VOLUME_HIFI4
#if SOF_USE_HIFI(4, VOLUME)

#if (!CONFIG_COMP_PEAK_VOL)

Expand Down
2 changes: 1 addition & 1 deletion src/audio/volume/volume_hifi4_with_peakvol.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ LOG_MODULE_DECLARE(volume_hifi4, CONFIG_SOF_LOG_LEVEL);

#include "volume.h"

#ifdef VOLUME_HIFI4
#if SOF_USE_HIFI(4, VOLUME)

#if CONFIG_COMP_PEAK_VOL
#include <xtensa/tie/xt_hifi4.h>
Expand Down

0 comments on commit 5c7db5b

Please sign in to comment.