diff --git a/arch/arm64/qcom/canoe_defconfig b/arch/arm64/qcom/canoe_defconfig index 453d46b6..bdd2c3d6 100644 --- a/arch/arm64/qcom/canoe_defconfig +++ b/arch/arm64/qcom/canoe_defconfig @@ -17,21 +17,11 @@ CONFIG_ECHO_CANCELLATION=n CONFIG_EXAMPLE_GAIN=n CONFIG_MSIIR=n CONFIG_CHMIXER=y -CONFIG_PCM_CNV=y -CONFIG_MFC=y -CONFIG_PCM_DECODER=y -CONFIG_PCM_ENCODER=y -CONFIG_DRC=n -CONFIG_IIR_MBDRC=n CONFIG_GAIN=y CONFIG_SOFT_VOL=n CONFIG_FIR_FILTER=n CONFIG_POPLESS_EQUALIZER=n CONFIG_SAL=n -CONFIG_SHOEBOX=n -CONFIG_REVERB=n -CONFIG_VIRTUALIZER=n -CONFIG_BASS_BOOST=n CONFIG_PLACEHOLDER_ENC_DEC=y # diff --git a/arch/arm64/qcom/defconfig b/arch/arm64/qcom/defconfig index 38f4ca72..6bda9ac2 100644 --- a/arch/arm64/qcom/defconfig +++ b/arch/arm64/qcom/defconfig @@ -17,20 +17,11 @@ CONFIG_ECHO_CANCELLATION=n CONFIG_EXAMPLE_GAIN=n CONFIG_MSIIR=y CONFIG_CHMIXER=y -CONFIG_PCM_CNV=y -CONFIG_MFC=y -CONFIG_PCM_DECODER=y -CONFIG_PCM_ENCODER=y -CONFIG_IIR_MBDRC=y CONFIG_GAIN=n CONFIG_SOFT_VOL=n CONFIG_FIR_FILTER=n CONFIG_POPLESS_EQUALIZER=n CONFIG_SAL=n -CONFIG_SHOEBOX=n -CONFIG_REVERB=n -CONFIG_VIRTUALIZER=n -CONFIG_BASS_BOOST=n # # Signal Processing Framework diff --git a/arch/arm64/qcom/shikra_defconfig b/arch/arm64/qcom/shikra_defconfig index 7d765375..cf9a1191 100644 --- a/arch/arm64/qcom/shikra_defconfig +++ b/arch/arm64/qcom/shikra_defconfig @@ -17,19 +17,11 @@ CONFIG_ECHO_CANCELLATION=n CONFIG_EXAMPLE_GAIN=n CONFIG_MSIIR=y CONFIG_CHMIXER=y -CONFIG_PCM_CNV=y -CONFIG_MFC=y -CONFIG_PCM_DECODER=y -CONFIG_PCM_ENCODER=y CONFIG_GAIN=y CONFIG_SOFT_VOL=n CONFIG_FIR_FILTER=y CONFIG_POPLESS_EQUALIZER=n CONFIG_SAL=y -CONFIG_SHOEBOX=n -CONFIG_REVERB=n -CONFIG_VIRTUALIZER=n -CONFIG_BASS_BOOST=n CONFIG_PLACEHOLDER_ENC_DEC=y # diff --git a/arch/linux/configs/defconfig b/arch/linux/configs/defconfig index 96cdca57..a06ba51d 100644 --- a/arch/linux/configs/defconfig +++ b/arch/linux/configs/defconfig @@ -15,22 +15,13 @@ CONFIG_MODULES=y CONFIG_ENCODER=n CONFIG_ECHO_CANCELLATION=n CONFIG_EXAMPLE_GAIN=n -CONFIG_MSIIR=y -CONFIG_CHMIXER=y -CONFIG_PCM_CNV=y -CONFIG_MFC=y -CONFIG_PCM_DECODER=y -CONFIG_PCM_ENCODER=y -CONFIG_IIR_MBDRC=y +CONFIG_MSIIR=n +CONFIG_CHMIXER=n CONFIG_GAIN=n CONFIG_SOFT_VOL=n CONFIG_FIR_FILTER=n CONFIG_POPLESS_EQUALIZER=n CONFIG_SAL=n -CONFIG_SHOEBOX=n -CONFIG_REVERB=n -CONFIG_VIRTUALIZER=n -CONFIG_BASS_BOOST=n # # Signal Processing Framework diff --git a/modules/CMakeLists.txt b/modules/CMakeLists.txt index c43b52c4..be06b486 100644 --- a/modules/CMakeLists.txt +++ b/modules/CMakeLists.txt @@ -31,14 +31,6 @@ endif() if(CONFIG_MSIIR) add_subdirectory(processing/filters/multi_stage_iir/build) endif() -if(CONFIG_PCM_CNV) - add_subdirectory(cmn/pcm_mf_cnv/build) - add_subdirectory(processing/resamplers/dynamic_resampler/build) - add_subdirectory(processing/resamplers/iir_resampler/build) -endif() -if(CONFIG_IIR_MBDRC) - add_subdirectory(processing/gain_control/iir_mbdrc/build) -endif() if(CONFIG_GAIN) add_subdirectory(processing/volume_control/capi/gain/build) endif() @@ -53,22 +45,5 @@ if(CONFIG_POPLESS_EQUALIZER) endif() if(CONFIG_SAL) add_subdirectory(cmn/simple_accumulator_limiter/build) -endif() -if(CONFIG_SHOEBOX OR CONFIG_REVERB) - add_subdirectory(processing/shoebox_reverb/build) -endif() -if(CONFIG_VIRTUALIZER) - add_subdirectory(processing/Virtualizer/build) -endif() -if(CONFIG_BASS_BOOST) - add_subdirectory(processing/bassboost/build) -endif() - -# The below modules are not standalone, so they should only be built if -# another module that is dependent on it is built. -if(CONFIG_SAL OR CONFIG_IIR_MBDRC OR CONFIG_VIRTUALIZER OR CONFIG_BASS_BOOST) - add_subdirectory(processing/gain_control/limiter/build) -endif() -if(CONFIG_IIR_MBDRC OR CONFIG_BASS_BOOST) - add_subdirectory(processing/gain_control/drc/build) + add_subdirectory(processing/gain_control/limiter/build) endif() diff --git a/modules/Kconfig b/modules/Kconfig index 23bda373..a2a04c18 100644 --- a/modules/Kconfig +++ b/modules/Kconfig @@ -30,16 +30,6 @@ config MSIIR tristate "Enable MSIIR Library" default y -config PCM_CNV - tristate "Enable PCM_CNV Library" - select CH_MIXER - select MSIIR - default y - -config IIR_MBDRC - tristate "Enable IIR_MBDRC Library" - default y - config GAIN tristate "Enable GAIN Library" default n @@ -60,21 +50,4 @@ config SAL tristate "Enable SAL library" default n -config SHOEBOX - tristate "Enable SHOEBOX library" - default n - -config REVERB - tristate "Enable REVERB library" - default n - -config VIRTUALIZER - tristate "Enable VIRTUALIZER library" - select MSIIR - default n - -config BASS_BOOST - tristate "Enable BASS_BOOST Library" - select MSIIR - default n endmenu diff --git a/modules/cmn/pcm_mf_cnv/build/CMakeLists.txt b/modules/cmn/pcm_mf_cnv/build/CMakeLists.txt deleted file mode 100644 index 65511e54..00000000 --- a/modules/cmn/pcm_mf_cnv/build/CMakeLists.txt +++ /dev/null @@ -1,111 +0,0 @@ -#[[ - @file CMakeLists.txt - - @brief - - @copyright - Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. - SPDX-License-Identifier: BSD-3-Clause-Clear -]] -cmake_minimum_required(VERSION 3.10) - -set(pcm_cnv_sources - ${LIB_ROOT}/capi/pcm_cnv/src/capi_pcm_mf_cnv.cpp - ${LIB_ROOT}/capi/pcm_cnv/src/capi_pcm_mf_cnv_island.cpp - ${LIB_ROOT}/capi/pcm_cnv/src/capi_pcm_mf_cnv_utils.cpp - ${LIB_ROOT}/capi/pcm_cnv/src/capi_pcm_mf_cnv_utils_island.cpp - ${LIB_ROOT}/lib/src/pc_converter.cpp - ${LIB_ROOT}/lib/src/pc_converter_island.cpp - ${LIB_ROOT}/lib/src/pc_init.cpp - ${LIB_ROOT}/lib/src/pc_process.cpp - ${LIB_ROOT}/lib/src/pc_process_island.cpp - ${LIB_ROOT}/lib/src/pc_float/pc_float.cpp -) - -set(pcm_cnv_includes - ${LIB_ROOT}/capi/pcm_cnv/api - ${LIB_ROOT}/capi/pcm_cnv/inc - ${LIB_ROOT}/capi/pcm_cnv/src - ${LIB_ROOT}/capi/mfc/api - ${LIB_ROOT}/capi/mfc/inc - ${LIB_ROOT}/lib/inc - ${PROJECT_SOURCE_DIR}/modules/audio/pcm_encoder/api - ${PROJECT_SOURCE_DIR}/modules/audio/pcm_encoder/inc - ${PROJECT_SOURCE_DIR}/modules/audio/pcm_decoder/api - ${PROJECT_SOURCE_DIR}/modules/audio/pcm_decoder/inc - ${PROJECT_SOURCE_DIR}/modules/processing/channel_mixer/lib/inc - ${PROJECT_SOURCE_DIR}/modules/processing/channel_mixer/api/ - ${PROJECT_SOURCE_DIR}/modules/processing/resamplers/dynamic_resampler/inc - ${PROJECT_SOURCE_DIR}/modules/processing/resamplers/iir_resampler/inc - ${PROJECT_SOURCE_DIR}/fwk/spf/utils/cmn/inc - ${PROJECT_SOURCE_DIR}/fwk/spf/utils/interleaver/inc - ${PROJECT_SOURCE_DIR}/fwk/spf/utils/lpi_pool/inc - ${PROJECT_SOURCE_DIR}/fwk/spf/interfaces/fwk/api - ${PROJECT_SOURCE_DIR}/fwk/spf/containers/cmn/graph_utils/inc - ) - -spf_module_sources( - KCONFIG CONFIG_PCM_CNV - NAME pcm_cnv - MAJOR_VER 1 - MINOR_VER 0 - AMDB_ITYPE "capi" - AMDB_MTYPE "PP" - AMDB_MID "0x07001003" - AMDB_TAG "capi_pcm_cnv" - AMDB_MOD_NAME "MODULE_ID_PCM_CNV" - SRCS ${pcm_cnv_sources} - INCLUDES ${pcm_cnv_includes} - H2XML_HEADERS "${LIB_ROOT}/capi/pcm_cnv/api/pcm_converter_api.h" - CFLAGS "" -) - -spf_module_sources( - KCONFIG CONFIG_PCM_DECODER - NAME pcm_decoder - MAJOR_VER 1 - MINOR_VER 0 - AMDB_ITYPE "capi" - AMDB_MTYPE "decoder" - AMDB_MID "0x07001005" - AMDB_TAG "capi_pcm_dec" - AMDB_MOD_NAME "MODULE_ID_PCM_DEC" - AMDB_FMT_ID1 "MEDIA_FMT_ID_PCM" - SRCS ${pcm_cnv_sources} - INCLUDES ${pcm_cnv_includes} - H2XML_HEADERS "${PROJECT_SOURCE_DIR}/modules/audio/pcm_decoder/api/pcm_decoder_api.h" - CFLAGS "" -) - -spf_module_sources( - KCONFIG CONFIG_PCM_ENCODER - NAME pcm_encoder - MAJOR_VER 1 - MINOR_VER 0 - AMDB_ITYPE "capi" - AMDB_MTYPE "encoder" - AMDB_MID "0x07001004" - AMDB_TAG "capi_pcm_enc" - AMDB_MOD_NAME "MODULE_ID_PCM_ENC" - AMDB_FMT_ID1 "MEDIA_FMT_ID_PCM" - SRCS ${pcm_cnv_sources} - INCLUDES ${pcm_cnv_includes} - H2XML_HEADERS "${PROJECT_SOURCE_DIR}/modules/audio/pcm_encoder/api/pcm_encoder_api.h" - CFLAGS "" -) - -spf_module_sources( - KCONFIG CONFIG_MFC - NAME mfc - MAJOR_VER 1 - MINOR_VER 0 - AMDB_ITYPE "capi" - AMDB_MTYPE "PP" - AMDB_MID "0x07001015" - AMDB_TAG "capi_mfc" - AMDB_MOD_NAME "MODULE_ID_MFC" - SRCS ${pcm_cnv_sources} - INCLUDES ${pcm_cnv_includes} - H2XML_HEADERS "${LIB_ROOT}/capi/mfc/api/mfc_api.h" - CFLAGS "" -) diff --git a/modules/cmn/pcm_mf_cnv/capi/mfc/api/mfc_api.h b/modules/cmn/pcm_mf_cnv/capi/mfc/api/mfc_api.h deleted file mode 100644 index ef23c4df..00000000 --- a/modules/cmn/pcm_mf_cnv/capi/mfc/api/mfc_api.h +++ /dev/null @@ -1,352 +0,0 @@ -#ifndef MFC_API_H -#define MFC_API_H - -/*============================================================================== - @file mfc_api.h - @brief This file contains MFC API -==============================================================================*/ - -/*=========================================================================== - Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. - SPDX-License-Identifier: BSD-3-Clause-Clear -======================================================================== */ - -/*------------------------------------------------------------------------------ - Includes -------------------------------------------------------------------------------*/ -#include "chmixer_common_api.h" -#include "module_cmn_api.h" - -/*# @h2xml_title1 {Media Format Converter (MFC) Module API} - @h2xml_title_agile_rev {Media Format Converter (MFC) Module API} - @h2xml_title_date {December 11, 2018} */ - -/*------------------------------------------------------------------------------ - Defines -------------------------------------------------------------------------------*/ - -/** @ingroup ar_spf_mod_mfc_mod - Identifier for the input port of the MFC module (#MODULE_ID_MFC). */ -#define MFC_DATA_INPUT_PORT 0x2 - -/** @ingroup ar_spf_mod_mfc_mod - Identifier for the output port of the MFC module. */ -#define MFC_DATA_OUTPUT_PORT 0x1 - -/*------------------------------------------------------------------------------ - API's -------------------------------------------------------------------------------*/ - -/** @ingroup ar_spf_mod_mfc_mod - Identifier for the parameter that configures the resampler in the MFC - module to be either an IIR resampler or FIR resampler. - - For an FIR resampler, clients can set additional FIR resampler - configuration fields. - - @msgpayload - param_id_mfc_resampler_cfg_t -*/ -#define PARAM_ID_MFC_RESAMPLER_CFG 0x0800104D - -/*# @h2xmlp_parameter {"PARAM_ID_MFC_RESAMPLER_CFG", - PARAM_ID_MFC_RESAMPLER_CFG} - @h2xmlp_description {ID for the parameter that configures the resampler in - the MFC module (MODULE_ID_MFC)to be either an IIR - resampler, FIR resampler or IIR preferred resampler.} - @h2xmlp_toolPolicy {Calibration; RTC} */ - -/** @ingroup ar_spf_mod_mfc_mod - Payload for #PARAM_ID_MFC_RESAMPLER_CFG in the Media Format Converter - Module. -*/ -#include "spf_begin_pack.h" -struct param_id_mfc_resampler_cfg_t -{ - uint32_t resampler_type; - /**< Specifies the type of resampler to use. - - @valuesbul - - 0 -- FIR resampler (Default) - - 1 -- IIR resampler - - 2 -- IIR resampler preferred: Uses IIR when possible, if not will fallback on FIR - */ - - /*#< @h2xmle_description {Specifies the resampler type to be used in MFC. \n - If IIR is selected, the use_hw_rs, dynamic_mode, and delay_type fields - are not applicable and are ignored.\n - - If FIR resampler or IIR preferred is selected, the use_hw_rs field is applicable, - it is cached and used.\n - - If FIR resampler is selected dynamic_mode, and delay_type fields are also applicable - and they are cached and used.\n - - If the input or output sampling rates are fractional: - - IIR Preferred Resampler will fallback on FIR - - IIR Resampler will NOT fallback on FIR, module will disable itself \n - } - @h2xmle_rangeList {"FIR resampler"=0; - "IIR Resampler"=1; - "IIR Resampler Preferred"=2} - @h2xmle_default {0} */ - - uint32_t use_hw_rs; - /**< Specifies whether to use the hardware or software resampler for the - FIR resampler. - - @valuesbul - - 0 -- Software Resampler (Default) - - 1 -- Hardware Resampler - - @contcell - If the hardware resampler is selected, the dynamic_mode and delay_type - values are saved but they are ignored. - - The hardware resampler can be created only if the chip supports it. - - If hardware resampler creation fails for any reason, the software - resampler is created with a saved dynamic mode, and the client sets - the delay type. - - If the software resampler is selected, the dynamic_mode and delay_type - fields are saved and used. - - A Get parameter query on this API will return the actual resampler - being used. It is not simply what the client set. */ - - /*#< @h2xmle_description {Specifies whether to use the hardware or software - resampler for the FIR resampler or IIR preferred resampler. \n - If the hardware resampler is selected, the - dynamic_mode and delay_type values are saved but - they are ignored. \n - If the software resampler is selected, these - fields are saved and used. \n - For more details, see AudioReach Signal Processing Framework (SPF) API Reference.} - @h2xmle_rangeList {"Software Resampler"=0, - "Hardware Resampler"=1} - @h2xmle_default {0} */ - - uint16_t dynamic_mode; - /**< Specifies the operation mode for the FIR resampler. - - @valuesbul - - 0 -- Generic resampling (Default) - - 1 -- Dynamic resampling - - This dynamic_mode value is considered only if the software resampler - is used. */ - - /*#< @h2xmle_description {Specifies the operation mode for the FIR - resampler. This dynamic_mode value is - considered only if the software resampler is - used.} - @h2xmle_rangeList {"Generic resampling"=0; - "Dynamic resampling"=1} - @h2xmle_default {0} */ - - uint16_t delay_type; - /**< Specifies the delay type for the FIR resampler. - - @valuesbul - - 0 -- High delay with smooth transition (Default) - - 1 -- Low delay with visible transitional phase distortion - - This value is considered only if the software resampler is used and - the dynamic_mode value is set to 1. */ - - /*#< @h2xmle_description {Specifies the delay type for the FIR resampler. - This value is considered only if the software - resampler is used and the dynamic_mode value is - set to 1.} - @h2xmle_rangeList {"High delay with smooth transition"=0; - "Low delay with visible transitional phase - distortion"=1} - @h2xmle_default {0} */ -} -#include "spf_end_pack.h" -; -typedef struct param_id_mfc_resampler_cfg_t param_id_mfc_resampler_cfg_t; - - -/** @ingroup ar_spf_mod_mfc_mod - Identifier for the output media format parameter used by #MODULE_ID_MFC. - - @msgpayload - param_id_mfc_output_media_fmt_t @newpage -*/ -#define PARAM_ID_MFC_OUTPUT_MEDIA_FORMAT 0x08001024 - -/*# @h2xmlp_parameter {"PARAM_ID_MFC_OUTPUT_MEDIA_FORMAT", - PARAM_ID_MFC_OUTPUT_MEDIA_FORMAT} - @h2xmlp_description {ID for the output media format parameter used by the - MFC module (MODULE_ID_MFC).} - @h2xmlp_toolPolicy {Calibration; RTC} - @h2xmlp_maxSize {72} */ - -/** @ingroup ar_spf_mod_mfc_mod - Payload of the #PARAM_ID_MFC_OUTPUT_MEDIA_FORMAT parameter in the Media - Format Converter Module. Following this structure is the variable payload - for channel_map. - */ -#include "spf_begin_pack.h" -#include "spf_begin_pragma.h" -struct param_id_mfc_output_media_fmt_t -{ - int32_t sampling_rate; - /**< Sampling rate in samples per second. - - @valuesbul - - If the IIR resampler type is used: - - #PARAM_VAL_NATIVE (Default) - - #PARAM_VAL_UNSET - - 8, 16, 24, 32, 48 kHz - - - If the FIR resampler type is used, all values are allowed: - - #PARAM_VAL_NATIVE (Default) - - #PARAM_VAL_UNSET - - 8, 11.025, 12 kHz, 16, 22.05, 24, 32, 44.1, 48, 88.2, 96, 176.4, - 192, 352.8 kHz, 384 kHz @tablebulletend */ - - /*#< @h2xmle_description {Sampling rate in samples per second. \n - If the IIR resampler type is used, only the - following sample rates are allowed: - PARAM_VAL_NATIVE and PARAM_VAL_UNSET; and 8, 16, - 24, 32, and 48 kHz. \n - If the FIR resampler type is used, all values are - allowed.} - @h2xmle_rangeList {"PARAM_VAL_UNSET"= -2; - "PARAM_VAL_NATIVE"= -1; - "8 kHz"=8000; - "11.025 kHz"=11025; - "12 kHz"=12000; - "16 kHz"=16000; - "22.05 kHz"=22050; - "24 kHz"=24000; - "32 kHz"=32000; - "44.1 kHz"=44100; - "48 kHz"=48000; - "88.2 kHz"=88200; - "96 kHz"=96000; - "176.4 kHz"=176400; - "192 kHz"=192000; - "352.8 kHz"=352800; - "384 kHz"=384000} - @h2xmle_default {-1} */ - - int16_t bit_width; - /**< Bit width of the audio samples. - - @valuesbul - - #PARAM_VAL_NATIVE - - #PARAM_VAL_UNSET - - #BIT_WIDTH_16 - - #BIT_WIDTH_24 - - #BIT_WIDTH_32 - - Samples with a bit width of 16 (Q15 format) are stored in 16-bit - words. Samples with a bit width 24 bits (Q27 format) or 32 bits (Q31 - format) are stored in 32-bit words. */ - - /*#< @h2xmle_description {Bit width of the audio samples. \n - Samples with a bit width of 16 (Q15 format) are - stored in 16-bit words. \n - Samples with a bit width 24 bits (Q27 format) or - 32 bits (Q31 format) are stored in 32-bit words.} - @h2xmle_rangeList {"PARAM_VAL_NATIVE"= -1; - "PARAM_VAL_UNSET"= -2; - "BIT_WIDTH_16"=16; - "BIT_WIDTH_24"=24; - "BIT_WIDTH_32"=32} - @h2xmle_default {-1} */ - - int16_t num_channels; - /**< Number of channels in the array. - - @values -2 through 32 */ - - /*#< @h2xmle_description {Number of channels.} - @h2xmle_range {-2..MODULE_CMN_MAX_CHANNEL} - @h2xmle_default {-1} */ - - uint16_t channel_type[0]; - /**< Array of channel mappings. - - Specify a channel mapping for each output channel. If the number of - channels is not a multiple of four, zero padding must be added to the - array to align the packet to a multiple of 32 bits. - - If num_channels is set to PARAM_VAL_NATIVE (-1) or PARAM_VAL_UNSET(-2), - this field is ignored. */ - - /*#< @h2xmle_description {Array of channel mappings. Specify a channel - mapping for each output channel. \n - If the number of channels is not a multiple - of four, zero padding must be added to array - to align the packet to a multiple of 32 - bits . \n - If num_channels is set to PARAM_VAL_NATIVE - (-1) or PARAM_VAL_UNSET(-2), this field is - ignored.} - @h2xmle_variableArraySize {num_channels} - @h2xmle_rangeEnum {pcm_channel_map} - @h2xmle_default {1} */ -} -#include "spf_end_pragma.h" -#include "spf_end_pack.h" -; -typedef struct param_id_mfc_output_media_fmt_t param_id_mfc_output_media_fmt_t; - - -/*------------------------------------------------------------------------------ - Module -------------------------------------------------------------------------------*/ - -/** @ingroup ar_spf_mod_mfc_mod - Identifier for the Media Format Converter (MFC) module. - - @subhead4{Supported parameter IDs} - - #PARAM_ID_MFC_OUTPUT_MEDIA_FORMAT @lstsp1 - - #PARAM_ID_MFC_RESAMPLER_CFG @lstsp1 - - #PARAM_ID_CHMIXER_COEFF - - Resampling is supported only for an integer sampling rate ratio, for - example, 48 kHz and 8 kHz. - - @subhead4{Supported input media format ID} - - Data Format : #DATA_FORMAT_FIXED_POINT @lstsp1 - - fmt_id : Don't care @lstsp1 - - Sample Rates : >0 to 384 kHz @lstsp1 - - Number of channels : 1 to 128 (for certain products this module supports only 32 channels) @lstsp1 - - Channel type : 0..128 @lstsp1 - - Bits per sample : 16, 32 @lstsp1 - - Q format : 15, 27, 31 @lstsp1 - - Interleaving : De-interleaved unpacked @lstsp1 - - Signed/unsigned : Don't care -*/ -#define MODULE_ID_MFC 0x07001015 - -/*# @h2xmlm_module {"MODULE_ID_MFC", MODULE_ID_MFC} - @h2xmlm_displayName {"MFC"} - @h2xmlm_modSearchKeys {resampler, channel mixer, byte converter, Audio, Voice} - @h2xmlm_description {ID for the Media Format Converter (MFC) module. - For more details, see AudioReach Signal Processing Framework (SPF) API Reference.} - @h2xmlm_dataMaxInputPorts {1} - @h2xmlm_dataInputPorts {IN=MFC_DATA_INPUT_PORT} - @h2xmlm_dataOutputPorts {OUT=MFC_DATA_OUTPUT_PORT} - @h2xmlm_dataMaxOutputPorts {1} - @h2xmlm_supportedContTypes {APM_CONTAINER_TYPE_SC, APM_CONTAINER_TYPE_GC} - @h2xmlm_isOffloadable {true} - @h2xmlm_stackSize {4096} - - @{ <-- Start of the Module --> - @h2xml_Select {param_id_mfc_resampler_cfg_t} - @h2xmlm_InsertParameter - @h2xml_Select {param_id_mfc_output_media_fmt_t} - @h2xmlm_InsertParameter - @h2xml_Select {param_id_chmixer_coeff_t} - @h2xmlm_InsertParameter - @h2xml_Select {chmixer_coeff_t} - @h2xmlm_InsertStructure - @} <-- End of the Module --> */ - - -#endif // MFC_API_H diff --git a/modules/cmn/pcm_mf_cnv/capi/mfc/inc/capi_mfc.h b/modules/cmn/pcm_mf_cnv/capi/mfc/inc/capi_mfc.h deleted file mode 100644 index 7f223cbd..00000000 --- a/modules/cmn/pcm_mf_cnv/capi/mfc/inc/capi_mfc.h +++ /dev/null @@ -1,33 +0,0 @@ -/* ======================================================================== */ -/** -@file capi_mfc.h - - Header file to implement the media format convertor block*/ - -/* ========================================================================= - Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. - SPDX-License-Identifier: BSD-3-Clause-Clear - ========================================================================== */ - -/*------------------------------------------------------------------------ - * Include files - * -----------------------------------------------------------------------*/ -#ifndef CAPI_MFC_H -#define CAPI_MFC_H - -#include "capi.h" -#include "ar_defs.h" - -#ifdef __cplusplus -extern "C" { -#endif /*__cplusplus*/ - -capi_err_t capi_mfc_get_static_properties(capi_proplist_t *init_set_properties, - capi_proplist_t *static_properties); -capi_err_t capi_mfc_init(capi_t *_pif, capi_proplist_t *init_set_properties); - -#ifdef __cplusplus -} -#endif /*__cplusplus*/ - -#endif // CAPI_MFC_H diff --git a/modules/cmn/pcm_mf_cnv/capi/pcm_cnv/api/pcm_converter_api.h b/modules/cmn/pcm_mf_cnv/capi/pcm_cnv/api/pcm_converter_api.h deleted file mode 100644 index 2bbf8e0b..00000000 --- a/modules/cmn/pcm_mf_cnv/capi/pcm_cnv/api/pcm_converter_api.h +++ /dev/null @@ -1,101 +0,0 @@ -#ifndef PCM_CONVERTER_API_H_ -#define PCM_CONVERTER_API_H_ -/*============================================================================== - @file pcm_converter_api.h - @brief This file contains PCM converter APIs - -================================================================================ - Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. - SPDX-License-Identifier: BSD-3-Clause-Clear -==============================================================================*/ - -/*------------------------------------------------------------------------ - Include files - -----------------------------------------------------------------------*/ -#include "chmixer_common_api.h" -#include "module_cmn_api.h" -#include "common_enc_dec_api.h" - -/*# @h2xml_title1 {PCM Converter Module API} - @h2xml_title_agile_rev {PCM Converter Module API} - @h2xml_title_date {March 26, 2019} */ - -/*------------------------------------------------------------------------------ - Defines -------------------------------------------------------------------------------*/ - -/** @ingroup ar_spf_mod_pcm_conv_mod - Enumerates the input port ID for the MFC module (#MODULE_ID_MFC). */ -#define PCM_CNV_DATA_INPUT_PORT 0x2 - -/** @ingroup ar_spf_mod_pcm_conv_mod - Enumerates the output port ID for the MFC module. */ -#define PCM_CNV_DATA_OUTPUT_PORT 0x1 - -/*------------------------------------------------------------------------------ - Module -------------------------------------------------------------------------------*/ - -/** @ingroup ar_spf_mod_pcm_conv_mod - Identifier for the PCM Converter module, which is used to convert the - properties of a PCM stream: endianness, interleaving, bit width, - number of channels, and so on. It cannot be used to convert the sampling - rate. This module has only one input port and one output port. - - @subhead4{Supported parameter IDs} - - #PARAM_ID_PCM_OUTPUT_FORMAT_CFG @lstsp1 - - #PARAM_ID_REMOVE_INITIAL_SILENCE @lstsp1 - - #PARAM_ID_REMOVE_TRAILING_SILENCE - - @subhead4{Supported input media format ID} - - Data format : #DATA_FORMAT_FIXED_POINT and #DATA_FORMAT_FLOATING_POINT @lstsp1 - - fmt_id : Don't care @lstsp1 - - Sample rates : 1..384 kHz @lstsp1 - - Number of channels: 1 to 128 (for certain products this module supports only 32 channels) @lstsp1 - - Bit width: @lstsep - - 16 (bits per sample 16 and Q15) @lstsp2 - - 24 (bits per sample 24 and Q23, bits per sample 32 and Q23, Q27, or - Q31) @lstsp2 - - 32 (bits per sample 32 and Q31) @lstsp1 - - 64 (only for floating point data) - - Interleaving: @lstsep - - Interleaved @lstsp2 - - De-interleaved unpacked @lstsp2 - - De-interleaved packed @lstsp1 - - Endianness: little, big - */ -#define MODULE_ID_PCM_CNV 0x07001003 - -/*# @h2xmlm_module {"MODULE_ID_PCM_CNV", MODULE_ID_PCM_CNV} - @h2xmlm_displayName {"PCM Converter"} - @h2xmlm_modSearchKeys {channel mixer, byte converter, endianness, Audio} - @h2xmlm_description {ID for the module used to convert the - properties of a PCM stream: endianness, - interleaving, bit width, number of channels,data format converter, - and so on. It cannot be used to convert the - sampling rate. \n - The module has only one input port and one - output port. For more details, see AudioReach Signal Processing Framework (SPF) API Reference.} - @h2xmlm_dataMaxInputPorts {1} - @h2xmlm_dataMaxOutputPorts {1} - @h2xmlm_dataInputPorts {IN = PCM_CNV_DATA_INPUT_PORT} - @h2xmlm_dataOutputPorts {OUT = PCM_CNV_DATA_OUTPUT_PORT} - @h2xmlm_supportedContTypes {APM_CONTAINER_TYPE_GC} - @h2xmlm_isOffloadable {true} - @h2xmlm_stackSize {4096} - - @{ <-- Start of the Module --> - @h2xml_Select {"param_id_pcm_output_format_cfg_t"} - @h2xmlm_InsertParameter - @h2xml_Select {"payload_pcm_output_format_cfg_t"} - @h2xmlm_InsertParameter - @h2xml_Select {param_id_pcm_output_format_cfg_t::data_format} - @h2xmle_rangeEnum {pcm_data_format} - @h2xml_Select {param_id_chmixer_coeff_t} - @h2xmlm_InsertParameter - @h2xml_Select {chmixer_coeff_t} - @h2xmlm_InsertStructure - @} <-- End of the Module --> */ - - -#endif // PCM_CONVERTER_API_H_ diff --git a/modules/cmn/pcm_mf_cnv/capi/pcm_cnv/inc/capi_pcm_cnv.h b/modules/cmn/pcm_mf_cnv/capi/pcm_cnv/inc/capi_pcm_cnv.h deleted file mode 100644 index 6fc7c278..00000000 --- a/modules/cmn/pcm_mf_cnv/capi/pcm_cnv/inc/capi_pcm_cnv.h +++ /dev/null @@ -1,35 +0,0 @@ -/* ======================================================================== */ -/** -@file capi_pcm_cnv.h - - Header file to implement the Common Audio Post Processor Interface - for Tx/Rx Tuning PCM_CNV block -*/ - -/* ========================================================================= - Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. - SPDX-License-Identifier: BSD-3-Clause-Clear - ========================================================================== */ - -/*------------------------------------------------------------------------ - * Include files - * -----------------------------------------------------------------------*/ -#ifndef CAPI_PCM_CNV_H -#define CAPI_PCM_CNV_H - -#include "capi.h" -#include "ar_defs.h" - -#ifdef __cplusplus -extern "C" { -#endif /*__cplusplus*/ - -capi_err_t capi_pcm_cnv_get_static_properties(capi_proplist_t *init_set_properties, - capi_proplist_t *static_properties); -capi_err_t capi_pcm_cnv_init(capi_t *_pif, capi_proplist_t *init_set_properties); - -#ifdef __cplusplus -} -#endif /*__cplusplus*/ - -#endif // CAPI_PCM_CNV_H diff --git a/modules/cmn/pcm_mf_cnv/capi/pcm_cnv/src/capi_pcm_mf_cnv_i.h b/modules/cmn/pcm_mf_cnv/capi/pcm_cnv/src/capi_pcm_mf_cnv_i.h deleted file mode 100644 index 16de3a45..00000000 --- a/modules/cmn/pcm_mf_cnv/capi/pcm_cnv/src/capi_pcm_mf_cnv_i.h +++ /dev/null @@ -1,72 +0,0 @@ -/* ========================================================================= - Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. - SPDX-License-Identifier: BSD-3-Clause-Clear - * =========================================================================*/ - -/** - * @file capi_pcm_mf_cnv_i.h - */ - -#include "capi_pcm_mf_cnv_utils.h" - -capi_vtbl_t *capi_pcm_mf_cnv_get_vtable(); - -capi_err_t capi_pcm_mf_cnv_process(capi_t *_pif, capi_stream_data_t *input[], capi_stream_data_t *output[]); - -capi_err_t capi_pcm_mf_cnv_end(capi_t *_pif); - -capi_err_t capi_pcm_mf_cnv_set_param(capi_t * _pif, - uint32_t param_id, - const capi_port_info_t *port_info_ptr, - capi_buf_t * params_ptr); - -capi_err_t capi_pcm_mf_cnv_get_param(capi_t * _pif, - uint32_t param_id, - const capi_port_info_t *port_info_ptr, - capi_buf_t * params_ptr); - -capi_err_t capi_pcm_mf_cnv_set_properties(capi_t *me_ptr, capi_proplist_t *props_ptr); - -capi_err_t capi_pcm_mf_cnv_get_properties(capi_t *me_ptr, capi_proplist_t *props_ptr); - -capi_err_t capi_pcm_mf_cnv_check_buffers(capi_pcm_mf_cnv_t *me_ptr, - capi_buf_t * src_buf_ptr, - capi_buf_t * dest_buf_ptr, - uint32_t port, - uint32_t eos_flag); - -capi_err_t capi_pcm_mf_cnv_check_scratch_buffer(capi_pcm_mf_cnv_t *me_ptr, - capi_buf_t * src_buf_ptr, - capi_buf_t * dest_buf_ptr, - uint32_t port); - -static inline void pcm_to_capi_interleaved_with_native(capi_interleaving_t *capi_value, - int16_t cfg_value, - capi_interleaving_t inp_value) -{ - switch (cfg_value) - { - case PCM_INTERLEAVED: - { - *capi_value = CAPI_INTERLEAVED; - break; - } - case PCM_DEINTERLEAVED_PACKED: - { - *capi_value = CAPI_DEINTERLEAVED_PACKED; - break; - } - case PCM_DEINTERLEAVED_UNPACKED: - { - *capi_value = CAPI_DEINTERLEAVED_UNPACKED_V2; - break; - } - case PARAM_VAL_NATIVE: - { - *capi_value = inp_value; - break; - } - default: - break; - } -} diff --git a/modules/cmn/pcm_mf_cnv/capi/pcm_cnv/src/capi_pcm_mf_cnv_island.cpp b/modules/cmn/pcm_mf_cnv/capi/pcm_cnv/src/capi_pcm_mf_cnv_island.cpp deleted file mode 100644 index 5d24ff89..00000000 --- a/modules/cmn/pcm_mf_cnv/capi/pcm_cnv/src/capi_pcm_mf_cnv_island.cpp +++ /dev/null @@ -1,281 +0,0 @@ -/* ========================================================================= - Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. - SPDX-License-Identifier: BSD-3-Clause-Clear - * =========================================================================*/ - -/** - * @file capi_pcm_mf_cnv_island.cpp - * - * Cpp source file to implement the Common Audio Post Processor Interface - * PCM_CNV block - */ - -#include "capi_pcm_mf_cnv_i.h" -#include "capi_pcm_mf_cnv_utils.h" -#define ALIGN4(o) (((o)+3)&(~3)) - -static capi_vtbl_t vtbl = { capi_pcm_mf_cnv_process, capi_pcm_mf_cnv_end, - capi_pcm_mf_cnv_set_param, capi_pcm_mf_cnv_get_param, - capi_pcm_mf_cnv_set_properties, capi_pcm_mf_cnv_get_properties }; - -capi_vtbl_t *capi_pcm_mf_cnv_get_vtable() -{ - return &vtbl; -} - -/*______________________________________________________________________________________________________________________ - DESCRIPTION: - Check if the scratch buffer allocated had enough size to handle incoming data. - LOGIC: - max_data_len_per_ch will be set to 0 during init or library init (even if scratch buffer is allocated for enc/dec) - At process time, src_buf_max_len_per_ch is calculated from input buffer - If this is more than the stored value, scratch buffer allocation logic is called. - - Since scratch buffer allocation depends on the factors like ordering or the modules, calculation is a little complex. - So we don't want it to be called at every process. To achieve this, we use the variable me_ptr->max_data_len_per_ch - Module reordering can only happen at capi_pcm_mf_cnv_lib_init, so this variable is reset to 0 there. - In other situations, if local_max_data_len_per_ch lesser than stored, we don't have to realloc the scratch buffers -______________________________________________________________________________________________________________________*/ -capi_err_t capi_pcm_mf_cnv_check_scratch_buffer(capi_pcm_mf_cnv_t *me_ptr, - capi_buf_t * src_buf_ptr, - capi_buf_t * dest_buf_ptr, - uint32_t port) -{ - capi_err_t capi_result = CAPI_EOK; - uint32_t src_buf_max_len_per_ch = 0; - - if (CAPI_DEINTERLEAVED_UNPACKED_V2 == me_ptr->in_media_fmt[port].format.data_interleaving) - { - src_buf_max_len_per_ch = src_buf_ptr[port].max_data_len; - } - else - { - src_buf_max_len_per_ch = src_buf_ptr[port].max_data_len / me_ptr->in_media_fmt[port].format.num_channels; - } - - src_buf_max_len_per_ch = ALIGN4(src_buf_max_len_per_ch); - if (me_ptr->max_data_len_per_ch < src_buf_max_len_per_ch) - { - me_ptr->max_data_len_per_ch = src_buf_max_len_per_ch; - capi_result = capi_pcm_mf_cnv_allocate_scratch_buffer(me_ptr, src_buf_max_len_per_ch); - if (CAPI_EOK != capi_result) - { - CNV_MSG(me_ptr->miid, DBG_ERROR_PRIO, "[%u] Error in pcm convert process - %d", me_ptr->type, capi_result); - capi_pcm_mf_cnv_reset_buffer_len(me_ptr, src_buf_ptr, dest_buf_ptr, port); - // Resetting the value of max_data_len_per_ch = 0 when scratch buffer allocation failed - me_ptr->max_data_len_per_ch = 0; - } - } - return capi_result; -} - -/*_____________________________________________________________________________________________________________________ - DESCRIPTION: - PCM_CNV module Data Process function to process an input buffer and generates an output buffer. - 1. Checks for the buffer size vs threshold value in case of CAPI_PCM_ENCODER and CAPI_PCM_DECODER - 2. If there is EOS marker, partial data is handled even for threshold modules - 3. For non-threshold modules, buffer sizes are assumed to be correct, so no checking is done to save mips - 4. Scratch buffer sizes are checked against stored value in case an alloc or realloc is needed - ____________________________________________________________________________________________________________________*/ -capi_err_t capi_pcm_mf_cnv_process(capi_t *_pif, capi_stream_data_t *input[], capi_stream_data_t *output[]) -{ - capi_err_t capi_result = CAPI_EOK; - uint32_t actual_input_bytes = 0; - bool_t all_input_consumed = FALSE; - uint32_t port = 0; - - bool_t is_output_present = - ((output) && (output[port]) && (output[port]->buf_ptr) && (output[port]->buf_ptr->data_ptr)); - bool_t is_input_present = ((input) && (input[port]) && (input[port]->buf_ptr) && (input[port]->buf_ptr->data_ptr)); - - if (is_input_present && (!is_output_present)) - { - // mark input is unconsumed - input[0]->buf_ptr->actual_data_len = 0; - } - - if (!(is_output_present && is_input_present)) - { - CNV_MSG(MIID_UNKNOWN, DBG_LOW_PRIO, "[%u] Cannot process: Output or input is NULL"); - return AR_EOK; - } - - actual_input_bytes = input[0]->buf_ptr->actual_data_len; - capi_pcm_mf_cnv_t *me_ptr = (capi_pcm_mf_cnv_t *)_pif; - - capi_buf_t *src_buf_ptr = input[port]->buf_ptr; - capi_buf_t *dest_buf_ptr = output[port]->buf_ptr; - - /*We will call process for pcm decoder and pcm enc eventhough lib is disabled and no memory is allocated - This is because pcm dec and enc need to raise threshold and cannot be disabled - In this case, memcpy and return without accessing lib memory */ - if (me_ptr->lib_enable == FALSE) - { - bool_t is_inplace = (input[0]->buf_ptr[0].data_ptr == output[0]->buf_ptr[0].data_ptr); - // even if processing is not done, input data needs to be copied to output & output actual len be set. - uint32_t out_max_data_len = output[0]->buf_ptr[0].max_data_len; - uint32_t num_bytes_to_cpy = MIN(input[0]->buf_ptr[0].actual_data_len, out_max_data_len); - for (uint32_t i = 0; i < input[0]->bufs_num; i++) - { - if (!is_inplace) - { - memscpy(output[0]->buf_ptr[i].data_ptr, out_max_data_len, input[0]->buf_ptr[i].data_ptr, num_bytes_to_cpy); - } - } - - // first update only first ch len's since module only supports CAPI_DEINTERLEAVED_UNPACKED_V2 - output[0]->buf_ptr[0].actual_data_len = num_bytes_to_cpy; - input[0]->buf_ptr[0].actual_data_len = num_bytes_to_cpy; - - /** return here if library is not enabled*/ - return CAPI_EOK; - } - - capi_result = capi_pcm_mf_cnv_check_scratch_buffer(me_ptr, src_buf_ptr, dest_buf_ptr, port); - - if (CAPI_EOK != capi_result) - { - return capi_result; - } - - // if configured for fixed output, but input samples differ from expected number, reset values - // if input actual len is more than expected module needs to consume only whats expected. - // if input is less than expected, module operates in fixed input mode. - if ((CAPI_MFC == me_ptr->type) && (FIR_RESAMPLER == me_ptr->pc[0].resampler_type) && - capi_pcm_mf_cnv_is_dm_enabled(me_ptr) && (FWK_EXTN_DM_FIXED_OUTPUT_MODE == me_ptr->dm_info.dm_mode)) - { - uint32_t in_samples = src_buf_ptr->actual_data_len / (me_ptr->in_media_fmt[0].format.bits_per_sample >> 3); - - if (in_samples < me_ptr->dm_info.expected_in_samples) - { - // process with available input samples if EOS/EOF is set, else return need more - // Also consume available input if got set_param for consume_partial_data. - if (input[port]->flags.end_of_frame || input[port]->flags.marker_eos || - me_ptr->dm_info.should_consume_partial_input) - { - me_ptr->dm_info.expected_in_samples = 0; - } - else // return need more - { - CNV_MSG(me_ptr->miid, - DBG_LOW_PRIO, - "[%u] Need more inp samples! expected %lu, received %lu", - me_ptr->type, - me_ptr->dm_info.expected_in_samples, - in_samples); - - // mark input unconsumed, need to update only 1st ch. - input[port]->buf_ptr[0].actual_data_len = 0; - return CAPI_ENEEDMORE; - } - } - else if (in_samples > me_ptr->dm_info.expected_in_samples) - { - CNV_MSG(me_ptr->miid, - DBG_LOW_PRIO, - "[%u] Got more samples! expected %lu, received %lu", - me_ptr->type, - me_ptr->dm_info.expected_in_samples, - in_samples); - - //resampler will not consume more than expected samples, so update input buffer actual data len before. - //test case: gen_cntr_two_priority_sync_parallel_paths_2, test passed but glitch was observed because samples were lost. - src_buf_ptr->actual_data_len = - me_ptr->dm_info.expected_in_samples * (me_ptr->in_media_fmt[0].format.bits_per_sample >> 3); //todo: check dynamic resampler - } - } - - // PC library updates only reads/writes into first ch capi_buf_t[0] lengths, capi is expected to update rest of the - // channel buffers if the interleaving format is not unpacked V2 - me_ptr->pc[port].heap_id = (uint32_t)me_ptr->heap_info.heap_id; - capi_result = ar_result_to_capi_err(pc_process(&me_ptr->pc[port], - src_buf_ptr, - dest_buf_ptr, - &me_ptr->scratch_buf_1[port], - &me_ptr->scratch_buf_2[port])); - if (CAPI_ENEEDMORE == capi_result) - { - #ifdef PCM_CNV_DEBUG - CNV_MSG(me_ptr->miid, - DBG_HIGH_PRIO, - "[%u] needs more input, input actual_data_len per ch = %ld ", - me_ptr->type, - (input[port]->buf_ptr ? input[port]->buf_ptr[0].actual_data_len : 0)); -#endif - // Drop data for eof case. Mark data as unconsumed for non-eof case. - if (!input[port]->flags.end_of_frame) - { - input[port]->buf_ptr[0].actual_data_len = 0; - } - return capi_result; - } - - if (0 != capi_result) - { - CNV_MSG(me_ptr->miid, - DBG_ERROR_PRIO, - "[%u] Error while pcm converter process, inp and out media fmts are ", - me_ptr->type); - capi_pcm_mf_cnv_print_media_fmt(me_ptr, &me_ptr->pc[port].core_lib.input_media_fmt, port); - capi_pcm_mf_cnv_print_media_fmt(me_ptr, &me_ptr->pc[port].core_lib.output_media_fmt, port); - } - - uint32_t is_gapless_case = FALSE; - - if ((me_ptr->initial_silence_in_samples > 0) || (me_ptr->trailing_silence_in_samples > 0)) - { - capi_media_fmt_v2_t *out_mf = NULL; - out_mf = me_ptr->out_media_fmt; - bool_t is_initial = TRUE; - uint32_t num_bytes_removed = 0; - uint32_t bytes_per_sample = (out_mf->format.bits_per_sample) / 8; - capi_stream_data_v2_t *in_stream_ptr = (capi_stream_data_v2_t *)input[0]; - module_cmn_md_list_t * metadata_list_ptr = in_stream_ptr->metadata_list_ptr; - - if (actual_input_bytes == input[0]->buf_ptr->actual_data_len) - { - all_input_consumed = TRUE; - } - // Detect last frame based on EOS. - if (in_stream_ptr->flags.marker_eos && all_input_consumed && me_ptr->trailing_silence_in_samples) - { - - is_initial = FALSE; - - uint32_t bytes_to_remove_per_channel = me_ptr->trailing_silence_in_samples * bytes_per_sample; - capi_cmn_gapless_remove_zeroes(&bytes_to_remove_per_channel, - out_mf, - &output[0], - is_initial, - metadata_list_ptr); - me_ptr->trailing_silence_in_samples = 0; - } - - if ((me_ptr->initial_silence_in_samples > 0) && (output[0]->buf_ptr->actual_data_len > 0)) - { - uint32_t bytes_to_remove_per_channel = me_ptr->initial_silence_in_samples * bytes_per_sample; - num_bytes_removed = bytes_to_remove_per_channel; - capi_cmn_gapless_remove_zeroes(&bytes_to_remove_per_channel, - out_mf, - &output[0], - is_initial, - metadata_list_ptr); - num_bytes_removed -= bytes_to_remove_per_channel; - if (output[0]->flags.is_timestamp_valid && num_bytes_removed) - { - is_gapless_case = TRUE; - output[0]->timestamp = - output[0]->timestamp + ((num_bytes_removed / bytes_per_sample) / out_mf->format.sampling_rate) * 1000000; - } - me_ptr->initial_silence_in_samples = bytes_to_remove_per_channel / bytes_per_sample; - } - } - - if (input[port]->flags.is_timestamp_valid && (FALSE == is_gapless_case)) - { - output[port]->timestamp = input[port]->timestamp - me_ptr->events_config.delay_in_us; - output[port]->flags.is_timestamp_valid = TRUE; - } - - return capi_result; -} diff --git a/modules/cmn/pcm_mf_cnv/capi/pcm_cnv/src/capi_pcm_mf_cnv_utils.h b/modules/cmn/pcm_mf_cnv/capi/pcm_cnv/src/capi_pcm_mf_cnv_utils.h deleted file mode 100644 index a0a7e353..00000000 --- a/modules/cmn/pcm_mf_cnv/capi/pcm_cnv/src/capi_pcm_mf_cnv_utils.h +++ /dev/null @@ -1,266 +0,0 @@ -/* ======================================================================== */ -/** -@file capiv2_pcm_mf_cnv_utils.h - - Header file to implement the Common Audio Post Processor Interface - for Tx/Rx Tuning PCM_CONV block -*/ - -/* ========================================================================= - Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. - SPDX-License-Identifier: BSD-3-Clause-Clear - ========================================================================== */ - -/*------------------------------------------------------------------------ - * Include files - * -----------------------------------------------------------------------*/ - -#ifndef CAPI_PCM_CNV_UTILS_H -#define CAPI_PCM_CNV_UTILS_H - -#ifndef CAPI_UNIT_TEST -/* For shared libraries. */ -#include "shared_lib_api.h" -#include "topo_utils.h" -#else -#include "capi_fwk_extns_pcm.h" -#include "capi_fwk_extns_frame_duration.h" -#endif -#include "capi_cmn.h" -#include "audpp_util.h" -#include "capi.h" -#include "audio_basic_op_ext.h" -#include "common_enc_dec_api.h" -#include "pcm_converter_api.h" -#include "pcm_encoder_api.h" -#include "pcm_decoder_api.h" -#include "mfc_api.h" -#include "capi_pcm_cnv.h" -#include "capi_pcm_dec.h" -#include "capi_pcm_enc.h" -#include "capi_mfc.h" -#include "pc_converter.h" - -#define CAPI_PCM_CNV_MAX_IN_PORTS 1 -#define CAPI_PCM_CNV_MAX_OUT_PORTS 1 -#define PCM_TRAILING_DELAY 0 -#define PCM_DECODER_DELAY 0 -#define PRI_IN_PORT_INDEX 0 -#define PRI_OUT_PORT_INDEX 0 -#define PCM_ENCODER_CONFIG_MAX_FRAME_SIZE_IN_SAMPLES 38400 -#define PCM_ENCODER_CONFIG_MAX_FRAME_SIZE_IN_MICROSECOND 100000 -#define PCM_ENCODER_CONFIG_FRAME_SIZE_IN_SAMPLES 1 -#define PCM_ENCODER_CONFIG_FRAME_SIZE_IN_MICROSECONDS 2 -#ifdef CAPI_UNIT_TEST -static inline uint32_t tu_get_unit_frame_size(uint32_t sample_rate) -{ - // Returns 1 sample as a minimum value - if (sample_rate < 1000) - { - return 1; - } - return (sample_rate / 1000); -} -#define PCM_CNV_DEBUG -#endif - -//#define PCM_CNV_DEBUG - - -#define ALIGN_4_BYTES(a) ((a + 3) & (0xFFFFFFFC)) - -static const uint32_t PCM_CNV_STACK_SIZE = 4096; -const uint32_t PCM_CNV_BW = 1 * 1024 * 1024; -const uint32_t PCM_CNV_CAPI_KPPS = 50; - -typedef enum capi_pcm_mf_cnv_result_t { CAPI_PCM_INVALID = 0, CAPI_PCM_VALID, CAPI_PCM_ERROR } capi_pcm_mf_cnv_result_t; - -typedef enum capi_pcm_mf_cnv_type_t { - CAPI_PCM_CONVERTER = 0, - CAPI_PCM_ENCODER, - CAPI_PCM_DECODER, - CAPI_MFC -} capi_pcm_mf_cnv_type_t; - -typedef enum capi_pcm_mf_cnv_perf_mode_t { - CAPI_PCM_PERF_MODE_INVALID = 0, - CAPI_PCM_PERF_MODE_LOW_POWER = 1, // should be same as #define APM_SG_PERF_MODE_LOW_POWER 0x1 - CAPI_PCM_PERF_MODE_LOW_LATENCY = 2 // should be same as #define APM_SG_PERF_MODE_LOW_LATENCY 0x2 -} capi_pcm_mf_cnv_perf_mode_t; - -typedef struct capi_pcm_mf_cnv_events_config_t -{ - uint32_t kpps; - uint32_t delay_in_us; - uint32_t code_bw; - uint32_t data_bw; -} capi_pcm_mf_cnv_events_config_t; - -typedef struct capi_pcm_mf_cnv_chmixer_coef_set_t -{ - uint16_t num_in_ch; - uint16_t *in_ch_map; - uint16_t num_out_ch; - uint16_t *out_ch_map; - int16_t * coef_ptr; -} capi_pcm_mf_cnv_chmixer_coef_set_t; - -typedef struct capi_pc_configured_mf_t -{ - data_format_t data_format; - uint32_t sampling_rate; - payload_pcm_output_format_cfg_t fmt; - uint16_t channel_type[CAPI_MAX_CHANNELS_V2]; -} capi_pc_configured_mf_t; - -typedef struct capi_pcm_mf_cnv_chmixer_config -{ - uint32_t num_coef_sets; - capi_pcm_mf_cnv_chmixer_coef_set_t *coef_sets_ptr; -} capi_pcm_mf_cnv_chmixer_config; - -typedef struct capi_pcm_mf_cnv_dm_info_t -{ - // mode - uint16_t dm_mode; - // flag to indicate if dm is enabled - uint16_t is_dm_disabled; - // for fixed output mode - uint32_t req_out_samples; - uint32_t expected_in_samples; - // for fixed input mode - uint32_t req_in_samples; - uint32_t expected_out_samples; - - uint32_t should_consume_partial_input; -} capi_pcm_mf_cnv_dm_info_t; - -typedef struct capi_pcm_mf_cnv_t -{ - capi_t vtbl; - capi_event_callback_info_t cb_info; - capi_heap_id_t heap_info; - capi_media_fmt_v2_t in_media_fmt[CAPI_PCM_CNV_MAX_IN_PORTS]; - capi_media_fmt_v2_t out_media_fmt[CAPI_PCM_CNV_MAX_OUT_PORTS]; - fwk_extn_pcm_param_id_media_fmt_extn_t extn_in_media_fmt[CAPI_PCM_CNV_MAX_IN_PORTS]; - fwk_extn_pcm_param_id_media_fmt_extn_t extn_out_media_fmt[CAPI_PCM_CNV_MAX_OUT_PORTS]; - capi_buf_t scratch_buf_1[CAPI_PCM_CNV_MAX_OUT_PORTS]; - capi_buf_t scratch_buf_2[CAPI_PCM_CNV_MAX_OUT_PORTS]; - capi_pc_configured_mf_t configured_media_fmt[CAPI_PCM_CNV_MAX_OUT_PORTS]; - capi_pcm_mf_cnv_chmixer_config config; - uint32_t coef_payload_size; - uint32_t inp_buf_size_per_ch; - uint32_t out_buf_size_per_ch; - uint32_t max_data_len_per_ch; - capi_pcm_mf_cnv_events_config_t events_config; - capi_pcm_mf_cnv_type_t type; - capi_pcm_mf_cnv_perf_mode_t perf_mode; - - // This variable will hold container based duration for MFC and SG perf mode based thresh for PCM decoders and - // encoders - uint32_t frame_size_us; - pc_lib_t pc[CAPI_PCM_CNV_MAX_IN_PORTS]; - bool_t lib_enable; - bool_t input_media_fmt_received; // indicates ip mf is received, lib init done and out mf is raised - uint32_t initial_silence_in_samples; - uint32_t trailing_silence_in_samples; - uint32_t miid; - param_id_pcm_encoder_frame_size_t frame_size; - - // port states - intf_extn_data_port_state_t in_port_state; - intf_extn_data_port_state_t out_port_state; - - // fixed input or output mode (if configured) and related data - capi_pcm_mf_cnv_dm_info_t dm_info; -} capi_pcm_mf_cnv_t; - -bool_t pcm_mf_cnv_is_supported_media_type(const capi_media_fmt_v2_t *format_ptr); - -bool_t pcm_mf_cnv_mfc_is_supported_media_type(const capi_media_fmt_v2_t *format_ptr); - -void capi_pcm_mf_cnv_mfc_set_output_bps_qf(capi_pc_configured_mf_t *media_fmt_ptr); - -uint32_t capi_pcm_mf_cnv_mfc_set_extn_inp_mf_bitwidth(uint32_t q_factor); -void capi_pcm_mf_cnv_mfc_deinit(capi_pcm_mf_cnv_t *me_ptr); -capi_err_t capi_pcm_mf_cnv_check_ch_type(capi_pcm_mf_cnv_t *me_ptr, - const uint16_t * channel_type, - const uint32_t array_size); - -capi_err_t capi_pcm_mf_cnv_handle_input_media_fmt(capi_pcm_mf_cnv_t * me_ptr, - capi_media_fmt_v2_t *temp_media_fmt_ptr, - uint32_t port); -capi_err_t capi_pcm_mf_cnv_check_and_raise_output_media_format_event(capi_pcm_mf_cnv_t *me_ptr); - -void capi_pcm_mf_cnv_print_media_fmt(capi_pcm_mf_cnv_t *me_ptr, pc_media_fmt_t *fmt_ptr, uint32_t port); -capi_err_t capi_pcm_mf_cnv_get_fixed_out_samples(capi_pcm_mf_cnv_t *me_ptr); -capi_err_t capi_pcm_mf_cnv_get_max_in_samples(capi_pcm_mf_cnv_t *me_ptr, uint32_t max_out_samples); - -ar_result_t capi_pcm_mf_cnv_lib_init(capi_pcm_mf_cnv_t *me_ptr, bool_t fir_iir_rs_switch); -capi_err_t capi_pcm_mf_cnv_allocate_scratch_buffer(capi_pcm_mf_cnv_t *me_ptr, uint32_t max_data_len_per_ch); -bool_t pcm_mf_cnv_is_supported_out_media_type(const payload_pcm_output_format_cfg_t *format_ptr, uint32 data_format); -capi_pcm_mf_cnv_result_t pcm_mf_cnv_is_supported_extn_media_type( - const fwk_extn_pcm_param_id_media_fmt_extn_t *format_ptr); -capi_err_t capi_pcm_mf_cnv_process_set_properties(capi_pcm_mf_cnv_t *me_ptr, capi_proplist_t *proplist_ptr); -capi_err_t capi_pcm_mf_cnv_process_get_properties(capi_pcm_mf_cnv_t * me_ptr, - capi_proplist_t * proplist_ptr, - capi_pcm_mf_cnv_type_t type); -void capi_pcm_mf_cnv_init_config(capi_pcm_mf_cnv_t *me_ptr); -capi_err_t capi_pcm_mf_cnv_update_and_raise_events(capi_pcm_mf_cnv_t *me_ptr); -capi_err_t capi_pcm_mf_cnv_raise_process_check_event(capi_pcm_mf_cnv_t *me_ptr); -capi_err_t capi_pcm_mf_cnv_raise_process_event(capi_pcm_mf_cnv_t *me_ptr); - -capi_err_t capi_pcm_mf_cnv_handle_data_port_op(capi_pcm_mf_cnv_t *me_ptr, capi_buf_t *params_ptr); - -capi_err_t capi_pcm_mf_cnv_realloc_scratch_buf(capi_pcm_mf_cnv_t *me_ptr, capi_buf_t *sb_ptr, uint32_t max_data_len); - -capi_err_t capi_pcm_mf_cnv_allocate_scratch_buffer(capi_pcm_mf_cnv_t *me_ptr, uint32_t max_data_len_per_ch); - -capi_err_t capi_pcm_encoder_update_frame_size(capi_pcm_mf_cnv_t *me_ptr); - - -void capi_pcm_mf_cnv_reset_buffer_len(capi_pcm_mf_cnv_t *me_ptr, - capi_buf_t * src_buf_ptr, - capi_buf_t * dest_buf_ptr, - uint32_t port); - -void capi_pcm_mf_cnv_update_dm_disable(capi_pcm_mf_cnv_t *me_ptr); - -static inline bool_t capi_pcm_mf_cnv_is_dm_enabled(capi_pcm_mf_cnv_t *me_ptr) -{ - return !me_ptr->dm_info.is_dm_disabled; -} - -static inline pc_interleaving_t capi_interleaved_to_pc(capi_interleaving_t capi_value) -{ - pc_interleaving_t pc_interleaved = PC_UNKNOWN_INTERLEAVING; - if (CAPI_INTERLEAVED == capi_value) - { - pc_interleaved = PC_INTERLEAVED; - } - else if (CAPI_DEINTERLEAVED_PACKED == capi_value) - { - pc_interleaved = PC_DEINTERLEAVED_PACKED; - } - else if(CAPI_DEINTERLEAVED_UNPACKED_V2 == capi_value) - { - // input media format will only be set with V2, hence no need to V1. - pc_interleaved = PC_DEINTERLEAVED_UNPACKED_V2; - } - return pc_interleaved; -} - -static inline pc_data_format_t capi_dataformat_to_pc(data_format_t capi_value) -{ - if (CAPI_FIXED_POINT == capi_value) - { - return PC_FIXED_FORMAT; - } - else if (CAPI_FLOATING_POINT == capi_value) - { - return PC_FLOATING_FORMAT; - } - return PC_INVALID_FORMAT; -} - -#endif // CAPI_PCM_CNV_UTILS_H diff --git a/modules/cmn/pcm_mf_cnv/capi/pcm_cnv/src/capi_pcm_mf_cnv_utils_island.cpp b/modules/cmn/pcm_mf_cnv/capi/pcm_cnv/src/capi_pcm_mf_cnv_utils_island.cpp deleted file mode 100644 index 4383466d..00000000 --- a/modules/cmn/pcm_mf_cnv/capi/pcm_cnv/src/capi_pcm_mf_cnv_utils_island.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* ========================================================================= - Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. - SPDX-License-Identifier: BSD-3-Clause-Clear - * =========================================================================*/ - -/** - * @file capi_pcm_mf_cnv_utils_island.cpp - * - * C source file to implement the Audio Post Processor Interface for - * PCM_CNV Module - */ - -#include "capi_pcm_mf_cnv_utils.h" - -/*_____________________________________________________________________________________________________________________ - DESCRIPTION: - Prints media fmt - ____________________________________________________________________________________________________________________*/ -void capi_pcm_mf_cnv_print_media_fmt(capi_pcm_mf_cnv_t *me_ptr, pc_media_fmt_t *fmt_ptr, uint32_t port) -{ - CNV_MSG(me_ptr->miid, - DBG_HIGH_PRIO, - "bit_width : %u , word_size : %u, q_factor : %u, interleaving : %u, endianness : %u, " - "alignment : %u, num_channels : %u sampling rate %d", - fmt_ptr->bit_width, - fmt_ptr->word_size, - fmt_ptr->q_factor, - fmt_ptr->interleaving, - fmt_ptr->endianness, - fmt_ptr->alignment, - fmt_ptr->num_channels, - fmt_ptr->sampling_rate); -} - - diff --git a/modules/cmn/pcm_mf_cnv/capi/pcm_cnv/stub_src/capi_pcm_cnv_stub.cpp b/modules/cmn/pcm_mf_cnv/capi/pcm_cnv/stub_src/capi_pcm_cnv_stub.cpp deleted file mode 100644 index 4e2afdb7..00000000 --- a/modules/cmn/pcm_mf_cnv/capi/pcm_cnv/stub_src/capi_pcm_cnv_stub.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* ========================================================================= - * Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. - * SPDX-License-Identifier: BSD-3-Clause-Clear - * =========================================================================*/ - -/** - * @file capi_pcm_cnv_stub.cpp - * - * Stub Interface for pcm_cnv. - */ - -#include "capi_pcm_cnv.h" - -capi_err_t capi_pcm_cnv_get_static_properties(capi_proplist_t *init_set_properties, - capi_proplist_t *static_properties) -{ - return CAPI_EUNSUPPORTED; -} - -capi_err_t capi_pcm_cnv_init(capi_t *_pif, capi_proplist_t *init_set_properties) -{ - return CAPI_EUNSUPPORTED; -} - -capi_err_t capi_pcm_enc_get_static_properties(capi_proplist_t *init_set_properties, - capi_proplist_t *static_properties) -{ - return CAPI_EUNSUPPORTED; -} -capi_err_t capi_pcm_enc_init(capi_t *_pif, capi_proplist_t *init_set_properties) -{ - return CAPI_EUNSUPPORTED; -} - -capi_err_t capi_pcm_dec_get_static_properties(capi_proplist_t *init_set_properties, - capi_proplist_t *static_properties) -{ - return CAPI_EUNSUPPORTED; -} - -capi_err_t capi_pcm_dec_init(capi_t *_pif, capi_proplist_t *init_set_properties) -{ - return CAPI_EUNSUPPORTED; -} diff --git a/modules/cmn/pcm_mf_cnv/lib/inc/pc_converter.h b/modules/cmn/pcm_mf_cnv/lib/inc/pc_converter.h deleted file mode 100644 index 32832a11..00000000 --- a/modules/cmn/pcm_mf_cnv/lib/inc/pc_converter.h +++ /dev/null @@ -1,437 +0,0 @@ -/*======================================================================== - -file pcm_converter.h -This file contains functions for compression-decompression container - - Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. - SPDX-License-Identifier: BSD-3-Clause-Clear -======================================================================*/ - -/* ======================================================================= -INCLUDE FILES FOR MODULE -========================================================================== */ -#ifndef PCM_CONVERTER_H -#define PCM_CONVERTER_H -#include "audio_basic_op_ext.h" -#include "ar_error_codes.h" -#include "capi.h" -#include "capi_cmn.h" -#include "shared_lib_api.h" -#include "shared_aud_cmn_lib.h" -#include "common_enc_dec_api.h" -#include "pcm_converter_api.h" -#include "pcm_encoder_api.h" -#include "pcm_decoder_api.h" -#include "ChannelMixerLib.h" -#include "hwsw_rs_lib.h" -#include "iir_rs_lib.h" -#include "spf_interleaver.h" - -#ifdef __cplusplus -extern "C" { -#endif /*__cplusplus*/ - -/*--------------------------------------------------------------*/ -/* Macro definitions */ -/* -------------------------------------------------------------*/ -//#define USE_Q6_SPECIFIC_CODE -//#define PCM_CNV_LIB_DEBUG 1 -#define MIID_UNKNOWN 0 - -#define CNV_MSG_PREFIX "MFC_PCM_CNV:[%lX] " -#define CNV_MSG(ID, xx_ss_mask, xx_fmt, ...) AR_MSG(xx_ss_mask, CNV_MSG_PREFIX xx_fmt, ID, ##__VA_ARGS__) - -#define CNV_IIR_RS_MIN_FRAME_SIZE_US 1000 -#define MEM_ALIGN_EIGHT_BYTE 8 - -/*---------------------------------------------------------------------------- - * Global Data Definitions - * -------------------------------------------------------------------------*/ -static const uint32_t MAX_Q23 = ((1 << PCM_Q_FACTOR_23) - 1); -static const uint32_t MIN_Q23 = (-(1 << PCM_Q_FACTOR_23)); -static const uint32_t MAX_Q27 = ((1 << PCM_Q_FACTOR_27) - 1); -static const uint32_t MIN_Q27 = (-(1 << PCM_Q_FACTOR_27)); -static const uint32_t MAX_Q31 = 0x7FFFFFFF; -static const uint32_t MIN_Q31 = 0x80000000; -static const uint32_t NUMBER_OF_PROCESS = 11; -static const uint32_t MAX_NUMBER_OF_BUFFERING_PROCESS = 7; -static const uint32_t NUMBER_OF_CHANNEL_MAPS = 2; -static const uint32_t NUMBER_OF_REMAP_BUFFERS = 4; -static const uint32_t MAX_BW_IDX = 3; -// All the kpps values are scaled based on sample word size -// Indices to WS map is as follows, -// 0 - > 16 bit -// 1 - > 24 bit -// 2 - > 32 bit -static const uint32_t endianness_kpps_per_ch[MAX_BW_IDX] = { 230, 180, 130 }; -static const uint32_t intl_dintl_kpps_per_ch[MAX_BW_IDX] = { 110, 640, 110 }; -static const uint32_t byte_cnv_kpps_per_ch[MAX_BW_IDX] = { 100, 300, 120 }; -static const uint32_t ch_mixer_kpps_per_ch[MAX_BW_IDX] = { 450, 500, 500 }; -static const uint32_t memcpy_kpps_per_ch[MAX_BW_IDX] = { 100, 100, 100 }; -static const uint32_t fw_kpps = 100; // just a little extra kpps for logic - -static const uint32_t base_sample_rate = 48000; - -#define PC_CEIL(x, y) (((x) + (y)-1) / (y)) - -// Enlists possible combinations of media_fmt for a given buf -// BW- bit width, W - word size, Q - q-factor -typedef enum pc_mf_combo_t { - PC_INVALID_CMBO = 0, - PC_BW16_W16_Q15, - PC_BW24_W24_Q23, - PC_BW24_W32_Q23, - PC_BW24_W32_Q27, - PC_BW24_W32_Q31, - PC_BW32_W32_Q31, - PC_BW32_W32_FLOAT, - PC_BW64_W64_DOUBLE, -} pc_mf_combo_t; - -typedef enum pc_endian_t { - PC_UNKNOWN_ENDIAN = PARAM_VAL_INVALID, - PC_LITTLE_ENDIAN = PCM_LITTLE_ENDIAN, - PC_BIG_ENDIAN = PCM_BIG_ENDIAN -} pc_endian_t; - -typedef enum pc_alignment_t { - PC_UNKNOWN_ALIGNMENT = PARAM_VAL_INVALID, - PC_LSB_ALIGNED = PCM_LSB_ALIGNED, - PC_MSB_ALIGNED = PCM_MSB_ALIGNED -} pc_alignment_t; - -/* PC handles unpacked data, in the CAPI_DEINTERLEVED_UNPACKED_V2 format, - i.e it reads/updates only first chs lengths */ -typedef enum pc_interleaving_t -{ - PC_UNKNOWN_INTERLEAVING = PARAM_VAL_INVALID, - PC_INTERLEAVED = PCM_INTERLEAVED, - PC_DEINTERLEAVED_PACKED = PCM_DEINTERLEAVED_PACKED, - PC_DEINTERLEAVED_UNPACKED_V2 = PCM_DEINTERLEAVED_UNPACKED -} pc_interleaving_t; - -// Enlisting data format to the pc module -typedef enum pc_data_format_t { - PC_FIXED_FORMAT = 0, - PC_FLOATING_FORMAT, - PC_INVALID_FORMAT, -} pc_data_format_t; - -// Media Format used for -typedef struct pc_media_fmt_t -{ - uint32_t sampling_rate; - pc_endian_t endianness; - pc_interleaving_t interleaving; - pc_mf_combo_t byte_combo; - pc_alignment_t alignment; - pc_data_format_t data_format; - uint16_t bit_width; - uint16_t word_size; - uint16_t q_factor; - uint16_t num_channels; - uint16_t * channel_type; -} pc_media_fmt_t; - -// Process modules which can be present in the PCM pipeline -// UP - comes before channel map module -// Down - comes after channel map module -typedef union pc_process_flags_t -{ - struct - { - uint32_t ENDIANNESS_PRE : 1; - uint32_t DATA_CNV_FLOAT_TO_FIXED : 1; - uint32_t INT_DEINT_PRE : 1; - uint32_t BYTE_CNV_PRE : 1; - uint32_t RESAMPLER_PRE : 1; - uint32_t CHANNEL_MIXER : 1; - uint32_t RESAMPLER_POST : 1; - uint32_t BYTE_CNV_POST : 1; - uint32_t INT_DEINT_POST : 1; - uint32_t DATA_CNV_FIXED_TO_FLOAT : 1; - uint32_t ENDIANNESS_POST : 1; - }; - uint32_t word; -} pc_process_flags_t; - -typedef enum pc_proc_flags_t { - ENDIANNESS_PRE = 0, - DATA_CNV_FLOAT_TO_FIXED, - INT_DEINT_PRE, - BYTE_CNV_PRE, - RESAMPLER_PRE, - CHANNEL_MIXER, - RESAMPLER_POST, - BYTE_CNV_POST, - INT_DEINT_POST, - DATA_CNV_FIXED_TO_FLOAT, - ENDIANNESS_POST, -} pc_proc_flags_t; - -typedef enum pc_resampler_type_t { FIR_RESAMPLER = 0, IIR_RESAMPLER = 1, IIR_PREFERRED } pc_resampler_type_t; - -typedef enum pc_rs_position_flag_t { RESAMPLER_POSITION_PRE, RESAMPLER_POSITION_POST } pc_rs_position_flag_t; - -typedef enum pcm_mf_cnv_type_t { PCM_CNV = 0, PCM_ENC, PCM_DEC, MFC } pcm_mf_cnv_type_t; -// This structure is used as a v-table for process calls for modules in the pcm pipeline -typedef struct pc_proc_info_t -{ - // Pointer to the process function - ar_result_t (*process)(void * me_ptr, - capi_buf_t * input_buf_ptr, - capi_buf_t * output_buf_ptr, - pc_media_fmt_t *input_media_fmt_ptr, - pc_media_fmt_t *output_media_fmt_ptr); - - // Pointer to the output buffer. - // We point this to the de-interleaved-unpacked buffers part of the pc_lib_t struct, because - // 1.Actual buffers are not available in the init phase - // 2.Actual buffer ptr values may change - // 3.We might have to re-map the buffers run time since most of the process functions take deint-unpacked fmt - capi_buf_t *output_buffer_ptr; - - // Output media format for the module. Input media fmt is obtained form the previous process's output media fmt - pc_media_fmt_t output_media_fmt; - -} pc_proc_info_t; - -typedef struct pc_core_lib_t -{ - // Memory pointer to the memory required for channel maps and remap buffers - void *pc_mem_ptr; - - // Max of input and output number of channels - uint16_t max_num_channels; - - // Input Media format - pc_media_fmt_t input_media_fmt; - - // Output media format - pc_media_fmt_t output_media_fmt; - - // Flags to hold information on which module is enabled in the pipeline - pc_process_flags_t flags; - - // Number of modules with cannot do processing in-place - uint32_t no_of_buffering_stages; - - // Process info v-table required to call process of each module - pc_proc_info_t pc_proc_info[NUMBER_OF_PROCESS]; - - // Temporary de-interleaved-unpacked buffer ptr holder for fwk input - capi_buf_t *remap_input_buf_ptr; - - // Temporary de-interleaved-unpacked buffer ptr holder for scratch buffer 1 - capi_buf_t *remap_scratch_buf1_ptr; - - // Temporary de-interleaved-unpacked buffer ptr holder for scratch buffer 2 - capi_buf_t *remap_scratch_buf2_ptr; - - // Temporary de-interleaved-unpacked buffer ptr holder for fwk output buffer - capi_buf_t *remap_output_buf_ptr; -} pc_core_lib_t; - -// Main library structure for pcm converter -typedef struct pc_lib_t -{ - pc_core_lib_t core_lib; - - // log id used for printing - uint32_t miid; - - // Channel mixer library structure - ChMixerStateStruct *ch_lib_ptr; - - // either fir or iir resampler - pc_resampler_type_t resampler_type; - - // fir resampler config - uint32_t use_hw_rs; - - // fir resampler dyn mode - uint16_t dynamic_mode; - - // for resampler delay type - uint16_t delay_type; - - // hw-sw (fir) resampler lib - hwsw_resampler_lib_t *hwsw_rs_lib_ptr; - - // previous resampler position - pc_rs_position_flag_t resampler_used; - - // iir resampler lib - iir_rs_lib_t *iir_rs_lib_ptr; - - // For IIR_RS use cases, this is used to send the library the fixed frame size. It is also - // used to ensure we only consume one frame_size worth of data per process call. Capi client - // will send aggregated frame size (ex 20ms, or 1ms when threshold is disabed). - uint32_t cntr_frame_size_us; - uint32_t frame_size_us; - uint32_t in_frame_samples_per_ch; // To avoid process call divisions. - uint32_t out_frame_samples_per_ch; - uint32_t heap_id; - bool_t consume_partial_input; - bool_t iir_pref_set; -} pc_lib_t; - -// Process function - -ar_result_t pc_endianness_process(void * me_ptr, - capi_buf_t * input_buf_ptr, - capi_buf_t * output_buf_ptr, - pc_media_fmt_t *input_media_fmt_ptr, - pc_media_fmt_t *output_media_fmt_ptr); - -ar_result_t pc_interleaving_process(void * me_ptr, - capi_buf_t * input_buf_ptr, - capi_buf_t * output_buf_ptr, - pc_media_fmt_t *input_media_fmt_ptr, - pc_media_fmt_t *output_media_fmt_ptr); - -ar_result_t pc_byte_morph_process(void * me_ptr, - capi_buf_t * input_buf_ptr, - capi_buf_t * output_buf_ptr, - pc_media_fmt_t *input_media_fmt_ptr, - pc_media_fmt_t *output_media_fmt_ptr); - -ar_result_t pc_channel_mix_process(void * me_ptr, - capi_buf_t * input_buf_ptr, - capi_buf_t * output_buf_ptr, - pc_media_fmt_t *input_media_fmt_ptr, - pc_media_fmt_t *output_media_fmt_ptr); - -ar_result_t pc_dyn_resampler_process(void * me_ptr, - capi_buf_t * input_buf_ptr, - capi_buf_t * output_buf_ptr, - pc_media_fmt_t *input_media_fmt_ptr, - pc_media_fmt_t *output_media_fmt_ptr); - -ar_result_t pc_iir_resampler_process(void * me_ptr, - capi_buf_t * input_buf_ptr, - capi_buf_t * output_buf_ptr, - pc_media_fmt_t *input_media_fmt_ptr, - pc_media_fmt_t *output_media_fmt_ptr); - -ar_result_t pc_float_to_fixed_conv_process(void * me_ptr, - capi_buf_t * input_buf_ptr, - capi_buf_t * output_buf_ptr, - pc_media_fmt_t *input_media_fmt_ptr, - pc_media_fmt_t *output_media_fmt_ptr); - -ar_result_t pc_fixed_to_float_conv_process(void * me_ptr, - capi_buf_t * input_buf_ptr, - capi_buf_t * output_buf_ptr, - pc_media_fmt_t *input_media_fmt_ptr, - pc_media_fmt_t *output_media_fmt_ptr); - -ar_result_t pc_intlv_16_out(capi_buf_t *input_buf_ptr, - capi_buf_t *output_buf_ptr, - uint16_t word_size_in, - uint16_t q_factor_in); - -ar_result_t pc_intlv_24_out(capi_buf_t *input_buf_ptr, - capi_buf_t *output_buf_ptr, - uint16_t word_size_in, - uint16_t q_factor_in); - -ar_result_t pc_intlv_32_out(capi_buf_t *input_buf_ptr, - capi_buf_t *output_buf_ptr, - uint16_t word_size_in, - uint16_t q_factor_in, - uint16_t q_factor_out); - -/** Generates DEINTERLEAVED UNPACKED V1 output i.e updates all the chs data len's*/ -ar_result_t pc_deintlv_16_out(capi_buf_t *input_buf_ptr, - capi_buf_t *output_buf_ptr, - uint16_t num_channels, - uint16_t word_size_in, - uint16_t q_factor_in); - -/** Generates DEINTERLEAVED UNPACKED V1 output i.e updates all the chs data len's*/ -ar_result_t pc_deintlv_24_out(capi_buf_t *input_buf_ptr, - capi_buf_t *output_buf_ptr, - uint16_t num_channels, - uint16_t word_size_in, - uint16_t q_factor_in); - -/** Generates DEINTERLEAVED UNPACKED V1 output i.e updates all the chs data len's*/ -ar_result_t pc_deintlv_32_out(capi_buf_t *input_buf_ptr, - capi_buf_t *output_buf_ptr, - uint16_t num_channels, - uint16_t word_size_in, - uint16_t q_factor_in, - uint16_t q_factor_out); - -/** Generates DEINTERLEAVED UNPACKED V2 output i.e updates only first chs data len's*/ -ar_result_t pc_deintlv_unpacked_v2_16_out(capi_buf_t *input_buf_ptr, - capi_buf_t *output_buf_ptr, - uint16_t num_channels, - uint16_t word_size_in, - uint16_t q_factor_in); - -/** Generates DEINTERLEAVED UNPACKED V2 output i.e updates only first chs data len's*/ -ar_result_t pc_deintlv_unpacked_v2_24_out(capi_buf_t *input_buf_ptr, - capi_buf_t *output_buf_ptr, - uint16_t num_channels, - uint16_t word_size_in, - uint16_t q_factor_in); - -/** Generates DEINTERLEAVED UNPACKED V2 output i.e updates only first chs data len's*/ -ar_result_t pc_deintlv_unpacked_v2_32_out(capi_buf_t *input_buf_ptr, - capi_buf_t *output_buf_ptr, - uint16_t num_channels, - uint16_t word_size_in, - uint16_t q_factor_in, - uint16_t q_factor_out); - -ar_result_t pc_change_endianness(int8_t *src_ptr, - int8_t *dest_ptr, - uint32_t src_actual_len, - uint32_t *dest_actual_len, - uint32_t word_size); -/* ----------------------------------------------------------------------- - ** API Func - ** ----------------------------------------------------------------------- */ -bool_t pc_is_floating_point_data_format_supported(); -bool_t pc_is_ch_mixer_needed(pc_lib_t * pc_ptr, - int16_t * coef_set_ptr, - pc_media_fmt_t *input_media_fmt_ptr, - pc_media_fmt_t *output_media_fmt_ptr); - -ar_result_t pc_init(pc_lib_t * pc_ptr, - pc_media_fmt_t *input_media_fmt_ptr, - pc_media_fmt_t *output_media_fmt_ptr, - void * coef_set_ptr, - uint32_t heap_id, - bool_t * lib_enable, - bool_t fir_iir_rs_switch, - uint32_t miid, - uint8_t type); - -void pc_deinit(pc_lib_t *pc_ptr); - -void pc_get_kpps_and_bw(pc_lib_t *pc_ptr, uint32_t *kpps, uint32_t *bw); - -uint32_t pc_get_algo_delay(pc_lib_t *pc_ptr); - -pc_mf_combo_t pc_classify_mf(pc_media_fmt_t *mf_ptr); - -ar_result_t pc_process(pc_lib_t * me_ptr, - capi_buf_t *input_buf_ptr, - capi_buf_t *output_buf_ptr, - capi_buf_t *scratch_buf_ptr_1, - capi_buf_t *scratch_buf_ptr_2); - -uint32_t pc_get_fixed_out_samples(pc_lib_t *pc_ptr, uint32_t req_out_samples); - -void pc_set_frame_size(pc_lib_t *pc_ptr, uint32_t frame_size_us); - -void pc_set_cntr_frame_size(pc_lib_t *pc_ptr, uint32_t cntr_frame_size_us); -void pc_set_consume_partial_input(pc_lib_t *pc_ptr, bool_t consume_partial_input); - -#ifdef __cplusplus -} -#endif /*__cplusplus*/ -#endif // PCM_CONVERTER_H diff --git a/modules/cmn/pcm_mf_cnv/lib/src/pc_converter.cpp b/modules/cmn/pcm_mf_cnv/lib/src/pc_converter.cpp deleted file mode 100644 index 31314257..00000000 --- a/modules/cmn/pcm_mf_cnv/lib/src/pc_converter.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/*======================================================================== - - file pcm_converter.cpp -This file contains functions for compression-decompression container - -Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. -SPDX-License-Identifier: BSD-3-Clause-Clear -======================================================================*/ - -/* ======================================================================= -INCLUDE FILES FOR MODULE -========================================================================== */ - -#include "pc_converter.h" - -/*______________________________________________________________________________________________________________________ - DESCRIPTION: - -______________________________________________________________________________________________________________________*/ - -/** changes endianess as it moves data into destination buffer, and returns the actual data length of the destination.*/ -ar_result_t pc_change_endianness(int8_t *in_ptr, - int8_t *out_ptr, - uint32_t src_actual_len, - uint32_t *dest_actual_len_ptr, - uint32_t word_size) -{ - uint32_t total_num_samples = src_actual_len / (word_size >> 3); - uint32_t i; - - if (16 == word_size) - { - int16_t *src_ptr_16 = (int16_t *)in_ptr; - int16_t *dst_ptr_16 = (int16_t *)out_ptr; - uint16_t val; - for (i = 0; i < total_num_samples; i++) - { - val = *src_ptr_16++; - *dst_ptr_16++ = (int16_t)(((val & 0xFF00) >> 8) | ((val & 0x00FF) << 8)); - } - } - else if (24 == word_size) - { - int8_t *src_ptr = in_ptr; - int8_t *dst_ptr = out_ptr; - uint8_t val1, val2, val3; - for (i = 0; i < total_num_samples; i++) - { - val1 = *src_ptr++; - val2 = *src_ptr++; - val3 = *src_ptr++; - *dst_ptr++ = val3; - *dst_ptr++ = val2; - *dst_ptr++ = val1; - } - } - else if (32 == word_size) - { - int32_t *dst_ptr = (int32_t *)out_ptr; - int32_t *src_ptr = (int32_t *)in_ptr; - uint32_t val; - for (i = 0; i < total_num_samples; i++) - { - val = *src_ptr++; -#if ((defined __hexagon__) || (defined __qdsp6__)) - *dst_ptr++ = Q6_R_swiz_R(val); -#else - *dst_ptr++ = (int32_t)((val & 0x000000FF) << 24 | (val & 0x0000FF00) << 8 | (val & 0x00FF0000) >> 8 | - (val & 0xFF000000) >> 24); -#endif - } - } - *dest_actual_len_ptr = src_actual_len; - return AR_EOK; -} diff --git a/modules/cmn/pcm_mf_cnv/lib/src/pc_converter_island.cpp b/modules/cmn/pcm_mf_cnv/lib/src/pc_converter_island.cpp deleted file mode 100644 index ebbe925a..00000000 --- a/modules/cmn/pcm_mf_cnv/lib/src/pc_converter_island.cpp +++ /dev/null @@ -1,982 +0,0 @@ -/*======================================================================== - - file pcm_converter.cpp -This file contains functions for compression-decompression container - -Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. -SPDX-License-Identifier: BSD-3-Clause-Clear -======================================================================*/ - -#include "pc_converter.h" - -/* ======================================================================= -INCLUDE FILES FOR MODULE -========================================================================== */ - -#if ((defined __hexagon__) || (defined __qdsp6__)) -#define USE_Q6_SPECIFIC_CODE -#endif -/*______________________________________________________________________________________________________________________ - DESCRIPTION: - -______________________________________________________________________________________________________________________*/ -ar_result_t pc_intlv_16_out(capi_buf_t *input_buf_ptr, - capi_buf_t *output_buf_ptr, - uint16_t word_size_in, - uint16_t q_factor_in) -{ - - int32_t samp; - int32_t *buf_ptr_32; - int16_t *buf_ptr_16; -#ifdef USE_Q6_SPECIFIC_CODE - int64_t *buf_ptr_64; -#endif - uint32_t total_num_samples = input_buf_ptr->actual_data_len / (word_size_in >> 3); - // AR_MSG(DBG_ERROR_PRIO, "PCM_MF_CNV_LIB: ws - %d total_sample %d ", word_size_in, total_num_samples); - const uint32_t shift = (q_factor_in - 15); // (Qn - Q15) - - if (32 == word_size_in) - { -#ifdef USE_Q6_SPECIFIC_CODE - buf_ptr_64 = (int64_t *)(input_buf_ptr->data_ptr); /* Input buffer */ - buf_ptr_32 = (int32_t *)(output_buf_ptr->data_ptr); /* Output buffer */ - - /* If input buf addr is 8 byte aligned and out buf addr is 4 byte aligned - then only perform the vector operation - */ - if ((0 == ((uint32_t)buf_ptr_64 & 0x7)) && (0 == ((uint32_t)buf_ptr_32 & 0x3))) - { - for (samp = total_num_samples; samp >= 2; samp -= 2) - { - int64_t temp64 = *buf_ptr_64++; - /* Convert from Q31 to Q15*/ - - /* Right shift each of the 32 bit words into 16 bits and - store the two lower halfwords into destination - */ - *buf_ptr_32++ = Q6_R_vasrw_PR(temp64, shift); - } - - /* If the number of samples are odd, following loop will handle. */ - total_num_samples = samp; - } - /* if either of buf addr is not byte aligned as required for vectorization - * or for the remaining samples in case it's odd*/ - else - { - int32_t temp32; - - int16_t *buf_ptr_src_16 = (int16_t *)buf_ptr_32; - int32_t *buf_ptr_src2_32 = (int32_t *)buf_ptr_64; - - for (samp = 0; samp < total_num_samples; samp++) - { - temp32 = *buf_ptr_src2_32++; - /* Q28 to Q15 */ - /* First right shift followed by rounding operation */ - *buf_ptr_src_16++ = Q6_R_asr_RR(temp32, shift); - } - } - -#else - /*----------- Non Q6 Version ---------------*/ - buf_ptr_16 = (int16_t *)output_buf_ptr->data_ptr; - buf_ptr_32 = (int32_t *)input_buf_ptr->data_ptr; - - /* Qn to Q15 */ - // shift is 31-15 = 16 if q_factor_in is 31. - for (samp = 0; samp < total_num_samples; samp++) - { - int32_t temp32 = *buf_ptr_32++; - *buf_ptr_16++ = (int16_t)(temp32 >> shift); - } -#endif /* USE_Q6_SPECIFIC_CODE */ - } - else if (24 == word_size_in) - { - buf_ptr_16 = (int16_t *)output_buf_ptr->data_ptr; - uint8_t *src_ptr = (uint8_t *)input_buf_ptr->data_ptr; - /* Qn to Q15 */ - for (samp = 0; samp < total_num_samples; samp++) - { - int32_t num32; - uint32_t tem32; - - num32 = 0; - tem32 = *src_ptr++; - num32 = num32 | (tem32); - tem32 = *src_ptr++; - num32 = num32 | (tem32 << 8); - tem32 = *src_ptr++; - num32 = num32 | (tem32 << 16); - *buf_ptr_16++ = (int16_t)(num32 >> shift); - } - } - else - { - return AR_EUNSUPPORTED; - } - output_buf_ptr->actual_data_len = input_buf_ptr->actual_data_len * 2 / (word_size_in >> 3); - return AR_EOK; -} - -/*______________________________________________________________________________________________________________________ - DESCRIPTION: - -______________________________________________________________________________________________________________________*/ -ar_result_t pc_intlv_24_out(capi_buf_t *input_buf_ptr, - capi_buf_t *output_buf_ptr, - uint16_t word_size_in, - uint16_t q_factor_in) -{ - int32_t samp; - int32_t *buf_ptr_32; - int8_t * buf_ptr_8; - uint32_t total_num_samples = input_buf_ptr->actual_data_len / (word_size_in >> 3); - uint32_t shift; - - if (16 == word_size_in) - { - /*----------- Non Q6 Version ---------------*/ - - buf_ptr_8 = (int8_t *)output_buf_ptr->data_ptr; - uint8_t *src = (uint8_t *)input_buf_ptr->data_ptr; - - /* Q16 -> Q23 conversion */ - for (samp = 0; samp < total_num_samples; samp++) - { - *buf_ptr_8++ = 0x00; - *buf_ptr_8++ = *src++; - *buf_ptr_8++ = *src++; - } - } - else if (32 == word_size_in) - { - - shift = (q_factor_in - 23); // (Qn - Q23) - - uint8_t *dst = (uint8_t *)output_buf_ptr->data_ptr; - buf_ptr_32 = (int32_t *)input_buf_ptr->data_ptr; - int32_t num32 = 0; - uint8_t temp8 = 0; - - /* Q27/31 -> Q23 conversion */ - for (samp = 0; samp < total_num_samples; samp++) - { - num32 = *buf_ptr_32++ >> shift; - temp8 = (uint8_t)num32; - *dst++ = temp8; - - num32 = num32 >> 8; - temp8 = (uint8_t)num32; - *dst++ = temp8; - - num32 = num32 >> 8; - temp8 = (uint8_t)num32; - *dst++ = temp8; - } - } - else - { - return AR_EUNSUPPORTED; - } - - output_buf_ptr->actual_data_len = input_buf_ptr->actual_data_len * 3 / (word_size_in >> 3); - return AR_EOK; -} - -/*______________________________________________________________________________________________________________________ - DESCRIPTION: - -______________________________________________________________________________________________________________________*/ -ar_result_t pc_intlv_32_out(capi_buf_t *input_buf_ptr, - capi_buf_t *output_buf_ptr, - uint16_t word_size_in, - uint16_t q_factor_in, - uint16_t q_factor_out) -{ - - int32_t samp; - int32_t *buf_ptr_32; - int16_t *buf_ptr_16; - uint32_t total_num_samples = input_buf_ptr->actual_data_len / (word_size_in >> 3); -#ifdef USE_Q6_SPECIFIC_CODE - int64_t *buf_ptr_64; -#endif - uint32_t shift; - uint32_t min_value = 0; - uint32_t max_value = 0; - if (PCM_Q_FACTOR_23 == q_factor_in) - { - min_value = MIN_Q23; - max_value = MAX_Q23; - } - else if (PCM_Q_FACTOR_27 == q_factor_in) - { - min_value = MIN_Q27; - max_value = MAX_Q27; - } - else // when q_factor_in is other than 23 and 27 - { - min_value = (-(1 << q_factor_in)); - max_value = ((1 << q_factor_in) - 1); - } - if (16 == word_size_in) - { - // no in-place - if (input_buf_ptr == output_buf_ptr) - { - return AR_EBADPARAM; - } - - shift = (q_factor_out - q_factor_in); - -#ifdef USE_Q6_SPECIFIC_CODE - - buf_ptr_32 = (int32_t *)(input_buf_ptr->data_ptr); /* Input buffer */ - buf_ptr_64 = (int64_t *)(output_buf_ptr->data_ptr); /* Output buffer */ - - /* Convert from Q15 to Q31/27, conversion output in scratch buffer - */ - - /* If Output buf addr is 8 byte aligned and input buf addr is 4 byte aligned - then only perform the vector operation - */ - if ((0 == ((uint32_t)buf_ptr_64 & 0x7)) && (0 == ((uint32_t)buf_ptr_32 & 0x3))) - { - for (samp = total_num_samples; samp >= 2; samp -= 2) - { - /* Sign extend two 16-bit words in to two 32-bit words */ - *buf_ptr_64 = Q6_P_vsxthw_R(*buf_ptr_32++); - - /* Shift left the result to convert it to Q31/27 - */ - *buf_ptr_64 = Q6_P_vaslw_PR(*buf_ptr_64, shift); - buf_ptr_64++; - } - - /* If the number of samples per channel is odd */ - total_num_samples = samp; - } - /* if either of buf addr is not byte aligned as required for vectorization - * or for odd samples */ - else - { - buf_ptr_16 = (int16_t *)buf_ptr_32; - buf_ptr_32 = (int32_t *)buf_ptr_64; - - /* Q15 -> Q31/27 conversion */ - for (samp = 0; samp < total_num_samples; samp++) - { - (*buf_ptr_32++) = (int32_t)((*buf_ptr_16++) << shift); - } - } -#else - /*----------- Non Q6 Version ---------------*/ - - buf_ptr_16 = (int16_t *)input_buf_ptr->data_ptr; - buf_ptr_32 = (int32_t *)output_buf_ptr->data_ptr; - - /* Q15 -> Q31/27 conversion */ - for (samp = 0; samp < total_num_samples; samp++) - { - int32_t temp = *buf_ptr_16++; - (*buf_ptr_32++) = (int32_t)((temp) << shift); - } - -#endif /* USE_Q6_SPECIFIC_CODE */ - } - else if (24 == word_size_in) - { - /*----------- Non Q6 Version ---------------*/ - shift = (31 - q_factor_out); - buf_ptr_32 = (int32_t *)output_buf_ptr->data_ptr; - uint8_t *src = (uint8_t *)input_buf_ptr->data_ptr; - // POSAL_ASSERT(shift <= 8); - - /* Q23 -> Q27 conversion */ - for (samp = 0; samp < total_num_samples; samp++) - { - int32_t num32; - uint32_t tem32; - num32 = 0; - tem32 = *src++; - num32 = num32 | (tem32 << 8); - tem32 = *src++; - num32 = num32 | (tem32 << 16); - tem32 = *src++; - num32 = num32 | (tem32 << 24); - (*buf_ptr_32++) = (int32_t)((num32) >> (shift)); - } - } - else if (32 == word_size_in) - { -#ifdef USE_Q6_SPECIFIC_CODE - int64_t *in_buf_ptr_64 = (int64_t *)(input_buf_ptr->data_ptr); /* Input buffer */ - buf_ptr_64 = (int64_t *)(output_buf_ptr->data_ptr); /* Output buffer */ - - /* Convert from Q15 to Q27, conversion output in scratch buffer - */ - - /* If Output buf addr is 8 byte aligned and input buf addr is 8 byte aligned - then only perform the vector operation - */ - if ((q_factor_out < q_factor_in) && (0 == ((uint32_t)buf_ptr_64 & 0x7)) && (0 == ((uint32_t)in_buf_ptr_64 & 0x7))) - { - shift = q_factor_in - q_factor_out; - for (samp = total_num_samples; samp >= 2; samp -= 2) - { - /* Shift left the result to convert it to Q27 - */ - *buf_ptr_64 = Q6_P_vasrw_PR(*in_buf_ptr_64++, shift); - buf_ptr_64++; - } - - /* If the number of samples per channel is odd */ - total_num_samples = samp; - } - /* if either of buf addr is not byte aligned as required for vectorization - * or for odd samples */ - else - { - int32_t *in_buf_ptr_32 = (int32_t *)input_buf_ptr->data_ptr; - buf_ptr_32 = (int32_t *)output_buf_ptr->data_ptr; - if (q_factor_out >= q_factor_in) - { - shift = q_factor_out - q_factor_in; - } - else - { - shift = q_factor_in - q_factor_out; - } - - - if (q_factor_out >= q_factor_in) - { - for (samp = 0; samp < total_num_samples; samp++) - { - int32_t temp32 = (int32_t)(*in_buf_ptr_32++); - temp32 = (temp32 < (int32_t)min_value) ? (int32_t)min_value : temp32; - temp32 = (temp32 > (int32_t)max_value) ? (int32_t)max_value : temp32; - (*buf_ptr_32++) = temp32 << shift; - } - } - else - { - for (samp = 0; samp < total_num_samples; samp++) - { - (*buf_ptr_32++) = (int32_t)((*in_buf_ptr_32++) >> shift); - } - } - } -#else // USE_Q6_SPECIFIC_CODE - /*----------- Non Q6 Version ---------------*/ - int32_t *in_buf_ptr_32 = (int32_t *)input_buf_ptr->data_ptr; - buf_ptr_32 = (int32_t *)output_buf_ptr->data_ptr; - if (q_factor_out >= q_factor_in) - { - shift = q_factor_out - q_factor_in; - } - else - { - shift = q_factor_in - q_factor_out; - } - - if (q_factor_out >= q_factor_in) - { - for (samp = 0; samp < total_num_samples; samp++) - { - int32_t temp32 = (int32_t)(*in_buf_ptr_32++); - temp32 = (temp32 < (int32_t)min_value) ? (int32_t)min_value : temp32; - temp32 = (temp32 > (int32_t)max_value) ? (int32_t)max_value : temp32; - (*buf_ptr_32++) = temp32 << shift; - } - } - else - { - for (samp = 0; samp < total_num_samples; samp++) - { - (*buf_ptr_32++) = (int32_t)((*in_buf_ptr_32++) >> shift); - } - } -#endif - } - else - { - return AR_EUNSUPPORTED; - } - - output_buf_ptr->actual_data_len = input_buf_ptr->actual_data_len * 4 / (word_size_in >> 3); - return AR_EOK; -} - -/*______________________________________________________________________________________________________________________ - DESCRIPTION: - -______________________________________________________________________________________________________________________*/ -static ar_result_t pc_deintlv_16_out_util_(capi_buf_t *input_buf_ptr, - capi_buf_t *output_buf_ptr, - uint16_t num_channels, - uint16_t word_size_in, - uint16_t q_factor_in, - bool_t updates_only_first_ch_len) -{ - ar_result_t result = AR_EOK; - int32_t samp, i; - int32_t *buf_ptr_32; - int16_t *buf_ptr_16; - uint32_t shift_factor = 0; -#ifdef USE_Q6_SPECIFIC_CODE - int64_t *buf_ptr_64; -#endif - uint32_t num_samp_per_ch = input_buf_ptr->actual_data_len / (word_size_in >> 3); - - if (32 == word_size_in) - { - int64_t dw_MAX = 0; - int64_t dw_MIN = 0; - int32_t max_value = 0; - int32_t min_value = 0; - - if (PCM_Q_FACTOR_23 == q_factor_in) - { - dw_MAX = ((int64_t)MAX_Q23 << 32) | (int64_t)MAX_Q23; - dw_MIN = ((int64_t)MIN_Q23 << 32) | (int64_t)MIN_Q23; - shift_factor = PCM_Q_FACTOR_23 - PCM_Q_FACTOR_15; // q23 - q15 - max_value = (int32_t)MAX_Q23; - min_value = (int32_t)MIN_Q23; - } - else if (PCM_Q_FACTOR_27 == q_factor_in) - { - dw_MAX = ((int64_t)MAX_Q27 << 32) | (int64_t)MAX_Q27; - dw_MIN = ((int64_t)MIN_Q27 << 32) | (int64_t)MIN_Q27; - shift_factor = BYTE_UPDOWN_CONV_SHIFT_FACT; // q27 - q15 - max_value = (int32_t)MAX_Q27; - min_value = (int32_t)MIN_Q27; - } - // q31 to q15 - else if (PCM_Q_FACTOR_31 == q_factor_in) - { - dw_MAX = ((int64_t)MAX_Q31 << 32) | (int64_t)MAX_Q31; - dw_MIN = ((int64_t)MIN_Q31 << 32) | (int64_t)MIN_Q31; - shift_factor = PCM_Q_FACTOR_31 - PCM_Q_FACTOR_15; // q31 - q15 - max_value = (int32_t)MAX_Q31; - min_value = (int32_t)MIN_Q31; - } - -#ifdef USE_Q6_SPECIFIC_CODE - - for (i = 0; i < num_channels; i++) - { - buf_ptr_64 = (int64_t *)(input_buf_ptr[i].data_ptr); /* Input buffer */ - buf_ptr_32 = (int32_t *)(output_buf_ptr[i].data_ptr); /* Output buffer */ - - /* Convert from (Q27 or Q31) to Q15 */ - - /* If input buf addr is 8 byte aligned and out buf addr is 4 byte aligned - then only perform the vector operation */ - if ((0 == ((uint32_t)buf_ptr_64 & 0x7)) && (0 == ((uint32_t)buf_ptr_32 & 0x3))) - { - for (samp = num_samp_per_ch; samp >= 2; samp -= 2) - { - int64_t temp64; - - /* Saturate to 27 or 31 bits based on input q format */ - temp64 = Q6_P_vminw_PP(*buf_ptr_64++, dw_MAX); - temp64 = Q6_P_vmaxw_PP(temp64, dw_MIN); - - /* Right shift each of the 32 bit words into 16 bits and - store the two lower halfwords into destination */ - *buf_ptr_32++ = Q6_R_vasrw_PR(temp64, shift_factor); - } - - /* If the number of samples are odd */ - if (samp) - { - int32_t temp32; - - int16_t *buf_ptr_src_16 = (int16_t *)buf_ptr_32; - int32_t *buf_ptr_src2_32 = (int32_t *)buf_ptr_64; - - /* Saturate to 27 or 31 bits based on the input q format */ - temp32 = Q6_R_max_RR(*buf_ptr_src2_32, (int32_t)min_value); - temp32 = Q6_R_min_RR(temp32, (int32_t)max_value); - - /* Q27->Q15 or Q31->Q15 with rounding */ - *buf_ptr_src_16 = Q6_R_asr_RR(temp32, shift_factor); - } - } - else /* if either of buf addr is not byte aligned as required for vectorization */ - { - int32_t temp32; - - int16_t *buf_ptr_src_16 = (int16_t *)buf_ptr_32; - int32_t *buf_ptr_src2_32 = (int32_t *)buf_ptr_64; - - if (PCM_Q_FACTOR_27 == q_factor_in) - { - for (samp = 0; samp < num_samp_per_ch; samp++) - { - /* Saturate to 27 bits */ - temp32 = Q6_R_max_RR(*buf_ptr_src2_32++, (int32_t)min_value); - temp32 = Q6_R_min_RR(temp32, (int32_t)max_value); - - /* Q27 to Q15 */ - *buf_ptr_src_16++ = Q6_R_asr_RR(temp32, shift_factor); - } - } - else if (PCM_Q_FACTOR_31 == q_factor_in) - { - for (samp = 0; samp < num_samp_per_ch; samp++) - { - /* Saturate to 31 bits */ - temp32 = Q6_R_max_RR(*buf_ptr_src2_32++, (int32_t)min_value); - temp32 = Q6_R_min_RR(temp32, (int32_t)max_value); - - /* Q31 to Q15 */ - *buf_ptr_src_16++ = Q6_R_asr_RR(temp32, shift_factor); - } - } - } - } -#else - /*----------- Non Q6 Version ---------------*/ - for (i = 0; i < num_channels; i++) - { - buf_ptr_32 = (int32_t *)(input_buf_ptr[i].data_ptr); /* Input buffer */ - buf_ptr_16 = (int16_t *)(output_buf_ptr[i].data_ptr); /* Output buffer */ - - /* Convert from Q27 (or Q31) to Q15 , inplace conversion */ - for (samp = 0; samp < num_samp_per_ch; samp++) - { - int32_t temp32 = *buf_ptr_32++; - - /* Saturate to 27 or 31 bits */ - temp32 = (temp32 < (int32_t)min_value) ? (int32_t)min_value : temp32; - temp32 = (temp32 > (int32_t)max_value) ? (int32_t)max_value : temp32; - - /*shift to Q15 */ - *buf_ptr_16++ = (int16_t)(temp32 >> shift_factor); - } - } -#endif /* __q6_specific_code__ */ - } - else if (24 == word_size_in) - { - shift_factor = 23 - 15; - - for (i = 0; i < num_channels; i++) - { - uint8_t *src_ptr = (uint8_t *)(input_buf_ptr[i].data_ptr); /* Input buffer */ - buf_ptr_16 = (int16_t *)(output_buf_ptr[i].data_ptr); /* Output buffer */ - - /* Convert from Q27 (or Q31) to Q15 , inplace conversion */ - for (samp = 0; samp < num_samp_per_ch; samp++) - { - int32_t num32; - uint32_t tem32; - - num32 = 0; - tem32 = *src_ptr++; - num32 = num32 | (tem32); - tem32 = *src_ptr++; - num32 = num32 | (tem32 << 8); - tem32 = *src_ptr++; - num32 = num32 | (tem32 << 16); - /*Right shift to Q15*/ - *buf_ptr_16++ = (int16_t)(num32 >> shift_factor); - } - } - } - else - { - // optimization: write/read only first ch lens, and assume same lens for rest of the chs - output_buf_ptr[0].actual_data_len = 0; - result = AR_EUNSUPPORTED; - goto bailout_; - } - - // optimization: write/read only first ch lens, and assume same lens for rest of the chs - output_buf_ptr[0].actual_data_len = num_samp_per_ch * 2; - -bailout_: - // update rest of the channels as well - if (FALSE == updates_only_first_ch_len) - { - for (uint32_t i = 1; i < num_channels; i++) - { - output_buf_ptr[i].actual_data_len = output_buf_ptr[0].actual_data_len; - } - } - - return result; -} - -/*______________________________________________________________________________________________________________________ - DESCRIPTION: - -______________________________________________________________________________________________________________________*/ -static ar_result_t pc_deintlv_24_out_util_(capi_buf_t *input_buf_ptr, - capi_buf_t *output_buf_ptr, - uint16_t num_channels, - uint16_t word_size_in, - uint16_t q_factor_in, - bool_t updates_only_first_ch_len) -{ - ar_result_t result = AR_EOK; - int32_t samp, i; - int32_t *buf_ptr_32; - int8_t * buf_ptr_8; - uint32_t shift; - uint32_t num_samp_per_ch = input_buf_ptr->actual_data_len / (word_size_in >> 3); - - if (16 == word_size_in) - { - /*----------- Non Q6 Version ---------------*/ - - /* Q16 -> Q23 conversion */ - uint8_t *src; - for (i = 0; i < num_channels; i++) - { - buf_ptr_8 = (output_buf_ptr[i].data_ptr); /* Input buffer */ - src = (uint8_t *)(input_buf_ptr[i].data_ptr); /* Output buffer */ - - for (samp = 0; samp < num_samp_per_ch; samp++) - { - *buf_ptr_8++ = 0x00; - *buf_ptr_8++ = *src++; - *buf_ptr_8++ = *src++; - } - } - } - else if (32 == word_size_in) - { - - shift = (q_factor_in - 23); // (Qn - Q23) - - int32_t num32 = 0; - uint8_t temp8 = 0; - uint8_t *dst; - /* Q27/31 -> Q23 conversion */ - for (i = 0; i < num_channels; i++) - { - buf_ptr_32 = (int32_t *)(input_buf_ptr[i].data_ptr); /* Input buffer */ - dst = (uint8_t *)(output_buf_ptr[i].data_ptr); /* Output buffer */ - - for (samp = 0; samp < num_samp_per_ch; samp++) - { - num32 = *buf_ptr_32++ >> shift; - temp8 = (uint8_t)num32; - *dst++ = temp8; - - num32 = num32 >> 8; - temp8 = (uint8_t)num32; - *dst++ = temp8; - - num32 = num32 >> 8; - temp8 = (uint8_t)num32; - *dst++ = temp8; - } - } - } - else - { - // optimization: write/read only first ch lens, and assume same lens for rest of the chs - output_buf_ptr[0].actual_data_len = 0; - result = AR_EUNSUPPORTED; - goto bailout_; - } - // optimization: write/read only first ch lens, and assume same lens for rest of the chs - output_buf_ptr[0].actual_data_len = num_samp_per_ch * 3; - -bailout_: - // update rest of the channels as well - if (FALSE == updates_only_first_ch_len) - { - for (uint32_t i = 1; i < num_channels; i++) - { - output_buf_ptr[i].actual_data_len = output_buf_ptr[0].actual_data_len; - } - } - - return result; -} - -/*______________________________________________________________________________________________________________________ - DESCRIPTION: - -______________________________________________________________________________________________________________________*/ -static ar_result_t pc_deintlv_32_out_util_(capi_buf_t *input_buf_ptr, - capi_buf_t *output_buf_ptr, - uint16_t num_channels, - uint16_t word_size_in, - uint16_t q_factor_in, - uint16_t q_factor_out, - bool_t updates_only_first_ch_len) -{ - ar_result_t result = AR_EOK; - int32_t samp, i; - int32_t *buf_ptr_32; - uint8_t *buf_ptr_8; - uint32_t shift_factor = 0; - uint32_t num_samp_per_ch = input_buf_ptr->actual_data_len / (word_size_in >> 3); - uint32_t min_value = 0; - uint32_t max_value = 0; - if (PCM_Q_FACTOR_23 == q_factor_in) - { - min_value = MIN_Q23; - max_value = MAX_Q23; - } - else if (PCM_Q_FACTOR_27 == q_factor_in) - { - min_value = MIN_Q27; - max_value = MAX_Q27; - } - else // when q_factor_in is other than 23 and 27 - { - min_value = (-(1 << q_factor_in)); - max_value = ((1 << q_factor_in) - 1); - } - - if (16 == word_size_in) - { - shift_factor = q_factor_out - q_factor_in; -#ifdef USE_Q6_SPECIFIC_CODE - for (i = 0; i < num_channels; i++) - { - int32_t *buf_ptr_32 = (int32_t *)(input_buf_ptr[i].data_ptr); /* Input buffer */ - int64_t *buf_ptr_64 = (int64_t *)(output_buf_ptr[i].data_ptr); /* Output buffer */ - - - /* Convert from Q15 to Q28, conversion output in scratch buffer */ - - /* If Output buf addr is 8 byte aligned and input buf addr is 4 byte aligned - then only perform the vector operation */ - if ((0 == ((uint32_t)buf_ptr_64 & 0x7)) && (0 == ((uint32_t)buf_ptr_32 & 0x3))) - { - for (samp = num_samp_per_ch; samp >= 2; samp -= 2) - { - - /* Sign extend two 16-bit words in to two 32-bit words */ - *buf_ptr_64 = Q6_P_vsxthw_R(*buf_ptr_32++); - - - /* Shift left the result to convert it to Q27 or Q31 */ - *buf_ptr_64 = Q6_P_vaslw_PR(*buf_ptr_64, shift_factor); - buf_ptr_64++; - } - - /* If the number of samples per channel is odd */ - if (samp) - { - int16_t *buf_ptr_src_16 = (int16_t *)buf_ptr_32; - int32_t *buf_ptr_src2_32 = (int32_t *)buf_ptr_64; - *buf_ptr_src2_32 = (int32_t)(*buf_ptr_src_16 << shift_factor); - } - } - else /* if either of buf addr is not byte aligned as required for vectorization */ - { - int16_t *buf_ptr_src_16 = (int16_t *)buf_ptr_32; - int32_t *buf_ptr_src2_32 = (int32_t *)buf_ptr_64; - - /* Q15 -> Q27(Q31) conversion */ - for (samp = 0; samp < num_samp_per_ch; samp++) - { - (*buf_ptr_src2_32++) = (int32_t)((*buf_ptr_src_16++) << shift_factor); - } - } - } -#else - /*----------- Non Q6 Version ---------------*/ - for (i = 0; i < num_channels; i++) - { - int16_t *buf_ptr_16 = (int16_t *)(input_buf_ptr[i].data_ptr); /* Input buffer */ - buf_ptr_32 = (int32_t *)(output_buf_ptr[i].data_ptr); /* Output buffer */ - - /* Convert from Q15 to Q27(or Q31), conversion output in scratch buffer */ - for (samp = 0; samp < num_samp_per_ch; samp++) - { - *buf_ptr_32++ = ((int32_t)(*buf_ptr_16++)) << shift_factor; - } - } -#endif /* __qdsp6__ */ - } - else if (24 == word_size_in) - { - shift_factor = (31 - q_factor_out); - -#ifdef USE_Q6_SPECIFIC_CODE - for (i = 0; i < num_channels; i++) - { - buf_ptr_8 = (uint8_t *)(input_buf_ptr[i].data_ptr); /* Input buffer */ - buf_ptr_32 = (int32_t *)(output_buf_ptr[i].data_ptr); /* Output buffer */ - - int32_t num32 = 0; - int32_t tem32 = 0, tem32_1 = 0, tem32_2 = 0; - - /* Q23 -> Q27 conversion */ - for (samp = 0; samp < num_samp_per_ch; samp++) - { - num32 = 0; - tem32 = buf_ptr_8[0]; // load the 1st byte of a sample - tem32_1 = buf_ptr_8[1]; // load the 2nd byte of a sample - tem32_2 = buf_ptr_8[2]; // load the 3rd byte of a sample - - tem32 = Q6_R_aslor_RI(tem32, - tem32_1, - 8); // left shift 2nd byte by 8 and or with first byte -- later left shift total by 8 - num32 = Q6_R_aslor_RI(num32, tem32_2, 24); // left shift 3rd byte by 24 - buf_ptr_8 += 3; // increment the input buf ptr - - num32 = - Q6_R_aslor_RI(num32, tem32, 8); // effective shifts will be (1st - 8, 2nd - 16, 3rd - 24) for each byte - (*buf_ptr_32++) = (int32_t)((num32) >> (shift_factor)); - } - } -#else - for (i = 0; i < num_channels; i++) - { - buf_ptr_8 = (uint8_t *)(input_buf_ptr[i].data_ptr); /* Input buffer */ - buf_ptr_32 = (int32_t *)(output_buf_ptr[i].data_ptr); /* Output buffer */ - - /* Q23 -> Q27 conversion */ - for (samp = 0; samp < num_samp_per_ch; samp++) - { - int32_t num32; - uint32_t tem32; - num32 = 0; - - tem32 = *buf_ptr_8++; - num32 = num32 | (tem32 << 8); - tem32 = *buf_ptr_8++; - num32 = num32 | (tem32 << 16); - tem32 = *buf_ptr_8++; - num32 = num32 | (tem32 << 24); - - (*buf_ptr_32++) = (int32_t)((num32) >> (shift_factor)); - } - } -#endif - } - else - { - shift_factor = (q_factor_out - q_factor_in); // (Q31/27 - Qn) - - if (q_factor_out >= q_factor_in) - { - shift_factor = q_factor_out - q_factor_in; - } - else - { - shift_factor = q_factor_in - q_factor_out; - } - for (i = 0; i < num_channels; i++) - { - int32_t *in_buf_ptr_32 = (int32_t *)(input_buf_ptr[i].data_ptr); - buf_ptr_32 = (int32_t *)(output_buf_ptr[i].data_ptr); - - if (q_factor_out >= q_factor_in) - { - for (samp = 0; samp < num_samp_per_ch; samp++) - { - int32_t temp32 = (int32_t)(*in_buf_ptr_32++); - temp32 = (temp32 < (int32_t)min_value) ? (int32_t)min_value : temp32; - temp32 = (temp32 > (int32_t)max_value) ? (int32_t)max_value : temp32; - (*buf_ptr_32++) = temp32 << shift_factor; - } - } - else - { - for (samp = 0; samp < num_samp_per_ch; samp++) - { - (*buf_ptr_32++) = (int32_t)((*in_buf_ptr_32++) >> shift_factor); - } - } - } - } - - - // optimization: write/read only first ch lens, and assume same lens for rest of the chs - output_buf_ptr[0].actual_data_len = num_samp_per_ch * 4; - - // update rest of the channels as well - if (FALSE == updates_only_first_ch_len) - { - for (uint32_t i = 1; i < num_channels; i++) - { - output_buf_ptr[i].actual_data_len = output_buf_ptr[0].actual_data_len; - } - } - - - return result; -} - -ar_result_t pc_deintlv_16_out(capi_buf_t *input_buf_ptr, - capi_buf_t *output_buf_ptr, - uint16_t num_channels, - uint16_t word_size_in, - uint16_t q_factor_in) -{ - return pc_deintlv_16_out_util_(input_buf_ptr, output_buf_ptr, num_channels, word_size_in, q_factor_in, FALSE); -} - -ar_result_t pc_deintlv_24_out(capi_buf_t *input_buf_ptr, - capi_buf_t *output_buf_ptr, - uint16_t num_channels, - uint16_t word_size_in, - uint16_t q_factor_in) -{ - return pc_deintlv_24_out_util_(input_buf_ptr, output_buf_ptr, num_channels, word_size_in, q_factor_in, FALSE); -} - -ar_result_t pc_deintlv_32_out(capi_buf_t *input_buf_ptr, - capi_buf_t *output_buf_ptr, - uint16_t num_channels, - uint16_t word_size_in, - uint16_t q_factor_in, - uint16_t q_factor_out) -{ - return pc_deintlv_32_out_util_(input_buf_ptr, - output_buf_ptr, - num_channels, - word_size_in, - q_factor_in, - q_factor_out, - FALSE); -} - -ar_result_t pc_deintlv_unpacked_v2_16_out(capi_buf_t *input_buf_ptr, - capi_buf_t *output_buf_ptr, - uint16_t num_channels, - uint16_t word_size_in, - uint16_t q_factor_in) -{ - return pc_deintlv_16_out_util_(input_buf_ptr, output_buf_ptr, num_channels, word_size_in, q_factor_in, TRUE); -} - -ar_result_t pc_deintlv_unpacked_v2_24_out(capi_buf_t *input_buf_ptr, - capi_buf_t *output_buf_ptr, - uint16_t num_channels, - uint16_t word_size_in, - uint16_t q_factor_in) -{ - return pc_deintlv_24_out_util_(input_buf_ptr, output_buf_ptr, num_channels, word_size_in, q_factor_in, TRUE); -} - -ar_result_t pc_deintlv_unpacked_v2_32_out(capi_buf_t *input_buf_ptr, - capi_buf_t *output_buf_ptr, - uint16_t num_channels, - uint16_t word_size_in, - uint16_t q_factor_in, - uint16_t q_factor_out) -{ - return pc_deintlv_32_out_util_(input_buf_ptr, - output_buf_ptr, - num_channels, - word_size_in, - q_factor_in, - q_factor_out, - TRUE); -} diff --git a/modules/cmn/pcm_mf_cnv/lib/src/pc_float/pc_float.cpp b/modules/cmn/pcm_mf_cnv/lib/src/pc_float/pc_float.cpp deleted file mode 100644 index d49cc45d..00000000 --- a/modules/cmn/pcm_mf_cnv/lib/src/pc_float/pc_float.cpp +++ /dev/null @@ -1,278 +0,0 @@ -/*======================================================================== - - file pc_float.cpp -This file contains functions for data format conversions. - -Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. -SPDX-License-Identifier: BSD-3-Clause-Clear -======================================================================*/ - -/* ======================================================================= -INCLUDE FILES FOR MODULE -========================================================================== */ - -#include "pc_converter.h" - -/*______________________________________________________________________________________________________________________ - DESCRIPTION: -Convert floating point input data to 32 bit (Q31) fixed point data, conversion to other bit widths is subsequently taken -care by byte morph process. -______________________________________________________________________________________________________________________*/ - -ar_result_t pc_float_to_fixed_conv_process(void * me_ptr, - capi_buf_t * input_buf_ptr, - capi_buf_t * output_buf_ptr, - pc_media_fmt_t *input_media_fmt_ptr, - pc_media_fmt_t *output_media_fmt_ptr) -{ - ar_result_t result = AR_EOK; - uint16_t bit_width_in = input_media_fmt_ptr->bit_width; - uint16_t word_size_in = input_media_fmt_ptr->word_size; - uint16_t word_size_out = output_media_fmt_ptr->word_size; - uint32_t samp = 0; - - // num_samples_in represents total samples for interleaved data, and samples per ch for deint data - uint32_t num_samples_in = - input_buf_ptr->actual_data_len / (word_size_in >> 3); // Calculate number of samples of input data - -#ifdef PCM_CNV_LIB_DEBUG - pc_lib_t *pc_ptr = (pc_lib_t *)me_ptr; - CNV_MSG(pc_ptr->miid, - DBG_HIGH_PRIO, - "Float to fixed: Word_size_in %d num_samples_in %d word_size_out %d, interleaving " - "%d", - word_size_in, - num_samples_in, - word_size_out, - input_media_fmt_ptr->interleaving); -#endif - - const uint32_t iq31 = (1 << PCM_Q_FACTOR_31); - const uint64_t iq31_1 = (1ll << PCM_Q_FACTOR_31); - - if (BIT_WIDTH_32 == bit_width_in) - { - int32_t num32 = 0; - float32_t * buf_ptr_32 = NULL; // Type cast input buffer to float data format - int32_t * dst_ptr_32 = NULL; - const float32_t fq31 = (float32_t)(iq31); - - if (PC_INTERLEAVED == input_media_fmt_ptr->interleaving) - { - buf_ptr_32 = (float32_t *)(input_buf_ptr->data_ptr); /* Input buffer */ - dst_ptr_32 = (int32_t *)(output_buf_ptr->data_ptr); /* Output buffer */ - - for (samp = 0; samp < num_samples_in; samp++) - { - // Operate on each input sample and converting to fixed point Q31 format - num32 = (int32_t)(*buf_ptr_32++ * fq31); - // Write converted sample to output buffer - *dst_ptr_32++ = num32; - } - output_buf_ptr->actual_data_len = num_samples_in * (word_size_out >> 3); - } - else - { - for (uint32_t i = 0; i < input_media_fmt_ptr->num_channels; i++) - { - buf_ptr_32 = (float32_t *)(input_buf_ptr[i].data_ptr); /* Input buffer */ - dst_ptr_32 = (int32_t *)(output_buf_ptr[i].data_ptr); /* Output buffer */ - - for (samp = 0; samp < num_samples_in; samp++) - { - // Operate on each input sample and converting to fixed point Q31 format - num32 = (int32_t)(*buf_ptr_32++ * fq31); - // Write converted sample to output buffer - *dst_ptr_32++ = num32; - } - } - - // optimization: write/read only first ch lens, and assume same lens for rest of the chs in the PC library. - output_buf_ptr[0].actual_data_len = num_samples_in * (word_size_out >> 3); - } - } - else if (BIT_WIDTH_64 == bit_width_in) - { - int32_t num32 = 0; - float64_t * buf_ptr_64 = NULL; - int32_t * dst_ptr_32 = NULL; - const float64_t dq31 = (float64_t)(iq31_1); - - if (PC_INTERLEAVED == input_media_fmt_ptr->interleaving) - { - buf_ptr_64 = (float64_t *)(input_buf_ptr->data_ptr); /* Input buffer */ - dst_ptr_32 = (int32_t *)(output_buf_ptr->data_ptr); /* Output buffer */ - - for (samp = 0; samp < num_samples_in; samp++) - { - // Operate on each input sample and converting to fixed point Q31 format - num32 = (int32_t)(*buf_ptr_64++ * dq31); - // Write converted sample to output buffer - *dst_ptr_32++ = num32; - } - output_buf_ptr->actual_data_len = num_samples_in * (word_size_out >> 3); - } - else - { - for (uint32_t i = 0; i < input_media_fmt_ptr->num_channels; i++) - { - buf_ptr_64 = (float64_t *)(input_buf_ptr[i].data_ptr); /* Input buffer */ - dst_ptr_32 = (int32_t *)(output_buf_ptr[i].data_ptr); /* Output buffer */ - - for (samp = 0; samp < num_samples_in; samp++) - { - // Operate on each input sample and converting to fixed point Q31 format - num32 = (int32_t)(*buf_ptr_64++ * dq31); - // Write converted sample to output buffer - *dst_ptr_32++ = num32; - } - } - // optimization: write/read only first ch lens, and assume same lens for rest of the chs in the PC library. - output_buf_ptr[0].actual_data_len = num_samples_in * (word_size_out >> 3); - } - } - else - { - result = AR_EUNSUPPORTED; - return result; - } - - return result; -} - -/*______________________________________________________________________________________________________________________ - DESCRIPTION: -Convert 32 bit (Q31) Fixed point input data to Floating point, conversion from any other bit width to 32 bit fixed point -data is done by byte morph process before this function is called. -______________________________________________________________________________________________________________________*/ - -ar_result_t pc_fixed_to_float_conv_process(void * me_ptr, - capi_buf_t * input_buf_ptr, - capi_buf_t * output_buf_ptr, - pc_media_fmt_t *input_media_fmt_ptr, - pc_media_fmt_t *output_media_fmt_ptr) -{ - ar_result_t result = AR_EOK; - - uint16_t word_size_in = input_media_fmt_ptr->word_size; - uint16_t word_size_out = output_media_fmt_ptr->word_size; - uint16_t bit_width_out = output_media_fmt_ptr->bit_width; - uint32_t samp = 0; - int32_t *buf_ptr_32 = NULL; - - // num_samples_in represents total samples for interleaved data, and samples per ch for deint data - uint32_t num_samples_in = input_buf_ptr->actual_data_len / (word_size_in >> 3); - -#ifdef PCM_CNV_LIB_DEBUG - pc_lib_t *pc_ptr = (pc_lib_t *)me_ptr; - CNV_MSG(pc_ptr->miid, - DBG_HIGH_PRIO, - "Fixed to float: Word_size_in %d num_samples_in %d word_size_out %d, interleaving " - "%d", - word_size_in, - num_samples_in, - word_size_out, - input_media_fmt_ptr->interleaving); -#endif - - const uint32_t iq31 = (1 << PCM_Q_FACTOR_31); - const uint64_t iq31_1 = (1ll << PCM_Q_FACTOR_31); - - if (BIT_WIDTH_32 == bit_width_out) - { - float32_t num32 = 0; - float32_t * dst_ptr_32 = NULL; - const float32_t fq31 = (float32_t)(iq31); - - if (PC_INTERLEAVED == input_media_fmt_ptr->interleaving) - { - buf_ptr_32 = (int32_t *)(input_buf_ptr->data_ptr); /* Input buffer */ - dst_ptr_32 = (float32_t *)(output_buf_ptr->data_ptr); /* Output buffer */ - - for (samp = 0; samp < num_samples_in; samp++) - { - // Convert fixed point input sample of data to floating point - num32 = ((float32_t)*buf_ptr_32++) / fq31; - // Writing to output buffer - *dst_ptr_32++ = num32; - } - output_buf_ptr->actual_data_len = num_samples_in * (word_size_out >> 3); - } - else - { - for (uint32_t i = 0; i < input_media_fmt_ptr->num_channels; i++) - { - buf_ptr_32 = (int32_t *)(input_buf_ptr[i].data_ptr); /* Input buffer */ - dst_ptr_32 = (float32_t *)(output_buf_ptr[i].data_ptr); /* Output buffer */ - - for (samp = 0; samp < num_samples_in; samp++) - { - // Convert fixed point input sample of data to floating point - num32 = ((float32_t)*buf_ptr_32++) / fq31; - // Writing to output buffer - *dst_ptr_32++ = num32; - } - } - - // optimization: write/read only first ch lens, and assume same lens for rest of the chs in the PC library. - output_buf_ptr[0].actual_data_len = num_samples_in * (word_size_out >> 3); - } - } - else if (BIT_WIDTH_64 == bit_width_out) - { - float64_t num64 = 0; - float64_t * dst_ptr_64 = NULL; - const float64_t dq31 = (float64_t)(iq31_1); - - if (PC_INTERLEAVED == input_media_fmt_ptr->interleaving) - { - buf_ptr_32 = (int32_t *)(input_buf_ptr->data_ptr); /* Input buffer */ - dst_ptr_64 = (float64_t *)(output_buf_ptr->data_ptr); /* Output buffer */ - - for (samp = 0; samp < num_samples_in; samp++) - { - // Convert fixed point input sample of data to floating point - num64 = ((float64_t)*buf_ptr_32++) / dq31; - // Writing to output buffer - *dst_ptr_64++ = num64; - } - output_buf_ptr->actual_data_len = num_samples_in * (word_size_out >> 3); - } - else - { - for (uint32_t i = 0; i < input_media_fmt_ptr->num_channels; i++) - { - buf_ptr_32 = (int32_t *)(input_buf_ptr[i].data_ptr); /* Input buffer */ - dst_ptr_64 = (float64_t *)(output_buf_ptr[i].data_ptr); /* Output buffer */ - - for (samp = 0; samp < num_samples_in; samp++) - { - // Convert fixed point input sample of data to floating point - num64 = ((float64_t)*buf_ptr_32++) / dq31; - // Writing to output buffer - *dst_ptr_64++ = num64; - } - } - - // optimization: write/read only first ch lens, and assume same lens for rest of the chs in the PC library. - output_buf_ptr[0].actual_data_len = num_samples_in * (word_size_out >> 3); - } - } - else - { - result = AR_EUNSUPPORTED; - return result; - } - - return result; -} - -/*______________________________________________________________________________________________________________________ - DESCRIPTION: -Function to check if floating point data format is supported by platform -______________________________________________________________________________________________________________________*/ - -bool_t pc_is_floating_point_data_format_supported() -{ - return TRUE; -} diff --git a/modules/cmn/pcm_mf_cnv/lib/src/pc_process.cpp b/modules/cmn/pcm_mf_cnv/lib/src/pc_process.cpp deleted file mode 100644 index 664d23fe..00000000 --- a/modules/cmn/pcm_mf_cnv/lib/src/pc_process.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/*______________________________________________________________________________________________________________________ - - file pc_process.cpp -This file contains functions for compression-decompression container - -Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. -SPDX-License-Identifier: BSD-3-Clause-Clear -______________________________________________________________________________________________________________________*/ - -/*______________________________________________________________________________________________________________________ -INCLUDE FILES FOR MODULE -______________________________________________________________________________________________________________________*/ - -#include "pc_converter.h" - -/*______________________________________________________________________________________________________________________ - DESCRIPTION: - -______________________________________________________________________________________________________________________*/ -ar_result_t pc_endianness_process(void *me_ptr, - capi_buf_t *input_buf_ptr, - capi_buf_t *output_buf_ptr, - pc_media_fmt_t *input_media_fmt_ptr, - pc_media_fmt_t *output_media_fmt_ptr) -{ - ar_result_t result = AR_EOK; - // No need to check for the same endianness, since it is done in the init phase - if (PC_INTERLEAVED != input_media_fmt_ptr->interleaving) - { - - - uint32_t num_bytes_to_process = input_buf_ptr[0].actual_data_len; - uint32_t num_bytes_processed = 0; - for (uint16_t ch = 0; ch < input_media_fmt_ptr->num_channels; ch++) - { - // Buffer length remains the same since we use the same buffer - pc_change_endianness(input_buf_ptr[ch].data_ptr, - output_buf_ptr[ch].data_ptr, - num_bytes_to_process, - &num_bytes_processed, - input_media_fmt_ptr->word_size); - } - output_buf_ptr[0].actual_data_len = num_bytes_processed; - } - else - { - // Buffer length remains the same since we use the same buffer - pc_change_endianness(input_buf_ptr->data_ptr, - output_buf_ptr->data_ptr, - input_buf_ptr->actual_data_len, - &output_buf_ptr->actual_data_len, - input_media_fmt_ptr->word_size); - } - - return result; -} - - -/*______________________________________________________________________________________________________________________ - DESCRIPTION: - -______________________________________________________________________________________________________________________*/ -ar_result_t pc_dyn_resampler_process(void *_pif, - capi_buf_t *input_buf_ptr, - capi_buf_t *output_buf_ptr, - pc_media_fmt_t *input_media_fmt_ptr, - pc_media_fmt_t *output_media_fmt_ptr) -{ - - ar_result_t result = AR_EOK; - pc_lib_t *me_ptr = (pc_lib_t *)_pif; - uint32_t heap_id = me_ptr->heap_id; - - // TODO: Currently resampler doesnt support unpacked V2, need changes in multiple places in dyn resampler module, - // mp2_dec, resampler library, hwrs driver. - for (uint32_t i = 1; i < input_media_fmt_ptr->num_channels; i++) - { - input_buf_ptr[i].actual_data_len = input_buf_ptr[0].actual_data_len; - input_buf_ptr[i].max_data_len = input_buf_ptr[0].max_data_len; - } - - for (uint32_t i = 1; i < output_media_fmt_ptr->num_channels; i++) - { - output_buf_ptr[i].actual_data_len = output_buf_ptr[0].actual_data_len; - output_buf_ptr[i].max_data_len = output_buf_ptr[0].max_data_len; - } - - result = hwsw_rs_lib_process(me_ptr->hwsw_rs_lib_ptr, - input_buf_ptr, - output_buf_ptr, - input_media_fmt_ptr->num_channels, - output_media_fmt_ptr->num_channels, - heap_id); - return result; -} - -/*______________________________________________________________________________________________________________________ - DESCRIPTION: - -______________________________________________________________________________________________________________________*/ - diff --git a/modules/cmn/pcm_mf_cnv/lib/src/pc_process_island.cpp b/modules/cmn/pcm_mf_cnv/lib/src/pc_process_island.cpp deleted file mode 100644 index a826fd11..00000000 --- a/modules/cmn/pcm_mf_cnv/lib/src/pc_process_island.cpp +++ /dev/null @@ -1,697 +0,0 @@ -/*______________________________________________________________________________________________________________________ - -file pc_process.cpp -This file contains functions for compression-decompression container - -Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. -SPDX-License-Identifier: BSD-3-Clause-Clear -______________________________________________________________________________________________________________________*/ - -/*______________________________________________________________________________________________________________________ -INCLUDE FILES FOR MODULE -______________________________________________________________________________________________________________________*/ - -#include "pc_converter.h" - -/*______________________________________________________________________________________________________________________ - DESCRIPTION: - Re-mapps the main buffer data pointer to the remap-buffer by using proper media fmt - Also, calculated the proper length and separation while remapping output buffer if there is any byte-scale involved -______________________________________________________________________________________________________________________*/ -void pc_remap_from_main_buf(capi_buf_t * main_buf_ptr, - capi_buf_t * remapped_buf_ptr, - capi_buf_t * remapped_input_ref_buf_ptr, - pc_media_fmt_t *media_fmt_ptr, - pc_media_fmt_t *ref_input_media_fmt_ptr, - bool_t is_input_side, - bool_t is_in_or_out_buf) -{ - uint32_t ch_spacing = 0; - uint32_t alignement_offset = 0; - - if (PC_INTERLEAVED == media_fmt_ptr->interleaving) - { - remapped_buf_ptr->data_ptr = main_buf_ptr->data_ptr; - remapped_buf_ptr->actual_data_len = main_buf_ptr->actual_data_len; - remapped_buf_ptr->max_data_len = main_buf_ptr->max_data_len; - } - else if (PC_DEINTERLEAVED_PACKED == media_fmt_ptr->interleaving) - { - if (is_input_side) - { - ch_spacing = main_buf_ptr->actual_data_len / media_fmt_ptr->num_channels; - } - else - { - if (PC_INTERLEAVED == ref_input_media_fmt_ptr->interleaving) - { - ch_spacing = (remapped_input_ref_buf_ptr->actual_data_len * (media_fmt_ptr->word_size >> 3) * - (media_fmt_ptr->num_channels)) / - ((ref_input_media_fmt_ptr->word_size >> 3) * (ref_input_media_fmt_ptr->num_channels)); - } - else - { - ch_spacing = remapped_input_ref_buf_ptr->actual_data_len * (media_fmt_ptr->word_size >> 3) / - (ref_input_media_fmt_ptr->word_size >> 3); - } - } - alignement_offset = ch_spacing % 4; - ch_spacing = ch_spacing - alignement_offset; - - for (uint32_t ch = 0; ch < media_fmt_ptr->num_channels; ch++) - { - remapped_buf_ptr[ch].data_ptr = main_buf_ptr->data_ptr + (ch_spacing * ch); - } - remapped_buf_ptr[0].actual_data_len = is_input_side ? ch_spacing : 0; - remapped_buf_ptr[0].max_data_len = ch_spacing; - } - else if (PC_DEINTERLEAVED_UNPACKED_V2 == media_fmt_ptr->interleaving) - { - if (is_in_or_out_buf) - { - for (uint32_t ch = 0; ch < media_fmt_ptr->num_channels; ch++) - { - remapped_buf_ptr[ch].data_ptr = main_buf_ptr[ch].data_ptr; - } - remapped_buf_ptr[0].actual_data_len = main_buf_ptr[0].actual_data_len; - remapped_buf_ptr[0].max_data_len = main_buf_ptr[0].max_data_len; - } - else - { - ch_spacing = is_input_side ? main_buf_ptr->actual_data_len / media_fmt_ptr->num_channels - : main_buf_ptr->max_data_len / media_fmt_ptr->num_channels; - - alignement_offset = ch_spacing % 4; - ch_spacing = ch_spacing - alignement_offset; - for (uint32_t ch = 0; ch < media_fmt_ptr->num_channels; ch++) - { - remapped_buf_ptr[ch].data_ptr = main_buf_ptr->data_ptr + (ch_spacing * ch); - } - remapped_buf_ptr[0].actual_data_len = is_input_side ? ch_spacing : 0; - remapped_buf_ptr[0].max_data_len = ch_spacing; - } - } -} -/*______________________________________________________________________________________________________________________ - DESCRIPTION: - 1. Finds out which actual buffer (process input, scratch buffer 1, scratch buffer 2 or output) - to use to remap from the remapped buffer pointer - 2. Similarly updated needed media fmt and a flag to indicate if the main buffer is from framework or if it scratch -______________________________________________________________________________________________________________________*/ -void pc_remap_buffer(pc_lib_t * pc_ptr, - capi_buf_t * input_buf_ptr, - capi_buf_t * output_buf_ptr, - capi_buf_t * scratch_buf_ptr_1, - capi_buf_t * scratch_buf_ptr_2, - capi_buf_t * remapped_ib_ptr, - capi_buf_t * remapped_ob_ptr, - pc_media_fmt_t *input_media_fmt_ptr, - pc_media_fmt_t *output_media_fmt_ptr, - bool_t is_input) -{ - capi_buf_t * main_buf_ptr = NULL; - bool_t is_in_out_buf = FALSE; - capi_buf_t * remapped_buf_ptr = NULL; - pc_media_fmt_t *media_fmt_ptr = NULL; - if (is_input) - { - remapped_buf_ptr = remapped_ib_ptr; - media_fmt_ptr = input_media_fmt_ptr; - } - else - { - remapped_buf_ptr = remapped_ob_ptr; - media_fmt_ptr = output_media_fmt_ptr; - } - - if (pc_ptr->core_lib.remap_input_buf_ptr == remapped_buf_ptr) - { - is_in_out_buf = TRUE; - main_buf_ptr = input_buf_ptr; - } - else if (pc_ptr->core_lib.remap_scratch_buf1_ptr == remapped_buf_ptr) - { - main_buf_ptr = scratch_buf_ptr_1; - } - else if (pc_ptr->core_lib.remap_scratch_buf2_ptr == remapped_buf_ptr) - { - main_buf_ptr = scratch_buf_ptr_2; - } - else if (pc_ptr->core_lib.remap_output_buf_ptr == remapped_buf_ptr) - { - is_in_out_buf = TRUE; - main_buf_ptr = output_buf_ptr; - } - else - { - CNV_MSG(pc_ptr->miid, DBG_ERROR_PRIO, "WARNING! BUFFER NOT MATCHED"); - return; - } - - pc_remap_from_main_buf(main_buf_ptr, - remapped_buf_ptr, - remapped_ib_ptr, - media_fmt_ptr, - input_media_fmt_ptr, - is_input, - is_in_out_buf); -} - -/*______________________________________________________________________________________________________________________ - DESCRIPTION: - -______________________________________________________________________________________________________________________*/ -ar_result_t pc_interleaving_process(void *me_ptr, - capi_buf_t *input_buf_ptr, - capi_buf_t *output_buf_ptr, - pc_media_fmt_t *input_media_fmt_ptr, - pc_media_fmt_t *output_media_fmt_ptr) -{ - ar_result_t result = AR_EOK; - - if (PC_INTERLEAVED == input_media_fmt_ptr->interleaving) - { - uint32_t num_samp_per_ch = - input_buf_ptr->actual_data_len / (input_media_fmt_ptr->num_channels * input_media_fmt_ptr->word_size >> 3); - uint32_t bytes_per_samp = input_media_fmt_ptr->word_size >> 3; - - result = spf_intlv_to_deintlv_unpacked_v2(input_buf_ptr, - output_buf_ptr, - input_media_fmt_ptr->num_channels, - bytes_per_samp, - num_samp_per_ch); - } - else - { - result = spf_deintlv_to_intlv(input_buf_ptr, - output_buf_ptr, - input_media_fmt_ptr->num_channels, - input_media_fmt_ptr->word_size); - } - - return result; -} - -/*______________________________________________________________________________________________________________________ - DESCRIPTION: - -______________________________________________________________________________________________________________________*/ -ar_result_t pc_byte_morph_process(void * me_ptr, - capi_buf_t * input_buf_ptr, - capi_buf_t * output_buf_ptr, - pc_media_fmt_t *input_media_fmt_ptr, - pc_media_fmt_t *output_media_fmt_ptr) -{ - ar_result_t result = AR_EOK; - pc_lib_t * pc_ptr = (pc_lib_t *)me_ptr; - if (PC_INTERLEAVED == input_media_fmt_ptr->interleaving) - { - if (PC_BW16_W16_Q15 == output_media_fmt_ptr->byte_combo) - { - result = pc_intlv_16_out(input_buf_ptr, - output_buf_ptr, - input_media_fmt_ptr->word_size, - input_media_fmt_ptr->q_factor); - } - else if (PC_BW24_W24_Q23 == output_media_fmt_ptr->byte_combo) - { - result = pc_intlv_24_out(input_buf_ptr, - output_buf_ptr, - input_media_fmt_ptr->word_size, - input_media_fmt_ptr->q_factor); - } - else if ((PC_BW24_W32_Q23 == output_media_fmt_ptr->byte_combo) || - (PC_BW24_W32_Q27 == output_media_fmt_ptr->byte_combo) || - (PC_BW24_W32_Q31 == output_media_fmt_ptr->byte_combo) || - (PC_BW32_W32_Q31 == output_media_fmt_ptr->byte_combo) || - (PC_BW32_W32_FLOAT == output_media_fmt_ptr->byte_combo) || - (PC_BW64_W64_DOUBLE == output_media_fmt_ptr->byte_combo)) - { - result = pc_intlv_32_out(input_buf_ptr, - output_buf_ptr, - input_media_fmt_ptr->word_size, - input_media_fmt_ptr->q_factor, - output_media_fmt_ptr->q_factor); - } - else - { - CNV_MSG(pc_ptr->miid, DBG_ERROR_PRIO, "Unsupported byte combo "); - } - } - else - { - if (PC_BW16_W16_Q15 == output_media_fmt_ptr->byte_combo) - { - result = pc_deintlv_unpacked_v2_16_out(input_buf_ptr, - output_buf_ptr, - input_media_fmt_ptr->num_channels, - input_media_fmt_ptr->word_size, - input_media_fmt_ptr->q_factor); - } - else if (PC_BW24_W24_Q23 == output_media_fmt_ptr->byte_combo) - { - result = pc_deintlv_unpacked_v2_24_out(input_buf_ptr, - output_buf_ptr, - input_media_fmt_ptr->num_channels, - input_media_fmt_ptr->word_size, - input_media_fmt_ptr->q_factor); - } - else if ((PC_BW24_W32_Q23 == output_media_fmt_ptr->byte_combo) || - (PC_BW24_W32_Q27 == output_media_fmt_ptr->byte_combo) || - (PC_BW24_W32_Q31 == output_media_fmt_ptr->byte_combo) || - (PC_BW32_W32_Q31 == output_media_fmt_ptr->byte_combo) || - (PC_BW32_W32_FLOAT == output_media_fmt_ptr->byte_combo) || - (PC_BW64_W64_DOUBLE == output_media_fmt_ptr->byte_combo)) - { - result = pc_deintlv_unpacked_v2_32_out(input_buf_ptr, - output_buf_ptr, - input_media_fmt_ptr->num_channels, - input_media_fmt_ptr->word_size, - input_media_fmt_ptr->q_factor, - output_media_fmt_ptr->q_factor); - } - else - { - CNV_MSG(pc_ptr->miid, DBG_ERROR_PRIO, "Unsupported byte combo "); - } - } - - return result; -} -/*______________________________________________________________________________________________________________________ - DESCRIPTION: - -______________________________________________________________________________________________________________________*/ -ar_result_t pc_channel_mix_process(void * me_ptr, - capi_buf_t * input_buf_ptr, - capi_buf_t * output_buf_ptr, - pc_media_fmt_t *input_media_fmt_ptr, - pc_media_fmt_t *output_media_fmt_ptr) -{ - ar_result_t result = AR_EOK; - pc_lib_t * pc_ptr = (pc_lib_t *)me_ptr; - void * local_input_buf_ptr[CAPI_MAX_CHANNELS_V2] = { NULL }; - void * local_output_buf_ptr[CAPI_MAX_CHANNELS_V2] = { NULL }; - uint32_t bytes_to_process = 0; - uint32_t samples_to_process = 0; - uint32_t byte_sample_convert = 0; - for (uint32_t i = 0; i < input_media_fmt_ptr->num_channels; i++) - { - local_input_buf_ptr[i] = (void *)input_buf_ptr[i].data_ptr; - } - - for (uint32_t ch = 0; ch < output_media_fmt_ptr->num_channels; ch++) - { - local_output_buf_ptr[ch] = (void *)output_buf_ptr[ch].data_ptr; - } - - bytes_to_process = input_buf_ptr[0].actual_data_len; - byte_sample_convert = (input_media_fmt_ptr->word_size == 16) ? 1 : 2; - samples_to_process = bytes_to_process >> (byte_sample_convert); - - ChMixerProcess(pc_ptr->ch_lib_ptr, local_output_buf_ptr, local_input_buf_ptr, samples_to_process); - // optimization: write/read only first ch lens, and assume same lens for rest of the chs - input_buf_ptr[0].actual_data_len = samples_to_process << byte_sample_convert; - output_buf_ptr[0].actual_data_len = samples_to_process << byte_sample_convert; - - return result; -} - -/*______________________________________________________________________________________________________________________ - DESCRIPTION: - -______________________________________________________________________________________________________________________*/ -ar_result_t pc_iir_resampler_process(void * me_ptr, - capi_buf_t * input_buf_ptr, - capi_buf_t * output_buf_ptr, - pc_media_fmt_t *input_media_fmt_ptr, - pc_media_fmt_t *output_media_fmt_ptr) -{ - - capi_err_t result = CAPI_EOK; - pc_lib_t * pc_ptr = (pc_lib_t *)me_ptr; - uint32_t num_input_samples, ch; - uint32_t processed_input_samples, generated_output_samples; - - iir_rs_lib_instance_t *port_instance_ptr = &pc_ptr->iir_rs_lib_ptr->lib_instance_per_port_ptr[0]; - num_input_samples = input_buf_ptr->actual_data_len >> 1; - // num_output_samples = (num_input_samples * output_media_fmt_ptr->sampling_rate) / - // input_media_fmt_ptr->sampling_rate; - - int8_t *input_ptr[CAPI_MAX_CHANNELS_V2] = { 0 }; - int8_t *output_ptr[CAPI_MAX_CHANNELS_V2] = { 0 }; - - processed_input_samples = generated_output_samples = 0; - while (num_input_samples > processed_input_samples) - { - for (ch = 0; ch < port_instance_ptr->lib_io_config.in_channels; ch++) - { - input_ptr[ch] = input_buf_ptr[ch].data_ptr + (processed_input_samples << 1); - output_ptr[ch] = output_buf_ptr[ch].data_ptr + (generated_output_samples << 1); - } - - // resampler process takes case of memscpy in passthrough case with different input and output pointers. - result = iir_rs_process(pc_ptr->iir_rs_lib_ptr, - input_ptr, - output_ptr, - pc_ptr->in_frame_samples_per_ch, - pc_ptr->out_frame_samples_per_ch); - - if (AR_EOK != result) - { - result = CAPI_EFAILED; - } - - processed_input_samples += pc_ptr->in_frame_samples_per_ch; - generated_output_samples += pc_ptr->out_frame_samples_per_ch; // amith - For now. - } - - // optimization: write/read only first ch lens, and assume same lens for rest of the chs - output_buf_ptr[0].actual_data_len = generated_output_samples << 1; - return result; -} - -/*______________________________________________________________________________________________________________________ - DESCRIPTION: - -______________________________________________________________________________________________________________________*/ -ar_result_t pc_calc_and_update_max_in_len(pc_lib_t * pc_ptr, - capi_buf_t *input_buf_ptr, - capi_buf_t *output_buf_ptr, - capi_buf_t *remapped_ib_ptr) -{ - ar_result_t result = AR_EOK; - uint32_t in_len_per_ch = 0; - uint32_t out_len_per_ch = 0; - uint32_t max_in_len_to_consume_per_ch = 0; - pc_media_fmt_t *imf_ptr = &pc_ptr->core_lib.input_media_fmt; - pc_media_fmt_t *omf_ptr = &pc_ptr->core_lib.output_media_fmt; - - if ((PC_INTERLEAVED == imf_ptr->interleaving) || (PC_DEINTERLEAVED_PACKED == imf_ptr->interleaving)) - { - in_len_per_ch = input_buf_ptr->actual_data_len / imf_ptr->num_channels; - } - else - { - in_len_per_ch = input_buf_ptr->actual_data_len; - } - - if ((PC_INTERLEAVED == omf_ptr->interleaving) || (PC_DEINTERLEAVED_PACKED == omf_ptr->interleaving)) - { - out_len_per_ch = output_buf_ptr->max_data_len / omf_ptr->num_channels; - } - else - { - out_len_per_ch = output_buf_ptr->max_data_len; - } - - // get output samples based on output buffer - uint32_t output_samples_per_ch = out_len_per_ch / (omf_ptr->word_size >> 3); - - // scale max required input samples to fill output max buffer length. - uint32_t max_req_in_per_ch = in_len_per_ch; - if ((pc_ptr->core_lib.flags.RESAMPLER_PRE || pc_ptr->core_lib.flags.RESAMPLER_POST)) - { - uint32_t req_in_samples_per_ch = 0; - // If IIR resampler is used, fixed input frame size is required. The following checks are needed: - // 1. Input length meets frame size. - // 2. Enough output was provided to fit the input. - if (NULL != pc_ptr->iir_rs_lib_ptr) - { - - if ((0 == pc_ptr->in_frame_samples_per_ch) || (0 == pc_ptr->out_frame_samples_per_ch)) - { - CNV_MSG(pc_ptr->miid, DBG_ERROR_PRIO, "pc_process: Error: Frame size not set."); - return AR_EFAILED; - } - - uint32_t in_frame_size_bpc = pc_ptr->in_frame_samples_per_ch * (imf_ptr->word_size >> 3); - - // Check if input length meets frame size. - if ((in_len_per_ch < in_frame_size_bpc) || (output_samples_per_ch < pc_ptr->out_frame_samples_per_ch)) - { -#ifdef PCM_CNV_DEBUG - CNV_MSG(pc_ptr->miid, - DBG_ERROR_PRIO, - "pc_process: Input given: bytes per ch: %ld, output samples per ch %ld, frame size bytes per ch: " - "%ld", - in_len_per_ch, - output_samples_per_ch, - in_frame_size_bpc); -#endif - return AR_ENEEDMORE; - } - req_in_samples_per_ch = pc_ptr->in_frame_samples_per_ch; - - // If more input was given, allow loops over iir resampler. IIR resampler pc process function allows for - // looping. - if (in_len_per_ch > in_frame_size_bpc) - { - - uint32_t in_proc_multiplier = in_len_per_ch / in_frame_size_bpc; - uint32_t out_proc_multiplier = output_samples_per_ch / pc_ptr->out_frame_samples_per_ch; - uint32_t proc_multiplier = MIN(in_proc_multiplier, out_proc_multiplier); - req_in_samples_per_ch *= proc_multiplier; -#ifdef PCM_CNV_DEBUG - CNV_MSG(pc_ptr->miid, - DBG_HIGH_PRIO, - "pc_process: Input given: bytes per ch: %ld, output bytes per ch %ld, consuming frame size bytes " - "per ch: %ld, in proc mult %ld, out proc mult %ld", - in_len_per_ch, - out_len_per_ch, - req_in_samples_per_ch * (imf_ptr->word_size >> 3), - in_proc_multiplier, - out_proc_multiplier); -#endif - - // Revert lib frame size back to cntr frame size when no longer in consume_partial_input mode, and - // we are able to process a full cntr frame size worth of data. - if ((!pc_ptr->consume_partial_input) && (pc_ptr->frame_size_us != pc_ptr->cntr_frame_size_us)) - { - uint64_t *FRACT_TIME_PTR_NULL = NULL; - - // To convert samples per ch to us, we can use bits_per_sample = 8, num_channels = 1. - uint32_t input_size_us = - capi_cmn_bytes_to_us(req_in_samples_per_ch, imf_ptr->sampling_rate, 8, 1, FRACT_TIME_PTR_NULL); - - if (input_size_us == pc_ptr->cntr_frame_size_us) - { - pc_set_frame_size(pc_ptr, pc_ptr->cntr_frame_size_us); - } - } - } - } - else if (NULL != pc_ptr->hwsw_rs_lib_ptr) // either hw or sw resampler is used. - { - // For software resampler, use the function to get in samples from out - if ((NULL != pc_ptr->hwsw_rs_lib_ptr->sw_rs_mem_ptr[STAGE_ZERO]) && - (pc_ptr->hwsw_rs_lib_ptr->sw_rs_mem_ptr[STAGE_ZERO]->drs_mem_ptr.pStructMem)) - { - req_in_samples_per_ch = pc_get_fixed_out_samples(pc_ptr, output_samples_per_ch); - } - else // For hardware resampler use differnt function to get in samples to be consumed - { - uint32_t local_out_sample = output_samples_per_ch; - hwsw_rs_lib_process_get_hw_process_info(pc_ptr->hwsw_rs_lib_ptr, - in_len_per_ch / (imf_ptr->word_size >> 3), - output_samples_per_ch, - &req_in_samples_per_ch, - &local_out_sample); - } - } - else - { - CNV_MSG(pc_ptr->miid, DBG_ERROR_PRIO, "pc_process: WARNING: Neither IIR not hwsw resamplers were enabled"); - req_in_samples_per_ch = (output_samples_per_ch * imf_ptr->sampling_rate) / omf_ptr->sampling_rate; - } - max_req_in_per_ch = req_in_samples_per_ch * (imf_ptr->word_size >> 3); - } - else // for case where resampler is not present calculate max input length from max samples output can hold - { - max_req_in_per_ch = output_samples_per_ch * (imf_ptr->word_size >> 3); - } - - // Update input buffer actual data legnth based on the len thats consumed by pc process, - // 1. If INPUT actual data length is greater than required, update actual data length - // based one expected input samples. - // 2. If INPUT actual data length is lesser than expected, this is an error case. Library - // will operate in fixed input mode and consume all the input, so no need to update - // input actual data length. - // 3. If OUTPUT max length is not enough to hold the converted data from input, - // calculate the corresponding input length which should be consumed - max_in_len_to_consume_per_ch = MIN(max_req_in_per_ch, in_len_per_ch); - -#ifdef PCM_CNV_LIB_DEBUG - CNV_MSG(pc_ptr->miid, - DBG_HIGH_PRIO, - "pc_process: max_in_len_to_consume_per_ch %lu in_len_per_ch %lu output_samples_per_ch %lu " - "max_req_in_per_ch %lu", - max_in_len_to_consume_per_ch, - in_len_per_ch, - output_samples_per_ch, - max_req_in_per_ch); -#endif - - if (PC_INTERLEAVED == imf_ptr->interleaving || PC_DEINTERLEAVED_PACKED == imf_ptr->interleaving) - { - input_buf_ptr->actual_data_len = max_in_len_to_consume_per_ch * imf_ptr->num_channels; - } - else - { - input_buf_ptr[0].actual_data_len = max_in_len_to_consume_per_ch; - } - - if (PC_INTERLEAVED == imf_ptr->interleaving) - { - remapped_ib_ptr->actual_data_len = input_buf_ptr->actual_data_len; - } - else - { - remapped_ib_ptr[0].actual_data_len = max_in_len_to_consume_per_ch; - } - - return result; -} - -/*______________________________________________________________________________________________________________________ - DESCRIPTION: - -______________________________________________________________________________________________________________________*/ -ar_result_t pc_process(pc_lib_t * pc_ptr, - capi_buf_t *input_buf_ptr, - capi_buf_t *output_buf_ptr, - capi_buf_t *scratch_buf_ptr_1, - capi_buf_t *scratch_buf_ptr_2) -{ - ar_result_t result = AR_EOK; - capi_buf_t * next_input_buf_ptr = pc_ptr->core_lib.remap_input_buf_ptr; - pc_media_fmt_t *next_input_media_fmt_ptr = &pc_ptr->core_lib.input_media_fmt; - bool_t any_process_done = FALSE; - - - - pc_remap_buffer(pc_ptr, - input_buf_ptr, - output_buf_ptr, - scratch_buf_ptr_1, - scratch_buf_ptr_2, - next_input_buf_ptr, - NULL, - next_input_media_fmt_ptr, - NULL, - TRUE); - - if (AR_ENEEDMORE == pc_calc_and_update_max_in_len(pc_ptr, input_buf_ptr, output_buf_ptr, next_input_buf_ptr)) - { - return AR_ENEEDMORE; - } - - for (uint32_t i = 0; i < NUMBER_OF_PROCESS; i++) - { if (NULL != pc_ptr->core_lib.pc_proc_info[i].process) - { - any_process_done = TRUE; - capi_buf_t * current_input_buf_ptr = next_input_buf_ptr; - capi_buf_t * current_output_buf_ptr = pc_ptr->core_lib.pc_proc_info[i].output_buffer_ptr; - pc_media_fmt_t *output_media_fmt_ptr = &pc_ptr->core_lib.pc_proc_info[i].output_media_fmt; - pc_remap_buffer(pc_ptr, - input_buf_ptr, - output_buf_ptr, - scratch_buf_ptr_1, - scratch_buf_ptr_2, - current_input_buf_ptr, - current_output_buf_ptr, - next_input_media_fmt_ptr, - output_media_fmt_ptr, - FALSE); - - result = pc_ptr->core_lib.pc_proc_info[i].process((void *)pc_ptr, - current_input_buf_ptr, - current_output_buf_ptr, - next_input_media_fmt_ptr, - output_media_fmt_ptr); - - if (current_output_buf_ptr == pc_ptr->core_lib.remap_output_buf_ptr) - { - output_buf_ptr->actual_data_len = current_output_buf_ptr->actual_data_len; - } - - next_input_media_fmt_ptr = &pc_ptr->core_lib.pc_proc_info[i].output_media_fmt; - next_input_buf_ptr = current_output_buf_ptr; - } - } - if (FALSE == any_process_done) - { - - if (pc_ptr->core_lib.input_media_fmt.interleaving == pc_ptr->core_lib.output_media_fmt.interleaving) - { - - if ((PC_INTERLEAVED == pc_ptr->core_lib.input_media_fmt.interleaving) || - (PC_DEINTERLEAVED_PACKED == pc_ptr->core_lib.input_media_fmt.interleaving)) - { - - if (input_buf_ptr->data_ptr != output_buf_ptr->data_ptr) - { - output_buf_ptr->actual_data_len = memscpy(output_buf_ptr->data_ptr, - output_buf_ptr->max_data_len, - input_buf_ptr->data_ptr, - input_buf_ptr->actual_data_len); - } - } - else - { - - uint32_t num_bytes_to_copy = MIN(output_buf_ptr[0].max_data_len, input_buf_ptr[0].actual_data_len); - for (int32_t ch = 0; ch < pc_ptr->core_lib.input_media_fmt.num_channels; ch++) - { - memscpy(output_buf_ptr[ch].data_ptr, num_bytes_to_copy, input_buf_ptr[ch].data_ptr, num_bytes_to_copy); - } - output_buf_ptr[0].actual_data_len = num_bytes_to_copy; - } - - } - else - { - - uint32_t bytes_per_ch = 0; - - // Enters here only for DEINTERLEAVED_PACKED <-> DEINTERLEAVED_UNPACKED conversion - // Note: Interleaved <-> deinterleaved packed/deinterleaved unpacked case doesn't happen - // since the interleaver process will be triggered if that happens - if (PCM_DEINTERLEAVED_PACKED == pc_ptr->core_lib.input_media_fmt.interleaving) - { - - bytes_per_ch = (input_buf_ptr->actual_data_len) / (pc_ptr->core_lib.input_media_fmt.num_channels); - uint32_t num_bytes_to_copy = MIN(bytes_per_ch, output_buf_ptr[0].max_data_len); - for (int32_t ch = 0; ch < pc_ptr->core_lib.input_media_fmt.num_channels; ch++) - { - memscpy(output_buf_ptr[ch].data_ptr, - num_bytes_to_copy, - input_buf_ptr->data_ptr + (bytes_per_ch * ch), - num_bytes_to_copy); - } - output_buf_ptr[0].actual_data_len = num_bytes_to_copy; - } - else - { - - // We can't use output buffer lengths because, actual length will be 0 and if we use max len, it will not be - // packed - // Since input is unpacked, first channels length will suffice for the bytes per ch - bytes_per_ch = (input_buf_ptr[0].actual_data_len); - output_buf_ptr->actual_data_len = 0; - for (int32_t ch = 0; ch < pc_ptr->core_lib.input_media_fmt.num_channels; ch++) - { - output_buf_ptr->actual_data_len += memscpy(output_buf_ptr->data_ptr + (bytes_per_ch * ch), - output_buf_ptr->max_data_len, - input_buf_ptr[ch].data_ptr, - bytes_per_ch); - } - } - - } - - } - - - return result; -} diff --git a/modules/cmn/pcm_mf_cnv/lib/stub_src/pc_float/pc_float_stub.cpp b/modules/cmn/pcm_mf_cnv/lib/stub_src/pc_float/pc_float_stub.cpp deleted file mode 100644 index 041ee374..00000000 --- a/modules/cmn/pcm_mf_cnv/lib/stub_src/pc_float/pc_float_stub.cpp +++ /dev/null @@ -1,41 +0,0 @@ - -/*======================================================================== - - file pc_float_stub.cpp -This file contains stub functions for data format conversions - -Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. -SPDX-License-Identifier: BSD-3-Clause-Clear -======================================================================*/ - -/* ======================================================================= -INCLUDE FILES FOR MODULE -========================================================================== */ - -#include "pc_converter.h" - -ar_result_t pc_float_to_fixed_conv_process(void * me_ptr, - capi_buf_t * input_buf_ptr, - capi_buf_t * output_buf_ptr, - pc_media_fmt_t *input_media_fmt_ptr, - pc_media_fmt_t *output_media_fmt_ptr) -{ - ar_result_t result = AR_EUNSUPPORTED; - return result; -} - -ar_result_t pc_fixed_to_float_conv_process(void * me_ptr, - capi_buf_t * input_buf_ptr, - capi_buf_t * output_buf_ptr, - pc_media_fmt_t *input_media_fmt_ptr, - pc_media_fmt_t *output_media_fmt_ptr) - -{ - ar_result_t result = AR_EUNSUPPORTED; - return result; -} - -bool_t pc_is_floating_point_data_format_supported() -{ - return FALSE; -} diff --git a/modules/cmn/pcm_mf_cnv/lib/tst/main.cpp b/modules/cmn/pcm_mf_cnv/lib/tst/main.cpp deleted file mode 100644 index a2baa5c8..00000000 --- a/modules/cmn/pcm_mf_cnv/lib/tst/main.cpp +++ /dev/null @@ -1,239 +0,0 @@ -/*============================================================================== - Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. - SPDX-License-Identifier: BSD-3-Clause-Clear - ==============================================================================*/ - -/*============================================================================ - FILE: main.c - - OVERVIEW: Entry point for PCM_converter unit test - - DEPENDENCIES: None - - ============================================================================*/ -#include -#include -#include -#include -#include -#include - -#include "wavefile.h" -#include "pcm_converter.h" -using namespace std; -uint8_t posal_debugmsg_lowest_prio = 4; - -/* ----------------------------------------------------------------------- -** Global Data -** ----------------------------------------------------------------------- */ -extern WavHeader wh; -extern WavHeader wh_write; -void get_interleaved_info(pc_main_mf_t *media_fmt_ptr, int in_value) -{ - switch (in_value) - { - case 0: - media_fmt_ptr->interleaving = CAPI_DEINTERLEAVED_PACKED; - break; - case 1: - media_fmt_ptr->interleaving = CAPI_INTERLEAVED; - break; - default: - media_fmt_ptr->interleaving = CAPI_INVALID_INTERLEAVING; - break; - } -} - -void get_endian_info(pc_main_mf_t *media_fmt_ptr, int in_value) -{ - switch (in_value) - { - case 0: - media_fmt_ptr->endianness = PCM_CNV_LITTLE_ENDIAN; - break; - case 1: - media_fmt_ptr->endianness = PCM_CNV_BIG_ENDIAN; - break; - default: - media_fmt_ptr->endianness = PCM_CNV_UNKNOWN_ENDIAN; - break; - } -} - -void print_media_format(pc_main_mf_t *media_fmt_ptr) -{ - cout << endl; - cout << "Media format is" << endl; - cout << "Bit width :" << media_fmt_ptr->bit_width << endl; - cout << "Word size :" << media_fmt_ptr->word_size << endl; - cout << "Q format :" << media_fmt_ptr->q_factor << endl; - cout << "Interleaving :" << media_fmt_ptr->interleaving << endl; - cout << "Endianness :" << media_fmt_ptr->endianness << endl << endl; -} - -int main(int argc, char *argv[]) -{ - ar_result_t result = AR_EOK; - unsigned long long cycles = 0; - int sample_count = 0; - int bytes_to_read = 0; - int bytes_to_write = 0; - int bytes_read = 0; - int bytes_written = 0; - int frame_size_bytes = 0; - int frame_size_bytes_out = 0; - int frame_size_samples = 0; - pc_main_mf_t inp_media_fmt = { 0 }; - pc_main_mf_t out_media_fmt = { 0 }; - int8_t * input_buf_ptr = NULL; - int8_t * output_buf_ptr = NULL; - int8_t * scratch_buf_ptr = NULL; - pc_lib_t me; - pc_lib_t * me_ptr = &me; - - // Check the number of arguments - if (argc < 11) - { - fprintf(stderr, "Qualcomm's new PCM converter:\n"); - fprintf(stderr, - "Usage: tst_pcm_cnv " - " \n\n"); - fprintf(stderr, "Input Multi-channel Audio wave file. \n"); - fprintf(stderr, "Output Multi-channel Audio output from PCM converter. \n"); - fprintf(stderr, "Q_format of input file - 15, 23, 27 or 31 \n"); - fprintf(stderr, "Whether input file is to be interleaved - set 1 to interleave\n"); - fprintf(stderr, "Endianness of input file - 0 or 1, 0 for little\n"); - fprintf(stderr, "Bitwidth of output file - 16, 24 or 32 \n"); - fprintf(stderr, "Word size of output file - 16, 24 or 32 \n"); - fprintf(stderr, "Q_format of output file - 15, 23, 27 or 31 \n"); - fprintf(stderr, "Whether output file is to be interleaved - set 1 to interleave\n"); - fprintf(stderr, "Endianness of output file - 0 or 1, 0 for little\n"); - fprintf(stderr, "The input multi-channel audio file can be in interleaved/deinterleaved format. \n"); - return -1; - } - - if (0 != WaveFileReadInit(argv[1], 1)) - return -1; - - inp_media_fmt.bit_width = wh.bitsPerSample; - inp_media_fmt.word_size = wh.bytesPerSample * 8 / wh.numChannels; - inp_media_fmt.q_factor = atoi(argv[3]); - get_interleaved_info(&inp_media_fmt, atoi(argv[4])); - get_endian_info(&inp_media_fmt, atoi(argv[5])); - - out_media_fmt.bit_width = atoi(argv[6]); - out_media_fmt.word_size = atoi(argv[7]); - out_media_fmt.q_factor = atoi(argv[8]); - get_interleaved_info(&out_media_fmt, atoi(argv[9])); - get_endian_info(&out_media_fmt, atoi(argv[10])); - - memcpy(&wh_write, &wh, sizeof(WavHeader)); - wh_write.bitsPerSample = out_media_fmt.bit_width; - wh_write.bytesPerSample = out_media_fmt.word_size * wh_write.numChannels / 8; - wh_write.bytesPerSecond = wh_write.bytesPerSample * wh_write.sampleRate; - wh_write.dataLength = wh.dataLength * wh_write.bytesPerSample / wh.bytesPerSample; - print_media_format(&inp_media_fmt); - print_media_format(&out_media_fmt); - - if (0 != WaveFileWriteInit(argv[2])) - { - WaveFileIOEnd(); - return -1; - } - - frame_size_samples = (wh.sampleRate / wh.sampleRate * 2) * wh.numChannels; // 2 samples per channel - frame_size_bytes = frame_size_samples * inp_media_fmt.word_size >> 3; - frame_size_bytes_out = frame_size_samples * out_media_fmt.word_size >> 3; - - - input_buf_ptr = (int8_t *)calloc(frame_size_bytes, sizeof(int8_t)); - output_buf_ptr = (int8_t *)calloc(frame_size_bytes_out, sizeof(int8_t)); - scratch_buf_ptr = (int8_t *)calloc(frame_size_bytes_out, sizeof(int8_t)); - - sample_count = wh.dataLength / wh.bytesPerSample; - - me.input_media_fmt = inp_media_fmt; - me.output_media_fmt = out_media_fmt; - me.inp_media_fmt_combo = pc_classify_mf(&inp_media_fmt); - me.out_media_fmt_combo = pc_classify_mf(&out_media_fmt); - - cout << "frame_size_samples :" << frame_size_samples << endl; - cout << "frame_size_bytes :" << frame_size_bytes << endl; - cout << "frame_size_bytes_out :" << frame_size_bytes_out << endl; - do - { - if (frame_size_bytes > wh.dataLength) - { - bytes_to_read = wh.dataLength; - bytes_to_write = wh_write.dataLength; - } - else - { - bytes_to_read = frame_size_bytes; - bytes_to_write = frame_size_bytes_out; - } - - // Read data from the input wave file - if (WaveFileRead((char *)input_buf_ptr, bytes_to_read) < 0) - { - break; - } - bytes_read += bytes_to_read; - sample_count -= bytes_to_read / wh.bytesPerSample; - - capi_buf_t inp_buffer = { 0 }; - capi_buf_t out_buffer = { 0 }; - capi_buf_t scratch_buffer = { 0 }; - inp_buffer.data_ptr = (int8_t *)input_buf_ptr; - inp_buffer.actual_data_len = bytes_to_read; - inp_buffer.max_data_len = frame_size_bytes * sizeof(int8_t); - out_buffer.data_ptr = (int8_t *)output_buf_ptr; - out_buffer.actual_data_len = 0; - out_buffer.max_data_len = frame_size_bytes_out * sizeof(int8_t); - scratch_buffer.data_ptr = (int8_t *)scratch_buf_ptr; - scratch_buffer.actual_data_len = 0; - scratch_buffer.max_data_len = frame_size_bytes_out * sizeof(int8_t); - pc_ch_info_t temp = { 0 }; - temp.num_samp_per_ch = bytes_to_read / ((inp_media_fmt.word_size >> 3) * wh.numChannels); - temp.num_channels = wh.numChannels; - temp.chan_spacing_in = bytes_to_read / wh.numChannels; - temp.chan_spacing_out = bytes_to_write / wh_write.numChannels; - - static int flag = 0; - if (0 == flag) - { - cout << "num_samp_per_ch :" << temp.num_samp_per_ch << endl; - cout << "num_channels :" << temp.num_channels << endl; - cout << "chan_spacing_in :" << temp.chan_spacing_in << endl; - cout << "chan_spacing_out :" << temp.chan_spacing_out << endl; - flag = 1; - } - result = pc_process(me_ptr, - &inp_buffer, - &out_buffer, - &scratch_buffer); - if (AR_EOK != result) - { - AR_MSG(DBG_ERROR_PRIO, "Failed to PCM convert, lol"); - break; - } - //printf("%x %x %x\n", output_buf_ptr, input_buf_ptr, scratch_buf_ptr); - WaveFileWrite((char *)output_buf_ptr, bytes_to_write); - - bytes_written += bytes_to_write; - - } while (sample_count > 0); // End main processing loop - - printf("cycles %llu\t", cycles); - /* printf("MIPS %f\n", */ - /* (((float)cycles * fparams[SAMPLE_RATE] * (float)numChannels)) / ((float)samplesWritten * 1000000)); */ - - free(input_buf_ptr); - free(output_buf_ptr); - free(scratch_buf_ptr); - printf("Bytes read from input file: %d\n", bytes_read); - printf("Bytes written to output file: %d\n", bytes_written); - - return 0; -} diff --git a/modules/processing/Virtualizer/api/Virtualizer_api.h b/modules/processing/Virtualizer/api/Virtualizer_api.h deleted file mode 100644 index 07f6e55b..00000000 --- a/modules/processing/Virtualizer/api/Virtualizer_api.h +++ /dev/null @@ -1,207 +0,0 @@ -/* - * Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. - * SPDX-License-Identifier: BSD-3-Clause-Clear - */ - -#ifndef VIRTUALIZER_CALIB_H -#define VIRTUALIZER_CALIB_H -/*============================================================================== - @file Virtualizer_calib.h - @brief This file contains VIRTUALIZER API -==============================================================================*/ - -#include "module_cmn_api.h" - -/** @h2xml_title1 {Virtualizer Module} - @h2xml_title_agile_rev {Virtualizer Module} - @h2xml_title_date {May 31,2019} */ - -/*------------------------------------------------------------------------------ - Module -------------------------------------------------------------------------------*/ -/*============================================================================== - Constants -==============================================================================*/ - - -/* ID of the Virtualizer Strength parameter used by MODULE_ID_VIRTUALIZER. */ -#define PARAM_ID_VIRTUALIZER_STRENGTH 0x08001136 - -/* Structure for the strength parameter of VIRTUALIZER module. */ -typedef struct param_id_virtualizer_strength_t param_id_virtualizer_strength_t; -/** @h2xmlp_parameter {"PARAM_ID_VIRTUALIZER_STRENGTH", PARAM_ID_VIRTUALIZER_STRENGTH} - @h2xmlp_description {Specifies the virtualizer strength } - @h2xmlp_toolPolicy {Calibration}*/ - -#include "spf_begin_pack.h" - -/* Payload of the PARAM_ID_VIRTUALIZER_STRENGTH parameter used by the Virtualizer module. */ -struct param_id_virtualizer_strength_t -{ - uint32_t strength; - /**< @h2xmle_description {Specifies the virtualizer strength.\n } - @h2xmle_range {0..1000} - @h2xmle_default {1000}*/ - -} -#include "spf_end_pack.h" -; - - -/* ID of the Virtualizer Out Type parameter used by MODULE_ID_VIRTUALIZER.*/ -#define PARAM_ID_VIRTUALIZER_OUT_TYPE 0x08001137 - -/* Structure for the out type parameter of VIRTUALIZER module. */ -typedef struct param_id_virtualizer_out_type_t param_id_virtualizer_out_type_t; -/** @h2xmlp_parameter {"PARAM_ID_VIRTUALIZER_OUT_TYPE", PARAM_ID_VIRTUALIZER_OUT_TYPE} - @h2xmlp_description {Specifies the output device type of the virtualizer.} - @h2xmlp_toolPolicy {Calibration} */ - -/* Payload of the PARAM_ID_VIRTUALIZER_OUT_TYPE parameter used by the Virtualizer module. */ -#include "spf_begin_pack.h" - -struct param_id_virtualizer_out_type_t -{ - uint32_t out_type; - /**< @h2xmle_description { Specifies the output device type of the virtualizer.\n} - @h2xmle_rangeList {"Headphone"= 0; - "Desktop speakers"=1} - @h2xmle_default {0} */ - -} -#include "spf_end_pack.h" -; - - -/* ID of the Virtualizer Gain Adjust parameter used by MODULE_ID_VIRTUALIZER. */ -#define PARAM_ID_VIRTUALIZER_GAIN_ADJUST 0x08001138 - - -/* Structure for the strength parameter of VIRTUALIZER module. */ -typedef struct param_id_virtualizer_gain_adjust_t param_id_virtualizer_gain_adjust_t; -/** @h2xmlp_parameter {"PARAM_ID_VIRTUALIZER_GAIN_ADJUST", PARAM_ID_VIRTUALIZER_GAIN_ADJUST} - @h2xmlp_description {Specifies the overall gain adjustment of virtualizer outputs.} - @h2xmlp_toolPolicy {Calibration} */ - -#include "spf_begin_pack.h" - -/* Payload of the PARAM_ID_VIRTUALIZER_GAIN_ADJUST parameter used by the Virtualizer module. */ - -struct param_id_virtualizer_gain_adjust_t -{ - int32_t gain_adjust; - /**< @h2xmle_description { Specifies the overall gain adjustment of virtualizer outputs, in the unit 'millibels'.\n} - @h2xmle_default {0} - @h2xmle_range {-600..600} - @@h2xmle_default {0} */ - -} -#include "spf_end_pack.h" -; - -#define PARAM_ID_VIRTUALIZER_OUT_CH_CFG 0x08001139 - -typedef struct param_id_virtualizer_out_ch_cfg_t param_id_virtualizer_out_ch_cfg_t; -/** @h2xmlp_parameter {"PARAM_ID_VIRTUALIZER_OUT_CH_CFG", PARAM_ID_VIRTUALIZER_OUT_CH_CFG} - @h2xmlp_description {Specifies the output channel configuration of the module.} - @h2xmlp_toolPolicy {Calibration} */ - -#include "spf_begin_pack.h" -#include "spf_begin_pragma.h" - -struct param_id_virtualizer_out_ch_cfg_t -{ - int16_t num_channels; - /**< @h2xmle_description { Specifies number of channels \n - - Sender will have to pad accordingly to make sure it is 4 byte aligned} - @h2xmle_range {1..2} - @h2xmle_default {2} */ - uint16_t channel_map[0]; - /**< @h2xmle_description { Payload consisting of channel mapping information for all the channels. \n - The channel mapping is specific for specific number of channels \n - for 1 : [PCM_CHANNEL_C] \n - for 2 : [PCM_CHANNEL_L, PCM_CHANNEL_R] \n } - @h2xmle_range {1..3} - @h2xmle_defaultList {1,2} - @h2xmle_variableArraySize {num_channels}*/ -} -#include "spf_end_pragma.h" -#include "spf_end_pack.h" -; - - -/* Global unique Module ID definition - Module library is independent of this number, it defined here for static - loading purpose only */ - -#define MODULE_ID_VIRTUALIZER 0x07001064 -/** - @h2xmlm_module {"MODULE_ID_VIRTUALIZER", - MODULE_ID_VIRTUALIZER} - @h2xmlm_displayName {"Virtualizer"} - @h2xmlm_modSearchKeys{effects, Audio} - @h2xmlm_description {ID of the VIRTUALIZER module.\n - - . This module supports the following parameter IDs:\n - . 1. PARAM_ID_MODULE_ENABLE \n - . 2. PARAM_ID_VIRTUALIZER_STRENGTH \n - . 3. PARAM_ID_VIRTUALIZER_OUT_TYPE \n - . 4. PARAM_ID_VIRTUALIZER_GAIN_ADJUST \n - . 5. PARAM_ID_VIRTUALIZER_OUT_CH_CFG \n - \n - . Supported Containers: \n - . 1. APM_CONTAINER_TYPE_ID_GC (or) \n - . 2. APM_CONTAINER_TYPE_ID_SC - \n - . Supported Input Media Format: \n - . Data Format : FIXED_POINT \n - . fmt_id : MEDIA_FMT_ID_PCM \n - . Sample Rates : Standard sample rates between 8kHz and 192kHz \n - . Number of channels : 1,2,6,8 \n - . Channel type : Supported channel mapping based on number of channels is given below. \n - . Bits per sample : 16,32 \n - . Q format : Q15 for bps = 16, Q27 for bps = 32 \n - . Interleaving : Deinterleaved Unpacked \n - . Signed/unsigned : Signed \n - \n - . Supported Input Channel Mapping based on number of input channels: \n - . 1: mono [C] \n - . 2: stereo [L, R] \n - . 6: 5.1 channel [L, R, C, LFE, LS, RS] or [L, R, C, LFE, LB, RB] \n - . 8: 7.1 channel [L, R, C, LFE, LS, RS, LB, RB] \n - \n - . Supported Output Channel Mapping based on number of output channels: \n - . 1: mono [C] \n - . 2: stereo [L, R] \n - \n - } - @h2xmlm_toolPolicy {Calibration} - @h2xmlm_dataMaxInputPorts { 1 } - @h2xmlm_dataInputPorts { IN=2} - @h2xmlm_dataOutputPorts { OUT=1} - @h2xmlm_dataMaxOutputPorts { 1 } - @h2xmlm_supportedContTypes {APM_CONTAINER_TYPE_GC, APM_CONTAINER_TYPE_SC} - @h2xmlm_isOffloadable {true} - @h2xmlm_stackSize {4096} - @h2xmlm_toolPolicy {Calibration} - - @{ <-- Start of the Module --> - @h2xml_Select {"param_id_module_enable_t"} - @h2xmlm_InsertParameter - @h2xml_Select {"param_id_virtualizer_strength_t"} - @h2xmlm_InsertParameter - @h2xmlp_toolPolicy {Calibration} - @h2xml_Select {"param_id_virtualizer_out_type_t"} - @h2xmlm_InsertParameter - @h2xmlp_toolPolicy {Calibration} - @h2xml_Select {"param_id_virtualizer_gain_adjust_t"} - @h2xmlm_InsertParameter - @h2xmlp_toolPolicy {Calibration} - @h2xml_Select {"param_id_virtualizer_out_ch_cfg_t"} - @h2xmlm_InsertParameter - @h2xmlp_toolPolicy {Calibration} - @} <-- End of the Module -->*/ - - -#endif - diff --git a/modules/processing/Virtualizer/bin/arm/libvirtualizer.a b/modules/processing/Virtualizer/bin/arm/libvirtualizer.a deleted file mode 100644 index 4c861fb8..00000000 Binary files a/modules/processing/Virtualizer/bin/arm/libvirtualizer.a and /dev/null differ diff --git a/modules/processing/Virtualizer/build/CMakeLists.txt b/modules/processing/Virtualizer/build/CMakeLists.txt deleted file mode 100644 index 50912ede..00000000 --- a/modules/processing/Virtualizer/build/CMakeLists.txt +++ /dev/null @@ -1,37 +0,0 @@ -#[[ - @file CMakeLists.txt - - @brief - - @copyright - Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. - SPDX-License-Identifier: BSD-3-Clause-Clear -]] -cmake_minimum_required(VERSION 3.10) - -set(virtualizer_includes - ${LIB_ROOT}/api - ${LIB_ROOT}/capi/inc - ${LIB_ROOT}/capi/src - ${LIB_ROOT}/lib/inc - ${LIB_ROOT}/lib/src - ${PROJECT_SOURCE_DIR}/modules/processing/gain_control/limiter/lib/inc - ${PROJECT_SOURCE_DIR}/modules/processing/filters/multi_stage_iir/lib/inc - ${PROJECT_SOURCE_DIR}/modules/cmn/common/utils/inc -) - -spf_module_sources( - KCONFIG CONFIG_VIRTUALIZER - NAME virtualizer - MAJOR_VER 1 - MINOR_VER 0 - AMDB_ITYPE "capi" - AMDB_MTYPE "pp" - AMDB_MID "0x07001064" - AMDB_TAG "capi_virtualizer" - AMDB_MOD_NAME "MODULE_ID_VIRTUALIZER" - INCLUDES ${virtualizer_includes} - H2XML_HEADERS "${LIB_ROOT}/api/Virtualizer_api.h" - CFLAGS "" - STATIC_LIB_PATH "${LIB_ROOT}/bin/arm/libvirtualizer.a" -) diff --git a/modules/processing/Virtualizer/inc/capi_virtualizer.h b/modules/processing/Virtualizer/inc/capi_virtualizer.h deleted file mode 100644 index 69fe5574..00000000 --- a/modules/processing/Virtualizer/inc/capi_virtualizer.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. - * SPDX-License-Identifier: BSD-3-Clause-Clear - */ - -/** - * @file capi_virtualizer.h - * - * Header file to implement the Audio Post Processor Interface for - * virtualization - */ - -#ifndef CAPI_VIRTUALIZER_H -#define CAPI_VIRTUALIZER_H - -#include "capi.h" -#include "ar_defs.h" - -#ifdef __cplusplus -extern "C" { -#endif - - -//#define PARAM_ID_VIRTUALIZER_DIPOLE_SPACING 0x0000DEF0 -//#define PARAM_ID_VIRTUALIZER_VOLUME_RAMP 0x0000DEF2 -//#define PARAM_ID_VIRTUALIZER_DELAY 0x0000DEF3 - - -/** - * Get static properties of virtualizer module such as - * memory, stack requirements etc. - * See Elite_CAPI.h for more details. - */ -capi_err_t capi_virtualizer_get_static_properties( - capi_proplist_t *init_set_properties, - capi_proplist_t *static_properties); - - -/** - * Instantiates(and allocates) the module memory. - * See Elite_CAPI.h for more details. - */ -capi_err_t capi_virtualizer_init( - capi_t *_pif, - capi_proplist_t *init_set_properties); - -#ifdef __cplusplus -} -#endif - -#endif // CAPI_VIRTUALIZER_H diff --git a/modules/processing/Virtualizer/inc/virtualizer_calibration_api.h b/modules/processing/Virtualizer/inc/virtualizer_calibration_api.h deleted file mode 100644 index 2c1ec901..00000000 --- a/modules/processing/Virtualizer/inc/virtualizer_calibration_api.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. - * SPDX-License-Identifier: BSD-3-Clause-Clear - */ - -#ifndef VIRTUALIZER_CALIBRATION_API_H -#define VIRTUALIZER_CALIBRATION_API_H - -#include "AudioComdef.h" - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/*---------------------------------------------------------------------------- - Parameters with IDs -----------------------------------------------------------------------------*/ -#define VIRTUALIZER_PARAM_LIB_VER (0) // ** param: library version -typedef int32 virtualizer_version_t; // access: get only - -#define VIRTUALIZER_PARAM_ENABLE (1) // ** param: on/off switch -typedef int32 virtualizer_enable_t; // access: get & set, runtime - // range: [0 (OFF) or 1 (ON)] - -#define VIRTUALIZER_PARAM_STRENGTH (2) // ** param: effect strength -typedef int32 virtualizer_strength_t; // access: get & set, runtime - // range: [0, 1000] - -#define VIRTUALIZER_PARAM_OUT_TYPE (3) // ** param: output type -typedef enum virtualizer_output_t { // access: get & set - OUTPUT_HEADPHONES = 0, // stereo headphone - OUTPUT_DESKTOP_SPKS, // speaker with large distance - OUTPUT_DIPOLE_SPKS // closely-spaced speakers -} virtualizer_output_t; - -#define VIRTUALIZER_PARAM_DIPOLE_SPACING (4) // ** param: output type -typedef int32 virtualizer_dipole_spacing_t; // access: get & set -// currently only 2 spacing tuned: // range: [1, 500] (millimeter) -// 50 mm and 100 mm - -#define VIRTUALIZER_PARAM_GAIN_ADJUST (5) // ** param: overall gain adjust -typedef int32 virtualizer_gain_adjust_t; // access: get & set - // range: [-600, 600] (mB) - -#define VIRTUALIZER_PARAM_RESET (6) // ** param: reset library - // access: set only - -#define VIRTUALIZER_PARAM_ALG_DELAY (7) // ** param: alg delay (samples) -typedef int32 virtualizer_alg_delay_t; // access: get only - -#define VIRTUALIZER_PARAM_CROSSFADE_FLAG (8) // ** param: whether in transition state -typedef int32 virtualizer_crossfade_t; // access: get only - // range: [0 (N) or 1 (YES)] - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* VIRTUALIZER_CALIBRATION_API_H */ diff --git a/modules/processing/Virtualizer/inc/virtualizer_lib_api.h b/modules/processing/Virtualizer/inc/virtualizer_lib_api.h deleted file mode 100644 index 8021c818..00000000 --- a/modules/processing/Virtualizer/inc/virtualizer_lib_api.h +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. - * SPDX-License-Identifier: BSD-3-Clause-Clear - */ - -#ifndef VIRTUALIZER_API_H -#define VIRTUALIZER_API_H - -/* - * This file was renamed by fw team from virtualizer_api.h to avoid - * compilation issues on windows - */ -/*---------------------------------------------------------------------------- - * Include Files - * -------------------------------------------------------------------------*/ -#include "virtualizer_calibration_api.h" - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/*---------------------------------------------------------------------------- - Library Version -----------------------------------------------------------------------------*/ -#define VIRTUALIZER_LIB_VER (0x01000300) // lib version : 1.3.0 - // (major.minor.bug) (8.16.8 bits) - -/*---------------------------------------------------------------------------- - Error code -----------------------------------------------------------------------------*/ -typedef enum VIRTUALIZER_RESULT { - VIRTUALIZER_SUCCESS = 0, - VIRTUALIZER_FAILURE, - VIRTUALIZER_MEMERROR, -} VIRTUALIZER_RESULT; - -/*---------------------------------------------------------------------------- - Channel Numbers: - - Virtualizer only works with input/output channels with specific orders - defined below: - 1: mono [C] - 2: stereo [L, R] - 6: 5.1 channel [L, R, C, LFE, Ls, Rs] - other non-standard channel numbers or channel orders should be properly - converted by wrapper before using virtualizer library. -----------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------- - Type Declarations -----------------------------------------------------------------------------*/ - -typedef struct _virtualizer_static_vars_t { // ** static params - int32 data_width; // 16 (Q15 PCM) or 32 (Q27 PCM) - int32 sample_rate; // sampling rate [22, 32, 44, 48] - int32 max_block_size; // max processing block size - int32 out_chs; // # of output chs [1, 2] - int32 in_chs; // # of input chs [1, 2, 6] - int32 limiter_delay_ms; // limiter delay in ms [0, 20] -} virtualizer_static_vars_t; - -typedef struct _virtualizer_mem_req_t { // ** memory requirements - uint32 mem_size; // lib mem size (lib_mem_ptr ->) - uint32 stack_size; // max stack mem size -} virtualizer_mem_req_t; - -typedef struct _virtualizer_lib_t { // ** library struct - void* mem_ptr; // mem pointer -} virtualizer_lib_t; - -/*----------------------------------------------------------------------------- - Function Declarations ------------------------------------------------------------------------------*/ - -// ** Process one block of samples (multi channel) -// lib_ptr: [in] pointer to library structure -// out_ptr: [out] pointer to output sample block (multi channel double ptr) -// in_ptr: [in] pointer to input sample block (multi channel double ptr) -// samples: [in] number of samples to be processed per channel -VIRTUALIZER_RESULT virtualizer_process(virtualizer_lib_t *lib_ptr, void **out_ptr, void **in_ptr, uint32 samples); - -// ** Get library memory requirements -// mem_req_ptr: [out] pointer to mem requirements structure -// static_vars_ptr: [in] pointer to static variable structure -VIRTUALIZER_RESULT virtualizer_get_mem_req(virtualizer_mem_req_t *mem_req_ptr, virtualizer_static_vars_t* static_vars_ptr); - -// ** Partition, initialize memory, and set default values -// lib_ptr: [in, out] pointer to library structure -// static_vars_ptr: [in] pointer to static variable structure -// mem_ptr: [in] pointer to allocated memory -// mem_size: [in] size of memory allocated -VIRTUALIZER_RESULT virtualizer_init_mem(virtualizer_lib_t *lib_ptr, virtualizer_static_vars_t* static_vars_ptr, void* mem_ptr, uint32 mem_size); - -// ** Set parameters to library -// lib_ptr: [in, out] pointer to lib structure -// param_id: [in] parameter id -// param_ptr: [in] pointer to the memory where the new values are stored -// param_size:[in] size of the memory pointed by param_ptr -VIRTUALIZER_RESULT virtualizer_set_param(virtualizer_lib_t* lib_ptr, uint32 param_id, void* param_ptr, uint32 param_size); - -// ** Get parameters from library -// lib_ptr: [in] pointer to library structure -// param_id: [in] parameter id -// param_ptr: [out] pointer to the memory where the retrieved value is going to be stored -// param_size:[in] size of the memory pointed by param_ptr -// param_actual_size_ptr: [out] pointer to memory that will hold the actual size of the parameter -VIRTUALIZER_RESULT virtualizer_get_param(virtualizer_lib_t* lib_ptr, uint32 param_id, void* param_ptr, uint32 param_size, uint32 *param_actual_size_ptr); - - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* VIRTUALIZER_API_H */ diff --git a/modules/processing/bassboost/api/api_bassboost.h b/modules/processing/bassboost/api/api_bassboost.h deleted file mode 100644 index 4d847f4d..00000000 --- a/modules/processing/bassboost/api/api_bassboost.h +++ /dev/null @@ -1,136 +0,0 @@ -#ifndef BASS_BOOST_CALIB_H -#define BASS_BOOST_CALIB_H -/*============================================================================== - @file bass_boost_calib.h - @brief This file contains BASS_BOOST API -==============================================================================*/ - -/*======================================================================= -* Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. -* SPDX-License-Identifier: BSD-3-Clause-Clear -=========================================================================*/ - -#include "module_cmn_api.h" - -/** @h2xml_title1 {BASS_BOOST Module API} - @h2xml_title_agile_rev {BASS_BOOST Module API} - @h2xml_title_date {May 30, 2019} */ -/*------------------------------------------------------------------------------ - Module -------------------------------------------------------------------------------*/ -/*============================================================================== - Constants -==============================================================================*/ -#define CAPI_BASSBOOST_MAX_IN_PORTS 1 -#define CAPI_BASS_BOOST_MAX_OUT_PORTS 1 -#define CAPI_BASSBOOST_DEFAULT_PORT 0 -#define BASS_BOOST_STACK_SIZE 4096 - - -/* Global unique Module ID definition - Module library is independent of this number, it defined here for static - loading purpose only */ - -#define MODULE_ID_BASS_BOOST 0x07001062 -/** - @h2xmlm_module {"MODULE_ID_BASS_BOOST", - MODULE_ID_BASS_BOOST} - @h2xmlm_displayName {"Bass Boost"} - @h2xmlm_modSearchKeys{effects, Audio} - @h2xmlm_description {ID of the Bass Boost module.\n - - This module supports the following parameter IDs:\n - - #PARAM_ID_MODULE_ENABLE \n - - #PARAM_ID_BASS_BOOST_MODE\n - - #PARAM_ID_BASS_BOOST_STRENGTH\n - - All parameter IDs are device independent.\n - - Supported Input Media Format:\n -* - Data Format : FIXED_POINT\n -* - fmt_id : Don't care\n -* - Sample Rates : Any (>0)\n -* - Number of channels : 1 to 8\n -* - Channel type : 1 to 63\n -* - Bits per sample : 16, 32\n -* - Q format : 15 for bits per sample = 16 and 27 for bps = 32\n -* - Interleaving : de-interleaved unpacked\n -* - Signed/unsigned : Signed } - - @h2xmlm_toolPolicy {Calibration} - - @h2xmlm_dataMaxInputPorts {CAPI_BASSBOOST_MAX_IN_PORTS} - @h2xmlm_dataInputPorts {IN=2} - @h2xmlm_dataMaxOutputPorts {CAPI_BASS_BOOST_MAX_OUT_PORTS} - @h2xmlm_dataOutputPorts {OUT=1} - @h2xmlm_supportedContTypes {APM_CONTAINER_TYPE_SC} - @h2xmlm_isOffloadable {true} - @h2xmlm_stackSize {BASS_BOOST_STACK_SIZE} - @h2xmlm_ToolPolicy {Calibration} - - @{ <-- Start of the Module --> - @h2xml_Select {"param_id_module_enable_t"} - @h2xmlm_InsertParameter -*/ - -/* ID of the Bass Boost Mode parameter used by MODULE_ID_BASS_BOOST. */ -#define PARAM_ID_BASS_BOOST_MODE 0x0800112C - -/* Structure for the mode parameter of Bass Boost module. */ -typedef struct bass_boost_mode_t bass_boost_mode_t; -/** @h2xmlp_parameter {"PARAM_ID_BASS_BOOST_MODE", PARAM_ID_BASS_BOOST_MODE} - @h2xmlp_description {Configures the bass boost mode} */ - -#include "spf_begin_pack.h" -#include "spf_begin_pragma.h" - -/* Payload of the PARAM_ID_BASS_BOOST_MODE parameter used by the Bass Boost module. */ -struct bass_boost_mode_t -{ - uint32_t bass_boost_mode; - /**< @h2xmle_description {Specifies the bass boost mode. This parameter is device dependent.\n - Physical boost enhances the low frequency contents.\n - Currently, only Physical Boost mode is supported.\n} - - @h2xmle_rangeList {"Physical boost (used by the headphone)"= 0} - @h2xmle_default {0} */ - -} -#include "spf_end_pragma.h" -#include "spf_end_pack.h" -; - - - -/* ID of the Bass Boost Strength parameter used by MODULE_ID_BASS_BOOST. */ -#define PARAM_ID_BASS_BOOST_STRENGTH 0x0800112D - - -/* Structure for the strength parameter of Bass Boost module. */ -typedef struct bass_boost_strength_t bass_boost_strength_t; -/** @h2xmlp_parameter {"PARAM_ID_BASS_BOOST_STRENGTH", PARAM_ID_BASS_BOOST_STRENGTH} - @h2xmlp_description {Specifies the effects of bass boost.} */ - - -#include "spf_begin_pack.h" -#include "spf_begin_pragma.h" - - -/* Payload of the PARAM_ID_BASS_BOOST_STRENGTH parameter used by the Bass Boost module. */ -struct bass_boost_strength_t -{ - uint32_t strength; - /**< @h2xmle_description {Specifies the effects of bass boost. This parameter affects the audio - stream and is device independent.\n} - - @h2xmle_range {0..1000} - @h2xmle_default {1000} */ - -} -#include "spf_end_pragma.h" -#include "spf_end_pack.h" -; - -/** @} <-- End of the Module -->*/ - -#endif diff --git a/modules/processing/bassboost/build/CMakeLists.txt b/modules/processing/bassboost/build/CMakeLists.txt deleted file mode 100644 index d8406e5b..00000000 --- a/modules/processing/bassboost/build/CMakeLists.txt +++ /dev/null @@ -1,46 +0,0 @@ -#[[ - @file CMakeLists.txt - - @brief - - @copyright - Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. - SPDX-License-Identifier: BSD-3-Clause-Clear -]] -cmake_minimum_required(VERSION 3.10) - -set(bass_boost_sources - ${LIB_ROOT}/capi/src/capi_bassboost.cpp - ${LIB_ROOT}/capi/src/capi_bassboost_kpps.cpp - ${LIB_ROOT}/capi/src/capi_bassboost_utils.cpp - ${LIB_ROOT}/lib/src/bassboost.c -) - -set(bass_boost_includes - ${LIB_ROOT}/api - ${LIB_ROOT}/capi/inc - ${LIB_ROOT}/capi/src - ${LIB_ROOT}/lib/inc - ${LIB_ROOT}/lib/src - ${PROJECT_SOURCE_DIR}/modules/cmn/common/utils/inc - ${PROJECT_SOURCE_DIR}/modules/processing/filters/multi_stage_iir/lib/inc - ${PROJECT_SOURCE_DIR}/modules/processing/gain_control/limiter/lib/inc - ${PROJECT_SOURCE_DIR}/modules/processing/gain_control/drc/lib/inc - ${PROJECT_SOURCE_DIR}/fwk/spf/interfaces/module/shared_lib_api/inc/generic -) - -spf_module_sources( - KCONFIG CONFIG_BASS_BOOST - NAME bass_boost - MAJOR_VER 1 - MINOR_VER 0 - AMDB_ITYPE "capi" - AMDB_MTYPE "PP" - AMDB_MID "0x07001062" - AMDB_TAG "capi_bassboost" - AMDB_MOD_NAME "MODULE_ID_BASS_BOOST" - SRCS ${bass_boost_sources} - INCLUDES ${bass_boost_includes} - H2XML_HEADERS "${LIB_ROOT}/api/api_bassboost.h" - CFLAGS "" -) diff --git a/modules/processing/bassboost/capi/inc/capi_bassboost.h b/modules/processing/bassboost/capi/inc/capi_bassboost.h deleted file mode 100644 index cae2af33..00000000 --- a/modules/processing/bassboost/capi/inc/capi_bassboost.h +++ /dev/null @@ -1,41 +0,0 @@ -/* ========================================================================= - * Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. - * SPDX-License-Identifier: BSD-3-Clause-Clear - * =========================================================================*/ - -/** - * @file capi_bassboost.h - * - * Header file to implement the Audio Post Processor Interface for - * acoustic bass enhancement - */ - -#ifndef CAPI_BASSBOOST_H -#define CAPI_BASSBOOST_H - -#include "capi.h" -#include "ar_defs.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Get static properties of bassboost module such as - * memory, stack requirements etc. - * See capi.h for more details. - */ -capi_err_t capi_bassboost_get_static_properties(capi_proplist_t *init_set_properties, - capi_proplist_t *static_properties); - -/** - * Instantiates(and allocates) the module memory. - * See capi.h for more details. - */ -capi_err_t capi_bassboost_init(capi_t *_pif, capi_proplist_t *init_set_properties); - -#ifdef __cplusplus -} -#endif - -#endif /* CAPI_BASSBOOST_H */ diff --git a/modules/processing/bassboost/capi/src/capi_bassboost.cpp b/modules/processing/bassboost/capi/src/capi_bassboost.cpp deleted file mode 100644 index 6516cb0a..00000000 --- a/modules/processing/bassboost/capi/src/capi_bassboost.cpp +++ /dev/null @@ -1,543 +0,0 @@ -/* ========================================================================= - * Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. - * SPDX-License-Identifier: BSD-3-Clause-Clear - * =========================================================================*/ - -/** - * @file capi_bassboost.cpp - * - * C source file to implement the Audio Post Processor Interface for - * Acoustic Bass Enhancement - * (library version: - * AUDIO_SYSTEM_BASSBOOST_UNIT_TEST_RELEASE_1.2_3.1.0_08.05.2016) - */ - -#define BASSBOOST_MAX_STRENGTH 1000 -#define BASSBOOST_MIN_STRENGTH 0 -#include "capi_bassboost_utils.h" - -static capi_err_t capi_bassboost_process(capi_t * _pif, - capi_stream_data_t *input[], - capi_stream_data_t *output[]); - -static capi_err_t capi_bassboost_end(capi_t *_pif); - -static capi_err_t capi_bassboost_set_param(capi_t * _pif, - uint32_t param_id, - const capi_port_info_t *port_info_ptr, - capi_buf_t * params_ptr); - -static capi_err_t capi_bassboost_get_param(capi_t * _pif, - uint32_t param_id, - const capi_port_info_t *port_info_ptr, - capi_buf_t * params_ptr); - -static capi_err_t capi_bassboost_set_properties(capi_t *_pif, capi_proplist_t *props_ptr); - -static capi_err_t capi_bassboost_get_properties(capi_t *_pif, capi_proplist_t *props_ptr); - -static capi_vtbl_t vtbl = { capi_bassboost_process, capi_bassboost_end, - capi_bassboost_set_param, capi_bassboost_get_param, - capi_bassboost_set_properties, capi_bassboost_get_properties }; - -/* ------------------------------------------------------------------------- - * Function name: capi_bassboost_get_static_properties - * Capi_v2 BassBoost function to get the static properties - * -------------------------------------------------------------------------*/ -capi_err_t capi_bassboost_get_static_properties(capi_proplist_t *init_set_properties, - capi_proplist_t *static_properties) -{ - capi_err_t capi_result = CAPI_EOK; - - if (NULL != static_properties) - { - capi_result = capi_bassboost_process_get_properties((capi_bassboost_t *)NULL, static_properties); - if (CAPI_FAILED(capi_result)) - { - BASSBOOST_MSG(MIID_UNKNOWN, DBG_HIGH_PRIO, "CAPI BassBoost: get static properties failed!"); - return capi_result; - } - } - else - { - BASSBOOST_MSG(MIID_UNKNOWN, DBG_ERROR_PRIO, "CAPI BassBoost: Get static properties received bad pointer, 0x%p", static_properties); - } - - return capi_result; -} - -/*------------------------------------------------------------------------ - Function name: capi_bassboost_init - Initialize the CAPIv2 BassBosst library. This function can allocate memory. - * -----------------------------------------------------------------------*/ - -capi_err_t capi_bassboost_init(capi_t *_pif, capi_proplist_t *init_set_properties) -{ - capi_err_t capi_result = CAPI_EOK; - - if (NULL == _pif || NULL == init_set_properties) - { - BASSBOOST_MSG(MIID_UNKNOWN, DBG_ERROR_PRIO, "CAPI BassBoost: Init received bad pointer, 0x%p, 0x%p", _pif, init_set_properties); - - CAPI_SET_ERROR(capi_result, CAPI_EBADPARAM); - return capi_result; - } - - capi_bassboost_t *me_ptr = (capi_bassboost_t *)_pif; - - memset(me_ptr, 0, sizeof(capi_bassboost_t)); - - me_ptr->lib_instance.mem_ptr = NULL; - me_ptr->vtbl.vtbl_ptr = &vtbl; - capi_bassboost_init_media_fmt(me_ptr); - me_ptr->events_config.kpps = 0; - me_ptr->events_config.code_bw = 0; - me_ptr->events_config.data_bw = BASS_BOOST_BY_PASS_BW; - me_ptr->events_config.delay_in_us = 0; - me_ptr->events_config.enable = TRUE; - - if (NULL != init_set_properties) - { - capi_result |= capi_bassboost_process_set_properties(me_ptr, init_set_properties); - capi_result ^= (capi_result & CAPI_EUNSUPPORTED); - if (CAPI_FAILED(capi_result)) - { - BASSBOOST_MSG(me_ptr->miid, DBG_ERROR_PRIO, "CAPI BassBoost: Init Set Property Failed"); - return capi_result; - } - } - // capi_bassboost_raise_event(me_ptr); - BASSBOOST_MSG(me_ptr->miid, DBG_HIGH_PRIO, "CAPI BassBoost: Initialization completed !!"); - return capi_result; -} - -/* ------------------------------------------------------------------------- - * Function name: capi_bassboost_process - * BassBoost Data Process function to process an input buffer - * and generates an output buffer. - * -------------------------------------------------------------------------*/ -static capi_err_t capi_bassboost_process(capi_t * _pif, - capi_stream_data_t *input[], - capi_stream_data_t *output[]) -{ - BASSBOOST_RESULT lib_result = BASSBOOST_SUCCESS; - capi_err_t capi_result = CAPI_EOK; - - capi_bassboost_t *me_ptr = (capi_bassboost_t *)_pif; - - POSAL_ASSERT(me_ptr); - POSAL_ASSERT(input[0]); - POSAL_ASSERT(output[0]); - POSAL_ASSERT(me_ptr->lib_static_vars.num_chs <= (int32)(input[0]->bufs_num)); - POSAL_ASSERT(me_ptr->lib_static_vars.num_chs <= (int32)(output[0]->bufs_num)); - - void *inp_ptrs[BASS_BOOST_MAX_CHANNELS]; - void *out_ptrs[BASS_BOOST_MAX_CHANNELS]; - - int32 byte_sample_convert = (16 == me_ptr->lib_static_vars.data_width) ? 1 : 2; - // one port only, one input and one output - uint32_t port = 0; - - if (me_ptr->is_disabled == TRUE) - { - me_ptr->is_disabled = FALSE; - for(uint32_t inch = 0; inch < input[0]->bufs_num; inch++) - { - input[0]->buf_ptr[inch].actual_data_len = 0; - } - for(uint32_t outch = 0; outch < output[0]->bufs_num; outch++) - { - output[0]->buf_ptr[outch].actual_data_len = 0; - } - capi_bassboost_update_raise_event(me_ptr); - return CAPI_EOK; - } - -#ifdef DO_BASSBOOST_PROFILING - me_ptr->kpps_profile_data.start_cycles = q6sim_read_cycles(); -#endif - - int32_t input_num_samples = input[port]->buf_ptr[0].actual_data_len >> (byte_sample_convert); - int32_t output_num_samples = output[port]->buf_ptr[0].max_data_len >> (byte_sample_convert); - int32_t num_samples_to_process = s32_min_s32_s32(input_num_samples, output_num_samples); - int32_t samples_to_process = num_samples_to_process; - int32_t samples_processed = 0; - while (samples_to_process > 0) - { - int32_t samples = s32_min_s32_s32(samples_to_process, me_ptr->lib_static_vars.max_block_size); - - for (int32_t ch = 0; ch < me_ptr->lib_static_vars.num_chs; ch++) - { - inp_ptrs[ch] = (void *)(input[port]->buf_ptr[ch].data_ptr + (samples_processed << byte_sample_convert)); - out_ptrs[ch] = (void *)(output[port]->buf_ptr[ch].data_ptr + (samples_processed << byte_sample_convert)); - } - - lib_result = bassboost_process(&(me_ptr->lib_instance), out_ptrs, inp_ptrs, samples); - if (BASSBOOST_SUCCESS != lib_result) - { - BASSBOOST_MSG(me_ptr->miid, DBG_ERROR_PRIO, "CAPI BassBoost: library process failed"); - CAPI_SET_ERROR(capi_result, CAPI_EFAILED); - return capi_result; - } - samples_processed += samples; - samples_to_process -= samples; - } - - for (int32_t ch = 0; ch < me_ptr->lib_static_vars.num_chs; ch++) - { - output[port]->buf_ptr[ch].actual_data_len = (num_samples_to_process << byte_sample_convert); - input[port]->buf_ptr[ch].actual_data_len = (num_samples_to_process << byte_sample_convert); - } - /* check if x-fading is done to update the KPPS when BB is disabled. */ - if (0 == me_ptr->lib_config.enable) - { - bassboost_crossfade_t x_fade_flag = 0; - uint32_t lib_actual_size = 0; - - lib_result = bassboost_get_param(&(me_ptr->lib_instance), - BASSBOOST_PARAM_CROSSFADE_FLAG, - (void *)&x_fade_flag, - (uint32)sizeof(x_fade_flag), - (uint32 *)&lib_actual_size); - - if ((BASSBOOST_SUCCESS != lib_result) || (0 == lib_actual_size)) - { - BASSBOOST_MSG(me_ptr->miid, DBG_ERROR_PRIO, "CAPI BassBoost: Get of xfade_flag failed"); - CAPI_SET_ERROR(capi_result, CAPI_EFAILED); - return capi_result; - } - if (0 == x_fade_flag) - { - me_ptr->events_config.code_bw = 0; - if ((me_ptr->lib_static_vars.sample_rate > 48000) || (me_ptr->lib_static_vars.num_chs > 2)) - { - me_ptr->events_config.data_bw = BASS_BOOST_BY_PASS_BW; - } - else - { - me_ptr->events_config.data_bw = BASS_BOOST_BY_PASS_BW_HIGH; - } - me_ptr->is_disabled = TRUE; - - // capi_bassboost_update_raise_event(me_ptr); - } - } - - output[0]->flags = input[0]->flags; - if (input[0]->flags.is_timestamp_valid) - { - output[0]->timestamp = input[0]->timestamp - me_ptr->events_config.delay_in_us; - } - -#ifdef DO_BASSBOOST_PROFILING - me_ptr->kpps_profile_data.end_cycles = q6sim_read_cycles(); - capi_bassboost_profiling(me_ptr, num_samples_to_process); -#endif - return capi_result; -} - -/* ------------------------------------------------------------------------- - * Function name: capi_bassboost_end - * Bass-boost close functions, returns the library to the uninitialized - * state and frees all the memory that was allocated. This function also - * frees the virtual function table. - * -------------------------------------------------------------------------*/ -static capi_err_t capi_bassboost_end(capi_t *_pif) -{ - capi_err_t capi_result = CAPI_EOK; - if (NULL == _pif) - { - BASSBOOST_MSG(MIID_UNKNOWN, DBG_ERROR_PRIO, "CAPI BassBoost: End received bad pointer, 0x%p", _pif); - CAPI_SET_ERROR(capi_result, CAPI_EBADPARAM); - return capi_result; - } - - capi_bassboost_t *me_ptr = (capi_bassboost_t *)_pif; - uint32_t temp_miid = me_ptr->miid; -#ifdef DO_BASSBOOST_PROFILING - capi_bassboost_print_kpps(me_ptr); -#endif - if (NULL != me_ptr->lib_instance.mem_ptr) - { - posal_memory_free(me_ptr->lib_instance.mem_ptr); - me_ptr->lib_instance.mem_ptr = NULL; - } - - me_ptr->lib_mem_req.mem_size = 0; - me_ptr->vtbl.vtbl_ptr = NULL; - - BASSBOOST_MSG(temp_miid, DBG_HIGH_PRIO, "CAPI BassBoost: End done"); - return capi_result; -} - -/* ------------------------------------------------------------------------- - * Function name: capi_bassboost_set_param - * Sets either a parameter value or a parameter structure containing - * multiple parameters. In the event of a failure, the appropriate error - * code is returned. - * -------------------------------------------------------------------------*/ -static capi_err_t capi_bassboost_set_param(capi_t * _pif, - uint32_t param_id, - const capi_port_info_t *port_info_ptr, - capi_buf_t * params_ptr) -{ - capi_err_t capi_result = CAPI_EOK; - if (NULL == _pif || NULL == params_ptr) - { - BASSBOOST_MSG(MIID_UNKNOWN, DBG_ERROR_PRIO, "CAPI BassBoost: set param received bad pointer, 0x%p, 0x%p", _pif, params_ptr); - CAPI_SET_ERROR(capi_result, CAPI_EBADPARAM); - return capi_result; - } - capi_bassboost_t *me_ptr = (capi_bassboost_t *)(_pif); - int8_t * param_payload_ptr = (int8_t *)(params_ptr->data_ptr); - uint32_t param_size = params_ptr->actual_data_len; - - switch (param_id) - { - case PARAM_ID_MODULE_ENABLE: - { - if (param_size >= sizeof(param_id_module_enable_t)) - { - param_id_module_enable_t *enable_ptr = (param_id_module_enable_t *)param_payload_ptr; - me_ptr->lib_config.enable = (0 == enable_ptr->enable) ? 0 : 1; - me_ptr->lib_config.is_enable_set = TRUE; - - capi_result = capi_bassboost_check_set_param(me_ptr, - BASSBOOST_PARAM_ENABLE, - (void *)&(me_ptr->lib_config.enable), - (uint32_t)sizeof(me_ptr->lib_config.enable), - (uint32_t)sizeof(bassboost_enable_t)); - if (CAPI_SUCCEEDED(capi_result)) - { - BASSBOOST_MSG(me_ptr->miid, DBG_HIGH_PRIO, "CAPI BassBoost: Set enable: %ld", me_ptr->lib_config.enable); - if (me_ptr->lib_config.enable && me_ptr->lib_instance.mem_ptr != NULL) - { - capi_bassboost_update_raise_event(me_ptr); - } - } - } - } - break; - - case PARAM_ID_BASS_BOOST_MODE: - { - bass_boost_mode_t *mode_ptr = (bass_boost_mode_t *)param_payload_ptr; - me_ptr->lib_config.mode = mode_ptr->bass_boost_mode; - me_ptr->lib_config.is_mode_set = TRUE; - bassboost_mode_t mode = (bassboost_mode_t)(mode_ptr->bass_boost_mode); - capi_result = capi_bassboost_check_set_param(me_ptr, - BASSBOOST_PARAM_MODE, - (void *)&(mode), - (uint32_t)sizeof(mode), - (uint32_t)sizeof(bassboost_mode_t)); - if (CAPI_SUCCEEDED(capi_result)) - { - BASSBOOST_MSG(me_ptr->miid, DBG_HIGH_PRIO, "CAPI BassBoost: set mode %lu", me_ptr->lib_config.mode); - } - } - break; - - case PARAM_ID_BASS_BOOST_STRENGTH: - { - - bass_boost_strength_t *strength_ptr = (bass_boost_strength_t *)param_payload_ptr; - me_ptr->lib_config.strength = strength_ptr->strength; - me_ptr->lib_config.is_strength_set = TRUE; - bassboost_strength_t strength = (bassboost_strength_t)(strength_ptr->strength); - - if (strength >= BASSBOOST_MIN_STRENGTH && strength <= BASSBOOST_MAX_STRENGTH) - { - capi_result = capi_bassboost_check_set_param(me_ptr, - BASSBOOST_PARAM_STRENGTH, - (void *)&(strength), - (uint32_t)sizeof(strength), - (uint32_t)sizeof(bassboost_strength_t)); - if (CAPI_SUCCEEDED(capi_result)) - { - BASSBOOST_MSG(me_ptr->miid, DBG_HIGH_PRIO, "CAPI BassBoost: set strength %ld", me_ptr->lib_config.strength); - } - } - else - { - - return CAPI_EBADPARAM; - } - } - break; - - default: - { - BASSBOOST_MSG(me_ptr->miid, DBG_ERROR_PRIO, "CAPI BassBoost: Set unsupported parameter ID %#x", (int)param_id); - CAPI_SET_ERROR(capi_result, CAPI_EBADPARAM); - } - } - return capi_result; -} - -/* ------------------------------------------------------------------------- - * Function name: capi_bassboost_get_param - * Gets either a parameter value or a parameter structure containing - * multiple parameters. In the event of a failure, the appropriate error - * code is returned. - * -------------------------------------------------------------------------*/ -static capi_err_t capi_bassboost_get_param(capi_t * _pif, - uint32_t param_id, - const capi_port_info_t *port_info_ptr, - capi_buf_t * params_ptr) -{ - capi_err_t capi_result = CAPI_EOK; - if (NULL == _pif || NULL == params_ptr) - { - BASSBOOST_MSG(MIID_UNKNOWN, DBG_ERROR_PRIO, "CAPI BassBoost: Get param received bad pointer, 0x%p, 0x%p", _pif, params_ptr); - return CAPI_EBADPARAM; - } - - capi_bassboost_t *me_ptr = (capi_bassboost_t *)_pif; - switch (param_id) - { - case PARAM_ID_MODULE_ENABLE: - { - if (params_ptr->max_data_len >= sizeof(param_id_module_enable_t)) - { - param_id_module_enable_t *enable_ptr = (param_id_module_enable_t *)(params_ptr->data_ptr); - - bassboost_enable_t enable_flag = 0; - uint32_t lib_actual_size = 0; - - capi_result = capi_bassboost_check_get_param(me_ptr, - BASSBOOST_PARAM_ENABLE, - (void *)&enable_flag, - (uint32_t)sizeof(enable_flag), - (uint32_t)sizeof(bassboost_enable_t), - &lib_actual_size); - if ((CAPI_FAILED(capi_result)) || (0 == lib_actual_size)) - { - params_ptr->actual_data_len = lib_actual_size; - return capi_result; - } - enable_ptr->enable = (uint32_t)enable_flag; - params_ptr->actual_data_len = (uint32_t)sizeof(enable_ptr->enable); - } - else - { - BASSBOOST_MSG(me_ptr->miid, DBG_ERROR_PRIO, "CAPI BassBoost: get enable need more memory"); - CAPI_SET_ERROR(capi_result, CAPI_ENEEDMORE); - } - } - break; - - case PARAM_ID_BASS_BOOST_MODE: - { - if (params_ptr->max_data_len >= sizeof(bass_boost_mode_t)) - { - bass_boost_mode_t *mode_ptr = (bass_boost_mode_t *)(params_ptr->data_ptr); - - /* currently the library only supports PHYSICAL_BOOST */ - bassboost_mode_t mode = PHYSICAL_BOOST; - uint32_t lib_actual_size = 0; - - capi_result = capi_bassboost_check_get_param(me_ptr, - BASSBOOST_PARAM_MODE, - (void *)&mode, - (uint32_t)sizeof(mode), - (uint32_t)sizeof(bassboost_mode_t), - &lib_actual_size); - if ((CAPI_FAILED(capi_result)) || (0 == lib_actual_size)) - { - params_ptr->actual_data_len = lib_actual_size; - return capi_result; - } - mode_ptr->bass_boost_mode = (uint32_t)mode; - params_ptr->actual_data_len = (uint32_t)sizeof(mode_ptr->bass_boost_mode); - } - else - { - BASSBOOST_MSG(me_ptr->miid, DBG_ERROR_PRIO, "CAPI BassBoost: get mode need more memory"); - CAPI_SET_ERROR(capi_result, CAPI_ENEEDMORE); - } - } - break; - - case PARAM_ID_BASS_BOOST_STRENGTH: - { - if (params_ptr->max_data_len >= sizeof(bass_boost_strength_t)) - { - - bass_boost_strength_t *strength_ptr = (bass_boost_strength_t *)(params_ptr->data_ptr); - - bassboost_strength_t strength = 1000; // default strength - uint32_t lib_actual_size = 0; - - capi_result = capi_bassboost_check_get_param(me_ptr, - BASSBOOST_PARAM_STRENGTH, - (void *)&strength, - (uint32_t)sizeof(strength), - (uint32_t)sizeof(bassboost_strength_t), - &lib_actual_size); - if ((CAPI_FAILED(capi_result)) || (0 == lib_actual_size)) - { - params_ptr->actual_data_len = lib_actual_size; - return capi_result; - } - - strength_ptr->strength = (uint32_t)strength; - params_ptr->actual_data_len = (uint32_t)sizeof(strength_ptr->strength); - } - else - { - BASSBOOST_MSG(me_ptr->miid, DBG_ERROR_PRIO, "CAPI BassBoost: get strength needs more memory"); - CAPI_SET_ERROR(capi_result, CAPI_ENEEDMORE); - } - } - break; - - default: - { - BASSBOOST_MSG(me_ptr->miid, DBG_ERROR_PRIO, "CAPI BassBoost: Get unsupported param ID %#x", (int)param_id); - CAPI_SET_ERROR(capi_result, CAPI_EBADPARAM); - } - } - return capi_result; -} - -/* ------------------------------------------------------------------------- - * Function name: capi_bassboost_set_properties - * Function to set the properties of Bassboost module - * -------------------------------------------------------------------------*/ -static capi_err_t capi_bassboost_set_properties(capi_t *_pif, capi_proplist_t *props_ptr) -{ - capi_err_t capi_result = CAPI_EOK; - if (NULL == _pif) - { - BASSBOOST_MSG(MIID_UNKNOWN, DBG_ERROR_PRIO, "CAPI BassBoost: Set properties received bad pointer, 0x%p", _pif); - CAPI_SET_ERROR(capi_result, CAPI_EBADPARAM); - return capi_result; - } - - capi_bassboost_t *me_ptr = (capi_bassboost_t *)_pif; - - capi_result |= capi_bassboost_process_set_properties(me_ptr, props_ptr); - - return capi_result; -} - -/* ------------------------------------------------------------------------- - * Function name: capi_bassboost_get_properties - * Function to get the properties of Bass-boost module - * -------------------------------------------------------------------------*/ -static capi_err_t capi_bassboost_get_properties(capi_t *_pif, capi_proplist_t *props_ptr) -{ - capi_err_t capi_result = CAPI_EOK; - if (NULL == _pif) - { - BASSBOOST_MSG(MIID_UNKNOWN, DBG_ERROR_PRIO, "CAPI BassBoost: Get properties received bad pointer, 0x%p", _pif); - CAPI_SET_ERROR(capi_result, CAPI_EBADPARAM); - return capi_result; - } - - capi_bassboost_t *me_ptr = (capi_bassboost_t *)_pif; - - capi_result |= capi_bassboost_process_get_properties(me_ptr, props_ptr); - - return capi_result; -} diff --git a/modules/processing/bassboost/capi/src/capi_bassboost_kpps.cpp b/modules/processing/bassboost/capi/src/capi_bassboost_kpps.cpp deleted file mode 100644 index f88f6925..00000000 --- a/modules/processing/bassboost/capi/src/capi_bassboost_kpps.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* ========================================================================= - * Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. - * SPDX-License-Identifier: BSD-3-Clause-Clear - ========================================================================== */ - -#include "capi_bassboost_utils.h" - -#define NUM_GENERAL_FREQUENCIES 12 - -static const uint32_t freq_array[] = { 8000, 11025, 16000, 22050, 32000, 44100, - 48000, 64000, 88200, 96000, 176400, 192000 }; - -static const uint32_t bassboost_kpps_table_enable[2][BASS_BOOST_MAX_CHANNELS][NUM_GENERAL_FREQUENCIES] = - { { { 478, 637, 896, 1213, 1786, 2422, 2627, 3519, 4846, 5258, 9730, 10574 }, - { 955, 1279, 1808, 2455, 3610, 4907, 5324, 7129, 9824, 10662, 19731, 21437 }, - { 1392, 1868, 2646, 3594, 5285, 7190, 7801, 10453, 14415, 15648, 29080, 31610 }, - { 1799, 2409, 3404, 4621, 6796, 9239, 10024, 13421, 18490, 20064, 37082, 40265 }, - { 2233, 2995, 4235, 5753, 8461, 11509, 12487, 16718, 23042, 25007, 46256, 50226 }, - { 2655, 3560, 5038, 6846, 10068, 13694, 14859, 19901, 27432, 29773, 55122, 59884 }, - { 3074, 4124, 5833, 7926, 11657, 15858, 17205, 23038, 31757, 34465, 63769, 69248 }, - { 3477, 4667, 6601, 8973, 13195, 17953, 19476, 26085, 35965, 39028, 72270, 78496 } }, - { { 484, 650, 927, 1267, 1863, 2533, 2749, 3679, 5062, 5495, 10129, 10999 }, - { 984, 1328, 1900, 2605, 3825, 5214, 5662, 7570, 10425, 11322, 20866, 22667 }, - { 1452, 1971, 2844, 3876, 5678, 7744, 8411, 11248, 15491, 16825, 31042, 33732 }, - { 1844, 2487, 3550, 4851, 7145, 9763, 10601, 14174, 19519, 21197, 39072, 42434 }, - { 2296, 3104, 4437, 6078, 8953, 12215, 13265, 17732, 24428, 26530, 48910, 53113 }, - { 2739, 3706, 5310, 7291, 10706, 14604, 15860, 21207, 29210, 31725, 58514, 63554 }, - { 3168, 4281, 6127, 8395, 12364, 16864, 18314, 24488, 33726, 36629, 67528, 73359 }, - { 3593, 4862, 6968, 9567, 14051, 19167, 20815, 27834, 38337, 41640, 76794, 83424 } } }; - -static const uint32_t bassboost_kpps_table_disable[2][BASS_BOOST_MAX_CHANNELS][NUM_GENERAL_FREQUENCIES] = - { { { 23, 24, 25, 31, 35, 37, 43, 52, 55, 67, 85, 91 }, - { 31, 34, 37, 48, 58, 61, 72, 90, 96, 120, 156, 168 }, - { 40, 44, 49, 67, 80, 85, 102, 130, 139, 174, 229, 247 }, - { 49, 54, 61, 84, 103, 108, 132, 169, 180, 228, 301, 324 }, - { 56, 63, 71, 102, 125, 132, 162, 207, 221, 281, 372, 402 }, - { 66, 73, 84, 120, 148, 156, 191, 246, 264, 335, 444, 480 }, - { 75, 83, 95, 137, 170, 179, 221, 285, 305, 389, 516, 557 }, - { 83, 93, 107, 155, 192, 203, 251, 324, 347, 443, 587, 635 } }, - { { 23, 26, 31, 47, 59, 63, 79, 103, 111, 143, 191, 207 }, - { 33, 39, 49, 81, 105, 113, 145, 193, 209, 273, 370, 401 }, - { 42, 52, 66, 114, 151, 162, 210, 283, 306, 402, 548, 594 }, - { 52, 64, 84, 148, 196, 212, 276, 373, 404, 532, 725, 788 }, - { 61, 77, 101, 181, 242, 261, 341, 462, 501, 661, 903, 981 }, - { 71, 89, 119, 215, 287, 311, 406, 552, 599, 790, 1081, 1175 }, - { 80, 101, 136, 248, 333, 360, 472, 641, 696, 920, 1259, 1368 }, - { 89, 114, 153, 281, 378, 409, 537, 731, 793, 1049, 1437, 1561 } } - - }; - -static inline int32_t get_frequency_index(uint32_t freq) -{ - int16 i = 0; - for (i = 0; i < NUM_GENERAL_FREQUENCIES; i++) - { - if (freq == freq_array[i]) - return i; - } - return -1; -} - -static inline int32_t get_channel_index(uint32_t num_ch) -{ - return (num_ch - 1); -} - -uint32_t capi_bassboost_get_kpps(capi_bassboost_t *me_ptr) -{ - const uint32_t numChan = me_ptr->input_media_fmt[0].format.num_channels; - const uint32_t Freq = me_ptr->input_media_fmt[0].format.sampling_rate; - uint32_t bits_per_sample = me_ptr->input_media_fmt[0].format.bits_per_sample; - - int32_t ch_index = get_channel_index(numChan); - int32_t freq_index = get_frequency_index(Freq); - int32_t bps_index = (bits_per_sample == 16) ? 0 : 1; - uint32_t kpps = 0; - - if ((freq_index >= 0) && (ch_index >= 0)) - { - if ((me_ptr->lib_config.enable) && (me_ptr->lib_instance.mem_ptr != NULL)) - { - kpps = bassboost_kpps_table_enable[bps_index][ch_index][freq_index]; - } - else - { - kpps = bassboost_kpps_table_disable[bps_index][ch_index][freq_index]; - } - } - - return kpps; -} diff --git a/modules/processing/bassboost/capi/src/capi_bassboost_utils.cpp b/modules/processing/bassboost/capi/src/capi_bassboost_utils.cpp deleted file mode 100644 index 998419ea..00000000 --- a/modules/processing/bassboost/capi/src/capi_bassboost_utils.cpp +++ /dev/null @@ -1,775 +0,0 @@ -/* ========================================================================= - * Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. - * SPDX-License-Identifier: BSD-3-Clause-Clear - * =========================================================================*/ - -/** - * @file capi_bassboost_utils.cpp - * - * C source file to implement the Audio Post Processor Interface for - * Acoustic Bass Enhancement - */ - -#include "capi_bassboost_utils.h" - -static void capi_bassboost_update_event_states(capi_bassboost_t *me_ptr); -void capi_bassboost_init_media_fmt(capi_bassboost_t *me_ptr); - -static bool_t bassboost_is_supported_media_type(const capi_media_fmt_v2_t *format_ptr) -{ - if (CAPI_FIXED_POINT != format_ptr->header.format_header.data_format) - { - AR_MSG(DBG_ERROR_PRIO, - "CAPI BassBoost: unsupported data format %lu", - (uint32_t)format_ptr->header.format_header.data_format); - return FALSE; - } - - if ((16 != format_ptr->format.bits_per_sample) && (32 != format_ptr->format.bits_per_sample)) - { - AR_MSG(DBG_ERROR_PRIO, - "CAPI BassBoost: only supports 16 and 32 bit data. Received %lu.", - format_ptr->format.bits_per_sample); - return FALSE; - } - - if (CAPI_INTERLEAVED == format_ptr->format.data_interleaving) - { - AR_MSG(DBG_ERROR_PRIO, "CAPI BassBoost: Interleaved data not supported."); - return FALSE; - } - - if (!format_ptr->format.data_is_signed) - { - AR_MSG(DBG_ERROR_PRIO, "CAPI BassBoost: Unsigned data not supported."); - return FALSE; - } - - if ((0 >= format_ptr->format.sampling_rate) - || (BASSBOOST_MAX_SAMPLE_RATE < format_ptr->format.sampling_rate)) - { - AR_MSG(DBG_ERROR_PRIO, "CAPI BassBoost: Sampling rate not supported"); - return FALSE; - } - - switch (format_ptr->format.num_channels) - { - case 0: - AR_MSG(DBG_ERROR_PRIO, "CAPI BassBoost: Zero channels passed."); - return FALSE; - - case 1: - if (PCM_CHANNEL_C != format_ptr->format.channel_type[0]) - { - AR_MSG(DBG_ERROR_PRIO, "CAPI BassBoost:: Unsupported Mono channel mapping."); - return FALSE; - } - break; - - case 2: - if ((PCM_CHANNEL_L != format_ptr->format.channel_type[0]) || - (PCM_CHANNEL_R != format_ptr->format.channel_type[1])) - { - AR_MSG(DBG_ERROR_PRIO, "CAPI BassBoost: Unsupported Stereo channel mapping."); - return FALSE; - } - break; - - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - break; - - default: - AR_MSG(DBG_ERROR_PRIO, - "CAPI BassBoost: Only upto 8 channels supported. Received %lu.", - format_ptr->format.num_channels); - return FALSE; - } - - return TRUE; -} - -void capi_bassboost_init_media_fmt(capi_bassboost_t *me_ptr) -{ - capi_media_fmt_v2_t *media_fmt_ptr = &(me_ptr->input_media_fmt[0]); - - media_fmt_ptr->header.format_header.data_format = CAPI_FIXED_POINT; - media_fmt_ptr->format.bits_per_sample = 16; - media_fmt_ptr->format.minor_version = 16; - media_fmt_ptr->format.bitstream_format = CAPI_DATA_FORMAT_INVALID_VAL; - media_fmt_ptr->format.data_interleaving = CAPI_DEINTERLEAVED_UNPACKED; - media_fmt_ptr->format.data_is_signed = 1; - media_fmt_ptr->format.num_channels = CAPI_DATA_FORMAT_INVALID_VAL; - media_fmt_ptr->format.q_factor = PCM_Q_FACTOR_15; - media_fmt_ptr->format.sampling_rate = CAPI_DATA_FORMAT_INVALID_VAL; - - for (uint32_t j = 0; j < CAPI_MAX_CHANNELS_V2; j++) - { - media_fmt_ptr->format.channel_type[j] = (uint16_t)CAPI_DATA_FORMAT_INVALID_VAL; - } -} -/* ========================================================================= - * FUNCTION : capi_bassboost_update_event_states - * DESCRIPTION: Function to update the event states to update using the - * callback function - * =========================================================================*/ -static void capi_bassboost_update_event_states(capi_bassboost_t *me_ptr) -{ - me_ptr->events_config.enable = me_ptr->lib_config.enable; - me_ptr->events_config.kpps = capi_bassboost_get_kpps(me_ptr); - me_ptr->events_config.code_bw = 0; - /*Honest B/W votes based on sampling rate and channels independently*/ - me_ptr->events_config.data_bw = BASS_BOOST_BW_LOW; - - if ((me_ptr->lib_static_vars.sample_rate <= 48000) && (me_ptr->lib_static_vars.num_chs > 2)) - { - me_ptr->events_config.data_bw = BASS_BOOST_BW_CH_GREATER_THAN_2; - } - else if ((me_ptr->lib_static_vars.sample_rate > 48000) && (me_ptr->lib_static_vars.num_chs <= 2)) - { - me_ptr->events_config.data_bw = BASS_BOOST_BW_FS_GREATER_THAN_48K; - } - else if ((me_ptr->lib_static_vars.sample_rate > 48000) && (me_ptr->lib_static_vars.num_chs > 2)) - { - me_ptr->events_config.data_bw = BASS_BOOST_BW_HIGHEST; - } - bassboost_delay_t delay = 0; - uint32_t actual_size_ptr = 0; - BASSBOOST_RESULT lib_result = BASSBOOST_SUCCESS; - if (me_ptr->lib_instance.mem_ptr) - { - lib_result = bassboost_get_param(&(me_ptr->lib_instance), - BASSBOOST_PARAM_DELAY, - &delay, - sizeof(bassboost_delay_t), - &actual_size_ptr); - if (BASSBOOST_SUCCESS != lib_result) - { - delay = 0; - } - } - me_ptr->events_config.delay_in_us = 0; - if (me_ptr->lib_static_vars.sample_rate) - { - me_ptr->events_config.delay_in_us = - (uint32_t)(((uint64_t)delay * 1000000) / (me_ptr->lib_static_vars.sample_rate)); - } -} - -/* ========================================================================= - * FUNCTION : capi_bassboost_raise_event - * DESCRIPTION: Function to raise various events of the bass boost module - * =========================================================================*/ -capi_err_t capi_bassboost_update_raise_event(capi_bassboost_t *me_ptr) -{ - capi_err_t capi_result = CAPI_EOK; - if (NULL == me_ptr->cb_info.event_cb) - { - BASSBOOST_MSG(me_ptr->miid, DBG_ERROR_PRIO, - "CAPI BassBoost: Event callback is not set. Unable to raise " - "events!"); - CAPI_SET_ERROR(capi_result, CAPI_EUNSUPPORTED); - return capi_result; - } - capi_bassboost_update_event_states(me_ptr); - capi_result |= capi_cmn_update_process_check_event(&me_ptr->cb_info, me_ptr->events_config.enable); - capi_result |= capi_cmn_update_kpps_event(&me_ptr->cb_info, me_ptr->events_config.kpps); - capi_result |= - capi_cmn_update_bandwidth_event(&me_ptr->cb_info, me_ptr->events_config.code_bw, me_ptr->events_config.data_bw); - capi_result |= capi_cmn_update_algo_delay_event(&me_ptr->cb_info, me_ptr->events_config.delay_in_us); - - return capi_result; -} - -/* ========================================================================= - * FUNCTION : capi_bassboost_check_get_cached_param - * DESCRIPTION: Function to get the cached configuration parameters from - * the Bassboost config - * =========================================================================*/ -static capi_err_t capi_bassboost_check_get_cached_param(capi_bassboost_t *me_ptr, - uint32_t param_id, - void * param_ptr, - uint32_t max_data_len, - uint32_t required_size, - uint32_t * actual_size_ptr) -{ - capi_err_t capi_result = CAPI_EOK; - - if (max_data_len >= required_size) - { - switch (param_id) - { - case BASSBOOST_PARAM_MODE: - { - bass_boost_mode_t *mode_ptr = (bass_boost_mode_t *)(param_ptr); - mode_ptr->bass_boost_mode = me_ptr->lib_config.mode; - *actual_size_ptr = (uint32_t)sizeof(mode_ptr->bass_boost_mode); - break; - } - - case BASSBOOST_PARAM_STRENGTH: - { - bass_boost_strength_t *strength_ptr = (bass_boost_strength_t *)(param_ptr); - strength_ptr->strength = me_ptr->lib_config.strength; - *actual_size_ptr = (uint32_t)sizeof(strength_ptr->strength); - break; - } - } - } - else - { - BASSBOOST_MSG(me_ptr->miid, DBG_ERROR_PRIO, "CAPI BassBoost: Get param needs more memory"); - CAPI_SET_ERROR(capi_result, CAPI_ENEEDMORE); - } - - return capi_result; -} - -/* ========================================================================= - * FUNCTION : capi_bassboost_check_get_param - * DESCRIPTION: Function to get the configuration parameters from the - * Bassbosst library - * =========================================================================*/ -capi_err_t capi_bassboost_check_get_param(capi_bassboost_t *me_ptr, - uint32_t param_id, - void * param_ptr, - uint32_t max_data_len, - uint32_t required_size, - uint32_t * actual_size_ptr) -{ - BASSBOOST_RESULT lib_result = BASSBOOST_SUCCESS; - capi_err_t capi_result = CAPI_EOK; - - if (me_ptr->lib_instance.mem_ptr == NULL) - { - capi_result |= capi_bassboost_check_get_cached_param(me_ptr, - param_id, - param_ptr, - max_data_len, - required_size, - actual_size_ptr); - if (CAPI_FAILED(capi_result)) - { - BASSBOOST_MSG(me_ptr->miid, DBG_ERROR_PRIO, "CAPI BassBoost: Get parameter failed from the cached params"); - return capi_result; - } - } - else - { - if (max_data_len >= required_size) - { - lib_result = bassboost_get_param(&(me_ptr->lib_instance), param_id, param_ptr, max_data_len, actual_size_ptr); - if (BASSBOOST_SUCCESS != lib_result) - { - BASSBOOST_MSG(me_ptr->miid, DBG_ERROR_PRIO, "CAPI BassBoost: get parameter failed"); - CAPI_SET_ERROR(capi_result, CAPI_EFAILED); - } - } - else - { - BASSBOOST_MSG(me_ptr->miid, DBG_ERROR_PRIO, "CAPI BassBoost: get parameter needs more memory"); - CAPI_SET_ERROR(capi_result, CAPI_EFAILED); - } - } - return capi_result; -} - -/* ========================================================================= - * FUNCTION : capi_bassboost_check_set_param - * DESCRIPTION: Function to set the configuration parameters to the - * Bassboost library - * =========================================================================*/ -capi_err_t capi_bassboost_check_set_param(capi_bassboost_t *me_ptr, - uint32_t param_id, - void * param_ptr, - uint32_t param_size, - uint32_t required_size) -{ - BASSBOOST_RESULT lib_result = BASSBOOST_SUCCESS; - capi_err_t capi_result = CAPI_EOK; - - if (me_ptr->lib_instance.mem_ptr == NULL) - { - return capi_result; - } - else - { - if (param_size >= required_size) - { - lib_result = bassboost_set_param(&(me_ptr->lib_instance), param_id, param_ptr, param_size); - if (BASSBOOST_SUCCESS != lib_result) - { - BASSBOOST_MSG(me_ptr->miid, DBG_ERROR_PRIO, "CAPI BassBoost: set parameter failed %d", lib_result); - CAPI_SET_ERROR(capi_result, CAPI_EFAILED); - } - } - else - { - BASSBOOST_MSG(me_ptr->miid, DBG_ERROR_PRIO, "CAPI BassBoost: set parameter needs more memory"); - CAPI_SET_ERROR(capi_result, CAPI_EFAILED); - } - } - return capi_result; -} - -/* ========================================================================= - * FUNCTION : capi_bassboost_set_cached_lib_config - * DESCRIPTION: Sets either a parameter value or a parameter structure - * containing multiple parameters. In the event of a failure, - * the appropriate error code is returned. - * =========================================================================*/ -static capi_err_t capi_bassboost_set_cached_lib_config(capi_bassboost_t *me_ptr) -{ - capi_err_t capi_result = CAPI_EOK; - - if (me_ptr->lib_config.is_enable_set) - { - bassboost_enable_t enable_flag = me_ptr->lib_config.enable; - capi_result |= capi_bassboost_check_set_param(me_ptr, - BASSBOOST_PARAM_ENABLE, - (void *)&(enable_flag), - (uint32_t)sizeof(enable_flag), - (uint32_t)sizeof(bassboost_enable_t)); - if (1 == me_ptr->lib_config.enable) - { - me_ptr->events_config.code_bw = 0; - me_ptr->events_config.kpps = capi_bassboost_get_kpps(me_ptr); - /*Honest B/W votes based on sampling rate and channels independently*/ - me_ptr->events_config.data_bw = BASS_BOOST_BW_LOW; - if ((me_ptr->lib_static_vars.sample_rate > 48000) && (me_ptr->lib_static_vars.num_chs <= 2)) - { - me_ptr->events_config.data_bw = BASS_BOOST_BW_FS_GREATER_THAN_48K; - } - else if ((me_ptr->lib_static_vars.sample_rate <= 48000) && (me_ptr->lib_static_vars.num_chs > 2)) - { - me_ptr->events_config.data_bw = BASS_BOOST_BW_CH_GREATER_THAN_2; - } - else if ((me_ptr->lib_static_vars.sample_rate > 48000) && (me_ptr->lib_static_vars.num_chs > 2)) - { - me_ptr->events_config.data_bw = BASS_BOOST_BW_HIGHEST; - } - } - - if (CAPI_FAILED(capi_result)) - { - BASSBOOST_MSG(me_ptr->miid, DBG_ERROR_PRIO, "CAPIv2 BassBoost: Set Cached Enabled failed %lu", capi_result); - return capi_result; - } - else - { - capi_bassboost_update_raise_event(me_ptr); - } - } - - if (me_ptr->lib_config.is_mode_set) - { - bassboost_mode_t mode = (bassboost_mode_t)(me_ptr->lib_config.mode); - capi_result |= capi_bassboost_check_set_param(me_ptr, - BASSBOOST_PARAM_MODE, - (void *)&(mode), - (uint32_t)sizeof(mode), - (uint32_t)sizeof(bassboost_mode_t)); - if (CAPI_FAILED(capi_result)) - { - BASSBOOST_MSG(me_ptr->miid, DBG_ERROR_PRIO, "CAPIv2 BassBoost: Set cached mode failed %lu", capi_result); - return capi_result; - } - } - - if (me_ptr->lib_config.is_strength_set) - { - bassboost_strength_t strength = (bassboost_strength_t)(me_ptr->lib_config.strength); - capi_result |= capi_bassboost_check_set_param(me_ptr, - BASSBOOST_PARAM_STRENGTH, - (void *)&(strength), - (uint32_t)sizeof(strength), - (uint32_t)sizeof(bassboost_strength_t)); - if (CAPI_FAILED(capi_result)) - { - BASSBOOST_MSG(me_ptr->miid, DBG_ERROR_PRIO, "CAPIv2 BassBoost: Set Cached strength failed %lu", capi_result); - return capi_result; - } - } - return capi_result; -} - -static capi_err_t capi_bassboost_check_create_lib_instance(capi_bassboost_t *me_ptr) -{ - bassboost_mem_req_t lib_mem_req; - capi_err_t capi_result = CAPI_EOK; - BASSBOOST_RESULT lib_result = BASSBOOST_SUCCESS; - void * ptr = NULL; - - int32_t framesize_10ms = align_to_8_byte(me_ptr->input_media_fmt[0].format.sampling_rate / 100); - me_ptr->lib_static_vars.data_width = me_ptr->input_media_fmt[0].format.bits_per_sample; - me_ptr->lib_static_vars.num_chs = me_ptr->input_media_fmt[0].format.num_channels; - me_ptr->lib_static_vars.sample_rate = me_ptr->input_media_fmt[0].format.sampling_rate; - me_ptr->lib_static_vars.limiter_delay = LIMITER_DEFAULT_DELAY_MS; - me_ptr->lib_static_vars.max_block_size = - framesize_10ms < BASS_BOOST_MAX_FRAME_SIZE ? framesize_10ms : BASS_BOOST_MAX_FRAME_SIZE; - - lib_result = bassboost_get_mem_req(&lib_mem_req, &(me_ptr->lib_static_vars)); - if (BASSBOOST_SUCCESS != lib_result) - { - BASSBOOST_MSG(me_ptr->miid, DBG_ERROR_PRIO, "CAPI BassBoost: error getting library memory requirements %d", lib_result); - CAPI_SET_ERROR(capi_result, CAPI_EFAILED); - return capi_result; - } - - lib_mem_req.mem_size = align_to_8_byte(lib_mem_req.mem_size); - - /* create the new library as needed */ - if ((0 == me_ptr->lib_mem_req.mem_size) || - (lib_mem_req.mem_size > me_ptr->lib_mem_req.mem_size) || // Make lib mem req =0 after 430. - (NULL == me_ptr->lib_instance.mem_ptr)) - { - if (NULL != me_ptr->lib_instance.mem_ptr) - { - posal_memory_free(me_ptr->lib_instance.mem_ptr); - me_ptr->lib_instance.mem_ptr = NULL; - } - ptr = posal_memory_malloc(lib_mem_req.mem_size, POSAL_HEAP_DEFAULT); - if (NULL == ptr) - { - BASSBOOST_MSG(me_ptr->miid, DBG_ERROR_PRIO, "CAPI BassBoost: failed allocating memory for bassboost library"); - CAPI_SET_ERROR(capi_result, CAPI_EFAILED); - return capi_result; - } - me_ptr->lib_mem_req.mem_size = lib_mem_req.mem_size; - } - else - { - ptr = me_ptr->lib_instance.mem_ptr; - } - - lib_result = - bassboost_init_mem(&(me_ptr->lib_instance), &(me_ptr->lib_static_vars), ptr, me_ptr->lib_mem_req.mem_size); - if (BASSBOOST_SUCCESS != lib_result) - { - BASSBOOST_MSG(me_ptr->miid, DBG_ERROR_PRIO, "CAPI BassBoost: library initialization failed"); - return CAPI_EFAILED; - } - - capi_result |= capi_bassboost_set_cached_lib_config(me_ptr); - - /* Library reset */ - lib_result = bassboost_set_param(&(me_ptr->lib_instance), BASSBOOST_PARAM_RESET, NULL, 0); - if (BASSBOOST_SUCCESS != lib_result) - { - BASSBOOST_MSG(me_ptr->miid, DBG_ERROR_PRIO, "CAPI BassBoost: library Reset failed"); - CAPI_SET_ERROR(capi_result, CAPI_EFAILED); - return capi_result; - } - - BASSBOOST_MSG(me_ptr->miid, DBG_HIGH_PRIO, "CAPI BassBoost: library created successfully"); - return capi_result; -} - -#ifdef DO_BASSBOOST_PROFILING -void capi_bassboost_print_kpps(capi_bassboost_t *me_ptr) -{ - me_ptr->kpps_profile_data.average_kpps = - ((me_ptr->kpps_profile_data.total_cycles / me_ptr->kpps_profile_data.sample_count) * - me_ptr->kpps_profile_data.sample_rate) / - (1000); - BASSBOOST_MSG(me_ptr->miid, DBG_HIGH_PRIO, "CAPI BassBoost: Total cycles :%llu", me_ptr->kpps_profile_data.total_cycles); - BASSBOOST_MSG(me_ptr->miid, DBG_HIGH_PRIO, "CAPI BassBoost: Total Sample processed: %llu", me_ptr->kpps_profile_data.sample_count); - BASSBOOST_MSG(me_ptr->miid, DBG_HIGH_PRIO, "CAPI BassBoost: Average KPPS: %llu", me_ptr->kpps_profile_data.average_kpps); - BASSBOOST_MSG(me_ptr->miid, DBG_HIGH_PRIO, "CAPI BassBoost: Peak KPPS : %llu", me_ptr->kpps_profile_data.peak_kpps); - me_ptr->kpps_profile_data.total_cycles = 0; - me_ptr->kpps_profile_data.peak_kpps = 0; - me_ptr->kpps_profile_data.sample_count = 0; - me_ptr->kpps_profile_data.average_kpps = 0; -} - -void capi_bassboost_profiling(capi_bassboost_t *me_ptr, uint32_t num_samples) -{ - me_ptr->kpps_profile_data.sample_rate = me_ptr->media_fmt[0].format.sampling_rate; - me_ptr->kpps_profile_data.total_cycles = - me_ptr->kpps_profile_data.total_cycles + - (me_ptr->kpps_profile_data.end_cycles - me_ptr->kpps_profile_data.start_cycles); - me_ptr->kpps_profile_data.sample_count += num_samples; - uint64_t frame_kpps = - (((me_ptr->kpps_profile_data.end_cycles - me_ptr->kpps_profile_data.start_cycles) / num_samples) * - me_ptr->kpps_profile_data.sample_rate) / - (1000); - if ((frame_kpps > me_ptr->kpps_profile_data.peak_kpps) && - (num_samples > (me_ptr->kpps_profile_data.sample_rate / 1000))) - { - me_ptr->kpps_profile_data.peak_kpps = frame_kpps; - } -} -#endif /* DO_BASSBOOST_PROFILING */ - -capi_err_t capi_bassboost_process_set_properties(capi_bassboost_t *me_ptr, capi_proplist_t *proplist_ptr) -{ - capi_err_t capi_result = CAPI_EOK; - capi_prop_t *prop_array = proplist_ptr->prop_ptr; - - if (NULL == prop_array) - { - BASSBOOST_MSG(me_ptr->miid, DBG_ERROR_PRIO, "CAPI Bassboost: Set property received null property array."); - - return CAPI_EBADPARAM; - } - - capi_result = capi_cmn_set_basic_properties(proplist_ptr, &me_ptr->heap, &me_ptr->cb_info, TRUE); - if (CAPI_EOK != capi_result) - { - BASSBOOST_MSG(me_ptr->miid, DBG_ERROR_PRIO, "CAPI Bassboost: Get basic properties failed with result %lu", capi_result); - - return capi_result; - } - - for (uint32_t i = 0; i < proplist_ptr->props_num; i++) - { - const capi_buf_t *const payload_ptr = &(prop_array[i].payload); - capi_result = CAPI_EOK; - - switch (prop_array[i].id) - { - case CAPI_PORT_NUM_INFO: - case CAPI_HEAP_ID: - case CAPI_EVENT_CALLBACK_INFO: - { - break; - } - - case CAPI_ALGORITHMIC_RESET: - { - if (NULL != me_ptr->lib_instance.mem_ptr) - { - BASSBOOST_MSG(me_ptr->miid, DBG_HIGH_PRIO, "CAPI BassBoost: Reset"); - BASSBOOST_RESULT lib_result = BASSBOOST_SUCCESS; - lib_result = bassboost_set_param(&(me_ptr->lib_instance), BASSBOOST_PARAM_RESET, NULL, 0); - if (BASSBOOST_SUCCESS != lib_result) - { - CAPI_SET_ERROR(capi_result, CAPI_EFAILED); - } - } - break; - } - - case CAPI_INPUT_MEDIA_FORMAT_V2: - { - if (payload_ptr->actual_data_len >= sizeof(capi_media_fmt_v2_t)) - { - BASSBOOST_MSG(me_ptr->miid, DBG_HIGH_PRIO, "CAPI BassBoost: Received Input media format"); - - capi_media_fmt_v2_t *data_ptr = (capi_media_fmt_v2_t *)(payload_ptr->data_ptr); - if (!bassboost_is_supported_media_type(data_ptr)) - { - CAPI_SET_ERROR(capi_result, CAPI_EFAILED); - break; - } - // copy and save the input media fmt - memscpy(me_ptr->input_media_fmt, - sizeof(capi_media_fmt_v2_t), - data_ptr, - sizeof(capi_media_fmt_v2_t)); // CH Mapping - capi_result = capi_bassboost_check_create_lib_instance(me_ptr); - if (CAPI_FAILED(capi_result)) - { - BASSBOOST_MSG(me_ptr->miid, DBG_ERROR_PRIO, "CAPI Bassboost: Library creation failed"); - break; // this is catastrophic error, return - } - // raise event for output media format - capi_result |= capi_bassboost_update_raise_event(me_ptr); - capi_result |= - capi_cmn_output_media_fmt_event_v2(&me_ptr->cb_info, - &me_ptr->input_media_fmt[CAPI_BASSBOOST_DEFAULT_PORT], - FALSE, - CAPI_BASSBOOST_DEFAULT_PORT); // raise event for output media - // format - } - else - { - BASSBOOST_MSG(me_ptr->miid, DBG_ERROR_PRIO, - "CAPI BassBoost: Set property id 0x%lx Bad param size %lu", - (uint32_t)prop_array[i].id, - payload_ptr->actual_data_len); - CAPI_SET_ERROR(capi_result, CAPI_ENEEDMORE); - } - break; - } - case CAPI_MODULE_INSTANCE_ID: - { - if (payload_ptr->actual_data_len >= sizeof(capi_module_instance_id_t)) - { - capi_module_instance_id_t *data_ptr = (capi_module_instance_id_t *)payload_ptr->data_ptr; - me_ptr->miid = data_ptr->module_instance_id; - #if 0 - AR_MSG(DBG_LOW_PRIO, - "CAPI BassBoost: This module-id 0x%08lX, instance-id 0x%08lX", - data_ptr->module_id, - me_ptr->miid); - #endif - } - else - { - AR_MSG(DBG_ERROR_PRIO, - "CAPI BassBoost: Set, Param id 0x%lx Bad param size %lu", - (uint32_t)prop_array[i].id, - payload_ptr->actual_data_len); - CAPI_SET_ERROR(capi_result, CAPI_ENEEDMORE); - } - break; - } - - default: - { - BASSBOOST_MSG(me_ptr->miid, DBG_HIGH_PRIO, "CAPI BassBoost: Set property id %#x. Not supported.", prop_array[i].id); - CAPI_SET_ERROR(capi_result, CAPI_EUNSUPPORTED); - break; - } - } /* switch (prop_array[i].id) */ - - if (CAPI_FAILED(capi_result)) - { - BASSBOOST_MSG(me_ptr->miid, DBG_HIGH_PRIO, - "CAPI Bassboost: Set property for %#x failed with opcode %lu", - prop_array[i].id, - capi_result); - } - } - - return capi_result; -} - -capi_err_t capi_bassboost_process_get_properties(capi_bassboost_t *me_ptr, capi_proplist_t *proplist_ptr) -{ - uint32_t i; - - capi_err_t result = CAPI_EOK; - capi_err_t result_2 = CAPI_EOK; - - capi_prop_t *prop_array = proplist_ptr->prop_ptr; - uint32_t miid = MIID_UNKNOWN; - if(me_ptr) - { - miid = me_ptr->miid; - } - if (NULL == prop_array) - { - BASSBOOST_MSG(miid, DBG_ERROR_PRIO, "CAPI Bassboost: Get property received null property array."); - - return CAPI_EBADPARAM; - } - - capi_basic_prop_t mod_prop; - mod_prop.init_memory_req = sizeof(capi_bassboost_t); - mod_prop.stack_size = BASSBOOST_STACK_SIZE; - mod_prop.num_fwk_extns = 0; // NA - mod_prop.fwk_extn_ids_arr = NULL; // NA - mod_prop.is_inplace = FALSE; // not capable of in-place processing of data - mod_prop.req_data_buffering = FALSE; - mod_prop.max_metadata_size = 0; // NA - - result = capi_cmn_get_basic_properties(proplist_ptr, &mod_prop); - if (CAPI_EOK != result) - { - BASSBOOST_MSG(miid, DBG_ERROR_PRIO, "CAPI Bassboost: Get common basic properties failed with result %lu", result); - - return result; - } - - for (i = 0; i < proplist_ptr->props_num; i++) - { - capi_buf_t *const payload_ptr = &(prop_array[i].payload); - const uint32_t param_id = prop_array[i].id; - - if (NULL == payload_ptr->data_ptr) - { - BASSBOOST_MSG(miid, DBG_ERROR_PRIO, "CAPI Bassboost: Get property id 0x%lx, received null buffer.", param_id); - CAPI_SET_ERROR(result, CAPI_EBADPARAM); - continue; - } - - result = CAPI_EOK; - - switch (prop_array[i].id) - { - case CAPI_INIT_MEMORY_REQUIREMENT: - case CAPI_IS_INPLACE: - case CAPI_REQUIRES_DATA_BUFFERING: - case CAPI_STACK_SIZE: - case CAPI_PORT_DATA_THRESHOLD: - case CAPI_MAX_METADATA_SIZE: - { - break; - } - - case CAPI_OUTPUT_MEDIA_FORMAT_SIZE: - { - if (payload_ptr->max_data_len >= sizeof(capi_output_media_format_size_t)) - { - capi_output_media_format_size_t *data_ptr = (capi_output_media_format_size_t *)payload_ptr->data_ptr; - data_ptr->size_in_bytes = sizeof(capi_standard_data_format_t); - payload_ptr->actual_data_len = sizeof(capi_output_media_format_size_t); - } - else - { - BASSBOOST_MSG(miid, DBG_ERROR_PRIO, - "CAPI Bassboost: Get Property id 0x%lx Bad param size %lu", - (uint32_t)prop_array[i].id, - payload_ptr->max_data_len); - CAPI_SET_ERROR(result, CAPI_ENEEDMORE); - } - - break; - } - - case CAPI_OUTPUT_MEDIA_FORMAT_V2: - { - if (payload_ptr->max_data_len >= sizeof(capi_media_fmt_v2_t)) - { - capi_media_fmt_v2_t *data_ptr = (capi_media_fmt_v2_t *)payload_ptr->data_ptr; - - if (NULL == me_ptr || NULL == me_ptr->lib_instance.mem_ptr || - (prop_array[i].port_info.is_valid && prop_array[i].port_info.port_index != 0)) - { - BASSBOOST_MSG(miid, DBG_ERROR_PRIO, - "CAPI Bassboost: Get Property id 0x%lx failed due to " - "invalid/unexpected values", - (uint32_t)prop_array[i].id); - CAPI_SET_ERROR(result, CAPI_EFAILED); - - break; - } - - *data_ptr = me_ptr->input_media_fmt[0]; - payload_ptr->actual_data_len = sizeof(capi_media_fmt_v2_t); - } - else - { - BASSBOOST_MSG(miid, DBG_ERROR_PRIO, - "CAPI Bassboost: Get Property id 0x%lx Bad param size %lu", - (uint32_t)prop_array[i].id, - payload_ptr->max_data_len); - CAPI_SET_ERROR(result, CAPI_ENEEDMORE); - } - - break; - } - - default: - { - CAPI_SET_ERROR(result, CAPI_EUNSUPPORTED); - break; - } - } /* switch (prop_array[i].id) */ - - CAPI_SET_ERROR(result_2, result); - - if (CAPI_FAILED(result)) - { - BASSBOOST_MSG(miid, DBG_HIGH_PRIO, "CAPI Bassboost: Get property for %#x failed with opcode %lu", prop_array[i].id, result); - } - } - - return result_2; -} diff --git a/modules/processing/bassboost/capi/src/capi_bassboost_utils.h b/modules/processing/bassboost/capi/src/capi_bassboost_utils.h deleted file mode 100644 index c7f05204..00000000 --- a/modules/processing/bassboost/capi/src/capi_bassboost_utils.h +++ /dev/null @@ -1,139 +0,0 @@ -/* ========================================================================= - * Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. - * SPDX-License-Identifier: BSD-3-Clause-Clear - * =========================================================================*/ -/** - * @file capi_bassboost_utils.h - * - * Header file for utilities implement the Audio Post Processor Interface for - * Acoustic Bass Enhancement - */ - -#ifndef CAPI_BASSBOOST_UTILS_H -#define CAPI_BASSBOOST_UTILS_H - -#ifndef CAPI_STANDALONE -/* For shared libraries. */ -#include "shared_lib_api.h" -#else -#include "capi_util.h" -#endif - -#ifndef POSAL_ASSERT -#define POSAL_ASSERT(...) \ - { \ - ; \ - } -#endif - -#include "capi.h" -#include "capi_cmn.h" -#include "audio_basic_op_ext.h" - -#include "api_bassboost.h" -#include "capi_bassboost.h" - -#include "audpp_util.h" -#include "bassboost_api.h" -#include "bassboost_calibration_api.h" - -#ifdef DO_BASSBOOST_PROFILING -#include -#endif - -#define MIID_UNKNOWN 0 - -#define BASSBOOST_MSG_PREFIX "BASSBOOST:[%lX] " -#define BASSBOOST_MSG(ID, xx_ss_mask, xx_fmt, ...) AR_MSG(xx_ss_mask, BASSBOOST_MSG_PREFIX xx_fmt, ID, ##__VA_ARGS__) - -const uint32_t BASS_BOOST_MAX_CHANNELS = 8; -const int32_t LIMITER_DEFAULT_DELAY_MS = 10; -const int32_t BASS_BOOST_MAX_FRAME_SIZE = 240; -static const uint32_t BASSBOOST_STACK_SIZE = 4096; -const uint32_t BASS_BOOST_BY_PASS_BW = 0; -const uint32_t BASS_BOOST_BY_PASS_BW_HIGH = 1 * 1024 * 1024; -const uint32_t BASS_BOOST_BW_LOW = 2 * 1024 * 1024; -const uint32_t BASS_BOOST_BW_CH_GREATER_THAN_2 = 2 * 1024 * 1024; -const uint32_t BASS_BOOST_BW_FS_GREATER_THAN_48K = 2 * 1024 * 1024; -const uint32_t BASS_BOOST_BW_HIGHEST = 45 * 1024 * 1024; -const uint32_t BASSBOOST_MAX_SAMPLE_RATE = 192000; -/*------------------------------------------------------------------------ - * Function declarations - * -----------------------------------------------------------------------*/ -typedef struct capi_bassboost_profiler -{ - uint64_t start_cycles; - uint64_t end_cycles; - uint64_t total_cycles; - uint64_t sample_count; - uint64_t average_kpps; - uint64_t peak_kpps; - uint32_t sample_rate; -} capi_bassboost_profiler_t; - -typedef struct capi_bassboost_events_config -{ - uint32_t enable; - uint32_t kpps; - uint32_t delay_in_us; - uint32_t code_bw; - uint32_t data_bw; -} capi_bassboost_events_config_t; - -typedef struct capi_bassboost_lib_config -{ - bool_t is_enable_set; - bool_t is_mode_set; - bool_t is_strength_set; - bassboost_enable_t enable; - bassboost_strength_t strength; - uint32_t mode; -} capi_bassboost_lib_config_t; - -typedef struct capi_bassboost_t -{ - capi_t vtbl; - capi_heap_id_t heap; // added here - bassboost_lib_t lib_instance; - bassboost_static_vars_t lib_static_vars; - bassboost_mem_req_t lib_mem_req; - - capi_event_callback_info_t cb_info; - capi_media_fmt_v2_t input_media_fmt[CAPI_BASSBOOST_MAX_IN_PORTS]; - capi_bassboost_events_config_t events_config; - capi_bassboost_lib_config_t lib_config; - bool_t is_disabled; - uint32_t miid; -#ifdef DO_BASSBOOST_PROFILING - capi_bassboost_profiler_t kpps_profile_data; -#endif -} capi_bassboost_t; - -capi_err_t capi_bassboost_process_set_properties(capi_bassboost_t *me_ptr, capi_proplist_t *proplist_ptr); - -capi_err_t capi_bassboost_process_get_properties(capi_bassboost_t *me_ptr, capi_proplist_t *proplist_ptr); - -capi_err_t capi_bassboost_update_raise_event(capi_bassboost_t *me_ptr); - -void capi_bassboost_init_media_fmt(capi_bassboost_t *me_ptr); - -capi_err_t capi_bassboost_check_set_param(capi_bassboost_t *me_ptr, - uint32_t param_id, - void * param_ptr, - uint32_t param_size, - uint32_t required_size); - -capi_err_t capi_bassboost_check_get_param(capi_bassboost_t *me_ptr, - uint32_t param_id, - void * param_ptr, - uint32_t max_data_len, - uint32_t required_size, - uint32_t * actual_size_ptr); - -void capi_bassboost_profiling(capi_bassboost_t *me_ptr, uint32_t num_samples); - -void capi_bassboost_print_kpps(capi_bassboost_t *me_ptr); - -uint32_t capi_bassboost_get_kpps(capi_bassboost_t *me_ptr); - -#endif /* CAPI_BASSBOOST_UTILS_H */ diff --git a/modules/processing/bassboost/capi/stub_src/capi_bassboost_stub.cpp b/modules/processing/bassboost/capi/stub_src/capi_bassboost_stub.cpp deleted file mode 100644 index 5122e850..00000000 --- a/modules/processing/bassboost/capi/stub_src/capi_bassboost_stub.cpp +++ /dev/null @@ -1,31 +0,0 @@ -/* ========================================================================= - * Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. - * SPDX-License-Identifier: BSD-3-Clause-Clear - * =========================================================================*/ - -/** - * @file capi_bassboost_stub.cpp - * - * Stubbed Interface for Acoustic Bass Enhancement - */ - -#include "capi_bassboost.h" - -/* ------------------------------------------------------------------------- - * Function name: capi_bassboost_get_static_properties - * Capi_v2 BassBoost stub function to get the static properties - * -------------------------------------------------------------------------*/ -capi_err_t capi_bassboost_get_static_properties(capi_proplist_t *init_set_properties, - capi_proplist_t *static_properties) -{ - return CAPI_EUNSUPPORTED; -} - -/* ------------------------------------------------------------------------- - * Function name: capi_bassboost_init - * Stub function for the Bass-boost Initialization - * -------------------------------------------------------------------------*/ -capi_err_t capi_bassboost_init(capi_t *_pif, capi_proplist_t *init_set_properties) -{ - return CAPI_EUNSUPPORTED; -} diff --git a/modules/processing/bassboost/lib/inc/bassboost_api.h b/modules/processing/bassboost/lib/inc/bassboost_api.h deleted file mode 100644 index 81b69d0a..00000000 --- a/modules/processing/bassboost/lib/inc/bassboost_api.h +++ /dev/null @@ -1,93 +0,0 @@ -#ifndef BASSBOOST_API_H -#define BASSBOOST_API_H -/*============================================================================ - @file bassboost_api.h - - Public API for Bass Boost Effect - - Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. - SPDX-License-Identifier: BSD-3-Clause-Clear -============================================================================*/ -#include "bassboost_calibration_api.h" -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/*---------------------------------------------------------------------------- - Library Version -----------------------------------------------------------------------------*/ -#define BASSBOOST_LIB_VER (0x01000203) // lib version : rel/1.2/3.1.0 - // (major.minor.bug) (8.16.8 bits) - -/*---------------------------------------------------------------------------- - Error code -----------------------------------------------------------------------------*/ -typedef enum BASSBOOST_RESULT { - BASSBOOST_SUCCESS = 0, - BASSBOOST_FAILURE, - BASSBOOST_MEMERROR -} BASSBOOST_RESULT; - -/*---------------------------------------------------------------------------- - Type Declarations -----------------------------------------------------------------------------*/ -typedef struct bassboost_static_vars_t {//** static params - int32 data_width; // 16 (Q15 PCM) or 32 (Q27 PCM) - int32 sample_rate; // sampling rate - int32 max_block_size; // max block size - int32 num_chs; // num of channels - int32 limiter_delay; // internal limiter delay (ms) -} bassboost_static_vars_t; - -typedef struct bassboost_mem_req_t { // ** memory requirements - uint32 mem_size; // lib mem size (lib_mem_ptr ->) - uint32 stack_size; // stack mem size -} bassboost_mem_req_t; - -typedef struct bassboost_lib_t { // ** library struct - void* mem_ptr; // mem pointer -} bassboost_lib_t; - -/*----------------------------------------------------------------------------- - Function Declarations ------------------------------------------------------------------------------*/ - -// ** Process one block of samples (multi channel) -// lib_ptr: [in] pointer to library structure -// out_ptr: [out] pointer to output sample block (multi channel double ptr) -// in_ptr: [in] pointer to input sample block (multi channel double ptr) -// samples: [in] number of samples to be processed per channel -BASSBOOST_RESULT bassboost_process(bassboost_lib_t *lib_ptr, void **out_ptr, void **in_ptr, uint32 samples); - -// ** Get library memory requirements -// mem_req_ptr: [out] pointer to mem requirements structure -// static_vars_ptr: [in] pointer to static variable structure -BASSBOOST_RESULT bassboost_get_mem_req(bassboost_mem_req_t *mem_req_ptr, bassboost_static_vars_t* static_vars_ptr); - -// ** Partition, initialize memory, and set default values -// lib_ptr: [in, out] pointer to library structure -// static_vars_ptr: [in] pointer to static variable structure -// mem_ptr: [in] pointer to allocated memory -// mem_size: [in] size of memory allocated -BASSBOOST_RESULT bassboost_init_mem(bassboost_lib_t *lib_ptr, bassboost_static_vars_t* static_vars_ptr, void* mem_ptr, uint32 mem_size); - -// ** Set parameters to library -// lib_ptr: [in, out] pointer to lib structure -// param_id: [in] parameter id -// param_ptr: [in] pointer to the memory where the new values are stored -// param_size:[in] size of the memory pointed by param_ptr -BASSBOOST_RESULT bassboost_set_param(bassboost_lib_t* lib_ptr, uint32 param_id, void* param_ptr, uint32 param_size); - -// ** Get parameters from library -// lib_ptr: [in] pointer to library structure -// param_id: [in] parameter id -// param_ptr: [out] pointer to the memory where the retrieved value is going to be stored -// param_size:[in] size of the memory pointed by param_ptr -// param_actual_size_ptr: [out] pointer to memory that will hold the actual size of the parameter -BASSBOOST_RESULT bassboost_get_param(bassboost_lib_t* lib_ptr, uint32 param_id, void* param_ptr, uint32 param_size, uint32 *param_actual_size_ptr); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* BASSBOOST_API_H */ diff --git a/modules/processing/bassboost/lib/inc/bassboost_calibration_api.h b/modules/processing/bassboost/lib/inc/bassboost_calibration_api.h deleted file mode 100644 index 69b5a913..00000000 --- a/modules/processing/bassboost/lib/inc/bassboost_calibration_api.h +++ /dev/null @@ -1,52 +0,0 @@ -#ifndef BASSBOOST_CALIBRATION_API_H -#define BASSBOOST_CALIBRATION_API_H -/*============================================================================ - @file bassboost_calibration_api.h - - Calibration (Public) API for Bass Boost Effect - - Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. - SPDX-License-Identifier: BSD-3-Clause-Clear -============================================================================*/ -#include "AudioComdef.h" - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/*---------------------------------------------------------------------------- - Parameters with IDs -----------------------------------------------------------------------------*/ -#define BASSBOOST_PARAM_LIB_VER (0) // ** param: library version -typedef int32 bassboost_version_t; // access: get only - -#define BASSBOOST_PARAM_ENABLE (1) // ** param: on/off switch -typedef int32 bassboost_enable_t; // access: get & set, runtime - // range: [0 (OFF) or 1 (ON)] - -#define BASSBOOST_PARAM_MODE (2) // ** param: processing mode -typedef enum bassboost_mode_t { // access: get & set - PHYSICAL_BOOST = 0, // 0: physical boost (headphone) - VIRTUAL_BOOST, // 1: virtual boost (small speaker) - INVALID_BOOST = 0x7FFFFFFF -} bassboost_mode_t; // (mode 1 is now placeholder) - -#define BASSBOOST_PARAM_STRENGTH (3) // ** param: effect strength -typedef int32 bassboost_strength_t; // access: get & set, runtime - // range: [0, 1000] (per millie) - -#define BASSBOOST_PARAM_RESET (4) // ** param: reset internal memories - // access: set only - -#define BASSBOOST_PARAM_DELAY (5) // ** param: report alg delay (samples) -typedef int32 bassboost_delay_t; // access: get only - -#define BASSBOOST_PARAM_CROSSFADE_FLAG (6)//**param: whether in transition state -typedef int32 bassboost_crossfade_t; // access: get only - // range: [0 (NO) or 1 (YES)] - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* BASSBOOST_CALIBRATION_API_H */ diff --git a/modules/processing/bassboost/lib/src/bassboost.c b/modules/processing/bassboost/lib/src/bassboost.c deleted file mode 100644 index 0a63ba10..00000000 --- a/modules/processing/bassboost/lib/src/bassboost.c +++ /dev/null @@ -1,956 +0,0 @@ -/*============================================================================ - FILE: bassboost.c - - OVERVIEW: BassBoost Implementations - - DEPENDENCIES: None - - Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. - SPDX-License-Identifier: BSD-3-Clause-Clear -============================================================================*/ -#include "bassboost.h" -#include "simple_mm.h" -#include "filter_design.h" -#include "audio_clips.h" -#include "drc_calib_api.h" - -void buffer32_copy -( - int32 *destBuf, /* output buffer */ - int32 *srcBuf, /* input buffer */ - uint32 samples /* number of samples to process */ -); - -/* configure the internal safeguard limiter */ -static BASSBOOST_RESULT config_limiter(bassboost_private_t *obj_ptr) -{ - int32 ch, status = 0; - limiter_tuning_t tuning; - - limiter_mode_t mode = NORMAL_PROC; - limiter_bypass_t bypass = 0; - tuning.makeup_gain = 256; // unity Q8 - tuning.gc = 32113; // GC = 0.98 - tuning.max_wait = 82; // (this value doens't matter) - - if (16 == obj_ptr->static_vars.data_width) { - tuning.threshold = 32022; // -0.2 dB, Q27 - } else { - tuning.threshold = 131162560; // -0.2 dB, Q15 - } - - // set mode - status += limiter_set_param(&obj_ptr->limiter_lib, LIMITER_PARAM_MODE, - &mode, sizeof(limiter_mode_t)); - - // set bypass - status += limiter_set_param(&obj_ptr->limiter_lib, LIMITER_PARAM_BYPASS, - &bypass, sizeof(limiter_bypass_t)); - - // set per channel tuning - for (ch = 0; ch < obj_ptr->static_vars.num_chs; ++ch) { - tuning.ch_idx = ch; - status += limiter_set_param(&obj_ptr->limiter_lib, LIMITER_PARAM_TUNING, - &tuning, sizeof(limiter_tuning_t)); - } - - return (status == 0 ? BASSBOOST_SUCCESS: BASSBOOST_FAILURE); -} - -/* configure the internal drc */ -static BASSBOOST_RESULT config_drc(bassboost_private_t *obj_ptr) -{ - drc_feature_mode_t drc_mode; - drc_config_t tuning; - int16 index; - int32 atrt, status = 0; - - // set drc mode to enable - drc_mode = DRC_ENABLED; - status += drc_set_param(&obj_ptr->drc_lib, DRC_PARAM_FEATURE_MODE, - (void*)&drc_mode, sizeof(drc_feature_mode_t)); - - // set drc config - // totally 10 dB boost, 4dB from drc makeup, another 6dB before limiter - tuning.channelLinked = CHANNEL_LINKED; - tuning.downSampleLevel = 8; // downsample 8 - tuning.rmsTavUL16Q16 = 310; // ~ 10ms 44/48k - - tuning.dnExpaThresholdL16Q7 = 4520; // -55 dBfs - tuning.dnExpaSlopeL16Q8 = -256; // 1:2 - tuning.dnExpaHysterisisUL16Q14 = 18855; - tuning.dnExpaMinGainDBL32Q23 = -167772160; - - tuning.upCompThresholdL16Q7 = 5416; // - 48 dBfs - tuning.upCompSlopeUL16Q16 = 43691; // 3:1 - tuning.upCompHysterisisUL16Q14 = 18855; - - tuning.dnCompThresholdL16Q7 = 9000; // -20 dBfs thresh - tuning.dnCompSlopeUL16Q16 = 49152; // 4:1 comp ratio - tuning.dnCompHysterisisUL16Q14 = 18855; - - tuning.makeupGainUL16Q12 = 6492; // makeup: 4dB - - // get 15 ms attack/release time. we support all sample rates but only - // 4 typicals are pre-calculated. we'll use them for nearby rates - index = find_freq(obj_ptr->static_vars.sample_rate, - bassboost_rates_const, BASSBOOST_NUM_RATES); - atrt = bassboost_atrt_const[index]; - tuning.dnCompAttackUL32Q31 = atrt; - tuning.dnCompReleaseUL32Q31 = atrt; - tuning.upCompAttackUL32Q31 = atrt; - tuning.upCompReleaseUL32Q31 = atrt; - tuning.dnExpaAttackUL32Q31 = atrt; - tuning.dnExpaReleaseUL32Q31 = atrt; - - status += drc_set_param(&obj_ptr->drc_lib, DRC_PARAM_CONFIG, - (void*)&tuning, sizeof(drc_config_t)); - - return (status == 0 ? BASSBOOST_SUCCESS: BASSBOOST_FAILURE); -} - -/* convert biquad coeffs designed by QSound code to be used by msiir library */ -static void convert_iir_coeffs(int32 *out_coeffs, int32 *in_coeffs) -{ - // filter coeffs designed by QSound code are Q23 with such order: - // b0, -a2, -a1, b2, b1, - // MSIIR filter coeff order: - // b0, b1, b2, a1, a2 - // we'll do proper adjustment and for simplcity, make each coeff Q30 - - // b0, Q23 to Q30 - out_coeffs[0] = s32_shl_s32_rnd_sat(in_coeffs[0], 7); - // b1, Q23 to Q30 - out_coeffs[1] = s32_shl_s32_rnd_sat(in_coeffs[4], 7); - // b2, Q23 to Q30 - out_coeffs[2] = s32_shl_s32_rnd_sat(in_coeffs[3], 7); - // a1, negate, then Q23 to Q30 - out_coeffs[3] = s32_shl_s32_rnd_sat(s32_neg_s32_sat(in_coeffs[2]), 7); - // a2, negate, then Q23 to Q30 - out_coeffs[4] = s32_shl_s32_rnd_sat(s32_neg_s32_sat(in_coeffs[1]), 7); -} - -/* configure internal iir filters */ -static BASSBOOST_RESULT config_iir_filters(bassboost_private_t *obj_ptr) -{ - typedef struct combined_struct { - int32 num_stages; - msiir_coeffs_t coeffs_struct[BASSBOOST_IIR_STAGES]; - } combined_struct; - - int32 ch, status = 0; - int32 coeffsL32Q23[5]; - int32 sample_rate = obj_ptr->static_vars.sample_rate; - int32 num_chs = obj_ptr->static_vars.num_chs; - - combined_struct config; - config.num_stages = BASSBOOST_IIR_STAGES; - config.coeffs_struct[0].shift_factor = c_iir_shift_factor; - - // design low-pass filter - designBiquadLowpassCoeffs(coeffsL32Q23, -602, c_bass_freq_hz, sample_rate, TRUE); - convert_iir_coeffs(config.coeffs_struct[0].iir_coeffs, coeffsL32Q23); - - for (ch = 0; ch < num_chs; ++ch) { - status += msiir_set_param(&obj_ptr->bass_fltrs[ch], MSIIR_PARAM_CONFIG, - &config, sizeof(combined_struct)); - } - - // design band-pass filter - designBiquadBandpassCoeffs(coeffsL32Q23, -602, c_band_freq_hz, sample_rate, TRUE); - convert_iir_coeffs(config.coeffs_struct[0].iir_coeffs, coeffsL32Q23); - - for (ch = 0; ch < num_chs; ++ch) { - status += msiir_set_param(&obj_ptr->band_fltrs[ch], MSIIR_PARAM_CONFIG, - &config, sizeof(combined_struct)); - } - - return (status == 0 ? BASSBOOST_SUCCESS: BASSBOOST_FAILURE); -} - -/* clean buffers and memories */ -static void reset(bassboost_private_t *obj_ptr) -{ - int32 ch, dummy; - - limiter_set_param(&obj_ptr->limiter_lib, LIMITER_PARAM_RESET, &dummy, sizeof(dummy)); - drc_set_param(&obj_ptr->drc_lib, DRC_PARAM_SET_RESET, (int8*)NULL, 0); - - for (ch = 0; ch < obj_ptr->static_vars.num_chs; ++ch) { - // clear delay line - delayline32_reset(&obj_ptr->delaylines[ch]); - // reset iir filters - msiir_set_param(&obj_ptr->bass_fltrs[ch], MSIIR_PARAM_RESET, &dummy, sizeof(dummy)); - msiir_set_param(&obj_ptr->band_fltrs[ch], MSIIR_PARAM_RESET, &dummy, sizeof(dummy)); - } -} - -/* set library with default value after init */ -static BASSBOOST_RESULT set_default(bassboost_private_t *obj_ptr) -{ - int32 ch, status = 0; - - // set default params - obj_ptr->enable = 0; - obj_ptr->mode = PHYSICAL_BOOST; - obj_ptr->strength = 1000; - - // set strength fader - obj_ptr->ramp_smps = ms_to_sample(c_fader_smooth_ms, obj_ptr->static_vars.sample_rate); - obj_ptr->onset_smps = ms_to_sample(c_onset_smooth_ms, obj_ptr->static_vars.sample_rate); - panner_setup(&obj_ptr->strenghth_fader, Q15_ONE, 0, 0); // set to max - - // set onoff fader - for (ch = 0; ch < obj_ptr->static_vars.num_chs; ++ch) { - panner_setup(&obj_ptr->onoff_fader[ch], Q15_ONE, 0, 0); // disable (reverse logic) - } - - // config sub modules - status += config_limiter(obj_ptr); - status += config_drc(obj_ptr); - status += config_iir_filters(obj_ptr); - - // reset lib - reset(obj_ptr); - - return (status == 0 ? BASSBOOST_SUCCESS: BASSBOOST_FAILURE); -} - -/* mix bass with delayed direct sound with smooth gain */ -// gain values are squared to be closer to how we perceive volume -static void smooth_bass_mix16(int32 **mix_buf, int16 **bass_buf, - pannerStruct *x_fader, int32 num_chs, int32 samples) -{ - int16 bass_gain_q15, bassGainSqL16Q15; - int32 i, ch, ramped_samples, tmp_sample, bass_gain_q31; - int32 deltaL32Q31 = x_fader->deltaL32Q31; - - bass_gain_q15 = panner_get_current(*x_fader); - bass_gain_q31 = s32_shl_s32_sat((int32)bass_gain_q15, 16); - bassGainSqL16Q15 = s16_extract_s32_h( - s32_mult_s16_s16_shift_sat(bass_gain_q15, bass_gain_q15)); - ramped_samples = s32_min_s32_s32(samples, x_fader->sampleCounter); - - // additional 6 dB gain applied during mix. notice that this is done - // by 1 extract upshift in ramped samples and setting Q14 for a Q15 - // gain when mixing with not ramped samples - - for (i = 0; i < ramped_samples; ++i) { - // obtain gain and square it - bass_gain_q15 = s16_extract_s32_h(bass_gain_q31); - bassGainSqL16Q15 = s16_extract_s32_h( - s32_mult_s16_s16_shift_sat(bass_gain_q15, bass_gain_q15)); - - // apply gain squre to samples and mix into 32 bit mix buffers - for (ch = 0; ch < num_chs; ++ch) { - tmp_sample = s16_extract_s64_h_rnd(s40_mult_s16_s16_shift( - *(bass_buf[ch]+i), bassGainSqL16Q15, 2)); - mix_buf[ch][i] = s32_add_s32_s32(mix_buf[ch][i], tmp_sample); - } - // add delta increment to Q31 gain - bass_gain_q31 = s32_add_s32_s32_sat(bass_gain_q31, deltaL32Q31); - } // end of for loop - - // decrease sample count for ramped samples - samples -= ramped_samples; - x_fader->sampleCounter -= ramped_samples; - - // mix the rest - for (ch = 0; ch < num_chs; ++ch) { - buffer32_mix16src(mix_buf[ch]+i, bass_buf[ch]+i, bassGainSqL16Q15, 14, samples); - } - } - -static void smooth_bass_mix32(int32 **mix_buf, int32 **bass_buf, - pannerStruct *x_fader, int32 num_chs, int32 samples) -{ - // bass gain uses the squared value of linear gain to be one step closer - // to how we perceive volume, but still stay simple on computation - - int16 bass_gain_q15, bassGainSqL16Q15; - int32 i, ch, ramped_samples, tmp_sample, bass_gain_q31; - int32 deltaL32Q31 = x_fader->deltaL32Q31; - - bass_gain_q15 = panner_get_current(*x_fader); - bass_gain_q31 = s32_shl_s32_sat((int32)bass_gain_q15, 16); - bassGainSqL16Q15 = s16_extract_s32_h( - s32_mult_s16_s16_shift_sat(bass_gain_q15, bass_gain_q15)); - ramped_samples = s32_min_s32_s32(samples, x_fader->sampleCounter); - - for (i = 0; i < ramped_samples; ++i) { - // obtain gain and squre it - bass_gain_q15 = s16_extract_s32_h(bass_gain_q31); - bassGainSqL16Q15 = s16_extract_s32_h( - s32_mult_s16_s16_shift_sat(bass_gain_q15, bass_gain_q15)); - - // apply gain squre to samples and mix into 32 bit mix buffers - for (ch = 0; ch < num_chs; ++ch) { - tmp_sample = s32_saturate_s64(s64_mult_s32_s16_shift( - *(bass_buf[ch]+i), bassGainSqL16Q15,2)); - mix_buf[ch][i] = s32_add_s32_s32(mix_buf[ch][i], tmp_sample); - } - // add delta increment to Q31 gain - bass_gain_q31 = s32_add_s32_s32_sat(bass_gain_q31, deltaL32Q31); - } // end of for loop - - // decrease sample count for ramped samples - samples -= ramped_samples; - x_fader->sampleCounter -= ramped_samples; - - // mix the rest - for (ch = 0; ch < num_chs; ++ch) { - buffer32_mix32(mix_buf[ch]+i, bass_buf[ch]+i, bassGainSqL16Q15, 14, samples); - } -} - -// smoothly crossfade between src1 and src2 with Q15 smooth panner, unity panner = all src2 -// should check these two functions in common lib when possible -// 16 bit version -static void bb_crossmix_panner(int16 *dest, int16 *src1, int16 *src2, pannerStruct *panner, int32 samples) -{ - int16 target_q15 = panner->targetGainL16Q15; - int32 pan_samples = panner->sampleCounter; - int32 delta_q31 = panner->deltaL32Q31; - int16 gain_q15, tmp16; - int32 gain_q31, ramp_samples, i; - - // current implementation totally ignores delay of panner - // src1 gets applied gain, and src2 is applied 1-gain - gain_q15 = panner_get_current(*panner); - gain_q31 = s32_shl_s32_sat((int32)gain_q15, 16); - - ramp_samples = s32_min_s32_s32(pan_samples, samples); - - // process samples with dynamic gains - for (i = 0; i < ramp_samples; ++i) { - // get q15 gain - gain_q15 = s16_extract_s32_h(gain_q31); - // apply gain to src 2 and save - *dest = s16_extract_s40_h(s40_mult_s16_s16_shift(*src2++, gain_q15, 1)); - // get 1-gain and apply to src 1 and mix - gain_q15 = s16_sub_s16_s16_sat(Q15_ONE, gain_q15); - tmp16 = s16_extract_s40_h(s40_mult_s16_s16_shift(*src1++, gain_q15, 1)); - *dest = s16_add_s16_s16_sat(*dest, tmp16); - dest++; - // add delta to q31 gain - gain_q31 = s32_add_s32_s32_sat(gain_q31, delta_q31); - } - pan_samples -= ramp_samples; - - // process samples with no gain change - samples -= ramp_samples; - if (samples > 0) { - if (Q15_ONE == target_q15) { - buffer_copy(dest, src2, samples); - } - else if (0 == target_q15) { - buffer_copy(dest, src1, samples); - } - else { - gain_q15 = s16_sub_s16_s16_sat(Q15_ONE, target_q15); - buffer_fill(dest, src2, target_q15, samples); - buffer_mix(dest, src1, gain_q15, samples); - } - } - panner->sampleCounter = pan_samples; -} - -// 32 bit version (different than common lib, with bug fix) -void bb32_crossmix_panner(int32 *dest, int32 *src1, int32 *src2, pannerStruct *panner, int32 samples) -{ - int16 target_q15 = panner->targetGainL16Q15; - int32 pan_samples = panner->sampleCounter; - int32 delta_q31 = panner->deltaL32Q31; - int16 gain_q15; - int32 gain_q31, ramp_samples, i, tmp32; - - // current implementation totally ignores delay of panner - // src1 gets applied gain, and src2 is applied 1-gain - gain_q15 = panner_get_current(*panner); - gain_q31 = s32_shl_s32_sat((int32)gain_q15, 16); - - ramp_samples = s32_min_s32_s32(pan_samples, samples); - - // process samples with dynamic gains - for (i = 0; i < ramp_samples; ++i) { - // get q15 gain - gain_q15 = s16_extract_s32_h(gain_q31); - // apply gain to src 2 and save - *dest = s32_mult_s32_s16_rnd_sat(*src2++, gain_q15); - // get 1-gain and apply to src 1 and mix - gain_q15 = s16_sub_s16_s16_sat(Q15_ONE, gain_q15); - tmp32 = s32_mult_s32_s16_rnd_sat(*src1++, gain_q15); - *dest = s32_add_s32_s32_sat(*dest, tmp32); - dest++; - // add delta to q31 gain - gain_q31 = s32_add_s32_s32_sat(gain_q31, delta_q31); - } - pan_samples -= ramp_samples; - - // process samples with no gain change - samples -= ramp_samples; - if (samples > 0) { - if (Q15_ONE == target_q15) { - buffer32_copy(dest, src2, samples); - } - else if (0 == target_q15) { - buffer32_copy(dest, src1, samples); - } - else { - gain_q15 = s16_sub_s16_s16_sat(Q15_ONE, target_q15); - buffer32_fill16(dest, src2, target_q15, samples); - buffer32_mix16(dest, src1, gain_q15, samples); - } - } - - panner->sampleCounter = pan_samples; -} - - -static BASSBOOST_RESULT bassboost_proc16(bassboost_private_t *obj_ptr, int16 **out_ptr, int16 **in_ptr, int32 samples) -{ - int32 num_chs = obj_ptr->static_vars.num_chs; - int16 **bass_buf = (int16 **)obj_ptr->bass_buf; - int16 **onset_buf = (int16 **)obj_ptr->onset_buf; - int32 **mix_buf = obj_ptr->mix_buf; - pannerStruct *strength = &obj_ptr->strenghth_fader; - pannerStruct *onset = obj_ptr->onset_fader; - pannerStruct *onoff = obj_ptr->onoff_fader; - int32 ch; - - // bypass mode (low MIPS) - if (0 >= obj_ptr->onoff_fader->sampleCounter && 0 == obj_ptr->enable) { - if (out_ptr != in_ptr) { - for (ch = 0; ch < num_chs; ++ch) { - buffer_copy(out_ptr[ch], in_ptr[ch], samples); - } - } - return BASSBOOST_SUCCESS; - } - - for (ch = 0; ch < num_chs; ++ch) { - // fade in or copy input samples - buffer_fill_with_panner(onset_buf[ch], in_ptr[ch], &onset[ch], samples); - // filter input, put bass part in bass buf - msiir_process_v2(&obj_ptr->bass_fltrs[ch], bass_buf[ch], onset_buf[ch], samples); - // filter input, put band pass portion in out buf as scratch - msiir_process_v2(&obj_ptr->band_fltrs[ch], out_ptr[ch], onset_buf[ch], samples); - // copy input to mix buf - buffer32_copy16(mix_buf[ch], onset_buf[ch], samples); - // mix band pass signal into bass buf: bass+0.5*band - buffer_mix(bass_buf[ch], out_ptr[ch], Q15_HALF, samples); - // inplace delay mixing buf contents - delayline32_inplace_delay(mix_buf[ch], &obj_ptr->delaylines[ch], samples); - } - - // apply drc on bass - drc_process(&obj_ptr->drc_lib, (int8 **)bass_buf, (int8 **)bass_buf, samples); - // mix bass and direct sound - smooth_bass_mix16(mix_buf, bass_buf, strength, num_chs, samples); - // use bass_buf as scratch for processed samples - limiter_process(&obj_ptr->limiter_lib, (void **)bass_buf, mix_buf, samples); - // cross fade at the output when needed - for (ch = 0; ch < num_chs; ++ch) { - bb_crossmix_panner(out_ptr[ch], bass_buf[ch], in_ptr[ch], &onoff[ch], samples); - } - - return BASSBOOST_SUCCESS; -} - -static BASSBOOST_RESULT bassboost_proc32(bassboost_private_t *obj_ptr, int32 **out_ptr, int32 **in_ptr, int32 samples) -{ - int32 num_chs = obj_ptr->static_vars.num_chs; - int32 **bass_buf = (int32 **)obj_ptr->bass_buf; - int32 **onset_buf = (int32 **)obj_ptr->onset_buf; - int32 **mix_buf = obj_ptr->mix_buf; - pannerStruct *strength = &obj_ptr->strenghth_fader; - pannerStruct *onset = obj_ptr->onset_fader; - pannerStruct *onoff = obj_ptr->onoff_fader; - int32 ch; - - // bypass mode (low MIPS) - if (0 >= obj_ptr->onoff_fader->sampleCounter && 0 == obj_ptr->enable) { - if (out_ptr != in_ptr) { - for (ch = 0; ch < num_chs; ++ch) { - buffer32_copy(out_ptr[ch], in_ptr[ch], samples); - } - } - return BASSBOOST_SUCCESS; - } - - for (ch = 0; ch < num_chs; ++ch) { - // fade in or copy input samples - buffer32_fill_panner(onset_buf[ch], in_ptr[ch], &onset[ch], samples); - // filter input, put bass part in bass buf - msiir_process_v2(&obj_ptr->bass_fltrs[ch], bass_buf[ch], onset_buf[ch], samples); - // filter input, put band pass portion in out buf as scratch - msiir_process_v2(&obj_ptr->band_fltrs[ch], out_ptr[ch], onset_buf[ch], samples); - // copy input to mix buf - buffer32_copy(mix_buf[ch], onset_buf[ch], samples); - // mix band pass signal into bass buf: bass+0.5*band - buffer32_mix16(bass_buf[ch], out_ptr[ch], Q15_HALF, samples); - // inplace delay mixing buf contents - delayline32_inplace_delay(mix_buf[ch], &obj_ptr->delaylines[ch], samples); - } - - // apply drc on bass - drc_process(&obj_ptr->drc_lib, (int8 **)bass_buf, (int8 **)bass_buf, samples); - // mix bass and direct sound - smooth_bass_mix32(mix_buf, bass_buf, strength, num_chs, samples); - // use bass_buf as scratch for processed samples - limiter_process(&obj_ptr->limiter_lib, (void **)bass_buf, mix_buf, samples); - // cross fade at the output when needed - for (ch = 0; ch < num_chs; ++ch) { - bb32_crossmix_panner(out_ptr[ch], bass_buf[ch], in_ptr[ch], &onoff[ch], samples); - } - - return BASSBOOST_SUCCESS; - } - -/*---------------------------------------------------------------------------- - API Functions -----------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------- -// ** Processing one block of samples -// lib_ptr: [in] pointer to library structure -// out_ptr: [out] pointer to output sample block (multi channel double ptr) -// in_ptr: [in] pointer to input sample block (multi channel double ptr) -// samples: [in] number of samples to be processed per channel -----------------------------------------------------------------------------*/ -BASSBOOST_RESULT bassboost_process(bassboost_lib_t *lib_ptr, void **out_ptr, void **in_ptr, uint32 api_samples) -{ - bassboost_private_t *obj_ptr = (bassboost_private_t *)lib_ptr->mem_ptr; - int32 samples = (int32)api_samples; - - // sanity check block size - if (samples > obj_ptr->static_vars.max_block_size) { - return BASSBOOST_FAILURE; - } - - // process for 16/32 bit respectively - if (16 == obj_ptr->static_vars.data_width) { - return bassboost_proc16(obj_ptr, (int16 **)out_ptr, (int16 **)in_ptr, samples); - } else { - return bassboost_proc32(obj_ptr, (int32 **)out_ptr, (int32 **)in_ptr, samples); - } -} - -/*---------------------------------------------------------------------------- -// ** Get library memory requirements -// mem_req_ptr: [out] pointer to mem requirements structure -// static_vars_ptr: [in] pointer to static variable structure -----------------------------------------------------------------------------*/ -BASSBOOST_RESULT bassboost_get_mem_req(bassboost_mem_req_t *mem_req_ptr, bassboost_static_vars_t* static_vars_ptr) -{ - uint32 reqsize; - int32 data_width = static_vars_ptr->data_width; - int32 sample_rate = static_vars_ptr->sample_rate; - int32 max_block_size = static_vars_ptr->max_block_size; - int32 num_chs = static_vars_ptr->num_chs; - int32 limiter_delay_ms = static_vars_ptr->limiter_delay; - - msiir_static_vars_t msiir_static; - msiir_mem_req_t msiir_mem_req; - drc_static_struct_t drc_static; - drc_lib_mem_requirements_t drc_mem_req; - limiter_static_vars_t limiter_static; - limiter_mem_req_t limiter_mem_req; - - int32 direct_delay, bytes_per_sample, delay_samples, limiter_delay_q15_sec, ch; - - /* first, sanity check data width */ - if (16 == data_width) { - bytes_per_sample = 2; - } else if (32 == data_width) { - bytes_per_sample = 4; - } else { - return BASSBOOST_FAILURE; - } - - /* start with fixed structure */ - reqsize = smm_malloc_size(sizeof(bassboost_private_t)); - - /*------------------------ calculate limiter mems ------------------------*/ - clip_32(&limiter_delay_ms, 0, c_limiter_max_delay_ms); - limiter_delay_q15_sec = s32_mult_s16_s16((int16)limiter_delay_ms, 33); - - limiter_static.data_width = data_width; - limiter_static.sample_rate = sample_rate; - limiter_static.max_block_size = max_block_size; - limiter_static.num_chs = num_chs; - limiter_static.delay = limiter_delay_q15_sec; - - if (LIMITER_SUCCESS != limiter_get_mem_req(&limiter_mem_req, &limiter_static)) { - return BASSBOOST_FAILURE; - } - reqsize += smm_malloc_size(limiter_mem_req.mem_size); - - /*-------------------------- calculate drc mems --------------------------*/ - delay_samples = ms_to_sample(c_drc_delay_ms, sample_rate); - - drc_static.data_width = (16 == data_width)? BITS_16: BITS_32; - drc_static.sample_rate = sample_rate; - drc_static.num_channel = num_chs; - drc_static.delay = delay_samples; - - if ((int)MSIIR_SUCCESS != (int)drc_get_mem_req(&drc_mem_req, &drc_static)) { - return BASSBOOST_FAILURE; - } - reqsize += smm_malloc_size(drc_mem_req.lib_mem_size); - - /*------------------------- calculate delay line -------------------------*/ - direct_delay = ms_to_sample(c_drc_delay_ms, sample_rate); - reqsize += smm_calloc_size(num_chs, sizeof(delayline32_t)); - for (ch = 0; ch < num_chs; ++ch) { - reqsize += smm_calloc_size(direct_delay, sizeof(int32)); - } - - /*--------------------- calculate onoff/onset faders ---------------------*/ - reqsize += smm_calloc_size(num_chs, sizeof(pannerStruct)); - reqsize += smm_calloc_size(num_chs, sizeof(pannerStruct)); - - /*------------------------- calculate msiir mems -------------------------*/ - reqsize += smm_calloc_size(num_chs, sizeof (msiir_lib_t)); // bass - reqsize += smm_calloc_size(num_chs, sizeof (msiir_lib_t)); // band - - msiir_static.data_width = data_width; - msiir_static.max_stages = 1; - if (MSIIR_SUCCESS != msiir_get_mem_req(&msiir_mem_req, &msiir_static)) { - return BASSBOOST_FAILURE; - } - - for (ch = 0; ch < num_chs; ++ch) { - reqsize += smm_malloc_size(msiir_mem_req.mem_size); // bass - reqsize += smm_malloc_size(msiir_mem_req.mem_size); // band - } - - /*--------------------------- scratch buffers ----------------------------*/ - reqsize += smm_calloc_size(num_chs, sizeof (void *)); // bass scratch - reqsize += smm_calloc_size(num_chs, sizeof (void *)); // onset scratch - reqsize += smm_calloc_size(num_chs, sizeof (int32 *)); // mix buf - - for (ch = 0; ch < num_chs; ++ch) { - reqsize += smm_calloc_size(max_block_size, bytes_per_sample); // bass - reqsize += smm_calloc_size(max_block_size, bytes_per_sample); // onset - reqsize += smm_calloc_size(max_block_size, sizeof(int32)); // 32bit mix - } - - /*------------------------- store requirements ---------------------------*/ - mem_req_ptr->mem_size = reqsize; - mem_req_ptr->stack_size = c_bassboost_max_stack_size; - - return BASSBOOST_SUCCESS; -} - -/*---------------------------------------------------------------------------- -// ** Partition, initialize memory, and set default values -// lib_ptr: [in, out] pointer to library structure -// static_vars_ptr: [in] pointer to static variable structure -// mem_ptr: [in] pointer to allocated memory -// mem_size: [in] size of memory allocated -----------------------------------------------------------------------------*/ -BASSBOOST_RESULT bassboost_init_mem(bassboost_lib_t *lib_ptr, bassboost_static_vars_t* static_vars_ptr, void* mem_ptr, uint32 mem_size) -{ - SimpleMemMgr MemMgr; - SimpleMemMgr *smm = &MemMgr; - bassboost_mem_req_t mem_req; - bassboost_private_t *obj_ptr; - int32 num_chs = static_vars_ptr->num_chs; - int32 sample_rate = static_vars_ptr->sample_rate; - int32 data_width = static_vars_ptr->data_width; - int32 max_block_size = static_vars_ptr->max_block_size; - int32 limiter_delay_ms = static_vars_ptr->limiter_delay; - - msiir_static_vars_t msiir_static; - msiir_mem_req_t msiir_mem_req; - drc_static_struct_t drc_static; - drc_lib_mem_requirements_t drc_mem_req; - limiter_static_vars_t limiter_static; - limiter_mem_req_t limiter_mem_req; - - int32 bytes_per_sample, delay_samples, direct_delay, limiter_delay_q15_sec, ch; - - /* double check if allocated mem is enough */ - bassboost_get_mem_req(&mem_req, static_vars_ptr); - if (mem_req.mem_size > mem_size) { - return BASSBOOST_MEMERROR; - } - - /* sanity check data width */ - if (16 == data_width) { - bytes_per_sample = 2; - } else if (32 == data_width) { - bytes_per_sample = 4; - } else { - return BASSBOOST_FAILURE; - } - - /* assign initial mem pointers and allocate current instance */ - lib_ptr->mem_ptr = mem_ptr; - smm_init(smm, lib_ptr->mem_ptr); - obj_ptr = (bassboost_private_t *)smm_malloc(smm, sizeof(bassboost_private_t)); - - /* keep a copy of static vars */ - obj_ptr->static_vars = *static_vars_ptr; - - /*-------------------- alloc & config safeguard limiter ------------------*/ - clip_32(&limiter_delay_ms, 0, c_limiter_max_delay_ms); - limiter_delay_q15_sec = s32_mult_s16_s16((int16)limiter_delay_ms, 33); - - limiter_static.data_width = data_width; - limiter_static.sample_rate = sample_rate; - limiter_static.max_block_size = max_block_size; - limiter_static.num_chs = num_chs; - limiter_static.delay = limiter_delay_q15_sec; - - limiter_get_mem_req(&limiter_mem_req, &limiter_static); - mem_size = limiter_mem_req.mem_size; - mem_ptr = smm_malloc(smm, mem_size); - if (LIMITER_SUCCESS != limiter_init_mem( - &obj_ptr->limiter_lib, &limiter_static, mem_ptr, mem_size)) { - return BASSBOOST_FAILURE; - } - - /*------------------------- alloc & config drc --------------------------*/ - delay_samples = ms_to_sample(c_drc_delay_ms, sample_rate); - - drc_static.data_width = (16 == data_width)? BITS_16: BITS_32; - drc_static.sample_rate = sample_rate; - drc_static.num_channel = num_chs; - drc_static.delay = delay_samples; - - drc_get_mem_req(&drc_mem_req, &drc_static); - mem_size = drc_mem_req.lib_mem_size; - mem_ptr = smm_malloc(smm, mem_size); - if (DRC_SUCCESS != drc_init_memory( - &obj_ptr->drc_lib, &drc_static, mem_ptr, mem_size)) { - return BASSBOOST_FAILURE; - } - - /*------------------------- alloc direct delay --------------------------*/ - direct_delay = ms_to_sample(c_drc_delay_ms, sample_rate); - obj_ptr->delaylines = (delayline32_t *)smm_calloc(smm, num_chs, sizeof(delayline32_t)); - for (ch = 0; ch < num_chs; ++ch) { - obj_ptr->delaylines[ch].buf = (int32 *)smm_calloc( smm, direct_delay, sizeof(int32)); - obj_ptr->delaylines[ch].buf_size = direct_delay; - } - - /*----------------------- alloc onoff/onset fader ------------------------*/ - obj_ptr->onoff_fader = (pannerStruct *)smm_calloc(smm, num_chs, sizeof(pannerStruct)); - obj_ptr->onset_fader = (pannerStruct *)smm_calloc(smm, num_chs, sizeof(pannerStruct)); - - /*---------------------- alloc for msiir filter --------------------------*/ - obj_ptr->bass_fltrs = (msiir_lib_t *)smm_calloc(smm, num_chs, sizeof(msiir_lib_t)); - obj_ptr->band_fltrs = (msiir_lib_t *)smm_calloc(smm, num_chs, sizeof(msiir_lib_t)); - - msiir_static.data_width = data_width; - msiir_static.max_stages = BASSBOOST_IIR_STAGES; - msiir_get_mem_req(&msiir_mem_req, &msiir_static); - mem_size = msiir_mem_req.mem_size; - - for (ch = 0; ch < num_chs; ++ch) { - mem_ptr = smm_malloc(smm, mem_size); - if (MSIIR_SUCCESS != msiir_init_mem( - &obj_ptr->bass_fltrs[ch], &msiir_static, mem_ptr, mem_size)) { - return BASSBOOST_FAILURE; - } - - mem_ptr = smm_malloc(smm, mem_size); - if (MSIIR_SUCCESS != msiir_init_mem( - &obj_ptr->band_fltrs[ch], &msiir_static, mem_ptr, mem_size)) { - return BASSBOOST_FAILURE; - } - } - - /*--------------------------- alloc scratch buffers ----------------------*/ - obj_ptr->bass_buf = (void **)smm_calloc(smm, num_chs, sizeof(void *)); - obj_ptr->onset_buf = (void **)smm_calloc(smm, num_chs, sizeof(void *)); - obj_ptr->mix_buf = (int32 **)smm_calloc(smm, num_chs, sizeof(int32 *)); - - for (ch = 0; ch < num_chs; ++ch) { - obj_ptr->bass_buf[ch] = (void *)smm_calloc(smm, max_block_size, bytes_per_sample); - obj_ptr->onset_buf[ch] = (void *)smm_calloc(smm, max_block_size, bytes_per_sample); - obj_ptr->mix_buf[ch] = (int32 *)smm_calloc(smm, max_block_size, sizeof(int32)); - } - - /*--------------------------- set default values -------------------------*/ - return set_default(obj_ptr); -} - -/*---------------------------------------------------------------------------- -// ** Set parameters to library -// lib_ptr: [in, out] pointer to lib structure -// param_id: [in] parameter id -// param_ptr: [in] pointer to the memory where the new values are stored -// param_size:[in] size of the memory pointed by param_ptr -----------------------------------------------------------------------------*/ -BASSBOOST_RESULT bassboost_set_param(bassboost_lib_t* lib_ptr, uint32 param_id, void* mem_ptr, uint32 mem_size) -{ - bassboost_private_t *obj_ptr = (bassboost_private_t *)lib_ptr->mem_ptr; - bassboost_mode_t new_mode; - int16 strength, strength_q15; - int32 enable, ch; - - switch (param_id) { - - case BASSBOOST_PARAM_ENABLE: - if (mem_size == sizeof(bassboost_enable_t)) { - enable = *((bassboost_enable_t *)mem_ptr); - if (0 != enable) { enable = 1; } - if (obj_ptr->enable != enable) { - obj_ptr->enable = enable; - // handle onset panner and buf to ramp up input - if (1 == enable && 0 == obj_ptr->onoff_fader->sampleCounter) { - reset(obj_ptr); - for (ch = 0; ch < obj_ptr->static_vars.num_chs; ++ch) { - panner_setup(&obj_ptr->onset_fader[ch], 0, 0, 0); - panner_setup(&obj_ptr->onset_fader[ch], Q15_ONE, obj_ptr->onset_smps, 0); - } - } - // onoff crossfader: has reverse logic, 0: on, Q15_ONE: off - // this design is to accommodate inplace processing - strength_q15 = enable ? 0 : Q15_ONE; - for (ch = 0; ch < obj_ptr->static_vars.num_chs; ++ch) { - panner_setup(&obj_ptr->onoff_fader[ch], strength_q15, obj_ptr->ramp_smps, 0); - } - } - } else { - return BASSBOOST_MEMERROR; // parameter size doesn't match - } - break; - - case BASSBOOST_PARAM_MODE: - if (mem_size == sizeof(bassboost_mode_t)) { - new_mode = *((bassboost_mode_t *)mem_ptr); - - if (obj_ptr->mode != new_mode) { - // current bass boost supports only physical boost, thus it's - // hard coded here. when we add virtual boost later, the following - // lines should be changed. - April, 2013 - - //obj_ptr->mode = new_mode; - obj_ptr->mode = PHYSICAL_BOOST; - reset(obj_ptr); - } - } else { - return BASSBOOST_MEMERROR; // parameter size doesn't match - } - break; - - case BASSBOOST_PARAM_STRENGTH: - if (mem_size == sizeof(bassboost_strength_t)) { - strength = s16_saturate_s32(*((bassboost_strength_t *)mem_ptr)); - if (obj_ptr->strength != strength) { - obj_ptr->strength = strength; - // convert to Q15 value: gain * 32767 / 1000 - strength_q15 = s16_saturate_s32(Q23_mult(strength, 274869518)); - panner_setup(&obj_ptr->strenghth_fader, strength_q15, obj_ptr->ramp_smps, 0); - } - } else { - return BASSBOOST_MEMERROR; // parameter size doesn't match - } - break; - - case BASSBOOST_PARAM_RESET: - reset(obj_ptr); - break; - - default: - return BASSBOOST_FAILURE; // unidentified parma ID - } - - return BASSBOOST_SUCCESS; -} - - -/*---------------------------------------------------------------------------- -// ** Get parameters from library -// lib_ptr: [in] pointer to library structure -// param_id: [in] parameter id -// param_ptr: [out] pointer to the memory where the retrieved value is going to be stored -// param_size:[in] size of the memory pointed by param_ptr -// param_actual_size_ptr: [out] pointer to memory that will hold the actual size of the parameter -----------------------------------------------------------------------------*/ -BASSBOOST_RESULT bassboost_get_param(bassboost_lib_t* lib_ptr, uint32 param_id, void* mem_ptr, uint32 mem_size, uint32 *param_size_ptr) -{ - bassboost_private_t *obj_ptr = (bassboost_private_t *)lib_ptr->mem_ptr; - - switch (param_id) { - - case BASSBOOST_PARAM_LIB_VER: - // get library version - if (mem_size >= sizeof(bassboost_version_t)) { - *((bassboost_version_t *)mem_ptr) = BASSBOOST_LIB_VER; - *param_size_ptr = sizeof(bassboost_version_t); - } else { - return BASSBOOST_MEMERROR; - } - break; - - case BASSBOOST_PARAM_ENABLE: - if (mem_size >= sizeof(bassboost_enable_t)) { - *((bassboost_enable_t *)mem_ptr) = obj_ptr->enable; - *param_size_ptr = sizeof(bassboost_enable_t); - } else { - return BASSBOOST_MEMERROR; - } - break; - - case BASSBOOST_PARAM_MODE: - if (mem_size >= sizeof(bassboost_mode_t)) { - *((bassboost_mode_t *)mem_ptr) = obj_ptr->mode; - *param_size_ptr = sizeof(bassboost_mode_t); - } else { - return BASSBOOST_MEMERROR; - } - break; - - case BASSBOOST_PARAM_STRENGTH: - // get tuning parameters for certain channel - if (mem_size >= sizeof(bassboost_strength_t)) { - *((bassboost_strength_t *)mem_ptr) = obj_ptr->strength; - *param_size_ptr = sizeof(bassboost_strength_t); - } else { - return BASSBOOST_MEMERROR; - } - break; - - case BASSBOOST_PARAM_DELAY: - // algorithmic delay = drc + limiter delay, in samples - if (mem_size >= sizeof(bassboost_delay_t)) { - if (0 >= obj_ptr->onoff_fader->sampleCounter && - 0 == obj_ptr->enable) { // if disabled steady state, no delay - *((bassboost_delay_t *)mem_ptr) = 0; - } else { - *((bassboost_delay_t *)mem_ptr) = obj_ptr->delaylines[0].buf_size + - ms_to_sample((int16)obj_ptr->static_vars.limiter_delay, - obj_ptr->static_vars.sample_rate); - } - *param_size_ptr = sizeof(bassboost_delay_t); - } else { - return BASSBOOST_MEMERROR; - } - break; - - case BASSBOOST_PARAM_CROSSFADE_FLAG: - // if onoff fader still has samples left, then it's in transition - if (mem_size >= sizeof(bassboost_crossfade_t)) { - if (0 >= obj_ptr->onoff_fader->sampleCounter) { - *((bassboost_crossfade_t *)mem_ptr) = 0; - } else { - *((bassboost_crossfade_t *)mem_ptr) = 1; - } - *param_size_ptr = sizeof(bassboost_crossfade_t); - } else { - return BASSBOOST_MEMERROR; - } - break; - default: - return BASSBOOST_FAILURE; // invalid parameter id - } - - return BASSBOOST_SUCCESS; -} - - diff --git a/modules/processing/bassboost/lib/src/bassboost.h b/modules/processing/bassboost/lib/src/bassboost.h deleted file mode 100644 index 69639a4e..00000000 --- a/modules/processing/bassboost/lib/src/bassboost.h +++ /dev/null @@ -1,96 +0,0 @@ -#ifndef BASSBOOST_H -#define BASSBOOST_H -/*============================================================================ - @file bassboost.h - - Private Header for Bass Boost Effect - - Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. - SPDX-License-Identifier: BSD-3-Clause-Clear -============================================================================*/ -#include "bassboost_api.h" - -/*---------------------------------------------------------------------------- - Include Files -----------------------------------------------------------------------------*/ -#include "audio_dsp32.h" -#include "limiter_api.h" -#include "msiir_api.h" -#include "drc_api.h" - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/*---------------------------------------------------------------------------- - Constants -----------------------------------------------------------------------------*/ -#define BASSBOOST_IIR_STAGES (1) // only one stage iir -#define BASSBOOST_NUM_RATES (6) // sample rate count -static const int32 c_bassboost_max_stack_size = 800; // worst stack size (552) -static const int16 c_limiter_max_delay_ms = 20; // 20ms supports down to 25 Hz signal -static const int16 c_drc_delay_ms = 4; // 4ms constant drc delay -static const int16 c_fader_smooth_ms = 100; // panner smooth time (ms) -static const int16 c_onset_smooth_ms = 30; // onset panner smooth time (ms) -static const int32 c_bass_freq_hz = 200; // bass cutoff frequency -static const int32 c_band_freq_hz = 350; // band-pass center frequency -static const int32 c_iir_shift_factor = 2; // iir filter shift factor - -/*---------------------------------------------------------------------------- - Type Declarations -----------------------------------------------------------------------------*/ -/* sampling rates having pre-calculated params for */ -static const int32 bassboost_rates_const[BASSBOOST_NUM_RATES] = { - 22050, - 32000, - 44100, - 48000, - 96000, - 192000 -}; - -/* attack / release constant for the 4 frequencies (15ms) */ -static const int32 bassboost_atrt_const[BASSBOOST_NUM_RATES] = { - 111285605, - 77314964, - 56382981, - 51857647, - 26087276, - 13083493 -}; - -/* main data struct */ -typedef struct bassboost_private_t { // ** main private structure - - /* internal copy of static vars */ - bassboost_static_vars_t static_vars; - - /* internal copy of tuning vars */ - bassboost_enable_t enable; // on/off switch [0 or 1] - bassboost_mode_t mode; // (placeholder) - bassboost_strength_t strength; // effect strength [0, 1000] - - /* other internal vars */ - limiter_lib_t limiter_lib; // safeguard limiter instance - drc_lib_t drc_lib; // drc instance - msiir_lib_t *bass_fltrs; // low-pass filter array - msiir_lib_t *band_fltrs; // band-pass filter array - delayline32_t *delaylines; // direct delays to match drc - - int32 ramp_smps; // smooth panner ramp samples - int32 onset_smps; // smooth samples for onset fader - pannerStruct strenghth_fader; // fader for strength - pannerStruct *onoff_fader; // fader for enable/disable - pannerStruct *onset_fader; // fader for enable transition - - void **bass_buf; // buffer to hold bass content - void **onset_buf; // buffer to hold smoothed input samples - int32 **mix_buf; // buffer to hold samples before limiting - -} bassboost_private_t; - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* BASSBOOST_H */ diff --git a/modules/processing/gain_control/drc/api/api_drc.h b/modules/processing/gain_control/drc/api/api_drc.h deleted file mode 100644 index 22e2a6a1..00000000 --- a/modules/processing/gain_control/drc/api/api_drc.h +++ /dev/null @@ -1,289 +0,0 @@ -#ifndef API_DRC_H -#define API_DRC_H -/*============================================================================== - @file drc_api.h - @brief This file contains DRC APIs -==============================================================================*/ -/*======================================================================= - * Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. - * SPDX-License-Identifier: BSD-3-Clause-Clear -=========================================================================*/ - -/*============================================================================== - Include Files -==============================================================================*/ - -#include "module_cmn_api.h" -#include "imcl_spm_intent_api.h" - -/*============================================================================== - Constants -==============================================================================*/ - -/* Stack size of DRC module */ -#define DRC_STACK_SIZE 2048 - - -/*============================================================================== - Param ID -==============================================================================*/ - -#define PARAM_ID_DRC_CONFIG 0x0800113E -/** @h2xmlp_parameter {"PARAM_ID_DRC_CONFIG", PARAM_ID_DRC_CONFIG} - @h2xmlp_description {DRC config parameters.} - @h2xmlp_toolPolicy {Calibration; RTC} */ - -typedef struct param_id_drc_config_t param_id_drc_config_t; - -#include "spf_begin_pack.h" -struct param_id_drc_config_t -{ - uint16_t mode; - /**< @h2xmle_description {Enable/disables the DRC feature. In Bypass mode, only delay is applied.} - @h2xmle_rangeList {"Bypass";0, "Enable";1} - @h2xmle_default {1} - @h2xmle_policy {Basic}*/ - - uint16_t channel_linked_mode; - /**< @h2xmle_description {Specifies whether all channels have the same applied dynamics(Linked) - or if they process their dynamics independently(Unlinked).} - @h2xmle_rangeList {"CHANNEL_UNLINKED";0, "CHANNEL_LINKED";1} - @h2xmle_default {0} - @h2xmle_policy {Basic}*/ - - uint16_t rms_time_avg_const; - /**< @h2xmle_description {Time-averaging constant for computing energy} - @h2xmle_range {0..65535} - @h2xmle_dataFormat {Q16} - @h2xmle_default {299} - @h2xmle_policy {Basic} */ - - uint16_t makeup_gain; - /**< @h2xmle_description {Makeup gain in dB applied after DRC.} - @h2xmle_range {0..65535} - @h2xmle_dataFormat {Q12} - @h2xmle_default {4096} - @h2xmle_displayType {dbtextbox} - @h2xmle_policy {Basic} */ - - int16_t down_expdr_threshold; - /**< @h2xmle_description {Downward expander threshold in dB} - @h2xmle_range {-32768..32767} - @h2xmle_dataFormat {Q7} - @h2xmle_default {3239} - @h2xmle_policy {Basic} */ - - int16_t down_expdr_slope; - /**< @h2xmle_description {Downward expander slope.} - @h2xmle_range {-32768..32767} - @h2xmle_dataFormat {Q8} - @h2xmle_default {-383} - @h2xmle_policy {Basic} */ - - uint32_t down_expdr_attack; - /**< @h2xmle_description {Down expander attack constant.} - @h2xmle_range {0..2147483648} - @h2xmle_dataFormat {Q31} - @h2xmle_default {1604514739} - @h2xmle_policy {Basic} */ - - uint32_t down_expdr_release; - /**< @h2xmle_description {Down expander release constant.} - @h2xmle_range {0..2147483648} - @h2xmle_dataFormat {Q31} - @h2xmle_default {1604514739} - @h2xmle_policy {Basic} */ - - int32_t down_expdr_min_gain_db; - /**< @h2xmle_description {Downward expander minimum gain in dB.} - @h2xmle_range {-2147483648..2147483647} - @h2xmle_dataFormat {Q23} - @h2xmle_default {-50331648} - @h2xmle_policy {Basic} */ - - uint16_t down_expdr_hysteresis; - /**< @h2xmle_description {Down expander hysteresis constant.} - @h2xmle_range {0..65535} - @h2xmle_dataFormat {Q14} - @h2xmle_default {16384} - @h2xmle_policy {Basic} */ - - int16_t up_cmpsr_threshold; - /**< @h2xmle_description {Upward compressor threshold.} - @h2xmle_range {-32768..32767} - @h2xmle_dataFormat {Q7} - @h2xmle_default {3239} - @h2xmle_policy {Basic} */ - - uint32_t up_cmpsr_attack; - /**< @h2xmle_description {Up compressor attack constant.} - @h2xmle_range {0..2147483648} - @h2xmle_dataFormat {Q31} - @h2xmle_default {5897467} - @h2xmle_policy {Basic} */ - - uint32_t up_cmpsr_release; - /**< @h2xmle_description {Up compressor release constant.} - @h2xmle_range {0..2147483648} - @h2xmle_dataFormat {Q31} - @h2xmle_default {5897467} - @h2xmle_policy {Basic} */ - - uint16_t up_cmpsr_slope; - /**< @h2xmle_description {Upward compression slope.} - @h2xmle_range {0..65535} - @h2xmle_dataFormat {Q16} - @h2xmle_default {0} - @h2xmle_policy {Basic} */ - - uint16_t up_cmpsr_hysteresis; - /**< @h2xmle_description {Up compressor hysteresis constant.} - @h2xmle_range {0..65535} - @h2xmle_dataFormat {Q14} - @h2xmle_default {18855} - @h2xmle_policy {Basic} */ - - int16_t down_cmpsr_threshold; - /**< @h2xmle_description {Downward compressor threshold.} - @h2xmle_range {-32768..32767} - @h2xmle_dataFormat {Q7} - @h2xmle_default {9063} - @h2xmle_policy {Basic} */ - - uint16_t down_cmpsr_slope; - /**< @h2xmle_description {Downward compression slope.} - @h2xmle_range {0..65535} - @h2xmle_dataFormat {Q16} - @h2xmle_default {64879} - @h2xmle_policy {Basic} */ - - uint32_t down_cmpsr_attack; - /**< @h2xmle_description {Down compressor attack constant.} - @h2xmle_range {0..2147483648} - @h2xmle_dataFormat {Q31} - @h2xmle_default {1604514739} - @h2xmle_policy {Basic} */ - - uint32_t down_cmpsr_release; - /**< @h2xmle_description {Down compressor release constant.} - @h2xmle_range {0..2147483648} - @h2xmle_dataFormat {Q31} - @h2xmle_default {1604514739} - @h2xmle_policy {Basic} */ - - uint16_t down_cmpsr_hysteresis; - /**< @h2xmle_description {Down compressor hysteresis constant.} - @h2xmle_range {0..65535} - @h2xmle_dataFormat {Q14} - @h2xmle_default {16384} - @h2xmle_policy {Basic} */ - - uint16_t down_sample_level; - /**< @h2xmle_description {DRC down sample level.} - @h2xmle_range {1..16} - @h2xmle_default {1} - @h2xmle_displayType {slider} - @h2xmle_policy {Basic} */ - - uint32_t delay_us; - /**< @h2xmle_description {DRC delay in microseconds.} - @h2xmle_range {0..100000} - @h2xmle_default {5000} - @h2xmle_policy {Basic} */ -} -#include "spf_end_pack.h" -; - -/*------------------------------------------------------------------------------ - Module -------------------------------------------------------------------------------*/ - -#define MODULE_ID_DRC 0x07001066 -/** - @h2xmlm_module {"MODULE_ID_DRC", MODULE_ID_DRC} - @h2xmlm_displayName {"Dynamic Range Control"} - @h2xmlm_modSearchKeys{drc, Audio, Voice} - @h2xmlm_description { - Dynamic Range Control Algorithm. - - This module supports the following parameter IDs:\n - - #PARAM_ID_MODULE_ENABLE\n - - #PARAM_ID_DRC_CONFIG\n - - Supported Input Media Format: \n - - Data Format : FIXED \n - - fmt_id : PCM \n - - Sample Rates : Don't care \n - - Number of channels : 1...32 \n - - Channel type : Don't care \n - - Bits per sample : 16, 32 \n - - Q format : Q15, Q27 \n - - Interleaving : De-interleaved unpacked \n - - Signed/unsigned : Signed \n} - @h2xmlm_dataMaxInputPorts {1} - @h2xmlm_dataMaxOutputPorts {1} - @h2xmlm_supportedContTypes {APM_CONTAINER_TYPE_SC, APM_CONTAINER_TYPE_GC} - @h2xmlm_isOffloadable {true} - @h2xmlm_stackSize {DRC_STACK_SIZE} - @h2xmlm_ctrlDynamicPortIntent { "DRC DOWN COMP threshold" = INTENT_ID_DRC_CONFIG, maxPorts= 1 } - @h2xmlm_toolPolicy { Calibration } - - @{ <-- Start of the Module --> - - @h2xml_Select {param_id_module_enable_t} - @h2xmlm_InsertParameter - - @h2xml_Select {param_id_drc_config_t} - @h2xmlm_InsertParameter - - @h2xml_Select {param_id_drc_config_t::rms_time_avg_const} - - @h2xmle_defaultDependency { Samplerate = "8000", default = "598"} - @h2xmle_defaultDependency { Samplerate = "16000", default = "299"} - @h2xmle_defaultDependency { Samplerate = "32000", default = "1484"} - @h2xmle_defaultDependency { Samplerate = "48000", default = "993"} - - @h2xml_Select {param_id_drc_config_t::down_expdr_attack} - - @h2xmle_defaultDependency { Samplerate = "8000", default = "2010199605"} - @h2xmle_defaultDependency { Samplerate = "16000", default = "1604514739"} - @h2xmle_defaultDependency { Samplerate = "32000", default = "1067661045"} - @h2xmle_defaultDependency { Samplerate = "48000", default = "789550996"} - - @h2xml_Select {param_id_drc_config_t::down_expdr_release} - - @h2xmle_defaultDependency { Samplerate = "8000", default = "2010199605"} - @h2xmle_defaultDependency { Samplerate = "16000", default = "1604514739"} - @h2xmle_defaultDependency { Samplerate = "32000", default = "1067661045"} - @h2xmle_defaultDependency { Samplerate = "48000", default = "789550996"} - - @h2xml_Select {param_id_drc_config_t::up_cmpsr_attack} - - @h2xmle_defaultDependency { Samplerate = "8000", default = "5897467"} - @h2xmle_defaultDependency { Samplerate = "16000", default = "5897467"} - @h2xmle_defaultDependency { Samplerate = "32000", default = "2950761"} - @h2xmle_defaultDependency { Samplerate = "48000", default = "1967625"} - - @h2xml_Select {param_id_drc_config_t::up_cmpsr_release} - - @h2xmle_defaultDependency { Samplerate = "8000", default = "5897468"} - @h2xmle_defaultDependency { Samplerate = "16000", default = "5897467"} - @h2xmle_defaultDependency { Samplerate = "32000", default = "2950761"} - @h2xmle_defaultDependency { Samplerate = "48000", default = "1967625"} - - @h2xml_Select {param_id_drc_config_t::down_cmpsr_attack} - - @h2xmle_defaultDependency { Samplerate = "8000", default = "2010199605"} - @h2xmle_defaultDependency { Samplerate = "16000", default = "1604514739"} - @h2xmle_defaultDependency { Samplerate = "32000", default = "1067661045"} - @h2xmle_defaultDependency { Samplerate = "48000", default = "789550996"} - - @h2xml_Select {param_id_drc_config_t::down_cmpsr_release} - - @h2xmle_defaultDependency { Samplerate = "8000", default = "2010199605"} - @h2xmle_defaultDependency { Samplerate = "16000", default = "1604514739"} - @h2xmle_defaultDependency { Samplerate = "32000", default = "1067661045"} - @h2xmle_defaultDependency { Samplerate = "48000", default = "789550996"} - -@} <-- End of the Module -->*/ - - - -#endif diff --git a/modules/processing/gain_control/drc/bin/arm/libdrc.a b/modules/processing/gain_control/drc/bin/arm/libdrc.a deleted file mode 100644 index 6d820bc4..00000000 Binary files a/modules/processing/gain_control/drc/bin/arm/libdrc.a and /dev/null differ diff --git a/modules/processing/gain_control/drc/build/CMakeLists.txt b/modules/processing/gain_control/drc/build/CMakeLists.txt deleted file mode 100644 index 9a8304ec..00000000 --- a/modules/processing/gain_control/drc/build/CMakeLists.txt +++ /dev/null @@ -1,35 +0,0 @@ -#[[ - @file CMakeLists.txt - - @brief - - @copyright - Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. - SPDX-License-Identifier: BSD-3-Clause-Clear -]] -cmake_minimum_required(VERSION 3.10) - -set(drc_includes - ${LIB_ROOT}/api - ${LIB_ROOT}/inc - ${PROJECT_SOURCE_DIR}/modules/cmn/common/utils/inc - ${PROJECT_SOURCE_DIR}/modules/cmn/api - ${PROJECT_SOURCE_DIR}/modules/cmn/common/internal_api -) - -spf_module_sources( - KCONFIG CONFIG_DRC - NAME drc - MAJOR_VER 1 - MINOR_VER 0 - AMDB_ITYPE "capi" - AMDB_MTYPE "PP" - AMDB_MID "0x07001066" - AMDB_TAG "capi_drc" - AMDB_MOD_NAME "MODULE_ID_DRC" - AMDB_FMT_ID1 "MEDIA_FMT_ID_PCM" - INCLUDES ${drc_includes} - H2XML_HEADERS "${LIB_ROOT}/api/api_drc.h" - CFLAGS "" - STATIC_LIB_PATH "${LIB_ROOT}/bin/arm/libdrc.a" -) diff --git a/modules/processing/gain_control/drc/inc/CDrcLib.h b/modules/processing/gain_control/drc/inc/CDrcLib.h deleted file mode 100644 index 11ec936e..00000000 --- a/modules/processing/gain_control/drc/inc/CDrcLib.h +++ /dev/null @@ -1,289 +0,0 @@ -#ifndef DRCLIB_H -#define DRCLIB_H -/*============================================================================ - @file CDrcLib.h - - Public header file for the Limiter algorithm. - - Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. - SPDX-License-Identifier: BSD-3-Clause-Clear -============================================================================*/ - -/*---------------------------------------------------------------------------- - * Include Files - * -------------------------------------------------------------------------*/ - -#include - -#include "AudioComdef.h" -#include "audpp_common.h" - -#ifndef __GNUC__ -#define __attribute__(arg) /* noop */ -#endif - - -static const int16 MAX_DELAY_SAMPLE = 1201; -static const uint16 ONE_OVER_TWENTY_UQ19 = 26214; -static const uint32 DRC_BLOCKSIZE = 80; /* native DRC frame size */ -static const int32 MIN_RMS_DB_L32Q23 = 0; -static const int16 MIN_RMS_DB_L16Q7 = -728; -static const int32 DB_16384_L32Q23 = 707051520; -static const int16 MAKEUPGAIN_UNITY = 4096; - - -/*---------------------------------------------------------------------------- - * Type Declarations - * -------------------------------------------------------------------------*/ - -/** - @brief Data types used in the DRC library - */ -typedef enum -{ - DRC_DISABLED = 0, - DRC_ENABLED = 1 - -} DrcFeaturesType; - -typedef enum -{ - CHANNEL_NOT_LINKED = 0, - CHANNEL_LINKED = 1 - -} DrcStereoLinkedType; - -typedef enum -{ - NO_CHANGE = 0, - ATTACK = 1, - RELEASE = 2 - -} DrcStateType; - -/** - @brief Default values of tuning parameters and hardcoded parameters used in the algorithm - */ -typedef enum -{ - // Default parameters - NUM_CHANNEL_DEFAULT = 1, - STEREO_LINKED_DEFAULT = 1, - - MODE_DEFAULT = 1, - DOWNSAMPLE_LEVEL_DEFAULT = 1, - DELAY_DEFAULT = 800, - RMS_TAV_DEFAULT = 4, - MAKEUP_GAIN_DEFAULT = 4650, - - DN_EXPA_THRESHOLD_DEFAULT = 0, - DN_EXPA_SLOPE_DEFAULT = 1, - DN_EXPA_ATTACK_DEFAULT = 2, - DN_EXPA_RELEASE_DEFAULT = 3, - DN_EXPA_HYSTERISIS_DEFAULT = 10023, - DN_EXPA_MIN_GAIN_DEFAULT = 32767, - - UP_COMP_THRESHOLD_DEFAULT = 4, - UP_COMP_SLOPE_DEFAULT = 5, - UP_COMP_ATTACK_DEFAULT = 6, - UP_COMP_RELEASE_DEFAULT = 7, - UP_COMP_HYSTERISIS_DEFAULT = 10023, - - DN_COMP_THRESHOLD_DEFAULT = 8, - DN_COMP_SLOPE_DEFAULT = 9, - DN_COMP_ATTACK_DEFAULT = 10, - DN_COMP_RELEASE_DEFAULT = 11, - DN_COMP_HYSTERISIS_DEFAULT = 10023 - -} DrcParamsDefault; - - - - -/*---------------------------------------------------------------------------- - * Type Declarations for overall configuration and state data structures - * -------------------------------------------------------------------------*/ -/** - @brief DRC configuration parameter structure containing tuning parameters - this structure is used with the Initialize/ReInitial functions, it is part of the - library interface, the structure is used by external caller to this library. - */ - -typedef struct _DrcConfig -{ - // DrcMiscCfg - int16 numChannel; // Q0 Number of channels - Internally set value - int16 stereoLinked; // Q0 stereo mode -- Linked or Not-Linked - - int16 mode; // Q0 DRC mode code - DRC_DISABLED or DRC_ENABLED - int16 downSampleLevel; // Q0 Down Sample Level to save MIPS - int16 delay; // Q0 Delay in samples - uint16 rmsTavUL16Q16; // Q16 Time Constant used to compute Input RMS - uint16 makeupGainUL16Q12; // Q12 Makeup Gain Value - [258, 64918] absolute - - // DrcStaticCurveCfg - int16 dnExpaThresholdL16Q7; - int16 dnExpaSlopeL16Q8; - uint32 dnExpaAttackUL32Q31; - uint32 dnExpaReleaseUL32Q31; - uint16 dnExpaHysterisisUL16Q14; - int32 dnExpaMinGainDBL32Q23; - - int16 upCompThresholdL16Q7; - uint16 upCompSlopeUL16Q16; - uint32 upCompAttackUL32Q31; - uint32 upCompReleaseUL32Q31; - uint16 upCompHysterisisUL16Q14; - - int16 dnCompThresholdL16Q7; - uint16 dnCompSlopeUL16Q16; - uint32 dnCompAttackUL32Q31; - uint32 dnCompReleaseUL32Q31; - uint16 dnCompHysterisisUL16Q14; - -} DrcConfig; - -/** - @brief DRC configuration parameter structure containing tuning parameters - this structure is used with the ASM optimized code, for - library internal use. - */ -typedef struct _DrcConfigInternal -{ - // Don't change the order of the fields above the line which are used in ASM - uint16 rmsTavUL16Q16; // Q16 Time Constant used to compute Input RMS - uint16 negativeDrcTavUL16Q16; // for unsigned Q16, (1-TAV) equals to -TAV - uint16 makeupGainUL16Q12; // Q12 Makeup Gain Value - [258, 64918] absolute - int16 delay; // Q0 Delay in samples - int32 downSampleLevel; // Q0 Down Sample Level to save MIPS - - int32 dnCompThresholdL16Q7; - int32 dnCompThrMultSlopeL32Q23; - uint32 dnCompSlopeUL16Q16; - - int32 dnExpaSlopeL16Q8; - int32 dnExpaThresholdL16Q7; - int32 dnExpaNewTargetGainL32Q23; - int32 dnExpaMinGainDBL32Q23; - - int32 upCompThrMultSlopeL32Q23; - uint32 upCompSlopeUL16Q16; - int32 upCompThresholdL16Q7; -#if ((defined __hexagon__) || (defined __qdsp6__)) - int32 stereoLinked; -#else - DrcStereoLinkedType stereoLinked; // Q0 stereo mode -- Linked or Not-Linked -#endif - uint32 dnCompHysterisisUL16Q14Asl1; - int32 outDnCompThresholdL16Q7; - uint32 dnCompAttackUL32Q31; - uint32 dnCompReleaseUL32Q31; - - uint32 dnExpaHysterisisUL16Q14Asl1; - int32 outDnExpaThresholdL16Q7; - uint32 dnExpaAttackUL32Q31; - uint32 dnExpaReleaseUL32Q31; - - uint32 upCompHysterisisUL16Q14Asl1; - int32 outUpCompThresholdL16Q7; - uint32 upCompAttackUL32Q31; - uint32 upCompReleaseUL32Q31; - //------------------------------ - - int16 numChannel; // Q0 Number of channels - Internally set value - - DrcFeaturesType mode; // Q0 DRC mode code - DRC_DISABLED or DRC_ENABLED - - uint32 dnCompHysterisisUL16Q14; - uint32 dnExpaHysterisisUL16Q14; - uint32 upCompHysterisisUL16Q14; - -} DrcConfigInternal; - - -/** - @brief DRC processing data structure - */ -typedef struct _DrcData -{ - // Don't change the order of the fields which are used in ASM - int32 *paGainL32Q15[2]; - int16 *pDelayBufferLeftL16; - int16 *pDelayBufferRightL16; - int32 rmsStateL32[2]; - int32 *pRmsStateL32; - int32 downSampleCounter; -#if ((defined __hexagon__) || (defined __qdsp6__)) - uint32 currState[2]; -#else - DrcStateType currState[2]; -#endif - int32 gainL32Q15[2]; - uint32 timeConstantUL32Q31[2]; - int32 dwcomp_state_change[2]; - int32 uwcomp_state_change[2]; -} DrcData; - -/*---------------------------------------------------------------------------- - * Type Declarations for overall configuration and state data structures - * -------------------------------------------------------------------------*/ - -class CDrcLib { -private: - - /*---------------------------------------------------------------------------- - * Constants Definition - * -------------------------------------------------------------------------*/ - static const int16 MAX_INT16_DB_Q7 = 11559; - static const int32 ONE_Q23 = 8388608; - static const uint16 HALF_UL16_Q16 = 32768; - -private: - DrcConfigInternal m_drcCfgInt __attribute__ ((aligned (8))); - DrcData m_drcData __attribute__ ((aligned (8))); - - int32 m_aGainL32Q15[2][DRC_BLOCKSIZE] __attribute__ ((aligned (8))); - int32 m_aRmsStateL32[2*DRC_BLOCKSIZE] __attribute__ ((aligned (8))); - int16 m_delayBufferLeftL16[MAX_DELAY_SAMPLE+DRC_BLOCKSIZE] __attribute__ ((aligned (8))); - int16 m_delayBufferRightL16[MAX_DELAY_SAMPLE+DRC_BLOCKSIZE] __attribute__ ((aligned (8))); - - void (*fnpProcess)(DrcConfigInternal *pDrcCfgInt, DrcData *pDrcData, - int16 *pOutPtrL16, int16 *pOutPtrR16, - int16 *pInPtrL16, int16 *pInPtrR16, - uint32 nSampleCnt); - -public: - CDrcLib(); - - /** - @brief Process input audio data with DRC algorithm - - @param pInPtrL16: [in] Pointer to 16-bit Q15 input channel data - @param pInPtrR16: [in] Pointer to 16-bit Q15 input channel data - @param pOutPtrL16: [out] Pointer to 16-bit Q15 output channel data - @param pOutPtrR16: [out] Pointer to 16-bit Q15 output channel data - */ - void Process(int16 *pOutPtrL16, - int16 *pOutPtrR16, - int16 *pInPtrL16, - int16 *pInPtrR16, - uint32 nSampleCnt=DRC_BLOCKSIZE); - - /** - @brief Initialize DRC algorithm - - Performs initialization of data structures for the - DRC algorithm. Two pointers to two memory is passed for - configuring the DRC static configuration - structure. - - */ - PPStatus Initialize(DrcConfig &cfg); - - PPStatus ReInitialize(DrcConfig &cfg); - - void Reset(); -}; - - -#endif /* #ifndef DRCLIB_H */ diff --git a/modules/processing/gain_control/drc/inc/capi_drc.h b/modules/processing/gain_control/drc/inc/capi_drc.h deleted file mode 100644 index 09e4231c..00000000 --- a/modules/processing/gain_control/drc/inc/capi_drc.h +++ /dev/null @@ -1,37 +0,0 @@ -/** -@file capi_drc.h - -@brief CAPI V2 API wrapper for drc algorithm - -*/ - -/*----------------------------------------------------------------------- -Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. -SPDX-License-Identifier: BSD-3-Clause-Clear ------------------------------------------------------------------------*/ - -#ifndef CAPI_DRC -#define CAPI_DRC - -#ifdef __cplusplus -extern "C" { -#endif //__cplusplus - -/*---------------------------------------------------------------------------- - * Include Files - * -------------------------------------------------------------------------*/ -#include "capi.h" - -/*---------------------------------------------------------------------------- - * Function Declarations - * -------------------------------------------------------------------------*/ - -capi_err_t capi_drc_get_static_properties(capi_proplist_t *init_set_properties, - capi_proplist_t *static_properties); - -capi_err_t capi_drc_init(capi_t *_pif, capi_proplist_t *init_set_properties); - -#ifdef __cplusplus -} -#endif //__cplusplus -#endif // CAPI_DRC diff --git a/modules/processing/gain_control/drc/inc/capi_drc_utils.h b/modules/processing/gain_control/drc/inc/capi_drc_utils.h deleted file mode 100644 index 752dd353..00000000 --- a/modules/processing/gain_control/drc/inc/capi_drc_utils.h +++ /dev/null @@ -1,77 +0,0 @@ -/** -@file capi_drc_utils.h - -@brief CAPI V2 utility header for DRC module. - -*/ - -/*----------------------------------------------------------------------- -Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. -SPDX-License-Identifier: BSD-3-Clause-Clear ------------------------------------------------------------------------*/ - -#include "api_drc.h" -#include "capi_cmn.h" -#include "capi_cmn_ctrl_port_list.h" -#include "capi_drc.h" -#include "drc_api.h" //lib interface -#include "imcl_drc_info_api.h" - -/*------------------------------------------------------------------------------ - * Defines - *-----------------------------------------------------------------------------*/ - -#define MIID_UNKNOWN 0 - -#define DRC_MSG_PREFIX "DRC:[%lX] " -#define DRC_MSG(ID, xx_ss_mask, xx_fmt, ...) AR_MSG(xx_ss_mask, DRC_MSG_PREFIX xx_fmt, ID, ##__VA_ARGS__) - -#define CHECK_THROW_ERROR(ID, result, error_msg, ...) \ - { \ - if (CAPI_FAILED(result)) \ - { \ - DRC_MSG(ID, DBG_ERROR_PRIO, error_msg, ##__VA_ARGS__); \ - return result; \ - } \ - } - -/* KPPS values */ -#define DRC_NB_KPPS (500) // 0.5 mpps in kpps for nb -#define DRC_WB_KPPS (800) // 0.8 mpps in kpps for wb -#define DRC_SWB_KPPS (2000) // 2 mpps in kpps for swb - approx -#define DRC_FB_KPPS (2730) // 2.71 mpps in kpps for fb - approx. - -/*------------------------------------------------------------------------------ - * Type Definition - *-----------------------------------------------------------------------------*/ - -typedef struct capi_drc_t -{ - capi_vtbl_t * vtbl; - capi_event_callback_info_t cb_info; - POSAL_HEAP_ID heap_id; - - drc_lib_t lib_handle; // Library instance - drc_static_struct_t lib_static_cfg; // static parameters structure - drc_config_t lib_cfg; // Configuration structure - drc_feature_mode_t mode; // operation mode - drc_lib_mem_requirements_t mem_req; // memory requirements structure - int16_t b_enable; // enable/disable lib - uint32_t delay_us; // drc delay in microseconds. - uint32_t miid; // Module Instance ID - - ctrl_port_list_handle_t ctrl_port_info; - - capi_media_fmt_v2_t input_media_fmt; -} capi_drc_t; - -/*------------------------------------------------------------------------------ - * Function Declarations - *-----------------------------------------------------------------------------*/ -void drc_lib_set_default_config(capi_drc_t *me_ptr); -capi_err_t drc_lib_set_calib(capi_drc_t *me_ptr); -capi_err_t drc_lib_alloc_init(capi_drc_t *me_ptr); - -capi_err_t drc_lib_send_config_imcl(capi_drc_t *me_ptr); - -void raise_kpps_delay_process_events(capi_drc_t *me_ptr); diff --git a/modules/processing/gain_control/drc/inc/drc_api.h b/modules/processing/gain_control/drc/inc/drc_api.h deleted file mode 100644 index 42194a0f..00000000 --- a/modules/processing/gain_control/drc/inc/drc_api.h +++ /dev/null @@ -1,126 +0,0 @@ -#ifndef DRCAPI_H -#define DRCAPI_H -/*============================================================================ - @file CDrcApi.h - - Public api for DRC. - - Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. - SPDX-License-Identifier: BSD-3-Clause-Clear -============================================================================*/ - -/*---------------------------------------------------------------------------- - * Include Files - * -------------------------------------------------------------------------*/ - -#include "drc_calib_api.h" - - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - - - -/*---------------------------------------------------------------------------- - * Type Declarations - * -------------------------------------------------------------------------*/ - - -typedef enum DRC_RESULT -{ - DRC_SUCCESS = 0, - DRC_FAILURE, - DRC_MEMERROR -}DRC_RESULT; - -typedef enum data_width_type -{ - BITS_16 = 0, // 16-bits sample - BITS_32 // 32-bits sample -} data_width_type; - - -//DRC static params structure -typedef struct drc_static_struct_t -{ - - data_width_type data_width; // 0(16-bits sample) or 1(32-bits sample) - uint32_t sample_rate; // Hz - uint32_t num_channel; // Q0 Number of channels - uint32_t delay; // Q0 Delay in samples per channel - -} drc_static_struct_t; - - - - - -// DRC lib structure -typedef struct drc_lib_t -{ - - void* lib_mem_ptr; // ptr to the total chunk of lib mem - -} drc_lib_t; - - - -// DRC lib mem requirements structure -typedef struct drc_lib_mem_requirements_t -{ - - uint32_t lib_mem_size; // size of the lib mem pointed by lib_mem_ptr - uint32_t lib_stack_size; // stack mem size -} drc_lib_mem_requirements_t; - - -/*---------------------------------------------------------------------------- - * Function Declarations and Documentation - * -------------------------------------------------------------------------*/ - -// DRC processing of de-interleaved multi-channel input audio signal sample by sample -// drc_lib_ptr: [in] Pointer to lib structure -// out_ptr: [out] Pointer to de-interleaved multi - channel output PCM samples -// in_ptr: [in] Pointer to de-interleaved multi - channel input PCM samples -// sample_per_channel: [in] Number of samples to be processed per channel -DRC_RESULT drc_process(drc_lib_t *drc_lib_ptr, int8_t **out_ptr, int8_t **in_ptr, uint32_t sample_per_channel); - - -// get DRC lib mem size -// drc_lib_mem_requirements_ptr: [out] Pointer to lib mem requirements structure -// static_struct_ptr: [in] Pointer to static structure -DRC_RESULT drc_get_mem_req(drc_lib_mem_requirements_t *drc_lib_mem_requirements_ptr, drc_static_struct_t* drc_static_struct_ptr); - -// partition and init the mem with params -// drc_lib_ptr: [in, out] Pointer to lib structure -// static_struct_ptr: [in] Pointer to static structure -// mem_ptr: [in] Pointer to the lib memory -// mem_size: [in] Size of the memory pointed by mem_ptr -DRC_RESULT drc_init_memory(drc_lib_t *drc_lib_ptr, drc_static_struct_t *drc_static_struct_ptr, int8_t *mem_ptr, uint32_t mem_size); - -// set the params in the lib mem with those pointed by mem_ptr -// drc_lib_ptr: [in, out] Pointer to lib structure -// param_id: [in] ID of the param -// mem_ptr: [in] Pointer to the memory where the values stored are used to set up the params in the lib memory -// mem_size:[in] Size of the memory pointed by mem_ptr -DRC_RESULT drc_set_param(drc_lib_t *drc_lib_ptr, uint32_t param_id, int8_t *mem_ptr, uint32_t mem_size); - -// retrieve params from lib mem -// drc_lib_ptr: [in] Pointer to lib structure -// param_id: [in] ID of the param -// mem_ptr: [out] Pointer to the memory where params are to be stored -// mem_size:[in] Size of the memory pointed by mem_ptr -// param_size_ptr: [out] Pointer to param size which indicates the size of the retrieved param(s) -DRC_RESULT drc_get_param(drc_lib_t *drc_lib_ptr, uint32_t param_id, int8_t *mem_ptr, uint32_t mem_size, uint32_t *param_size_ptr); - - - - - - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* #ifndef DRCAPI_H */ diff --git a/modules/processing/gain_control/drc/inc/drc_calib_api.h b/modules/processing/gain_control/drc/inc/drc_calib_api.h deleted file mode 100644 index 051b5350..00000000 --- a/modules/processing/gain_control/drc/inc/drc_calib_api.h +++ /dev/null @@ -1,134 +0,0 @@ -#ifndef DRC_CALIB_API_H -#define DRC_CALIB_API_H -/*============================================================================ - @file CDrcCalibApi.h - - Public api for DRC. - - Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. - SPDX-License-Identifier: BSD-3-Clause-Clear -============================================================================*/ -/*============================================================================ - - $Header: //components/rel/audioreach_spm_pp.cmn/0.0/gain_control/drc/lib/inc/drc_calib_api.h#1 $ - - when who what, where, why - ---------- ------- --------------------------------------------------------- - 2012-11-12 juihuaj Initial revision. - 2012-11-28 juihuaj Added param IDs and corresponding structures -============================================================================*/ - -/*---------------------------------------------------------------------------- - * Include Files - * -------------------------------------------------------------------------*/ - - -#include "ar_defs.h" - - - - - - - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - - - - -/*---------------------------------------------------------------------------- - * Type Declarations - * -------------------------------------------------------------------------*/ -// param ID and the corresponding payload for lib version -#define DRC_PARAM_GET_LIB_VER (0) // read only -typedef int64_t drc_lib_ver_t; // lib version(major.minor.bug); (8bits.16bits.8bits) - - - - -typedef enum drc_mode_t -{ - DRC_BYPASSED = 0, // DRC processing bypassed; no DRC processing and only delay is implemented - DRC_ENABLED // DRC processing enabled; normal DRC processing - -} drc_mode_t; - -// param ID and the corresponding payload for DRC feature mode -#define DRC_PARAM_FEATURE_MODE (1) // read/write -typedef drc_mode_t drc_feature_mode_t; // 1 is with DRC processing; 0 is no DRC processing(bypassed, only delay is implemented) - - - -typedef enum drc_channel_linking_t -{ - CHANNEL_NOT_LINKED = 0, - CHANNEL_LINKED - -} drc_channel_linking_t; - -// param ID and the corresponding payload for DRC processing -#define DRC_PARAM_CONFIG (2) // read/write -typedef struct drc_config_t -{ - - // below two should not change during Reinit - int16_t channelLinked; // Q0 channel mode -- Linked(1) or Not-Linked(0) - int16_t downSampleLevel; // Q0 Down Sample Level to save MIPS - - - uint16_t rmsTavUL16Q16; // Q16 Time Constant used to compute Input RMS - uint16_t makeupGainUL16Q12; // Q12 Makeup Gain Value - - - int16_t dnExpaThresholdL16Q7; - int16_t dnExpaSlopeL16Q8; - uint32_t dnExpaAttackUL32Q31; - uint32_t dnExpaReleaseUL32Q31; - int32_t dnExpaMinGainDBL32Q23; - uint16_t dnExpaHysterisisUL16Q14; - - int16_t upCompThresholdL16Q7; - uint32_t upCompAttackUL32Q31; - uint32_t upCompReleaseUL32Q31; - uint16_t upCompSlopeUL16Q16; - uint16_t upCompHysterisisUL16Q14; - - int16_t dnCompThresholdL16Q7; - uint16_t dnCompSlopeUL16Q16; - uint32_t dnCompAttackUL32Q31; - uint32_t dnCompReleaseUL32Q31; - uint16_t dnCompHysterisisUL16Q14; - - - - int16_t dummy; // avoid memory hole - -} drc_config_t; - - -// param ID for reset(to flush memory) -// no payload needed for this ID -#define DRC_PARAM_SET_RESET (3) // write only - - - -// param ID and the corresponding payload for delay(in samples) -#define DRC_PARAM_GET_DELAY (4) // read only -typedef uint32_t drc_delay_t; // Q0 Delay in samples per channel - - - - - - - - - - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* #ifndef DRC_CALIB_API_H */ diff --git a/modules/processing/gain_control/drc/inc/drc_lib.h b/modules/processing/gain_control/drc/inc/drc_lib.h deleted file mode 100644 index acd684db..00000000 --- a/modules/processing/gain_control/drc/inc/drc_lib.h +++ /dev/null @@ -1,191 +0,0 @@ -#ifndef DRCLIB_H -#define DRCLIB_H -/*============================================================================ - @file CDrcLib.h - - Public header file for the Limiter algorithm. - - Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. - SPDX-License-Identifier: BSD-3-Clause-Clear -============================================================================*/ - -/*---------------------------------------------------------------------------- - * Include Files - * -------------------------------------------------------------------------*/ - - -#include "drc_api.h" - -#if ((defined __hexagon__) || (defined __qdsp6__)) -#define QDSP6_DRCLIB_ASM 1 -#elif (defined __XTENSA__) -#define DRCLIB_OPT 1 -#else -#define DRCLIB_ORIGINAL 1 -#endif - - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#define DRC_LIB_VER 0X020A020102000000 // 2.10/2.1.2 external(major).external(minor)/major.minor.revision - -static const uint32_t drc_max_stack_size = 2048; -// worst case stack mem consumption in bytes; -// this number is obtained offline via stack profiling -// stack mem consumption should be no bigger than this number - -/*---------------------------------------------------------------------------- -* Constants Definition -* -------------------------------------------------------------------------*/ -#define ONE 1 -#define TWO 2 -//#define THREE 3 -#define MINUS_ONE -1 -#define MINUS_TWO -2 -#define MINUS_THREE -3 -#define MINUS_FOUR -4 -#define MINUS_FIVE -5 -#define ONE_BY_3_Q15 10923 -#define ONE_BY_5_Q15 6554 -#define ONE_BY_6_Q15 5461 -#define ONE_BY_7_Q15 4681 -#define Q15 15 // Q factor for Q15 -#define Q27 27 // Q factor for Q27 -#define MINUS_FIFTEEN -Q15 -#define ALIGN8(o) (((o)+7)&(~7)) - - - -/*---------------------------------------------------------------------------- - * Type Declarations - * -------------------------------------------------------------------------*/ -// internal use only -typedef enum DrcStateType -{ - NO_CHANGE = 0, - ATTACK = 1, - RELEASE = 2 - -} DrcStateType; - - -// internal use only -typedef enum DrcConstants -{ - - ONE_OVER_TWENTY_UQ19 = 26214, - MIN_RMS_DB_L32Q23 = 0, - MIN_RMS_DB_L16Q7 = -728, - DB_16384_L32Q23 = 707051520, - MAKEUPGAIN_UNITY = 4096, -#ifdef PROD_SPECIFIC_MAX_CH - MAX_NUM_CHANNEL = 128 -#else - MAX_NUM_CHANNEL = 32 -#endif - -} DrcConstants; - -// Ying -typedef enum DrcProcessMode -{ - ProcessMultiChan16Linked = 0, - ProcessMultiChan16Unlinked = 1, - ProcessMultiChan32Linked = 2, - ProcessMultiChan32Unlinked = 3, - ProcessOneChan16 = 4, - ProcessOneChan32 = 5, - ProcessBypass16 = 6, - ProcessBypass32 = 7 -} DrcProcessMode; - - -// Default calibration parameters; internal use only -typedef enum DrcParamsDefault -{ - - MODE_DEFAULT = 0x0, // 1 is with DRC processing; 0 is no DRC processing(bypassed, only delay is implemented) - - CHANNEL_LINKED_DEFAULT = 0x0, - DOWNSAMPLE_LEVEL_DEFAULT = 0x1, - - RMS_TAV_DEFAULT = 0x0B78, - MAKEUP_GAIN_DEFAULT = 0x1000, - - DN_EXPA_THRESHOLD_DEFAULT = 0x0A28, - DN_EXPA_SLOPE_DEFAULT = 0xFF9A, - DN_EXPA_ATTACK_DEFAULT = 0x00B3BAB3, - DN_EXPA_RELEASE_DEFAULT = 0x01BF7A00, - DN_EXPA_HYSTERISIS_DEFAULT = 0x49A7, - DN_EXPA_MIN_GAIN_DEFAULT = 0xFD000000, - - UP_COMP_THRESHOLD_DEFAULT = 0x0A28, - UP_COMP_SLOPE_DEFAULT = 0x0, - UP_COMP_ATTACK_DEFAULT = 0x0059FCFC, - UP_COMP_RELEASE_DEFAULT = 0x0059FCFC, - UP_COMP_HYSTERISIS_DEFAULT = 0x49A7, - - DN_COMP_THRESHOLD_DEFAULT = 0x1BA8, - DN_COMP_SLOPE_DEFAULT = 0xF333, - DN_COMP_ATTACK_DEFAULT = 0x06D9931E, - DN_COMP_RELEASE_DEFAULT = 0x00120478, - DN_COMP_HYSTERISIS_DEFAULT = 0x49A7 - -} DrcParamsDefault; - - - -//DRC state params structure -typedef struct drc_state_struct_t -{ - - int8_t** delayBuffer; // dynamic mem allocation for int8_t* delayBuffer[ch_num]; Delay buffer used to save the channel-delayed samples - int32_t* rmsStateL32; // dynamic mem allocation for int32_t rmsStateL32[ch_num]; Current sample index - int32_t* drcRmsDBL32Q23; // dynamic mem allocation for int32_t drcRmsDBL32Q23[ch_num]; - uint32_t* targetGainUL32Q15; // dynamic mem allocation for uint32_t targetGainUL32Q15[ch_num]; - uint32_t* gainUL32Q15; // dynamic mem allocation for uint32_t gainUL32Q15[ch_num]; - DrcStateType* currState; // dynamic mem allocation for DrcStateType currState[ch_num]; - uint32_t* timeConstantUL32Q31; // dynamic mem allocation for uint32_t timeConstantUL32Q31[ch_num]; - int32_t* dwcomp_state_change; // dynamic mem allocation for int32_t* dwcomp_state_change[ch_num] - int32_t* uwcomp_state_change; // dynamic mem allocation for int32_t* uwcomp_state_change[ch_num] - int32_t* dnexpa_state_change; // dynamic mem allocation for int32_t* dnexpa_state_change[ch_num] - uint64_t* instGainUL64Q27; // dynamic mem allocation for uint64_t instGainUL64Q27[ch_num]; - - uint32_t inputIndex; // Current input data index in the delay buffer - uint32_t processIndex; // Current process data index in the delay buffer - uint32_t drcProcessMode; // drc mode for different types of process() Ying - - - int16_t downSampleCounter; - - int16_t outDnCompThresholdL16Q7; - int16_t outDnExpaThresholdL16Q7; - int16_t outUpCompThresholdL16Q7; - -} drc_state_struct_t; - - -// DRC lib mem structure -typedef struct drc_lib_mem_t -{ - drc_static_struct_t* drc_static_struct_ptr; // ptr to the static struct in mem - int32_t drc_static_struct_size; // size of the allocated mem pointed by the static struct - drc_feature_mode_t* drc_feature_mode_ptr; - int32_t drc_feature_mode_size; - drc_config_t* drc_config_ptr; - int32_t drc_config_size; - drc_state_struct_t* drc_state_struct_ptr; // ptr to the state struct in lib mem - int32_t drc_state_struct_size; // size of the allocated mem pointed by the state struct - -} drc_lib_mem_t; - - - - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* #ifndef DRCLIB_H */ diff --git a/modules/processing/gain_control/iir_mbdrc/api/mbdrc_api.h b/modules/processing/gain_control/iir_mbdrc/api/mbdrc_api.h deleted file mode 100644 index 77982515..00000000 --- a/modules/processing/gain_control/iir_mbdrc/api/mbdrc_api.h +++ /dev/null @@ -1,754 +0,0 @@ -#ifndef MBDRC_API_H -#define MBDRC_API_H -/*============================================================================== - @file mbdrc_api.h - @brief This file contains MBDRC parameters -==============================================================================*/ - -/*======================================================================= -* Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. -* SPDX-License-Identifier: BSD-3-Clause-Clear -=========================================================================*/ -/*======================================================================== - Edit History - - when who what, where, why - -------- --- ------------------------------------------------------- - 10/10/18 akr Created File . - ========================================================================== */ - -/*------------------------------------------------------------------------ - * Include files - * -----------------------------------------------------------------------*/ -#include "module_cmn_api.h" - -/** - @h2xml_title1 {Multiband Dynamic Range Control (MBDRC) API} - @h2xml_title_agile_rev {Multiband Dynamic Range Control (MBDRC) API} - @h2xml_title_date {October 10, 2018} - */ -/** - @h2xmlx_xmlNumberFormat {int} -*/ - -/*============================================================================== - Constants -==============================================================================*/ -#define CAPI_IIR_MBDRC_MAX_PORT 1 - -#define CAPI_IIR_MBDRC_STACK_SIZE 4096 - -#define IIR_MAX_COEFFS_PER_BAND 10 - -#define IIR_MBDRC_MAX_BANDS 10 - -#define MODULE_ID_IIR_MBDRC 0x07001017 - -#ifdef PROD_SPECIFIC_MAX_CH -#define CAPI_IIR_MBDRC_MAX_CHANNELS 128 -#else -#define CAPI_IIR_MBDRC_MAX_CHANNELS 32 -#endif - -/** - @h2xmlm_module {"MODULE_ID_IIR_MBDRC", - MODULE_ID_IIR_MBDRC} - @h2xmlm_displayName {"IIR MBDRC"} - @h2xmlm_modSearchKeys{drc, Audio} - @h2xmlm_toolPolicy {Calibration} - @h2xmlm_description {Multiband Dynamic Range Control Module \n - - - This module supports the following parameter IDs: \n - - #PARAM_ID_IIR_MBDRC_CONFIG_PARAMS \n - - #PARAM_ID_IIR_MBDRC_FILTER_XOVER_FREQS \n - - #PARAM_ID_MODULE_ENABLE \n - -* Supported Input Media Format: \n -* - Data Format : FIXED_POINT \n -* - fmt_id : Don't care \n -* - Sample Rates : Any \n -* - Number of channels : 1 to 128 (for certain products this module supports only 32 channels) \n -* - Channel type : 1 to 128 \n -* - Bits per sample : 16, 32 \n -* - Q format : 15, 27 \n -* - Interleaving : de-interleaved unpacked \n -* - Signed/unsigned : Signed } - - @h2xmlm_dataMaxInputPorts {CAPI_IIR_MBDRC_MAX_PORT} - @h2xmlm_dataInputPorts {IN=2} - @h2xmlm_dataMaxOutputPorts {CAPI_IIR_MBDRC_MAX_PORT} - @h2xmlm_dataOutputPorts {OUT=1} - @h2xmlm_supportedContTypes {APM_CONTAINER_TYPE_SC, APM_CONTAINER_TYPE_GC} - @h2xmlm_isOffloadable {true} - @h2xmlm_stackSize {CAPI_IIR_MBDRC_STACK_SIZE} - @h2xmlm_ToolPolicy {Calibration} - @{ <-- Start of the Module --> -*/ - -/* ID of the MBDRC Configuration parameter used by MODULE_ID_IIR_MBDRC.*/ -#define PARAM_ID_IIR_MBDRC_CONFIG_PARAMS 0x08001028 - -#include "spf_begin_pack.h" -/** @h2xmlp_subStruct */ -struct subband_drc_config_params_t -{ - - int16_t drc_mode; - /**< @h2xmle_description {Specifies whether DRC mode is bypassed for subbands.} - @h2xmle_rangeList {"Disable"=0; "Enable"=1} - @h2xmle_default {1} */ - - int16_t drc_linked_flag; - /**< @h2xmle_description {Specifies whether all stereo channels have the same applied dynamics - or if they process their dynamics independently.} - @h2xmle_rangeList {"Not linked,channels process the dynamics independently" = 0; - "Linked,channels have the same applied dynamics" = 1} - @h2xmle_default {1} */ - - int16_t drc_down_sample_level; - /**< @h2xmle_description {DRC down sample level.} - @h2xmle_default {1} - @h2xmle_range {1..16}*/ - - uint16_t drc_rms_time_avg_const; - /**< @h2xmle_description {RMS signal energy time-averaging constant.} - @h2xmle_default {298} - @h2xmle_range {0..65535} - @h2xmle_dataFormat {Q16} */ - - uint16_t drc_makeup_gain; - /**< @h2xmle_description {DRC makeup gain in decibels.} - @h2xmle_default {4096} - @h2xmle_range {258..64917} - @h2xmle_dataFormat {Q12} */ - - /* Down expander settings */ - - int16_t down_expdr_threshold; - /**< @h2xmle_description {Down expander threshold.} - Its value must be: (*/ - -#endif diff --git a/modules/processing/gain_control/iir_mbdrc/bin/arm/libiir_mbdrc.a b/modules/processing/gain_control/iir_mbdrc/bin/arm/libiir_mbdrc.a deleted file mode 100644 index e474add6..00000000 Binary files a/modules/processing/gain_control/iir_mbdrc/bin/arm/libiir_mbdrc.a and /dev/null differ diff --git a/modules/processing/gain_control/iir_mbdrc/build/CMakeLists.txt b/modules/processing/gain_control/iir_mbdrc/build/CMakeLists.txt deleted file mode 100644 index 9cd0444e..00000000 --- a/modules/processing/gain_control/iir_mbdrc/build/CMakeLists.txt +++ /dev/null @@ -1,35 +0,0 @@ -#[[ - @file CMakeLists.txt - - @brief - - @copyright - Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. - SPDX-License-Identifier: BSD-3-Clause-Clear -]] -cmake_minimum_required(VERSION 3.10) - -#Include directories -set(iir_mbdrc_includes - ${LIB_ROOT}/api - ${LIB_ROOT}/inc - ${PROJECT_SOURCE_DIR}/modules/cmn/common/utils/inc - ${PROJECT_SOURCE_DIR}/modules/processing/gain_control/drc/lib/inc - ${PROJECT_SOURCE_DIR}/modules/processing/gain_control/limiter/inc -) - -spf_module_sources( - KCONFIG CONFIG_IIR_MBDRC - NAME iir_mbdrc - MAJOR_VER 1 - MINOR_VER 0 - AMDB_ITYPE "capi" - AMDB_MTYPE "pp" - AMDB_MID "0x07001017" - AMDB_TAG "capi_iir_mbdrc" - AMDB_MOD_NAME "MODULE_ID_IIR_MBDRC" - INCLUDES ${iir_mbdrc_includes} - H2XML_HEADERS "${LIB_ROOT}/api/mbdrc_api.h" - CFLAGS "" - STATIC_LIB_PATH "${LIB_ROOT}/bin/arm/libiir_mbdrc.a" -) diff --git a/modules/processing/gain_control/iir_mbdrc/inc/capi_iir_mbdrc.h b/modules/processing/gain_control/iir_mbdrc/inc/capi_iir_mbdrc.h deleted file mode 100644 index 904a3217..00000000 --- a/modules/processing/gain_control/iir_mbdrc/inc/capi_iir_mbdrc.h +++ /dev/null @@ -1,43 +0,0 @@ -/* ===================================================================== - Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. - SPDX-License-Identifier: BSD-3-Clause-Clear - * =====================================================================*/ - -/** - * @file capi_iir_mbdrc.h - * - */ - -#ifndef CAPI_IIR_MBDRC_H -#define CAPI_IIR_MBDRC_H - -#include "capi.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Get static properties of mbdrc module such as - * memory, stack requirements etc. - * See Elite_CAPI.h for more details. - */ -capi_err_t capi_iir_mbdrc_get_static_properties( - capi_proplist_t* init_set_properties, - capi_proplist_t* static_properties); - - -/** - * Instantiates(and allocates) the module memory. - * See Elite_CAPI.h for more details. - */ -capi_err_t capi_iir_mbdrc_init( - capi_t* _pif, - capi_proplist_t* init_set_properties); - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/modules/processing/gain_control/iir_mbdrc/inc/capi_iir_mbdrc_utils.h b/modules/processing/gain_control/iir_mbdrc/inc/capi_iir_mbdrc_utils.h deleted file mode 100644 index 82f918a8..00000000 --- a/modules/processing/gain_control/iir_mbdrc/inc/capi_iir_mbdrc_utils.h +++ /dev/null @@ -1,369 +0,0 @@ -/* ======================================================================== */ -/** - @file capi_iir_mbdrc_utils.h - - Header file to implement utilities for MBDRC audio Post - Processing module - */ - -/* ========================================================================= - Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. - SPDX-License-Identifier: BSD-3-Clause-Clear - ========================================================================== */ - -#ifndef CAPI_IIR_MBDRC_UTILS_H -#define CAPI_IIR_MBDRC_UTILS_H - -/*------------------------------------------------------------------------ - * Include files - * -----------------------------------------------------------------------*/ -#include "capi.h" -#include "capi_cmn.h" -#ifdef CAPI_STANDALONE -#include "capi_util.h" -#else -#include "posal.h" -#endif - -#include "capi_iir_mbdrc.h" -#include "iir_mbdrc_api.h" -#include "iir_mbdrc_calibration_api.h" -#include "mbdrc_api.h" -#include "stringl.h" -/*------------------------------------------------------------------------ - * Macros, Defines, Type declarations - * -----------------------------------------------------------------------*/ - -#define MIID_UNKNOWN 0 - -#define IIR_MBDRC_MSG_PREFIX "IIR_MBDRC:[%lX] " -#define IIR_MBDRC_MSG(ID, xx_ss_mask, xx_fmt, ...) AR_MSG(xx_ss_mask, IIR_MBDRC_MSG_PREFIX xx_fmt, ID, ##__VA_ARGS__) - -// Default values for iir_mbdrc static parameters -static const uint32 CAPI_IIR_MBDRC_DEFAULT_SAMPLING_RATE = 48000; // sampling rate -static const uint32 CAPI_IIR_MBDRC_DEFAULT_NUM_CHANNELS = 1; // Mono channel -static const uint32 CAPI_IIR_MBDRC_DEFAULT_BLOCK_SIZE = 480; // 480 = 10ms samples at 48KHz - -#define IIR_MBDRC_MAX_MSIIR_STATES_MEM (32) -// max # of even allpass stage -#define IIR_MBDRC_EVEN_AP_STAGE 3 -// max # of odd allpass stage -#define IIR_MBDRC_ODD_AP_STAGE 2 - -#define CAPI_IIR_MBDRC_ALIGN_TO_8(x) ((((uint32_t)(x) + 7) >> 3) << 3) -#define ALIGN8(o) (((o) + 7) & (~7)) -#define CAPI_IIR_MBDRC_ALIGN_4_BYTE(x) (((x) + 3) & (0xFFFFFFFC)) - -// Limiter default values -static const int32 CAPI_IIR_MBDRC_LIM_THRESH_16BIT_VAL = 93945856; -static const int32 CAPI_IIR_MBDRC_LIM_MAKEUP_GAIN_VAL = 256; -static const int32 CAPI_IIR_MBDRC_LIM_GC_VAL = 32440; -static const int32 CAPI_IIR_MBDRC_LIM_MAX_WAIT_VAL = 82; -static const int32 CAPI_IIR_MBDRC_LIM_GAIN_ATTACK_VAL = 188099735; -static const int32 CAPI_IIR_MBDRC_LIM_GAIN_RELEASE_VAL = 32559427; -static const int32 CAPI_IIR_MBDRC_LIM_RELEASE_COEF_VAL = 32768; -static const int32 CAPI_IIR_MBDRC_LIM_ATTACK_COEF_VAL = 32768; -static const int32 CAPI_IIR_MBDRC_LIM_HARD_THRESH_16BIT_VAL = 93945856; -static const int32 CAPI_IIR_MBDRC_LIM_HISTORY_WINLEN_VAL = 262; -static const int32 CAPI_IIR_MBDRC_LIM_DELAY_VAL = 262; - -static const int32 CAPI_IIR_MBDRC_KPPS_CH1_DW8_VAL = 587860; -static const int32 CAPI_IIR_MBDRC_KPPS_CH2_DW8_VAL = 607254; -static const int32 CAPI_IIR_MBDRC_KPPS_CH6_DW8_VAL = 569251; -static const int32 CAPI_IIR_MBDRC_KPPS_CH8_DW8_VAL = 539941; -static const int32 CAPI_IIR_MBDRC_KPPS_CH1_DW8_band_1_2_VAL = 503647; -static const int32 CAPI_IIR_MBDRC_KPPS_CH2_DW8_band_1_2_VAL = 508655; -static const int32 CAPI_IIR_MBDRC_KPPS_CH6_DW8_band_1_2_VAL = 455077; -static const int32 CAPI_IIR_MBDRC_KPPS_CH8_DW8_band_1_2_VAL = 445501; - -static const int32 CAPI_IIR_MBDRC_KPPS_CH1_DW1_link1_VAL = 865519; -static const int32 CAPI_IIR_MBDRC_KPPS_CH2_DW1_link1_VAL = 740111; -static const int32 CAPI_IIR_MBDRC_KPPS_CH6_DW1_link1_VAL = 609267; -static const int32 CAPI_IIR_MBDRC_KPPS_CH8_DW1_link1_VAL = 591798; -static const int32 CAPI_IIR_MBDRC_KPPS_CH1_DW1_link1_band_1_2_VAL = 781348; -static const int32 CAPI_IIR_MBDRC_KPPS_CH2_DW1_link1_band_1_2_VAL = 653223; -static const int32 CAPI_IIR_MBDRC_KPPS_CH6_DW1_link1_band_1_2_VAL = 500676; -static const int32 CAPI_IIR_MBDRC_KPPS_CH8_DW1_link1_band_1_2_VAL = 480502; - -static const int32 CAPI_IIR_MBDRC_KPPS_CH1_DW1_link0_VAL = 865519; -static const int32 CAPI_IIR_MBDRC_KPPS_CH2_DW1_link0_VAL = 854974; -static const int32 CAPI_IIR_MBDRC_KPPS_CH6_DW1_link0_VAL = 826218; -static const int32 CAPI_IIR_MBDRC_KPPS_CH8_DW1_link0_VAL = 843466; -static const int32 CAPI_IIR_MBDRC_KPPS_CH1_DW1_link0_band_1_2_VAL = 792501; -static const int32 CAPI_IIR_MBDRC_KPPS_CH2_DW1_link0_band_1_2_VAL = 792973; -static const int32 CAPI_IIR_MBDRC_KPPS_CH6_DW1_link0_band_1_2_VAL = 738497; -static const int32 CAPI_IIR_MBDRC_KPPS_CH8_DW1_link0_band_1_2_VAL = 758090; - -static const uint32 CAPI_IIR_MBDRC_limiter_threshold_min = 1; // 16-bit - -96db , 24-bit - -162db , 32-bit - -162db -static const uint32 CAPI_IIR_MBDRC_limiter_threshold_32bit_max = 2127207634; // 24-bit - 24db , 32-bit - 0db - -/*------------------------------------------------------------------------ - * Structure definitions - * -----------------------------------------------------------------------*/ -typedef struct capi_iir_mbdrc_common_config_struct_t -{ - iir_mbdrc_num_band_t iir_mbdrc_num_band; - iir_mbdrc_limiter_mode_t iir_mbdrc_limiter_mode; - iir_mbdrc_limiter_bypass_t iir_mbdrc_limiter_bypass; - uint32 version; -} capi_iir_mbdrc_common_config_struct_t; - -typedef struct capi_iir_mbdrc_crossover_freqs_t -{ - uint32 ch_idx; // channel index - uint32 crossover_freqs[IIR_MBDRC_MAX_BANDS - 1]; // cross-over frequencies; -} capi_iir_mbdrc_crossover_freqs_t; - -typedef struct capi_iir_mbdrc_per_config_crossover_freqs_struct_t -{ - uint32_t channel_mask_lsb; - uint32_t channel_mask_msb; - capi_iir_mbdrc_crossover_freqs_t iir_mbdrc_crossover_freqs; -} capi_iir_mbdrc_per_config_crossover_freqs_struct_t; - -typedef struct capi_iir_mbdrc_config_struct_t -{ - iir_mbdrc_mute_flags_t iir_mbdrc_mute_flags; - iir_mbdrc_drc_feature_mode_struct_t - * iir_mbdrc_drc_feature_mode_struct; // iir_mbdrc_drc_feature_mode_struct[num_bands] - iir_mbdrc_drc_config_struct_t *iir_mbdrc_drc_cfg; // iir_mbdrc_drc_cfg[num_bands] - iir_mbdrc_limiter_tuning_t iir_mbdrc_limiter_cfg; - iir_mbdrc_iir_config_struct_t *iir_mbdrc_iir_cfg; // iir_mbdrc_iir_cfg[num_bands-1] -} capi_iir_mbdrc_config_struct_t; - -typedef struct capi_iir_mbdrc_per_config_struct_t -{ - uint32_t channel_mask_lsb; // Contains Channel type info - // Least significant bit = 0 => per channel - // calibration disable Least significant bit = 1 => - // per channel calibration enable - uint32_t channel_mask_msb; // Contains Channel type info - capi_iir_mbdrc_config_struct_t iir_mbdrc_cfg; // Has calibration for the above mapped channels. - -} capi_iir_mbdrc_per_config_struct_t; - -typedef struct capi_iir_mbdrc_per_config_t -{ - uint32_t num_config; - uint32_t num_crossover_freqs_config; - capi_iir_mbdrc_per_config_struct_t * iir_mbdrc_per_cfg; // iir_mbdrc_per_cfg[num_config] - capi_iir_mbdrc_per_config_crossover_freqs_struct_t *iir_mbdrc_crossover_freqs_per_cfg; - // iir_mbdrc_crossover_freqs_per_cfg[num_crossover_freqs_config] -} capi_iir_mbdrc_per_config_t; - -typedef struct capi_iir_mbdrc_per_config_crossover_freqs_struct_v2_t -{ - uint32_t channel_map_mask_list[CAPI_CMN_MAX_CHANNEL_MAP_GROUPS]; - capi_iir_mbdrc_crossover_freqs_t iir_mbdrc_crossover_freqs; -} capi_iir_mbdrc_per_config_crossover_freqs_struct_v2_t; - -typedef struct capi_iir_mbdrc_per_config_struct_v2_t -{ - uint32_t channel_map_mask_list[CAPI_CMN_MAX_CHANNEL_MAP_GROUPS]; - capi_iir_mbdrc_config_struct_t iir_mbdrc_cfg; // Has calibration for the above mapped channels. -} capi_iir_mbdrc_per_config_struct_v2_t; - -typedef struct capi_iir_mbdrc_per_config_v2_t -{ - uint32_t num_config; - uint32_t num_crossover_freqs_config; - capi_iir_mbdrc_per_config_struct_v2_t * iir_mbdrc_per_cfg; // iir_mbdrc_per_cfg[num_config] - capi_iir_mbdrc_per_config_crossover_freqs_struct_v2_t *iir_mbdrc_crossover_freqs_per_cfg; - uint32_t cached_xover_freqs_v2_param_size; - uint32_t cached_mbdrc_config_v2_param_size; -} capi_iir_mbdrc_per_config_v2_t; - -typedef struct capi_iir_mbdrc_memory_struct_t -{ - iir_mbdrc_lib_mem_requirements_t mem_req; // MBDRC memory requirements structure - void * mem_ptr; // MBDRC memory pointer - capi_heap_id_t heap_mem; // Heap ID to be used for memory allocation -} iir_mbdrc_memory_struct_t; - -typedef struct capi_iir_mbdrc_event_report_t -{ - capi_event_callback_info_t cb_info; - uint32_t iir_mbdrc_bw; - uint32_t iir_mbdrc_kpps; - uint32_t iir_mbdrc_delay_in_us; - bool_t iir_mbdrc_enable; -} iir_mbdrc_event_report_t; - -typedef enum capi_iir_mbdrc_config_version_t -{ - DEFAULT = 0, - VERSION_V1 = 1, - VERSION_V2 = 2 -} capi_iir_mbdrc_config_version_t; - -#define CAPI_IIR_MBDRC_MF_V2_MIN_SIZE (sizeof(capi_standard_data_format_v2_t) + sizeof(capi_set_get_media_format_t)) - -typedef struct capi_iir_mbdrc_t -{ - capi_vtbl_t * vtbl; - capi_media_fmt_v2_t media_fmt[CAPI_IIR_MBDRC_MAX_PORT]; - capi_iir_mbdrc_event_report_t iir_mbdrc_event_report; - capi_iir_mbdrc_memory_struct_t iir_mbdrc_memory; // contains memory information - iir_mbdrc_lib_t iir_mbdrc_lib; // contains ptr to the total chunk of lib mem - iir_mbdrc_static_struct_t iir_mbdrc_static_cfg; // Stores static config information from media - // format and calibration received during Set param - iir_mbdrc_static_struct_t iir_mbdrc_static_cfg_of_defult_cfg; // Stores static config information - // from media format and default - // calibration - iir_mbdrc_feature_mode_t iir_mbdrc_feature_mode; // Stores MBDRC mode - bool_t is_iir_mbdrc_set_cfg_param_received; // This flag is set to 1 if Set - // param is received or else it is - // set to 0 - bool_t is_iir_mbdrc_media_fmt_received; // This flag is set to 1 if Media format - // is received or else it is set to 0 - bool_t is_iir_mbdrc_library_set_with_default_cfg; // This flag is set to 1 if - // library is set with default - // config, due to non - // availability of calibration - // for all the channel type - // received through Media - // format in Calibration - // received through Set Param - iir_mbdrc_per_channel_calib_mode_t iir_mbdrc_per_channel_calib_mode; // Stores information if per-channel - // calibration is enabled or disabled - capi_iir_mbdrc_common_config_struct_t iir_mbdrc_common_cfg; - capi_iir_mbdrc_per_config_t iir_mbdrc_main_cfg; // Stores the calibration received through set param - capi_iir_mbdrc_per_config_t - iir_mbdrc_default_cfg; // Stores the default calibratio capi_iir_mbdrc_per_config_t iir_mbdrc_main_cfg; // - // Stores the calibration received through set param - capi_iir_mbdrc_per_config_v2_t iir_mbdrc_main_cfg_v2; // Stores the calibration received through set param - capi_iir_mbdrc_per_config_v2_t iir_mbdrc_default_cfg_v2; // Stores the calibration received through set param - uint32_t cached_mbdrc_config_v2_param_size; - uint32_t cached_mbdrc_xover_freqs_v2_param_size; - uint32_t miid; // Module Instance ID - uint64_t input_mf_ch_mask_v1; // Input channel mask - // Input channel mask for v2 config - uint32_t input_mf_ch_mask_list_v2[CAPI_CMN_MAX_CHANNEL_MAP_GROUPS]; - // flag to detect if higher than 63 channel map received or not - bool_t higher_channel_map_present; - - capi_iir_mbdrc_config_version_t cfg_version; - -} capi_iir_mbdrc_t; - -/*------------------------------------------------------------------------ - * Function declarations - * -----------------------------------------------------------------------*/ -// Utility functions - -// Functions to be called from init function. -void capi_iir_mbdrc_init_media_fmt(capi_iir_mbdrc_t *const me_ptr); -void capi_iir_mbdrc_init_events(capi_iir_mbdrc_t *const me_ptr); -capi_err_t capi_iir_mbdrc_init_config(capi_iir_mbdrc_t *const me_ptr); - -// Set and Get property functions. -capi_err_t capi_iir_mbdrc_process_set_properties(capi_iir_mbdrc_t *me_ptr, capi_proplist_t *proplist_ptr); -capi_err_t capi_iir_mbdrc_process_get_properties(capi_iir_mbdrc_t *me_ptr, capi_proplist_t *proplist_ptr); - -// Set and Get Config params functions. -capi_err_t capi_iir_mbdrc_set_config_params(capi_iir_mbdrc_t *me_ptr, const uint32_t param_id, capi_buf_t *params_ptr); -capi_err_t capi_iir_mbdrc_get_config_params(capi_iir_mbdrc_t *me_ptr, const uint32_t param_id, capi_buf_t *params_ptr); - -// Function to raise the events -void capi_iir_mbdrc_raise_events(capi_iir_mbdrc_t *const me_ptr, bool_t media_fmt_update); -capi_err_t capi_iir_mbdrc_check_channel_map_cfg(iir_mbdrc_per_ch_filter_xover_freqs_t *cfg_ptr, uint32_t num_config); -capi_err_t capi_iir_mbdrc_init_default_xover_config(capi_iir_mbdrc_t *me_ptr); -uint64_t capi_iir_mbdrc_calculate_channel_mask(uint32_t channel_mask_lsb, uint32_t channel_mask_msb); -iir_mbdrc_per_channel_calib_mode_t capi_iir_mbdrc_configure_per_channel_calib_mode( - capi_iir_mbdrc_t *me_ptr, - uint64_t channel_map_from_set_config); - -capi_err_t capi_iir_mbdrc_allocate_lib_memory(capi_iir_mbdrc_t *me_ptr, - bool_t force_reinit, - bool_t use_default_static_cfg); - -capi_err_t capi_iir_mbdrc_set_xover_freq_v2_params(capi_iir_mbdrc_t *me_ptr, - const uint32_t param_id, - capi_buf_t * params_ptr); - -capi_err_t capi_iir_mbdrc_validate_multichannel_v2_payload(capi_iir_mbdrc_t *me_ptr, - int8_t * data_ptr, - uint32_t param_id, - uint32_t param_size, - uint32_t num_cfg, - uint32_t * req_payload_size, - uint32_t base_payload_size, - uint32_t per_cfg_base_payload_size); - -capi_err_t capi_iir_mbdrc_validate_per_channel_v2_payload(capi_iir_mbdrc_t *me_ptr, - uint32_t num_cfg, - int8_t * data_ptr, - uint32_t param_size, - uint32_t * required_size_ptr, - uint32_t param_id, - uint32_t base_payload_size, - uint32_t per_cfg_base_payload_size); - -bool_t capi_iir_mbdrc_check_multi_ch_channel_mask_v2_param(uint32_t miid, - uint32_t num_config, - uint32_t param_id, - int8_t * param_ptr, - uint32_t base_payload_size, - uint32_t per_cfg_base_payload_size); - -capi_err_t capi_iir_mbdrc_set_config_v2_params(capi_iir_mbdrc_t *me_ptr, - const uint32_t param_id, - capi_buf_t * params_ptr); - -iir_mbdrc_per_channel_calib_mode_t capi_iir_mbdrc_configure_per_channel_calib_mode_v2(capi_iir_mbdrc_t *me_ptr, - uint32_t *channel_mask_list, - uint32_t channel_group_mask); - -bool_t capi_iir_mbdrc_check_if_non_vol_cal_changed_v2( - capi_iir_mbdrc_t * me_ptr, - capi_buf_t * params_ptr, - int32_t * memory_needs_to_change, - iir_mbdrc_per_channel_calib_mode_t iir_mbdrc_per_channel_calib_mode); - -void capi_iir_mbdrc_get_channel_mask_list_v2(uint32_t temp_channel_mask_list[], - uint32_t *channel_mask_list, - uint32_t channel_group_mask); - -capi_err_t capi_iir_mbdrc_get_xover_freq_v2_params(capi_iir_mbdrc_t *me_ptr, - const uint32_t param_id, - capi_buf_t * params_ptr); - -capi_err_t capi_iir_mbdrc_init_default_xover_config_v2(capi_iir_mbdrc_t *me_ptr); - -capi_err_t capi_iir_mbdrc_init_default_config_v2(capi_iir_mbdrc_t *const me_ptr, - bool_t cache_defaults_to_iir_mbdrc_main_cfg); - -void capi_iir_mbdrc_get_calib_mode_for_v2_cfg(capi_iir_mbdrc_t *me_ptr); - -void capi_iir_mbdrc_check_allocate_and_initialize_lib_v2_cfg(capi_iir_mbdrc_t *me_ptr, - uint32_t num_cfg, - uint32_t channels_allocated, - uint32_t *matched_ptr); - -capi_err_t capi_iir_mbdrc_init_lib_v1(capi_iir_mbdrc_t *me_ptr, uint32_t matched); - -capi_err_t capi_iir_mbdrc_init_lib_v2(capi_iir_mbdrc_t *me_ptr, uint32_t matched); - -void capi_iir_mbdrc_post_process_lib_initialization_v1(capi_iir_mbdrc_t *me_ptr); - -void capi_iir_mbdrc_post_process_lib_initialization_v2(capi_iir_mbdrc_t *me_ptr); - -capi_err_t capi_iir_mbdrc_set_params_to_library_v2(capi_iir_mbdrc_t *me_ptr, bool_t use_default_static_cfg); - -void capi_iir_mbdrc_update_drc_flags_and_ch_mask_v2(capi_iir_mbdrc_t *me_ptr, - const uint32_t num_bands, - bool_t * downsample_level_flag_1, - bool_t * drc_linked_flag, - const uint32_t num_channel); - -void capi_iir_mbdrc_check_allocate_and_initialize_lib_v2_cfg(capi_iir_mbdrc_t *me_ptr, - uint32_t channels_allocated, - uint32_t * matched); - -capi_err_t capi_iir_mbdrc_get_config_params_v2(capi_iir_mbdrc_t *const me_ptr, - uint32_t param_id, - capi_buf_t *params_ptr); - -uint32_t capi_iir_mbdrc_calculate_cached_size_for_default_v2_param(uint32_t num_bands, - uint32_t num_config); -#endif diff --git a/modules/processing/gain_control/iir_mbdrc/inc/iir_mbdrc.h b/modules/processing/gain_control/iir_mbdrc/inc/iir_mbdrc.h deleted file mode 100644 index 1a84df93..00000000 --- a/modules/processing/gain_control/iir_mbdrc/inc/iir_mbdrc.h +++ /dev/null @@ -1,149 +0,0 @@ -/* ========================================================================= - Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. - SPDX-License-Identifier: BSD-3-Clause-Clear - ========================================================================== */ - -#ifndef IIR_MBDRC_H -#define IIR_MBDRC_H - -#include "iir_mbdrc_api.h" -#include "drc_api.h" -#include "limiter_api.h" -#include "audio_dsp.h" -#include "audio_apiir_df1_opt.h" - - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/*---------------------------------------------------------------------------- - * Preprocessor Definitions and Constants - * -------------------------------------------------------------------------*/ -#define IIR_MBDRC_LIB_VER (0x0400010000000000) // lib version : 4.0_1.0.0 - // external_major.external_minor.major.minor.revision.custom_alphabet.custom_number.reserved) - // (8.8.8.8.8.8.8.8 bits) - - -static const uint32 eq_max_stack_size = 600; // worst case stack mem in bytes -#define ALIGN8(o) (((o)+7)&(~7)) - - -#define IIR_MBDRC_TIME_CONST 0x1BF7A00 // UL32Q31, same as DN_EXPA_RELEASE_DEFAULT - -/* define IIR-related constants */ -// max states required per band -#define MAX_MSIIR_STATES_MEM (32) -// max # of even allpass stage -#define EVEN_AP_STAGE 3 -// max # of odd allpass stage -#define ODD_AP_STAGE 2 -// use fixed Q27 for all coef -#define IIR_COEFFS_TARGET_Q_FACTOR 27 -// for allpass biquad iir, only b0 and b1 are needed -#define BIQUAD_APIIR_COEFF_LENGTH 2 - -#define MBDRC_NUM_BAND_DEFAULT 1 -/*---------------------------------------------------------------------------- - * Type Declarations - * -------------------------------------------------------------------------*/ - -// iir_mbdrc states struct -typedef struct iir_mbdrc_states_mem_t -{ - // dynamic mem allocation for mute_flags[num_channels][IIR_MBDRC_MAX_BANDS] - int32 **mute_flags; - - // dynamic mem allocation for iir_mbdrc_cross_over_freqs[num_channels][IIR_MBDRC_MAX_BANDS-1] - uint32 **iir_mbdrc_cross_over_freqs; - - // dynamic mem allocation for drc_enable[num_channels][IIR_MBDRC_MAX_BANDS] - uint16 **drc_enable; - - // dynamic mem allocation for iir_mbdrc_makeupgain[num_channels][IIR_MBDRC_MAX_BANDS] - uint16 **iir_mbdrc_makeupgain; - - // dynamic mem allocation for iir_mbdrc_inst_makeupgain[num_channels][IIR_MBDRC_MAX_BANDS] - uint16 **iir_mbdrc_inst_makeupgain; - - uint32 num_band; -} iir_mbdrc_states_mem_t; - - -// iir_mbdrc internal memory struct -typedef struct iir_mbdrc_misc_scratch_buf_t -{ - // LPF output; shared by all bands - // dynamic mem allocation for int32 *subBandLPBuf[IIR_MBDRC_MAX_CHANNELS] - int32 **subBandLPBuf; - - // HPF output, which is input of next LPF; shared by all bands - // dynamic mem allocation for int32 *subBandHPBuf[IIR_MBDRC_MAX_CHANNELS] - int32 **subBandHPBuf; - - // IIR filter bank output, which is used for 16-bit case; shared by all bands - // dynamic mem allocation for int16 *internalOutBuf16[IIR_MBDRC_MAX_CHANNELS] - int16 **internalOutBuf16; - - // mixer output, which is limiter input; shared by all bands - // dynamic mem allocation for *internalOutBuf32[IIR_MBDRC_MAX_CHANNELS] - int32 **internalOutBuf32; - - // shared by all bands/channels - int32 *scatch_buf; - -} iir_mbdrc_misc_scratch_buf_t; - -// iir filter structure -// array is allocated for worse case (9-order IIR design) -typedef struct iir_filter_t -{ - uint32 num_stages[2]; // num_stages[0]: even filter stages; - // num_stages[1]: odd filter stages - - /* according to allpass biquad filter's transfer function: */ - /* H_ap(z) = (b0 + b1*z^-1 + z^-2)/(1 + b1*z^-1 + b0*z^-2) */ - /* only b0 and b1 needs to be saved */ - /* Besides, the 3-rd stage of even allpass filter is 1st order IIR */ - /* H_even_3rd(z) = (b0 + z^-1)/(1 + b0*z^-1) */ - /* only b0 needs to be saved */ - /* iir_coeffs store order is: */ - /* [b0_even1 b1_even1 | b0_even2 b1_even2 | b0_even3 b1_even3 | ...*/ - /* ...b0_odd1 b1_odd1 | b0_odd2 b1_odd2] */ - int32 iir_coeffs[MSIIR_MAX_COEFFS_PER_BAND]; - - /* each biquad IIR needs 4 mem, 1st order IIR needs 2 mem */ - /* states store order is: */ - /* [4 mem for even ap1 | 4 mem for even ap2 | ... */ - /* ... 4 mem for 1st order iir | 4 mem for odd ap1 | ... */ - /* ... 4 mem for odd ap2 | ... */ - /* ... 3 * (4 mem for delay apx)] */ - int32 states[MAX_MSIIR_STATES_MEM]; -} iir_filter_t; - - -// IIR_MBDRC lib mem structure -typedef struct iir_mbdrc_lib_mem_t -{ - iir_mbdrc_static_struct_t *iir_mbdrc_static_struct_ptr; - iir_mbdrc_feature_mode_t *iir_mbdrc_feature_mode_ptr; - iir_mbdrc_per_channel_calib_mode_t *iir_mbdrc_per_channel_calib_mode_ptr; - - // dynamic mem allocation for DRC library - drc_lib_t *drc_lib_linked_mem; // DRC when per-channel mode is enabled: drc_lib_linked_mem[IIR_MBDRC_MAX_BANDS] - drc_lib_t **drc_lib_mem; // DRC when per-channel mode is disabled: drc_lib_mem[num_channel][IIR_MBDRC_MAX_BANDS] - limiter_lib_t limiter_lib_mem; // multi ch ready - iir_mbdrc_states_mem_t *iir_mbdrc_states_mem_ptr; - iir_mbdrc_misc_scratch_buf_t *iir_mbdrc_misc_scratch_buf_ptr; - - // dynamic mem allocation for iir_filter_t *iir_filter_struct_ptr_array[IIR_MBDRC_MAX_BANDS-1][IIR_MBDRC_MAX_CHANNELS] - iir_filter_t ***iir_filter_struct_ptr_array; - -} iir_mbdrc_lib_mem_t; - - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif // IIR_MBDRC_H diff --git a/modules/processing/gain_control/iir_mbdrc/inc/iir_mbdrc_api.h b/modules/processing/gain_control/iir_mbdrc/inc/iir_mbdrc_api.h deleted file mode 100644 index d2eab906..00000000 --- a/modules/processing/gain_control/iir_mbdrc/inc/iir_mbdrc_api.h +++ /dev/null @@ -1,108 +0,0 @@ -/* ========================================================================= - Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. - SPDX-License-Identifier: BSD-3-Clause-Clear - ========================================================================== */ - -#ifndef IIR_MBDRC_API_H -#define IIR_MBDRC_API_H - -#include "iir_mbdrc_calibration_api.h" -#include "iir_mbdrc_function_defines.h" -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - - -/*---------------------------------------------------------------------------- - * Type Declarations - * -------------------------------------------------------------------------*/ -typedef enum IIR_MBDRC_RESULT -{ - IIR_MBDRC_SUCCESS = 0, - IIR_MBDRC_FAILURE, - IIR_MBDRC_MEMERROR -}IIR_MBDRC_RESULT; - -//IIR_MBDRC static params structure -typedef struct iir_mbdrc_static_struct_t -{ - uint32_t data_width; // 16 or 32 - uint32_t sample_rate; // Hz - uint32_t num_channel; // num of channel; up to 8 - uint32_t *drc_delay_samples; // dynamic mem allocation for drc_delay_samples * max_num_band; - // samples per channel in Q0 - uint32_t max_num_band; // max num of band; 1 ~ 10 - uint32_t limiter_delay_secs; // seconds per channel in Q15, the same for all channels - uint32_t max_block_size; // for limiter - uint32_t limiter_history_winlen; // length of history window (Q15 value of sec) -} iir_mbdrc_static_struct_t; - - -// IIR_MBDRC lib structure -typedef struct iir_mbdrc_lib_t -{ - void* iir_mbdrc_lib_mem_ptr; // ptr to the total chunk of lib mem -} iir_mbdrc_lib_t; - - -// IIR_MBDRC lib mem requirements structure -typedef struct iir_mbdrc_lib_mem_requirements_t -{ - uint32_t iir_mbdrc_lib_mem_size; // size of the lib mem pointed by lib_mem_ptr - uint32_t iir_mbdrc_lib_stack_size; // stack mem size -} iir_mbdrc_lib_mem_requirements_t; - - -/*---------------------------------------------------------------------------- - * Function Declarations and Documentation - * -------------------------------------------------------------------------*/ - -// get lib mem req -// iir_mbdrc_lib_mem_requirements_ptr: [out] Pointer to lib mem requirements structure -// iir_mbdrc_static_struct_ptr: [in] Pointer to static structure -IIR_MBDRC_RESULT iir_mbdrc_get_mem_req(iir_mbdrc_lib_mem_requirements_t *iir_mbdrc_lib_mem_requirements_ptr, iir_mbdrc_static_struct_t *iir_mbdrc_static_struct_ptr); - - -// partition and init the mem with default values -// iir_mbdrc_lib_ptr: [in, out] Pointer to lib structure -// iir_mbdrc_static_struct_ptr: [in] Pointer to static structure -// mem_ptr: [in] Pointer to lib memory -// mem_size: [in] Size of the memory pointed by mem_ptr -IIR_MBDRC_RESULT iir_mbdrc_init_memory(iir_mbdrc_lib_t *iir_mbdrc_lib_ptr, iir_mbdrc_static_struct_t *iir_mbdrc_static_struct_ptr, int8_t *mem_ptr, uint32_t mem_size); - - -// retrieve params from lib mem -// iir_mbdrc_lib_ptr: [in] Pointer to lib structure -// param_id: [in] ID of the param -// mem_ptr: [in/out] Pointer to the memory where params are to be stored -// mem_size:[in] Size of the memory pointed by mem_ptr -// param_size_ptr: [out] Pointer to param size which indicates the size of the retrieved param(s) -IIR_MBDRC_RESULT iir_mbdrc_get_param(iir_mbdrc_lib_t *iir_mbdrc_lib_ptr, uint32_t param_id, int8_t *mem_ptr, uint32_t mem_size, uint32_t *param_size_ptr); - - -// set the params in the lib mem -// iir_mbdrc_lib_ptr: [in, out] Pointer to lib structure -// param_id: [in] ID of the param -// mem_ptr: [in] Pointer to the memory where the values stored are used to set up the params in the lib memory -// mem_size:[in] Size of the memory pointed by mem_ptr -IIR_MBDRC_RESULT iir_mbdrc_set_param(iir_mbdrc_lib_t *iir_mbdrc_lib_ptr, uint32_t param_id, int8_t *mem_ptr, uint32_t mem_size); - - -// IIR_MBDRC processing of de-interleaved multi-channel audio signal -// iir_mbdrc_lib_ptr: [in] Pointer to lib structure -// out_ptr: [out] Pointer to de-interleaved multi-channel output PCM samples -// in_ptr: [in] Pointer to de-interleaved multi-channel input PCM samples -// block_size: [in] Number of samples to be processed per channel -IIR_MBDRC_RESULT iir_mbdrc_process(iir_mbdrc_lib_t *iir_mbdrc_lib_ptr, int8_t *out_ptr[], int8_t *in_ptr[], uint32_t block_size); - - -#ifdef IIR_MBDRC_SPLITFILTER32_LOOP_ASM -void iir_mbdrc_SplitFilter32_loop(int32_t *tmpOddOut, - int32_t *tmpEvenOut, - uint32_t nSampleCnt); -#endif -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif // IIR_MBDRC_API_H diff --git a/modules/processing/gain_control/iir_mbdrc/inc/iir_mbdrc_calibration_api.h b/modules/processing/gain_control/iir_mbdrc/inc/iir_mbdrc_calibration_api.h deleted file mode 100644 index fe0d2300..00000000 --- a/modules/processing/gain_control/iir_mbdrc/inc/iir_mbdrc_calibration_api.h +++ /dev/null @@ -1,195 +0,0 @@ -/* ========================================================================= - Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. - SPDX-License-Identifier: BSD-3-Clause-Clear - ========================================================================== */ - -#ifndef IIR_MBDRC_CALIBRATION_API -#define IIR_MBDRC_CALIBRATION_API - -#include "ar_defs.h" -#include "iir_mbdrc_api.h" -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/*---------------------------------------------------------------------------- - * Preprocessor Definitions and Constants - * -------------------------------------------------------------------------*/ -#define MSIIR_MAX_COEFFS_PER_BAND (10) // # of coeffs needed per filter block - // = #of biquad coeffs * (3 even stages + 2 odd stages) - -/*---------------------------------------------------------------------------- - * Pramameter ID Definitions - * -------------------------------------------------------------------------*/ - -// param id to get lib version -#define IIR_MBDRC_PARAM_GET_LIB_VER (0) // read only -typedef int64_t iir_mbdrc_lib_ver_t; // lib version - // external_major.external_minor.major.minor.revision.custom_alphabet.custom_number.reserved) - // (8.8.8.8.8.8.8.8 bits) - -// this param id is for iir_mbdrc_feature_mode_t -#define IIR_MBDRC_PARAM_FEATURE_MODE (1) // read/write; apply to all channels -typedef enum iir_mbdrc_mode_t -{ - IIR_MBDRC_BYPASSED = 0, // IIR_MBDRC processing bypassed; no IIR_MBDRC processing - IIR_MBDRC_ENABLED // IIR_MBDRC processing enabled; normal IIR_MBDRC processing -} iir_mbdrc_mode_t; -typedef iir_mbdrc_mode_t iir_mbdrc_feature_mode_t; - -// param id to get/set actual num of band -#define IIR_MBDRC_PARAM_NUM_BAND (2) // read/write; apply to all channels; -typedef uint32_t iir_mbdrc_num_band_t; - -// param id to get/set mute flags -#define IIR_MBDRC_PARAM_MUTE_FLAGS (3) // read/write; -typedef struct iir_mbdrc_mute_flags_t -{ - uint32_t ch_idx; // channel index - int32_t *mute_flags; // total mute_flag[num_band] per channel -} iir_mbdrc_mute_flags_t; - // read/write the number of band flags - - -// this param id is for iir_mbdrc_drc_feature_mode_struct_t -#define IIR_MBDRC_PARAM_DRC_FEATURE_MODE (4) // read/write; apply to all channels -typedef enum iir_mbdrc_drc_mode_t -{ - IIR_MBDRC_DRC_BYPASSED = 0, // DRC processing bypassed; - // no DRC processing and only delay is implemented - IIR_MBDRC_DRC_ENABLED, // DRC processing enabled; normal DRC processing -} iir_mbdrc_drc_mode_t; - -typedef struct iir_mbdrc_drc_feature_mode_struct_t -{ - uint32_t ch_idx; // channel index: 0 ~ IIR_MBDRC_MAX_BANDS-1 - uint32_t band_index; // band index: 0 ~ IIR_MBDRC_MAX_CHANNELS-1 (apply same mode to entire channels) - iir_mbdrc_drc_mode_t iir_mbdrc_drc_feature_mode; // 1 is with DRC processing; - // 0 is no DRC processing - // (bypassed, only delay is implemented) -} iir_mbdrc_drc_feature_mode_struct_t; - - -// this param id is for iir_mbdrc_drc_config_struct_t -#define IIR_MBDRC_PARAM_DRC_CONFIG (5) // read/write -typedef struct iir_mbdrc_drc_config_t -{ - // below two should not change during Reinit - int16_t channel_linked; // Q0 channel mode -- Linked(1) or Not-Linked(0); - int16_t down_sample_level; // Q0 Down Sample Level to save MIPS - - uint16_t rms_tav; // Q16 Time Constant used to compute Input RMS - uint16_t make_up_gain; // Q12 Makeup Gain Value - - int16_t dn_expa_threshold; // Q7 downward expansion threshold - int16_t dn_expa_slope; // Q8 downward expansion slope - uint32_t dn_expa_attack; // Q31 downward expansion attack time - uint32_t dn_expa_release; // Q31 downward expansion release time - int32_t dn_expa_min_gain_db; // Q23 downward expansion minimum gain in dB - uint16_t dn_expa_hysterisis; // Q14 downward expansion hysterisis time - - int16_t up_comp_threshold; // Q7 upward compression threshold - uint32_t up_comp_attack; // Q31 upward compression attack time - uint32_t up_comp_release; // Q31 upward compression release time - uint16_t up_comp_slope; // Q8 upward compression slope - uint16_t up_comp_hysterisis; // Q14 upward compression hysterisis time - - int16_t dn_comp_threshold; // Q7 downward compression threshold - uint16_t dn_comp_slope; // Q8 downward compression slope - uint32_t dn_comp_attack; // Q31 downward compression attack time - uint32_t dn_comp_release; // Q31 downward compression release time - uint16_t dn_comp_hysterisis; // Q14 downward compression hysterisis time - - int16_t reserved; - -} iir_mbdrc_drc_config_t; - -typedef struct iir_mbdrc_drc_config_struct_t -{ - uint32_t ch_idx; // channel index: 0 ~ IIR_MBDRC_MAX_BANDS-1 - uint32_t band_index; // band index: 0 ~ IIR_MBDRC_MAX_CHANNELS-1 - iir_mbdrc_drc_config_t iir_mbdrc_drc_config; -} iir_mbdrc_drc_config_struct_t; - - -// param id for get/set limiter mode -#define IIR_MBDRC_PARAM_LIMITER_MODE (6) // read/write -typedef enum iir_mbdrc_limiter_mode_t -{ - LIM_MAKEUPGAIN_ONLY = 0, - LIM_NORMAL_PROC -} iir_mbdrc_limiter_mode_t; - - -// param id for get/set limiter bypass mode -// this id itself has been verified but currently IIR_MBDRC -// does not use limiter in bypass mode - -// this id is here to maintain consistency under unified -// API guideline since limiter lib has this param id - -// this id can be used for new feature support in future -#define IIR_MBDRC_PARAM_LIMITER_BYPASS (7) // read/write -typedef int32_t iir_mbdrc_limiter_bypass_t; - - -// param id for limiter cfg params -#define IIR_MBDRC_PARAM_LIMITER_CONFIG (8) // read/write -typedef struct iir_mbdrc_limiter_tuning_t -{ - int32_t ch_idx; // channel index - int32_t threshold; // threshold (16bit: Q15; 32bit:Q27) - int32_t makeup_gain; // make up gain (Q8) - int32_t gc; // recovery const (Q15) - int32_t max_wait; // max wait (Q15 value of sec) - - uint32_t gain_attack; // limiter gain attack time (Q31) - uint32_t gain_release; // limiter gain release time (Q31) - uint32_t attack_coef; // limiter gain attack time speed coef (Q15) - uint32_t release_coef; // limiter gain release time speed coef (Q15) - int32_t hard_threshold; // threshold for hard limiter (16bit: Q15; 32bit:Q27) -} iir_mbdrc_limiter_tuning_t; - -// param id for IIR coeffs -// write only, only set_param is needed since -// there is no menu to do get_param in ACDB -#define IIR_MBDRC_PARAM_MSIIR_CONFIG (9) - -typedef struct iir_mbdrc_iir_config_struct_t { - uint32_t ch_idx; // channel index - uint32_t band_index; // 0 ~ 9 - uint32_t num_stages[2]; // num_stages[0]: even filter stages; - // num_stages[1]: odd filter stages - int32_t iir_coeffs[MSIIR_MAX_COEFFS_PER_BAND]; // store order: 3-stage even, 2-stage odd. -} iir_mbdrc_iir_config_struct_t; - -// param id for get/set crossover freqs -#define IIR_MBDRC_PARAM_CROSSOVER_FREQS (10) // read/write -typedef struct iir_mbdrc_crossover_freqs_t -{ - uint32_t ch_idx; // channel index - uint32_t *crossover_freqs; // cross-over frequencies; -} iir_mbdrc_crossover_freqs_t; - // read/write num_band-1 crossover freqs - -// param id for reset -#define IIR_MBDRC_PARAM_SET_RESET (11) // write only -// clear below internal mem -// - Even IIR -// - Odd IIR -// - delay IIR -// - DRC -// - limiter - -#define IIR_MBDRC_PARAM_PER_CHANNEL_CALIBRATION_MODE (12) // read/write -typedef enum iir_mbdrc_per_channel_calib_mode_t -{ - IIR_MBDRC_PER_CHANNEL_CALIB_DISABLE = 0, // disable per-channel calibration(== old version) - IIR_MBDRC_PER_CHANNEL_CALIB_ENABLE // enable per-channel calibration -}iir_mbdrc_per_channel_calib_mode_t; - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif // IIR_MBDRC_CALIBRATION_API diff --git a/modules/processing/gain_control/iir_mbdrc/inc/iir_mbdrc_function_defines.h b/modules/processing/gain_control/iir_mbdrc/inc/iir_mbdrc_function_defines.h deleted file mode 100644 index 14d1f5a7..00000000 --- a/modules/processing/gain_control/iir_mbdrc/inc/iir_mbdrc_function_defines.h +++ /dev/null @@ -1,16 +0,0 @@ -/* ========================================================================= - Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. - SPDX-License-Identifier: BSD-3-Clause-Clear - ========================================================================== */ - -#ifdef __qdsp6__ - -#define IIR_MBDRC_SPLITFILTER32_LOOP_ASM -#define IIRDF1_32_1STORDER_ASM - -#endif - - - - - diff --git a/modules/processing/resamplers/dynamic_resampler/api/dynamic_resampler_api.h b/modules/processing/resamplers/dynamic_resampler/api/dynamic_resampler_api.h deleted file mode 100644 index ee6e9b90..00000000 --- a/modules/processing/resamplers/dynamic_resampler/api/dynamic_resampler_api.h +++ /dev/null @@ -1,162 +0,0 @@ -#ifndef DYNAMIC_RESAMPLER_API_H -#define DYNAMIC_RESAMPLER_API_H - -/*============================================================================== - @file dynamic_resampler_api.h - @brief This file contains RESAMPLER API -==============================================================================*/ - -/* ======================================================================== - Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. - SPDX-License-Identifier: BSD-3-Clause-Clear -===========================================================================*/ - -/*------------------------------------------------------------------------ - * Include files - * -----------------------------------------------------------------------*/ -#include "module_cmn_api.h" - -/** @h2xml_title1 {Dynamic Resampler Module API} - @h2xml_title_agile_rev {Dynamic Resampler Module API} - @h2xml_title_date {September, 2018} */ - -/*------------------------------------------------------------------------------ - Defines -------------------------------------------------------------------------------*/ -/* Input port ID of Dynamic Resampler module */ -#define DYN_RS_DATA_INPUT_PORT 0x2 - -/* Output port ID of Dynamic Resampler module */ -#define DYN_RS_DATA_OUTPUT_PORT 0x1 - -/*------------------------------------------------------------------------------ - Module -------------------------------------------------------------------------------*/ -#define MODULE_ID_DYNAMIC_RESAMPLER 0x07001016 -/** - @h2xmlm_module {"MODULE_ID_DYNAMIC_RESAMPLER", - MODULE_ID_DYNAMIC_RESAMPLER} - @h2xmlm_displayName {"Dynamic Resampler"} - @h2xmlm_modSearchKeys{resampler, Audio} - @h2xmlm_description {- Dynamic Resampler module.\n - - This module converts audio sampling rate and uses FIR filters to do it. \n - - Therefore the SNR is higher than IIR filters but - at the cost of higher Delay.\n - -\n - - Supports following params: - - PARAM_ID_DYNAMIC_RESAMPLER_CONFIG - - PARAM_ID_DYNAMIC_RESAMPLER_OUT_CFG - - \n - - Supported Input Media Format: \n - - Data Format : FIXED_POINT \n - - fmt_id : Don't care \n - - Sample Rates : >0 to 384 kHz \n - - Number of channels : 1 to 128 (for certain products this module supports only 32 channels) \n - - Channel type : Don't care \n - - Bits per sample : 16, 32 \n - - Q format : Don't care \n - - Interleaving : de-interleaved unpacked \n - - Signed/unsigned : Don't care } - - @h2xmlm_dataMaxInputPorts { 1 } - @h2xmlm_dataInputPorts { IN = DYN_RS_DATA_INPUT_PORT} - @h2xmlm_dataOutputPorts { OUT = DYN_RS_DATA_OUTPUT_PORT} - @h2xmlm_dataMaxOutputPorts { 1 } - @h2xmlm_supportedContTypes {APM_CONTAINER_TYPE_SC} - @h2xmlm_isOffloadable {true} - @h2xmlm_stackSize { 4096 } - @{ <-- Start of the Module --> -*/ - -/* ID of the Dynamic Resampler configuration parameter used by MODULE_ID_DYNAMIC_RESAMPLER. */ -#define PARAM_ID_DYNAMIC_RESAMPLER_CONFIG 0x08001025 - -/* Structure payload for: PARAM_ID_DYNAMIC_RESAMPLER_CONFIG*/ -/** @h2xmlp_parameter {"PARAM_ID_DYNAMIC_RESAMPLER_CONFIG", PARAM_ID_DYNAMIC_RESAMPLER_CONFIG} - @h2xmlp_description { Structure for setting the configuration for the Dynamic Resampler } - @h2xmlp_toolPolicy {Calibration; RTC} */ - -#include "spf_begin_pack.h" -struct param_id_dynamic_resampler_config_t -{ - uint32_t use_hw_rs; - /**< @h2xmle_description {Specifies whether to use the hardware or software resampler for DYNAMIC RESAMPLER \n - -> If the client wants to use hardware resampler, use_hw_rs should - be set to 1 and dynamic_mode and delay_type values will be saved but ignored. \n - -> Hardware resampler can be created only if the chip supports it \n - -> If hardware resampler creation fails for any reason, sw resampler will - be created with saved dynamic mode and delay type set by client \n - -\n - -> If use_hw_rs flag is set to 0, software resampler is to be used, - and dynamic_mode and delay_type params come into play \n - -\n - -> Get param query on this api will return the actual resampler being used. - It is not simply what the client set} - - @h2xmle_rangeList {"Use sw resampler" = 0, - "Use hw resampler" = 1} - @h2xmle_default {0} */ - - uint16_t dynamic_mode; - /**< @h2xmle_description {Specifies the mode of operation for the DYNAMIC RESAMPLER\n - -> This dynamic_mode value has significance only if sw resampler is used.} - @h2xmle_rangeList {"Generic resampling"= 0; - "Dynamic resampling"=1} - @h2xmle_default {0} */ - - - uint16_t delay_type; - /**< @h2xmle_description {Specifies the delay type for the DYNAMIC RESAMPLER mode\n - -> This delay_type value has significance only if sw resampler is used - AND the dynamic_mode value is set to 1. } - @h2xmle_rangeList {"High delay with smooth transition"= 0; - "Low delay with visible transitional phase distortion"=1} - @h2xmle_default {0} */ -} -#include "spf_end_pack.h" -; -/* Structure type def for above payload. */ -typedef struct param_id_dynamic_resampler_config_t param_id_dynamic_resampler_config_t; - - - -/* Set param for sending output sample rate */ -#define PARAM_ID_DYNAMIC_RESAMPLER_OUT_CFG 0x08001034 - -/** @h2xmlp_parameter {"PARAM_ID_DYNAMIC_RESAMPLER_OUT_CFG", PARAM_ID_DYNAMIC_RESAMPLER_OUT_CFG} - @h2xmlp_description {Specifies the output sample rate to be set.} - @h2xmlp_toolPolicy {Calibration; RTC} */ - -#include "spf_begin_pack.h" -struct param_id_dynamic_resampler_out_cfg_t -{ - int32_t sampling_rate; - /**< @h2xmle_description {Specifies the output sample rate\n - ->Ranges from -2 to 384KHz where - -2 is PARAM_VAL_UNSET and -1 is PARAM_VAL_NATIVE} - @h2xmle_rangelist {"PARAM_VAL_UNSET" = -2; - "PARAM_VAL_NATIVE" =-1; - "8 kHz"=8000; - "11.025 kHz"=11025; - "12 kHz"=12000; - "16 kHz"=16000; - "22.05 kHz"=22050; - "24 kHz"=24000; - "32 kHz"=32000; - "44.1 kHz"=44100; - "48 kHz"=48000; - "88.2 kHz"=88200; - "96 kHz"=96000; - "176.4 kHz"=176400; - "192 kHz"=192000; - "352.8 kHz"=352800; - "384 kHz"=384000} - @h2xmle_default {-1} */ -} -#include "spf_end_pack.h" -; -/* Structure type def for above payload. */ -typedef struct param_id_dynamic_resampler_out_cfg_t param_id_dynamic_resampler_out_cfg_t; - - -/** @} <-- End of the Module -->*/ -#endif //DYNAMIC_RESAMPLER_API_H diff --git a/modules/processing/resamplers/dynamic_resampler/bin/arm/libdynamic_resampler.a b/modules/processing/resamplers/dynamic_resampler/bin/arm/libdynamic_resampler.a deleted file mode 100644 index b8ca9b07..00000000 Binary files a/modules/processing/resamplers/dynamic_resampler/bin/arm/libdynamic_resampler.a and /dev/null differ diff --git a/modules/processing/resamplers/dynamic_resampler/build/CMakeLists.txt b/modules/processing/resamplers/dynamic_resampler/build/CMakeLists.txt deleted file mode 100644 index 1b783827..00000000 --- a/modules/processing/resamplers/dynamic_resampler/build/CMakeLists.txt +++ /dev/null @@ -1,33 +0,0 @@ -#[[ - @file CMakeLists.txt - - @brief - - @copyright - Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. - SPDX-License-Identifier: BSD-3-Clause-Clear -]] -cmake_minimum_required(VERSION 3.10) - -#Include directories -set(dynamic_resampler_includes - ${LIB_ROOT}/inc -) - -spf_module_sources( - KCONFIG CONFIG_DYNAMIC_RESAMPLER - NAME dynamic_resampler - MAJOR_VER 1 - MINOR_VER 0 - AMDB_ITYPE "capi" - AMDB_MTYPE "pp" - AMDB_MID "0x07001016" - AMDB_TAG "capi_dynamic_resampler" - AMDB_MOD_NAME "MODULE_ID_DYNAMIC_RESAMPLER" - INCLUDES ${dynamic_resampler_includes} - H2XML_HEADERS "${LIB_ROOT}/api/dynamic_resampler_api.h" - CFLAGS "" - STATIC_LIB_PATH "${LIB_ROOT}/bin/arm/libdynamic_resampler.a" -) - - diff --git a/modules/processing/resamplers/dynamic_resampler/inc/hw_rs_lib.h b/modules/processing/resamplers/dynamic_resampler/inc/hw_rs_lib.h deleted file mode 100644 index 3570710e..00000000 --- a/modules/processing/resamplers/dynamic_resampler/inc/hw_rs_lib.h +++ /dev/null @@ -1,40 +0,0 @@ -/**======================================================================== - @file hw_rs_lib.h - - @brief This file contains API's for allocating static variables needed for hw resampler - -/*========================================================================= -Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. -SPDX-License-Identifier: BSD-3-Clause-Clear -========================================================================= */ - -#ifndef _HW_RS_LIB_H_ -#define _HW_RS_LIB_H_ - -#include "ar_error_codes.h" -#include "posal.h" - - -#ifdef __cplusplus -extern "C" { -#endif //__cplusplus - -// Mutex Info Structure -typedef struct hw_resampler_mutex_t -{ - posal_mutex_t mutex_lock; // Mutex lock for Hw Resampler api call. -} hw_resampler_mutex_t; - -ar_result_t hw_rs_lib_static_init(); - -void hw_rs_lib_init(posal_atomic_word_t **phwrs_resource_state, - posal_atomic_word_t **estimated_time_of_all_suspended_session, - hw_resampler_mutex_t **mutex_info); - -ar_result_t hw_rs_lib_static_deinit(); - -#ifdef __cplusplus -} -#endif //__cplusplus - -#endif /* _HW_RS_LIB_H_ */ diff --git a/modules/processing/resamplers/dynamic_resampler/inc/hwsw_rs_lib.h b/modules/processing/resamplers/dynamic_resampler/inc/hwsw_rs_lib.h deleted file mode 100644 index 551b5351..00000000 --- a/modules/processing/resamplers/dynamic_resampler/inc/hwsw_rs_lib.h +++ /dev/null @@ -1,263 +0,0 @@ -/* ======================================================================== */ -/** - @file hwsw_rs_lib.h - Header file for combo hw- sw resampler lib -*/ - -/*========================================================================= -Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. -SPDX-License-Identifier: BSD-3-Clause-Clear -========================================================================= */ - -#ifndef HWSW_RS_LIB_H -#define HWSW_RS_LIB_H - -/*------------------------------------------------------------------------ - * Include files - * -----------------------------------------------------------------------*/ - -#ifndef CAPI_UNIT_TEST -#include "shared_lib_api.h" -#else -#include "Elite_intf_extns_change_media_fmt.h" -#include "capi.h" -#endif - -#include "audpp_util.h" -#include "audio_dsp32.h" -#include "resampler_32b_ext.h" -#include "hwsw_rs_lib_hw.h" -#include "hw_rs_lib.h" - -#ifdef __cplusplus -extern "C" { -#endif //__cplusplu -/*------------------------------------------------------------------------ - * Macros, Defines, Type declarations - * -----------------------------------------------------------------------*/ -#define INTM_GUARD_BITS 32 -// Enum to list the number of stages supported -typedef enum { - STAGE_ZERO, - STAGE_ONE, - MAX_MULTI_STAGES_SUPPORTED -}stage_t; - -//Enum: column indices for sampling rates in table -typedef enum{ - MS_IP_SR = 1, - MS_INT_SR = 2, - MS_OP_SR = 3, - MS_UNIT_IP_SMPLS = 4, // unit frame size input sample index - MS_UNIT_INTM_SMPLS = 5, - MS_UNIT_OP_SMPLS = 6 -}tbl_fs_idx; - -typedef enum{ - FIXED_IN = 0, - FIXED_OUT -}process_mode; - -#define TEN_MS 10 // duration in ms - -// Enum : Supported multi-stage list -typedef enum{ - DYRS_384_44_1, - MAX_MULTI_STAGE_SUPPORTED_LIST -}ms_lst_fs_t; - -const uint32_t multi_stage_sr_info[][7] = { - {DYRS_384_44_1, 384000, 192000, 44100, 384, 192, 44 }, -}; - -// To print all lib status messages -//#define HWSW_RESAMPLER_DEBUG_MSG 1 - -// To print each frame status -//#define HWSW_RESAMPLER_PRINT_FRAME_STATS 1 -/*------------------------------------------------------------------------ - * Structure definitions - * -----------------------------------------------------------------------*/ -typedef struct hwsw_rs_sw_mode_config -{ - uint16_t dynamic_mode; // 0: non-dynamic mode, 1: dynamic mode - uint16_t delay_type; // 0: High delay, 1: Low delay (relevant if dynamic mode is set) -} hwsw_rs_sw_mode_config_t; - -typedef struct hwsw_rs_sw_lib_config -{ - uint32_t first_frame; - int32_t config_params[20]; -} hwsw_rs_sw_lib_config_t; - -typedef struct hwsw_rs_sw_lib_mem_req -{ - uint32_t drsStructSize; - uint32_t drsGenCoeffSize; - uint32_t drsPerChannelDataMemSize; - uint32_t drsMemSize; - uint32_t drsFiltCoeffMxSize; -} hwsw_rs_sw_lib_mem_req_t; - -typedef struct hwsw_rs_sw_lib_mem_ptr -{ - // Library State structure memory - void *pStructMem; - - // Generated polyphase filter coefficients - void *pGenCoeff; - - // Per channel filter memory - void *pChannelData[CAPI_MAX_CHANNELS_V2]; - - // Coefficient matrix - void *pCoefMatrix; - - // Filter selected based on inp/out freq - void *pResampCoef; -} hwsw_rs_sw_lib_mem_ptr_t; - -typedef struct hwsw_rs_sw_memory -{ - hwsw_rs_sw_lib_mem_req_t drs_mem_req; - hwsw_rs_sw_lib_mem_req_t prev_drs_mem_req; - hwsw_rs_sw_lib_mem_ptr_t drs_mem_ptr; -} hwsw_rs_sw_memory_t; - -typedef struct hwsw_rs_media_fmt_t -{ - uint32_t inp_sample_rate; - uint16_t bits_per_sample; - uint16_t num_channels; - uint32_t output_sample_rate; - uint32_t q_factor; -} hwsw_rs_media_fmt_t; - -typedef struct hwsw_rs_events_config -{ - uint32_t KPPS; - uint32_t delay_in_us; - uint32_t bandwidth; -} hwsw_rs_events_config_t; - -typedef struct hwsw_rs_resampler_config -{ - uint32_t use_hw_rs; - uint16_t dynamic_mode; - uint16_t delay_type; -} hwsw_rs_resampler_config_t; - -typedef enum hwsw_rs_using_resampler_t { SW_RESAMPLER = 0, HW_RESAMPLER, NO_RESAMPLER } hwsw_rs_using_resampler_t; - -// Information required for multi-stage -typedef struct ms_info_t{ - uint32_t intm_max_smpls_ms; - uint32_t num_stages; - int32_t tbl_idx; // index in the Multi stage sampling rate conversion table - capi_stream_data_t intm_buf_ptr; // intermediate stage stream buffer -}ms_info_t; - -typedef struct hwsw_resampler_lib -{ - // Flag which tells us which resampler is being used - hwsw_rs_using_resampler_t this_resampler_instance_using; - - // Copy of Input Media format in lib - hwsw_rs_media_fmt_t media_fmt; - - /* sw related structs */ - // Resampling mode (dynamic or non-dynamic) (High Delay or Low Delay) - hwsw_rs_sw_mode_config_t sw_rs_config_param; - - // Sw resampler Library config structure. - hwsw_rs_sw_lib_config_t* sw_lib_config_ptr[MAX_MULTI_STAGES_SUPPORTED]; - - // info about allocated memory for sw resampler. - hwsw_rs_sw_memory_t* sw_rs_mem_ptr[MAX_MULTI_STAGES_SUPPORTED]; - - /* hw related structs */ - // hw resampler structure - hwsw_rs_hw_resampler_t hw_resampler; - - /* dm related params set to the lib through set param handling when receiving dm mode and num samples - * dm_mode decides if lib should operate in fixed out or fall back to default operation*/ - uint32_t dm_mode; - /* output num of samples are provided to lib to be used when dm mode is set to fixed out mode - * Lib by default only has info of output buffers max data length - * For lib default behavior this variable wont be used */ - uint32_t output_fixed_samples; - - //flag to check if it is a multi_stage_process - bool_t is_multi_stage_process; - - //multi stage information structure - ms_info_t ms_info; -#ifdef HWSW_RESAMPLER_DEBUG_MSG - FILE *fp_intm; - FILE *fp_out; -#endif -} hwsw_resampler_lib_t; - -/*------------------------------------------------------------------------ - * Function definitions - * -----------------------------------------------------------------------*/ -void hwsw_rs_lib_init(hwsw_resampler_lib_t *hwsw_rs_lib); - -ar_result_t hwsw_rs_lib_deinit(hwsw_resampler_lib_t *hwsw_rs_ptr); - -void hwsw_rs_hw_resampler_get_process_info(hwsw_rs_hw_resampler_t *hwrs_ptr, - uint32_t input_actual_samples, - uint32_t output_max_samples, - uint32_t * input_samples_to_consume_ptr, - uint32_t * output_samples_to_generate_ptr); - -void hwsw_rs_lib_process_get_hw_process_info(hwsw_resampler_lib_t *hwsw_rs_ptr, - uint32_t input_actual_samples, - uint32_t output_max_samples, - uint32_t * input_samples_to_consume_ptr, - uint32_t * output_samples_to_generate_ptr); - -ar_result_t hwsw_rs_lib_process(hwsw_resampler_lib_t *hwsw_rs_ptr, - capi_buf_t * input_buf_ptr, - capi_buf_t * output_buf_ptr, - uint32_t input_num_bufs, - uint32_t output_num_bufs, - uint32_t heap_id); - -ar_result_t hwsw_rs_lib_check_create_resampler_instance(hwsw_resampler_lib_t *hwsw_rs_ptr, uint32_t heap_id); - -void hwsw_rs_set_lib_mf(hwsw_resampler_lib_t *hwsw_rs_ptr, hwsw_rs_media_fmt_t *inp_mf); - -void hwsw_rs_lib_set_dm_config(hwsw_resampler_lib_t *hwsw_rs_ptr, uint32_t dm_mode, uint32_t fixed_out_samples); - -void hwsw_rs_lib_set_config(uint32_t use_hwrs, - uint16_t dyn_mode, - uint16_t delay, - hwsw_resampler_lib_t *hwsw_rs_ptr, - bool_t * update_rs); - -ar_result_t hwsw_rs_lib_set_hwrs_suspend_resume(bool_t is_suspend, hwsw_resampler_lib_t *hwsw_rs_ptr, uint32_t *create_rs); - -uint32_t hwsw_rs_lib_get_kpps(hwsw_resampler_lib_t *hwsw_rs_ptr); - -uint32_t hwsw_rs_lib_get_bw(hwsw_resampler_lib_t *hwsw_rs_ptr); - -uint32_t hwsw_rs_lib_get_alg_delay(hwsw_resampler_lib_t *hwsw_rs_ptr); - -void hwsw_rs_lib_get_process_check(hwsw_resampler_lib_t *hwsw_rs_ptr, uint32_t *process_check); - -ar_result_t hwsw_rs_lib_algo_reset(hwsw_resampler_lib_t *hwsw_rs_ptr); - -bool_t hwsw_rs_lib_is_multi_stage_supported (hwsw_resampler_lib_t *hwsw_rs_ptr); - -void hwsw_rs_lib_init_sw_rs_mem_inst(hwsw_resampler_lib_t *hwsw_rs_ptr, uint32_t stage_idx); - -ar_result_t hwsw_rs_lib_create_lib_inst(hwsw_resampler_lib_t *hwsw_rs_ptr, uint32_t stage_idx, uint32_t req_size_per_instance, - uint32_t heap_id); - - -#ifdef __cplusplus -} -#endif //__cplusplus - -#endif // HWSW_RS_LIB_H diff --git a/modules/processing/resamplers/dynamic_resampler/inc/hwsw_rs_lib_hw.h b/modules/processing/resamplers/dynamic_resampler/inc/hwsw_rs_lib_hw.h deleted file mode 100644 index f75c5fa6..00000000 --- a/modules/processing/resamplers/dynamic_resampler/inc/hwsw_rs_lib_hw.h +++ /dev/null @@ -1,173 +0,0 @@ -/* ======================================================================== */ -/** - @file hwsw_rs_lib_hw.h - Header file for combo hw-sw resampler lib with hw defines -*/ - -/*========================================================================= -Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. -SPDX-License-Identifier: BSD-3-Clause-Clear -========================================================================= */ - -#ifndef HWSW_RS_LIB_HW_H -#define HWSW_RS_LIB_HW_H - -/*------------------------------------------------------------------------ - * Include files - * -----------------------------------------------------------------------*/ - -#include "posal.h" -#if ((defined __hexagon__) || (defined __qdsp6__)) -#include "hwd_devcfg.h" -#endif -#include "hw_rs_lib.h" - - -/*------------------------------------------------------------------------ - * Macros, Defines, Type declarations - * -----------------------------------------------------------------------*/ -static const uint32_t HW_RS_MAX_FREQ = 384000; -static const uint32_t HW_RS_MAX_CHANNELS = 32; - -// OSR for Down-sampling is 24. -static const uint32_t HW_RS_MAX_DOWNSAMPLE_RATIO = 24; - -// Highest OSR for Up-sampling is 160. -static const uint32_t HW_RS_MAX_UPSAMPLE_RATIO = 160; - -static const uint32_t HW_RS_BUFFER_DELAY_US = 10000; // 10 MS -static const uint32_t HW_RS_BUFFER_DELAY_MS = HW_RS_BUFFER_DELAY_US / 1000; // 10 MS -static const int32_t HW_RS_FRAME_SIZE_US = HW_RS_BUFFER_DELAY_US; // 10 MS -static const uint32_t HW_RS_PROCESS_TIME_THRESHOLD = 7000; - -/*------------------------------------------------------------------------ - * Structure definitions - * -----------------------------------------------------------------------*/ - -// Hw Resampler Input-Output Media info Structure. -typedef struct hwsw_rs_hw_resampler_media_info -{ - int32 in_sampling_rate; - int32 out_sampling_rate; - uint16 bits_per_sample; - uint16 num_channels; -} hwsw_rs_hw_resampler_media_info_t; - -// Hw Resampler job signal Structure -typedef struct hwsw_rs_hw_resampler_job_signal -{ - posal_signal_t sig_job_ptr; // signal for the job submitted - posal_channel_t channel_job_ptr; // channel used to embed the signal - uint32 sig_mask; -} hwsw_rs_hw_resampler_job_signal_t; - -// Hw Resampler Internal Buffer Structure -typedef struct hwsw_rs_hw_resampler_internal_buf -{ - capi_buf_t buf[HW_RS_MAX_CHANNELS]; - uint32_t start_byte_index; // read byte index in each buffer - uint32_t valid_bytes; // valid bytes in each buffer - uint32_t frame_size_in_bytes; // bytes allocated per buffer -} hwsw_rs_hw_resampler_internal_buf_t; - -// Hw Resampler Buffer Manager. -typedef struct hwsw_rs_hw_resampler_buffer_mgr -{ - // Buffer where data is copied from ext input buffer - hwsw_rs_hw_resampler_internal_buf_t *data_input_buffer_ptr; - - // Input Buffer which is used to call the Hw resampler process - hwsw_rs_hw_resampler_internal_buf_t *process_input_buffer_ptr; - - // Buffer from data is copied to ext output buffer - hwsw_rs_hw_resampler_internal_buf_t *data_output_buffer_ptr; - - // Output Buffer which is used to call the Hw resampler process - hwsw_rs_hw_resampler_internal_buf_t *process_output_buffer_ptr; - - // Pointer to the memory allocated for buffers. - int8_t *mem_ptr; - - // size of allocated memory. - uint32_t mem_size; - - // Total normalized input samples consumed by the module - uint32_t input_samples_consumed; - - // Total normalized output samples produced by the module - uint32_t output_samples_produced; - - // number of samples to consume precalculated before process - uint32_t input_samples_to_consume; - - // number of samples to produce precalculated before process - uint32_t output_samples_to_generate; -} hwsw_rs_hw_resampler_buffer_mgr_t; - -// Hw Resampler Structure -typedef struct hwsw_rs_hw_resampler -{ - /* - * This flag is used to identify if Hw resampler is supported by Chip. - * It can also be false if client want to force-disable the Hw resampler. - */ - bool_t hw_resampler_supported; - - /* - * This is in an internal flag which is set only when both hw resampler can be used - * AND client has asked to use it through the set param api - */ - bool_t use_hw_rs; - - /* - * This flag is used to identify if a job is completed or not. - * If it is true then it doesn't always mean that job is pending at Hw resampler. - * It is possible that Hw resampler has completed the job and raised the signal through - * callback function. But caller hasnt cleared that signal yet. - */ - bool_t is_job_pending; - - // Flag to identify if session is suspended or not. - bool_t is_session_suspended; - - /* - * It accumulates the minimum estimated time(at max clock) of all those jobs - * which are closed because of the session suspend. - * We intend to reopen these jobs once session is resumed. - * This variable is used to correct the Time threshold. - */ - posal_atomic_word_t *estimated_time_of_all_suspended_session; - - // Minimum estimated time(at max clock) to complete the current job only - uint32_t minimum_estimated_time_of_this_session; - - // Signal, used to identify if a job is completed by Hw resampler. - hwsw_rs_hw_resampler_job_signal_t job_signal; - - // Media info for which Hw resampler job is need to be opened. - hwsw_rs_hw_resampler_media_info_t media_info; - - // Buffer manager which keeps the pointer to all the process and data buffers. - hwsw_rs_hw_resampler_buffer_mgr_t buf_mgr; - - // Mutex, to avoid simultaneous access of Hw resampler api. - hw_resampler_mutex_t *mutex_info; - - // Hw resampler handle. - //rs_drv_handle_t rs_handle; - - // Hw resampler job config structure. - //rs_drv_job_cfg_t rs_job_cfg; - - // heap id, to allocate the memory for buffers. - uint32_t heap_id; - - // keeps record of number of Hw jobs currently opened. - posal_atomic_word_t *phwrs_resource_state; - -#if HW_RS_JOB_COMPLETION_TIME - uint64_t job_complete_time; -#endif -} hwsw_rs_hw_resampler_t; - -#endif // HWSW_RS_LIB_HW_H diff --git a/modules/processing/resamplers/dynamic_resampler/inc/multi_def_resampler.h b/modules/processing/resamplers/dynamic_resampler/inc/multi_def_resampler.h deleted file mode 100644 index dadf964a..00000000 --- a/modules/processing/resamplers/dynamic_resampler/inc/multi_def_resampler.h +++ /dev/null @@ -1,31 +0,0 @@ -/*========================================================================= -Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. -SPDX-License-Identifier: BSD-3-Clause-Clear -========================================================================= */ - -#ifndef MULTI_DEF_RESAMPLER_H -#define MULTI_DEF_RESAMPLER_H - -#define resamp_output_latency resamp_output_latency_dynamic_resampler -#define resamp_input_latency resamp_input_latency_dynamic_resampler -#define resamp_size resamp_size_dynamic_resampler -#define select_filter select_filter_dynamic_resampler -#define init_upsamp init_upsamp_dynamic_resampler -#define straight_copy straight_copy_dynamic_resampler -#define gen_rs_filt_coefs_lin32 gen_rs_filt_coefs_lin32_dynamic_resampler -#define rsphase_update_frac rsphase_update_frac_dynamic_resampler -#define conv_32 conv_32_dynamic_resampler -#define init_dnsamp init_dnsamp_dynamic_resampler -#define conv_16X32 conv_16X32_dynamic_resampler -#define int_div_16 int_div_16_dynamic_resampler -#define int_div_32 int_div_32_dynamic_resampler -#define int_div_64 int_div_64_dynamic_resampler -#define frac_div_32 frac_div_32_dynamic_resampler -#define halfQ15 halfQ15_dynamic_resampler -#define oneQ15 oneQ15_dynamic_resampler -#define resampFiltQFac resampFiltQFac_dynamic_resampler -#define resampTotalPhGrp resampTotalPhGrp_dynamic_resampler -#define resampFiltLenGrp resampFiltLenGrp_dynamic_resampler - - -#endif /* MULTI_DEF_RESAMPLER_H */ diff --git a/modules/processing/resamplers/dynamic_resampler/inc/resampler_32b_ext.h b/modules/processing/resamplers/dynamic_resampler/inc/resampler_32b_ext.h deleted file mode 100644 index 26c42691..00000000 --- a/modules/processing/resamplers/dynamic_resampler/inc/resampler_32b_ext.h +++ /dev/null @@ -1,143 +0,0 @@ -#include "multi_def_resampler.h" - -/*========================================================================= -Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. -SPDX-License-Identifier: BSD-3-Clause-Clear -========================================================================= */ - -#ifndef _RESAMPLER_32B_EXT_H_ -#define _RESAMPLER_32B_EXT_H_ - -#ifdef __cplusplus -extern "C" { -#endif -/*===========================================================================* - * INCLUDE HEADER FILES * - *===========================================================================*/ -#include "audio_basic_op.h" - -/*===========================================================================* - * Constants. * - *===========================================================================*/ - -/* For windows SPF builds we use the original resampler and - * not the qdsp or xtensa optimised versions */ -#if !((defined __hexagon__) || (defined __qdsp6__)) && !defined(__XTENSA__) -#define RESAMPLER_ORIGINAL -#endif - -#if defined(__XTENSA__) -#define RESAMPLER_C_OPT -#endif - -#ifndef RESAMPLER_ORIGINAL - #ifndef RESAMPLER_C_OPT - #define RESAMPLER_ASM_OPT - #endif -#endif - -#ifdef RESAMPLER_ORIGINAL - #undef RESAMPLER_C_OPT -#endif - - -/* Comprehensive analysis report covers the conversion cases from 8 to 384 kHz. - * It is safe to claim that the maximum supported frequency and down-conversion ratio - * are 384 kHz and 48, respectively. To claim higher frequency or conversion ratio, - * the comprehensive analysis must be conducted before claiming - */ -#define MAX_FREQ 1536000 -#define MAX_DOWN_RATIO 192 -#define ASYNC_RANGE 20 -#define MASK_QUALITY 0xF -#define MASK_INTERP 0x1 -#define MASK_ASYNC 0x1 -#define MASK_CHANNEL 0xF -#define MASK_INPUT 0x1 -#define MASK_BITS 0x1 -#define MASK_COEF 0x2 -#define MASK_DYNAMIC 0x1 -#define MASK_DELAY 0x1 -#define MASK_FILT_SEL 0x1 -#define MASK_DATA_QFACT 0x1 -#define SHIFT_QUALITY 6 -#define SHIFT_INTERP 10 -#define SHIFT_ASYNC 11 -#define SHIFT_CHANNEL 2 -#define SHIFT_INPUT 1 -#define SHIFT_BITS 0 -#define SHIFT_DYNAMIC 12 -#define SHIFT_DELAY 13 -#define SHIFT_FILTER_SELECT 14 -#define SHIFT_DATA_Q_FACTOR 15 - - -typedef enum -{ - MODE, /* SRC mode word */ - IN_FREQ, /* input frequency */ - OUT_FREQ, /* output frequency */ - RS_OSR, /* up-sampler OSR */ - RS_FLEN, /* up-sampler filter length */ - RS_MEM_LEN, /* up-sampler memory length */ - RS_QFAC, /* up-sampler filter coefficient q-factor */ - RS_SYMMETRIC, /* up-sampler filter symmetry indicator */ - MODE_COEF_BIT, /* coefficient bit width indicator, 16 bit input */ - /* 0 -- 16 bit filter coefficients */ - /* 1 -- 32 bit filter coefficients */ - MODE_INTERP, /* interpolation mode indicator */ - /* 0 -- linear interpolation */ - /* 1 -- quadratic interpolation */ - MODE_ASYNC, /* asynchronous indicator */ - NUM_CHAN, /* number of channels */ - MODE_DYNAMIC, /* dynamic resampler indicator */ - MODE_DYNAMIC_DELAY, /* delay mode for dyanmic resampler */ - /* 0 -- low delay with visible transitional phase distortion */ - /* 1 -- high delay with smooth transition */ - MODE_FILT_SEL_FLAG, - /* 0 -- disable new filter selection */ - /* 1 -- enable new filter selection */ - DATA_Q27_FLAG, - /* 0 -- not Q27 for 32bit data */ - /* 1 -- Q27 only when data width is 32 bits */ - - -} PARAM; - -/*===========================================================================* - * FUNCTION DECLARATIONS FOR BOTH UP-SAMPLER AND DOWN-SAMPLER * - *===========================================================================*/ -void resamp_size(int32 *par, int16 *pRsSize, int16 *pRsMemSize); -void* select_filter(int32 minFreq, int32 maxFreq, int32 async, int32* param); -int16 dynamic_resamp_output_latency(void *pRS); -int16 dynamic_resamp_input_latency(void *pRS); -int32 resamp_fixedin(void*, void**, void**, int32); -int32 resamp_fixedout(void*, void**, void**, int32); -int32 resamp_calc_fixedin(void*, int32); -int32 resamp_calc_fixedout(void*, int32); -void resamp_overshoot_protection_q27(void**, int32, int32); - -uint32 resamp_memreq_opt_coef_table(void*); -int32 resamp_gen_opt_coef_table(void*,void*,uint32); - -/*===========================================================================* - * FUNCTION DECLARATIONS FOR UP-SAMPLER * - *===========================================================================*/ -int32 init_upsamp(void*, int32*, void*, void*, void**); - -/*===========================================================================* - * FUNCTION DECLARATIONS FOR DOWN_SAMPLER * - *===========================================================================*/ -int32 init_dnsamp(void*, int32*, void*, void*, void**); - -/*===========================================================================* - * FUNCTION DECLARATIONS FOR DYNAMIC_RESAMPLER * - *===========================================================================*/ -int32 init_dynamic_resamp(void*, int32*, void*, void*, void**); -int32 reinit_dynamic_resamp(void* pStruct, int32 inFreq); - -#ifdef __cplusplus -} -#endif - -#endif /* _RESAMPLER_32B_EXT_H_ */ diff --git a/modules/processing/resamplers/dynamic_resampler/inc/rs_common.h b/modules/processing/resamplers/dynamic_resampler/inc/rs_common.h deleted file mode 100644 index 1fb6185f..00000000 --- a/modules/processing/resamplers/dynamic_resampler/inc/rs_common.h +++ /dev/null @@ -1,96 +0,0 @@ -#include "multi_def_resampler.h" - -/*========================================================================= -Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. -SPDX-License-Identifier: BSD-3-Clause-Clear -========================================================================= */ - -#ifndef _RS_COMMON_H_ -#define _RS_COMMON_H_ - -#include "audio_basic_op.h" - -/*===========================================================================* - * TYPE DEFINITIONS * - *===========================================================================*/ - - -/*===========================================================================* - * constants * - *===========================================================================*/ -#define Q15_SHIFT 15 -#define Q20_SHIFT 20 -#define Q23_SHIFT 23 -#define MAX_Q15 32767 -#define MIN_Q15 -32768 - - -/*===========================================================================* - * EXTERNAL VARIABLES * - *===========================================================================*/ -extern const int16 oneQ15, halfQ15; -extern const int32 oneQ23, halfQ23; - -/*===========================================================================* - * STRUCTURES * - *===========================================================================*/ -typedef struct -{ - int64 totalPhStepCoef;/* Phase update step size for filter coefficient*/ - int32 fracPhMask; - int32 fracPhStepCoef; /* Phase update step size for filter coefficient*/ - int32 inFreq; /* input sampling rate */ - int32 outFreq; /* output sampling rate */ - int32 maxFreq; - int32 totalPhCap; /* cap of total phase */ - int32 totalPhStep; /* phase update step size for starting point */ - int32 curTotalPh; /* total phase for starting point */ - int32 fracPhStep; - int32 curFracPh; /* fractional phase for starting point, no init */ - int32 invMaxFreq; /* inverse of input frequency */ - int16 intPhStepCoef; /* Phase update step size for filter coefficient*/ - int16 sampStep; /* phase update step size for starting point */ - int16 intPhStep; - int16 curIntPh; /* integer phase for starting point, no init */ - int16 invMaxFreqShift;/* shifting factor of invInFreq */ - int16 totalIntPh; /* filter over sampling ratio */ - int16 convIndex; /* filter index for convolution */ - int16 loadIndex; /* filter index for loading filter memory */ - int16 async; /* Asynchronous mode indicator */ - int16 intRatio; /* Integer resampling ratio indicator */ -} RSPhase; - -typedef struct -{ - void *pMem; /* point to filter memory */ - void *pCoef; /* point to filter coefficient */ - void *pCoef2; - void *pGenCoef; /* pointer to generated filter coefficients */ - int32 halfQfac; /* one half for a given Q factor */ - int32 coefLen; /* length of filter coefficient */ - int32 coefLen2; /* half length of filter coefficient if filter */ - /* coefficients is symmetric. */ - int32 coefLen3; /* length of filter coefficient */ - int32 coefLen4; /* half length of filter coefficient if filter */ - /* coefficients is symmetric. */ - int16 coefStep; /* convolution step size of filter coefficient */ - int16 coefStep2; - int16 coefStart; - int16 qFac; /* Qfactor of the filter coefficients */ - int16 memLen; /* length of filter memory */ - int16 memStep; /* convolution step size of filter memmory */ -} Filters; - -/*===========================================================================* - * FUNCTION DECLARATIONS * - *===========================================================================*/ -int16 int_div_16(int16 num16, int16 den16, int16* rem16); -int32 int_div_32(int32 num32, int32 den32, int32* rem32); -int64 int_div_64(int64 num64, int64 den64, int64* rem64); -int32 frac_div_32(int32 num, int32 den, int16 Qfac); -int32 fxp_inv_32(int32 num, int16 qFac, int16 *shift); - -#endif /* _RS_COMMON_H_ */ -/*===========================================================================* - * End of rs_common.h * - *===========================================================================*/ diff --git a/modules/processing/resamplers/dynamic_resampler/inc/rs_driver.h b/modules/processing/resamplers/dynamic_resampler/inc/rs_driver.h deleted file mode 100644 index 73118619..00000000 --- a/modules/processing/resamplers/dynamic_resampler/inc/rs_driver.h +++ /dev/null @@ -1,460 +0,0 @@ -/* -============================================================================ - -FILE: rs_driver.h - -DESCRIPTION: Resampler HW driver header file. - -/*========================================================================= -Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. -SPDX-License-Identifier: BSD-3-Clause-Clear -========================================================================= */ - -#include - -#ifdef __cplusplus -extern "C" { -#endif //__cplusplus - -#ifndef RS_DRIVER_H -#define RS_DRIVER_H - -#include "typedef_drivers.h" -#include "posal.h" -#include "ar_defs.h" -#include "qurt.h" -#include "hwd_devcfg.h" - -//#define DRIVER_DEBUG 1 - -#define MAX_MULTI_RESAMP_CHANNELS 32 - -/** - * The following define is for HW Interrupt triger event type - */ - -typedef enum _rs_job_event_type -{ - RS_JOB_EVEN_INVALID = -1, - RS_JOB_EVEN_JOB_DONE = 1, - RS_JOB_EVEN_JOB_ERROR = 2, -} rs_job_event_type; - -/** -* The following define is for HW resampler job status -*/ -typedef enum _rs_job_status_type -{ - RS_JOB_STATUS_INVALID = -1, - RS_JOB_STATUS_ONGOING = 0, //job not finish yet - RS_JOB_STATUS_DONE, //job done - RS_JOB_STATUS_AHB_ERROR, //job error - RS_JOB_STATUS_SAMPLE_COUNT_ERROR, //job error -} rs_job_status_type; - -/** -* The following define is for HW resampler operation mode. -*/ -typedef enum _rs_operation_type -{ - RS_OPERATION_INVALID = -1, - RS_OPERATION_UPSAMPLING = 1, //up sampling only - RS_OPERATION_DNSAMPLING, //down sampling only - RS_OPERATION_RESAMPLING, //up sampling first then down sampling = Both, - //for example of 48 KHz to 44.1 KHz: upsampling 48 K to 88.2 K first then divide it by 2 -} rs_operation_type; - -/** -* The following define is for HW resampler operation priority. -*/ -typedef enum _rs_priority_type -{ - RS_PRIORITY_INVALID = -1, - RS_PRIORITY_LOW = 0, - RS_PRIORITY_HIGH, -} rs_priority_type; - -/** -* The following define is for HW resampler job submit type. -*/ -typedef enum _rs_job_submit_type -{ - RS_JOB_INVALID = -1, - RS_JOB_CANCEL = 0, - RS_JOB_SUBMIT, -} rs_job_submit_type; - -/** -* The following define is for HW resampler coeffcient source type. -*/ -typedef enum _rs_coeff_src_type -{ - RS_COEFF_SRC_INVALID = -1, - RS_COEFF_SRC_ROM = 0, - RS_COEFF_SRC_CUSTOMER, //coeff array is put in RAM -} rs_coeff_src_type; - -/** -* The following define is for HW resampler coeffcient type. It is valid only when coeff source is ROM. -*/ -typedef enum _rs_coeff_quality_type -{ - RS_COEFF_QUALITY_INVALID = -1, - RS_COEFF_QUALITY_HQ = 0, //coeff bit width = 16 - RS_COEFF_QUALITY_SHQ, //coeff bit width = 20 -} rs_coeff_quality_type; - -/** -* The following define is for HW resampler coeffcient type. It is valid only when coeff source is ROM. -*/ -typedef enum _rs_sample_width_type -{ - RS_SAMPLE_WIDTH_INVALID = -1, - RS_SAMPLE_WIDTH_16 = 0, - RS_SAMPLE_WIDTH_32, -} rs_sample_width_type; - -/** -* The following define is for HW upsampler filter type. -*/ -typedef enum _rs_upsamp_filter_type -{ - RS_UPSAMPLER_FILTER_ID_INVALID = -1, - RS_UPSAMPLER_FILTER_ID_1344 = 0, - RS_UPSAMPLER_FILTER_ID_8960, - RS_UPSAMPLER_FILTER_ID_MAX, -} rs_upsamp_filter_type; - -/** -* The following define is for HW downsampler filter type. -*/ -typedef enum _rs_dnsamp_filter_type -{ - RS_DNSAMPLER_FILTER_ID_INVALID = -1, - RS_DNSAMPLER_FILTER_ID_1344 = 0, - RS_DNSAMPLER_FILTER_ID_8960, //not supported - RS_DNSAMPLER_FILTER_ID_MAX, -} rs_dnsamp_filter_type; - -/** -* The following define is for HW resampler interpolation type. -*/ -typedef enum _rs_interp_type -{ - RS_INTERP_MODE_INVALID = -1, - RS_INTERP_MODE_LINEAR = 0, - RS_INTERP_MODE_QUAD, - RS_INTERP_MODE_MAX, -} rs_interp_type; - -/** -* The following define is for HW resampler force interpolation type. -*/ -typedef enum _rs_force_interpol_type -{ - RS_FORCE_INTERPOL_INVALID = -1, - RS_FORCE_INTERPOL_OFF = 0, //normal operation - RS_FORCE_INTERPOL_ON, //force fractional operation, used in streaming case -} rs_force_interpol_type; - - -/** -* The following define is for HW resampler dynamic resampler mode. -*/ -typedef enum _rs_dynamic_resampler_type -{ - RS_DYNAMIC_RESAMPLER_INVALID = -1, - RS_DYNAMIC_RESAMPLER_OFF = 0, //normal operation - RS_DYNAMIC_RESAMPLER_ON, //dynamic resampler mode -} rs_dynamic_resampler_type; - - -/** \brief resampler driver upsampler parameter struct */ -typedef struct _struct_rs_upsampler -{ - /** integer phase step size */ - uint16_t int_phase_step_size; // = samp_inc; - /** current integer phase */ - uint16_t cur_int_phase; // = samp; - /** fraction phase step size */ - uint32_t frac_phase_step_size; // = sub_samp_inc; - /** current fraction phase */ - uint32_t cur_frac_phase; // = sub_samp; - /** upsampler out freq */ - uint32_t out_freq; - /** fraction const */ - uint32_t frac_const; - /** shift const */ - uint16_t shift_const; - /** up sampler filter memory size */ - int16_t up_filt_mem_size; -} struct_rs_upsampler; - -/** \brief resampler driver downsampler parameter struct */ -typedef struct _struct_rs_dnsampler -{ - /** upsampler structure */ - struct_rs_upsampler up_samp_struct; - /** down sampler filter memory size */ - int16_t dn_filt_mem_size; - /** down sampler ratio. input stream is divided by this factor */ - int16_t ds_factor; - /** down sampler step size - number of coefficeints that needs to be skipped*/ - int16_t ds_step; - /** location of the end of the UpSampler filter = ptrDnSampStruct->filtMemOffset */ - int16_t up_sampler_flt_fptr; //UPSAMPLER ONLY up_sampler_flt_fptr = upsamp.filtMemOffset //DOWN SAMPLER ONLY up_sampler_flt_fptr = 0 //RESAMPLER up_sampler_flt_fptr = upsamp.filtMemOffset - /** location of next sample generated by UPsampler */ - int16_t up_sampler_flt_optr; //UPSAMPLER ONLY up_sampler_flt_optr = upsamp.outputOffset //DOWN SAMPLER ONLY up_sampler_flt_optr = 0 //RESAMPLER up_sampler_flt_optr = dnsamp.inputOffset - /** location of next input sample read from memory = ptrDnSampStruct->inputOffset */ - int16_t resampler_flt_iptr; //UPSAMPLER ONLY resampler_flt_iptr = upsamp.inputOffset //DOWN SAMPLER ONLY resampler_flt_iptr = dnsamp.inputOffset //RESAMPLER resampler_flt_iptr = upsamp.inputOffset - /** location of the end of the DnSampler Filter */ - int16_t dn_sampler_flt_fptr; //UPSAMPLER ONLY dn_sampler_flt_fptr = 0 //DOWN SAMPLER ONLY dn_sampler_flt_fptr = dnsamp.filtMemOffset //RESAMPLER dn_sampler_flt_fptr = dnsamp.filtMemOffset -}struct_rs_dnsampler; - -/** \brief resampler driver customer coeff parameter struct */ -typedef struct _struct_rs_cust_coeff -{ - /** Starting address of custom coefficients */ - uint32_t cust_coeff_base_addr; - /** customer coeff length */ - uint32_t cust_coeff_length; - /** up sampler customer coeff offset */ - uint16_t us_cust_coeff_cfg_offset; //in 16 bit word unit - /** up sampler customer coeff filter taps */ - uint16_t us_cust_coeff_cfg_filter_taps; - /** up sampler customer coeff polyphase */ - uint16_t us_cust_coeff_cfg_plyphase; - /** down sampler customer coeff offset */ - uint16_t ds_cust_coeff_cfg_offset; //in 16 bit word unit - /** down sampler customer coeff filter taps */ - uint16_t ds_cust_coeff_cfg_filter_taps; - /** need driver to allocate internal buffer for customer coeffcients. 1 - need 0 - not needed */ - uint16_t internal_coeff_buf_needed; -}struct_rs_cust_coeff; - - -/** \brief resampler driver hw resampler job parameter struct */ -typedef struct _struct_rs_job_config -{ - /** pointer to down sampler structure */ - struct_rs_dnsampler *ptr_dn_samp_struct; - /** pointer to customer coeff structure */ - struct_rs_cust_coeff *ptr_cust_coeff; - /** operation type: Up/Down/Both */ - rs_operation_type operation; - /** priority: High/Low */ - rs_priority_type prio; - /** number of channels, 1-8 */ - uint16_t num_channels; - /** sampler bit width: 16bit/24bit */ - rs_sample_width_type data_width; - /** coeff quality: 16bit/17bit/18bit */ - rs_coeff_quality_type coeff_width; - /** submit this job or not: 1:submit 0:cancel */ - rs_job_submit_type submit_job; - /** upsampler filter ID */ - rs_upsamp_filter_type upsamp_filt_id; - /** dnsampler filter ID */ - rs_dnsamp_filter_type dnsamp_filt_id; - /** hw resampler interpolation mode*/ - rs_interp_type interp_mode; - /** hw resampler sync mode*/ - rs_force_interpol_type force_interpol; - /** hw resampler dynamic resampler mode*/ - rs_dynamic_resampler_type dynamic_rs; - /** coeff source: ROM and RAM */ - rs_coeff_src_type coeff_src; - /** for internal input/output buffer 0: don't need, 1: need */ - uint16_t internal_buf_needed; - /** the max num of input samples per channel, valid if internal_buf_needed = 1, 4096 is maxium */ - /** if this field is set as zero, driver will set it as 4096 */ - uint16_t input_num_sample_max; -} struct_rs_job_config; - -/** \brief resampler driver buffer parameter struct */ -typedef struct _struct_rs_buf -{ - /** buffer pointer. all samples in filt memory are uint32_t format */ - uint32_t buf_ptr; - /** buffer length in bytes */ - uint16_t buf_length; -} struct_rs_buf; - -/** \brief HW Resampler driver for stream structure data updating */ -typedef struct _struct_rs_stream_data -{ - /** integer phase step size */ - uint16_t int_phase_step_size; // = samp_inc; - /** fraction phase step size */ - uint32_t frac_phase_step_size; // = sub_samp_inc; - /** current fraction phase */ - uint32_t cur_frac_phase; // = sub_samp; - /** fraction const */ - uint32_t frac_const; - /** shift const */ - uint16_t shift_const; - /** upsampler out freq */ - uint32_t med_freq; -} struct_rs_stream_data; - -/** \brief HW Resampler driver callback data type */ -typedef struct _struct_rs_cb_data -{ - /** Resampler driver return result */ - /** AR_EOK SUCCESS others FAILURE */ - ar_result_t result; - /** job ID */ - uint16_t job_id; - /** Error type */ - rs_job_status_type hw_error_type; -} struct_rs_cb_data; - -/** \brief HW Resampler driver callback function type */ -typedef void (*rs_job_event_callback_func) -( - /** A void pointer to user defined context */ - void *user_ctx_ptr, - /** Callback event type */ - rs_job_event_type event, - /** Callback data type */ - void *cb_data_ptr -); - - -/** \brief resampler driver hw resampler job timing info struct */ -typedef struct _struct_rs_job_timing_info -{ - int32_t num_input_sample_per_frame; - int32_t num_output_sample_per_frame; - /** frame size in microsecond unit. the frame szie should be matched with the num input sample sent via rs_send_job() */ - /** for example, for 48000 Hz to 44100 Hz resampling case, if frame_size = 10000 ns, then the num_input_sample for every frame is 48. */ - int32_t frame_size; - /** the time in microsecond unit client requires hw resampler done the job for this frame */ - int32_t budget_time_to_done; - /** the time in microsecond unit that hw resampler can finish the job. it is returned back from hw rs driver*/ - int32_t estimated_time_to_done; -} struct_rs_job_timing_info; - -/** -* This resampler driver init function and it is only called once. -* -* @return Success/failure of resampler init. -*/ -ar_result_t rs_init(void); - -/** -* This resampler driver deinit function and it is only called once. -* -* @return Success/failure of resampler deinit. -*/ -ar_result_t rs_deinit(void); - -/** -* This function is for resampler job init. -* -* @param[in] px - processor ID: 0 QDSP 1 APPLICATION PROCESSOR. -* @param[in] job_struct - point to job configure struct. -* @param[in] cb_func - callback function when job is done -* @param[in] user_ctx - user defined ctx used in callback function -* @return job ID, valid job ID is 0 to 15. -*/ -int16_t rs_init_job(uint16_t px, struct_rs_job_config* job_struct, rs_job_event_callback_func cb_func, void* user_ctx); - -/** -* This function is for sending the input samplers to driver -* -* @param[in] px - processor ID: 0 QDSP 1 APPLICATION PROCESSOR. -* @param[in] job_id - job ID. -* @param[in] in_samples - the num of input samples -* @param[in] out_samples - the expected num of output samples. -* @param[in] in_buf_ptr - pointer to an array which specific the input buffer pointer for every channel. -* @param[in] out_buf_ptr - pointer to an array which specific the output buffer pointer for every channel. -* @return Success/failure of sending this frame job. -*/ -ar_result_t rs_send_job(uint16_t px, int16_t job_id, uint16_t in_samples, uint16_t out_samples, int32_t** in_buf_ptr, int32_t** out_buf_ptr); - -/** -* This function is for reset hw resampler -* It is used in fast farward/rewind cases -* The frame sent via rs_send_job() is treated as the first frame after rs_reset_job() called -* -* @param[in] px - processor ID: 0 QDSP 1 APPLICATION PROCESSOR. -* @param[in] job_id - job ID. -* @param[in] job_struct - point to job configure struct. Some parameters are updated -* @return Success/failure of sending this frame job. -*/ -ar_result_t rs_reset_job(uint16_t px, int16_t job_id, struct_rs_job_config* job_struct); - -/** -* This function is for confirming the job. It is called after client getting the callback function. -* The output samples will be in output buffer after this function call -* -* @param[in] px - processor ID: 0 QDSP 1 APPLICATION PROCESSOR. -* @param[in] job_id - job ID. -* @param[in/out] samples_processed - num of samples has been processed -* @return job status. -*/ -rs_job_status_type rs_confirm_job(uint16_t px, int16_t job_id, uint32_t *samples_processed); - -/** -* This function is for uninit this job -* -* @param[in] px - processor ID: 0 QDSP 1 APPLICATION PROCESSOR. -* @param[in] job_id - job ID. -* @return void -*/ -void rs_uninit_job(uint16_t px, int16_t job_id); - -/** -* This function is for querying the stream configuration -* -* @param[in] job_id - job ID. -* @param[in] ptr_rs_dnsamp - point to struct_rs_dnsampler struct. -* @return Success/failure of query. -*/ -ar_result_t rs_get_stream_config(int16_t job_id, struct_rs_dnsampler *ptr_rs_dnsamp); - -/** -* This function is for setting the stream configuration -* -* @param[in] job_id - job ID. -* @param[in] ptr_rs_dnsamp - point to struct_rs_dnsampler struct. -* @return Success/failure of query. -*/ -ar_result_t rs_set_stream_config(int16_t job_id, struct_rs_dnsampler *ptr_rs_dnsamp); - -/** -* This function is for updaing the stream configuration -* -* @param[in] job_id - job ID. -* @param[in] ptr_rs_str_data - point to struct_rs_stream_data struct. -* @param[in] flag - for internal use only, 6 - update all parameters in struct_rs_stream_data; others: only int_phase_step_size and frac_phase_step_size -* @return Success/failure of query. -*/ -ar_result_t rs_set_stream_data(int16_t job_id, struct_rs_stream_data *ptr_rs_str_data, uint16_t flag); - -/** - * This function is for estimating the core clk - * - * @param[in] job_id the job_id of the stream - * @param[in] ptr_job_timing_info pointer to struct struct_rs_job_timing_info - * @return AR_EOK if succesful, else failure - */ -ar_result_t rs_estimate_core_clks(int16_t job_id, struct_rs_job_timing_info* ptr_job_timing_info); - - -/** - * This function is for querying hw resampler version - * - * @return hw resampler version - */ -uint32_t rs_query_hw_version(void); - -bool_t HwdDevCfg_HWSupport(HwdModuleType moduleType); -#endif - -#ifdef __cplusplus -} -#endif //__cplusplus - - diff --git a/modules/processing/resamplers/dynamic_resampler/inc/rs_driver_ext.h b/modules/processing/resamplers/dynamic_resampler/inc/rs_driver_ext.h deleted file mode 100644 index 462b112a..00000000 --- a/modules/processing/resamplers/dynamic_resampler/inc/rs_driver_ext.h +++ /dev/null @@ -1,410 +0,0 @@ -/* -============================================================================ - -FILE: rs_driver_ext.h - -DESCRIPTION: Resampler HW driver extension header file. - -/*========================================================================= -Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. -SPDX-License-Identifier: BSD-3-Clause-Clear -========================================================================= */ - -#ifdef __cplusplus -extern "C" { -#endif //__cplusplus - -#ifndef RS_DRIVER_EXT_H -#define RS_DRIVER_EXT_H - -#include "posal.h" - -//The max number of jobs in queue is 8. -//The max number of jobs that resampler can process is 8. -//The number of IDs that can be used is 16 IDs. (valid ID is 0 to 15) - -#define MAX_NUM_OF_HW_RESAMPLER_JOB 8 -#define MAX_HW_RS_FREQ_SUPPORTED 192000 - -typedef void* rs_drv_handle_t; - -/** - * HW Resampler driver extension IOCtrl call property - */ -typedef enum _rs_drv_property_type -{ - RS_DRV_PROPERTY_UNDEFINED, - RS_DRV_PROPERTY_FORCE_INTERPOL_CONFIG = 0x1, - RS_DRV_PROPERTY_REGISTER_JOB_EVENT_CALLBACK = 0x2, //this is used only for async call - RS_DRV_PROPERTY_GET_REQUIRED_NUM_SAMPLES = 0x3, - RS_DRV_PROPERTY_ESTIMATE_CORE_CLK = 0x4, - RS_DRV_PROPERTY_DYNAMIC_RESAMPLER_CONFIG = 0x5, - - RS_DRV_PROPERTY_GLOBAL = 0x20000000, - RS_DRV_PROPERTY_HW_VERSION_QUERY, - RS_DRV_PROPERTY_MAX -}rs_drv_property_type; - -/** -* HW resampler driver extension upsampler filter type define. -*/ -typedef enum _rs_drv_upsamp_filter_type -{ - RS_DRV_UPSAMPLER_FILTER_ID_INVALID = -1, - RS_DRV_UPSAMPLER_FILTER_ID_1344 = 0, - RS_DRV_UPSAMPLER_FILTER_ID_8960, - RS_DRV_UPSAMPLER_FILTER_ID_MAX, -} rs_drv_upsamp_filter_type; - -/** -* HW resampler driver extension interpolation type define. -*/ -typedef enum _rs_drv_interp_type -{ - RS_DRV_INTERP_MODE_INVALID = -1, - RS_DRV_INTERP_MODE_LINEAR = 0, - RS_DRV_INTERP_MODE_QUAD, - RS_DRV_INTERP_MODE_MAX, -} rs_drv_interp_type; - -/** -* HW resampler driver extension force interpolation type.define -*/ -typedef enum _rs_drv_force_interpol_type -{ - RS_DRV_FORCE_INTERPOL_INVALID = -1, - RS_DRV_FORCE_INTERPOL_OFF = 0, //normal operation - RS_DRV_FORCE_INTERPOL_ON, //force fractional operation, used in streaming case -} rs_drv_force_interpol_type; - - -/** -* HW resampler driver extension dynamic resampler enable type.define -*/ -typedef enum _rs_drv_dynamic_resampler_type -{ - RS_DRV_DYNAMIC_RESAMPLER_INVALID = -1, - RS_DRV_DYNAMIC_RESAMPLER_OFF = 0, //normal operation - RS_DRV_DYNAMIC_RESAMPLER_ON, //dynamic resampler is enabled. used for fast/slow playabck -} rs_drv_dynamic_resampler_type; - -/** -* The following define is to inform HW resampler driver extension which clock mismatch detect mode used by client. -* This is used only in force fraction operation mode -* -* HW Resampler is running on local system clcok. The input stream maybe from network which is running in remote clock domain -* The output stream maybe driven from audio render device which maybe in another clock domain -* For example, for no drift case, the input freq is 48000 Hz and output freq is 48000 Hz. -* If there is the drift between remote clock domain and local system clock, when we use the local system clock to count the incoming -* audio samples, we can get for example 48005 smaple in one sec -* If there is the drift between device render clock domain and local system clock, when we use the local system clock to count the output -* audio samples, we can get for example 47995 smaple in one sec -* So we have the below user cases: -* 1) The drift is happened in INPUT path only --> RS_DRV_SAMPLE_RATE_DRIFT_MODE_INPUT -* 2) The drift is happened in OUTPUT path only --> RS_DRV_SAMPLE_RATE_DRIFT_MODE_OUTPUT -* 3) The drift is happened in both --> RS_DRV_SAMPLE_RATE_DRIFT_MODE_BOTH -* -* Call sequence for FORCE_FRACTION_OPERATION mode -* 1. Configure job as FORCE_FRACTION_OPERATION mode and start job as normal -* 2. Client detect the input or/and output sample rate period -* 3. If drift is detected, -* 3-1 Use RS_DRV_PROPERTY_FORCE_INTERPOL_CONFIG to configure FORCE_FRACTION_OPERATION mode -* 3-2 Calculate the num of input/output smaples -* 3-3 Send the job -* -* for case like 8 Khz -> 6.1 KHz, the resampler should be set as -* 8 -> 24.4 -> 6.1 -* 8 -> 24.4 -> force fraction mode -* 24.4 -> 6.1 -> normal down sampleing -*/ -typedef enum _rs_drv_sample_rate_drift_mode -{ - RS_DRV_SAMPLE_RATE_DRIFT_MODE_INVALID = -1, - RS_DRV_SAMPLE_RATE_DRIFT_MODE_INPUT = 0, - RS_DRV_SAMPLE_RATE_DRIFT_MODE_OUTPUT, - RS_DRV_SAMPLE_RATE_DRIFT_MODE_BOTH, -} rs_drv_sample_rate_drift_mode; - -/** -* HW resampler driver extension prediction mode define for calculate num of input/output samples -*/ -typedef enum _rs_drv_num_sample_predict_mode -{ - RS_DRV_NUM_SAMPLE_PREDICT_MODE_INVALID = -1, - RS_DRV_NUM_SAMPLE_PREDICT_MODE_FIXED_INPUT = 0, //Baseing on num of input samples to calculate the num of output samples - RS_DRV_NUM_SAMPLE_PREDICT_MODE_FIXED_OUTPUT, //Baseing on num of output samples to calculate the needed num of input samples -} rs_drv_num_sample_predict_mode; - -/** -* HW Resampler driver extension IOCtl call property info struct.define -*/ -typedef struct -{ - /** Property call type*/ - rs_drv_property_type prop; - /** Data size of property call*/ - int32 data_size; - /** Data pointer of property call*/ - void *data_ptr; - /** Reserved*/ - int32 flags; -} rs_drv_ioctl_prop_info_t; - - -/** -* The structure define for a buffer that is passed into resampler driver extension functions -*/ -typedef struct -{ - int8* data_ptr; /**< Data pointer to the raw data. */ - - uint32 actual_data_len; /**< Length of the valid data (in bytes). This - field has multiple uses, depending on the - context:\n - - When this buffer is an input to a function, the caller specifies - the number of valid bytes using this field. The callee overwrites this - field with the number of bytes that were consumed. - - - When this buffer is the output of a function, the caller does not - use this field. The callee fills this field with the number of generated - valid bytes in the output buffer. - */ - uint32 max_data_len; /**< Total allocated size of the buffer (in - bytes). When a pointer of type rs_drv_buf_t - is passed as an input argument of a - function, this parameter specifies the - allocated size of the buffer and is - untouched by the callee. */ -} rs_drv_buf_t; - -/** -* The structure is for a list of rs_drv_buf buffers. It can be used for functions -* that require multiple input or output buffers. -* -* This structure consists of a pointer to an array of type rs_drv_buf. For -* multichannel de-interleaved data, each buffer contains data from all -* the channels in sequence. -*/ -typedef struct -{ - rs_drv_buf_t* buf_ptr; /**< Array of rs_drv_buf buffer elements. */ - uint32 bufs_num; /**< Number of elements in the array. */ -} rs_drv_buflist_t; - - -/** -* HW Resampler driver extension job open parameter struct.define -*/ -typedef struct _rs_drv_job_cfg -{ - /** input sample rate */ - int32 in_freq; - /** output sample rate */ - int32 out_freq; - /** number of channels, 1-8 */ - uint16 num_channels; - /** sampler bit width: 16bit/32bit */ - uint16 samp_bit_width; - /** hw resampler upsampler filter type*/ - rs_drv_upsamp_filter_type upsamp_filt_id; - /** hw resampler interpolation mode*/ - rs_drv_interp_type interp_mode; - /** hw resampler force interpol mode*/ - rs_drv_force_interpol_type force_interpol; - /** hw resampler dynamic resampler mode*/ - rs_drv_dynamic_resampler_type dynamic_resampler; - /** for internal input/output buffer 0: don't need, 1: need */ - /** if this is set as 0, client should guarantee that both buffer pointer and buffer max length for each channel */ - /** of input/output are 32 byte aligned. The memory for each channel is physical continus */ - /** if force_interpol is set as ON, set internal_buf_needed to 0 to avoid any internal buffer overwriten as the internal */ - /** input/output buffer sizes are calculated basing on the in_freq and out_freq which are not drifted */ - uint16 internal_buf_needed; - /** the max num of input samples per channel, valid if internal_buf_needed = 1, 4096 is maxium */ - /** if this field is set as zero, driver will set it as 4096 */ - uint16 input_num_sample_max; -} rs_drv_job_cfg_t; - -/** -* HW Resampler driver extension IOCtl property call - async mode configure struct.define -*/ -typedef struct -{ - rs_drv_sample_rate_drift_mode mode; - /** input sample rate */ - int32 in_freq; - /** output sample rate */ - int32 out_freq; -} rs_drv_ioctl_prop_force_interpol_cfg_t; - - -/** -* HW Resampler driver extension IOCtl property call - get the num of required samples -* For "Fixed Input Mode" -- mode = RS_DRV_NUM_SAMPLE_PREDICT_MODE_FIXED_INPUT -* num_sample_in : specific the num of input sample by client -* num_sample_out: the num of output sample returned by resampler driver -* For "Fixed Output Mode" -- mode = RS_DRV_NUM_SAMPLE_PREDICT_MODE_FIXED_OUTPUT -* num_sample_in : the num of input sample returned by resampler driver -* num_sample_out: specific the num of output sample by client -*/ -typedef struct -{ - rs_drv_num_sample_predict_mode mode; - /** num of input samples */ - uint32 num_sample_in; - /** num of output samples */ - uint32 num_sample_out; -} rs_drv_ioctl_prop_get_num_sample_t; - -/** -* HW Resampler driver extension IOCtl property call - estimate hw resampler core clk -*/ -typedef struct -{ - /** frame size in microsecond unit. the frame szie should be matched with the num input sample sent via rs_drv_job_process() */ - /** for example, for 48000 Hz to 44100 Hz resampling case, if frame_size = 10000 us, then the num_input_sample for every frame is 480. */ - int32 frame_size; - /** the time in microsecond unit client requires hw resampler done the job for this frame */ - int32 budget_time_to_done; - /** the time in microsecond unit that hw resampler can finish the job. it is returned back from hw rs driver*/ - int32 estimated_time_to_done; -} rs_drv_ioctl_prop_estimate_core_clk_t; - - -/** -* HW Resampler driver extension IOCtl property call - dynamic resampler mode configure struct.define -*/ -typedef struct -{ - /** input sample rate */ - int32 in_freq; - /** output sample rate */ - int32 out_freq; -} rs_drv_ioctl_prop_dynamic_resampler_cfg_t; - -/** -* This resampler driver driver extension init function and it is only called once. -* -* @return Success/failure of resampler init. -*/ -ar_result_t rs_drv_init(void); - -/** -* This resampler driver driver extension deinit function and it is only called once. -* -* @return Success/failure of resampler deinit. -*/ -ar_result_t rs_drv_deinit(void); - -/** -* This function is for resampler driver extension job init. -* @param[in/out] rs_drv_h - this will be the service entry handle returned to the caller. -* @param[in] job_cfg_ptr - point to job configure struct. -* @return Success/failure of sending this frame job. -*/ -ar_result_t rs_drv_job_open(rs_drv_handle_t *rs_drv_h, rs_drv_job_cfg_t* job_cfg_ptr); - -/** -* This function is for processing the input/output data -* -* @param[in] rs_drv_h - input handle. -* @param[in] in_buflist_ptr - pointer to rs_drv_buflist. -* @param[in] out_buflist_ptr - pointer to rs_drv_buflist. -* @return Success/failure of sending this frame job. -* Note: -* 1. Client should use RS_DRV_PROPERTY_GET_REQUIRED_NUM_SAMPLES property call to get the num of input samples (for fixed output mode) -* OR num of output samples (for fixed input mode) before calling this function -* 2. Supposing: -* the num of input samples = num_input_samples -* the num of output samples = num_output_samples -* 3. Then set the input and output buffer as below: -* in_buflist_ptr->buf_ptr->actual_data_len = num_input_samples * sample_size_in_bytes -* out_buflist_ptr->buf_ptr->actual_data_len = num_output_samples * sample_size_in_bytes -* -*/ -ar_result_t rs_drv_job_process(rs_drv_handle_t rs_drv_h, rs_drv_buflist_t* in_buflist_ptr, rs_drv_buflist_t* out_buflist_ptr); - -/** -* This function is for processing the input/output data -* -* @param[in] rs_drv_h - input handle. -* @return Success/failure of sending this frame job. -* Note: -* This function is used for fast farward/rewind cases -* The frame sent via rs_drv_job_process() is treated as the first frame after rs_drv_job_reset() called. -*/ -ar_result_t rs_drv_job_reset(rs_drv_handle_t rs_drv_h); - -/** -* This function is for uninit this job -* -* @param[in] rs_drv_h - input handle -* @return void -*/ -ar_result_t rs_drv_job_close(rs_drv_handle_t rs_drv_h); - -/** -* HW Resampler driver extension IOCtl function -* -* @param[in] rs_drv_h - input handle -* @param[in] prop_info_ptr point to property info structure -* @return Success/failure IOCtl call. -*/ -ar_result_t rs_drv_ioctl(rs_drv_handle_t rs_drv_h, rs_drv_ioctl_prop_info_t *prop_info_ptr); - -// -//async call APIs -// -/** - * The following define is for HW Interrupt triger event type - */ - -typedef enum _rs_drv_job_event_type -{ - RS_DRV_JOB_EVEN_INVALID = -1, - RS_DRV_JOB_EVEN_JOB_DONE = 1, - RS_DRV_JOB_EVEN_JOB_ERROR = 2, -} rs_drv_job_event_type; - -/** \brief HW Resampler driver callback function type */ -typedef void (*rs_drv_job_callback_func) -( - rs_drv_handle_t rs_drv_h, - /** Callback event type */ - rs_drv_job_event_type event, - /** Callback data type */ - void *cb_data_ptr -); - - -/** -* HW Resampler driver extension IOCtl property call - job event notification struct.define -*/ -typedef struct -{ - /** Event type, not used now*/ - rs_drv_job_event_type event; - /** Callback function */ - rs_drv_job_callback_func job_event_callback_func; - /** User defined context */ - void *user_ctx_ptr; -} rs_drv_ioctl_prop_job_event_notification_t; - - -/** -* This function is for getting the output data and how many input data consumed -* This API is just used for async call case -* -* @param[in] rs_drv_h - input handle. -* @param[in] in_buflist_ptr - pointer to rs_drv_buflist. -* @param[in] out_buflist_ptr - pointer to rs_drv_buflist. -* @return Success/failure of sending this frame job. -*/ -ar_result_t rs_drv_job_process_done(rs_drv_handle_t rs_drv_h, rs_drv_buflist_t* in_buflist_ptr, rs_drv_buflist_t* out_buflist_ptr); - -#endif - -#ifdef __cplusplus -} -#endif //__cplusplus - - diff --git a/modules/processing/resamplers/iir_resampler/api/iir_resampler_api.h b/modules/processing/resamplers/iir_resampler/api/iir_resampler_api.h deleted file mode 100644 index e1460e78..00000000 --- a/modules/processing/resamplers/iir_resampler/api/iir_resampler_api.h +++ /dev/null @@ -1,176 +0,0 @@ -/*========================================================================*/ -/** -@file iir_resampler_api.h - -@brief iir_resampler_api.h: This file contains the Module Id, Param IDs and configuration - structures exposed by the IIR Resampler Module. -*/ -/*======================================================================= - Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. - SPDX-License-Identifier: BSD-3-Clause-Clear -=========================================================================*/ - -#ifndef IIR_RESAMPLER_API_H -#define IIR_RESAMPLER_API_H - -/*------------------------------------------------------------------------ - * Include files - * -----------------------------------------------------------------------*/ -#include "module_cmn_api.h" - - /** - @h2xml_title1 {IIR RESAMPLER API} - @h2xml_title_agile_rev {IIR RESAMPLER API} - @h2xml_title_date {July 31, 2018} - */ - -/*============================================================================== - Constants -==============================================================================*/ -/** @ingroup ar_spf_mod_iir_resam_macros - Size of the stack for the IIR Resampler module. */ -#define IIR_RS_STACK_SIZE 1024 - -/** @ingroup ar_spf_mod_iir_resam_macros - Maximum ports for the IIR Resampler module. */ -#define IIR_RS_MAX_PORTS 1 - -/** @ingroup ar_spf_mod_iir_resam_macros - ID of the IIR RESAMPLER module. - - This module converts audio sampling rate. Uses IIR filters to do it. - Therefore it renders output with a lower Delay compared to FIR. - - @subhead4{Supported input sample rates} - - 8000 Hz - - 16000 Hz - - 24000 Hz - - 32000 Hz - - 48000 Hz - - @subhead4{Supported parameter IDs} - - #PARAM_ID_IIR_RESAMPLER_OUT_CFG @lstsp1 - - #PARAM_ID_IIR_RESAMPELR_VERSION - - @subhead4{Supported input media format ID} - - Data Format : FIXED_POINT @lstsp1 - - fmt_id : Don't care @lstsp1 - - Sample Rates : 8000, 16000, 24000, 32000, 48000 (Hz) @lstsp1 - - Number of channels : 1 to 128 (for certain products this module supports only 32 channels) @lstsp1 - - Channel type : 0 to 128 @lstsp1 - - Bits per sample : 16 @lstsp1 - - Q format : 15, 27, 31 @lstsp1 - - Interleaving : de-interleaved unpacked @lstsp1 - - Signed/unsigned : Don't care - */ -#define MODULE_ID_IIR_RESAMPLER 0x07001018 -/** - @h2xmlm_module {"MODULE_ID_IIR_RESAMPLER", - MODULE_ID_IIR_RESAMPLER} - @h2xmlm_displayName {"IIR Resampler"} - @h2xmlm_modSearchKeys{resampler, Audio, Voice} - @h2xmlm_description {ID of the IIR RESAMPLER module.\n - - -This module converts audio sampling rate. Uses IIR filters to do it. - Therefore it renders output with a lower Delay compared to FIR.\n - - Input Sample Rates Supported: 8000, 16000, 24000, 32000, 48000 (Hz) \n - - This module supports the following parameter IDs\n - - #PARAM_ID_IIR_RESAMPLER_OUT_CFG\n - - #PARAM_ID_IIR_RESAMPELR_VERSION\n - - * - Supported Input Media Format: \n - * - Data Format : FIXED_POINT \n - * - fmt_id : Don't care\n - * - Sample Rates : 8000, 16000, 24000, 32000, 48000 (Hz)\n - * - Number of channels : 1 to 128 (for certain products this module supports only 32 channels)\n - * - Channel type : 0 to 128\n - * - Bits per sample : 16\n - * - Q format : 15, 27, 31\n - * - Interleaving : de-interleaved unpacked\n - * - Signed/unsigned : Don't care} - - @h2xmlm_dataMaxInputPorts {IIR_RS_MAX_PORTS} - @h2xmlm_dataInputPorts {IN=2} - @h2xmlm_dataMaxOutputPorts {IIR_RS_MAX_PORTS} - @h2xmlm_dataOutputPorts {OUT=1} - @h2xmlm_supportedContTypes {APM_CONTAINER_TYPE_SC, APM_CONTAINER_TYPE_GC} - @h2xmlm_isOffloadable {true} - @h2xmlm_stackSize {IIR_RS_STACK_SIZE} - @h2xmlm_ToolPolicy {Calibration} - - @{ <-- Start of the Module --> -*/ -/*------------------------------------------------------------------------ - * Macros, Defines, Type declarations - * -----------------------------------------------------------------------*/ - -/** @ingroup ar_spf_mod_iir_resam_macros - Set param for sending output sample rate. - IIR Resampler will allocate channel memory and configure the algorithm - with this.*/ -#define PARAM_ID_IIR_RESAMPLER_OUT_CFG 0x08001033 -typedef struct param_id_iir_resampler_out_cfg_t param_id_iir_resampler_out_cfg_t; - -/** @h2xmlp_parameter {"PARAM_ID_IIR_RESAMPLER_OUT_CFG", PARAM_ID_IIR_RESAMPLER_OUT_CFG} - @h2xmlp_description {Specifies the output sample rate.IIR Resampler will allocate channel memory and - configure the algorithm with this.} - @h2xmlp_toolPolicy {Calibration; RTC } */ - -/** @ingroup ar_spf_mod_iir_resam_macros - Specifies the output sample rate.IIR Resampler will allocate channel memory and - configure the algorithm with this. */ - -#include "spf_begin_pack.h" -struct param_id_iir_resampler_out_cfg_t -{ - int32_t sampling_rate; - /**< Specifies the output sample rate; 0 is invalid. */ - - /**< @h2xmle_description {Specifies the output sample rate; 0 is invalid} - @h2xmle_rangeList {"PARAM_VAL_NATIVE"=-1; - "PARAM_VAL_UNSET"=-2; - "8 kHz"= 8000; - "16 kHz"=16000; - "24 kHz"=24000; - "32 kHz"=32000; - "48 kHz"=48000; - "96 kHz"=96000; - "192 kHz"=192000; - "384 kHz"=384000} - @h2xmle_default {-1} */ -} -#include "spf_end_pack.h" -; - - -/** @ingroup ar_spf_mod_iir_resam_macros - IIR Resampler module version. */ -#define PARAM_ID_IIR_RESAMPELR_VERSION 0x08001319 -typedef struct iir_resampler_lib_version_param_t iir_resampler_lib_version_param_t; - -/** @h2xmlp_parameter {"PARAM_ID_IIR_RESAMPELR_VERSION", PARAM_ID_IIR_RESAMPELR_VERSION} - @h2xmlp_description {The current version of the library is returned} - @h2xmlp_toolPolicy {RTC_READONLY} */ - -/** @ingroup ar_spf_mod_iir_resam_macros - The current version of the library is returned. */ - -#include "spf_begin_pack.h" -struct iir_resampler_lib_version_param_t -{ - uint32_t lib_version_lsb; - /**< Lower 32 bits of the 64-bit library version number. */ - - /**< @h2xmle_description {Lower 32 bits of the 64-bit library version number} */ - - uint32_t lib_version_msb; - /**< Higher 32 bits of the 64-bit library version number. */ - - /**< @h2xmle_description {Higher 32 bits of the 64-bit library version number} */ -} - -#include "spf_end_pack.h" -; - -/** @} <-- End of the Module -->*/ -#endif /* IIR_RESAMPLER_API_H */ diff --git a/modules/processing/resamplers/iir_resampler/bin/arm/libiir_resampler.a b/modules/processing/resamplers/iir_resampler/bin/arm/libiir_resampler.a deleted file mode 100644 index 84c93cdd..00000000 Binary files a/modules/processing/resamplers/iir_resampler/bin/arm/libiir_resampler.a and /dev/null differ diff --git a/modules/processing/resamplers/iir_resampler/build/CMakeLists.txt b/modules/processing/resamplers/iir_resampler/build/CMakeLists.txt deleted file mode 100644 index 47a97666..00000000 --- a/modules/processing/resamplers/iir_resampler/build/CMakeLists.txt +++ /dev/null @@ -1,30 +0,0 @@ -#[[ - @file CMakeLists.txt - - @brief - - @copyright - Copyright (c) Qualcomm Innovation Center, Inc. All rights reserved. - SPDX-License-Identifier: BSD-3-Clause-Clear -]] -cmake_minimum_required(VERSION 3.10) - -set(iir_resampler_includes - ${LIB_ROOT}/inc -) - -spf_module_sources( - KCONFIG CONFIG_IIR_RESAMPLER - NAME iir_resampler - MAJOR_VER 1 - MINOR_VER 0 - AMDB_ITYPE "capi" - AMDB_MTYPE "pp" - AMDB_MID "0x07001018" - AMDB_TAG "capi_iir_resampler" - AMDB_MOD_NAME "MODULE_ID_IIR_RESAMPLER" - INCLUDES ${iir_resampler_includes} - H2XML_HEADERS "${LIB_ROOT}/api/iir_resampler_api.h" - CFLAGS "" - STATIC_LIB_PATH "${LIB_ROOT}/bin/arm/libiir_resampler.a" -) \ No newline at end of file diff --git a/modules/processing/resamplers/iir_resampler/inc/iir_resampler.h b/modules/processing/resamplers/iir_resampler/inc/iir_resampler.h deleted file mode 100644 index 2dc23945..00000000 --- a/modules/processing/resamplers/iir_resampler/inc/iir_resampler.h +++ /dev/null @@ -1,429 +0,0 @@ -/*========================================================================= -Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. -SPDX-License-Identifier: BSD-3-Clause-Clear -========================================================================= */ -#ifndef __IIR_RESAMPER_H__ -#define __IIR_RESAMPER_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "AudioComdef.h" - -#if defined(__XTENSA__) -#include "NatureDSP_types_hifi5.h" -#include "NatureDSP_Signal_hifi5.h" -#endif - -/* KPPS numbers for various modes. These are required for evaluating the offsets in various modules */ -//DC: TBD KPI numbers to be added -#define IIR_RESAMPER_KPPS_8K_TO_16K (329 ) -#define IIR_RESAMPER_KPPS_8K_TO_24K (329 ) -#define IIR_RESAMPER_KPPS_8K_TO_32K (748 ) -#define IIR_RESAMPER_KPPS_8K_TO_48K (945 ) -#define IIR_RESAMPER_KPPS_8K_TO_96K (945 ) -#define IIR_RESAMPER_KPPS_8K_TO_192K (945 ) -#define IIR_RESAMPER_KPPS_8K_TO_384K (945 ) -#define IIR_RESAMPER_KPPS_8K_MAX (945 ) - -#define IIR_RESAMPER_KPPS_16K_TO_8K (325 ) -#define IIR_RESAMPER_KPPS_16K_TO_24K (325 ) -#define IIR_RESAMPER_KPPS_16K_TO_32K (756 ) -#define IIR_RESAMPER_KPPS_16K_TO_48K (1074) -#define IIR_RESAMPER_KPPS_16K_TO_96K (1074) -#define IIR_RESAMPER_KPPS_16K_TO_192K (1074) -#define IIR_RESAMPER_KPPS_16K_TO_384K (1074) -#define IIR_RESAMPER_KPPS_16K_MAX (1074) - -#define IIR_RESAMPER_KPPS_24K_TO_8K (325 ) -#define IIR_RESAMPER_KPPS_24K_TO_16K (325 ) -#define IIR_RESAMPER_KPPS_24K_TO_32K (756 ) -#define IIR_RESAMPER_KPPS_24K_TO_48K (1074) -#define IIR_RESAMPER_KPPS_24K_TO_96K (1074) -#define IIR_RESAMPER_KPPS_24K_TO_192K (1074) -#define IIR_RESAMPER_KPPS_24K_TO_384K (1074) -#define IIR_RESAMPER_KPPS_24K_MAX (1074) - - -#define IIR_RESAMPER_KPPS_32K_TO_8K (736 ) -#define IIR_RESAMPER_KPPS_32K_TO_16K (748 ) -#define IIR_RESAMPER_KPPS_32K_TO_24K (748 ) -#define IIR_RESAMPER_KPPS_32K_TO_48K (2445) -#define IIR_RESAMPER_KPPS_32K_TO_96K (2445) -#define IIR_RESAMPER_KPPS_32K_TO_192K (2445) -#define IIR_RESAMPER_KPPS_32K_TO_384K (2445) -#define IIR_RESAMPER_KPPS_32K_MAX (2445) - -#define IIR_RESAMPER_KPPS_48K_TO_8K (927 ) -#define IIR_RESAMPER_KPPS_48K_TO_16K (1058) -#define IIR_RESAMPER_KPPS_48K_TO_24K (1058) -#define IIR_RESAMPER_KPPS_48K_TO_32K (2437) -#define IIR_RESAMPER_KPPS_48K_TO_96K (2437) -#define IIR_RESAMPER_KPPS_48K_TO_192K (2437) -#define IIR_RESAMPER_KPPS_48K_TO_384K (2437) -#define IIR_RESAMPER_KPPS_48K_MAX (2437) - -#define IIR_RESAMPER_KPPS_96K_TO_8K (927 ) -#define IIR_RESAMPER_KPPS_96K_TO_16K (1058) -#define IIR_RESAMPER_KPPS_96K_TO_24K (1058) -#define IIR_RESAMPER_KPPS_96K_TO_32K (2437) -#define IIR_RESAMPER_KPPS_96K_TO_48K (2437) -#define IIR_RESAMPER_KPPS_96K_TO_192K (2437) -#define IIR_RESAMPER_KPPS_96K_TO_384K (2437) -#define IIR_RESAMPER_KPPS_96K_MAX (2437) - -#define IIR_RESAMPER_KPPS_192K_TO_8K (927 ) -#define IIR_RESAMPER_KPPS_192K_TO_16K (1058) -#define IIR_RESAMPER_KPPS_192K_TO_24K (1058) -#define IIR_RESAMPER_KPPS_192K_TO_32K (2437) -#define IIR_RESAMPER_KPPS_192K_TO_48K (2437) -#define IIR_RESAMPER_KPPS_192K_TO_96K (2437) -#define IIR_RESAMPER_KPPS_192K_TO_384K (2437) -#define IIR_RESAMPER_KPPS_192K_MAX (2437) - -#define IIR_RESAMPER_KPPS_384K_TO_8K (927 ) -#define IIR_RESAMPER_KPPS_384K_TO_16K (1058) -#define IIR_RESAMPER_KPPS_384K_TO_24K (1058) -#define IIR_RESAMPER_KPPS_384K_TO_32K (2437) -#define IIR_RESAMPER_KPPS_384K_TO_48K (2437) -#define IIR_RESAMPER_KPPS_384K_TO_96K (2437) -#define IIR_RESAMPER_KPPS_384K_TO_192K (2437) -#define IIR_RESAMPER_KPPS_384K_MAX (2437) - -#define RS_MAX_STAGES (10) - -#ifdef PROD_SPECIFIC_MAX_CH -#define MAX_CHANNELS PROD_SPECIFIC_MAX_CH -#else -#define MAX_CHANNELS 32 -#endif - -#define RS_PRECISION_COEFF 16 -#define IIR_RESAMPLER_MAX_STACK_SIZE 8192 - -#define IIR_RESAMPLER_RELEASE_VERSION_MSB (0x02000101) -#define IIR_RESAMPLER_RELEASE_VERSION_LSB (0x00000000) - -#define IIR_RESAMPLER_IO_CONFIG (1) // refers to iir_resampler_io_config_t in iir_resampler_api.h -#define IIR_RESAMPLER_MEM_CONFIG (2) // refers to iir_resampler_memory_config_t in iir_resampler_api.h -#define IIR_RESAMPLER_BUF_PTR_ARRAY_PTR (3) // refers to pointer to input/output data buffer pointer array -#define PARAM_ID_IIR_RESAMPLER_DELAY (4) // refers to iir_resampler_delay_config_t - - -#define IIR_RESAMPLER_MAX_INPUT_CHANNELS (1) // maximum input TX channels -#define IIR_RESAMPLER_MAX_OUTPUT_CHANNELS (1) // maximum output channels -#define IIR_RESAMPLER_MIN_INPUT_CHANNELS (1) // minimum input TX channels -#define IIR_RESAMPLER_MIN_OUTPUT_CHANNELS (1) // minimum output channels - -#ifdef PROD_SPECIFIC_MAX_CH -#define IIR_RESAMPLER_MAX_NUM_CHAN PROD_SPECIFIC_MAX_CH -#else -#define IIR_RESAMPLER_MAX_NUM_CHAN 32 -#endif - -#define IIR_RESAMPLER_SUCCESS (0) // successful result -#define IIR_RESAMPLER_FAIL (1) // failed result - -typedef uint32_t IIR_RESAMPLER_STRUCT_IDS; -typedef uint32_t IIR_RESAMPLER_RESULT; - - -typedef struct iir_resampler_config_struct_t { - uint32 input_sampling_rate; - uint32 output_sampling_rate; - uint32 input_dynamic_range; - uint32 input_frame_samples; - uint32 output_frame_samples; - uint32 filter_sampling_rate; - uint32 filter_cut_off_freq; - int32 up_sample_flag; - int32 dn_sample_flag; - uint32 up_sample_factor; - uint32 dn_sample_factor; - uint32 stages; -#if (RS_PRECISION_COEFF==32) - const int32 *f_x[RS_MAX_STAGES]; - const int32 *f_y[RS_MAX_STAGES]; -#else - const int16 *f_x[RS_MAX_STAGES]; - const int16 *f_y[RS_MAX_STAGES]; -#endif - int32 gain; - int32 q_in; - int32 q_out; - int32 q_coeff; - int32 q_g; - int32 q_x; - int32 q_y; - int32 q_accu; - uint32 single_channel_mem_size; //Memoryfor single channel - uint32 num_channels; - uint32 filter_scratch_size; // used for determining the scratch buffer size - uint32 filter_frame_samples; // number of filtering samples per frame - uint32 group_delay_samples_x1000; - int32 reserved; // used for alignment -} iir_resampler_config_struct_t; - -typedef struct iir_resampler_channel_memory_struct_t { - int32 *x_delay_ptr[RS_MAX_STAGES]; - int32 *y_delay_ptr[RS_MAX_STAGES]; - int32* filter_scratch_buf_ptr; // used for intermediate filtering stage data - int32 reserved; // used for alignment - /* Memory for the above pointers*/ -} iir_resampler_channel_memory_struct_t; - -#if defined(__XTENSA__) -typedef struct biquad_t{ - bqriir32x16_df1_handle_t bq_handle; - void *scratchmem; - int32 *y_32_out; - void *objmem; -}biquad_t; - -typedef struct iir_resampler_lib_t { - iir_resampler_config_struct_t iir_resampler_config_structure; - iir_resampler_channel_memory_struct_t *iir_resampler_channel_memory_ptr[MAX_CHANNELS]; - biquad_t biquad_instance; -}iir_resampler_lib_t; -#else -typedef struct iir_resampler_lib_t { - iir_resampler_config_struct_t iir_resampler_config_structure; - iir_resampler_channel_memory_struct_t *iir_resampler_channel_memory_ptr[MAX_CHANNELS]; -}iir_resampler_lib_t; -#endif - -/* Supported sample rates -*/ -typedef enum IIR_RESAMPLER_SAMPLE_RATE -{ - EIGHT_K = 8000, // sample rate: 8k NB - SIXTEEN_K = 16000, // sample rate: 16k WB - TWENTY_FOUR_K = 24000, // sample rate: 24k - THIRTY_TWO_K = 32000, // sample rate: 32k SWB - FOURTY_EIGHT_K = 48000, // sample rate: 48k FB - NINETY_SIX_K = 96000, // sample rate: 96k - ONE_NINETY_TWO_K = 192000, // sample rate: 192k - THREE_EIGHTY_FOUR_K = 384000 // sample rate: 384k -}IIR_RESAMPLER_SAMPLE_RATE; -//Make sure that variables are of size greater than or equal to uint_32 - - -/************************************ Structures ****************************/ -/* -iir_resampler_memory_config_t - -iir_resampler_memory_config_t is associated with IIR_RESAMPLER_MEM_CONFIG id. -This is the library structure encapsulating memory details of the library -required for creating the instance. Caller allocates this structure for -callee to fill. - -Supported for iir_resampler_get_req(...) function - -lib_instance_mem_size: [OUT]: callee fills size of library instance memory required in bytes -lib_stack_mem_size: [OUT]: callee fills size of the stack memory required by library -*/ -typedef struct iir_resampler_memory_config_t { - uint32_t lib_instance_mem_size; - uint32_t lib_stack_mem_size; - uint32_t num_in_samples; - uint32_t num_out_samples; -} iir_resampler_memory_config_t; - - - -/* -iir_resampler_io_config_t - -iir_resampler_io_config_t is the library structure encapsulating library I/O configuration - -in_channels: [IN]: input tx channels -out_channels: [IN]: output channels -in_sample_rate: [IN]: input sampling frequency -out_sample_rate: [IN]: output sampling frequency -frame_length_ms: [IN]: frame length (ms) - -*/ -typedef struct iir_resampler_io_config_t { - uint32_t in_channels; - uint32_t out_channels; - uint32_t in_sample_rate; - uint32_t out_sample_rate; - uint32_t frame_length_ms; - uint32_t bytes_per_sample; -} iir_resampler_io_config_t; - - -/* -iir_resampler_delay_config_t - -iir_resampler_delay_config_t is the library structure encapsulating group_delay_samples - -group_delay_samples: [OUT]: number of samples by which the group is delayed by - -*/ -typedef struct iir_resampler_delay_config_t { - uint32 group_delay_samples_x1000; -} iir_resampler_delay_config_t; - - -/* -iir_resampler_t - -iir_resampler_t is the library instance definition. - -IN: Memory for iir_resampler_t is used in iir_resampler_set(...),iir_resampler_get(...),iir_resampler_process(...) -OUT: Library provides pointer to iir_resampler_t in iir_resampler_init(...) -*/ -typedef int8_t iir_resampler_t; - -/************************************ Functions *****************************/ - -/* -iir_resampler_get_req - -iir_resampler_get_req, signature of the structure is fixed as shown. This api provides -the memory and other requirements (if any) of the library based on the -configuration provided. - -This function is expected to be called before init is invoked. - -req_config_id: [IN]: configuration structure ID for querying requirements, defines the payload pointed by iir_resampler_instance_memory_config_t - Supports: IIR_RESAMPLER_INSTANCE_MEM - -req_config_ptr: [IN/OUT]: requirements structure pointer in which the memory requirement that is calculated is updated and returned - -req_config_size: [IN]: size of structure pointed by req_config_ptr in which the requirements are updated - -config_id: [IN]: requirements structure ID for querying requirements, defines the payload pointed by config_ptr - Supports: IIR_RESAMPLER_IO_CONFIG - -config_ptr: [IN]: req configuration structure pointer for iir_resampler to be used by library to calculate the requirement - -config_size: [IN]: size of structure pointed by config_ptr which has the configuration details for which the memory is calculated - -Return: -result - IIR_RESAMPLER_RESULT -*/ -IIR_RESAMPLER_RESULT iir_resampler_get_req( - uint32_t req_config_id, - int8_t* req_config_ptr, - uint32_t req_config_size, - uint32_t config_id, - int8_t* config_ptr, - uint32_t config_size -); - - -/* -iir_resampler_init - -iir_resampler_init signature of the structure is fixed as shown. -This api -- Allocates static memory only to library instance -- Outputs iir_resampler's instance pointer iir_resampler_lib_ptr - -This function is expected to be called before iir_resampler_process is invoked. - -iir_resampler_lib_ptr : [OUT]: pointer to the pointer pointing to the iir_resampler library instance -req_config_id : [IN]: structure ID that defines the payload pointed by req_config_ptr -req_config_ptr : [IN]: pointer to static config for initializing the iir_resampler -req_config_size: [IN]: size of the structure pointed by config_ptr -static_mem_ptr : [IN]: pointer to the iir_resampler instance memory -static_mem_size: [IN]: size of instance memory that has been allocated for the iir_resampler - -Return: -result - IIR_RESAMPLER_RESULT -*/ -IIR_RESAMPLER_RESULT iir_resampler_init( - iir_resampler_t** iir_resampler_lib_ptr, - uint32_t req_config_id, - int8_t* req_config_ptr, - uint32_t req_config_size, - int8_t* static_mem_ptr, - uint32_t static_mem_size -); - -/* -iir_resampler_process - -iir_resampler_lib_ptr: [IN]: pointer to the iir_resampler public library structure -output_data_ptr: [OUT]: caller provides the address of output_data that needs to be filled by the library(callee) -input_data_ptr: [IN]: caller provides the address of input_data that contains the data of input channels -output_data_size: [IN]: output data structure size -input_data_size: [IN]: input data structure size -output_data_id: [IN]: structure ID associated with the output data - Supports: IIR_RESAMPLER_BUF_PTR -input_data_id: [IN]: structure ID associated with the input data - Supports: IIR_RESAMPLER_BUF_PTR -Return: -result - IIR_RESAMPLER_RESULT -*/ -IIR_RESAMPLER_RESULT iir_resampler_process( - iir_resampler_t* iir_resampler_lib_ptr, - int8_t** output_data_ptr, - int8_t** input_data_ptr, - uint32_t output_data_size, - uint32_t input_data_size, - uint32_t output_data_id, - uint32_t input_data_id -); - -/* -iir_resampler_set - -- This api sets data to the library - -iir_resampler_lib_ptr: [IN]: pointer to the iir_resampler public library structure -set_struct_id: [IN]: this structure ID defines the structure in set_struct_ptr -set_struct_ptr: [IN]: data pointer of the parameter buffer that is to be set to internal library -set_struct_size [IN]: caller fills; size of the structure pointed by set_struct_ptr; It also indicates memory in bytes that will be filled by the caller -Return: -result - IIR_RESAMPLER_RESULT -*/ -IIR_RESAMPLER_RESULT iir_resampler_set( - iir_resampler_t* iir_resampler_lib_ptr, - IIR_RESAMPLER_STRUCT_IDS set_struct_id, - int8_t* set_struct_ptr, - uint32_t set_struct_size -); - -/* -iir_resampler_get - -- This api gets data from library -- Returns data identified with get_struct_id which is filled by caller -- Callee fills data at the address pointed by get_struct_ptr -- Callee updates get_struct_filled_size - -iir_resampler_lib_ptr: [IN]: pointer to the iir_resampler public library structure -get_struct_id: [IN]: this structre ID defines the structure in get_struct_ptr - Supports: PARAM_ID_IIR_RESAMPELR_VERSION - PARAM_ID_IIR_RESAMPLER_DELAY -get_struct_ptr: [IN/OUT]: data pointer of the parameter buffer in which the values read from internal library will be stored -get_struct_size: [IN]: caller fills; get_struct_size i.e. memory in bytes available for callee to fill(note has to be properly type casted for the size) -*get_struct_filled_size:[IN/OUT]: Caller passes address; callee fills with memory in bytes read from internal library - -Return: -result - IIR_RESAMPLER_RESULT -*/ -IIR_RESAMPLER_RESULT iir_resampler_get( - iir_resampler_t* iir_resampler_lib_ptr, - IIR_RESAMPLER_STRUCT_IDS get_struct_id, - int8_t* get_struct_ptr, - uint32_t get_struct_size, - uint32_t* get_struct_filled_size -); - -/* -iir_resampler_get_upsample_factor --this api is used to get up sample factor from lib which is used to calculate bandwidth. -iir_resampler_lib_ptr: [IN]: pointer to the iir_resampler public library structure -up_sample_factor: [OUT]: uint32_t variable returns up_sample_factor -*/ -uint32_t iir_resampler_get_upsample_factor(iir_resampler_t* iir_resampler_lib_ptr); -#ifdef __cplusplus -} -#endif - -#endif//#ifndef __IIR_RESAMPER_H__ diff --git a/modules/processing/resamplers/iir_resampler/inc/iir_rs_lib.h b/modules/processing/resamplers/iir_resampler/inc/iir_rs_lib.h deleted file mode 100644 index 42b13276..00000000 --- a/modules/processing/resamplers/iir_resampler/inc/iir_rs_lib.h +++ /dev/null @@ -1,100 +0,0 @@ -/*========================================================================= -Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. -SPDX-License-Identifier: BSD-3-Clause-Clear -========================================================================= */ - -#ifndef IIR_RS_LIB_H -#define IIR_RS_LIB_H - -/*------------------------------------------------------------------------ - * Include files - * -----------------------------------------------------------------------*/ - -#ifndef CAPI_UNIT_TEST -#include "shared_lib_api.h" -#else -#include "Elite_intf_extns_change_media_fmt.h" -#include "capi.h" -#endif - -#include "posal.h" -#include "iir_resampler.h" -#include "module_cmn_api.h" - - - -#ifdef __cplusplus -extern "C" { -#endif /*__cplusplus*/ - -/*------------------------------------------------------------------------ - * Macros, Defines, Type declarations - * -----------------------------------------------------------------------*/ -//#define IIR_RS_DBG_TAP - -#define IIR_RS_8K_SAMPLING_RATE (8000) -#define IIR_RS_16K_SAMPLING_RATE (16000) -#define IIR_RS_24K_SAMPLING_RATE (24000) -#define IIR_RS_32K_SAMPLING_RATE (32000) -#define IIR_RS_48K_SAMPLING_RATE (48000) -#define IIR_RS_96K_SAMPLING_RATE (96000) -#define IIR_RS_192K_SAMPLING_RATE (192000) -#define IIR_RS_384K_SAMPLING_RATE (384000) - - -#define IIR_RS_FRAME_LEN_10_MS (10) -#define IIR_RS_FRAME_LEN_20_MS (20) -#define IIR_RS_FRAME_LEN_1_MS (1) -#define IIR_RS_FRAME_LEN_MAX_MS (IIR_RS_FRAME_LEN_20_MS + IIR_RS_FRAME_LEN_1_MS) - -#define IIR_RESAMPLER_ROUNDTO8(x) ((((uint32_t)(x) + 7) >> 3) << 3) - -// To print all lib status messages -//#define IIR_RESAMPLER_DEBUG_MSG 1 - -// Max number of ports supported by one instance of resampler CAPI -#define MAX_NUM_PORTS (1) -/*------------------------------------------------------------------------ - * Structure definitions - * -----------------------------------------------------------------------*/ -typedef struct iir_rs_lib_instance_t -{ - iir_resampler_io_config_t lib_io_config; // resampler io config - iir_resampler_memory_config_t lib_mem_config; // resampler mem config - iir_resampler_t * lib_mem_ptr; // resampler mem instance -} iir_rs_lib_instance_t; - - - -typedef struct iir_rs_lib_t -{ - uint32_t num_ports; // active port numbers - iir_rs_lib_instance_t lib_instance_per_port_ptr[MAX_NUM_PORTS]; // pointer to lib instance per port -} iir_rs_lib_t; - -/*------------------------------------------------------------------------ - * Function definitions - * -----------------------------------------------------------------------*/ -void iir_rs_lib_deinit(iir_rs_lib_t *iir_rs_ptr); - -ar_result_t iir_rs_process(iir_rs_lib_t *iir_rs_ptr, int8** input_data_ptr, int8** output_data_ptr,uint32 num_in_samples, uint32 num_out_samples); - -ar_result_t iir_rs_get_param(iir_rs_lib_t *iir_rs_ptr, uint32_t param_id, int8_t *param_data_ptr, uint32_t param_size); - -ar_result_t iir_rs_lib_clear_algo_memory(iir_rs_lib_t *iir_rs_ptr); - -ar_result_t iir_rs_lib_allocate_memory(iir_rs_lib_t * iir_rs_ptr, uint32_t inp_sampling_rate, uint32_t out_sampling_rate, - uint32_t num_channels, uint32_t bits_per_sample, uint32_t frame_length_ms, uint32_t heap_id); - -uint32_t iir_rs_lib_get_kpps(iir_rs_lib_t *iir_rs_ptr, uint32_t input_samp_rate, uint32_t output_samp_rate); - -uint32_t iir_rs_lib_get_delay(iir_rs_lib_t *iir_rs_ptr, uint32_t input_samp_rate, uint32_t output_samp_rate); - -uint32_t iir_rs_lib_get_bw(iir_rs_lib_t *iir_rs_ptr, uint32_t input_samp_rate); - - -#ifdef __cplusplus -} -#endif /*__cplusplus*/ - -#endif // iir_rs_lib_H diff --git a/modules/processing/shoebox_reverb/api/api_reverb.h b/modules/processing/shoebox_reverb/api/api_reverb.h deleted file mode 100644 index b3fdca36..00000000 --- a/modules/processing/shoebox_reverb/api/api_reverb.h +++ /dev/null @@ -1,656 +0,0 @@ -/* - * Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. - * SPDX-License-Identifier: BSD-3-Clause-Clear - */ - -#ifndef API_REVERB_H -#define API_REVERB_H -/*============================================================================== - @file api_reverb.h - @brief This file contains REVERB API -==============================================================================*/ - -/*------------------------------------------------------------------------ - * Include files - * -----------------------------------------------------------------------*/ -#include "module_cmn_api.h" -/*============================================================================== - Constants -==============================================================================*/ -#define REVERB_MAX_IN_PORTS 1 -#define REVERB_MAX_OUT_PORTS 1 -#define REVERB_STACK_SIZE 2000 - - - -#define MODULE_ID_REVERB 0x07001059 -/** - @h2xmlm_module {"MODULE_ID_REVERB", - MODULE_ID_REVERB} - @h2xmlm_displayName {"Reverb"} - @h2xmlm_modSearchKeys{effects, Audio} - @h2xmlm_description {ID of the Reverberation module.\n - - This module supports the following parameter IDs:\n - - #PARAM_ID_MODULE_ENABLE \n - - #PARAM_ID_REVERB_MODE\n - - #PARAM_ID_REVERB_PRESET\n - - #PARAM_ID_REVERB_WET_MIX\n - - #PARAM_ID_REVERB_GAIN_ADJUST\n - - #PARAM_ID_REVERB_ROOM_LEVEL\n - - #PARAM_ID_REVERB_ROOM_HF_LEVEL\n - - #PARAM_ID_REVERB_DECAY_TIME\n - - #PARAM_ID_REVERB_DECAY_HF_RATIO\n - - #PARAM_ID_REVERB_REFLECTIONS_LEVEL\n - - #PARAM_ID_REVERB_REFLECTIONS_DELAY\n - - #PARAM_ID_REVERB_LEVEL\n - - #PARAM_ID_REVERB_DELAY\n - - #PARAM_ID_REVERB_DIFFUSION\n - - #PARAM_ID_REVERB_DENSITY\n - All parameter IDs are device independent.\n - - Supported Input Media Format:\n -* - Data Format : FIXED_POINT\n -* - fmt_id : Don't care\n -* - Sample Rates : {8000,11025,16000,22050,32000,44100,48000}\n -* - Number of channels : {1 ,2 ,6 ,8}\n -* - Channel type : 1 to 63\n -* - Bits per sample : 16, 32\n -* - Q format : 15, 27\n -* - Interleaving : de-interleaved unpacked\n -* - Signed/unsigned : Signed } - - - @h2xmlm_toolPolicy {Calibration} - - - - @h2xmlm_dataMaxInputPorts {REVERB_MAX_IN_PORTS} - @h2xmlm_dataInputPorts {IN=2} - @h2xmlm_dataMaxOutputPorts {REVERB_MAX_OUT_PORTS} - @h2xmlm_dataOutputPorts {OUT=1} - @h2xmlm_supportedContTypes {APM_CONTAINER_TYPE_SC} - @h2xmlm_isOffloadable {true} - @h2xmlm_stackSize {REVERB_STACK_SIZE} - @h2xmlm_ToolPolicy {Calibration} - @{ <-- Start of the Module --> - - @h2xml_Select {"param_id_module_enable_t"} - @h2xmlm_InsertParameter -*/ -/* ID of the Reverberation Mode parameter used by MODULE_ID_REVERB. */ -#define PARAM_ID_REVERB_MODE 0x080010FD - -/* Structure for the mode parameter of Reverb module. */ -typedef struct capi_reverb_mode_t capi_reverb_mode_t; -/** @h2xmlp_parameter {"PARAM_ID_REVERB_MODE", PARAM_ID_REVERB_MODE} - @h2xmlp_description { Used only for Get Parameter calls.\n - This parameter must be initialized once when the library is created.\n - The mode cannot be changed after initialization. Hence, this parameter - ID is used only for Get Parameter calls.\n - Insert effects\n - One source is in and one source is out. The input/output channels match so - the reverberation output is a mixture of original (dry) sound and - reverberation (wet) sound. For example, applying reverberation to a music - stream.\n - Auxiliary effects\n - Multiple input sources and one global reverberation engine. Each input source makes a copy of itself - with its own (Q15) reverberation send gain applied. The copies are mixed internally inside the - reverberation library.\n - The sound sources can have different numbers of channels, and they do not need to match the - reverberation output numbers of channels.\n - After mixing all inputs, reverberation generates dense echoes (wet sound). The reverberation (wet) - output must be mixed somewhere outside the reverberation library with the direct (dry) sound. For - example, applying one global reverberation for gaming or multi-track MIDI.\n } */ - -#include "spf_begin_pack.h" -#include "spf_begin_pragma.h" - -/* Payload of the PARAM_ID_REVERB_MODE parameter used by the - Reverb module. - */ -struct capi_reverb_mode_t -{ - uint32_t reverb_mode; - /**< @h2xmle_description { Specifies the reverberation topology mode.\n - The COPP_TOPOLOGY_ID_AUDIO_PLUS_HEADPHONE and - COPP_TOPOLOGY_ID_AUDIO_PLUS_SPEAKER topologies support only - Insert Effects mode.\n - For Auxiliary Effect mode, a custom topology must be defined.\n } - - @h2xmle_rangeList {"Insert Effects mode"=0; - "Auxiliary Effects mode"=1} - @h2xmle_default {0} */ - -} - -#include "spf_end_pragma.h" -#include "spf_end_pack.h" -; - -/* ID of the Reverberation Preset parameter used by MODULE_ID_REVERB. */ -#define PARAM_ID_REVERB_PRESET 0x080010FE - -/** User-customized preset (with environmental reverberation parameters specified individually). */ -#define REVERB_PRESET_CUSTOM 0 - -/** Simulates an environment in a room. */ -#define REVERB_PRESET_ROOM 1 - -/** Simulates an environment in a bathroom. */ -#define REVERB_PRESET_BATHROOM 2 - -/** Simulates an environment in a concert hall. */ -#define REVERB_PRESET_CONCERTHALL 3 - -/** Simulates an environment in a cave. */ -#define REVERB_PRESET_CAVE 4 - -/** Simulates an environment in an arena. */ -#define REVERB_PRESET_ARENA 5 - -/** Simulates an environment in a forest. */ -#define REVERB_PRESET_FOREST 6 - -/** Simulates an environment in a city. */ -#define REVERB_PRESET_CITY 7 - -/** Simulates an environment in the mountains (open air). */ -#define REVERB_PRESET_MOUNTAINS 8 - -/** Simulates an environment under the water. */ -#define REVERB_PRESET_UNDERWATER 9 - -/** Simulates an environment in an auditorium. */ -#define REVERB_PRESET_AUDITORIUM 10 - -/** Simulates an environment in an alley. */ -#define REVERB_PRESET_ALLEY 11 - -/** Simulates an environment in a hallway. */ -#define REVERB_PRESET_HALLWAY 12 - -/** Simulates an environment in a hangar. */ -#define REVERB_PRESET_HANGAR 13 - -/** Simulates an environment in a living room. */ -#define REVERB_PRESET_LIVINGROOM 14 - -/** Simulates an environment in a small room. */ -#define REVERB_PRESET_SMALLROOM 15 - -/** Simulates an environment in a medium-sized room. */ -#define REVERB_PRESET_MEDIUMROOM 16 - -/** Simulates an environment in a large room. */ -#define REVERB_PRESET_LARGEROOM 17 - -/** Simulates an environment in a medium-sized hall. */ -#define REVERB_PRESET_MEDIUMHALL 18 - -/** Simulates an environment in a large hall. */ -#define REVERB_PRESET_LARGEHALL 19 - -/** Simulates sound being sent to a metal plate, which vibrates back and forth. - These vibrations are transformed into an audio signal. - */ - #define REVERB_PRESET_PLATE 20 - -/** Simulates a generic reverberation effect. */ -#define REVERB_PRESET_GENERIC 21 - -/** Simulates an environment in a padded cell. */ -#define REVERB_PRESET_PADDEDCELL 22 - -/** Simulates an environment in a stone room. */ -#define REVERB_PRESET_STONEROOM 23 - -/** Simulates an environment in a carpeted hallway. */ -#define REVERB_PRESET_CARPETEDHALLWAY 24 - -/** Simulates an environment in a stone corridor. */ -#define REVERB_PRESET_STONECORRIDOR 25 - -/** Simulates an environment in a quarry. */ -#define REVERB_PRESET_QUARRY 26 - -/** Simulates an environment on an open plain. */ -#define REVERB_PRESET_PLAIN 27 - -/** Simulates an environment in a parking lot. */ -#define REVERB_PRESET_PARKINGLOT 28 - -/** Simulates an environment in a sewer pipe. */ -#define REVERB_PRESET_SEWERPIPE 29 - -/** Synthetic environment preset: drugged. */ -#define REVERB_PRESET_DRUGGED 30 - -/** Synthetic environment preset: dizzy. */ -#define REVERB_PRESET_DIZZY 31 - -/** Synthetic environment preset: psychotic. */ -#define REVERB_PRESET_PSYCHOTIC 32 - - - -/* Structure for the preset parameter of Reverb module. */ -typedef struct capi_reverb_preset_t capi_reverb_preset_t; -/** @h2xmlp_parameter {"PARAM_ID_REVERB_PRESET", PARAM_ID_REVERB_PRESET} - @h2xmlp_description { Used to preset parameters for Reverb module.\n\n -User-customized preset (with environmental reverberation parameters specified individually) - REVERB_PRESET_CUSTOM\n\n -To simulates an environment in a room - REVERB_PRESET_ROOM\n\n -To simulates an environment in a bathroom - REVERB_PRESET_BATHROOM\n \n -To Simulates an environment in a concert hall -REVERB_PRESET_CONCERTHALL\n \n -To Simulates an environment in a cave - REVERB_PRESET_CAVE\n \n -To Simulates an environment in an arena - REVERB_PRESET_ARENA\n \n -To Simulates an environment in a forest - REVERB_PRESET_FOREST\n \n -To Simulates an environment in a city - REVERB_PRESET_CITY\n \n -To Simulates an environment in the mountains (open air) - REVERB_PRESET_MOUNTAINS\n \n -To Simulates an environment under the water - REVERB_PRESET_UNDERWATER\n \n -To Simulates an environment in an auditorium - REVERB_PRESET_AUDITORIUM\n\n -To Simulates an environment in an alley - REVERB_PRESET_ALLEY\n\n -To Simulates an environment in a hallway - REVERB_PRESET_HALLWAY\n\n -To Simulates an environment in a hangar - REVERB_PRESET_HANGAR\n\n -To Simulates an environment in a living room - REVERB_PRESET_LIVINGROOM\n \n -To Simulates an environment in a small room - REVERB_PRESET_SMALLROOM\n\n -To Simulates an environment in a medium-sized room - REVERB_PRESET_MEDIUMROOM\n\n -To Simulates an environment in a large room - REVERB_PRESET_LARGEROOM\n\n -To Simulates an environment in a medium-sized hall - REVERB_PRESET_MEDIUMHALL\n\n -To Simulates an environment in a large hall - REVERB_PRESET_LARGEHALL\n\n -To Simulates sound being sent to a metal plate, which vibrates back and forth(These vibrations are transformed into an audio signal) - REVERB_PRESET_PLATE\n\n -To Simulates a generic reverberation effect - REVERB_PRESET_GENERIC\n\n -To Simulates an environment in a padded cell - REVERB_PRESET_PADDEDCELL\n\n -ToSimulates an environment in a stone room - REVERB_PRESET_STONEROOM\n\n -To Simulates an environment in a carpeted hallway - REVERB_PRESET_CARPETEDHALLWAY\n\n -To Simulates an environment in a stone corridor - REVERB_PRESET_STONECORRIDOR\n\n -To Simulates an environment in a quarry - REVERB_PRESET_QUARRY\n\n -To Simulates an environment on an open plain - REVERB_PRESET_PLAIN\n\n -To Simulates an environment in a parking lot - REVERB_PRESET_PARKINGLOT\n\n -To Simulates an environment in a sewer pipe - REVERB_PRESET_SEWERPIPE \n\n -To Synthetic environment preset: drugged - REVERB_PRESET_DRUGGED \n\n -To Synthetic environment preset: dizzy - REVERB_PRESET_DIZZY\n\n -To Synthetic environment preset: psychotic - REVERB_PRESET_PSYCHOTIC\n } */ - -#include "spf_begin_pack.h" -#include "spf_begin_pragma.h" - -/* Payload of the PARAM_ID_REVERB_PRESET parameter used by the - Reverb module. - */ -struct capi_reverb_preset_t -{ - uint32_t reverb_preset; - /**< @h2xmle_description {Specifies one of the reverberation presets that create special - environmental audio effects.} - @h2xmle_range {0..32} - @h2xmle_default {REVERB_PRESET_CUSTOM} - - @h2xmle_rangeList {"CAPI_REVERB_PRESET_CUSTOM"=0; - " CAPI_REVERB_PRESET_ROOM"=1; - "CAPI_REVERB_PRESET_BATHROOM"=2; - "CAPI_REVERB_PRESET_CONCERTHALL"=3; - "CAPI_REVERB_PRESET_CAVE"=4; - "CAPI_REVERB_PRESET_ARENA"=5; - "CAPI_REVERB_PRESET_FOREST"=6; - "CAPI_REVERB_PRESET_CITY"=7; - "CAPI_REVERB_PRESET_MOUNTAINS "=8; - "CAPI_REVERB_PRESET_UNDERWATER"=9; - "CAPI_REVERB_PRESET_AUDITORIUM"=10; - "CAPI_REVERB_PRESET_ALLEY"=11; - "CAPI_REVERB_PRESET_HALLWAY"=12; - " CAPI_REVERB_PRESET_HANGAR"=13; - "CAPI_REVERB_PRESET_LIVINGROOM"=14; - "CAPI_REVERB_PRESET_SMALLROOM "=15; - "CAPI_REVERB_PRESET_MEDIUMROOM"=16; - "CAPI_REVERB_PRESET_LARGEROOM "=17; - "CAPI_REVERB_PRESET_MEDIUMHALL"=18; - " CAPI_REVERB_PRESET_LARGEHALL "=19; - "CAPI_REVERB_PRESET_PLATE"=20; - " CAPI_REVERB_PRESET_GENERIC"=21; - "CAPI_REVERB_PRESET_PADDEDCELL "=22; - "CAPI_REVERB_PRESET_STONEROOM"=23; - "CAPI_REVERB_PRESET_CARPETEDHALLWAY"=24; - "CAPI_REVERB_PRESET_STONECORRIDOR"=25; - "CAPI_REVERB_PRESET_QUARRY"=26; - "CAPI_REVERB_PRESET_PLAIN"=27; - "CAPI_REVERB_PRESET_PARKINGLOT"=28; - "CAPI_REVERB_PRESET_SEWERPIPE"=29; - "CAPI_REVERB_PRESET_DRUGGED"=30; - "CAPI_REVERB_PRESET_DIZZY"=31; - "CAPI_REVERB_PRESET_PSYCHOTIC"=32 } */ - -} -#include "spf_end_pragma.h" -#include "spf_end_pack.h" -; - - -/* ID of the Reverberation Wet Mix parameter used by CAPI_MODULE_ID_REVERB. */ -#define PARAM_ID_REVERB_WET_MIX 0x080010FF - -/* Structure for the wet mix parameter of Reverb module. */ -typedef struct capi_reverb_wet_mix_t capi_reverb_wet_mix_t; -/** @h2xmlp_parameter {"PARAM_ID_REVERB_WET_MIX", PARAM_ID_REVERB_WET_MIX} - @h2xmlp_description { Specifies the reverberation wet/dry mix ratio for Insert Effects mode} */ - -#include "spf_begin_pack.h" -#include "spf_begin_pragma.h" - -/* Payload of the PARAM_ID_REVERB_WET_MIX parameter used by the - Reverb module. - */ -struct capi_reverb_wet_mix_t -{ - uint32_t reverb_wet_mix; - /**< @h2xmle_description {Specifies the reverberation wet/dry mix ratio for Insert Effects mode.} - @h2xmle_range {0..1000} - @h2xmle_default {618} */ - -} -#include "spf_end_pragma.h" -#include "spf_end_pack.h" -; - -/* ID of the Reverberation Gain Adjust parameter used by CAPI_MODULE_ID_REVERB. */ -#define PARAM_ID_REVERB_GAIN_ADJUST 0x08001100 - -/* Structure for the gain adjust parameter of Reverb module. */ -typedef struct capi_reverb_gain_adjust_t capi_reverb_gain_adjust_t; -/** @h2xmlp_parameter {"PARAM_ID_REVERB_GAIN_ADJUST", PARAM_ID_REVERB_GAIN_ADJUST} - @h2xmlp_description { Specifies the overall gain adjustment of reverberation outputs} */ - -#include "spf_begin_pack.h" -#include "spf_begin_pragma.h" - -/* Payload of the PARAM_ID_REVERB_GAIN_ADJUST parameter used by the - Reverb module. - */ -struct capi_reverb_gain_adjust_t -{ - int32_t gain_adjust; - /**< @h2xmle_description {Specifies the overall gain adjustment of - reverberation outputs,in the units of 'millibels'.} - @h2xmle_range {-600..600} - @h2xmle_default {0} */ - -} -#include "spf_end_pragma.h" -#include "spf_end_pack.h" -; - -/* ID of the Reverberation Room Level parameter used by CAPI_MODULE_ID_REVERB. */ -#define PARAM_ID_REVERB_ROOM_LEVEL 0x08001101 - -/* Structure for the room level parameter of Reverb module. */ -typedef struct capi_reverb_room_level_t capi_reverb_room_level_t; -/** @h2xmlp_parameter {"PARAM_ID_REVERB_ROOM_LEVEL", PARAM_ID_REVERB_ROOM_LEVEL} - @h2xmlp_description { Specifies the master volume level of the environment reverberation effect} */ - -#include "spf_begin_pack.h" -#include "spf_begin_pragma.h" - -/* Payload of the PARAM_ID_REVERB_ROOM_LEVEL parameter used by the - Reverb module. - */ -struct capi_reverb_room_level_t -{ - int32_t room_level; - /**< @h2xmle_description {Specifies the master volume level of the environment reverberation - effect,in the units of 'millibels'.} - @h2xmle_range {-9600..0} - @h2xmle_default {-9600} */ - -} -#include "spf_end_pragma.h" -#include "spf_end_pack.h" -; - -/* ID of the Reverberation Room High Frequency Level parameter used by CAPI_MODULE_ID_REVERB. */ -#define PARAM_ID_REVERB_ROOM_HF_LEVEL 0x08001102 - -/* Structure for the room hf level parameter of Reverb module. */ -typedef struct capi_reverb_room_hf_level_t capi_reverb_room_hf_level_t; -/** @h2xmlp_parameter {"PARAM_ID_REVERB_ROOM_HF_LEVEL", PARAM_ID_REVERB_ROOM_HF_LEVEL} - @h2xmlp_description { Specifies the relative volume level} */ - -#include "spf_begin_pack.h" -#include "spf_begin_pragma.h" - -/* Payload of the PARAM_ID_REVERB_ROOM_HF_LEVEL parameter used by the - Reverb module. - */ -struct capi_reverb_room_hf_level_t -{ - int32_t room_hf_level; - /**< @h2xmle_description { Specifies the volume level at 5 kHz relative to the volume level at - low frequencies of the overall reverberation effect, - in the units of 'millibels'.} - @h2xmle_range {-9600..0} - @h2xmle_default {0} */ - -} -#include "spf_end_pragma.h" -#include "spf_end_pack.h" -; - -/* ID of the Reverberation Decay Time parameter used by CAPI_MODULE_ID_REVERB. */ -#define PARAM_ID_REVERB_DECAY_TIME 0x08001103 - -/* Structure for the decay time parameter of Reverb module. */ -typedef struct capi_reverb_decay_time_t capi_reverb_decay_time_t; -/** @h2xmlp_parameter {"PARAM_ID_REVERB_DECAY_TIME", PARAM_ID_REVERB_DECAY_TIME} - @h2xmlp_description { Specifies the Specifies the time for the level of reverberation} */ - -#include "spf_begin_pack.h" -#include "spf_begin_pragma.h" - -/* Payload of the PARAM_ID_REVERB_DECAY_TIME parameter used by the - Reverb module. - */ -struct capi_reverb_decay_time_t -{ - uint32_t decay_time; - /**< @h2xmle_description {Specifies the time for the level of reverberation to decay - by 60 dB,in the units of 'milliseconds'.} - @h2xmle_default {1000} - @h2xmle_range {100..20000} */ - -} -#include "spf_end_pragma.h" -#include "spf_end_pack.h" -; - -/* ID of the Reverberation Decay High Frequency Ratio parameter used by CAPI_MODULE_ID_REVERB. */ -#define PARAM_ID_REVERB_DECAY_HF_RATIO 0x08001104 - -/* Structure for the decay hf ratio parameter of Reverb module. */ -typedef struct capi_reverb_decay_hf_ratio_t capi_reverb_decay_hf_ratio_t; -/** @h2xmlp_parameter {"PARAM_ID_REVERB_DECAY_HF_RATIO", PARAM_ID_REVERB_DECAY_HF_RATIO} - @h2xmlp_description { Specifies the ratio of high frequency decay time} */ - -#include "spf_begin_pack.h" -#include "spf_begin_pragma.h" - -/* Payload of the PARAM_ID_REVERB_DECAY_HF_RATIO parameter used by the - Reverb module. - */ -struct capi_reverb_decay_hf_ratio_t -{ - uint32_t decay_hf_ratio; - /**< @h2xmle_description {Specifies the ratio of high frequency decay time (at 5 kHz) relative - to the decay time at low frequencies,in the units of 'milliseconds'.} - @h2xmle_default {500} - @h2xmle_range {150..2000} */ - -} -#include "spf_end_pragma.h" -#include "spf_end_pack.h" -; - -/*ID of the Reverberation Reflections Level parameter used by CAPI_MODULE_ID_REVERB. */ -#define PARAM_ID_REVERB_REFLECTIONS_LEVEL 0x08001105 - -/* Structure for the reverb reflections level parameter of Reverb module. */ -typedef struct capi_reverb_reflections_level_t capi_reverb_reflections_level_t; -/** @h2xmlp_parameter {"PARAM_ID_REVERB_REFLECTIONS_LEVEL",PARAM_ID_REVERB_REFLECTIONS_LEVEL} - @h2xmlp_description { Specifies the volume level of the early reflections} */ - -#include "spf_begin_pack.h" -#include "spf_begin_pragma.h" - -/* Payload of the PARAM_ID_REVERB_REFLECTIONS_LEVEL parameter used by the - Reverb module. - */ -struct capi_reverb_reflections_level_t -{ - int32_t reflections_level; - /**< @h2xmle_description {Specifies the volume level of the early reflections,in the units of 'millibels'.} - @h2xmle_range {-9600..1000} - @h2xmle_default {-9600} */ - -} -#include "spf_end_pragma.h" -#include "spf_end_pack.h" -; - - -/*ID of the Reverberation Reflections Delay parameter used by CAPI_MODULE_ID_REVERB. */ -#define PARAM_ID_REVERB_REFLECTIONS_DELAY 0x08001106 - -/* Structure for the reverb reflections delay parameter of Reverb module. */ -typedef struct capi_reverb_reflections_delay_t capi_reverb_reflections_delay_t; -/** @h2xmlp_parameter {"PARAM_ID_REVERB_REFLECTIONS_DELAY",PARAM_ID_REVERB_REFLECTIONS_DELAY} - @h2xmlp_description { Specifies the time between the first reflection and the late reverberation} */ - -#include "spf_begin_pack.h" -#include "spf_begin_pragma.h" - -/* Payload of the PARAM_ID_REVERB_REFLECTIONS_DELAY parameter used by the - Reverb module. - */ -struct capi_reverb_reflections_delay_t -{ - uint32_t reflections_delay; - /**< @h2xmle_description { Specifies the time between the first reflection and - the late reverberation,in the units of 'milliseconds'.} - @h2xmle_range {0..300} - @h2xmle_default {20} */ - -} -#include "spf_end_pragma.h" -#include "spf_end_pack.h" -; - - -/* ID of the Reverberation Level parameter used by CAPI_MODULE_ID_REVERB. */ -#define PARAM_ID_REVERB_LEVEL 0x08001107 - -/* Structure for the reverb level parameter of Reverb module. */ -typedef struct capi_reverb_level_t capi_reverb_level_t; -/** @h2xmlp_parameter {"PARAM_ID_REVERB_LEVEL",PARAM_ID_REVERB_LEVEL} - @h2xmlp_description { Specifies the volume level of the late reverberation} */ - -#include "spf_begin_pack.h" -#include "spf_begin_pragma.h" - -/* Payload of the PARAM_ID_REVERB_LEVEL parameter used by the - Reverb module. - */ -struct capi_reverb_level_t -{ - int32_t reverb_level; - /**< @h2xmle_description {Specifies the volume level of the late reverberation.} - @h2xmle_range {-9600..2000} - @h2xmle_default {-9600} */ - -} -#include "spf_end_pragma.h" -#include "spf_end_pack.h" -; - - -/*ID of the Reverberation Delay parameter used by CAPI_MODULE_ID_REVERB. */ -#define PARAM_ID_REVERB_DELAY 0x08001108 - -/* Structure for the reverb delay parameter of Reverb module. */ -typedef struct capi_reverb_delay_t capi_reverb_delay_t; -/** @h2xmlp_parameter {"PARAM_ID_REVERB_DELAY",PARAM_ID_REVERB_DELAY} - @h2xmlp_description { Specifies the time between the first reflection and the late reverberation} */ - -#include "spf_begin_pack.h" -#include "spf_begin_pragma.h" - -/* Payload of the PARAM_ID_REVERB_DELAY parameter used by the - Reverb module. - */ -struct capi_reverb_delay_t -{ - uint32_t reverb_delay; - /**< @h2xmle_description {Specifies the time between the first reflection and - the late reverberation,in the units of ' milliseconds'.} - @h2xmle_range {0..100} - @h2xmle_default {40} */ - -} -#include "spf_end_pragma.h" -#include "spf_end_pack.h" -; - - -/* ID of the Reverberation Diffusion parameter used by CAPI_MODULE_ID_REVERB. */ -#define PARAM_ID_REVERB_DIFFUSION 0x08001109 - -/* Structure for the reverb diffusion parameter of Reverb module. */ -typedef struct capi_reverb_diffusion_t capi_reverb_diffusion_t; -/** @h2xmlp_parameter {"PARAM_ID_REVERB_DIFFUSION",PARAM_ID_REVERB_DIFFUSION} - @h2xmlp_description { Specifies the echo density in the late reverberation decay} */ - -#include "spf_begin_pack.h" -#include "spf_begin_pragma.h" - -/* Payload of the PARAM_ID_REVERB_DIFFUSION parameter used by the - Reverb module. - */ -struct capi_reverb_diffusion_t -{ - uint32_t diffusion; - /**< @h2xmle_description {Specifies the echo density in the late reverberation decay.} - @h2xmle_range {0..1000} - @h2xmle_default {1000} */ - -} -#include "spf_end_pragma.h" -#include "spf_end_pack.h" -; - -/** ID of the Reverberation Density parameter used by CAPI_MODULE_ID_REVERB. */ -#define PARAM_ID_REVERB_DENSITY 0x0800110A - -/* Structure for the reverb density parameter of Reverb module. */ -typedef struct capi_reverb_density_t capi_reverb_density_t; -/** @h2xmlp_parameter {"PARAM_ID_REVERB_DENSITY",PARAM_ID_REVERB_DENSITY} - @h2xmlp_description { Specifies the modal density of the late reverberation decay} */ - -#include "spf_begin_pack.h" -#include "spf_begin_pragma.h" - -/* Payload of the PARAM_ID_REVERB_DENSITY parameter used by the - Reverb module. - */ -struct capi_reverb_density_t -{ - uint32_t density; - /**< @h2xmle_description {Specifies the modal density of the late reverberation decay} - @h2xmle_range {0..1000} - - @h2xmle_default {1000} */ - -} -#include "spf_end_pragma.h" -#include "spf_end_pack.h" -; -/** @} <-- End of the Module -->*/ - -#endif - diff --git a/modules/processing/shoebox_reverb/api/shoebox_api.h b/modules/processing/shoebox_reverb/api/shoebox_api.h deleted file mode 100644 index 040bfd54..00000000 --- a/modules/processing/shoebox_reverb/api/shoebox_api.h +++ /dev/null @@ -1,552 +0,0 @@ -/* - * Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. - * SPDX-License-Identifier: BSD-3-Clause-Clear - */ - -#ifndef API_SHOEBOX_H -#define API_SHOEBOX_H -/*============================================================================== - @file api_shoebox.h - @brief This file contains SHOEBOX API -==============================================================================*/ - -/*------------------------------------------------------------------------ - * Include files - * -----------------------------------------------------------------------*/ -#include "module_cmn_api.h" -/*============================================================================== - Constants -==============================================================================*/ - -#define SHOEBOX_MAX_IN_PORTS 1 -#define SHOEBOX_MAX_OUT_PORTS 1 -#define SHOEBOX_STACK_SIZE 2000 - - -#define MODULE_ID_SHOEBOX 0x07001058 -/** - @h2xmlm_module {"MODULE_ID_SHOEBOX", - MODULE_ID_SHOEBOX} - @h2xmlm_displayName {"Shoebox"} - @h2xmlm_modSearchKeys{effects, Audio} - - @h2xmlm_toolPolicy {Calibration} - @h2xmlm_description {Shoebox Module which reduces reverberation effects in a cubical room.\n - - This module supports the following parameter IDs: \n - - #PARAM_ID_MODULE_ENABLE \n -* - #PARAM_ID_SHOEBOX_BRIGHTNESS_ADJUST \n -* - #PARAM_ID_SHOEBOX_DECAY_TIME_ADJUST \n -* - #PARAM_ID_SHOEBOX_ROOM_MATERIAL_TIME_ADJUST \n -* - #PARAM_ID_SHOEBOX_ROOM_SIZE_TIME_ADJUST \n -* - #PARAM_ID_SHOEBOX_WET_MIX \n -* - #PARAM_ID_SHOEBOX_GAIN \n -* -* Supported Input Media Format:\n -* - Data Format : FIXED_POINT\n -* - fmt_id : Don't care\n -* - Sample Rates : {8000,16000,32000,44100,48000,96000,192000}\n -* - Number of channels : {1 ,2}\n -* - Channel type : 1 to 63\n -* - Bits per sample : 16, 32\n -* - Q format : 15, 27\n -* - Interleaving : de-interleaved unpacked\n -* - Signed/unsigned : Signed } - - @h2xmlm_dataMaxInputPorts {SHOEBOX_MAX_IN_PORTS} - @h2xmlm_dataInputPorts {IN=2} - @h2xmlm_dataMaxOutputPorts {SHOEBOX_MAX_OUT_PORTS} - @h2xmlm_dataOutputPorts {OUT=1} - @h2xmlm_supportedContTypes {APM_CONTAINER_TYPE_SC, APM_CONTAINER_TYPE_GC} - @h2xmlm_isOffloadable {true} - @h2xmlm_stackSize {SHOEBOX_STACK_SIZE} - @h2xmlm_ToolPolicy {Calibration} - @{ <-- Start of the Module --> - @h2xml_Select {"param_id_module_enable_t"} - @h2xmlm_InsertParameter - */ - -#define PARAM_ID_SHOEBOX_WET_MIX 0x0800111D - -/* Structure for the wet mix parameter of Shoebox module. */ -typedef struct shoebox_wet_mix_t shoebox_wet_mix_t; -/** @h2xmlp_parameter {"PARAM_ID_SHOEBOX_WET_MIX", PARAM_ID_SHOEBOX_WET_MIX} - @h2xmlp_description {Payload of the PARAM_ID_SHOEBOX_WET_MIX parameter used by the Shoebox module} - */ - -#include "spf_begin_pack.h" -#include "spf_begin_pragma.h" - -/* Payload of the PARAM_ID_SHOEBOX_WET_MIX parameter used by the - Shoebox module. - */ -struct shoebox_wet_mix_t -{ - uint32_t wet_mix; - /**< @h2xmle_description {Specifies the mix ratio between dry and wet sound} - @h2xmle_default {600} - @h2xmle_range {0..1000} */ -} -#include "spf_end_pragma.h" -#include "spf_end_pack.h" -; - -#define PARAM_ID_SHOEBOX_ROOM_SIZE 0x0800111E - -/* Structure for the room size parameter of Shoebox module. */ -typedef struct shoebox_room_size_t shoebox_room_size_t; -/** @h2xmlp_parameter {"PARAM_ID_SHOEBOX_ROOM_SIZE", PARAM_ID_SHOEBOX_ROOM_SIZE} - @h2xmlp_description {Payload of the PARAM_ID_SHOEBOX_ROOM_SIZE parameter used by the Shoebox module} - */ - -#include "spf_begin_pack.h" -#include "spf_begin_pragma.h" - -/* Payload of the PARAM_ID_SHOEBOX_ROOM_SIZE parameter used by the - Shoebox module. - */ -struct shoebox_room_size_t -{ - uint32_t length; - /**< @h2xmle_description {Specifies length of the room, in the units of 'meter'} - @h2xmle_default {524288} - @h2xmle_range {0..13107200} - @h2xmle_dataFormat {Q16} */ - - uint32_t width; - /**< @h2xmle_description { Specifies width of the room, in the units of 'meter'} - @h2xmle_default {327680} - @h2xmle_range {0..6553600} - @h2xmle_dataFormat {Q16} */ - - uint32_t height; - /**< @h2xmle_description { Specifies height of the room, in the units of 'meter'} - @h2xmle_default {196608} - @h2xmle_range {0..655360} - @h2xmle_dataFormat {Q16} */ -} -#include "spf_end_pragma.h" -#include "spf_end_pack.h" -; - -#define PARAM_ID_SHOEBOX_ROOM_MATERIAL 0x0800111F - -/** supported material IDs forPARAM_ID_SHOEBOX_ROOM_MATERIAL - */ - -/** To simulate the case when there is no reflection. */ -#define SHOEBOX_MATERIAL_TRANSPARENT 0 - -/** To simulate the reflection from acoustic ceiling tiles. */ -#define SHOEBOX_MATERIAL_ACOUSTIC_CEILING_TILES 1 - -/** To simulate the reflection from bare brick surface. */ -#define SHOEBOX_MATERIAL_BRICK_BARE 2 - -/** To simulate the reflection from painted brick surface. */ -#define SHOEBOX_MATERIAL_BRICK_PAINTED 3 - -/** To simulate the reflection from coarse concrete block. */ -#define SHOEBOX_MATERIAL_CONCRETE_BLOCK_COARSE 4 - -/** To simulate the reflection from painted concrete block. */ -#define SHOEBOX_MATERIAL_CONCRETE_BLOCK_PAINTED 5 - -/** To simulate the reflection from heavy curtain. */ -#define SHOEBOX_MATERIAL_CURTAIN_HEAVY 6 - -/** To simulate the reflection from fiber glass insulation. */ -#define SHOEBOX_MATERIAL_FIBER_GLASS_INSULATION 7 - -/** To simulate the reflection from thick glass */ -#define SHOEBOX_MATERIAL_GLASS_THICK 8 - -/** To simulate the reflection from thin glass. */ -#define SHOEBOX_MATERIAL_GLASS_THIN 9 - -/** To simulate the reflection from grass. */ -#define SHOEBOX_MATERIAL_GRASS 10 - -/** To simulate the reflection from linoleum on concrete. */ -#define SHOEBOX_MATERIAL_LINOLEUM_ON_CONCRETE 11 - -/** To simulate the reflection from marble. */ -#define SHOEBOX_MATERIAL_MARBLE 12 - -/** To simulate the reflection from metal. */ -#define SHOEBOX_MATERIAL_METAL 13 - -/** To simulate the reflection from parquet on concrete. */ -#define SHOEBOX_MATERIAL_PARQUET_ON_CONCRETE 14 - -/** To simulate the reflection from rough plaster. */ -#define SHOEBOX_MATERIAL_PLASTER_ROUGH 15 - -/** To simulate the reflection from smooth plaster. */ -#define SHOEBOX_MATERIAL_PLASTER_SMOOTH 16 - -/** To simulate the reflection from plywood panel. */ -#define SHOEBOX_MATERIAL_PLYWOOD_PANEL 17 - -/** To simulate the reflection from polished concrete or tile. */ -#define SHOEBOX_MATERIAL_POLISHED_CONCRETE_OR_TILE 18 - -/** To simulate the reflection from sheet rock. */ -#define SHOEBOX_MATERIAL_SHEET_ROCK 19 - -/** To simulate the reflection from water or ice surface. */ -#define SHOEBOX_MATERIAL_WATER_OR_ICE_SURFACE 20 - -/** To simulate the reflection from wood on ceiling. */ -#define SHOEBOX_MATERIAL_WOOD_ON_CEILING 21 - -/** To simulate the reflection from wood panel. */ -#define SHOEBOX_MATERIAL_WOOD_PANEL 22 - -/* Structure for the room material parameter of Shoebox module. */ -typedef struct shoebox_room_material_t shoebox_room_material_t; -/** @h2xmlp_parameter {"PARAM_ID_SHOEBOX_ROOM_MATERIAL", PARAM_ID_SHOEBOX_ROOM_MATERIAL} - @h2xmlp_description {Payload of the PARAM_ID_SHOEBOX_ROOM_MATERIAL parameter used by the - Shoebox module.\n -To simulate the case when there is no reflection - SHOEBOX_MATERIAL_TRANSPARENT\n -To simulate the reflection from acoustic ceiling tiles - SHOEBOX_MATERIAL_ACOUSTIC_CEILING_TILES\n -To simulate the reflection from bare brick surface - SHOEBOX_MATERIAL_BRICK_BARE\n -To simulate the reflection from painted brick surface - -SHOEBOX_MATERIAL_BRICK_PAINTED\n -To simulate the reflection from coarse concrete block - -SHOEBOX_MATERIAL_CONCRETE_BLOCK_COARSE\n -To simulate the reflection from painted concrete block - -SHOEBOX_MATERIAL_CONCRETE_BLOCK_PAINTED\n -To simulate the reflection from heavy curtain - -SHOEBOX_MATERIAL_CURTAIN_HEAVY\n -To simulate the reflection from fiber glass insulation - -SHOEBOX_MATERIAL_FIBER_GLASS_INSULATION\n -To simulate the reflection from thick glass - -SHOEBOX_MATERIAL_GLASS_THICK\n -To simulate the reflection from thin glass - -SHOEBOX_MATERIAL_GLASS_THIN\n -To simulate the reflection from grass - -SHOEBOX_MATERIAL_GRASS\n -To simulate the reflection from linoleum on concrete - -SHOEBOX_MATERIAL_LINOLEUM_ON_CONCRETE\n -To simulate the reflection from marble - -SHOEBOX_MATERIAL_MARBLE\n -To simulate the reflection from metal - -SHOEBOX_MATERIAL_METAL\n -To simulate the reflection from parquet on concrete - -SHOEBOX_MATERIAL_PARQUET_ON_CONCRETE\n -To simulate the reflection from rough plaster - -SHOEBOX_MATERIAL_PLASTER_ROUGH\n -To simulate the reflection from smooth plaster - -SHOEBOX_MATERIAL_PLASTER_SMOOTH\n -To simulate the reflection from plywood panel - -SHOEBOX_MATERIAL_PLYWOOD_PANEL\n -To simulate the reflection from polished concrete or tile - -SHOEBOX_MATERIAL_POLISHED_CONCRETE_OR_TILE\n -To simulate the reflection from sheet rock - -SHOEBOX_MATERIAL_SHEET_ROCK\n -To simulate the reflection from water or ice surface - -SHOEBOX_MATERIAL_WATER_OR_ICE_SURFACE\n -To simulate the reflection from wood on ceiling - -SHOEBOX_MATERIAL_WOOD_ON_CEILING\n -To simulate the reflection from wood panel - -SHOEBOX_MATERIAL_WOOD_PANEL } - - */ - -#include "spf_begin_pack.h" -#include "spf_begin_pragma.h" - -/* Payload of the PARAM_ID_SHOEBOX_ROOM_MATERIAL parameter used by the - Shoebox module. - - This parameter supports the following material IDs: - - - #SHOEBOX_MATERIAL_TRANSPARENT - - #SHOEBOX_MATERIAL_ACOUSTIC_CEILING_TILES - - #SHOEBOX_MATERIAL_BRICK_BARE - - #SHOEBOX_MATERIAL_BRICK_PAINTED - - #SHOEBOX_MATERIAL_CONCRETE_BLOCK_COARSE - - #SHOEBOX_MATERIAL_CONCRETE_BLOCK_PAINTED - - #SHOEBOX_MATERIAL_CURTAIN_HEAVY - - #SHOEBOX_MATERIAL_FIBER_GLASS_INSULATION - - #SHOEBOX_MATERIAL_GLASS_THICK - - #SHOEBOX_MATERIAL_GLASS_THIN - - #SHOEBOX_MATERIAL_GRASS - - #SHOEBOX_MATERIAL_LINOLEUM_ON_CONCRETE - - #SHOEBOX_MATERIAL_MARBLE - - #SHOEBOX_MATERIAL_METAL - - #SHOEBOX_MATERIAL_PARQUET_ON_CONCRETE - - #SHOEBOX_MATERIAL_PLASTER_ROUGH - - #SHOEBOX_MATERIAL_PLASTER_SMOOTH - - #SHOEBOX_MATERIAL_PLYWOOD_PANEL - - #SHOEBOX_MATERIAL_POLISHED_CONCRETE_OR_TILE - - #SHOEBOX_MATERIAL_SHEET_ROCK - - #SHOEBOX_MATERIAL_WATER_OR_ICE_SURFACE - - #SHOEBOX_MATERIAL_WOOD_ON_CEILING - - #SHOEBOX_MATERIAL_WOOD_PANEL - */ -struct shoebox_room_material_t -{ - uint32_t front_wall; - /**< @h2xmle_description {Specifies the material of front wall} - @h2xmle_default {SHOEBOX_MATERIAL_TRANSPARENT} - @h2xmle_rangeList {"SHOEBOX_MATERIAL_TRANSPARENT"=0; - "SHOEBOX_MATERIAL_ACOUSTIC_CEILING_TILES"=1; - "SHOEBOX_MATERIAL_BRICK_BARE"=2; - "SHOEBOX_MATERIAL_BRICK_PAINTED"=3; - "SHOEBOX_MATERIAL_CONCRETE_BLOCK_COARSE"=4; - "SHOEBOX_MATERIAL_CONCRETE_BLOCK_PAINTED"=5; - "SHOEBOX_MATERIAL_CURTAIN_HEAVY"=6; - "SHOEBOX_MATERIAL_FIBER_GLASS_INSULATION"=7; - "SHOEBOX_MATERIAL_GLASS_THICK"=8; - "SHOEBOX_MATERIAL_GLASS_THIN"=9; - "SHOEBOX_MATERIAL_GRASS"=10; - "SHOEBOX_MATERIAL_GRASS"=11; - "SHOEBOX_MATERIAL_LINOLEUM_ON_CONCRETE"=12; - "SHOEBOX_MATERIAL_MARBLE"=13; - "SHOEBOX_MATERIAL_METAL"=14; - "SHOEBOX_MATERIAL_PARQUET_ON_CONCRETE"=15; - "SHOEBOX_MATERIAL_PLASTER_ROUGH"=16; - "SHOEBOX_MATERIAL_PLASTER_SMOOTH"=17; - "SHOEBOX_MATERIAL_PLYWOOD_PANEL"=18; - "SHOEBOX_MATERIAL_POLISHED_CONCRETE_OR_TILE"=19; - "SHOEBOX_MATERIAL_SHEET_ROCK"=20; - "SHOEBOX_MATERIAL_WATER_OR_ICE_SURFACE"=21; - "SHOEBOX_MATERIAL_WOOD_ON_CEILING"=22; - "SHOEBOX_MATERIAL_WOOD_PANEL"=23 } */ - - uint32_t back_wall; - - /**< @h2xmle_description {Specifies the material of back wall} - @h2xmle_default {SHOEBOX_MATERIAL_TRANSPARENT} - @h2xmle_rangeList {"SHOEBOX_MATERIAL_TRANSPARENT"=0; - "SHOEBOX_MATERIAL_ACOUSTIC_CEILING_TILES"=1; - "SHOEBOX_MATERIAL_BRICK_BARE"=2; - "SHOEBOX_MATERIAL_BRICK_PAINTED"=3; - "SHOEBOX_MATERIAL_CONCRETE_BLOCK_COARSE"=4; - "SHOEBOX_MATERIAL_CONCRETE_BLOCK_PAINTED"=5; - "SHOEBOX_MATERIAL_CURTAIN_HEAVY"=6; - "SHOEBOX_MATERIAL_FIBER_GLASS_INSULATION"=7; - "SHOEBOX_MATERIAL_GLASS_THICK"=8; - "SHOEBOX_MATERIAL_GLASS_THIN"=9; - "SHOEBOX_MATERIAL_GRASS"=10; - "SHOEBOX_MATERIAL_GRASS"=11; - "SHOEBOX_MATERIAL_LINOLEUM_ON_CONCRETE"=12; - "SHOEBOX_MATERIAL_MARBLE"=13; - "SHOEBOX_MATERIAL_METAL"=14; - "SHOEBOX_MATERIAL_PARQUET_ON_CONCRETE"=15; - "SHOEBOX_MATERIAL_PLASTER_ROUGH"=16; - "SHOEBOX_MATERIAL_PLASTER_SMOOTH"=17; - "SHOEBOX_MATERIAL_PLYWOOD_PANEL"=18; - "SHOEBOX_MATERIAL_POLISHED_CONCRETE_OR_TILE"=19; - "SHOEBOX_MATERIAL_SHEET_ROCK"=20; - "SHOEBOX_MATERIAL_WATER_OR_ICE_SURFACE"=21; - "SHOEBOX_MATERIAL_WOOD_ON_CEILING"=22; - "SHOEBOX_MATERIAL_WOOD_PANEL"=23 }*/ - - uint32_t left_wall; - - /**< @h2xmle_description {Specifies the material of left wall} - @h2xmle_default {SHOEBOX_MATERIAL_TRANSPARENT} - @h2xmle_rangeList {"SHOEBOX_MATERIAL_TRANSPARENT"=0; - "SHOEBOX_MATERIAL_ACOUSTIC_CEILING_TILES"=1; - "SHOEBOX_MATERIAL_BRICK_BARE"=2; - "SHOEBOX_MATERIAL_BRICK_PAINTED"=3; - "SHOEBOX_MATERIAL_CONCRETE_BLOCK_COARSE"=4; - "SHOEBOX_MATERIAL_CONCRETE_BLOCK_PAINTED"=5; - "SHOEBOX_MATERIAL_CURTAIN_HEAVY"=6; - "SHOEBOX_MATERIAL_FIBER_GLASS_INSULATION"=7; - "SHOEBOX_MATERIAL_GLASS_THICK"=8; - "SHOEBOX_MATERIAL_GLASS_THIN"=9; - "SHOEBOX_MATERIAL_GRASS"=10; - "SHOEBOX_MATERIAL_GRASS"=11; - "SHOEBOX_MATERIAL_LINOLEUM_ON_CONCRETE"=12; - "SHOEBOX_MATERIAL_MARBLE"=13; - "SHOEBOX_MATERIAL_METAL"=14; - "SHOEBOX_MATERIAL_PARQUET_ON_CONCRETE"=15; - "SHOEBOX_MATERIAL_PLASTER_ROUGH"=16; - "SHOEBOX_MATERIAL_PLASTER_SMOOTH"=17; - "SHOEBOX_MATERIAL_PLYWOOD_PANEL"=18; - "SHOEBOX_MATERIAL_POLISHED_CONCRETE_OR_TILE"=19; - "SHOEBOX_MATERIAL_SHEET_ROCK"=20; - "SHOEBOX_MATERIAL_WATER_OR_ICE_SURFACE"=21; - "SHOEBOX_MATERIAL_WOOD_ON_CEILING"=22; - "SHOEBOX_MATERIAL_WOOD_PANEL"=23 }*/ - - uint32_t right_wall; - - /**< @h2xmle_description {Specifies the material of right wall} - @h2xmle_default {SHOEBOX_MATERIAL_TRANSPARENT} - @h2xmle_rangeList {"SHOEBOX_MATERIAL_TRANSPARENT"=0; - "SHOEBOX_MATERIAL_ACOUSTIC_CEILING_TILES"=1; - "SHOEBOX_MATERIAL_BRICK_BARE"=2; - "SHOEBOX_MATERIAL_BRICK_PAINTED"=3; - "SHOEBOX_MATERIAL_CONCRETE_BLOCK_COARSE"=4; - "SHOEBOX_MATERIAL_CONCRETE_BLOCK_PAINTED"=5; - "SHOEBOX_MATERIAL_CURTAIN_HEAVY"=6; - "SHOEBOX_MATERIAL_FIBER_GLASS_INSULATION"=7; - "SHOEBOX_MATERIAL_GLASS_THICK"=8; - "SHOEBOX_MATERIAL_GLASS_THIN"=9; - "SHOEBOX_MATERIAL_GRASS"=10; - "SHOEBOX_MATERIAL_GRASS"=11; - "SHOEBOX_MATERIAL_LINOLEUM_ON_CONCRETE"=12; - "SHOEBOX_MATERIAL_MARBLE"=13; - "SHOEBOX_MATERIAL_METAL"=14; - "SHOEBOX_MATERIAL_PARQUET_ON_CONCRETE"=15; - "SHOEBOX_MATERIAL_PLASTER_ROUGH"=16; - "SHOEBOX_MATERIAL_PLASTER_SMOOTH"=17; - "SHOEBOX_MATERIAL_PLYWOOD_PANEL"=18; - "SHOEBOX_MATERIAL_POLISHED_CONCRETE_OR_TILE"=19; - "SHOEBOX_MATERIAL_SHEET_ROCK"=20; - "SHOEBOX_MATERIAL_WATER_OR_ICE_SURFACE"=21; - "SHOEBOX_MATERIAL_WOOD_ON_CEILING"=22; - "SHOEBOX_MATERIAL_WOOD_PANEL"=23 }*/ - - uint32_t ceiling; - - /**< @h2xmle_description {Specifies the material of ceiling} - @h2xmle_default {SHOEBOX_MATERIAL_TRANSPARENT} - @h2xmle_rangeList {"SHOEBOX_MATERIAL_TRANSPARENT"=0; - "SHOEBOX_MATERIAL_ACOUSTIC_CEILING_TILES"=1; - "SHOEBOX_MATERIAL_BRICK_BARE"=2; - "SHOEBOX_MATERIAL_BRICK_PAINTED"=3; - "SHOEBOX_MATERIAL_CONCRETE_BLOCK_COARSE"=4; - "SHOEBOX_MATERIAL_CONCRETE_BLOCK_PAINTED"=5; - "SHOEBOX_MATERIAL_CURTAIN_HEAVY"=6; - "SHOEBOX_MATERIAL_FIBER_GLASS_INSULATION"=7; - "SHOEBOX_MATERIAL_GLASS_THICK"=8; - "SHOEBOX_MATERIAL_GLASS_THIN"=9; - "SHOEBOX_MATERIAL_GRASS"=10; - "SHOEBOX_MATERIAL_GRASS"=11; - "SHOEBOX_MATERIAL_LINOLEUM_ON_CONCRETE"=12; - "SHOEBOX_MATERIAL_MARBLE"=13; - "SHOEBOX_MATERIAL_METAL"=14; - "SHOEBOX_MATERIAL_PARQUET_ON_CONCRETE"=15; - "SHOEBOX_MATERIAL_PLASTER_ROUGH"=16; - "SHOEBOX_MATERIAL_PLASTER_SMOOTH"=17; - "SHOEBOX_MATERIAL_PLYWOOD_PANEL"=18; - "SHOEBOX_MATERIAL_POLISHED_CONCRETE_OR_TILE"=19; - "SHOEBOX_MATERIAL_SHEET_ROCK"=20; - "SHOEBOX_MATERIAL_WATER_OR_ICE_SURFACE"=21; - "SHOEBOX_MATERIAL_WOOD_ON_CEILING"=22; - "SHOEBOX_MATERIAL_WOOD_PANEL"=23 }*/ - - uint32_t floor; - - /**< @h2xmle_description {Specifies the material of floor} - @h2xmle_default {SHOEBOX_MATERIAL_TRANSPARENT} - @h2xmle_rangeList {"SHOEBOX_MATERIAL_TRANSPARENT"=0; - "SHOEBOX_MATERIAL_ACOUSTIC_CEILING_TILES"=1; - "SHOEBOX_MATERIAL_BRICK_BARE"=2; - "SHOEBOX_MATERIAL_BRICK_PAINTED"=3; - "SHOEBOX_MATERIAL_CONCRETE_BLOCK_COARSE"=4; - "SHOEBOX_MATERIAL_CONCRETE_BLOCK_PAINTED"=5; - "SHOEBOX_MATERIAL_CURTAIN_HEAVY"=6; - "SHOEBOX_MATERIAL_FIBER_GLASS_INSULATION"=7; - "SHOEBOX_MATERIAL_GLASS_THICK"=8; - "SHOEBOX_MATERIAL_GLASS_THIN"=9; - "SHOEBOX_MATERIAL_GRASS"=10; - "SHOEBOX_MATERIAL_GRASS"=11; - "SHOEBOX_MATERIAL_LINOLEUM_ON_CONCRETE"=12; - "SHOEBOX_MATERIAL_MARBLE"=13; - "SHOEBOX_MATERIAL_METAL"=14; - "SHOEBOX_MATERIAL_PARQUET_ON_CONCRETE"=15; - "SHOEBOX_MATERIAL_PLASTER_ROUGH"=16; - "SHOEBOX_MATERIAL_PLASTER_SMOOTH"=17; - "SHOEBOX_MATERIAL_PLYWOOD_PANEL"=18; - "SHOEBOX_MATERIAL_POLISHED_CONCRETE_OR_TILE"=19; - "SHOEBOX_MATERIAL_SHEET_ROCK"=20; - "SHOEBOX_MATERIAL_WATER_OR_ICE_SURFACE"=21; - "SHOEBOX_MATERIAL_WOOD_ON_CEILING"=22; - "SHOEBOX_MATERIAL_WOOD_PANEL"=23 } */ -} -#include "spf_end_pragma.h" -#include "spf_end_pack.h" -; - -#define PARAM_ID_SHOEBOX_GAIN 0x08001120 - -/* Structure for the gain parameter of Shoebox module. */ -typedef struct shoebox_gain_t shoebox_gain_t; -/** @h2xmlp_parameter {"PARAM_ID_SHOEBOX_GAIN", PARAM_ID_SHOEBOX_GAIN} - @h2xmlp_description {Payload of the PARAM_ID_SHOEBOX_GAIN parameter used by the - Shoebox module.} - */ - -#include "spf_begin_pack.h" -#include "spf_begin_pragma.h" - -/* Payload of the PARAM_ID_SHOEBOX_GAIN parameter used by the - Shoebox module. - */ -struct shoebox_gain_t -{ - uint32_t reverb_gain; - /**< @h2xmle_description {Specifies Gain adjustment to the environment reverb effect} - @h2xmle_default {65536} - @h2xmle_range {0..4294967295} - @h2xmle_dataFormat {Q16} */ -} -#include "spf_end_pragma.h" -#include "spf_end_pack.h" -; - -#define PARAM_ID_SHOEBOX_DECAY_TIME_ADJUST 0x080010FB - -/* Structure for the decay time adjust parameter of Shoebox module. */ -typedef struct shoebox_decay_time_adjust_t shoebox_decay_time_adjust_t; -/** @h2xmlp_parameter {"PARAM_ID_SHOEBOX_DECAY_TIME_ADJUST", PARAM_ID_SHOEBOX_DECAY_TIME_ADJUST} - @h2xmlp_description {Payload of the PARAM_ID_SHOEBOX_DECAY_TIME_ADJUST parameter used by the Shoebox module.} - */ -#include "spf_begin_pack.h" -#include "spf_begin_pragma.h" - -/* Payload of the PARAM_ID_SHOEBOX_DECAY_TIME_ADJUST parameter used by the - Shoebox module. - */ -struct shoebox_decay_time_adjust_t -{ - uint32_t decay_time_adjust; - /**< @h2xmle_description {Specifies Adjustment to RT60 time.} - @h2xmle_default {65536} - @h2xmle_range {0..4294967295} - @h2xmle_dataFormat {Q16} */ -} -#include "spf_end_pragma.h" -#include "spf_end_pack.h" -; - -#define PARAM_ID_SHOEBOX_BRIGHTNESS_ADJUST 0x080010FC - -/* Structure for the brightness adjust parameter of Shoebox module. */ -typedef struct shoebox_brightness_adjust_t shoebox_brightness_adjust_t; -/** @h2xmlp_parameter {"PARAM_ID_SHOEBOX_BRIGHTNESS_ADJUST", PARAM_ID_SHOEBOX_BRIGHTNESS_ADJUST} - @h2xmlp_description {Payload of the PARAM_ID_SHOEBOX_BRIGHTNESS_ADJUST parameter used by the - Shoebox module.} - */ -#include "spf_begin_pack.h" -#include "spf_begin_pragma.h" - -/* Payload of the PARAM_ID_SHOEBOX_BRIGHTNESS_ADJUST parameter used by the - Shoebox module. - */ -struct shoebox_brightness_adjust_t -{ - uint32_t brightness_adjust; - /**< @h2xmle_description {Specifies The balance between the low and high frequency components of the Shoebox - reverberation.} - @h2xmle_default {65536} - @h2xmle_range {0..4294967295} - @h2xmle_dataFormat {Q16} */ -} -#include "spf_end_pragma.h" -#include "spf_end_pack.h" -; - -/** - @h2xml_Select {lib_version_t} - @h2xmlm_InsertParameter -*/ - -/** @} <-- End of the Module -->*/ -#endif diff --git a/modules/processing/shoebox_reverb/bin/arm/libshoebox_reverb.a b/modules/processing/shoebox_reverb/bin/arm/libshoebox_reverb.a deleted file mode 100644 index c2f5e01e..00000000 Binary files a/modules/processing/shoebox_reverb/bin/arm/libshoebox_reverb.a and /dev/null differ diff --git a/modules/processing/shoebox_reverb/build/CMakeLists.txt b/modules/processing/shoebox_reverb/build/CMakeLists.txt deleted file mode 100644 index a15ed094..00000000 --- a/modules/processing/shoebox_reverb/build/CMakeLists.txt +++ /dev/null @@ -1,49 +0,0 @@ -#[[ - @file CMakeLists.txt - - @brief - - @copyright - Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. - SPDX-License-Identifier: BSD-3-Clause-Clear -]] -cmake_minimum_required(VERSION 3.10) - -set(shoebox_reverb_includes - ${LIB_ROOT}/api - ${LIB_ROOT}/inc - ${PROJECT_SOURCE_DIR}/modules/cmn/common/utils/inc -) - -spf_module_sources( - KCONFIG CONFIG_SHOEBOX - NAME shoebox - MAJOR_VER 1 - MINOR_VER 0 - AMDB_ITYPE "capi" - AMDB_MTYPE "pp" - AMDB_MID "0x07001058" - AMDB_TAG "capi_shoebox" - AMDB_MOD_NAME "MODULE_ID_SHOEBOX" - INCLUDES ${shoebox_reverb_includes} - H2XML_HEADERS "${LIB_ROOT}/api/shoebox_api.h" - CFLAGS "" - STATIC_LIB_PATH "${LIB_ROOT}/bin/arm/libshoebox_reverb.a" -) - -spf_module_sources( - KCONFIG CONFIG_REVERB - NAME reverb - MAJOR_VER 1 - MINOR_VER 0 - AMDB_ITYPE "capi" - AMDB_MTYPE "pp" - AMDB_MID "0x07001059" - AMDB_TAG "capi_shoebox" - AMDB_MOD_NAME "MODULE_ID_REVERB" - INCLUDES ${shoebox_reverb_includes} - H2XML_HEADERS "${LIB_ROOT}/api/api_reverb.h" - CFLAGS "" - STATIC_LIB_PATH "${LIB_ROOT}/bin/arm/libshoebox_reverb.a" -) - diff --git a/modules/processing/shoebox_reverb/inc/ShoeBox_calibration_api.h b/modules/processing/shoebox_reverb/inc/ShoeBox_calibration_api.h deleted file mode 100644 index 71b06df8..00000000 --- a/modules/processing/shoebox_reverb/inc/ShoeBox_calibration_api.h +++ /dev/null @@ -1,297 +0,0 @@ -/* - * Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. - * SPDX-License-Identifier: BSD-3-Clause-Clear - */ - -#ifndef SHOEBOX_CALIBRATION_API_H -#define SHOEBOX_CALIBRATION_API_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/*---------------------------------------------------------------------------- - Reverb Environment Enum -----------------------------------------------------------------------------*/ -typedef enum room_material_type { - /* Q3D_AUDIO_MATERIAL list starts */ - TRANSPARENT = 0, - ACOUSTIC_CEILING_TILES, - BRICK_BARE, - BRICK_PAINTED, - CONCRETE_BLOCK_COARSE, - CONCRETE_BLOCK_PAINTED, - CURTAIN_HEAVY, - FIBER_GLASS_INSULATION, - GLASS_THICK, - GLASS_THIN, - GRASS, - LINOLEUM_ON_CONCRETE, - MARBLE, - METAL, - PARQUET_ON_CONCRETE, - PLASTER_ROUGH, - PLASTER_SMOOTH, - PLYWOOD_PANEL, - POLISHED_CONCRETE_OR_TILE, - SHEET_ROCK, - WATER_OR_ICE_SURFACE, - WOOD_ON_CEILING, - WOOD_PANEL, - /* Q3D_AUDIO_MATERIAL list ends */ - - MATERIAL_RESERVE1, - MATERIAL_RESERVE2, -} room_material_type; - - - -/*---------------------------------------------------------------------------- - Parameters with IDs -----------------------------------------------------------------------------*/ -/* shoebox_ver_param_t - -This structure defines the parameters associated with SHOEBOX_VER_PARAM in enum algo_struct_id_t, which is in algo_api.h - -This is a Mandatory Param Structure - -Supported only for get_param(...) api - -struct_size: [IN/OUT]: --IN : Caller fills size for the size of the payload structure, expects size >= sizeof(shoebox_ver_param_t) - --OUT: Callee fills the appropriate size of the buffer filled which is sizeof(shoebox_ver_param_t) -ver: [OUT] returned version number -*/ -typedef struct shoebox_ver_param_t { - uint32_t struct_size; - uint32_t reserved; - int64_t ver; -} shoebox_ver_param_t; - - -/* shoebox_enable_param_t - -This structure defines the parameters associated with SHOEBOX_ENABLE_PARAM in enum algo_struct_id_t, which is in algo_api.h - -This is a Mandatory Param Structure - -Supported only for get/set_param(...) api - -struct_size: [IN/OUT]: --IN : Caller fills size for the size of the payload structure, expects size >= sizeof(shoebox_enable_param_t) - --OUT: Callee fills the appropriate size of the buffer filled which is sizeof(shoebox_enable_param_t) -enable: [IN/OUT] enable or disable status, range: [1:on or 0:off] - range: [0(off), 1(on) ]; - default value: 0 (off) -*/ -typedef struct shoebox_enable_param_t { - uint32_t struct_size; - uint32_t enable; -} shoebox_enable_param_t; - - -/* shoebox_wet_mix_param_t - -This structure defines the mix ratio between dry and wet sound, which is associated with SHOEBOX_WET_MIX_PARAM defined in shoebox_api.h - -Supported for set/get_param(...) api - -struct_size: [IN/OUT]: --IN : Caller fills size for the size of the payload structure in apis set_param(...) & get_param(...). expects size >= sizeof(shoebox_wet_mix_param_t) - --OUT: Callee fills the appropriate size of the buffer filled in api get_param(...),sizeof(shoebox_wet_mix_param_t) -wet_mix: [IN/OUT]: overall gain adjustment, range: [0, 1000] per millie -*/ -typedef struct shoebox_wet_mix_param_t -{ - uint32_t struct_size; - int32_t wet_mix; -} shoebox_wet_mix_param_t; - - -/* shoebox_room_size_param_t - -This structure defines the room dimension parameters, which is associated with SHOEBOX_ROOM_SIZE_PARAM defined in shoebox_api.h - -Supported for set/get_param(...) api - -struct_size: [IN/OUT]: --IN : Caller fills size for the size of the payload structure in apis set_param(...) & get_param(...). expects size >= sizeof(shoebox_room_size_param_t) - --OUT: Callee fills the appropriate size of the buffer filled in api get_param(...),sizeof(shoebox_room_size_param_t) -length: [IN/OUT]: stores the length of the room, in the unit of meter in uint32Q16 format, - range: [1 2^32-1] (equivalent range in meter is [2^-16 m, 65535m]) - default value: 524288 (equivalent value in meter is 8m) -width: [IN/OUT]: stores the width of the room, in the unit of meter in uint32Q16 format, - range: [1 2^32-1] (equivalent range in meter is [2^-16 m, 65535m]) - default value: 327680 (equivalent value in meter is 5m) -height: [IN/OUT]: stores the height of the room, in the unit of meter in uint32Q16 format, - range: [1 2^32-1] (equivalent range in meter is [2^-16 m, 65535m]) - default value: 196608 (equivalent value in meter is 3m) -*/ -typedef struct shoebox_room_size_param_t -{ - uint32_t struct_size; - uint32_t length; - uint32_t width; - uint32_t height; - -} shoebox_room_size_param_t; - - -/* shoebox_room_material_param_t - -This structure defines the room walls material parameters, which is associated with SHOEBOX_ROOM_MATERIAL_PARAM defined in shoebox_api.h - -Supported for set/get_param(...) api - -struct_size: [IN/OUT]: --IN : Caller fills size for the size of the payload structure in apis set_param(...) & get_param(...). expects size >= sizeof(shoebox_room_material_param_t) - --OUT: Callee fills the appropriate size of the buffer filled in api get_param(...),sizeof(shoebox_room_material_param_t) -front_wall: [IN/OUT]: stores the material of front wall (defined in enum room_material_type) - range: [0 25] - default value: 16 (PLASTER_SMOOTH) -back_wall: [IN/OUT]: stores the material of back wall (defined in enum room_material_type) - range: [0 25] - default value: 16 (PLASTER_SMOOTH) -left_wall: [IN/OUT]: stores the material of left wall (defined in enum room_material_type) - range: [0 25] - default value: 16 (PLASTER_SMOOTH) -right_wall: [IN/OUT]: stores the material of right wall (defined in enum room_material_type) - range: [0 25] - default value: 16 (PLASTER_SMOOTH) -ceiling: [IN/OUT]: stores the material of ceiling (defined in enum room_material_type) - range: [0 25] - default value: 15 (PLASTER_ROUGH) -floor: [IN/OUT]: stores the material of floor wall (defined in enum room_material_type) - range: [0 25] - default value: 14 (PARQUET_ON_CONCRETE) -*/ -typedef struct shoebox_room_material_param_t -{ - uint32_t struct_size; - int32_t front_wall; - int32_t back_wall; - int32_t left_wall; - int32_t right_wall; - int32_t ceiling; - int32_t floor; - -} shoebox_room_material_param_t; - - -/* shoebox_reverb_gain_param_t - -This structure defines the adjustment gain to environment reverb effect, which is associated with SHOEBOX_REVERB_GAIN_PARAM defined in shoebox_api.h -This is suppose to be mapped to DayDream's reverb gain parameter. - -Supported for set/get_param(...) api - -struct_size: [IN/OUT]: --IN : Caller fills size for the size of the payload structure in apis set_param(...) & get_param(...). expects size >= sizeof(shoebox_reverb_gain_param_t) - --OUT: Callee fills the appropriate size of the buffer filled in api get_param(...),sizeof(shoebox_reverb_gain_param_t) -room_level: [IN/OUT]: gain adjustment to the environment reverb effect, format in uint32Q16 - range: [0, 2^32-1], (equivalent floating point range is: 0.0 to (2^16-2^-16) ) - default value: 20724 (equivaluent to -10dB) -*/ -typedef struct shoebox_reverb_gain_param_t -{ - uint32_t struct_size; - uint32_t reverb_gain; -} shoebox_reverb_gain_param_t; - - -/* shoebox_decay_time_adjust_param_t - -This structure defines the adjust factor for decay time RT60 , which is associated with SHOEBOX_DECAY_TIME_ADJUST_PARAM defined in shoebox_api.h -This is supposed to be mapped to DayDream's time adjust - -Supported for set/get_param(...) api - -struct_size: [IN/OUT]: --IN : Caller fills size for the size of the payload structure in apis set_param(...) & get_param(...). expects size >= sizeof(shoebox_decay_time_adjust_param_t) - --OUT: Callee fills the appropriate size of the buffer filled in api get_param(...),sizeof(shoebox_decay_time_adjust_param_t) -decay_time_adjust: [IN/OUT]: adjustment to RT60 time, format in uint32Q16 - range: [0, 2^32-1], (equivalent floating point range is: 0.0 to (2^16-2^-16) ) - default value: 65536 (equivalent to floating point value 1.0 ) -*/ -typedef struct shoebox_decay_time_adjust_param_t -{ - uint32_t struct_size; - uint32_t decay_time_adjust; -} shoebox_decay_time_adjust_param_t; - - -/* shoebox_brightness_adjust_param_t - -This structure defines the balance between the low and high frequency components of the reverb, which is associated -with SHOEBOX_BRIGHTNESS_ADJUST_PARAM defined in shoebox_api.h. -Internally, this is mapped to tuning of shoebox_decay_hf_ratio_param_t and shoebox_room_hf_level_param_t to match with DayDream's brightness_adjust - -Supported for set/get_param(...) api - -struct_size: [IN/OUT]: --IN : Caller fills size for the size of the payload structure in apis set_param(...) & get_param(...). expects size >= sizeof(shoebox_brightness_adjust_param_t) - --OUT: Callee fills the appropriate size of the buffer filled in api get_param(...),sizeof(shoebox_brightness_adjust_param_t) -brightness_adjust: [IN/OUT]: the balance between the low and high frequency components of the reverb, format in uint32Q16 - range: [0, 2^32-1], (equivalent floating point range is: 0.0 to (2^16-2^-16) ) - default value: 65536 (equivalent to floating point value 1.0 ) -*/ -typedef struct shoebox_brightness_param_t -{ - uint32_t struct_size; - uint32_t brightness_adjust; -} shoebox_brightness_adjust_param_t; - - -/* shoebox_reset_param_t - -This structure defines the parameters associated with SHOEBOX_RESET_PARAM, in enum algo_struct_id_t, which is in algo_api.h - -algo_set can be used to reinit the library while retaining the current set of calibration parameters -Supports set_param(...) only - -struct_size: [IN]: --IN : Caller fills size for the size of the payload structure in apis set_param(...) . expects size >= sizeof(shoebox_reset_param_t) - -This parameter has no payload other than size -*/ -typedef struct shoebox_reset_param_t { - uint32_t struct_size; -} shoebox_reset_param_t; - - -/* shoebox_alg_delay_param_t - -This structure defines the algorithm delay associated with SHOEBOX_ALG_DELAY_PARAM, in enum algo_struct_id_t, which is in algo_api.h - -algo_get can be used to return the algorithm delay in Shoebox -Supports get_param(...) only - -struct_size: [IN]: IN : Caller fills size for the size of the payload structure in apis set_param(...) . expects size >= sizeof(shoebox_alg_delay_param_t) -alg_delay: [OUT]: the algorithm delay of shoebox. For v1, it always return 0 for there's no algorithm delay in dry path -*/ -typedef struct shoebox_alg_delay_param_t -{ - uint32_t struct_size; - uint32_t alg_delay; -} shoebox_alg_delay_param_t; - - -/* shoebox_crossfade_param_t - -This structure defines the crossfading flag associated with SHOEBOX_CROSSFADE_PARAM, in enum algo_struct_id_t, which is in algo_api.h -crossfading(gain panning) is executed when shoebox/reverb is enabled or disabled or cfg changed on the fly. - -algo_get can be used to return the crossfading flag in Shoebox -Supports get_param(...) only - -struct_size: [IN]: IN : Caller fills size for the size of the payload structure in apis set_param(...) . expects size >= sizeof(shoebox_crossfade_param_t) -crossfade: [OUT]: the crossfading flag returned from the library, - range: [0(no), 1(yes)] - crossfading/transition time is fixed to 100ms inside Reverb. No configurable through API. - -*/ -typedef struct shoebox_crossfade_param_t -{ - uint32_t struct_size; - uint32_t crossfade; -} shoebox_crossfade_param_t; - - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* SHOEBOX_CALIBRATION_API_H */ diff --git a/modules/processing/shoebox_reverb/inc/capi_shoebox.h b/modules/processing/shoebox_reverb/inc/capi_shoebox.h deleted file mode 100644 index 7b3c8590..00000000 --- a/modules/processing/shoebox_reverb/inc/capi_shoebox.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. - * SPDX-License-Identifier: BSD-3-Clause-Clear - */ - -/** - * @file capi_shoebox.h - * - * Header file to implement the Audio Post Processor Interface for - * Shoebox module - */ - -#ifndef CAPI_SHOEBOX_H -#define CAPI_SHOEBOX_H - -#include "capi.h" -#include "ar_defs.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Get static properties of shoebox module such as - * memory, stack requirements etc. - * See Elite_CAPI.h for more details. - */ -capi_err_t capi_shoebox_get_static_properties(capi_proplist_t *init_set_properties, - capi_proplist_t *static_properties); - -/** - * Instantiates(and allocates) the module memory. - * See Elite_CAPI.h for more details. - */ -capi_err_t capi_shoebox_init(capi_t *_pif, capi_proplist_t *init_set_properties); - -/** - * Get static properties of reverb module such as - * memory, stack requirements etc. - * See Elite_CAPI.h for more details. - */ -capi_err_t capi_reverb_get_static_properties(capi_proplist_t *init_set_properties, - capi_proplist_t *static_properties); - -/** - * Instantiates(and allocates) the module memory. - * See Elite_CAPI.h for more details. - */ -capi_err_t capi_reverb_init(capi_t *_pif, capi_proplist_t *init_set_properties); - -#ifdef __cplusplus -} -#endif - -#endif /* CAPI_SHOEBOX_H */ diff --git a/modules/processing/shoebox_reverb/inc/reverb_api.h b/modules/processing/shoebox_reverb/inc/reverb_api.h deleted file mode 100644 index a97be569..00000000 --- a/modules/processing/shoebox_reverb/inc/reverb_api.h +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. - * SPDX-License-Identifier: BSD-3-Clause-Clear - */ - -#ifndef REVERB_API_H -#define REVERB_API_H - -#include "reverb_calibration_api.h" -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/*---------------------------------------------------------------------------- - Library Version -----------------------------------------------------------------------------*/ -#define REVERB_LIB_VER (0x02000004) // lib version : 2.0.4 - // (major.minor.bug) (8.16.8 bits) - -/*---------------------------------------------------------------------------- - Error Code and Types -----------------------------------------------------------------------------*/ -typedef enum REVERB_RESULT { - REVERB_SUCCESS = 0, - REVERB_FAILURE, - REVERB_MEMERROR, - REVERB_UNSUPPORTED_PARAM, -} REVERB_RESULT; - -typedef enum reverb_mode_t { // ** reverb topology mode - INSERT_EFFECT = 0, // insert: cascaded with others - AUX_EFFECT // aux: parallel with others -} reverb_mode_t; - -/*---------------------------------------------------------------------------- - Topology: Reverb operates in two modes - - 1. INSERT_EFFECT: One source in and one out, input/output channels match - so that reverb output is a mixture of original (dry) sound and reverb - (wet) sound. e.g. applying reverb to a music stream. - - |--------| - source (dry) --> | reverb | --> mixed output (dry + wet) - |--------| - - in this mode, reverb is applied by calling reverb_process function. - - 2. AUX_EFFECT: Multiple input sources and one global reverb engine. Each - input source makes a copy of itself, with its own (Q15) reverb send gain - applied, then mixed internally inside the reverb lib. The sound sources - can have different channel numbers, and don't need to match the reverb - output channel number. After mixing all inputs, reverb generates dense - echos (wet sound), and the reverb (wet) output needs to be mixed - somewhere outside the reverb library with the direct (dry) sound. - e.g. applying one global reverb for gaming or multi-track MIDI. - - source1 -.----------->|------------| |-------| - source2 -|-.--------->| dry path |---->| mixer |--> mixed output - ... | | | processing | |-------| - sourceN -|-|-.------->|------------| ^ - | | | | - | | \-gainN->|------------| | - | \---gain2->| reverb |---------/ - \-----gain1->|------------| (wet sound only) - - in this mode, reverb is applied by calling reverb_process_aux_input - multiple times when mixing each input source, then - reverb_process_aux_output is called one time after all the - sources are done with mixing for the current block of samples. -----------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------- - Channel Numbers: - - Reverb only works with input/output channels with specific orders defined - below: - 1: mono [C] - 2: stereo [L, R] - 6: 5.1 channel [L, R, C, LFE, Ls, Rs] - 8: 7.1 channel [L, R, C, LFE, Ls, Rs, Lbk, Rbk] - other non-standard channel numbers or channel orders should be properly - converted by wrapper before using reverb library. -----------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------- - Static Types and Lib Mems -----------------------------------------------------------------------------*/ - -typedef struct reverb_static_vars_t { // ** static params - int32 data_width; // 16 (Q15 PCM) or 32 (Q27 PCM) - int32 sample_rate; // sampling rate - int32 max_block_size; // max block size - int32 num_chs; // num of output channels - reverb_mode_t mode; // insert or aux effect -} reverb_static_vars_t; - -typedef struct reverb_mem_req_t { // ** memory requirements - uint32 mem_size; // lib mem size (lib_mem_ptr ->) - uint32 stack_size; // stack mem size -} reverb_mem_req_t; - -typedef struct reverb_lib_t { // ** library struct - void* mem_ptr; // mem pointer -} reverb_lib_t; - -/*----------------------------------------------------------------------------- - Function Declarations -----------------------------------------------------------------------------*/ - -// ** Mix one input source into aux mode reverb's internal buffers -// Description: The caller should supply input source channel number and -// reverb send gain (Q15) that comes with this input source. This function -// can be called one time for each input source and one frame -// lib_ptr: [out] pointer to library structure -// in_ptr: [in] pointer to input sample block (multi channel double ptr) -// in_chs: [in] input source channel number [1, 2, 6, 8] -// send_gain: [in] reverb send gain for this audio source (Q15) -// samples: [in] number of samples to be processed per channel -REVERB_RESULT reverb_process_aux_input(reverb_lib_t *lib_ptr, void **in_ptr, int32 in_chs, int16 send_gain, uint32 samples); - -// ** Processing one block of aux mode reverb output -// Description: before calling this function, the internal input mix buffer -// should have accumulated samples from all the input sources who wants to -// have themselves reverberated. This function will process from this buffer -// and produce output. This function is only called once per frame. -// lib_ptr: [in] pointer to library structure -// out_ptr: [out] pointer to output sample block (multi channel double ptr) -// samples: [in] number of samples to be processed per channel -REVERB_RESULT reverb_process_aux_output(reverb_lib_t *lib_ptr, void **out_ptr, uint32 samples); - -// ** Processing one block of insert type reverb -// lib_ptr: [in] pointer to library structure -// out_ptr: [out] pointer to output sample block (multi channel double ptr) -// in_ptr: [in] pointer to input sample block (multi channel double ptr) -// samples: [in] number of samples to be processed per channel -REVERB_RESULT reverb_process(reverb_lib_t *lib_ptr, void **out_ptr, void **in_ptr, uint32 samples); - - -// ** Get library memory requirements -// mem_req_ptr: [out] pointer to mem requirements structure -// static_vars_ptr: [in] pointer to static variable structure -REVERB_RESULT reverb_get_mem_req(reverb_mem_req_t *mem_req_ptr, reverb_static_vars_t* static_vars_ptr); - -// ** Partition, initialize memory, and set default values -// lib_ptr: [in, out] pointer to library structure -// static_vars_ptr: [in] pointer to static variable structure -// mem_ptr: [in] pointer to allocated memory -// mem_size: [in] size of memory allocated -REVERB_RESULT reverb_init_mem(reverb_lib_t *lib_ptr, reverb_static_vars_t* static_vars_ptr, void* mem_ptr, uint32 mem_size); - -// ** Set parameters to library -// lib_ptr: [in, out] pointer to lib structure -// param_id: [in] parameter id -// param_ptr: [in] pointer to the memory where the new values are stored -// param_size:[in] size of the memory pointed by param_ptr -REVERB_RESULT reverb_set_param(reverb_lib_t* lib_ptr, uint32 param_id, void* param_ptr, uint32 param_size); - -// ** Get parameters from library -// lib_ptr: [in] pointer to library structure -// param_id: [in] parameter id -// param_ptr: [out] pointer to the memory where the retrieved value is going to be stored -// param_size:[in] size of the memory pointed by param_ptr -// param_actual_size_ptr: [out] pointer to memory that will hold the actual size of the parameter -REVERB_RESULT reverb_get_param(reverb_lib_t* lib_ptr, uint32 param_id, void* param_ptr, uint32 param_size, uint32 *param_actual_size_ptr); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* REVERB_API_H */ diff --git a/modules/processing/shoebox_reverb/inc/reverb_calibration_api.h b/modules/processing/shoebox_reverb/inc/reverb_calibration_api.h deleted file mode 100644 index 74973f3d..00000000 --- a/modules/processing/shoebox_reverb/inc/reverb_calibration_api.h +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. - * SPDX-License-Identifier: BSD-3-Clause-Clear - */ - -#ifndef REVERB_CALIBRATION_API_H -#define REVERB_CALIBRATION_API_H - -#include "AudioComdef.h" - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/*---------------------------------------------------------------------------- - Reverb Environment Enum -----------------------------------------------------------------------------*/ - -typedef enum environment_t { - environment_Custom = 0, // custom preset - environment_Room = 1, // 01 - environment_Bathroom, // 02 - environment_ConcertHall, // 03 - environment_Cave, // 04 - environment_Arena, // 05 - environment_Forest, // 06 - environment_City, // 07 - environment_Mountains, // 08 - environment_Underwater, // 09 - environment_Auditorium, // 10 - environment_Alley, // 11 - environment_Hallway, // 12 - environment_Hangar, // 13 - environment_Livingroom, // 14 - environment_Smallroom, // 15 - environment_Mediumroom, // 16 - environment_Largeroom, // 17 - environment_Mediumhall, // 18 - environment_Largehall, // 19 - environment_Plate, // 20 - environment_Generic, // 21 - environment_PaddedCell, // 22 - environment_Stoneroom, // 23 - environment_CarpetedHallway, // 24 - environment_StoneCorridor, // 25 - environment_Quarry, // 26 - environment_Plain, // 27 - environment_ParkingLot, // 28 - environment_SewerPipe, // 29 - environment_Drugged, // 30 - environment_Dizzy, // 31 - environment_Psychotic, // 32 - environment_Count -} environment_t; - -/*---------------------------------------------------------------------------- - Parameters with IDs -----------------------------------------------------------------------------*/ -#define REVERB_PARAM_LIB_VER (0) // ** param: library version -typedef int32 reverb_version_t; // access: get only - -/*------------------ begin OpenSL ES compatible parameters ------------------*/ -// Description: The master volume level of the environment reverb effect -#define REVERB_PARAM_ROOM_LEVEL (1) // ** param: room level -typedef int32 reverb_room_level_t; // access: get & set - // range: [-9600, 0] (mb) - -// Description: The volume level at 5kHz relative to the volume level at low -// frequencies of the overall reverb effect -#define REVERB_PARAM_ROOM_HF_LEVEL (2) // ** param: room HF level -typedef int32 reverb_room_hf_level_t; // access: get & set - // range: [-9600, 0] (mb) - -// Description: The time taken for the level of reverberation to decay by 60 dB -#define REVERB_PARAM_DECAY_TIME (3) // ** param: decay time RT60 -typedef int32 reverb_decay_time_t; // access: get & set - // range: [100, 20000] (ms) - -// Description: The ratio of high frequency decay time (at 5kHz) relative to -// the decay time at low frequencies -#define REVERB_PARAM_DECAY_HF_RATIO (4) // ** param: decay HF ratio -typedef int32 reverb_decay_hf_ratio_t; // access: get & set - // range: [100, 2000] (per millie) - -// Description: The volume level of the early reflections -#define REVERB_PARAM_REFLECTIONS_LEVEL (5) // ** param: reflections level -typedef int32 reverb_reflections_level_t; // access: get & set - // range: [-9600, 1000] (mb) - -// Description: The delay time for the early reflection (relative to direct sound) -#define REVERB_PARAM_REFLECTIONS_DELAY (6) // ** param: reflections delay -typedef int32 reverb_reflections_delay_t; // access: get & set - // range: [0, 300] (ms) - -// Description: The volume level of the late reverberation -#define REVERB_PARAM_REVERB_LEVEL (7) // ** param: reverb level -typedef int32 reverb_reverb_level_t; // access: get & set - // range: [-9600, 2000] (mb) - -// Description: The time between the first reflection and the late reverberation -#define REVERB_PARAM_REVERB_DELAY (8) // ** param: reverb delay -typedef int32 reverb_reverb_delay_t; // access: get & set - // range: [0, 100] (ms) - -// Description: The echo density in the late reverberation decay -#define REVERB_PARAM_DIFFUSION (9) // ** param: diffusion -typedef int32 reverb_diffusion_t; // access: get & set - // range: [0, 1000] (per millie) - -// Description: The modal density of the late reverberation decay -#define REVERB_PARAM_DENSITY (10) // ** param: density -typedef int32 reverb_density_t; // access: get & set - // range: [0, 1000] (per millie) - -/*------------------- end OpenSL ES compatible parameters -------------------*/ - -#define REVERB_PARAM_ENABLE (11) // ** param: enable switch -typedef int32 reverb_enable_t; // access: get & set - // range: [1:on or 0:off] - -#define REVERB_PARAM_MODE (12) // ** param: topology mode -// typedef enum reverb_mode_t; // access: get only - -#define REVERB_PARAM_PRESET (13) // ** param: reverb preset -typedef int32 reverb_preset_t; // access: get & set - // range: [0, 32] - -// Description: reverb dry/wet mix for insert mode only. no effect on aux mode -#define REVERB_PARAM_WET_MIX (14) // ** param: wet mix ratio -typedef int32 reverb_wet_mix_t; // access: get & set - // range: [0, 1000] (per millie) - -#define REVERB_PARAM_GAIN_ADJUST (15) // ** param: overall gain adjustment -typedef int32 reverb_gain_adjust_t; // access: get & set -// (may cause saturation) // range : [-600, 600] (mB) - -#define REVERB_PARAM_RESET (16) // ** param: reset - // access: set only - -#define REVERB_PARAM_ALG_DELAY (17) // ** param: algorithm delay -typedef int32 reverb_alg_delay_t; // access: get only - -#define REVERB_PARAM_CROSSFADE_FLAG (18) // ** param: transition/crossfade flag -typedef int32 reverb_crossfade_t; // access: get only - // range: [0(no), 1(yes)] - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* REVERB_CALIBRATION_API_H */ diff --git a/modules/processing/shoebox_reverb/inc/reverbglobal.h b/modules/processing/shoebox_reverb/inc/reverbglobal.h deleted file mode 100644 index a569e7be..00000000 --- a/modules/processing/shoebox_reverb/inc/reverbglobal.h +++ /dev/null @@ -1,339 +0,0 @@ -/* - * Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. - * SPDX-License-Identifier: BSD-3-Clause-Clear - */ - -#ifndef _REVERBGLOBAL_H_ -#define _REVERBGLOBAL_H_ - - -#include "audio_dsp.h" - -#define BIT_EXACT_WITH_QSOUND 0 // to match QSound or not -#define REVERB_HARDCODE_DELAYS 0 // load comb and all-pass delays from table -#define REVERB_LP_POST_BIQUAD 0 // low-power reverb post filter - -typedef struct _reverbConfig -{ - uint16 uinChannels; - uint16 uiSampleRate; - uint16 uOutChannels; - int enable; - int lowpowerFlag; - int envPreset; - int envReverbLevelMB; - int envReverbTimeMs; - int envDecayHFRatioQ16; - int envPreDelayMs; - int reverbSendGainMB; -} reverbConfig; - -class CReverbLib { - typedef struct _combFilter - { /* comb filter with a delay line and a damping(decayHFratio) filter */ - /* first-order IIR damping filter: */ - /* c0+c1*z**-1 */ - /* ----------- */ - /* 1-c2*z**-1 */ - int16 dampCoeffsL16Q14[3]; /* filter coeffs: c0, c1, and c2-1 */ - int16 dampStateXL16; /* state: x(n-1) L16 */ - int32 dampStateYL32; /* state: y(n-1) L32 */ - int16 delayIndex; /* delayline index */ - int16 delayLength; /* delayline length */ - int16 *delayBuf; /* pointer to delayline buffer */ - } combFilter; - - typedef struct _allpassFilter - { /* all-pass filter with a delay line */ - int16 gainL16Q15; /* all-pass gain, L16Q15 */ - int16 delayIndex; /* delayline index */ - int16 delayLength; /* delayline length */ - int16 *delayBuf; /* pointer to delayline buffer */ - } allpassFilter; - - typedef struct _revWrap - { /* parameters wrapped to pass to the main processing block */ - /*-------------------- local copy of main config params -----------------*/ - boolean enable; /* enable or bypass reverb process */ - boolean lowpowerFlag; /* use or not the low-power version */ - int16 envPreset; /* environment preset number */ - int16 envReverbLevelMB; /* reverb level ("reverb" in preset) */ - int16 envReverbTimeMs; /* reverb decay time */ - int32 envDecayHFRatioQ16; /* reverb decay HF ratio */ - int16 envPreDelayMs; /* reverb pre delay */ - int16 reverbSendGainMB; /* reverb send amount from one source*/ - - /*------------------------------- others --------------------------------*/ - int16 inChannels; /* input channel number */ - int16 outChannels; /* output channel number */ - uint16 sampleRate; /* sampling rate */ - int16 reverbSendGainL16Q15;/* reverb send amount in L16Q15 */ - int16 reverbVolumeL16Q15; /* late reverb level + normalization */ - delaylineStruct *preDelayline; /* reverb delay struct of wet signal */ - combFilter *combs; /* comb filter struct array */ - allpassFilter *allpass; /* all-pass filter struct array */ - } revWrap; -#ifdef LP_REVERB - typedef struct _revLpWrap - { /* parameters wrapped to pass to the low-power processing block */ - int16 inChannels; /* input channel number */ - int16 outChannels; /* output channel number */ - uint16 sampleRate; /* sampling Rate */ - int16 reverbSendGainMB; /* reverb send amount in mb */ - int16 reverbSendGainL16Q15; /* reverb send amount in L16Q15 */ - int16 reverbVolumeL16Q15; /* late reverb level + normalization */ - delaylineStruct *preDelayline; /* reverb delay struct of wet signal */ - combFilter *combs; /* comb filter struct array */ - allpassFilter *allpass; /* all-pass filter struct array */ - } revLpWrap; -#endif - typedef enum - { /* environment types */ - environment_Room = 1, // 01 - environment_Bathroom, // 02 - environment_ConcertHall, // 03 - environment_Cave, // 04 - environment_Arena, // 05 - environment_Forest, // 06 - environment_City, // 07 - environment_Mountains, // 08 - environment_Underwater, // 09 - environment_Auditorium, // 10 - environment_Alley, // 11 - environment_Hallway, // 12 - environment_Hangar, // 13 - environment_Livingroom, // 14 - environment_Smallroom, // 15 - environment_Mediumroom, // 16 - environment_Largeroom, // 17 - environment_Mediumhall, // 18 - environment_Largehall, // 19 - environment_Plate, // 20 - environment_Generic, // 21 - environment_PaddedCell, // 22 - environment_Stoneroom, // 23 - environment_CarpetedHallway, // 24 - environment_StoneCorridor, // 25 - environment_Quarry, // 26 - environment_Plain, // 27 - environment_ParkingLot, // 28 - environment_SewerPipe, // 29 - /*----- the last three are not fully implemented yet -----*/ - environment_Drugged, // 30 - environment_Dizzy, // 31 - environment_Psychotic, // 32 - environment_Count - } environment; - - typedef struct _eaxListenerProperties - { /* selected elements following standard of EAX 2.0 listener properties */ - int16 room; // room input attenuation (mB) - int16 decayTime; // reverb time RT60 (ms) - int32 decayHFRatio; // high/low freq decay time ratio, L32Q23 - int16 reflections; // early echo level (mB),(not implemented) - int16 reflectionsDelay; // early echo delay (ms) - int16 reverb; // late reverb level (mB) - int16 reverbDelay; // late reverb delay (ms) - } eaxListenerProperties; -#ifdef LP_REVERB - typedef struct _reverbLpPreloadParams - { - int16 comb0CoeffsL16Q14[2]; /* damp coeffs c0 and c2-1 (c1==0) */ - int16 comb1CoeffsL16Q14[2]; /* damp coeffs c0 and c2-1 (c1==0) */ - int16 comb2CoeffsL16Q14[2]; /* damp coeffs c0 and c2-1 (c1==0) */ - int16 combDelays[3]; /* comb delayline lengths */ - int16 allpassDelays[2]; /* allpass delayline lengths */ - int16 preDelay; /* initial reverb delay */ - } reverbLpPreloadParams; -#endif -private: - static const uint16 REVERB_BLOCKSIZE = 480; // blocksize - static const uint16 COMBS = 6; /* number of comb filters per channel */ - static const uint16 ALLPASS = 2; /* number of all-pass filters per channel */ - /* reverb time is defined as RT60 - the time that reverb sound drops 60 dB */ - static const int16 DECAY_CENTS = -6000; - /* cutoff frequencies for designing filters */ - static const uint16 LowpassDesignFrequency = 5000; - static const uint16 HighpassDesignFrequency = 100; - static const uint16 COMBS_LP = 3; /* 3 comb filters for low-power QReverb */ - static const uint16 ALLPASS_LP = 2; /* 2 all pass filters for low-power QReverb */ - - /* comb filter and allpass filter delay lines in milliseconds */ - static const int16 combDelays[COMBS]; // ms - static const int16 allpassDelays[ALLPASS]; // ms - - /* Following standard of EAX 2.0 listener property sets */ - /* I3DL2 and MIDI compatible reverb types, merged into one list */ - static const eaxListenerProperties reverbPresets[environment_Count - 1]; - - static const int32 sampleRates[7]; - static const int16 storedDelays[7][COMBS+ALLPASS]; -#ifdef LP_REVERB - static const reverbLpPreloadParams storedLpParams[7]; -#endif -private: - /* various delayline buffers */ - int16 revInputDlyBufL[2352]; // 400ms, 48kHz - int16 revInputDlyBufR[5424]; // 464ms, 48kHz - int16 revCombDlyBuf0[2*2401]; // 50ms, 48kHz - int16 revCombDlyBuf1[2*2689]; // 56ms, 48kHz - int16 revCombDlyBuf2[2*2929]; // 61ms, 48kHz - int16 revCombDlyBuf3[2*3265]; // 68ms, 48kHz - int16 revCombDlyBuf4[2*3457]; // 72ms, 48kHz - int16 revCombDlyBuf5[2*3747]; // 78ms, 48kHz - int16 revAllpassDlyBuf0[2*289]; // 6ms, 48kHz - int16 revAllpassDlyBuf1[2*529]; // 11ms, 48kHz - - /* filter and delayline structs */ - combFilter revCombs[2*COMBS]; /* comb filter struct array */ - allpassFilter revAllpass[2*ALLPASS]; /* all-pass filter struct array */ - delaylineStruct revPreDelayline[2]; /* reverb input delayline */ - revWrap revShared; /* parameter wrapper struct */ -#ifdef LP_REVERB - /* various delayline buffers */ - int16 revInputDlyBufLp[240]; /* 5 ms, 48kHz */ - int16 revCombDlyBuf0Lp[1467]; /* 30.555 6ms, 48kHz */ - int16 revCombDlyBuf1Lp[1595]; /* 33.1774 ms, 48kHz */ - int16 revCombDlyBuf2Lp[1699]; /* 35.3810 ms, 48kHz */ - int16 revAllpassDlyBuf0Lp[289]; /* 6 ms, 48kHz */ - int16 revAllpassDlyBuf1Lp[529]; /* 11 ms, 48kHz */ - - /* others */ - combFilter revLpCombs[COMBS_LP]; /* comb filters */ - allpassFilter revLpAllpass[ALLPASS_LP]; /* all-pass filters */ - delaylineStruct revLpPreDelayline; /* reverb input delayline */ - revLpWrap revLpShared; -#endif -private: - void reverb_init(); - - void reverb_preload_delays - ( - int16 *delays, /* comb and allpass filter delays */ - uint16 sampleRate /* sampling rate */ - ); - - void apply_allpass_filter - ( - int16 *destBuf, /* input(output) buffer */ - allpassFilter *allpass, /* all-pass filter struct */ - int16 samples /* number of sampels to process */ - ); - - void apply_comb_filter - ( - int16 *destBuf, /* output buffer to mix into */ - int16 *srcBuf, /* input buffer of comb filter */ - combFilter *comb, /* comb filter struct */ - int16 n, /* number of samples */ - int16 reverbVolumeL16Q15 /* reverb volume */ -#if BIT_EXACT_WITH_QSOUND - ,boolean firstCombFlag /* The firstCombFlag is a flag to match */ - /* QSound code. QSound does something different for the first comb filter*/ - /* in the parallel structure. This is only to match bit-exact. A working */ - /* algorithm does not need this. */ -#endif - ); - - void mix_parallel_combs - ( - int16 channel, /* channel index, 0:left or 1:right */ - int16 *destBuf, /* output buffer */ - int16 *srcBuf, /* input buffer */ - combFilter *combs, /* comb filter struct array */ - int16 n, /* number of samples to be processed */ - int16 reverbVolumeL16Q15,/* reverb volume */ - int16 num_combs /* number of comb filters in parallel */ - ); - - void reverb_delay_then_combs - ( - int16 channel, /* channel index, 0:left or 1:right */ - int16 *combMixBuf, /* output buffer of mixed comb outputs */ - int16 *srcBuf, /* reverb input buffer */ - delaylineStruct *preDelayline, /* late reverb delayline struct */ - combFilter *combs, /* comb filter struct array */ - int16 reverbVolumeL16Q15,/* reverb volume */ - int16 num_combs, /* number of comb filters */ - int16 samples /* number of sampels to process */ - ); - - void reverb_preproc_mix - ( - int16 *revInBufL, /* reverb input buffer (left ) */ - int16 *revInBufR, /* reverb input buffer (right) */ - int16 *srcBufL, /* direct sound input buffer (left ) */ - int16 *srcBufR, /* direct sound input buffer (right) */ - revWrap revShared, /* parameter wrapper struct */ - int16 samples /* number of sampels to process */ - ); - - void reverb_process_mono_out - ( - int16 *mixBuf, /* direct sound and final mix */ - int16 *revInBuf, /* reverb input buffer */ - revWrap revShared, /* parameter wrapper struct */ - int16 samples /* number of sampels to process */ - ); - - void reverb_process_stereo_out - ( - int16 *mixBufL, /* direct sound and reverb mix */ - int16 *mixBufR, /* direct sound and reverb mix */ - int16 *revInBufL, /* reverb input buffer */ - int16 *revInBufR, /* reverb input buffer */ - revWrap revShared, /* parameter wrapper struct */ - int16 samples /* number of sampels to process */ - ); - - void reverb_update_filter_delays - ( - uint16 sampleRate /* sampling rate */ - ); - void reverb_update_predelay - ( - uint16 sampleRate /* sampling rate */ - ); - void reverb_update_room_filters - ( - uint16 sampleRate /* sampling rate */ - ); -#ifdef LP_REVERB - boolean reverb_setup_lp - ( - const reverbConfig &cfg - ); - - boolean reverb_reset_lp(void); - - reverbLpPreloadParams reverb_lp_preload - ( - uint16 sampleRate - ); - - void process_lp - ( - int16 *srcBufL, /* reverb input buffer */ - int16 *srcBufR, /* reverb input buffer */ - int16 *mixBufL, /* direct sound and reverb mix */ - int16 *mixBufR, /* direct sound and reverb mix */ - uint32 samples /* number of sampels to process */ - ); -#endif -public: - CReverbLib(); - - boolean initialize (const reverbConfig &cfg); - - void Reset(); - - void process - ( - int16 *outBufL, /* output buffer L */ - int16 *outBufR, /* output buffer R */ - int16 *srcBufL, /* input buffer L */ - int16 *srcBufR, /* input buffer R */ - uint32 nSampleCnt=REVERB_BLOCKSIZE - ); -}; -#endif /* _REVERBGLOBAL_H_ */ diff --git a/modules/processing/shoebox_reverb/inc/shoebox_lib_api.h b/modules/processing/shoebox_reverb/inc/shoebox_lib_api.h deleted file mode 100644 index f4d72152..00000000 --- a/modules/processing/shoebox_reverb/inc/shoebox_lib_api.h +++ /dev/null @@ -1,382 +0,0 @@ -/* - * Copyright (c) Qualcomm Innovation Center, Inc. All Rights Reserved. - * SPDX-License-Identifier: BSD-3-Clause-Clear - */ - -#ifndef SHOEBOX_API_H -#define SHOEBOX_API_H - -#include "ShoeBox_calibration_api.h" -#include "AudioComdef.h" -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - - -/*---------------------------------------------------------------------------- - Error Code and Types -----------------------------------------------------------------------------*/ -typedef enum SHOEBOX_RESULT { - SHOEBOX_SUCCESS = 0, - SHOEBOX_FAILURE, - SHOEBOX_MEMERROR, - SHOEBOX_UNSUPPORTED_PARAM, - SHOEBOX_UNSUPPORTED_PARAM_VALUE, //new return value added for the cases when input size/parameter value is out of algorithm supported boundary. - //Inside algorithm, the values will be bounded to the max that the algorithm supports -} SHOEBOX_RESULT; - - -/* -shoebox_struct_id_t - -shoebox_struct_id_t is Mandatory. Some of the struct_ids are mandatory as mentioned. - -shoebox_struct_id_t enum typedef refers to structures that can be used to communicate with library functions. -Along with refering to structures in algo_api.h. This enum also refers to the calibration structures in algo_calibration_api.h - -Note: enum numbers doesn't have to be sequential. -*/ -typedef enum shoebox_struct_id_t { - SHOEBOX_CONFIG = 0, // mapped to struct: shoebox_config_t - SHOEBOX_MEMORY, // mapped to struct: shoebox_memory_config_t - SHOEBOX_VERSION_PARAM, // mapped to struct: shoebox_ver_param_t - SHOEBOX_ENABLE_PARAM, // mapped to struct: shoebox_enable_param_t - SHOEBOX_WET_MIX_PARAM, // mapped to struct: shoebox_wet_mix_param_t - - /* tuning parameters that are mapped to DayDream's */ - SHOEBOX_ROOM_SIZE_PARAM, // mapped to struct: shoebox_room_size_param_t - SHOEBOX_ROOM_MATERIAL_PARAM, // mapped to struct: shoebox_room_material_param_t - SHOEBOX_REVERB_GAIN_PARAM, // mapped to struct: shoebox_reverb_gain_param_t - SHOEBOX_DECAY_TIME_ADJUST_PARAM,// mapped to struct: shoebox_decay_time_adjust_param_t - SHOEBOX_BRIGHTNESS_ADJUST_PARAM,// mapped to struct: shoebox_brightness_adjust_param_t - - SHOEBOX_RESET_PARAM, // mapped to struct: shoebox_reset_param_t - SHOEBOX_ALG_DELAY_PARAM, // mapped to struct: shoebox_alg_delay_param_t - SHOEBOX_CROSSFADE_FLAG_PARAM // mapped to struct: shoebox_crossflag_param_t -} shoebox_struct_id_t; - - -/* -shoebox_memory_t - -shoebox_memory_config_t is the library structure encapsulating memory details of the library. -Memory for this structure has to be allocated by Caller before calling any of the library apis - -Note: each structure definition should have a specific id in shoebox_struct_id_t (SHOEBOX_MEMORY in this case) - -struct_size: [IN]: Filled by the caller, shows the size of the structure -lib_static_mem_size: [IN/OUT]: Size of library static memory required in bytes, this memory - --[OUT]: Callee fills for api shoebox_get_req, --[IN]: Caller fills for api shoebox_init -lib_stack_size: [OUT]: Size of the stack needed by library. [out]: for api shoebox_get_req, Don't care for api ashoebox_init - -*/ -typedef struct shoebox_memory_t { - uint32_t struct_size; - uint32_t lib_static_mem_size; - uint32_t lib_scratch_mem_size; - uint32_t lib_stack_mem_size; -} shoebox_memory_t; - - -/* -shoebox_config_t - -shoebox__config_t is the library structure encapsulating library configurations -which donot change with calibration or without memory reallocation - -shoebox_config_t is a Mandatory Structure Definition. Members of this structure are not mandatory -but recommended for every algorithm; however not limited by the following fields,i.e. algorithms can add new parameters as needed. - -Moreoever, more than one static config can be defined to differentate the evolution of parameters or fit the specific needs of the algorithm. -Note: each structure definition should have a specific id in shoebox_struct_id_t - -struct_size:[IN]: Mandatory : Filled by the caller, shows the size of the structure -sample_rate:[IN]: Input/outputs operating sampling rate. -q_format:[IN]: Q-factor for input/output data: 15 for 16bit input and 27 for 32bit input -bytes_per_sample:[IN] : Number of bytes for input and output bytes. 16 (Q15 PCM) or 32 (Q27 PCM) -num_chs:[IN] : Number of input/output channels, -max_frame_size:[IN]: : max frame size -*/ -typedef struct shoebox_config_t { // ** static params - uint32_t struct_size; - uint32_t sample_rate; // supporting 8k/16k/32k/44.1k/48k/96k/192kHz - uint32_t q_format; // 15 (16bit path) or 27 (32bit processing with 24bit path) supported currently - uint32_t bytes_per_sample; // 2 or 4 (for 24bit path, shoebox always takes L32Q27 format input) - uint32_t num_chs; // In first release v1, only stereo in/stereo out supported - uint32_t max_frame_size; -} shoebox_config_t; - - -/* -shoebox_t - -shoebox_t is the library instance definition. -shoebox_t is Mandatory Definition -*/ -typedef int8_t shoebox_t; - - -/*----------------------------------------------------------------------------- - Function Declarations -----------------------------------------------------------------------------*/ - -/* shoebox_get_req -This api provides the memory and other requirements of the library based on the configuration provided - -This function is expected to be called before shoebox_init is invoked. -req_config_id: [IN] : Requirements Structure ID for querying memory requirements, defines the payload pointed by req_config_ptr - Supports : SHOEBOX_MEMORY, (algorithms can add more shoebox_struct_id_t as the needs grow), -req_config_ptr: [OUT] : Requirements Structure pointer for engine to be filled by library -config_id: [IN] : Configuration Structure ID for querying engine requirements, defines the payload pointed by engine_config_ptr - Currently only supports : SHOEBOX_CONFIG (static structure) -config_ptr: [IN] : Configuration Structure pointer for engine to be used by library to calculate requirements - For SHOEBOX_CONFIG, this pointer points to the structure containing the static structure for memory size estimate - -Return: -result - SHOEBOX_RESULT -*/ -SHOEBOX_RESULT shoebox_get_req( - uint32_t req_config_id, - int8_t *req_config_ptr, - uint32_t config_id, - int8_t *config_ptr -); - - -/* shoebox_init - -shoebox_init signature of the structure is fixed as shown. -This api -- Allocates static memory only to library & -- partition the memory properly -- Initializes calibration to default values - -This function is expected to be called before shoebox_process is invoked. -**shoebox_lib_ptr: [OUT] : pointer to the algo public library structure -config_id: [IN] : Configuration Structure ID for querying engine requirements, defines the payload pointed by engine_config_ptr - Supports : SHOEBOX_CONFIG -config_ptr: [IN] : Configuration Structure pointer for engine to be used by library to calculate requirements -static_memory_ptr: [IN] : Pointer to static memory for initializing the engine -static_memory_size: [IN] : size of the static memory pointer by pointer engine_static_memory_ptr - -Return: -result - SHOEBOX_RESULT -*/ -SHOEBOX_RESULT shoebox_init( - shoebox_t **shoebox_lib_ptr, - uint32_t config_id, - int8_t *config_ptr, - int8_t *static_memory_ptr, - uint32_t static_memory_size -); - - -/* -shoebox_set -- Sets data to the library - -shoebox_lib_ptr: [IN] : pointer to the algo public library structure -set_struct_id: [IN] : this strucutre ID defines the structure in set_struct_ptr -set_struct_ptr: [IN] : data pointer & struct_size of the memory or parameter buffer - -Return: -result - SHOEBOX_RESULT - */ -SHOEBOX_RESULT shoebox_set( - shoebox_t *shoebox_lib_ptr, - uint32_t set_struct_id, - int8_t *set_struct_ptr -); - - -/* -shoebox_get -- This api gets data from library -- Returns data identified with get_data.struct_id which is filled by Callee -- Callee fills data at the address pointed by get_data.io_ptr -- Callee updates get_data.io_ptr.struct_size (note io_ptr has to be properly type casted for the struct_size) -example structures/data queried by Caller - - Calibration data - - RTM - - Algorithm Version - -*shoebox_lib_ptr: [IN] : pointer to the algo public library structure -index: [IN] : index value, ranges from 0 to max_inputs-1, defines the input from which the data has to be "get" -get_struct_id: [IN] : this strucutre ID defines the structure in get_struct_ptr -get_struct_ptr: [IN/OUT] : data pointer & struct_size of the parameter buffer - Caller fills: [IN] : get_struct_ptr->struct_size i.e. memory in bytes available for callee to fill(note has to be properly type casted for the size) - Callee fills: [OUT] : get_struct_ptr->struct_size i.e. memory in bytes filled by callee and the rest of the fields of the structure as needed - -Return: -result - SHOEBOX_RESULT -*/ -SHOEBOX_RESULT shoebox_get( - shoebox_t *shoebox_lib_ptr, - uint32_t get_struct_id, - int8_t *get_struct_ptr -); - -/* -Reads input data and processes it according to the calibration data set using shoebox_set -This function can only be invoked after successful call to shoebox_init & after setting scratch memory as required - -*shoebox_lib_ptr: [IN] : pointer to the algo public library structure -**output_data_ptr: [OUT] : This pointer points to the output data address that the library needs to fill. -output_data_size: [IN] : This parameter gives the per-channel output data frame's size in terms of number of samples. Set by the caller. -**input_data_ptr: [IN] : This pointer points to the actual input data address that the caller provides, assuming they are de-interleaved. -input_data_size: [IN] : This parameter gives the per-channel input data frame's size in terms of number of samples. Set by the caller. - -Return: -result - SHOEBOX_RESULT -*/ -SHOEBOX_RESULT shoebox_process( - shoebox_t *shoebox_lib_ptr, - int8_t **output_data_ptr, // always assuming de-interleaved output - uint32_t output_data_size, - int8_t **input_data_ptr, // always assuming de-interleaved input - uint32_t input_data_size -); - - -int8_t* get_reverb_lib_ptr( shoebox_t* lib_ptr ); - - -/*---------------------------------------------------------------------------- - Reverb Environment Enum ----------------------------------------------------------------------------- -typedef enum environment_t { - environment_Custom = 0, // custom preset - environment_Room = 1, // 01 - environment_Bathroom, // 02 - environment_ConcertHall, // 03 - environment_Cave, // 04 - environment_Arena, // 05 - environment_Forest, // 06 - environment_City, // 07 - environment_Mountains, // 08 - environment_Underwater, // 09 - environment_Auditorium, // 10 - environment_Alley, // 11 - environment_Hallway, // 12 - environment_Hangar, // 13 - environment_Livingroom, // 14 - environment_Smallroom, // 15 - environment_Mediumroom, // 16 - environment_Largeroom, // 17 - environment_Mediumhall, // 18 - environment_Largehall, // 19 - environment_Plate, // 20 - environment_Generic, // 21 - environment_PaddedCell, // 22 - environment_Stoneroom, // 23 - environment_CarpetedHallway, // 24 - environment_StoneCorridor, // 25 - environment_Quarry, // 26 - environment_Plain, // 27 - environment_ParkingLot, // 28 - environment_SewerPipe, // 29 - environment_Drugged, // 30 - environment_Dizzy, // 31 - environment_Psychotic, // 32 - environment_Count -} environment_t; -*/ -/*---------------------------------------------------------------------------- - Parameters with IDs -----------------------------------------------------------------------------*/ -#define REVERB_PARAM_LIB_VER (0) // ** param: library version -typedef int32 reverb_version_t; // access: get only - -/*------------------ begin OpenSL ES compatible parameters ------------------*/ -// Description: The master volume level of the environment reverb effect -#define REVERB_PARAM_ROOM_LEVEL (1) // ** param: room level -typedef int32 reverb_room_level_t; // access: get & set - // range: [-9600, 0] (mb) - -// Description: The volume level at 5kHz relative to the volume level at low -// frequencies of the overall reverb effect -#define REVERB_PARAM_ROOM_HF_LEVEL (2) // ** param: room HF level -typedef int32 reverb_room_hf_level_t; // access: get & set - // range: [-9600, 0] (mb) - -// Description: The time taken for the level of reverberation to decay by 60 dB -#define REVERB_PARAM_DECAY_TIME (3) // ** param: decay time RT60 -typedef int32 reverb_decay_time_t; // access: get & set - // range: [100, 20000] (ms) - -// Description: The ratio of high frequency decay time (at 5kHz) relative to -// the decay time at low frequencies -#define REVERB_PARAM_DECAY_HF_RATIO (4) // ** param: decay HF ratio -typedef int32 reverb_decay_hf_ratio_t; // access: get & set - // range: [100, 2000] (per millie) - -// Description: The volume level of the early reflections -#define REVERB_PARAM_REFLECTIONS_LEVEL (5) // ** param: reflections level -typedef int32 reverb_reflections_level_t; // access: get & set - // range: [-9600, 1000] (mb) - -// Description: The delay time for the early reflection (relative to direct sound) -#define REVERB_PARAM_REFLECTIONS_DELAY (6) // ** param: reflections delay -typedef int32 reverb_reflections_delay_t; // access: get & set - // range: [0, 300] (ms) - -// Description: The volume level of the late reverberation -#define REVERB_PARAM_REVERB_LEVEL (7) // ** param: reverb level -typedef int32 reverb_reverb_level_t; // access: get & set - // range: [-9600, 2000] (mb) - -// Description: The time between the first reflection and the late reverberation -#define REVERB_PARAM_REVERB_DELAY (8) // ** param: reverb delay -typedef int32 reverb_reverb_delay_t; // access: get & set - // range: [0, 100] (ms) - -// Description: The echo density in the late reverberation decay -#define REVERB_PARAM_DIFFUSION (9) // ** param: diffusion -typedef int32 reverb_diffusion_t; // access: get & set - // range: [0, 1000] (per millie) - -// Description: The modal density of the late reverberation decay -#define REVERB_PARAM_DENSITY (10) // ** param: density -typedef int32 reverb_density_t; // access: get & set - // range: [0, 1000] (per millie) - -/*------------------- end OpenSL ES compatible parameters -------------------*/ - -#define REVERB_PARAM_ENABLE (11) // ** param: enable switch -typedef int32 reverb_enable_t; // access: get & set - // range: [1:on or 0:off] - -#define REVERB_PARAM_MODE (12) // ** param: topology mode -// typedef enum reverb_mode_t; // access: get only - -#define REVERB_PARAM_PRESET (13) // ** param: reverb preset -typedef int32 reverb_preset_t; // access: get & set - // range: [0, 32] - -// Description: reverb dry/wet mix for insert mode only. no effect on aux mode -#define REVERB_PARAM_WET_MIX (14) // ** param: wet mix ratio -typedef int32 reverb_wet_mix_t; // access: get & set - // range: [0, 1000] (per millie) - -#define REVERB_PARAM_GAIN_ADJUST (15) // ** param: overall gain adjustment -typedef int32 reverb_gain_adjust_t; // access: get & set -// (may cause saturation) // range : [-600, 600] (mB) - -#define REVERB_PARAM_RESET (16) // ** param: reset - // access: set only - -#define REVERB_PARAM_ALG_DELAY (17) // ** param: algorithm delay -typedef int32 reverb_alg_delay_t; // access: get only - -#define REVERB_PARAM_CROSSFADE_FLAG (18) // ** param: transition/crossfade flag -typedef int32 reverb_crossfade_t; // access: get only - // range: [0(no), 1(yes)] - - - - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* SHOEBOX_API_H */