Skip to content

Commit a2b5b46

Browse files
committed
Volume: Add volume simd build option
Previously, volume simd version selection is based on compiler toolchain, this change keep the original logic as default, if there is no valid simd option was selected. If there is a selection from kconfig, then this option will override compiler build option and be used to build volume module. Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
1 parent ac76b3e commit a2b5b46

File tree

10 files changed

+53
-15
lines changed

10 files changed

+53
-15
lines changed

src/audio/volume/Kconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
if COMP_VOLUME
1010

11+
rsource "Kconfig.simd"
12+
1113
config COMP_VOLUME_WINDOWS_FADE
1214
bool "Windows Fade shape volume transitions support"
1315
help

src/audio/volume/Kconfig.simd

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# SPDX-License-Identifier: BSD-3-Clause
2+
3+
comment "volume optimization level select"
4+
5+
choice "VOLUME_SIMD_LEVEL_SELECT"
6+
prompt "choose which simd level used for volume module"
7+
8+
config VOLUME_SIMD_TOOLCHAIN_SELECT
9+
prompt "simd will selected by toolchain pre-defined header"
10+
bool
11+
help
12+
When this was selected, optimization level will be determined
13+
by toolchain pre-defined macros in core isa header file.
14+
15+
config VOLUME_HIFI3
16+
prompt "choose hifi3 intrinsic optimized volume module"
17+
depends on ARCH="xtensa"
18+
bool
19+
help
20+
This option used to build HIFI3 intrinsic optimized volume code
21+
22+
config VOLUME_HIFI4
23+
prompt "choose hifi4 intrinsic optimized volume module"
24+
depends on ARCH="xtensa"
25+
bool
26+
help
27+
This option used to build HIFI4 optimized volume code
28+
29+
config VOLUME_GENERIC
30+
prompt "choose generic C volume module, no simd involved"
31+
bool
32+
help
33+
This option used to build volume generic code.
34+
endchoice

src/audio/volume/volume.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ static int volume_process(struct processing_module *mod,
587587
cd->peak_cnt = 0;
588588
peak_vol_update(cd);
589589
memset(cd->peak_regs.peak_meter, 0, sizeof(cd->peak_regs.peak_meter));
590-
#ifdef VOLUME_HIFI4
590+
#if CONFIG_VOLUME_HIFI4
591591
memset(cd->peak_vol, 0, sizeof(int32_t) * SOF_IPC_MAX_CHANNELS * 4);
592592
#endif
593593
}

src/audio/volume/volume.h

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,17 @@ struct sof_ipc_ctrl_value_chan;
3636

3737
#if defined(__XCC__)
3838
# include <xtensa/config/core-isa.h>
39-
# if XCHAL_HAVE_HIFI4
40-
# define VOLUME_HIFI4
41-
# elif XCHAL_HAVE_HIFI3
42-
# define VOLUME_HIFI3
43-
# else
44-
# define VOLUME_GENERIC
45-
# endif
39+
#if CONFIG_VOLUME_SIMD_TOOLCHAIN_SELECT
40+
#if XCHAL_HAVE_HIFI4
41+
# define CONFIG_VOLUME_HIFI4 1
42+
#elif XCHAL_HAVE_HIFI3
43+
# define CONFIG_VOLUME_HIFI3 1
4644
#else
47-
# define VOLUME_GENERIC
45+
# define CONFIG_VOLUME_GENERIC 1
46+
#endif
47+
#endif
48+
#else
49+
# define CONFIG_VOLUME_GENERIC 1
4850
#endif
4951

5052
/**

src/audio/volume/volume_generic.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ LOG_MODULE_DECLARE(volume_generic, CONFIG_SOF_LOG_LEVEL);
2727

2828
#include "volume.h"
2929

30-
#ifdef VOLUME_GENERIC
30+
#if CONFIG_VOLUME_GENERIC
3131

3232
#if (!CONFIG_COMP_PEAK_VOL)
3333

src/audio/volume/volume_generic_with_peakvol.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ LOG_MODULE_DECLARE(volume_generic, CONFIG_SOF_LOG_LEVEL);
2323

2424
#include "volume.h"
2525

26-
#ifdef VOLUME_GENERIC
26+
#if CONFIG_VOLUME_GENERIC
2727

2828
#if CONFIG_COMP_PEAK_VOL
2929

src/audio/volume/volume_hifi3.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ LOG_MODULE_DECLARE(volume_hifi3, CONFIG_SOF_LOG_LEVEL);
2121

2222
#include "volume.h"
2323

24-
#ifdef VOLUME_HIFI3
24+
#if CONFIG_VOLUME_HIFI3
2525

2626
#if (!CONFIG_COMP_PEAK_VOL)
2727

src/audio/volume/volume_hifi3_with_peakvol.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ LOG_MODULE_DECLARE(volume_hifi3, CONFIG_SOF_LOG_LEVEL);
2121

2222
#include "volume.h"
2323

24-
#ifdef VOLUME_HIFI3
24+
#if CONFIG_VOLUME_HIFI3
2525

2626
#if CONFIG_COMP_PEAK_VOL
2727

src/audio/volume/volume_hifi4.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ LOG_MODULE_DECLARE(volume_hifi4, CONFIG_SOF_LOG_LEVEL);
2121

2222
#include "volume.h"
2323

24-
#ifdef VOLUME_HIFI4
24+
#if CONFIG_VOLUME_HIFI4
2525

2626
#if (!CONFIG_COMP_PEAK_VOL)
2727

src/audio/volume/volume_hifi4_with_peakvol.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ LOG_MODULE_DECLARE(volume_hifi4, CONFIG_SOF_LOG_LEVEL);
2121

2222
#include "volume.h"
2323

24-
#ifdef VOLUME_HIFI4
24+
#if CONFIG_VOLUME_HIFI4
2525

2626
#if CONFIG_COMP_PEAK_VOL
2727
#include <xtensa/tie/xt_hifi4.h>

0 commit comments

Comments
 (0)