hikey960: HiFi3 host side XAF framework
Xtensa Audio Framework in user space to offload audio tasks to HiFi3 DSP.
It provides few API's to invoke DSP and to perform ogg audio decoding,
post processing (PCM Gain) as well it provides adb shell-based
"xaf-dec-test" and "xaf-dec-mix-test" binaries to perform pcm and ogg
file playback
Change-Id: I77ac3b56d4141f41e06f0d0eac4ac3a8ee567e8d
Signed-off-by: Niranjan Yadla <nyadla@cadence.com>
diff --git a/hifi/xaf/host-apf/include/audio/xa-audio-decoder-api.h b/hifi/xaf/host-apf/include/audio/xa-audio-decoder-api.h
new file mode 100644
index 0000000..f82544c
--- /dev/null
+++ b/hifi/xaf/host-apf/include/audio/xa-audio-decoder-api.h
@@ -0,0 +1,46 @@
+/*******************************************************************************
+* Copyright (C) 2018 Cadence Design Systems, Inc.
+*
+* Permission is hereby granted, free of charge, to any person obtaining
+* a copy of this software and associated documentation files (the
+* "Software"), to use this Software with Cadence processor cores only and
+* not with any other processors and platforms, subject to
+* the following conditions:
+*
+* The above copyright notice and this permission notice shall be included
+* in all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+******************************************************************************/
+
+#ifndef __XA_ADEC_API_H__
+#define __XA_ADEC_API_H__
+
+/* ...generic audio-decoder configuration parameters */
+enum xa_config_param_codec {
+ XA_CODEC_CONFIG_PARAM_CHANNELS = 0x10000 + 0,
+ XA_CODEC_CONFIG_PARAM_SAMPLE_RATE = 0x10000 + 1,
+ XA_CODEC_CONFIG_PARAM_PCM_WIDTH = 0x10000 + 2,
+ XA_CODEC_CONFIG_PARAM_PRODUCED = 0x10000 + 3
+};
+
+/* ...ports indices */
+enum xa_codec_ports {
+ XA_CODEC_INPUT_PORT = 0,
+ XA_CODEC_OUTPUT_PORT = 1
+};
+
+/* ...non-fatal execution errors */
+enum
+{
+ XA_CODEC_EXEC_NO_DATA = XA_ERROR_CODE(xa_severity_nonfatal, xa_class_execute, XA_CODEC_GENERIC, 0)
+};
+
+#endif
diff --git a/hifi/xaf/host-apf/include/audio/xa-mixer-api.h b/hifi/xaf/host-apf/include/audio/xa-mixer-api.h
new file mode 100644
index 0000000..c9695b4
--- /dev/null
+++ b/hifi/xaf/host-apf/include/audio/xa-mixer-api.h
@@ -0,0 +1,154 @@
+/*******************************************************************************
+* Copyright (C) 2018 Cadence Design Systems, Inc.
+*
+* Permission is hereby granted, free of charge, to any person obtaining
+* a copy of this software and associated documentation files (the
+* "Software"), to use this Software with Cadence processor cores only and
+* not with any other processors and platforms, subject to
+* the following conditions:
+*
+* The above copyright notice and this permission notice shall be included
+* in all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+******************************************************************************/
+
+#ifndef __XA_MIXER_API_H__
+#define __XA_MIXER_API_H__
+
+/*******************************************************************************
+ * Includes
+ ******************************************************************************/
+
+/* ...generic commands */
+#include "xa_apicmd_standards.h"
+
+/* ...generic error codes */
+#include "xa_error_standards.h"
+
+/* ...common types */
+#include "xa_type_def.h"
+
+/*******************************************************************************
+ * Constants definitions
+ ******************************************************************************/
+
+/* ...mixer-specific configuration parameters */
+enum xa_config_param_mixer {
+ XA_MIXER_CONFIG_PARAM_INPUT_TRACKS = 0,
+ XA_MIXER_CONFIG_PARAM_PCM_WIDTH = 1,
+ XA_MIXER_CONFIG_PARAM_CHANNELS = 2,
+ XA_MIXER_CONFIG_PARAM_SAMPLE_RATE = 4,
+ XA_MIXER_CONFIG_PARAM_FRAME_SIZE = 5,
+ XA_MIXER_CONFIG_PARAM_BUFFER_SIZE = 6,
+ XA_MIXER_CONFIG_PARAM_VOLUME = 7,
+ XA_MIXER_CONFIG_PARAM_NUM = 8
+};
+
+/* ...component identifier (informative) */
+#define XA_CODEC_MIXER 1
+
+/* ...global limitation - maximal mixer track number */
+#define XA_MIXER_MAX_TRACK_NUMBER 4
+
+/* ...volume representation */
+#define __XA_MIXER_VOLUME(v) \
+ ({ u32 __v = (u32)((v) * (1 << 12)); (__v > 0xFFFF ? __v = 0xFFFF : 0); (u16)__v; })
+
+/* ...mixer volume setting command encoding */
+#define XA_MIXER_VOLUME(track, channel, volume) \
+ (__XA_MIXER_VOLUME(volume) | ((track) << 16) | ((channel) << 20))
+
+/*******************************************************************************
+ * Class 0: API Errors
+ ******************************************************************************/
+
+#define XA_MIXER_API_NONFATAL(e) \
+ XA_ERROR_CODE(xa_severity_nonfatal, xa_class_api, XA_CODEC_MIXER, (e))
+
+#define XA_MIXER_API_FATAL(e) \
+ XA_ERROR_CODE(xa_severity_fatal, xa_class_api, XA_CODEC_MIXER, (e))
+
+enum xa_error_nonfatal_api_mixer {
+ XA_MIXER_API_NONFATAL_MAX = XA_MIXER_API_NONFATAL(0)
+};
+
+enum xa_error_fatal_api_mixer {
+ XA_MIXER_API_FATAL_MAX = XA_MIXER_API_FATAL(0)
+};
+
+/*******************************************************************************
+ * Class 1: Configuration Errors
+ ******************************************************************************/
+
+#define XA_MIXER_CONFIG_NONFATAL(e) \
+ XA_ERROR_CODE(xa_severity_nonfatal, xa_class_config, XA_CODEC_MIXER, (e))
+
+#define XA_MIXER_CONFIG_FATAL(e) \
+ XA_ERROR_CODE(xa_severity_fatal, xa_class_config, XA_CODEC_MIXER, (e))
+
+enum xa_error_nonfatal_config_mixer {
+ XA_MIXER_CONFIG_NONFATAL_RANGE = XA_MIXER_CONFIG_NONFATAL(0),
+ XA_MIXER_CONFIG_NONFATAL_STATE = XA_MIXER_CONFIG_NONFATAL(1),
+ XA_MIXER_CONFIG_NONFATAL_MAX = XA_MIXER_CONFIG_NONFATAL(2)
+};
+
+enum xa_error_fatal_config_mixer {
+ XA_MIXER_CONFIG_FATAL_RANGE = XA_MIXER_CONFIG_FATAL(0),
+ XA_MIXER_CONFIG_FATAL_TRACK_STATE = XA_MIXER_CONFIG_FATAL(0 + XA_MIXER_CONFIG_NONFATAL_MAX),
+ XA_MIXER_CONFIG_FATAL_MAX = XA_MIXER_CONFIG_FATAL(1)
+};
+
+/*******************************************************************************
+ * Class 2: Execution Class Errors
+ ******************************************************************************/
+
+#define XA_MIXER_EXEC_NONFATAL(e) \
+ XA_ERROR_CODE(xa_severity_nonfatal, xa_class_execute, XA_CODEC_MIXER, (e))
+
+#define XA_MIXER_EXEC_FATAL(e) \
+ XA_ERROR_CODE(xa_severity_fatal, xa_class_execute, XA_CODEC_MIXER, (e))
+
+enum xa_error_nonfatal_execute_mixer {
+ XA_MIXER_EXEC_NONFATAL_STATE = XA_MIXER_EXEC_NONFATAL(0),
+ XA_MIXER_EXEC_NONFATAL_NO_DATA = XA_MIXER_EXEC_NONFATAL(1),
+ XA_MIXER_EXEC_NONFATAL_INPUT = XA_MIXER_EXEC_NONFATAL(2),
+ XA_MIXER_EXEC_NONFATAL_OUTPUT = XA_MIXER_EXEC_NONFATAL(3),
+ XA_MIXER_EXEC_NONFATAL_MAX = XA_MIXER_EXEC_NONFATAL(4)
+};
+
+enum xa_error_fatal_execute_mixer {
+ XA_MIXER_EXEC_FATAL_STATE = XA_MIXER_EXEC_FATAL(0),
+ XA_MIXER_EXEC_FATAL_INPUT = XA_MIXER_EXEC_FATAL(1),
+ XA_MIXER_EXEC_FATAL_OUTPUT = XA_MIXER_EXEC_FATAL(2),
+ XA_MIXER_EXEC_FATAL_MAX = XA_MIXER_EXEC_FATAL(3)
+};
+
+/*******************************************************************************
+ * API function definition (tbd)
+ ******************************************************************************/
+
+#if defined(USE_DLL) && defined(_WIN32)
+#define DLL_SHARED __declspec(dllimport)
+#elif defined (_WINDLL)
+#define DLL_SHARED __declspec(dllexport)
+#else
+#define DLL_SHARED
+#endif
+
+#if defined(__cplusplus)
+extern "C" {
+#endif /* __cplusplus */
+DLL_SHARED xa_codec_func_t xa_mixer;
+#if defined(__cplusplus)
+}
+#endif /* __cplusplus */
+
+#endif /* __XA_MIXER_API_H__ */
diff --git a/hifi/xaf/host-apf/include/audio/xa-pcm-api.h b/hifi/xaf/host-apf/include/audio/xa-pcm-api.h
new file mode 100644
index 0000000..94fb136
--- /dev/null
+++ b/hifi/xaf/host-apf/include/audio/xa-pcm-api.h
@@ -0,0 +1,138 @@
+/*******************************************************************************
+* Copyright (C) 2018 Cadence Design Systems, Inc.
+*
+* Permission is hereby granted, free of charge, to any person obtaining
+* a copy of this software and associated documentation files (the
+* "Software"), to use this Software with Cadence processor cores only and
+* not with any other processors and platforms, subject to
+* the following conditions:
+*
+* The above copyright notice and this permission notice shall be included
+* in all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+******************************************************************************/
+
+#ifndef __XA_PCM_API_H__
+#define __XA_PCM_API_H__
+
+/*******************************************************************************
+ * Includes
+ ******************************************************************************/
+
+#include "xa_type_def.h"
+#include "xa_error_standards.h"
+#include "xa_apicmd_standards.h"
+#include "xa_memory_standards.h"
+
+/*******************************************************************************
+ * Constants definitions
+ ******************************************************************************/
+
+/* ...codec-specific configuration parameters */
+enum xa_config_param_pcm {
+ XA_PCM_CONFIG_PARAM_SAMPLE_RATE = 0,
+ XA_PCM_CONFIG_PARAM_IN_PCM_WIDTH = 1,
+ XA_PCM_CONFIG_PARAM_IN_CHANNELS = 2,
+ XA_PCM_CONFIG_PARAM_OUT_PCM_WIDTH = 3,
+ XA_PCM_CONFIG_PARAM_OUT_CHANNELS = 4,
+ XA_PCM_CONFIG_PARAM_CHANROUTING = 5,
+ XA_PCM_CONFIG_PARAM_NUM = 6,
+};
+
+/* ...component identifier (informative) */
+#define XA_CODEC_PCM 16
+
+/*******************************************************************************
+ * Class 0: API Errors
+ ******************************************************************************/
+
+#define XA_PCM_API_NONFATAL(e) \
+ XA_ERROR_CODE(xa_severity_nonfatal, xa_class_api, XA_CODEC_PCM, (e))
+
+#define XA_PCM_API_FATAL(e) \
+ XA_ERROR_CODE(xa_severity_fatal, xa_class_api, XA_CODEC_PCM, (e))
+
+enum xa_error_nonfatal_api_pcm {
+ XA_PCM_API_NONFATAL_MAX = XA_PCM_API_NONFATAL(0)
+};
+
+enum xa_error_fatal_api_pcm {
+ XA_PCM_API_FATAL_MAX = XA_PCM_API_FATAL(0)
+};
+
+/*******************************************************************************
+ * Class 1: Configuration Errors
+ ******************************************************************************/
+
+#define XA_PCM_CONFIG_NONFATAL(e) \
+ XA_ERROR_CODE(xa_severity_nonfatal, xa_class_config, XA_CODEC_PCM, (e))
+
+#define XA_PCM_CONFIG_FATAL(e) \
+ XA_ERROR_CODE(xa_severity_fatal, xa_class_config, XA_CODEC_PCM, (e))
+
+enum xa_error_nonfatal_config_pcm {
+ XA_PCM_CONFIG_NONFATAL_RANGE = XA_PCM_CONFIG_NONFATAL(0),
+ XA_PCM_CONFIG_NONFATAL_STATE = XA_PCM_CONFIG_NONFATAL(1),
+ XA_PCM_CONFIG_NONFATAL_MAX = XA_PCM_CONFIG_NONFATAL(2)
+};
+
+enum xa_error_fatal_config_pcm {
+ XA_PCM_CONFIG_FATAL_RANGE = XA_PCM_CONFIG_FATAL(0),
+ XA_PCM_CONFIG_FATAL_MAX = XA_PCM_CONFIG_FATAL(1)
+};
+
+/*******************************************************************************
+ * Class 2: Execution Class Errors
+ ******************************************************************************/
+
+#define XA_PCM_EXEC_NONFATAL(e) \
+ XA_ERROR_CODE(xa_severity_nonfatal, xa_class_execute, XA_CODEC_PCM, (e))
+
+#define XA_PCM_EXEC_FATAL(e) \
+ XA_ERROR_CODE(xa_severity_fatal, xa_class_execute, XA_CODEC_PCM, (e))
+
+enum xa_error_nonfatal_execute_pcm {
+ XA_PCM_EXEC_NONFATAL_STATE = XA_PCM_EXEC_NONFATAL(0),
+ XA_PCM_EXEC_NONFATAL_NO_DATA = XA_PCM_EXEC_NONFATAL(1),
+ XA_PCM_EXEC_NONFATAL_INPUT = XA_PCM_EXEC_NONFATAL(2),
+ XA_PCM_EXEC_NONFATAL_OUTPUT = XA_PCM_EXEC_NONFATAL(3),
+ XA_PCM_EXEC_NONFATAL_MAX = XA_PCM_EXEC_NONFATAL(4)
+};
+
+enum xa_error_fatal_execute_pcm {
+ XA_PCM_EXEC_FATAL_STATE = XA_PCM_EXEC_FATAL(0),
+ XA_PCM_EXEC_FATAL_INPUT = XA_PCM_EXEC_FATAL(1),
+ XA_PCM_EXEC_FATAL_OUTPUT = XA_PCM_EXEC_FATAL(2),
+ XA_PCM_EXEC_FATAL_MAX = XA_PCM_EXEC_FATAL(3)
+};
+
+/*******************************************************************************
+ * API function definition
+ ******************************************************************************/
+
+#if defined(USE_DLL) && defined(_WIN32)
+#define DLL_SHARED __declspec(dllimport)
+#elif defined (_WINDLL)
+#define DLL_SHARED __declspec(dllexport)
+#else
+#define DLL_SHARED
+#endif
+
+#if defined(__cplusplus)
+extern "C" {
+#endif /* __cplusplus */
+DLL_SHARED xa_codec_func_t xa_pcm_codec;
+#if defined(__cplusplus)
+}
+#endif /* __cplusplus */
+
+#endif /* __XA_PCM_API_H__ */
+
diff --git a/hifi/xaf/host-apf/include/audio/xa_apicmd_standards.h b/hifi/xaf/host-apf/include/audio/xa_apicmd_standards.h
new file mode 100644
index 0000000..eb1b78e
--- /dev/null
+++ b/hifi/xaf/host-apf/include/audio/xa_apicmd_standards.h
@@ -0,0 +1,107 @@
+/*******************************************************************************
+* Copyright (C) 2018 Cadence Design Systems, Inc.
+*
+* Permission is hereby granted, free of charge, to any person obtaining
+* a copy of this software and associated documentation files (the
+* "Software"), to use this Software with Cadence processor cores only and
+* not with any other processors and platforms, subject to
+* the following conditions:
+*
+* The above copyright notice and this permission notice shall be included
+* in all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+******************************************************************************/
+/*******************************************************************************
+*
+* NOTE, ANY CHANGES TO THIS FILE MAY AFFECT UNDERLYING AUDIO / SPEECH CODEC
+* LIBRARY COMPONENT FROM CADENCE DESIGN SYSTEMS, INC.
+*
+******************************************************************************/
+
+
+#ifndef __XA_API_CMD_STANDARDS_H__
+#define __XA_API_CMD_STANDARDS_H__
+
+/*****************************************************************************/
+/* Standard API commands */
+/*****************************************************************************/
+
+enum xa_api_cmd_generic {
+ XA_API_CMD_GET_LIB_ID_STRINGS = 0x0001,
+
+ XA_API_CMD_GET_API_SIZE = 0x0002,
+ XA_API_CMD_INIT = 0x0003,
+
+ XA_API_CMD_SET_CONFIG_PARAM = 0x0004,
+ XA_API_CMD_GET_CONFIG_PARAM = 0x0005,
+
+ XA_API_CMD_GET_MEMTABS_SIZE = 0x0006,
+ XA_API_CMD_SET_MEMTABS_PTR = 0x0007,
+ XA_API_CMD_GET_N_MEMTABS = 0x0008,
+
+ XA_API_CMD_EXECUTE = 0x0009,
+
+ XA_API_CMD_PUT_INPUT_QUERY = 0x000A,
+ XA_API_CMD_GET_CURIDX_INPUT_BUF = 0x000B,
+ XA_API_CMD_SET_INPUT_BYTES = 0x000C,
+ XA_API_CMD_GET_OUTPUT_BYTES = 0x000D,
+ XA_API_CMD_INPUT_OVER = 0x000E,
+
+ XA_API_CMD_GET_MEM_INFO_SIZE = 0x0010,
+ XA_API_CMD_GET_MEM_INFO_ALIGNMENT = 0x0011,
+ XA_API_CMD_GET_MEM_INFO_TYPE = 0x0012,
+ XA_API_CMD_GET_MEM_INFO_PLACEMENT = 0x0013,
+ XA_API_CMD_GET_MEM_INFO_PRIORITY = 0x0014,
+ XA_API_CMD_SET_MEM_PTR = 0x0015,
+ XA_API_CMD_SET_MEM_INFO_SIZE = 0x0016,
+ XA_API_CMD_SET_MEM_PLACEMENT = 0x0017,
+
+ XA_API_CMD_GET_N_TABLES = 0x0018,
+ XA_API_CMD_GET_TABLE_INFO_SIZE = 0x0019,
+ XA_API_CMD_GET_TABLE_INFO_ALIGNMENT = 0x001A,
+ XA_API_CMD_GET_TABLE_INFO_PRIORITY = 0x001B,
+ XA_API_CMD_SET_TABLE_PTR = 0x001C,
+ XA_API_CMD_GET_TABLE_PTR = 0x001D
+};
+
+/*****************************************************************************/
+/* Standard API command indices */
+/*****************************************************************************/
+
+enum xa_cmd_type_generic {
+ /* XA_API_CMD_GET_LIB_ID_STRINGS indices */
+ XA_CMD_TYPE_LIB_NAME = 0x0100,
+ XA_CMD_TYPE_LIB_VERSION = 0x0200,
+ XA_CMD_TYPE_API_VERSION = 0x0300,
+
+ /* XA_API_CMD_INIT indices */
+ XA_CMD_TYPE_INIT_API_PRE_CONFIG_PARAMS = 0x0100,
+ XA_CMD_TYPE_INIT_API_POST_CONFIG_PARAMS = 0x0200,
+ XA_CMD_TYPE_INIT_PROCESS = 0x0300,
+ XA_CMD_TYPE_INIT_DONE_QUERY = 0x0400,
+
+ /* XA_API_CMD_EXECUTE indices */
+ XA_CMD_TYPE_DO_EXECUTE = 0x0100,
+ XA_CMD_TYPE_DONE_QUERY = 0x0200,
+ XA_CMD_TYPE_DO_RUNTIME_INIT = 0x0300
+};
+
+
+/*****************************************************************************/
+/* Standard API configuration parameters */
+/*****************************************************************************/
+
+enum xa_config_param_generic {
+ XA_CONFIG_PARAM_CUR_INPUT_STREAM_POS = 0x0100,
+ XA_CONFIG_PARAM_GEN_INPUT_STREAM_POS = 0x0200,
+};
+
+#endif /* __XA_API_CMD_STANDARDS_H__ */
diff --git a/hifi/xaf/host-apf/include/audio/xa_error_standards.h b/hifi/xaf/host-apf/include/audio/xa_error_standards.h
new file mode 100644
index 0000000..1b67b52
--- /dev/null
+++ b/hifi/xaf/host-apf/include/audio/xa_error_standards.h
@@ -0,0 +1,79 @@
+/*******************************************************************************
+* Copyright (C) 2018 Cadence Design Systems, Inc.
+*
+* Permission is hereby granted, free of charge, to any person obtaining
+* a copy of this software and associated documentation files (the
+* "Software"), to use this Software with Cadence processor cores only and
+* not with any other processors and platforms, subject to
+* the following conditions:
+*
+* The above copyright notice and this permission notice shall be included
+* in all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+******************************************************************************/
+/*******************************************************************************
+*
+* NOTE, ANY CHANGES TO THIS FILE MAY AFFECT UNDERLYING AUDIO / SPEECH CODEC
+* LIBRARY COMPONENT FROM CADENCE DESIGN SYSTEMS, INC.
+*
+******************************************************************************/
+
+
+#ifndef __XA_ERROR_STANDARDS_H__
+#define __XA_ERROR_STANDARDS_H__
+
+/*****************************************************************************/
+/* File includes */
+/* xa_type_def.h */
+/*****************************************************************************/
+
+/*****************************************************************************/
+/* Constant hash defines */
+/*****************************************************************************/
+#define XA_NO_ERROR 0
+#define XA_FATAL_ERROR 0x80000000
+
+enum xa_error_severity {
+ xa_severity_nonfatal = 0,
+ xa_severity_fatal = 0xffffffff
+};
+
+enum xa_error_class {
+ xa_class_api = 0,
+ xa_class_config = 1,
+ xa_class_execute = 2,
+ xa_class_proxy = 3
+};
+
+#define XA_CODEC_GENERIC 0
+
+#define XA_ERROR_CODE(severity, class, codec, index) ((severity << 15) | (class << 11) | (codec << 6) | index)
+#define XA_ERROR_SEVERITY(code) (((code) & XA_FATAL_ERROR) != 0)
+#define XA_ERROR_CLASS(code) (((code) >> 11) & 0x0f)
+#define XA_ERROR_CODEC(code) (((code) >> 6) & 0x1f)
+#define XA_ERROR_SUBCODE(code) (((code) >> 0) & 0x3f)
+
+/* Our convention is that only api-class errors can be generic ones. */
+
+/*****************************************************************************/
+/* Class 0: API Errors */
+/*****************************************************************************/
+/* Non Fatal Errors */
+/* (none) */
+/* Fatal Errors */
+enum xa_error_fatal_api_generic {
+ XA_API_FATAL_MEM_ALLOC = XA_ERROR_CODE(xa_severity_fatal, xa_class_api, XA_CODEC_GENERIC, 0),
+ XA_API_FATAL_MEM_ALIGN = XA_ERROR_CODE(xa_severity_fatal, xa_class_api, XA_CODEC_GENERIC, 1),
+ XA_API_FATAL_INVALID_CMD = XA_ERROR_CODE(xa_severity_fatal, xa_class_api, XA_CODEC_GENERIC, 2),
+ XA_API_FATAL_INVALID_CMD_TYPE = XA_ERROR_CODE(xa_severity_fatal, xa_class_api, XA_CODEC_GENERIC, 3)
+};
+
+#endif /* __XA_ERROR_STANDARDS_H__ */
diff --git a/hifi/xaf/host-apf/include/audio/xa_memory_standards.h b/hifi/xaf/host-apf/include/audio/xa_memory_standards.h
new file mode 100644
index 0000000..27ec455
--- /dev/null
+++ b/hifi/xaf/host-apf/include/audio/xa_memory_standards.h
@@ -0,0 +1,104 @@
+/*******************************************************************************
+* Copyright (C) 2018 Cadence Design Systems, Inc.
+*
+* Permission is hereby granted, free of charge, to any person obtaining
+* a copy of this software and associated documentation files (the
+* "Software"), to use this Software with Cadence processor cores only and
+* not with any other processors and platforms, subject to
+* the following conditions:
+*
+* The above copyright notice and this permission notice shall be included
+* in all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+******************************************************************************/
+/*******************************************************************************
+*
+* NOTE, ANY CHANGES TO THIS FILE MAY AFFECT UNDERLYING AUDIO / SPEECH CODEC
+* LIBRARY COMPONENT FROM CADENCE DESIGN SYSTEMS, INC.
+*
+******************************************************************************/
+
+
+#ifndef __XA_MEMORY_STANDARDS_H__
+#define __XA_MEMORY_STANDARDS_H__
+
+/*****************************************************************************/
+/* Constant hash defines */
+/*****************************************************************************/
+/* when you don't need alignment, pass this to memory library */
+#define XA_MEM_NO_ALIGN 0x01
+
+/* standard memory types */
+/* to be used inter frames */
+#define XA_MEMTYPE_PERSIST 0x00
+/* read write, to be used intra frames */
+#define XA_MEMTYPE_SCRATCH 0x01
+/* read only memory, intra frame */
+#define XA_MEMTYPE_INPUT 0x02
+/* read-write memory, for usable output, intra frame */
+#define XA_MEMTYPE_OUTPUT 0x03
+/* readonly memory, inter frame */
+#define XA_MEMTYPE_TABLE 0x04
+/* input buffer before mem tabs allocation */
+#define XA_MEMTYPE_PRE_FRAME_INPUT 0x05
+/* input buffer before mem tabs allocation */
+#define XA_MEMTYPE_PRE_FRAME_SCRATCH 0x06
+/* for local variables */
+#define XA_MEMTYPE_AUTO_VAR 0x80
+
+/* standard memory priorities */
+#define XA_MEMPRIORITY_ANYWHERE 0x00
+#define XA_MEMPRIORITY_LOWEST 0x01
+#define XA_MEMPRIORITY_LOW 0x02
+#define XA_MEMPRIORITY_NORM 0x03
+#define XA_MEMPRIORITY_ABOVE_NORM 0x04
+#define XA_MEMPRIORITY_HIGH 0x05
+#define XA_MEMPRIORITY_HIGHER 0x06
+#define XA_MEMPRIORITY_CRITICAL 0x07
+
+/* standard memory placements */
+/* placement is defined by 64 bits */
+
+#define XA_MEMPLACE_FAST_RAM_0 0x000001
+#define XA_MEMPLACE_FAST_RAM_1 0x000002
+#define XA_MEMPLACE_FAST_RAM_2 0x000004
+#define XA_MEMPLACE_FAST_RAM_3 0x000008
+#define XA_MEMPLACE_FAST_RAM_4 0x000010
+#define XA_MEMPLACE_FAST_RAM_5 0x000020
+#define XA_MEMPLACE_FAST_RAM_6 0x000040
+#define XA_MEMPLACE_FAST_RAM_7 0x000080
+
+#define XA_MEMPLACE_INT_RAM_0 0x000100
+#define XA_MEMPLACE_INT_RAM_1 0x000200
+#define XA_MEMPLACE_INT_RAM_2 0x000400
+#define XA_MEMPLACE_INT_RAM_3 0x000800
+#define XA_MEMPLACE_INT_RAM_4 0x001000
+#define XA_MEMPLACE_INT_RAM_5 0x002000
+#define XA_MEMPLACE_INT_RAM_6 0x004000
+#define XA_MEMPLACE_INT_RAM_7 0x008000
+
+#define XA_MEMPLACE_EXT_RAM_0 0x010000
+#define XA_MEMPLACE_EXT_RAM_1 0x020000
+#define XA_MEMPLACE_EXT_RAM_2 0x040000
+#define XA_MEMPLACE_EXT_RAM_3 0x080000
+#define XA_MEMPLACE_EXT_RAM_4 0x100000
+#define XA_MEMPLACE_EXT_RAM_5 0x200000
+#define XA_MEMPLACE_EXT_RAM_6 0x400000
+#define XA_MEMPLACE_EXT_RAM_7 0x800000
+
+#define XA_MEMPLACE_DONTCARE_H 0xFFFFFFFF
+#define XA_MEMPLACE_DONTCARE_L 0xFFFFFFFF
+
+/* the simple common PC RAM */
+#define XA_PC_RAM_H 0x00000000
+#define XA_PC_RAM_L XA_MEMPLACE_EXT_RAM_0
+
+#endif /* __XA_MEMORY_STANDARDS_H__ */
diff --git a/hifi/xaf/host-apf/include/audio/xa_type_def.h b/hifi/xaf/host-apf/include/audio/xa_type_def.h
new file mode 100644
index 0000000..e83cdd3
--- /dev/null
+++ b/hifi/xaf/host-apf/include/audio/xa_type_def.h
@@ -0,0 +1,98 @@
+/*******************************************************************************
+* Copyright (C) 2018 Cadence Design Systems, Inc.
+*
+* Permission is hereby granted, free of charge, to any person obtaining
+* a copy of this software and associated documentation files (the
+* "Software"), to use this Software with Cadence processor cores only and
+* not with any other processors and platforms, subject to
+* the following conditions:
+*
+* The above copyright notice and this permission notice shall be included
+* in all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+******************************************************************************/
+/*******************************************************************************
+*
+* NOTE, ANY CHANGES TO THIS FILE MAY AFFECT UNDERLYING AUDIO / SPEECH CODEC
+* LIBRARY COMPONENT FROM CADENCE DESIGN SYSTEMS, INC.
+*
+******************************************************************************/
+
+
+#ifndef __XA_TYPE_DEF_H__
+#define __XA_TYPE_DEF_H__
+
+/****************************************************************************/
+/* types type define prefix examples bytes */
+/************************ *********** ****** **************** ***** */
+typedef signed char WORD8 ;/* b WORD8 b_name 1 */
+typedef signed char * pWORD8 ;/* pb pWORD8 pb_nmae 1 */
+typedef unsigned char UWORD8 ;/* ub UWORD8 ub_count 1 */
+typedef unsigned char * pUWORD8 ;/* pub pUWORD8 pub_count 1 */
+
+typedef signed short WORD16 ;/* s WORD16 s_count 2 */
+typedef signed short * pWORD16 ;/* ps pWORD16 ps_count 2 */
+typedef unsigned short UWORD16 ;/* us UWORD16 us_count 2 */
+typedef unsigned short * pUWORD16;/* pus pUWORD16 pus_count 2 */
+
+typedef signed int WORD24 ;/* k WORD24 k_count 3 */
+typedef signed int * pWORD24 ;/* pk pWORD24 pk_count 3 */
+typedef unsigned int UWORD24 ;/* uk UWORD24 uk_count 3 */
+typedef unsigned int * pUWORD24;/* puk pUWORD24 puk_count 3 */
+
+typedef signed int WORD32 ;/* i WORD32 i_count 4 */
+typedef signed int * pWORD32 ;/* pi pWORD32 pi_count 4 */
+typedef unsigned int UWORD32 ;/* ui UWORD32 ui_count 4 */
+typedef unsigned int * pUWORD32;/* pui pUWORD32 pui_count 4 */
+
+typedef signed long long WORD40 ;/* m WORD40 m_count 5 */
+typedef signed long long * pWORD40 ;/* pm pWORD40 pm_count 5 */
+typedef unsigned long long UWORD40 ;/* um UWORD40 um_count 5 */
+typedef unsigned long long * pUWORD40;/* pum pUWORD40 pum_count 5 */
+
+typedef signed long long WORD64 ;/* h WORD64 h_count 8 */
+typedef signed long long * pWORD64 ;/* ph pWORD64 ph_count 8 */
+typedef unsigned long long UWORD64 ;/* uh UWORD64 uh_count 8 */
+typedef unsigned long long * pUWORD64;/* puh pUWORD64 puh_count 8 */
+
+typedef float FLOAT32 ;/* f FLOAT32 f_count 4 */
+typedef float * pFLOAT32;/* pf pFLOAT32 pf_count 4 */
+typedef double FLOAT64 ;/* d UFLOAT64 d_count 8 */
+typedef double * pFlOAT64;/* pd pFLOAT64 pd_count 8 */
+
+typedef void VOID ;/* v VOID v_flag 4 */
+typedef void * pVOID ;/* pv pVOID pv_flag 4 */
+
+/* variable size types: platform optimized implementation */
+//typedef signed int BOOL ;/* bool BOOL bool_true */
+//typedef unsigned int UBOOL ;/* ubool BOOL ubool_true */
+typedef signed int FLAG ;/* flag FLAG flag_false */
+typedef unsigned int UFLAG ;/* uflag FLAG uflag_false */
+typedef signed int LOOPIDX ;/* lp LOOPIDX lp_index */
+typedef unsigned int ULOOPIDX;/* ulp SLOOPIDX ulp_index */
+typedef signed int WORD ;/* lp LOOPIDX lp_index */
+typedef unsigned int UWORD ;/* ulp SLOOPIDX ulp_index */
+
+typedef LOOPIDX LOOPINDEX; /* lp LOOPIDX lp_index */
+typedef ULOOPIDX ULOOPINDEX;/* ulp SLOOPIDX ulp_index */
+
+#define PLATFORM_INLINE __inline
+
+typedef struct xa_codec_opaque { WORD32 _; } *xa_codec_handle_t;
+
+typedef int XA_ERRORCODE;
+
+typedef XA_ERRORCODE xa_codec_func_t(xa_codec_handle_t p_xa_module_obj,
+ WORD32 i_cmd,
+ WORD32 i_idx,
+ pVOID pv_value);
+
+#endif /* __XA_TYPE_DEF_H__ */
diff --git a/hifi/xaf/host-apf/include/audio/xa_vorbis_dec_api.h b/hifi/xaf/host-apf/include/audio/xa_vorbis_dec_api.h
new file mode 100644
index 0000000..f99660f
--- /dev/null
+++ b/hifi/xaf/host-apf/include/audio/xa_vorbis_dec_api.h
@@ -0,0 +1,121 @@
+/*******************************************************************************
+* Copyright (C) 2018 Cadence Design Systems, Inc.
+*
+* Permission is hereby granted, free of charge, to any person obtaining
+* a copy of this software and associated documentation files (the
+* "Software"), to use this Software with Cadence processor cores only and
+* not with any other processors and platforms, subject to
+* the following conditions:
+*
+* The above copyright notice and this permission notice shall be included
+* in all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+******************************************************************************/
+/*******************************************************************************
+*
+* NOTE, ANY CHANGES TO THIS FILE MAY AFFECT UNDERLYING AUDIO / SPEECH CODEC
+* LIBRARY COMPONENT FROM CADENCE DESIGN SYSTEMS, INC.
+*
+******************************************************************************/
+
+
+
+#ifndef __XA_VORBIS_DEC_API_H__
+#define __XA_VORBIS_DEC_API_H__
+
+#include <xa_memory_standards.h>
+
+/* vorbis_dec-specific configuration parameters */
+enum xa_config_param_vorbis_dec
+{
+ XA_VORBISDEC_CONFIG_PARAM_SAMP_FREQ = 0,
+ XA_VORBISDEC_CONFIG_PARAM_NUM_CHANNELS = 1,
+ XA_VORBISDEC_CONFIG_PARAM_PCM_WDSZ = 2,
+ XA_VORBISDEC_CONFIG_PARAM_COMMENT_MEM_PTR = 3,
+ XA_VORBISDEC_CONFIG_PARAM_COMMENT_MEM_SIZE = 4,
+ XA_VORBISDEC_CONFIG_PARAM_GET_CUR_BITRATE = 5,
+ XA_VORBISDEC_CONFIG_PARAM_RAW_VORBIS_FILE_MODE = 6,
+ XA_VORBISDEC_CONFIG_PARAM_RAW_VORBIS_LAST_PKT_GRANULE_POS = 7,
+ XA_VORBISDEC_CONFIG_PARAM_OGG_MAX_PAGE_SIZE = 8,
+ XA_VORBISDEC_CONFIG_PARAM_RUNTIME_MEM = 9
+};
+
+/* commands */
+#include <xa_apicmd_standards.h>
+
+/* vorbis_dec-specific command types */
+/* (none) */
+
+/* error codes */
+#include <xa_error_standards.h>
+#define XA_CODEC_VORBIS_DEC 7
+
+/* vorbis_dec-specific error codes */
+
+/*****************************************************************************/
+/* Class 1: Configuration Errors */
+/*****************************************************************************/
+/* Nonfatal Errors */
+enum xa_error_nonfatal_config_vorbis_dec
+{
+ XA_VORBISDEC_CONFIG_NONFATAL_GROUPED_STREAM = XA_ERROR_CODE(xa_severity_nonfatal, xa_class_config, XA_CODEC_VORBIS_DEC, 0),
+ XA_VORBISDEC_CONFIG_NONFATAL_BAD_PARAM = XA_ERROR_CODE(xa_severity_nonfatal, xa_class_config, XA_CODEC_VORBIS_DEC, 1)
+};
+
+/* Fatal Errors */
+enum xa_error_fatal_config_vorbis_dec
+{
+ XA_VORBISDEC_CONFIG_FATAL_BADHDR = XA_ERROR_CODE(xa_severity_fatal, xa_class_config, XA_CODEC_VORBIS_DEC, 0),
+ XA_VORBISDEC_CONFIG_FATAL_NOTVORBIS = XA_ERROR_CODE(xa_severity_fatal, xa_class_config, XA_CODEC_VORBIS_DEC, 1),
+ XA_VORBISDEC_CONFIG_FATAL_BADINFO = XA_ERROR_CODE(xa_severity_fatal, xa_class_config, XA_CODEC_VORBIS_DEC, 2),
+ XA_VORBISDEC_CONFIG_FATAL_BADVERSION = XA_ERROR_CODE(xa_severity_fatal, xa_class_config, XA_CODEC_VORBIS_DEC, 3),
+ XA_VORBISDEC_CONFIG_FATAL_BADBOOKS = XA_ERROR_CODE(xa_severity_fatal, xa_class_config, XA_CODEC_VORBIS_DEC, 4),
+ XA_VORBISDEC_CONFIG_FATAL_CODEBOOK_DECODE = XA_ERROR_CODE(xa_severity_fatal, xa_class_config, XA_CODEC_VORBIS_DEC, 5),
+ XA_VORBISDEC_CONFIG_FATAL_INVALID_PARAM = XA_ERROR_CODE(xa_severity_fatal, xa_class_config, XA_CODEC_VORBIS_DEC, 6)
+};
+
+/*****************************************************************************/
+/* Class 2: Execution Errors */
+/*****************************************************************************/
+/* Nonfatal Errors */
+enum xa_error_nonfatal_execute_vorbis_dec
+{
+ XA_VORBISDEC_EXECUTE_NONFATAL_OV_HOLE = XA_ERROR_CODE(xa_severity_nonfatal, xa_class_execute, XA_CODEC_VORBIS_DEC, 0),
+ XA_VORBISDEC_EXECUTE_NONFATAL_OV_NOTAUDIO = XA_ERROR_CODE(xa_severity_nonfatal, xa_class_execute, XA_CODEC_VORBIS_DEC, 1),
+ XA_VORBISDEC_EXECUTE_NONFATAL_OV_BADPACKET = XA_ERROR_CODE(xa_severity_nonfatal, xa_class_execute, XA_CODEC_VORBIS_DEC, 2),
+ XA_VORBISDEC_EXECUTE_NONFATAL_OV_RUNTIME_DECODE_FLUSH_IN_PROGRESS = XA_ERROR_CODE(xa_severity_nonfatal, xa_class_execute, XA_CODEC_VORBIS_DEC, 3),
+ XA_VORBISDEC_EXECUTE_NONFATAL_OV_INVALID_STRM_POS = XA_ERROR_CODE(xa_severity_nonfatal, xa_class_execute, XA_CODEC_VORBIS_DEC, 4),
+ XA_VORBISDEC_EXECUTE_NONFATAL_OV_INSUFFICIENT_DATA = XA_ERROR_CODE(xa_severity_nonfatal, xa_class_execute, XA_CODEC_VORBIS_DEC, 5),
+ XA_VORBISDEC_EXECUTE_NONFATAL_OV_UNEXPECTED_IDENT_PKT_RECEIVED = XA_ERROR_CODE(xa_severity_nonfatal, xa_class_execute, XA_CODEC_VORBIS_DEC, 6),
+ XA_VORBISDEC_EXECUTE_NONFATAL_OV_UNEXPECTED_HEADER_PKT_RECEIVED = XA_ERROR_CODE(xa_severity_nonfatal, xa_class_execute, XA_CODEC_VORBIS_DEC, 7)
+};
+/* Fatal Errors */
+enum xa_error_fatal_execute_vorbis_dec
+{
+ XA_VORBISDEC_EXECUTE_FATAL_PERSIST_ALLOC = XA_ERROR_CODE(xa_severity_fatal, xa_class_execute, XA_CODEC_VORBIS_DEC, 0),
+ XA_VORBISDEC_EXECUTE_FATAL_SCRATCH_ALLOC = XA_ERROR_CODE(xa_severity_fatal, xa_class_execute, XA_CODEC_VORBIS_DEC, 1),
+ XA_VORBISDEC_EXECUTE_FATAL_CORRUPT_STREAM = XA_ERROR_CODE(xa_severity_fatal, xa_class_execute, XA_CODEC_VORBIS_DEC, 2),
+ XA_VORBISDEC_EXECUTE_FATAL_INSUFFICIENT_INP_BUF_SIZE = XA_ERROR_CODE(xa_severity_fatal, xa_class_execute, XA_CODEC_VORBIS_DEC, 3)
+};
+
+#include "xa_type_def.h"
+
+#ifdef __cplusplus
+ extern "C" {
+#endif /* __cplusplus */
+
+ xa_codec_func_t xa_vorbis_dec;
+
+#ifdef __cplusplus
+ }
+#endif /* __cplusplus */
+
+#endif /* __XA_VORBIS_DEC_API_H__ */