Skip to content

Commit 2752cdf

Browse files
btian1kv2019i
authored andcommitted
Volume: Add volume simd build option
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 <baofeng.tian@intel.com>
1 parent a3045b8 commit 2752cdf

File tree

10 files changed

+44
-21
lines changed

10 files changed

+44
-21
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+
depends on COMP_VOLUME
8+
default VOLUME_HIFI_MAX
9+
10+
config VOLUME_HIFI_MAX
11+
prompt "SIMD will selected by toolchain pre-defined header"
12+
bool
13+
help
14+
When this was selected, optimization level will be determined
15+
by toolchain pre-defined macros in core isa header file.
16+
17+
config VOLUME_HIFI_4
18+
prompt "choose HIFI4 intrinsic optimized volume module"
19+
bool
20+
help
21+
This option used to build HIFI4 optimized volume code
22+
23+
config VOLUME_HIFI_3
24+
prompt "choose HIFI3 intrinsic optimized volume module"
25+
bool
26+
help
27+
This option used to build HIFI3 intrinsic optimized volume code
28+
29+
config VOLUME_HIFI_NONE
30+
prompt "choose generic C volume module, no HIFI SIMD involved"
31+
bool
32+
help
33+
This option used to build volume generic code.
34+
endchoice

src/audio/volume/volume.c

Lines changed: 2 additions & 2 deletions
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 SOF_USE_HIFI(4, VOLUME) || SOF_USE_HIFI(5, VOLUME)
591591
memset(cd->peak_vol, 0, sizeof(int32_t) * SOF_IPC_MAX_CHANNELS * 4);
592592
#endif
593593
}
@@ -622,7 +622,7 @@ static vol_zc_func vol_get_zc_function(struct comp_dev *dev,
622622
static void volume_set_alignment(struct audio_stream *source,
623623
struct audio_stream *sink)
624624
{
625-
#if XCHAL_HAVE_HIFI3 || XCHAL_HAVE_HIFI4
625+
#if SOF_USE_HIFI(3, VOLUME) || SOF_USE_HIFI(4, VOLUME) || SOF_USE_HIFI(5, VOLUME)
626626
/* Both source and sink buffer in HiFi 3 or HiFi4 processing version,
627627
* xtensa intrinsics ask for 8-byte aligned. 5.1 format SSE audio
628628
* requires 16-byte aligned.

src/audio/volume/volume.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,6 @@
3434
struct comp_buffer;
3535
struct sof_ipc_ctrl_value_chan;
3636

37-
#if defined(__XCC__)
38-
# 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
46-
#else
47-
# define VOLUME_GENERIC
48-
#endif
49-
5037
/**
5138
* \brief In IPC3 volume is in Q8.16 format, in IPC4 in Q1.31, but is converted
5239
* by firmware to Q1.23 format.

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 SOF_USE_HIFI(NONE, VOLUME)
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 SOF_USE_HIFI(NONE, VOLUME)
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 SOF_USE_HIFI(3, VOLUME)
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 SOF_USE_HIFI(3, VOLUME)
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 SOF_USE_HIFI(4, VOLUME) || SOF_USE_HIFI(5, VOLUME)
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 SOF_USE_HIFI(4, VOLUME) || SOF_USE_HIFI(5, VOLUME)
2525

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

0 commit comments

Comments
 (0)