Skip to content

Commit 0ea5836

Browse files
singalsulgirdwood
authored andcommitted
Audio: STFT Process: Add Xtensa HiFi function versions
This patch adds to stft_process-hifi3.c the HiFi3 versions of higher complexity functions stft_process_apply_window() and stft_process_overlap_add_ifft_buffer(). The functions with no clear HiFi optimization benefit are moved from stft_process-generic.c to stft_process_common.c. Those functions move data with practically no processing to samples. The stft_process_setup() function is changed to allocate buffers with mod_balloc_align() to ensure a 32-bit sample pair or complex number is aligned for 64 bit xtensa SIMD. This patch also adds checks to other parameters to ensure the STFT is set up in a way that can be executed. The patch also fixes a too large allocation in setup. The window function buffer allocation is common for all channels. It should not be multiplied by channels count. This change saves 17 MCPS (from 63 MCPS to 46 MCPS). The test was done with script run: scripts/rebuild-testbench.sh -p mtl scripts/sof-testbench-helper.sh -x -m stft_process_1024_256_ \ -p profile-stft_process.txt The above STFT used FFT length 1024 with hop 256. Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
1 parent 5d04374 commit 0ea5836

8 files changed

Lines changed: 628 additions & 398 deletions

File tree

src/audio/stft_process/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ else()
88
add_local_sources(sof stft_process_setup.c)
99
add_local_sources(sof stft_process_common.c)
1010
add_local_sources(sof stft_process-generic.c)
11+
add_local_sources(sof stft_process-hifi3.c)
1112

1213
if(CONFIG_IPC_MAJOR_4)
1314
add_local_sources(sof stft_process-ipc4.c)

src/audio/stft_process/Kconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ config COMP_STFT_PROCESS
1919

2020
if COMP_STFT_PROCESS
2121

22+
rsource "Kconfig.simd"
23+
2224
config STFT_PROCESS_MAGNITUDE_PHASE
2325
bool "Convert FFTs to polar magnitude and phase"
2426
default n
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# SPDX-License-Identifier: BSD-3-Clause
2+
3+
comment "STFT Process optimization level select"
4+
5+
choice "COMP_STFT_PROCESS_SIMD_LEVEL_SELECT"
6+
prompt "Choose which SIMD level is used for the STFT Process module"
7+
depends on COMP_STFT_PROCESS
8+
default COMP_STFT_PROCESS_HIFI_MAX
9+
10+
config COMP_STFT_PROCESS_HIFI_MAX
11+
prompt "SIMD will be selected by toolchain pre-defined header"
12+
bool
13+
help
14+
When this is selected, the optimization level will be
15+
determined by the toolchain pre-defined macros in the
16+
core isa header file.
17+
18+
config COMP_STFT_PROCESS_HIFI_3
19+
prompt "Choose HIFI3 intrinsic optimized STFT Process module"
20+
bool
21+
help
22+
This option is used to build HIFI3 intrinsic optimized
23+
STFT Process code.
24+
25+
config COMP_STFT_PROCESS_HIFI_NONE
26+
prompt "Choose generic C STFT Process module, no HIFI SIMD involved"
27+
bool
28+
help
29+
This option is used to build STFT Process
30+
with generic C code.
31+
endchoice

0 commit comments

Comments
 (0)