Skip to content

Commit

Permalink
Audio: Volume: Add HiFi5 implementation.
Browse files Browse the repository at this point in the history
Add HiFi5 implementation of volume functions, compared with
HiFi3 version, can reduce about 28% cycles.

Signed-off-by: Andrula Song <[email protected]>
Signed-off-by: Seppo Ingalsuo <[email protected]>
  • Loading branch information
andrula-song authored and singalsu committed Oct 28, 2024
1 parent 45de1b6 commit 394c08d
Show file tree
Hide file tree
Showing 9 changed files with 1,167 additions and 7 deletions.
2 changes: 2 additions & 0 deletions src/audio/volume/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ if(CONFIG_COMP_VOLUME)
volume_generic.c
volume_hifi3.c
volume_hifi4.c
volume_hifi5.c
volume_generic_with_peakvol.c
volume_hifi3_with_peakvol.c
volume_hifi4_with_peakvol.c
volume_hifi5_with_peakvol.c
volume.c)
if(CONFIG_IPC_MAJOR_3)
add_local_sources(sof volume_ipc3.c)
Expand Down
6 changes: 6 additions & 0 deletions src/audio/volume/Kconfig.simd
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ choice "VOLUME_SIMD_LEVEL_SELECT"
When this was selected, optimization level will be determined
by toolchain pre-defined macros in core isa header file.

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

config VOLUME_HIFI_4
prompt "choose HIFI4 intrinsic optimized volume module"
bool
Expand Down
10 changes: 6 additions & 4 deletions src/audio/volume/volume.c
Original file line number Diff line number Diff line change
Expand Up @@ -646,19 +646,21 @@ static vol_zc_func vol_get_zc_function(struct comp_dev *dev,
static void volume_set_alignment(struct audio_stream *source,
struct audio_stream *sink)
{
#if SOF_USE_HIFI(3, VOLUME) || SOF_USE_HIFI(4, VOLUME) || SOF_USE_HIFI(5, VOLUME)
/* Both source and sink buffer in HiFi 3 or HiFi4 processing version,
/* Both source and sink buffer in HiFi5 processing version,
* xtensa intrinsics ask for 16-byte aligned.
*
* Both source and sink buffer in HiFi 3 or HiFi4 processing version,
* xtensa intrinsics ask for 8-byte aligned. 5.1 format SSE audio
* requires 16-byte aligned.
*/
const uint32_t byte_align = audio_stream_get_channels(source) == 6 ? 16 : 8;
const uint32_t byte_align = audio_stream_get_channels(source) == 6 ?
SOF_FRAME_BYTE_ALIGN_6CH : SOF_FRAME_BYTE_ALIGN;

/*There is no limit for frame number, so both source and sink set it to be 1*/
const uint32_t frame_align_req = 1;

audio_stream_set_align(byte_align, frame_align_req, source);
audio_stream_set_align(byte_align, frame_align_req, sink);
#endif
}

/**
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"

#if SOF_USE_HIFI(4, VOLUME) || SOF_USE_HIFI(5, VOLUME)
#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"

#if SOF_USE_HIFI(4, VOLUME) || SOF_USE_HIFI(5, VOLUME)
#if SOF_USE_HIFI(4, VOLUME)

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

0 comments on commit 394c08d

Please sign in to comment.