audio: dts: Add library stub

This will allow the fuzzer to probe deeper into the code while also
allowing CI to build test the adapter.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
This commit is contained in:
Curtis Malainey 2023-07-13 13:28:41 -07:00 committed by Liam Girdwood
parent 74a0e0f1fe
commit d28785ce73
5 changed files with 87 additions and 2 deletions

View File

@ -77,10 +77,14 @@ if((NOT CONFIG_LIBRARY) OR CONFIG_LIBRARY_STATIC)
endif()
if(CONFIG_DTS_CODEC)
add_local_sources(sof module/dts.c)
add_local_sources(sof module/dts/dts.c)
target_compile_definitions(sof PRIVATE -DDTS_MATH_INT32 -DDTS_XTENSA)
if (CONFIG_DTS_CODEC_STUB)
add_local_sources(sof module/dts/dts_stub.c)
else()
sof_add_static_library(DtsCodec ${CMAKE_CURRENT_LIST_DIR}/lib/release/libdts-sof-interface-i32.a)
endif()
endif()
return()
endif()

View File

@ -259,6 +259,7 @@ endif # volume
config DTS_CODEC
bool "DTS codec"
default n
select DTS_CODEC_STUB if COMP_STUBS
help
Select to include DTS codec.
In order to compile with this option enabled, a pre-compiled static library
@ -266,6 +267,14 @@ endif # volume
then compilation errors will occur.
For more information, please contact sales@xperi.com
config DTS_CODEC_STUB
bool "DTS codec stub"
depends on DTS_CODEC
default n
help
Select to include DTS codec stub library. This is meant for testing and CI
purposes only.
config INTEL_MODULES
bool "Intel modules"
default n

View File

@ -0,0 +1,68 @@
// SPDX-License-Identifier: BSD-3-Clause
//
// Copyright(c) 2023 Google LLC. All rights reserved.
//
// Author: Curtis Malainey <cujomalainey@chromium.org>
#include <sof/audio/dts/DtsSofInterface.h>
DtsSofInterfaceResult DTS_SOF_INTERFACE_API dtsSofInterfaceInit(
DtsSofInterfaceInst **ppInst,
DtsSofInterfaceAllocateMemory pMemoryAllocationFn,
DtsSofInterfaceFreeMemory pMemoryFreeFn,
void *MemoryAllocationContext) DTS_SOF_INTERFACE_NOEXCEPT
{
return DTS_SOF_INTERFACE_RESULT_SUCCESS;
}
DtsSofInterfaceResult DTS_SOF_INTERFACE_API dtsSofInterfacePrepare(
DtsSofInterfaceInst* pInst,
const DtsSofInterfaceBufferConfiguration* pBufferConfiguration,
void** ppSofInputBuffer,
unsigned int* pSofInputBufferSize,
void** ppSofOutputBuffer,
unsigned int* pSofOutputBufferSize) DTS_SOF_INTERFACE_NOEXCEPT
{
return DTS_SOF_INTERFACE_RESULT_SUCCESS;
}
DtsSofInterfaceResult DTS_SOF_INTERFACE_API dtsSofInterfaceInitProcess(
DtsSofInterfaceInst* pInst) DTS_SOF_INTERFACE_NOEXCEPT
{
return DTS_SOF_INTERFACE_RESULT_SUCCESS;
}
DtsSofInterfaceResult DTS_SOF_INTERFACE_API dtsSofInterfaceProcess(
DtsSofInterfaceInst* pInst,
unsigned int* pNumBytesProcessed) DTS_SOF_INTERFACE_NOEXCEPT
{
return DTS_SOF_INTERFACE_RESULT_SUCCESS;
}
DtsSofInterfaceResult DTS_SOF_INTERFACE_API dtsSofInterfaceApplyConfig(
DtsSofInterfaceInst* pInst,
int parameterId,
const void *pData,
unsigned int dataSize) DTS_SOF_INTERFACE_NOEXCEPT
{
return DTS_SOF_INTERFACE_RESULT_SUCCESS;
}
DtsSofInterfaceResult DTS_SOF_INTERFACE_API dtsSofInterfaceReset(
DtsSofInterfaceInst* pInst) DTS_SOF_INTERFACE_NOEXCEPT
{
return DTS_SOF_INTERFACE_RESULT_SUCCESS;
}
DtsSofInterfaceResult DTS_SOF_INTERFACE_API dtsSofInterfaceFree(
DtsSofInterfaceInst* pInst) DTS_SOF_INTERFACE_NOEXCEPT
{
return DTS_SOF_INTERFACE_RESULT_SUCCESS;
}
DtsSofInterfaceResult DTS_SOF_INTERFACE_API dtsSofInterfaceGetVersion(
DtsSofInterfaceVersionInfo* pInterfaceVersion,
DtsSofInterfaceVersionInfo* pSdkVersion) DTS_SOF_INTERFACE_NOEXCEPT
{
return DTS_SOF_INTERFACE_RESULT_SUCCESS;
}

View File

@ -730,7 +730,11 @@ zephyr_library_sources_ifdef(CONFIG_COMP_GOOGLE_HOTWORD_DETECT
)
zephyr_library_sources_ifdef(CONFIG_DTS_CODEC
${SOF_AUDIO_PATH}/module_adapter/module/dts.c
${SOF_AUDIO_PATH}/module_adapter/module/dts/dts.c
)
zephyr_library_sources_ifdef(CONFIG_DTS_CODEC_STUB
${SOF_AUDIO_PATH}/module_adapter/module/dts/dts_stub.c
)
zephyr_library_sources_ifdef(CONFIG_WAVES_CODEC