First submission of audio effect library from NXP software.
This CL contains the first open sourceable version of the audio effect library from NXP software. The effects implemented are: - Bass boost - Virtualizer (stereo widening) - Equalizer - Spectrum analyzer Source file for the effect engines are located under libeffects/lvm/lib The wrapper implementing the interface with the audio effect framework in under libeffects/lvm/wrapper The code of other effect libraries has also been reorganized fo clarity: - the effect factory is now under libeffects/factory - the test equalizer and reverb effects are under libeffect/testlibs - the visualizer is under libeffects/virtualizer Change-Id: I8d91e2181f81b89f8fc0c1e1e6bf552c5809b2eb
This commit is contained in:
25
media/libeffects/factory/Android.mk
Normal file
25
media/libeffects/factory/Android.mk
Normal file
@ -0,0 +1,25 @@
|
||||
LOCAL_PATH:= $(call my-dir)
|
||||
|
||||
# Effect factory library
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_SRC_FILES:= \
|
||||
EffectsFactory.c
|
||||
|
||||
LOCAL_SHARED_LIBRARIES := \
|
||||
libcutils
|
||||
|
||||
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)
|
||||
LOCAL_MODULE:= libeffects
|
||||
|
||||
ifeq ($(TARGET_OS)-$(TARGET_SIMULATOR),linux-true)
|
||||
LOCAL_LDLIBS += -ldl
|
||||
endif
|
||||
|
||||
ifneq ($(TARGET_SIMULATOR),true)
|
||||
LOCAL_SHARED_LIBRARIES += libdl
|
||||
endif
|
||||
|
||||
LOCAL_C_INCLUDES := \
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
124
media/libeffects/lvm/lib/Android.mk
Normal file
124
media/libeffects/lvm/lib/Android.mk
Normal file
@ -0,0 +1,124 @@
|
||||
LOCAL_PATH:= $(call my-dir)
|
||||
|
||||
# Music bundle
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_ARM_MODE := arm
|
||||
|
||||
LOCAL_SRC_FILES:= \
|
||||
StereoWidening/src/LVCS_BypassMix.c \
|
||||
StereoWidening/src/LVCS_Control.c \
|
||||
StereoWidening/src/LVCS_Equaliser.c \
|
||||
StereoWidening/src/LVCS_Init.c \
|
||||
StereoWidening/src/LVCS_Process.c \
|
||||
StereoWidening/src/LVCS_ReverbGenerator.c \
|
||||
StereoWidening/src/LVCS_StereoEnhancer.c \
|
||||
StereoWidening/src/LVCS_Tables.c \
|
||||
Bass/src/LVDBE_Control.c \
|
||||
Bass/src/LVDBE_Init.c \
|
||||
Bass/src/LVDBE_Process.c \
|
||||
Bass/src/LVDBE_Tables.c \
|
||||
Bundle/src/LVM_API_Specials.c \
|
||||
Bundle/src/LVM_Buffers.c \
|
||||
Bundle/src/LVM_Init.c \
|
||||
Bundle/src/LVM_Process.c \
|
||||
Bundle/src/LVM_Tables.c \
|
||||
Bundle/src/LVM_Control.c \
|
||||
SpectrumAnalyzer/src/LVPSA_Control.c \
|
||||
SpectrumAnalyzer/src/LVPSA_Init.c \
|
||||
SpectrumAnalyzer/src/LVPSA_Memory.c \
|
||||
SpectrumAnalyzer/src/LVPSA_Process.c \
|
||||
SpectrumAnalyzer/src/LVPSA_QPD_Init.c \
|
||||
SpectrumAnalyzer/src/LVPSA_QPD_Process.c \
|
||||
SpectrumAnalyzer/src/LVPSA_Tables.c \
|
||||
Eq/src/LVEQNB_CalcCoef.c \
|
||||
Eq/src/LVEQNB_Control.c \
|
||||
Eq/src/LVEQNB_Init.c \
|
||||
Eq/src/LVEQNB_Process.c \
|
||||
Eq/src/LVEQNB_Tables.c \
|
||||
Common/src/InstAlloc.c \
|
||||
Common/src/DC_2I_D16_TRC_WRA_01.c \
|
||||
Common/src/DC_2I_D16_TRC_WRA_01_Init.c \
|
||||
Common/src/FO_2I_D16F32C15_LShx_TRC_WRA_01.c \
|
||||
Common/src/FO_2I_D16F32Css_LShx_TRC_WRA_01_Init.c \
|
||||
Common/src/FO_1I_D16F16C15_TRC_WRA_01.c \
|
||||
Common/src/FO_1I_D16F16Css_TRC_WRA_01_Init.c \
|
||||
Common/src/BP_1I_D16F32C30_TRC_WRA_01.c \
|
||||
Common/src/BP_1I_D16F16C14_TRC_WRA_01.c \
|
||||
Common/src/BP_1I_D32F32C30_TRC_WRA_02.c \
|
||||
Common/src/BP_1I_D16F16Css_TRC_WRA_01_Init.c \
|
||||
Common/src/BP_1I_D16F32Cll_TRC_WRA_01_Init.c \
|
||||
Common/src/BP_1I_D32F32Cll_TRC_WRA_02_Init.c \
|
||||
Common/src/BQ_2I_D32F32Cll_TRC_WRA_01_Init.c \
|
||||
Common/src/BQ_2I_D32F32C30_TRC_WRA_01.c \
|
||||
Common/src/BQ_2I_D16F32C15_TRC_WRA_01.c \
|
||||
Common/src/BQ_2I_D16F32C14_TRC_WRA_01.c \
|
||||
Common/src/BQ_2I_D16F32C13_TRC_WRA_01.c \
|
||||
Common/src/BQ_2I_D16F32Css_TRC_WRA_01_init.c \
|
||||
Common/src/BQ_2I_D16F16C15_TRC_WRA_01.c \
|
||||
Common/src/BQ_2I_D16F16C14_TRC_WRA_01.c \
|
||||
Common/src/BQ_2I_D16F16Css_TRC_WRA_01_Init.c \
|
||||
Common/src/BQ_1I_D16F16C15_TRC_WRA_01.c \
|
||||
Common/src/BQ_1I_D16F16Css_TRC_WRA_01_Init.c \
|
||||
Common/src/BQ_1I_D16F32C14_TRC_WRA_01.c \
|
||||
Common/src/BQ_1I_D16F32Css_TRC_WRA_01_init.c \
|
||||
Common/src/PK_2I_D32F32C30G11_TRC_WRA_01.c \
|
||||
Common/src/PK_2I_D32F32C14G11_TRC_WRA_01.c \
|
||||
Common/src/PK_2I_D32F32CssGss_TRC_WRA_01_Init.c \
|
||||
Common/src/PK_2I_D32F32CllGss_TRC_WRA_01_Init.c \
|
||||
Common/src/Int16LShiftToInt32_16x32.c \
|
||||
Common/src/From2iToMono_16.c \
|
||||
Common/src/Copy_16.c \
|
||||
Common/src/MonoTo2I_16.c \
|
||||
Common/src/LoadConst_16.c \
|
||||
Common/src/dB_to_Lin32.c \
|
||||
Common/src/Shift_Sat_v16xv16.c \
|
||||
Common/src/Abs_32.c \
|
||||
Common/src/Int32RShiftToInt16_Sat_32x16.c \
|
||||
Common/src/From2iToMono_32.c \
|
||||
Common/src/mult3s_16x16.c \
|
||||
Common/src/NonLinComp_D16.c \
|
||||
Common/src/DelayMix_16x16.c \
|
||||
Common/src/MSTo2i_Sat_16x16.c \
|
||||
Common/src/From2iToMS_16x16.c \
|
||||
Common/src/Mac3s_Sat_16x16.c \
|
||||
Common/src/Add2_Sat_16x16.c \
|
||||
Common/src/LVC_MixSoft_1St_2i_D16C31_SAT.c \
|
||||
Common/src/LVC_MixSoft_1St_D16C31_SAT.c \
|
||||
Common/src/LVC_Mixer_VarSlope_SetTimeConstant.c \
|
||||
Common/src/LVC_Mixer_SetTimeConstant.c \
|
||||
Common/src/LVC_Mixer_SetTarget.c \
|
||||
Common/src/LVC_Mixer_GetTarget.c \
|
||||
Common/src/LVC_Mixer_Init.c \
|
||||
Common/src/LVC_Core_MixHard_1St_2i_D16C31_SAT.c \
|
||||
Common/src/LVC_Core_MixSoft_1St_2i_D16C31_WRA.c \
|
||||
Common/src/LVC_Core_MixInSoft_D16C31_SAT.c \
|
||||
Common/src/LVC_Mixer_GetCurrent.c \
|
||||
Common/src/LVC_MixSoft_2St_D16C31_SAT.c \
|
||||
Common/src/LVC_Core_MixSoft_1St_D16C31_WRA.c \
|
||||
Common/src/LVC_Core_MixHard_2St_D16C31_SAT.c \
|
||||
Common/src/LVC_MixInSoft_D16C31_SAT.c \
|
||||
Common/src/AGC_MIX_VOL_2St1Mon_D32_WRA.c \
|
||||
Common/src/LVM_Timer.c \
|
||||
Common/src/LVM_Timer_Init.c
|
||||
|
||||
LOCAL_MODULE:= libmusicbundle
|
||||
|
||||
LOCAL_PRELINK_MODULE := false
|
||||
|
||||
LOCAL_C_INCLUDES += \
|
||||
$(LOCAL_PATH)/Eq/lib \
|
||||
$(LOCAL_PATH)/Eq/src \
|
||||
$(LOCAL_PATH)/Bass/lib \
|
||||
$(LOCAL_PATH)/Bass/src \
|
||||
$(LOCAL_PATH)/Common/lib \
|
||||
$(LOCAL_PATH)/Common/src \
|
||||
$(LOCAL_PATH)/Bundle/lib \
|
||||
$(LOCAL_PATH)/Bundle/src \
|
||||
$(LOCAL_PATH)/SpectrumAnalyzer/lib \
|
||||
$(LOCAL_PATH)/SpectrumAnalyzer/src \
|
||||
$(LOCAL_PATH)/StereoWidening/src \
|
||||
$(LOCAL_PATH)/StereoWidening/lib
|
||||
|
||||
include $(BUILD_STATIC_LIBRARY)
|
472
media/libeffects/lvm/lib/Bass/lib/LVDBE.h
Executable file
472
media/libeffects/lvm/lib/Bass/lib/LVDBE.h
Executable file
@ -0,0 +1,472 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/****************************************************************************************
|
||||
|
||||
$Author: nxp007753 $
|
||||
$Revision: 1081 $
|
||||
$Date: 2010-07-05 11:48:44 +0200 (Mon, 05 Jul 2010) $
|
||||
|
||||
*****************************************************************************************/
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* Header file for the application layer interface of Dynamic Bass Enhancement */
|
||||
/* module. */
|
||||
/* */
|
||||
/* This files includes all definitions, types, structures and function */
|
||||
/* prototypes required by the calling layer. All other types, structures and */
|
||||
/* functions are private. */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* Note: 1 */
|
||||
/* ======= */
|
||||
/* The algorithm can execute either with separate input and output buffers or with */
|
||||
/* a common buffer, i.e. the data is processed in-place. */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* Note: 2 */
|
||||
/* ======= */
|
||||
/* The Dynamic Bass Enhancement algorithm always processes data as stereo input. Mono*/
|
||||
/* format data is not supported. The data is interleaved as follows: */
|
||||
/* */
|
||||
/* Byte Offset Stereo Input Mono-In-Stereo Input */
|
||||
/* =========== ============ ==================== */
|
||||
/* 0 Left Sample #1 Mono Sample #1 */
|
||||
/* 2 Right Sample #1 Mono Sample #1 */
|
||||
/* 4 Left Sample #2 Mono Sample #2 */
|
||||
/* 6 Right Sample #2 Mono Sample #2 */
|
||||
/* . . . */
|
||||
/* . . . */
|
||||
/* */
|
||||
/* Mono format data is not supported, the calling routine must convert a Mono stream */
|
||||
/* in to Mono-In-Stereo format. */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
|
||||
#ifndef __LVDBE_H__
|
||||
#define __LVDBE_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* Includes */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
|
||||
#include "LVM_Types.h"
|
||||
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* Definitions */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
|
||||
/* Memory table*/
|
||||
#define LVDBE_NR_MEMORY_REGIONS 4 /* Number of memory regions */
|
||||
|
||||
/* Bass Enhancement effect level */
|
||||
#define LVDBE_EFFECT_03DB 3 /* Effect defines for backwards compatibility */
|
||||
#define LVDBE_EFFECT_06DB 6
|
||||
#define LVDBE_EFFECT_09DB 9
|
||||
#define LVDBE_EFFECT_12DB 12
|
||||
#define LVDBE_EFFECT_15DB 15
|
||||
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* Types */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
|
||||
/* Instance handle */
|
||||
typedef void *LVDBE_Handle_t;
|
||||
|
||||
|
||||
/* Operating modes */
|
||||
typedef enum
|
||||
{
|
||||
LVDBE_OFF = 0,
|
||||
LVDBE_ON = 1,
|
||||
LVDBE_MODE_MAX = LVM_MAXINT_32
|
||||
} LVDBE_Mode_en;
|
||||
|
||||
|
||||
/* High pass filter */
|
||||
typedef enum
|
||||
{
|
||||
LVDBE_HPF_OFF = 0,
|
||||
LVDBE_HPF_ON = 1,
|
||||
LVDBE_HPF_MAX = LVM_MAXINT_32
|
||||
} LVDBE_FilterSelect_en;
|
||||
|
||||
|
||||
/* Volume control */
|
||||
typedef enum
|
||||
{
|
||||
LVDBE_VOLUME_OFF = 0,
|
||||
LVDBE_VOLUME_ON = 1,
|
||||
LVDBE_VOLUME_MAX = LVM_MAXINT_32
|
||||
} LVDBE_Volume_en;
|
||||
|
||||
|
||||
/* Memory Types */
|
||||
typedef enum
|
||||
{
|
||||
LVDBE_PERSISTENT = 0,
|
||||
LVDBE_PERSISTENT_DATA = 1,
|
||||
LVDBE_PERSISTENT_COEF = 2,
|
||||
LVDBE_SCRATCH = 3,
|
||||
LVDBE_MEMORY_MAX = LVM_MAXINT_32
|
||||
|
||||
} LVDBE_MemoryTypes_en;
|
||||
|
||||
|
||||
/* Function return status */
|
||||
typedef enum
|
||||
{
|
||||
LVDBE_SUCCESS = 0, /* Successful return from a routine */
|
||||
LVDBE_ALIGNMENTERROR = 1, /* Memory alignment error */
|
||||
LVDBE_NULLADDRESS = 2, /* NULL allocation address */
|
||||
LVDBE_TOOMANYSAMPLES = 3, /* Maximum block size exceeded */
|
||||
LVDBE_SIZEERROR = 4, /* Incorrect structure size */
|
||||
LVDBE_STATUS_MAX = LVM_MAXINT_32
|
||||
} LVDBE_ReturnStatus_en;
|
||||
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* Linked enumerated type and capability definitions */
|
||||
/* */
|
||||
/* The capability definitions are used to define the required capabilities at */
|
||||
/* initialisation, these are added together to give the capability word. The */
|
||||
/* enumerated type is used to select the mode through a control function at run time. */
|
||||
/* */
|
||||
/* The capability definition is related to the enumerated type value by the equation: */
|
||||
/* */
|
||||
/* Capability_value = 2^Enumerated_value */
|
||||
/* */
|
||||
/* For example, a module could be configurd at initialisation to support two sample */
|
||||
/* rates only by calling the init function with the value: */
|
||||
/* Capabilities.SampleRate = LVDBE_CAP_32000 + LVCS_DBE_44100; */
|
||||
/* */
|
||||
/* and at run time it would be passed the value LVDBE_FS_32000 through the control */
|
||||
/* function to select operation at 32kHz */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
|
||||
/*
|
||||
* Bass Enhancement centre frequency
|
||||
*/
|
||||
#define LVDBE_CAP_CENTRE_55Hz 1
|
||||
#define LVDBE_CAP_CENTRE_66Hz 2
|
||||
#define LVDBE_CAP_CENTRE_78Hz 4
|
||||
#define LVDBE_CAP_CENTRE_90Hz 8
|
||||
|
||||
typedef enum
|
||||
{
|
||||
LVDBE_CENTRE_55HZ = 0,
|
||||
LVDBE_CENTRE_66HZ = 1,
|
||||
LVDBE_CENTRE_78HZ = 2,
|
||||
LVDBE_CENTRE_90HZ = 3,
|
||||
LVDBE_CENTRE_MAX = LVM_MAXINT_32
|
||||
} LVDBE_CentreFreq_en;
|
||||
|
||||
|
||||
/*
|
||||
* Supported sample rates in samples per second
|
||||
*/
|
||||
#define LVDBE_CAP_FS_8000 1
|
||||
#define LVDBE_CAP_FS_11025 2
|
||||
#define LVDBE_CAP_FS_12000 4
|
||||
#define LVDBE_CAP_FS_16000 8
|
||||
#define LVDBE_CAP_FS_22050 16
|
||||
#define LVDBE_CAP_FS_24000 32
|
||||
#define LVDBE_CAP_FS_32000 64
|
||||
#define LVDBE_CAP_FS_44100 128
|
||||
#define LVDBE_CAP_FS_48000 256
|
||||
|
||||
typedef enum
|
||||
{
|
||||
LVDBE_FS_8000 = 0,
|
||||
LVDBE_FS_11025 = 1,
|
||||
LVDBE_FS_12000 = 2,
|
||||
LVDBE_FS_16000 = 3,
|
||||
LVDBE_FS_22050 = 4,
|
||||
LVDBE_FS_24000 = 5,
|
||||
LVDBE_FS_32000 = 6,
|
||||
LVDBE_FS_44100 = 7,
|
||||
LVDBE_FS_48000 = 8,
|
||||
LVDBE_FS_MAX = LVM_MAXINT_32
|
||||
} LVDBE_Fs_en;
|
||||
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* Structures */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
|
||||
/* Memory region definition */
|
||||
typedef struct
|
||||
{
|
||||
LVM_UINT32 Size; /* Region size in bytes */
|
||||
LVM_UINT16 Alignment; /* Region alignment in bytes */
|
||||
LVDBE_MemoryTypes_en Type; /* Region type */
|
||||
void *pBaseAddress; /* Pointer to the region base address */
|
||||
} LVDBE_MemoryRegion_t;
|
||||
|
||||
|
||||
/* Memory table containing the region definitions */
|
||||
typedef struct
|
||||
{
|
||||
LVDBE_MemoryRegion_t Region[LVDBE_NR_MEMORY_REGIONS]; /* One definition for each region */
|
||||
} LVDBE_MemTab_t;
|
||||
|
||||
|
||||
/* Parameter structure */
|
||||
typedef struct
|
||||
{
|
||||
LVDBE_Mode_en OperatingMode;
|
||||
LVDBE_Fs_en SampleRate;
|
||||
LVM_INT16 EffectLevel;
|
||||
LVDBE_CentreFreq_en CentreFrequency;
|
||||
LVDBE_FilterSelect_en HPFSelect;
|
||||
LVDBE_Volume_en VolumeControl;
|
||||
LVM_INT16 VolumedB;
|
||||
LVM_INT16 HeadroomdB;
|
||||
|
||||
} LVDBE_Params_t;
|
||||
|
||||
|
||||
/* Capability structure */
|
||||
typedef struct
|
||||
{
|
||||
LVM_UINT16 SampleRate; /* Sampling rate capabilities */
|
||||
LVM_UINT16 CentreFrequency; /* Centre frequency capabilities */
|
||||
LVM_UINT16 MaxBlockSize; /* Maximum block size in sample pairs */
|
||||
} LVDBE_Capabilities_t;
|
||||
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* Function Prototypes */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION: LVDBE_Memory */
|
||||
/* */
|
||||
/* DESCRIPTION: */
|
||||
/* This function is used for memory allocation and free. It can be called in */
|
||||
/* two ways: */
|
||||
/* */
|
||||
/* hInstance = NULL Returns the memory requirements */
|
||||
/* hInstance = Instance handle Returns the memory requirements and */
|
||||
/* allocated base addresses for the instance */
|
||||
/* */
|
||||
/* When this function is called for memory allocation (hInstance=NULL) the memory */
|
||||
/* base address pointers are NULL on return. */
|
||||
/* */
|
||||
/* When the function is called for free (hInstance = Instance Handle) the memory */
|
||||
/* table returns the allocated memory and base addresses used during initialisation. */
|
||||
/* */
|
||||
/* PARAMETERS: */
|
||||
/* hInstance Instance Handle */
|
||||
/* pMemoryTable Pointer to an empty memory definition table */
|
||||
/* pCapabilities Pointer to the default capabilites */
|
||||
/* */
|
||||
/* RETURNS: */
|
||||
/* LVDBE_SUCCESS Succeeded */
|
||||
/* */
|
||||
/* NOTES: */
|
||||
/* 1. This function may be interrupted by the LVDBE_Process function */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
|
||||
LVDBE_ReturnStatus_en LVDBE_Memory(LVDBE_Handle_t hInstance,
|
||||
LVDBE_MemTab_t *pMemoryTable,
|
||||
LVDBE_Capabilities_t *pCapabilities);
|
||||
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION: LVDBE_Init */
|
||||
/* */
|
||||
/* DESCRIPTION: */
|
||||
/* Create and initialisation function for the Bass Enhancement module */
|
||||
/* */
|
||||
/* This function can be used to create an algorithm instance by calling with */
|
||||
/* hInstance set to NULL. In this case the algorithm returns the new instance */
|
||||
/* handle. */
|
||||
/* */
|
||||
/* This function can be used to force a full re-initialisation of the algorithm */
|
||||
/* by calling with hInstance = Instance Handle. In this case the memory table */
|
||||
/* should be correct for the instance, this can be ensured by calling the function */
|
||||
/* LVDBE_Memory before calling this function. */
|
||||
/* */
|
||||
/* PARAMETERS: */
|
||||
/* hInstance Instance handle */
|
||||
/* pMemoryTable Pointer to the memory definition table */
|
||||
/* pCapabilities Pointer to the initialisation capabilities */
|
||||
/* */
|
||||
/* RETURNS: */
|
||||
/* LVDBE_SUCCESS Initialisation succeeded */
|
||||
/* LVDBE_ALIGNMENTERROR Instance or scratch memory on incorrect alignment */
|
||||
/* LVDBE_NULLADDRESS One or more memory has a NULL pointer */
|
||||
/* */
|
||||
/* NOTES: */
|
||||
/* 1. The instance handle is the pointer to the base address of the first memory */
|
||||
/* region. */
|
||||
/* 2. This function must not be interrupted by the LVDBE_Process function */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
|
||||
LVDBE_ReturnStatus_en LVDBE_Init(LVDBE_Handle_t *phInstance,
|
||||
LVDBE_MemTab_t *pMemoryTable,
|
||||
LVDBE_Capabilities_t *pCapabilities);
|
||||
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION: LVDBE_GetParameters */
|
||||
/* */
|
||||
/* DESCRIPTION: */
|
||||
/* Request the Bass Enhancement parameters. The current parameter set is returned */
|
||||
/* via the parameter pointer. */
|
||||
/* */
|
||||
/* PARAMETERS: */
|
||||
/* hInstance Instance handle */
|
||||
/* pParams Pointer to an empty parameter structure */
|
||||
/* */
|
||||
/* RETURNS: */
|
||||
/* LVDBE_SUCCESS Always succeeds */
|
||||
/* */
|
||||
/* NOTES: */
|
||||
/* 1. This function may be interrupted by the LVDBE_Process function */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
|
||||
LVDBE_ReturnStatus_en LVDBE_GetParameters(LVDBE_Handle_t hInstance,
|
||||
LVDBE_Params_t *pParams);
|
||||
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION: LVDBE_GetCapabilities */
|
||||
/* */
|
||||
/* DESCRIPTION: */
|
||||
/* Request the Dynamic Bass Enhancement capabilities. The initial capabilities are */
|
||||
/* returned via the pointer. */
|
||||
/* */
|
||||
/* PARAMETERS: */
|
||||
/* hInstance Instance handle */
|
||||
/* pCapabilities Pointer to an empty capabilitiy structure */
|
||||
/* */
|
||||
/* RETURNS: */
|
||||
/* LVDBE_Success Always succeeds */
|
||||
/* */
|
||||
/* NOTES: */
|
||||
/* 1. This function may be interrupted by the LVDBE_Process function */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
|
||||
LVDBE_ReturnStatus_en LVDBE_GetCapabilities(LVDBE_Handle_t hInstance,
|
||||
LVDBE_Capabilities_t *pCapabilities);
|
||||
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION: LVDBE_Control */
|
||||
/* */
|
||||
/* DESCRIPTION: */
|
||||
/* Sets or changes the Bass Enhancement parameters. Changing the parameters while the */
|
||||
/* module is processing signals may have the following side effects: */
|
||||
/* */
|
||||
/* General parameters: */
|
||||
/* =================== */
|
||||
/* OperatingMode: Changing the mode of operation may cause a change in volume */
|
||||
/* level. */
|
||||
/* */
|
||||
/* SampleRate: Changing the sample rate may cause pops and clicks. */
|
||||
/* */
|
||||
/* EffectLevel: Changing the effect level setting will have no side effects */
|
||||
/* */
|
||||
/* CentreFrequency: Changing the centre frequency may cause pops and clicks */
|
||||
/* */
|
||||
/* HPFSelect: Selecting/de-selecting the high pass filter may cause pops and */
|
||||
/* clicks */
|
||||
/* */
|
||||
/* VolumedB Changing the volume setting will have no side effects */
|
||||
/* */
|
||||
/* */
|
||||
/* PARAMETERS: */
|
||||
/* hInstance Instance handle */
|
||||
/* pParams Pointer to a parameter structure */
|
||||
/* */
|
||||
/* RETURNS: */
|
||||
/* LVDBE_SUCCESS Always succeeds */
|
||||
/* */
|
||||
/* NOTES: */
|
||||
/* 1. This function must not be interrupted by the LVDBE_Process function */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
|
||||
LVDBE_ReturnStatus_en LVDBE_Control(LVDBE_Handle_t hInstance,
|
||||
LVDBE_Params_t *pParams);
|
||||
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION: LVDBE_Process */
|
||||
/* */
|
||||
/* DESCRIPTION: */
|
||||
/* Process function for the Bass Enhancement module. */
|
||||
/* */
|
||||
/* PARAMETERS: */
|
||||
/* hInstance Instance handle */
|
||||
/* pInData Pointer to the input data */
|
||||
/* pOutData Pointer to the output data */
|
||||
/* NumSamples Number of samples in the input buffer */
|
||||
/* */
|
||||
/* RETURNS: */
|
||||
/* LVDBE_SUCCESS Succeeded */
|
||||
/* LVDBE_TOOMANYSAMPLES NumSamples was larger than the maximum block size */
|
||||
/* */
|
||||
/* NOTES: */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
|
||||
LVDBE_ReturnStatus_en LVDBE_Process(LVDBE_Handle_t hInstance,
|
||||
const LVM_INT16 *pInData,
|
||||
LVM_INT16 *pOutData,
|
||||
LVM_UINT16 NumSamples);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __LVDBE_H__ */
|
518
media/libeffects/lvm/lib/Bass/src/LVDBE_Coeffs.h
Executable file
518
media/libeffects/lvm/lib/Bass/src/LVDBE_Coeffs.h
Executable file
@ -0,0 +1,518 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __LVDBE_COEFFS_H__
|
||||
#define __LVDBE_COEFFS_H__
|
||||
|
||||
|
||||
/************************************************************************************/
|
||||
/* */
|
||||
/* General */
|
||||
/* */
|
||||
/************************************************************************************/
|
||||
|
||||
#define LVDBE_SCALESHIFT 10 /* As a power of 2 */
|
||||
|
||||
|
||||
/************************************************************************************/
|
||||
/* */
|
||||
/* High Pass Filter coefficients */
|
||||
/* */
|
||||
/************************************************************************************/
|
||||
|
||||
/* Coefficients for centre frequency 55Hz */
|
||||
#define HPF_Fs8000_Fc55_A0 1029556328 /* Floating point value 0.958849 */
|
||||
#define HPF_Fs8000_Fc55_A1 -2059112655 /* Floating point value -1.917698 */
|
||||
#define HPF_Fs8000_Fc55_A2 1029556328 /* Floating point value 0.958849 */
|
||||
#define HPF_Fs8000_Fc55_B1 -2081986375 /* Floating point value -1.939001 */
|
||||
#define HPF_Fs8000_Fc55_B2 1010183914 /* Floating point value 0.940807 */
|
||||
#define HPF_Fs11025_Fc55_A0 1038210831 /* Floating point value 0.966909 */
|
||||
#define HPF_Fs11025_Fc55_A1 -2076421662 /* Floating point value -1.933818 */
|
||||
#define HPF_Fs11025_Fc55_A2 1038210831 /* Floating point value 0.966909 */
|
||||
#define HPF_Fs11025_Fc55_B1 -2099950710 /* Floating point value -1.955732 */
|
||||
#define HPF_Fs11025_Fc55_B2 1027238450 /* Floating point value 0.956690 */
|
||||
#define HPF_Fs12000_Fc55_A0 1040079943 /* Floating point value 0.968650 */
|
||||
#define HPF_Fs12000_Fc55_A1 -2080159885 /* Floating point value -1.937300 */
|
||||
#define HPF_Fs12000_Fc55_A2 1040079943 /* Floating point value 0.968650 */
|
||||
#define HPF_Fs12000_Fc55_B1 -2103811702 /* Floating point value -1.959327 */
|
||||
#define HPF_Fs12000_Fc55_B2 1030940477 /* Floating point value 0.960138 */
|
||||
#define HPF_Fs16000_Fc55_A0 1045381988 /* Floating point value 0.973588 */
|
||||
#define HPF_Fs16000_Fc55_A1 -2090763976 /* Floating point value -1.947176 */
|
||||
#define HPF_Fs16000_Fc55_A2 1045381988 /* Floating point value 0.973588 */
|
||||
#define HPF_Fs16000_Fc55_B1 -2114727793 /* Floating point value -1.969494 */
|
||||
#define HPF_Fs16000_Fc55_B2 1041478147 /* Floating point value 0.969952 */
|
||||
#define HPF_Fs22050_Fc55_A0 1049766523 /* Floating point value 0.977671 */
|
||||
#define HPF_Fs22050_Fc55_A1 -2099533046 /* Floating point value -1.955343 */
|
||||
#define HPF_Fs22050_Fc55_A2 1049766523 /* Floating point value 0.977671 */
|
||||
#define HPF_Fs22050_Fc55_B1 -2123714381 /* Floating point value -1.977863 */
|
||||
#define HPF_Fs22050_Fc55_B2 1050232780 /* Floating point value 0.978105 */
|
||||
#define HPF_Fs24000_Fc55_A0 1050711051 /* Floating point value 0.978551 */
|
||||
#define HPF_Fs24000_Fc55_A1 -2101422103 /* Floating point value -1.957102 */
|
||||
#define HPF_Fs24000_Fc55_A2 1050711051 /* Floating point value 0.978551 */
|
||||
#define HPF_Fs24000_Fc55_B1 -2125645498 /* Floating point value -1.979662 */
|
||||
#define HPF_Fs24000_Fc55_B2 1052123526 /* Floating point value 0.979866 */
|
||||
#define HPF_Fs32000_Fc55_A0 1053385759 /* Floating point value 0.981042 */
|
||||
#define HPF_Fs32000_Fc55_A1 -2106771519 /* Floating point value -1.962084 */
|
||||
#define HPF_Fs32000_Fc55_A2 1053385759 /* Floating point value 0.981042 */
|
||||
#define HPF_Fs32000_Fc55_B1 -2131104794 /* Floating point value -1.984746 */
|
||||
#define HPF_Fs32000_Fc55_B2 1057486949 /* Floating point value 0.984861 */
|
||||
#define HPF_Fs44100_Fc55_A0 1055592498 /* Floating point value 0.983097 */
|
||||
#define HPF_Fs44100_Fc55_A1 -2111184995 /* Floating point value -1.966194 */
|
||||
#define HPF_Fs44100_Fc55_A2 1055592498 /* Floating point value 0.983097 */
|
||||
#define HPF_Fs44100_Fc55_B1 -2135598658 /* Floating point value -1.988931 */
|
||||
#define HPF_Fs44100_Fc55_B2 1061922249 /* Floating point value 0.988992 */
|
||||
#define HPF_Fs48000_Fc55_A0 1056067276 /* Floating point value 0.983539 */
|
||||
#define HPF_Fs48000_Fc55_A1 -2112134551 /* Floating point value -1.967079 */
|
||||
#define HPF_Fs48000_Fc55_A2 1056067276 /* Floating point value 0.983539 */
|
||||
#define HPF_Fs48000_Fc55_B1 -2136564296 /* Floating point value -1.989831 */
|
||||
#define HPF_Fs48000_Fc55_B2 1062877714 /* Floating point value 0.989882 */
|
||||
|
||||
/* Coefficients for centre frequency 66Hz */
|
||||
#define HPF_Fs8000_Fc66_A0 1023293271 /* Floating point value 0.953016 */
|
||||
#define HPF_Fs8000_Fc66_A1 -2046586542 /* Floating point value -1.906032 */
|
||||
#define HPF_Fs8000_Fc66_A2 1023293271 /* Floating point value 0.953016 */
|
||||
#define HPF_Fs8000_Fc66_B1 -2068896860 /* Floating point value -1.926810 */
|
||||
#define HPF_Fs8000_Fc66_B2 997931110 /* Floating point value 0.929396 */
|
||||
#define HPF_Fs11025_Fc66_A0 1033624228 /* Floating point value 0.962638 */
|
||||
#define HPF_Fs11025_Fc66_A1 -2067248455 /* Floating point value -1.925275 */
|
||||
#define HPF_Fs11025_Fc66_A2 1033624228 /* Floating point value 0.962638 */
|
||||
#define HPF_Fs11025_Fc66_B1 -2090448000 /* Floating point value -1.946881 */
|
||||
#define HPF_Fs11025_Fc66_B2 1018182305 /* Floating point value 0.948256 */
|
||||
#define HPF_Fs12000_Fc66_A0 1035857662 /* Floating point value 0.964718 */
|
||||
#define HPF_Fs12000_Fc66_A1 -2071715325 /* Floating point value -1.929435 */
|
||||
#define HPF_Fs12000_Fc66_A2 1035857662 /* Floating point value 0.964718 */
|
||||
#define HPF_Fs12000_Fc66_B1 -2095080333 /* Floating point value -1.951196 */
|
||||
#define HPF_Fs12000_Fc66_B2 1022587158 /* Floating point value 0.952359 */
|
||||
#define HPF_Fs16000_Fc66_A0 1042197528 /* Floating point value 0.970622 */
|
||||
#define HPF_Fs16000_Fc66_A1 -2084395056 /* Floating point value -1.941244 */
|
||||
#define HPF_Fs16000_Fc66_A2 1042197528 /* Floating point value 0.970622 */
|
||||
#define HPF_Fs16000_Fc66_B1 -2108177912 /* Floating point value -1.963394 */
|
||||
#define HPF_Fs16000_Fc66_B2 1035142690 /* Floating point value 0.964052 */
|
||||
#define HPF_Fs22050_Fc66_A0 1047445145 /* Floating point value 0.975509 */
|
||||
#define HPF_Fs22050_Fc66_A1 -2094890289 /* Floating point value -1.951019 */
|
||||
#define HPF_Fs22050_Fc66_A2 1047445145 /* Floating point value 0.975509 */
|
||||
#define HPF_Fs22050_Fc66_B1 -2118961025 /* Floating point value -1.973436 */
|
||||
#define HPF_Fs22050_Fc66_B2 1045593102 /* Floating point value 0.973784 */
|
||||
#define HPF_Fs24000_Fc66_A0 1048576175 /* Floating point value 0.976563 */
|
||||
#define HPF_Fs24000_Fc66_A1 -2097152349 /* Floating point value -1.953125 */
|
||||
#define HPF_Fs24000_Fc66_A2 1048576175 /* Floating point value 0.976563 */
|
||||
#define HPF_Fs24000_Fc66_B1 -2121278255 /* Floating point value -1.975594 */
|
||||
#define HPF_Fs24000_Fc66_B2 1047852379 /* Floating point value 0.975889 */
|
||||
#define HPF_Fs32000_Fc66_A0 1051780119 /* Floating point value 0.979547 */
|
||||
#define HPF_Fs32000_Fc66_A1 -2103560237 /* Floating point value -1.959093 */
|
||||
#define HPF_Fs32000_Fc66_A2 1051780119 /* Floating point value 0.979547 */
|
||||
#define HPF_Fs32000_Fc66_B1 -2127829187 /* Floating point value -1.981695 */
|
||||
#define HPF_Fs32000_Fc66_B2 1054265623 /* Floating point value 0.981861 */
|
||||
#define HPF_Fs44100_Fc66_A0 1054424722 /* Floating point value 0.982010 */
|
||||
#define HPF_Fs44100_Fc66_A1 -2108849444 /* Floating point value -1.964019 */
|
||||
#define HPF_Fs44100_Fc66_A2 1054424722 /* Floating point value 0.982010 */
|
||||
#define HPF_Fs44100_Fc66_B1 -2133221723 /* Floating point value -1.986718 */
|
||||
#define HPF_Fs44100_Fc66_B2 1059573993 /* Floating point value 0.986805 */
|
||||
#define HPF_Fs48000_Fc66_A0 1054993851 /* Floating point value 0.982540 */
|
||||
#define HPF_Fs48000_Fc66_A1 -2109987702 /* Floating point value -1.965079 */
|
||||
#define HPF_Fs48000_Fc66_A2 1054993851 /* Floating point value 0.982540 */
|
||||
#define HPF_Fs48000_Fc66_B1 -2134380475 /* Floating point value -1.987797 */
|
||||
#define HPF_Fs48000_Fc66_B2 1060718118 /* Floating point value 0.987871 */
|
||||
|
||||
/* Coefficients for centre frequency 78Hz */
|
||||
#define HPF_Fs8000_Fc78_A0 1016504203 /* Floating point value 0.946693 */
|
||||
#define HPF_Fs8000_Fc78_A1 -2033008405 /* Floating point value -1.893387 */
|
||||
#define HPF_Fs8000_Fc78_A2 1016504203 /* Floating point value 0.946693 */
|
||||
#define HPF_Fs8000_Fc78_B1 -2054623390 /* Floating point value -1.913517 */
|
||||
#define HPF_Fs8000_Fc78_B2 984733853 /* Floating point value 0.917105 */
|
||||
#define HPF_Fs11025_Fc78_A0 1028643741 /* Floating point value 0.957999 */
|
||||
#define HPF_Fs11025_Fc78_A1 -2057287482 /* Floating point value -1.915998 */
|
||||
#define HPF_Fs11025_Fc78_A2 1028643741 /* Floating point value 0.957999 */
|
||||
#define HPF_Fs11025_Fc78_B1 -2080083769 /* Floating point value -1.937229 */
|
||||
#define HPF_Fs11025_Fc78_B2 1008393904 /* Floating point value 0.939140 */
|
||||
#define HPF_Fs12000_Fc78_A0 1031271067 /* Floating point value 0.960446 */
|
||||
#define HPF_Fs12000_Fc78_A1 -2062542133 /* Floating point value -1.920892 */
|
||||
#define HPF_Fs12000_Fc78_A2 1031271067 /* Floating point value 0.960446 */
|
||||
#define HPF_Fs12000_Fc78_B1 -2085557048 /* Floating point value -1.942326 */
|
||||
#define HPF_Fs12000_Fc78_B2 1013551620 /* Floating point value 0.943944 */
|
||||
#define HPF_Fs16000_Fc78_A0 1038734628 /* Floating point value 0.967397 */
|
||||
#define HPF_Fs16000_Fc78_A1 -2077469256 /* Floating point value -1.934794 */
|
||||
#define HPF_Fs16000_Fc78_A2 1038734628 /* Floating point value 0.967397 */
|
||||
#define HPF_Fs16000_Fc78_B1 -2101033380 /* Floating point value -1.956740 */
|
||||
#define HPF_Fs16000_Fc78_B2 1028275228 /* Floating point value 0.957656 */
|
||||
#define HPF_Fs22050_Fc78_A0 1044918584 /* Floating point value 0.973156 */
|
||||
#define HPF_Fs22050_Fc78_A1 -2089837169 /* Floating point value -1.946313 */
|
||||
#define HPF_Fs22050_Fc78_A2 1044918584 /* Floating point value 0.973156 */
|
||||
#define HPF_Fs22050_Fc78_B1 -2113775854 /* Floating point value -1.968607 */
|
||||
#define HPF_Fs22050_Fc78_B2 1040555007 /* Floating point value 0.969092 */
|
||||
#define HPF_Fs24000_Fc78_A0 1046252164 /* Floating point value 0.974398 */
|
||||
#define HPF_Fs24000_Fc78_A1 -2092504328 /* Floating point value -1.948797 */
|
||||
#define HPF_Fs24000_Fc78_A2 1046252164 /* Floating point value 0.974398 */
|
||||
#define HPF_Fs24000_Fc78_B1 -2116514229 /* Floating point value -1.971157 */
|
||||
#define HPF_Fs24000_Fc78_B2 1043212719 /* Floating point value 0.971568 */
|
||||
#define HPF_Fs32000_Fc78_A0 1050031301 /* Floating point value 0.977918 */
|
||||
#define HPF_Fs32000_Fc78_A1 -2100062603 /* Floating point value -1.955836 */
|
||||
#define HPF_Fs32000_Fc78_A2 1050031301 /* Floating point value 0.977918 */
|
||||
#define HPF_Fs32000_Fc78_B1 -2124255900 /* Floating point value -1.978367 */
|
||||
#define HPF_Fs32000_Fc78_B2 1050762639 /* Floating point value 0.978599 */
|
||||
#define HPF_Fs44100_Fc78_A0 1053152258 /* Floating point value 0.980824 */
|
||||
#define HPF_Fs44100_Fc78_A1 -2106304516 /* Floating point value -1.961649 */
|
||||
#define HPF_Fs44100_Fc78_A2 1053152258 /* Floating point value 0.980824 */
|
||||
#define HPF_Fs44100_Fc78_B1 -2130628742 /* Floating point value -1.984303 */
|
||||
#define HPF_Fs44100_Fc78_B2 1057018180 /* Floating point value 0.984425 */
|
||||
#define HPF_Fs48000_Fc78_A0 1053824087 /* Floating point value 0.981450 */
|
||||
#define HPF_Fs48000_Fc78_A1 -2107648173 /* Floating point value -1.962900 */
|
||||
#define HPF_Fs48000_Fc78_A2 1053824087 /* Floating point value 0.981450 */
|
||||
#define HPF_Fs48000_Fc78_B1 -2131998154 /* Floating point value -1.985578 */
|
||||
#define HPF_Fs48000_Fc78_B2 1058367200 /* Floating point value 0.985681 */
|
||||
|
||||
/* Coefficients for centre frequency 90Hz */
|
||||
#define HPF_Fs8000_Fc90_A0 1009760053 /* Floating point value 0.940412 */
|
||||
#define HPF_Fs8000_Fc90_A1 -2019520105 /* Floating point value -1.880825 */
|
||||
#define HPF_Fs8000_Fc90_A2 1009760053 /* Floating point value 0.940412 */
|
||||
#define HPF_Fs8000_Fc90_B1 -2040357139 /* Floating point value -1.900231 */
|
||||
#define HPF_Fs8000_Fc90_B2 971711129 /* Floating point value 0.904977 */
|
||||
#define HPF_Fs11025_Fc90_A0 1023687217 /* Floating point value 0.953383 */
|
||||
#define HPF_Fs11025_Fc90_A1 -2047374434 /* Floating point value -1.906766 */
|
||||
#define HPF_Fs11025_Fc90_A2 1023687217 /* Floating point value 0.953383 */
|
||||
#define HPF_Fs11025_Fc90_B1 -2069722397 /* Floating point value -1.927579 */
|
||||
#define HPF_Fs11025_Fc90_B2 998699604 /* Floating point value 0.930111 */
|
||||
#define HPF_Fs12000_Fc90_A0 1026704754 /* Floating point value 0.956193 */
|
||||
#define HPF_Fs12000_Fc90_A1 -2053409508 /* Floating point value -1.912387 */
|
||||
#define HPF_Fs12000_Fc90_A2 1026704754 /* Floating point value 0.956193 */
|
||||
#define HPF_Fs12000_Fc90_B1 -2076035996 /* Floating point value -1.933459 */
|
||||
#define HPF_Fs12000_Fc90_B2 1004595918 /* Floating point value 0.935603 */
|
||||
#define HPF_Fs16000_Fc90_A0 1035283225 /* Floating point value 0.964183 */
|
||||
#define HPF_Fs16000_Fc90_A1 -2070566451 /* Floating point value -1.928365 */
|
||||
#define HPF_Fs16000_Fc90_A2 1035283225 /* Floating point value 0.964183 */
|
||||
#define HPF_Fs16000_Fc90_B1 -2093889811 /* Floating point value -1.950087 */
|
||||
#define HPF_Fs16000_Fc90_B2 1021453326 /* Floating point value 0.951303 */
|
||||
#define HPF_Fs22050_Fc90_A0 1042398116 /* Floating point value 0.970809 */
|
||||
#define HPF_Fs22050_Fc90_A1 -2084796232 /* Floating point value -1.941618 */
|
||||
#define HPF_Fs22050_Fc90_A2 1042398116 /* Floating point value 0.970809 */
|
||||
#define HPF_Fs22050_Fc90_B1 -2108591057 /* Floating point value -1.963778 */
|
||||
#define HPF_Fs22050_Fc90_B2 1035541188 /* Floating point value 0.964423 */
|
||||
#define HPF_Fs24000_Fc90_A0 1043933302 /* Floating point value 0.972239 */
|
||||
#define HPF_Fs24000_Fc90_A1 -2087866604 /* Floating point value -1.944477 */
|
||||
#define HPF_Fs24000_Fc90_A2 1043933302 /* Floating point value 0.972239 */
|
||||
#define HPF_Fs24000_Fc90_B1 -2111750495 /* Floating point value -1.966721 */
|
||||
#define HPF_Fs24000_Fc90_B2 1038593601 /* Floating point value 0.967266 */
|
||||
#define HPF_Fs32000_Fc90_A0 1048285391 /* Floating point value 0.976292 */
|
||||
#define HPF_Fs32000_Fc90_A1 -2096570783 /* Floating point value -1.952584 */
|
||||
#define HPF_Fs32000_Fc90_A2 1048285391 /* Floating point value 0.976292 */
|
||||
#define HPF_Fs32000_Fc90_B1 -2120682737 /* Floating point value -1.975040 */
|
||||
#define HPF_Fs32000_Fc90_B2 1047271295 /* Floating point value 0.975347 */
|
||||
#define HPF_Fs44100_Fc90_A0 1051881330 /* Floating point value 0.979641 */
|
||||
#define HPF_Fs44100_Fc90_A1 -2103762660 /* Floating point value -1.959282 */
|
||||
#define HPF_Fs44100_Fc90_A2 1051881330 /* Floating point value 0.979641 */
|
||||
#define HPF_Fs44100_Fc90_B1 -2128035809 /* Floating point value -1.981888 */
|
||||
#define HPF_Fs44100_Fc90_B2 1054468533 /* Floating point value 0.982050 */
|
||||
#define HPF_Fs48000_Fc90_A0 1052655619 /* Floating point value 0.980362 */
|
||||
#define HPF_Fs48000_Fc90_A1 -2105311238 /* Floating point value -1.960724 */
|
||||
#define HPF_Fs48000_Fc90_A2 1052655619 /* Floating point value 0.980362 */
|
||||
#define HPF_Fs48000_Fc90_B1 -2129615871 /* Floating point value -1.983359 */
|
||||
#define HPF_Fs48000_Fc90_B2 1056021492 /* Floating point value 0.983497 */
|
||||
|
||||
|
||||
/************************************************************************************/
|
||||
/* */
|
||||
/* Band Pass Filter coefficients */
|
||||
/* */
|
||||
/************************************************************************************/
|
||||
|
||||
/* Coefficients for centre frequency 55Hz */
|
||||
#define BPF_Fs8000_Fc55_A0 9875247 /* Floating point value 0.009197 */
|
||||
#define BPF_Fs8000_Fc55_A1 0 /* Floating point value 0.000000 */
|
||||
#define BPF_Fs8000_Fc55_A2 -9875247 /* Floating point value -0.009197 */
|
||||
#define BPF_Fs8000_Fc55_B1 -2125519830 /* Floating point value -1.979545 */
|
||||
#define BPF_Fs8000_Fc55_B2 1053762629 /* Floating point value 0.981393 */
|
||||
#define BPF_Fs11025_Fc55_A0 7183952 /* Floating point value 0.006691 */
|
||||
#define BPF_Fs11025_Fc55_A1 0 /* Floating point value 0.000000 */
|
||||
#define BPF_Fs11025_Fc55_A2 -7183952 /* Floating point value -0.006691 */
|
||||
#define BPF_Fs11025_Fc55_B1 -2131901658 /* Floating point value -1.985488 */
|
||||
#define BPF_Fs11025_Fc55_B2 1059207548 /* Floating point value 0.986464 */
|
||||
#define BPF_Fs12000_Fc55_A0 6603871 /* Floating point value 0.006150 */
|
||||
#define BPF_Fs12000_Fc55_A1 0 /* Floating point value 0.000000 */
|
||||
#define BPF_Fs12000_Fc55_A2 -6603871 /* Floating point value -0.006150 */
|
||||
#define BPF_Fs12000_Fc55_B1 -2133238092 /* Floating point value -1.986733 */
|
||||
#define BPF_Fs12000_Fc55_B2 1060381143 /* Floating point value 0.987557 */
|
||||
#define BPF_Fs16000_Fc55_A0 4960591 /* Floating point value 0.004620 */
|
||||
#define BPF_Fs16000_Fc55_A1 0 /* Floating point value 0.000000 */
|
||||
#define BPF_Fs16000_Fc55_A2 -4960591 /* Floating point value -0.004620 */
|
||||
#define BPF_Fs16000_Fc55_B1 -2136949052 /* Floating point value -1.990189 */
|
||||
#define BPF_Fs16000_Fc55_B2 1063705760 /* Floating point value 0.990653 */
|
||||
#define BPF_Fs22050_Fc55_A0 3604131 /* Floating point value 0.003357 */
|
||||
#define BPF_Fs22050_Fc55_A1 0 /* Floating point value 0.000000 */
|
||||
#define BPF_Fs22050_Fc55_A2 -3604131 /* Floating point value -0.003357 */
|
||||
#define BPF_Fs22050_Fc55_B1 -2139929085 /* Floating point value -1.992964 */
|
||||
#define BPF_Fs22050_Fc55_B2 1066450095 /* Floating point value 0.993209 */
|
||||
#define BPF_Fs24000_Fc55_A0 3312207 /* Floating point value 0.003085 */
|
||||
#define BPF_Fs24000_Fc55_A1 0 /* Floating point value 0.000000 */
|
||||
#define BPF_Fs24000_Fc55_A2 -3312207 /* Floating point value -0.003085 */
|
||||
#define BPF_Fs24000_Fc55_B1 -2140560606 /* Floating point value -1.993552 */
|
||||
#define BPF_Fs24000_Fc55_B2 1067040703 /* Floating point value 0.993759 */
|
||||
#define BPF_Fs32000_Fc55_A0 2486091 /* Floating point value 0.002315 */
|
||||
#define BPF_Fs32000_Fc55_A1 0 /* Floating point value 0.000000 */
|
||||
#define BPF_Fs32000_Fc55_A2 -2486091 /* Floating point value -0.002315 */
|
||||
#define BPF_Fs32000_Fc55_B1 -2142328962 /* Floating point value -1.995199 */
|
||||
#define BPF_Fs32000_Fc55_B2 1068712067 /* Floating point value 0.995316 */
|
||||
#define BPF_Fs44100_Fc55_A0 1805125 /* Floating point value 0.001681 */
|
||||
#define BPF_Fs44100_Fc55_A1 0 /* Floating point value 0.000000 */
|
||||
#define BPF_Fs44100_Fc55_A2 -1805125 /* Floating point value -0.001681 */
|
||||
#define BPF_Fs44100_Fc55_B1 -2143765772 /* Floating point value -1.996537 */
|
||||
#define BPF_Fs44100_Fc55_B2 1070089770 /* Floating point value 0.996599 */
|
||||
#define BPF_Fs48000_Fc55_A0 1658687 /* Floating point value 0.001545 */
|
||||
#define BPF_Fs48000_Fc55_A1 0 /* Floating point value 0.000000 */
|
||||
#define BPF_Fs48000_Fc55_A2 -1658687 /* Floating point value -0.001545 */
|
||||
#define BPF_Fs48000_Fc55_B1 -2144072292 /* Floating point value -1.996823 */
|
||||
#define BPF_Fs48000_Fc55_B2 1070386036 /* Floating point value 0.996875 */
|
||||
|
||||
/* Coefficients for centre frequency 66Hz */
|
||||
#define BPF_Fs8000_Fc66_A0 13580189 /* Floating point value 0.012648 */
|
||||
#define BPF_Fs8000_Fc66_A1 0 /* Floating point value 0.000000 */
|
||||
#define BPF_Fs8000_Fc66_A2 -13580189 /* Floating point value -0.012648 */
|
||||
#define BPF_Fs8000_Fc66_B1 -2117161175 /* Floating point value -1.971760 */
|
||||
#define BPF_Fs8000_Fc66_B2 1046266945 /* Floating point value 0.974412 */
|
||||
#define BPF_Fs11025_Fc66_A0 9888559 /* Floating point value 0.009209 */
|
||||
#define BPF_Fs11025_Fc66_A1 0 /* Floating point value 0.000000 */
|
||||
#define BPF_Fs11025_Fc66_A2 -9888559 /* Floating point value -0.009209 */
|
||||
#define BPF_Fs11025_Fc66_B1 -2125972738 /* Floating point value -1.979966 */
|
||||
#define BPF_Fs11025_Fc66_B2 1053735698 /* Floating point value 0.981368 */
|
||||
#define BPF_Fs12000_Fc66_A0 9091954 /* Floating point value 0.008468 */
|
||||
#define BPF_Fs12000_Fc66_A1 0 /* Floating point value 0.000000 */
|
||||
#define BPF_Fs12000_Fc66_A2 -9091954 /* Floating point value -0.008468 */
|
||||
#define BPF_Fs12000_Fc66_B1 -2127818004 /* Floating point value -1.981685 */
|
||||
#define BPF_Fs12000_Fc66_B2 1055347356 /* Floating point value 0.982869 */
|
||||
#define BPF_Fs16000_Fc66_A0 6833525 /* Floating point value 0.006364 */
|
||||
#define BPF_Fs16000_Fc66_A1 0 /* Floating point value 0.000000 */
|
||||
#define BPF_Fs16000_Fc66_A2 -6833525 /* Floating point value -0.006364 */
|
||||
#define BPF_Fs16000_Fc66_B1 -2132941739 /* Floating point value -1.986457 */
|
||||
#define BPF_Fs16000_Fc66_B2 1059916517 /* Floating point value 0.987124 */
|
||||
#define BPF_Fs22050_Fc66_A0 4967309 /* Floating point value 0.004626 */
|
||||
#define BPF_Fs22050_Fc66_A1 0 /* Floating point value 0.000000 */
|
||||
#define BPF_Fs22050_Fc66_A2 -4967309 /* Floating point value -0.004626 */
|
||||
#define BPF_Fs22050_Fc66_B1 -2137056003 /* Floating point value -1.990288 */
|
||||
#define BPF_Fs22050_Fc66_B2 1063692170 /* Floating point value 0.990641 */
|
||||
#define BPF_Fs24000_Fc66_A0 4565445 /* Floating point value 0.004252 */
|
||||
#define BPF_Fs24000_Fc66_A1 0 /* Floating point value 0.000000 */
|
||||
#define BPF_Fs24000_Fc66_A2 -4565445 /* Floating point value -0.004252 */
|
||||
#define BPF_Fs24000_Fc66_B1 -2137927842 /* Floating point value -1.991100 */
|
||||
#define BPF_Fs24000_Fc66_B2 1064505202 /* Floating point value 0.991398 */
|
||||
#define BPF_Fs32000_Fc66_A0 3427761 /* Floating point value 0.003192 */
|
||||
#define BPF_Fs32000_Fc66_A1 0 /* Floating point value 0.000000 */
|
||||
#define BPF_Fs32000_Fc66_A2 -3427761 /* Floating point value -0.003192 */
|
||||
#define BPF_Fs32000_Fc66_B1 -2140369007 /* Floating point value -1.993374 */
|
||||
#define BPF_Fs32000_Fc66_B2 1066806920 /* Floating point value 0.993541 */
|
||||
#define BPF_Fs44100_Fc66_A0 2489466 /* Floating point value 0.002318 */
|
||||
#define BPF_Fs44100_Fc66_A1 0 /* Floating point value 0.000000 */
|
||||
#define BPF_Fs44100_Fc66_A2 -2489466 /* Floating point value -0.002318 */
|
||||
#define BPF_Fs44100_Fc66_B1 -2142352342 /* Floating point value -1.995221 */
|
||||
#define BPF_Fs44100_Fc66_B2 1068705240 /* Floating point value 0.995309 */
|
||||
#define BPF_Fs48000_Fc66_A0 2287632 /* Floating point value 0.002131 */
|
||||
#define BPF_Fs48000_Fc66_A1 0 /* Floating point value 0.000000 */
|
||||
#define BPF_Fs48000_Fc66_A2 -2287632 /* Floating point value -0.002131 */
|
||||
#define BPF_Fs48000_Fc66_B1 -2142775436 /* Floating point value -1.995615 */
|
||||
#define BPF_Fs48000_Fc66_B2 1069113581 /* Floating point value 0.995690 */
|
||||
|
||||
/* Coefficients for centre frequency 78Hz */
|
||||
#define BPF_Fs8000_Fc78_A0 19941180 /* Floating point value 0.018572 */
|
||||
#define BPF_Fs8000_Fc78_A1 0 /* Floating point value 0.000000 */
|
||||
#define BPF_Fs8000_Fc78_A2 -19941180 /* Floating point value -0.018572 */
|
||||
#define BPF_Fs8000_Fc78_B1 -2103186749 /* Floating point value -1.958745 */
|
||||
#define BPF_Fs8000_Fc78_B2 1033397648 /* Floating point value 0.962427 */
|
||||
#define BPF_Fs11025_Fc78_A0 14543934 /* Floating point value 0.013545 */
|
||||
#define BPF_Fs11025_Fc78_A1 0 /* Floating point value 0.000000 */
|
||||
#define BPF_Fs11025_Fc78_A2 -14543934 /* Floating point value -0.013545 */
|
||||
#define BPF_Fs11025_Fc78_B1 -2115966638 /* Floating point value -1.970647 */
|
||||
#define BPF_Fs11025_Fc78_B2 1044317135 /* Floating point value 0.972596 */
|
||||
#define BPF_Fs12000_Fc78_A0 13376999 /* Floating point value 0.012458 */
|
||||
#define BPF_Fs12000_Fc78_A1 0 /* Floating point value 0.000000 */
|
||||
#define BPF_Fs12000_Fc78_A2 -13376999 /* Floating point value -0.012458 */
|
||||
#define BPF_Fs12000_Fc78_B1 -2118651708 /* Floating point value -1.973148 */
|
||||
#define BPF_Fs12000_Fc78_B2 1046678029 /* Floating point value 0.974795 */
|
||||
#define BPF_Fs16000_Fc78_A0 10064222 /* Floating point value 0.009373 */
|
||||
#define BPF_Fs16000_Fc78_A1 0 /* Floating point value 0.000000 */
|
||||
#define BPF_Fs16000_Fc78_A2 -10064222 /* Floating point value -0.009373 */
|
||||
#define BPF_Fs16000_Fc78_B1 -2126124342 /* Floating point value -1.980108 */
|
||||
#define BPF_Fs16000_Fc78_B2 1053380304 /* Floating point value 0.981037 */
|
||||
#define BPF_Fs22050_Fc78_A0 7321780 /* Floating point value 0.006819 */
|
||||
#define BPF_Fs22050_Fc78_A1 0 /* Floating point value 0.000000 */
|
||||
#define BPF_Fs22050_Fc78_A2 -7321780 /* Floating point value -0.006819 */
|
||||
#define BPF_Fs22050_Fc78_B1 -2132143771 /* Floating point value -1.985714 */
|
||||
#define BPF_Fs22050_Fc78_B2 1058928700 /* Floating point value 0.986204 */
|
||||
#define BPF_Fs24000_Fc78_A0 6730640 /* Floating point value 0.006268 */
|
||||
#define BPF_Fs24000_Fc78_A1 0 /* Floating point value 0.000000 */
|
||||
#define BPF_Fs24000_Fc78_A2 -6730640 /* Floating point value -0.006268 */
|
||||
#define BPF_Fs24000_Fc78_B1 -2133421607 /* Floating point value -1.986904 */
|
||||
#define BPF_Fs24000_Fc78_B2 1060124669 /* Floating point value 0.987318 */
|
||||
#define BPF_Fs32000_Fc78_A0 5055965 /* Floating point value 0.004709 */
|
||||
#define BPF_Fs32000_Fc78_A1 0 /* Floating point value 0.000000 */
|
||||
#define BPF_Fs32000_Fc78_A2 -5055965 /* Floating point value -0.004709 */
|
||||
#define BPF_Fs32000_Fc78_B1 -2137003977 /* Floating point value -1.990240 */
|
||||
#define BPF_Fs32000_Fc78_B2 1063512802 /* Floating point value 0.990473 */
|
||||
#define BPF_Fs44100_Fc78_A0 3673516 /* Floating point value 0.003421 */
|
||||
#define BPF_Fs44100_Fc78_A1 0 /* Floating point value 0.000000 */
|
||||
#define BPF_Fs44100_Fc78_A2 -3673516 /* Floating point value -0.003421 */
|
||||
#define BPF_Fs44100_Fc78_B1 -2139919394 /* Floating point value -1.992955 */
|
||||
#define BPF_Fs44100_Fc78_B2 1066309718 /* Floating point value 0.993078 */
|
||||
#define BPF_Fs48000_Fc78_A0 3375990 /* Floating point value 0.003144 */
|
||||
#define BPF_Fs48000_Fc78_A1 0 /* Floating point value 0.000000 */
|
||||
#define BPF_Fs48000_Fc78_A2 -3375990 /* Floating point value -0.003144 */
|
||||
#define BPF_Fs48000_Fc78_B1 -2140541906 /* Floating point value -1.993535 */
|
||||
#define BPF_Fs48000_Fc78_B2 1066911660 /* Floating point value 0.993639 */
|
||||
|
||||
/* Coefficients for centre frequency 90Hz */
|
||||
#define BPF_Fs8000_Fc90_A0 24438548 /* Floating point value 0.022760 */
|
||||
#define BPF_Fs8000_Fc90_A1 0 /* Floating point value 0.000000 */
|
||||
#define BPF_Fs8000_Fc90_A2 -24438548 /* Floating point value -0.022760 */
|
||||
#define BPF_Fs8000_Fc90_B1 -2092801347 /* Floating point value -1.949073 */
|
||||
#define BPF_Fs8000_Fc90_B2 1024298757 /* Floating point value 0.953953 */
|
||||
#define BPF_Fs11025_Fc90_A0 17844385 /* Floating point value 0.016619 */
|
||||
#define BPF_Fs11025_Fc90_A1 0 /* Floating point value 0.000000 */
|
||||
#define BPF_Fs11025_Fc90_A2 -17844385 /* Floating point value -0.016619 */
|
||||
#define BPF_Fs11025_Fc90_B1 -2108604921 /* Floating point value -1.963791 */
|
||||
#define BPF_Fs11025_Fc90_B2 1037639797 /* Floating point value 0.966377 */
|
||||
#define BPF_Fs12000_Fc90_A0 16416707 /* Floating point value 0.015289 */
|
||||
#define BPF_Fs12000_Fc90_A1 0 /* Floating point value 0.000000 */
|
||||
#define BPF_Fs12000_Fc90_A2 -16416707 /* Floating point value -0.015289 */
|
||||
#define BPF_Fs12000_Fc90_B1 -2111922936 /* Floating point value -1.966882 */
|
||||
#define BPF_Fs12000_Fc90_B2 1040528216 /* Floating point value 0.969067 */
|
||||
#define BPF_Fs16000_Fc90_A0 12359883 /* Floating point value 0.011511 */
|
||||
#define BPF_Fs16000_Fc90_A1 0 /* Floating point value 0.000000 */
|
||||
#define BPF_Fs16000_Fc90_A2 -12359883 /* Floating point value -0.011511 */
|
||||
#define BPF_Fs16000_Fc90_B1 -2121152162 /* Floating point value -1.975477 */
|
||||
#define BPF_Fs16000_Fc90_B2 1048735817 /* Floating point value 0.976711 */
|
||||
#define BPF_Fs22050_Fc90_A0 8997173 /* Floating point value 0.008379 */
|
||||
#define BPF_Fs22050_Fc90_A1 0 /* Floating point value 0.000000 */
|
||||
#define BPF_Fs22050_Fc90_A2 -8997173 /* Floating point value -0.008379 */
|
||||
#define BPF_Fs22050_Fc90_B1 -2128580762 /* Floating point value -1.982395 */
|
||||
#define BPF_Fs22050_Fc90_B2 1055539113 /* Floating point value 0.983047 */
|
||||
#define BPF_Fs24000_Fc90_A0 8271818 /* Floating point value 0.007704 */
|
||||
#define BPF_Fs24000_Fc90_A1 0 /* Floating point value 0.000000 */
|
||||
#define BPF_Fs24000_Fc90_A2 -8271818 /* Floating point value -0.007704 */
|
||||
#define BPF_Fs24000_Fc90_B1 -2130157013 /* Floating point value -1.983863 */
|
||||
#define BPF_Fs24000_Fc90_B2 1057006621 /* Floating point value 0.984414 */
|
||||
#define BPF_Fs32000_Fc90_A0 6215918 /* Floating point value 0.005789 */
|
||||
#define BPF_Fs32000_Fc90_A1 0 /* Floating point value 0.000000 */
|
||||
#define BPF_Fs32000_Fc90_A2 -6215918 /* Floating point value -0.005789 */
|
||||
#define BPF_Fs32000_Fc90_B1 -2134574521 /* Floating point value -1.987977 */
|
||||
#define BPF_Fs32000_Fc90_B2 1061166033 /* Floating point value 0.988288 */
|
||||
#define BPF_Fs44100_Fc90_A0 4517651 /* Floating point value 0.004207 */
|
||||
#define BPF_Fs44100_Fc90_A1 0 /* Floating point value 0.000000 */
|
||||
#define BPF_Fs44100_Fc90_A2 -4517651 /* Floating point value -0.004207 */
|
||||
#define BPF_Fs44100_Fc90_B1 -2138167926 /* Floating point value -1.991324 */
|
||||
#define BPF_Fs44100_Fc90_B2 1064601898 /* Floating point value 0.991488 */
|
||||
#define BPF_Fs48000_Fc90_A0 4152024 /* Floating point value 0.003867 */
|
||||
#define BPF_Fs48000_Fc90_A1 0 /* Floating point value 0.000000 */
|
||||
#define BPF_Fs48000_Fc90_A2 -4152024 /* Floating point value -0.003867 */
|
||||
#define BPF_Fs48000_Fc90_B1 -2138935002 /* Floating point value -1.992038 */
|
||||
#define BPF_Fs48000_Fc90_B2 1065341620 /* Floating point value 0.992177 */
|
||||
|
||||
|
||||
/************************************************************************************/
|
||||
/* */
|
||||
/* Automatic Gain Control time constants and gain settings */
|
||||
/* */
|
||||
/************************************************************************************/
|
||||
|
||||
/* AGC Time constants */
|
||||
#define AGC_ATTACK_Fs8000 27571 /* Floating point value 0.841395 */
|
||||
#define AGC_ATTACK_Fs11025 28909 /* Floating point value 0.882223 */
|
||||
#define AGC_ATTACK_Fs12000 29205 /* Floating point value 0.891251 */
|
||||
#define AGC_ATTACK_Fs16000 30057 /* Floating point value 0.917276 */
|
||||
#define AGC_ATTACK_Fs22050 30778 /* Floating point value 0.939267 */
|
||||
#define AGC_ATTACK_Fs24000 30935 /* Floating point value 0.944061 */
|
||||
#define AGC_ATTACK_Fs32000 31383 /* Floating point value 0.957745 */
|
||||
#define AGC_ATTACK_Fs44100 31757 /* Floating point value 0.969158 */
|
||||
#define AGC_ATTACK_Fs48000 31838 /* Floating point value 0.971628 */
|
||||
#define DECAY_SHIFT 10 /* As a power of 2 */
|
||||
#define AGC_DECAY_Fs8000 44 /* Floating point value 0.000042 */
|
||||
#define AGC_DECAY_Fs11025 32 /* Floating point value 0.000030 */
|
||||
#define AGC_DECAY_Fs12000 29 /* Floating point value 0.000028 */
|
||||
#define AGC_DECAY_Fs16000 22 /* Floating point value 0.000021 */
|
||||
#define AGC_DECAY_Fs22050 16 /* Floating point value 0.000015 */
|
||||
#define AGC_DECAY_Fs24000 15 /* Floating point value 0.000014 */
|
||||
#define AGC_DECAY_Fs32000 11 /* Floating point value 0.000010 */
|
||||
#define AGC_DECAY_Fs44100 8 /* Floating point value 0.000008 */
|
||||
#define AGC_DECAY_Fs48000 7 /* Floating point value 0.000007 */
|
||||
|
||||
/* AGC Gain settings */
|
||||
#define AGC_GAIN_SCALE 31 /* As a power of 2 */
|
||||
#define AGC_GAIN_SHIFT 4 /* As a power of 2 */
|
||||
#define AGC_TARGETLEVEL 33170337 /* Floating point value -0.100000dB */
|
||||
#define AGC_HPFGAIN_0dB 110739704 /* Floating point value 0.412538 */
|
||||
#define AGC_GAIN_0dB 0 /* Floating point value 0.000000 */
|
||||
#define AGC_HPFGAIN_1dB 157006071 /* Floating point value 0.584893 */
|
||||
#define AGC_GAIN_1dB 32754079 /* Floating point value 0.122018 */
|
||||
#define AGC_HPFGAIN_2dB 208917788 /* Floating point value 0.778279 */
|
||||
#define AGC_GAIN_2dB 69504761 /* Floating point value 0.258925 */
|
||||
#define AGC_HPFGAIN_3dB 267163693 /* Floating point value 0.995262 */
|
||||
#define AGC_GAIN_3dB 110739704 /* Floating point value 0.412538 */
|
||||
#define AGC_HPFGAIN_4dB 332516674 /* Floating point value 1.238721 */
|
||||
#define AGC_GAIN_4dB 157006071 /* Floating point value 0.584893 */
|
||||
#define AGC_HPFGAIN_5dB 405843924 /* Floating point value 1.511886 */
|
||||
#define AGC_GAIN_5dB 208917788 /* Floating point value 0.778279 */
|
||||
#define AGC_HPFGAIN_6dB 488118451 /* Floating point value 1.818383 */
|
||||
#define AGC_GAIN_6dB 267163693 /* Floating point value 0.995262 */
|
||||
#define AGC_HPFGAIN_7dB 580431990 /* Floating point value 2.162278 */
|
||||
#define AGC_GAIN_7dB 332516674 /* Floating point value 1.238721 */
|
||||
#define AGC_HPFGAIN_8dB 684009483 /* Floating point value 2.548134 */
|
||||
#define AGC_GAIN_8dB 405843924 /* Floating point value 1.511886 */
|
||||
#define AGC_HPFGAIN_9dB 800225343 /* Floating point value 2.981072 */
|
||||
#define AGC_GAIN_9dB 488118451 /* Floating point value 1.818383 */
|
||||
#define AGC_HPFGAIN_10dB 930621681 /* Floating point value 3.466836 */
|
||||
#define AGC_GAIN_10dB 580431990 /* Floating point value 2.162278 */
|
||||
#define AGC_HPFGAIN_11dB 1076928780 /* Floating point value 4.011872 */
|
||||
#define AGC_GAIN_11dB 684009483 /* Floating point value 2.548134 */
|
||||
#define AGC_HPFGAIN_12dB 1241088045 /* Floating point value 4.623413 */
|
||||
#define AGC_GAIN_12dB 800225343 /* Floating point value 2.981072 */
|
||||
#define AGC_HPFGAIN_13dB 1425277769 /* Floating point value 5.309573 */
|
||||
#define AGC_GAIN_13dB 930621681 /* Floating point value 3.466836 */
|
||||
#define AGC_HPFGAIN_14dB 1631942039 /* Floating point value 6.079458 */
|
||||
#define AGC_GAIN_14dB 1076928780 /* Floating point value 4.011872 */
|
||||
#define AGC_HPFGAIN_15dB 1863823163 /* Floating point value 6.943282 */
|
||||
#define AGC_GAIN_15dB 1241088045 /* Floating point value 4.623413 */
|
||||
|
||||
|
||||
/************************************************************************************/
|
||||
/* */
|
||||
/* Volume control */
|
||||
/* */
|
||||
/************************************************************************************/
|
||||
|
||||
/* Volume control gain */
|
||||
#define VOLUME_MAX 0 /* In dBs */
|
||||
#define VOLUME_SHIFT 0 /* In dBs */
|
||||
|
||||
/* Volume control time constants */
|
||||
#define VOL_TC_SHIFT 21 /* As a power of 2 */
|
||||
#define VOL_TC_Fs8000 25889 /* Floating point value 0.024690 */
|
||||
#define VOL_TC_Fs11025 18850 /* Floating point value 0.017977 */
|
||||
#define VOL_TC_Fs12000 17331 /* Floating point value 0.016529 */
|
||||
#define VOL_TC_Fs16000 13026 /* Floating point value 0.012422 */
|
||||
#define VOL_TC_Fs22050 9468 /* Floating point value 0.009029 */
|
||||
#define VOL_TC_Fs24000 8702 /* Floating point value 0.008299 */
|
||||
#define VOL_TC_Fs32000 6533 /* Floating point value 0.006231 */
|
||||
#define VOL_TC_Fs44100 4745 /* Floating point value 0.004525 */
|
||||
#define VOL_TC_Fs48000 4360 /* Floating point value 0.004158 */
|
||||
#define MIX_TC_Fs8000 29365 /* Floating point value 0.896151 */
|
||||
#define MIX_TC_Fs11025 30230 /* Floating point value 0.922548 */
|
||||
#define MIX_TC_Fs12000 30422 /* Floating point value 0.928415 */
|
||||
#define MIX_TC_Fs16000 30978 /* Floating point value 0.945387 */
|
||||
#define MIX_TC_Fs22050 31451 /* Floating point value 0.959804 */
|
||||
#define MIX_TC_Fs24000 31554 /* Floating point value 0.962956 */
|
||||
#define MIX_TC_Fs32000 31850 /* Floating point value 0.971973 */
|
||||
#define MIX_TC_Fs44100 32097 /* Floating point value 0.979515 */
|
||||
#define MIX_TC_Fs48000 32150 /* Floating point value 0.981150 */
|
||||
|
||||
|
||||
#endif
|
377
media/libeffects/lvm/lib/Bass/src/LVDBE_Control.c
Executable file
377
media/libeffects/lvm/lib/Bass/src/LVDBE_Control.c
Executable file
@ -0,0 +1,377 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/****************************************************************************************
|
||||
|
||||
$Author: nxp007753 $
|
||||
$Revision: 1223 $
|
||||
$Date: 2010-07-15 14:27:01 +0200 (Thu, 15 Jul 2010) $
|
||||
|
||||
*****************************************************************************************/
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* Includes */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
|
||||
#include "LVDBE.h"
|
||||
#include "LVDBE_Private.h"
|
||||
#include "VectorArithmetic.h"
|
||||
#include "LVDBE_Coeffs.h"
|
||||
#include "LVDBE_Tables.h"
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION: LVDBE_GetParameters */
|
||||
/* */
|
||||
/* DESCRIPTION: */
|
||||
/* Request the Dynamic Bass Enhancement parameters. The current parameter set is */
|
||||
/* returned via the parameter pointer. */
|
||||
/* */
|
||||
/* PARAMETERS: */
|
||||
/* hInstance Instance handle */
|
||||
/* pParams Pointer to an empty parameter structure */
|
||||
/* */
|
||||
/* RETURNS: */
|
||||
/* LVDBE_SUCCESS Always succeeds */
|
||||
/* */
|
||||
/* NOTES: */
|
||||
/* 1. This function may be interrupted by the LVDBE_Process function */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
|
||||
LVDBE_ReturnStatus_en LVDBE_GetParameters(LVDBE_Handle_t hInstance,
|
||||
LVDBE_Params_t *pParams)
|
||||
{
|
||||
|
||||
LVDBE_Instance_t *pInstance =(LVDBE_Instance_t *)hInstance;
|
||||
|
||||
*pParams = pInstance->Params;
|
||||
|
||||
return(LVDBE_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION: LVDBE_GetCapabilities */
|
||||
/* */
|
||||
/* DESCRIPTION: Dynamic Bass Enhnacement capabilities. The current capabilities are */
|
||||
/* returned via the pointer. */
|
||||
/* */
|
||||
/* PARAMETERS: */
|
||||
/* hInstance Instance handle */
|
||||
/* pCapabilities Pointer to an empty capability structure */
|
||||
/* */
|
||||
/* RETURNS: */
|
||||
/* LVDBE_Success Always succeeds */
|
||||
/* */
|
||||
/* NOTES: */
|
||||
/* 1. This function may be interrupted by the LVDBE_Process function */
|
||||
/* */
|
||||
/************************************************************************************/
|
||||
|
||||
LVDBE_ReturnStatus_en LVDBE_GetCapabilities(LVDBE_Handle_t hInstance,
|
||||
LVDBE_Capabilities_t *pCapabilities)
|
||||
{
|
||||
|
||||
LVDBE_Instance_t *pInstance =(LVDBE_Instance_t *)hInstance;
|
||||
|
||||
*pCapabilities = pInstance->Capabilities;
|
||||
|
||||
return(LVDBE_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION: LVDBE_SetFilters */
|
||||
/* */
|
||||
/* DESCRIPTION: */
|
||||
/* Sets the filter coefficients and clears the data history */
|
||||
/* */
|
||||
/* PARAMETERS: */
|
||||
/* pInstance Pointer to the instance */
|
||||
/* pParams Initialisation parameters */
|
||||
/* */
|
||||
/************************************************************************************/
|
||||
|
||||
void LVDBE_SetFilters(LVDBE_Instance_t *pInstance,
|
||||
LVDBE_Params_t *pParams)
|
||||
{
|
||||
|
||||
/*
|
||||
* Calculate the table offsets
|
||||
*/
|
||||
LVM_UINT16 Offset = (LVM_UINT16)((LVM_UINT16)pParams->SampleRate + (LVM_UINT16)(pParams->CentreFrequency * (1+LVDBE_FS_48000)));
|
||||
|
||||
|
||||
/*
|
||||
* Setup the high pass filter
|
||||
*/
|
||||
LoadConst_16(0, /* Clear the history, value 0 */
|
||||
(LVM_INT16 *)&pInstance->pData->HPFTaps, /* Destination */
|
||||
sizeof(pInstance->pData->HPFTaps)/sizeof(LVM_INT16)); /* Number of words */
|
||||
BQ_2I_D32F32Cll_TRC_WRA_01_Init(&pInstance->pCoef->HPFInstance, /* Initialise the filter */
|
||||
&pInstance->pData->HPFTaps,
|
||||
(BQ_C32_Coefs_t *)&LVDBE_HPF_Table[Offset]);
|
||||
|
||||
|
||||
/*
|
||||
* Setup the band pass filter
|
||||
*/
|
||||
LoadConst_16(0, /* Clear the history, value 0 */
|
||||
(LVM_INT16 *)&pInstance->pData->BPFTaps, /* Destination */
|
||||
sizeof(pInstance->pData->BPFTaps)/sizeof(LVM_INT16)); /* Number of words */
|
||||
BP_1I_D32F32Cll_TRC_WRA_02_Init(&pInstance->pCoef->BPFInstance, /* Initialise the filter */
|
||||
&pInstance->pData->BPFTaps,
|
||||
(BP_C32_Coefs_t *)&LVDBE_BPF_Table[Offset]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/************************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION: LVDBE_SetAGC */
|
||||
/* */
|
||||
/* DESCRIPTION: */
|
||||
/* Sets the AGC gain level and attack and decay times constants. */
|
||||
/* */
|
||||
/* PARAMETERS: */
|
||||
/* pInstance Pointer to the instance */
|
||||
/* pParams Initialisation parameters */
|
||||
/* */
|
||||
/************************************************************************************/
|
||||
|
||||
void LVDBE_SetAGC(LVDBE_Instance_t *pInstance,
|
||||
LVDBE_Params_t *pParams)
|
||||
{
|
||||
|
||||
/*
|
||||
* Get the attack and decay time constants
|
||||
*/
|
||||
pInstance->pData->AGCInstance.AGC_Attack = LVDBE_AGC_ATTACK_Table[(LVM_UINT16)pParams->SampleRate]; /* Attack multiplier */
|
||||
pInstance->pData->AGCInstance.AGC_Decay = LVDBE_AGC_DECAY_Table[(LVM_UINT16)pParams->SampleRate]; /* Decay multipler */
|
||||
|
||||
|
||||
/*
|
||||
* Get the boost gain
|
||||
*/
|
||||
if (pParams->HPFSelect == LVDBE_HPF_ON)
|
||||
{
|
||||
pInstance->pData->AGCInstance.AGC_MaxGain = LVDBE_AGC_HPFGAIN_Table[(LVM_UINT16)pParams->EffectLevel]; /* High pass filter on */
|
||||
}
|
||||
else
|
||||
{
|
||||
pInstance->pData->AGCInstance.AGC_MaxGain = LVDBE_AGC_GAIN_Table[(LVM_UINT16)pParams->EffectLevel]; /* High pass filter off */
|
||||
}
|
||||
pInstance->pData->AGCInstance.AGC_GainShift = AGC_GAIN_SHIFT;
|
||||
pInstance->pData->AGCInstance.AGC_Target = AGC_TARGETLEVEL;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION: LVDBE_SetVolume */
|
||||
/* */
|
||||
/* DESCRIPTION: */
|
||||
/* Converts the input volume demand from dBs to linear. */
|
||||
/* */
|
||||
/* PARAMETERS: */
|
||||
/* pInstance Pointer to the instance */
|
||||
/* pParams Initialisation parameters */
|
||||
/* */
|
||||
/* NOTES: */
|
||||
/* 1. The volume should have the following settings: */
|
||||
/* */
|
||||
/* DBE Vol Control Volume setting */
|
||||
/* === =========== =================== */
|
||||
/* Off Off HeadroomdB */
|
||||
/* Off On VolumedB+HeadroomdB */
|
||||
/* On Off HeadroomdB */
|
||||
/* On On VolumedB+HeadroomdB */
|
||||
/* */
|
||||
/************************************************************************************/
|
||||
|
||||
void LVDBE_SetVolume(LVDBE_Instance_t *pInstance,
|
||||
LVDBE_Params_t *pParams)
|
||||
{
|
||||
|
||||
LVM_UINT16 dBShifts; /* 6dB shifts */
|
||||
LVM_UINT16 dBOffset; /* Table offset */
|
||||
LVM_INT16 Volume = 0; /* Required volume in dBs */
|
||||
|
||||
/*
|
||||
* Apply the volume if enabled
|
||||
*/
|
||||
if (pParams->VolumeControl == LVDBE_VOLUME_ON)
|
||||
{
|
||||
/*
|
||||
* Limit the gain to the maximum allowed
|
||||
*/
|
||||
if (pParams->VolumedB > VOLUME_MAX)
|
||||
{
|
||||
Volume = VOLUME_MAX;
|
||||
}
|
||||
else
|
||||
{
|
||||
Volume = pParams->VolumedB;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Calculate the required gain and shifts
|
||||
*/
|
||||
dBOffset = (LVM_UINT16)(6 + Volume % 6); /* Get the dBs 0-5 */
|
||||
dBShifts = (LVM_UINT16)(Volume / -6); /* Get the 6dB shifts */
|
||||
|
||||
|
||||
/*
|
||||
* When DBE is enabled use AGC volume
|
||||
*/
|
||||
pInstance->pData->AGCInstance.Target = ((LVM_INT32)LVDBE_VolumeTable[dBOffset] << 16);
|
||||
pInstance->pData->AGCInstance.Target = pInstance->pData->AGCInstance.Target >> dBShifts;
|
||||
|
||||
pInstance->pData->AGCInstance.VolumeTC = LVDBE_VolumeTCTable[(LVM_UINT16)pParams->SampleRate]; /* Volume update time constant */
|
||||
pInstance->pData->AGCInstance.VolumeShift = VOLUME_SHIFT+1;
|
||||
|
||||
/*
|
||||
* When DBE is disabled use the bypass volume control
|
||||
*/
|
||||
if(dBShifts > 0)
|
||||
{
|
||||
LVC_Mixer_SetTarget(&pInstance->pData->BypassVolume.MixerStream[0],(((LVM_INT32)LVDBE_VolumeTable[dBOffset]) >> dBShifts));
|
||||
}
|
||||
else
|
||||
{
|
||||
LVC_Mixer_SetTarget(&pInstance->pData->BypassVolume.MixerStream[0],(LVM_INT32)LVDBE_VolumeTable[dBOffset]);
|
||||
}
|
||||
|
||||
pInstance->pData->BypassVolume.MixerStream[0].CallbackSet = 1;
|
||||
LVC_Mixer_VarSlope_SetTimeConstant(&pInstance->pData->BypassVolume.MixerStream[0],
|
||||
LVDBE_MIXER_TC,
|
||||
(LVM_Fs_en)pInstance->Params.SampleRate,
|
||||
2);
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION: LVDBE_Control */
|
||||
/* */
|
||||
/* DESCRIPTION: */
|
||||
/* Sets or changes the Bass Enhancement parameters. Changing the parameters while the */
|
||||
/* module is processing signals may have the following side effects: */
|
||||
/* */
|
||||
/* General parameters: */
|
||||
/* =================== */
|
||||
/* OperatingMode: Changing the mode of operation may cause a change in volume */
|
||||
/* level or cause pops and clicks. */
|
||||
/* */
|
||||
/* SampleRate: Changing the sample rate may cause pops and clicks. */
|
||||
/* */
|
||||
/* EffectLevel: Changing the effect level may cause pops and clicks */
|
||||
/* */
|
||||
/* CentreFrequency: Changing the centre frequency may cause pops and clicks */
|
||||
/* */
|
||||
/* HPFSelect: Selecting/de-selecting the high pass filter may cause pops and */
|
||||
/* clicks */
|
||||
/* */
|
||||
/* VolumedB Changing the volume setting will have no side effects */
|
||||
/* */
|
||||
/* */
|
||||
/* PARAMETERS: */
|
||||
/* hInstance Instance handle */
|
||||
/* pParams Pointer to a parameter structure */
|
||||
/* */
|
||||
/* RETURNS: */
|
||||
/* LVDBE_SUCCESS Always succeeds */
|
||||
/* */
|
||||
/* NOTES: */
|
||||
/* 1. This function must not be interrupted by the LVDBE_Process function */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
|
||||
LVDBE_ReturnStatus_en LVDBE_Control(LVDBE_Handle_t hInstance,
|
||||
LVDBE_Params_t *pParams)
|
||||
{
|
||||
|
||||
LVDBE_Instance_t *pInstance =(LVDBE_Instance_t *)hInstance;
|
||||
|
||||
|
||||
/*
|
||||
* Update the filters
|
||||
*/
|
||||
if ((pInstance->Params.SampleRate != pParams->SampleRate) ||
|
||||
(pInstance->Params.CentreFrequency != pParams->CentreFrequency))
|
||||
{
|
||||
LVDBE_SetFilters(pInstance, /* Instance pointer */
|
||||
pParams); /* New parameters */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Update the AGC is the effect level has changed
|
||||
*/
|
||||
if ((pInstance->Params.SampleRate != pParams->SampleRate) ||
|
||||
(pInstance->Params.EffectLevel != pParams->EffectLevel) ||
|
||||
(pInstance->Params.HPFSelect != pParams->HPFSelect))
|
||||
{
|
||||
LVDBE_SetAGC(pInstance, /* Instance pointer */
|
||||
pParams); /* New parameters */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Update the Volume if the volume demand has changed
|
||||
*/
|
||||
if ((pInstance->Params.VolumedB != pParams->VolumedB) ||
|
||||
(pInstance->Params.SampleRate != pParams->SampleRate) ||
|
||||
(pInstance->Params.HeadroomdB != pParams->HeadroomdB) ||
|
||||
(pInstance->Params.VolumeControl != pParams->VolumeControl))
|
||||
{
|
||||
LVDBE_SetVolume(pInstance, /* Instance pointer */
|
||||
pParams); /* New parameters */
|
||||
}
|
||||
|
||||
if (pInstance->Params.OperatingMode==LVDBE_ON && pParams->OperatingMode==LVDBE_OFF)
|
||||
{
|
||||
LVDBE_Params_t Params = *pParams; /* make local copy of params */
|
||||
Params.EffectLevel = 0; /* zero effect level before switching off module*/
|
||||
pInstance->bTransitionOnToOff = LVM_TRUE; /* Set the CallBack */
|
||||
LVDBE_SetAGC(pInstance, /* Instance pointer */
|
||||
&Params); /* New parameters */
|
||||
}
|
||||
if (pInstance->Params.OperatingMode==LVDBE_OFF && pParams->OperatingMode==LVDBE_ON)
|
||||
{
|
||||
pInstance->bTransitionOnToOff = LVM_FALSE; /* Set the CallBack */
|
||||
LVDBE_SetAGC(pInstance, /* Instance pointer */
|
||||
pParams); /* New parameters */
|
||||
}
|
||||
|
||||
/*
|
||||
* Update the instance parameters
|
||||
*/
|
||||
pInstance->Params = *pParams;
|
||||
|
||||
|
||||
return(LVDBE_SUCCESS);
|
||||
}
|
267
media/libeffects/lvm/lib/Bass/src/LVDBE_Init.c
Executable file
267
media/libeffects/lvm/lib/Bass/src/LVDBE_Init.c
Executable file
@ -0,0 +1,267 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/****************************************************************************************
|
||||
|
||||
$Author: nxp007753 $
|
||||
$Revision: 1081 $
|
||||
$Date: 2010-07-05 11:48:44 +0200 (Mon, 05 Jul 2010) $
|
||||
|
||||
*****************************************************************************************/
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* Includes */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
|
||||
#include "LVDBE.h"
|
||||
#include "LVDBE_Private.h"
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION: LVDBE_Memory */
|
||||
/* */
|
||||
/* DESCRIPTION: */
|
||||
/* This function is used for memory allocation and free. It can be called in */
|
||||
/* two ways: */
|
||||
/* */
|
||||
/* hInstance = NULL Returns the memory requirements */
|
||||
/* hInstance = Instance handle Returns the memory requirements and */
|
||||
/* allocated base addresses for the instance */
|
||||
/* */
|
||||
/* When this function is called for memory allocation (hInstance=NULL) the memory */
|
||||
/* base address pointers are NULL on return. */
|
||||
/* */
|
||||
/* When the function is called for free (hInstance = Instance Handle) the memory */
|
||||
/* table returns the allocated memory and base addresses used during initialisation. */
|
||||
/* */
|
||||
/* PARAMETERS: */
|
||||
/* hInstance Instance Handle */
|
||||
/* pMemoryTable Pointer to an empty memory definition table */
|
||||
/* pCapabilities Pointer to the instance capabilities */
|
||||
/* */
|
||||
/* RETURNS: */
|
||||
/* LVDBE_SUCCESS Succeeded */
|
||||
/* */
|
||||
/* NOTES: */
|
||||
/* 1. This function may be interrupted by the LVDBE_Process function */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
|
||||
LVDBE_ReturnStatus_en LVDBE_Memory(LVDBE_Handle_t hInstance,
|
||||
LVDBE_MemTab_t *pMemoryTable,
|
||||
LVDBE_Capabilities_t *pCapabilities)
|
||||
{
|
||||
|
||||
LVM_UINT32 ScratchSize;
|
||||
LVDBE_Instance_t *pInstance = (LVDBE_Instance_t *)hInstance;
|
||||
|
||||
|
||||
/*
|
||||
* Fill in the memory table
|
||||
*/
|
||||
if (hInstance == LVM_NULL)
|
||||
{
|
||||
/*
|
||||
* Instance memory
|
||||
*/
|
||||
pMemoryTable->Region[LVDBE_MEMREGION_INSTANCE].Size = sizeof(LVDBE_Instance_t);
|
||||
pMemoryTable->Region[LVDBE_MEMREGION_INSTANCE].Alignment = LVDBE_INSTANCE_ALIGN;
|
||||
pMemoryTable->Region[LVDBE_MEMREGION_INSTANCE].Type = LVDBE_PERSISTENT;
|
||||
pMemoryTable->Region[LVDBE_MEMREGION_INSTANCE].pBaseAddress = LVM_NULL;
|
||||
|
||||
/*
|
||||
* Data memory
|
||||
*/
|
||||
pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_DATA].Size = sizeof(LVDBE_Data_t);
|
||||
pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_DATA].Alignment = LVDBE_PERSISTENT_DATA_ALIGN;
|
||||
pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_DATA].Type = LVDBE_PERSISTENT_DATA;
|
||||
pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_DATA].pBaseAddress = LVM_NULL;
|
||||
|
||||
/*
|
||||
* Coef memory
|
||||
*/
|
||||
pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_COEF].Size = sizeof(LVDBE_Coef_t);
|
||||
pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_COEF].Alignment = LVDBE_PERSISTENT_COEF_ALIGN;
|
||||
pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_COEF].Type = LVDBE_PERSISTENT_COEF;
|
||||
pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_COEF].pBaseAddress = LVM_NULL;
|
||||
|
||||
/*
|
||||
* Scratch memory
|
||||
*/
|
||||
ScratchSize = (LVM_UINT32)(LVDBE_SCRATCHBUFFERS_INPLACE*sizeof(LVM_INT16)*pCapabilities->MaxBlockSize);
|
||||
pMemoryTable->Region[LVDBE_MEMREGION_SCRATCH].Size = ScratchSize;
|
||||
pMemoryTable->Region[LVDBE_MEMREGION_SCRATCH].Alignment = LVDBE_SCRATCH_ALIGN;
|
||||
pMemoryTable->Region[LVDBE_MEMREGION_SCRATCH].Type = LVDBE_SCRATCH;
|
||||
pMemoryTable->Region[LVDBE_MEMREGION_SCRATCH].pBaseAddress = LVM_NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Read back memory allocation table */
|
||||
*pMemoryTable = pInstance->MemoryTable;
|
||||
}
|
||||
|
||||
return(LVDBE_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION: LVDBE_Init */
|
||||
/* */
|
||||
/* DESCRIPTION: */
|
||||
/* Create and initialisation function for the Dynamic Bass Enhancement module */
|
||||
/* */
|
||||
/* This function can be used to create an algorithm instance by calling with */
|
||||
/* hInstance set to NULL. In this case the algorithm returns the new instance */
|
||||
/* handle. */
|
||||
/* */
|
||||
/* This function can be used to force a full re-initialisation of the algorithm */
|
||||
/* by calling with hInstance = Instance Handle. In this case the memory table */
|
||||
/* should be correct for the instance, this can be ensured by calling the function */
|
||||
/* DBE_Memory before calling this function. */
|
||||
/* */
|
||||
/* PARAMETERS: */
|
||||
/* hInstance Instance handle */
|
||||
/* pMemoryTable Pointer to the memory definition table */
|
||||
/* pCapabilities Pointer to the instance capabilities */
|
||||
/* */
|
||||
/* RETURNS: */
|
||||
/* LVDBE_SUCCESS Initialisation succeeded */
|
||||
/* LVDBE_ALIGNMENTERROR Instance or scratch memory on incorrect alignment */
|
||||
/* LVDBE_NULLADDRESS Instance or scratch memory has a NULL pointer */
|
||||
/* */
|
||||
/* NOTES: */
|
||||
/* 1. The instance handle is the pointer to the base address of the first memory */
|
||||
/* region. */
|
||||
/* 2. This function must not be interrupted by the LVDBE_Process function */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
|
||||
LVDBE_ReturnStatus_en LVDBE_Init(LVDBE_Handle_t *phInstance,
|
||||
LVDBE_MemTab_t *pMemoryTable,
|
||||
LVDBE_Capabilities_t *pCapabilities)
|
||||
{
|
||||
|
||||
LVDBE_Instance_t *pInstance;
|
||||
LVMixer3_1St_st *pMixer_Instance;
|
||||
LVM_INT16 i;
|
||||
LVM_INT32 MixGain;
|
||||
|
||||
|
||||
/*
|
||||
* Set the instance handle if not already initialised
|
||||
*/
|
||||
if (*phInstance == LVM_NULL)
|
||||
{
|
||||
*phInstance = (LVDBE_Handle_t)pMemoryTable->Region[LVDBE_MEMREGION_INSTANCE].pBaseAddress;
|
||||
}
|
||||
pInstance =(LVDBE_Instance_t *)*phInstance;
|
||||
|
||||
|
||||
/*
|
||||
* Check the memory table for NULL pointers and incorrectly aligned data
|
||||
*/
|
||||
for (i=0; i<LVDBE_NR_MEMORY_REGIONS; i++)
|
||||
{
|
||||
if (pMemoryTable->Region[i].Size!=0)
|
||||
{
|
||||
if (pMemoryTable->Region[i].pBaseAddress==LVM_NULL)
|
||||
{
|
||||
return(LVDBE_NULLADDRESS);
|
||||
}
|
||||
if (((LVM_UINT32)pMemoryTable->Region[i].pBaseAddress % pMemoryTable->Region[i].Alignment)!=0){
|
||||
return(LVDBE_ALIGNMENTERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Save the memory table in the instance structure
|
||||
*/
|
||||
pInstance->Capabilities = *pCapabilities;
|
||||
|
||||
|
||||
/*
|
||||
* Save the memory table in the instance structure
|
||||
*/
|
||||
pInstance->MemoryTable = *pMemoryTable;
|
||||
|
||||
|
||||
/*
|
||||
* Set the default instance parameters
|
||||
*/
|
||||
pInstance->Params.CentreFrequency = LVDBE_CENTRE_55HZ;
|
||||
pInstance->Params.EffectLevel = 0;
|
||||
pInstance->Params.HeadroomdB = 0;
|
||||
pInstance->Params.HPFSelect = LVDBE_HPF_OFF;
|
||||
pInstance->Params.OperatingMode = LVDBE_OFF;
|
||||
pInstance->Params.SampleRate = LVDBE_FS_8000;
|
||||
pInstance->Params.VolumeControl = LVDBE_VOLUME_OFF;
|
||||
pInstance->Params.VolumedB = 0;
|
||||
|
||||
|
||||
/*
|
||||
* Set pointer to data and coef memory
|
||||
*/
|
||||
pInstance->pData = pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_DATA].pBaseAddress;
|
||||
pInstance->pCoef = pMemoryTable->Region[LVDBE_MEMREGION_PERSISTENT_COEF].pBaseAddress;
|
||||
|
||||
|
||||
/*
|
||||
* Initialise the filters
|
||||
*/
|
||||
LVDBE_SetFilters(pInstance, /* Set the filter taps and coefficients */
|
||||
&pInstance->Params);
|
||||
|
||||
|
||||
/*
|
||||
* Initialise the AGC
|
||||
*/
|
||||
LVDBE_SetAGC(pInstance, /* Set the AGC gain */
|
||||
&pInstance->Params);
|
||||
pInstance->pData->AGCInstance.AGC_Gain = pInstance->pData->AGCInstance.AGC_MaxGain; /* Default to the bass boost setting */
|
||||
|
||||
|
||||
/*
|
||||
* Initialise the volume
|
||||
*/
|
||||
LVDBE_SetVolume(pInstance, /* Set the Volume */
|
||||
&pInstance->Params);
|
||||
|
||||
pInstance->pData->AGCInstance.Volume = pInstance->pData->AGCInstance.Target; /* Initialise as the target */
|
||||
|
||||
pMixer_Instance = &pInstance->pData->BypassVolume;
|
||||
MixGain = LVC_Mixer_GetTarget(&pMixer_Instance->MixerStream[0]);
|
||||
LVC_Mixer_Init(&pMixer_Instance->MixerStream[0],MixGain,MixGain);
|
||||
|
||||
/* Configure the mixer process path */
|
||||
pMixer_Instance->MixerStream[0].CallbackParam = 0;
|
||||
pMixer_Instance->MixerStream[0].pCallbackHandle = LVM_NULL;
|
||||
pMixer_Instance->MixerStream[0].pCallBack = LVM_NULL;
|
||||
pMixer_Instance->MixerStream[0].CallbackSet = 0;
|
||||
|
||||
/*
|
||||
* Initialise the clicks minimisation variable
|
||||
*/
|
||||
pInstance->bTransitionOnToOff = LVM_FALSE;
|
||||
|
||||
return(LVDBE_SUCCESS);
|
||||
}
|
||||
|
148
media/libeffects/lvm/lib/Bass/src/LVDBE_Private.h
Executable file
148
media/libeffects/lvm/lib/Bass/src/LVDBE_Private.h
Executable file
@ -0,0 +1,148 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/****************************************************************************************
|
||||
|
||||
$Author: nxp007753 $
|
||||
$Revision: 1081 $
|
||||
$Date: 2010-07-05 11:48:44 +0200 (Mon, 05 Jul 2010) $
|
||||
|
||||
*****************************************************************************************/
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* Header file for the private layer interface of Dynamic Bass Enhancement module */
|
||||
/* */
|
||||
/* This files includes all definitions, types, structures and function */
|
||||
/* prototypes required by the execution layer. */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
|
||||
#ifndef __LVDBE_PRIVATE_H__
|
||||
#define __LVDBE_PRIVATE_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* Includes */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
|
||||
#include "LVDBE.h" /* Calling or Application layer definitions */
|
||||
#include "BIQUAD.h"
|
||||
#include "LVC_Mixer.h"
|
||||
#include "AGC.h"
|
||||
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* Defines */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
|
||||
/* General */
|
||||
#define LVDBE_INVALID 0xFFFF /* Invalid init parameter */
|
||||
|
||||
/* Memory */
|
||||
#define LVDBE_MEMREGION_INSTANCE 0 /* Offset to the instance memory region */
|
||||
#define LVDBE_MEMREGION_PERSISTENT_DATA 1 /* Offset to persistent data memory region */
|
||||
#define LVDBE_MEMREGION_PERSISTENT_COEF 2 /* Offset to persistent coefficient region */
|
||||
#define LVDBE_MEMREGION_SCRATCH 3 /* Offset to data scratch memory region */
|
||||
|
||||
#define LVDBE_INSTANCE_ALIGN 4 /* 32-bit alignment for structures */
|
||||
#define LVDBE_PERSISTENT_DATA_ALIGN 4 /* 32-bit alignment for data */
|
||||
#define LVDBE_PERSISTENT_COEF_ALIGN 4 /* 32-bit alignment for coef */
|
||||
#define LVDBE_SCRATCH_ALIGN 4 /* 32-bit alignment for long data */
|
||||
|
||||
#define LVDBE_SCRATCHBUFFERS_INPLACE 4 /* Number of buffers required for inplace processing */
|
||||
|
||||
#define LVDBE_MIXER_TC 5 /* Mixer time */
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* Structures */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
|
||||
/* Data structure */
|
||||
typedef struct
|
||||
{
|
||||
/* AGC parameters */
|
||||
AGC_MIX_VOL_2St1Mon_D32_t AGCInstance; /* AGC instance parameters */
|
||||
|
||||
/* Process variables */
|
||||
Biquad_2I_Order2_Taps_t HPFTaps; /* High pass filter taps */
|
||||
Biquad_1I_Order2_Taps_t BPFTaps; /* Band pass filter taps */
|
||||
LVMixer3_1St_st BypassVolume; /* Bypass volume scaler */
|
||||
|
||||
} LVDBE_Data_t;
|
||||
|
||||
/* Coefs structure */
|
||||
typedef struct
|
||||
{
|
||||
/* Process variables */
|
||||
Biquad_Instance_t HPFInstance; /* High pass filter instance */
|
||||
Biquad_Instance_t BPFInstance; /* Band pass filter instance */
|
||||
|
||||
} LVDBE_Coef_t;
|
||||
|
||||
/* Instance structure */
|
||||
typedef struct
|
||||
{
|
||||
/* Public parameters */
|
||||
LVDBE_MemTab_t MemoryTable; /* Instance memory allocation table */
|
||||
LVDBE_Params_t Params; /* Instance parameters */
|
||||
LVDBE_Capabilities_t Capabilities; /* Instance capabilities */
|
||||
|
||||
/* Data and coefficient pointers */
|
||||
LVDBE_Data_t *pData; /* Instance data */
|
||||
LVDBE_Coef_t *pCoef; /* Instance coefficients */
|
||||
|
||||
LVM_INT32 bTransitionOnToOff;
|
||||
|
||||
} LVDBE_Instance_t;
|
||||
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* Function prototypes */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
|
||||
void LVDBE_SetAGC(LVDBE_Instance_t *pInstance,
|
||||
LVDBE_Params_t *pParams);
|
||||
|
||||
|
||||
void LVDBE_SetVolume(LVDBE_Instance_t *pInstance,
|
||||
LVDBE_Params_t *pParams);
|
||||
|
||||
|
||||
void LVDBE_SetFilters(LVDBE_Instance_t *pInstance,
|
||||
LVDBE_Params_t *pParams);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __LVDBE_PRIVATE_H__ */
|
||||
|
||||
|
205
media/libeffects/lvm/lib/Bass/src/LVDBE_Process.c
Executable file
205
media/libeffects/lvm/lib/Bass/src/LVDBE_Process.c
Executable file
@ -0,0 +1,205 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/****************************************************************************************
|
||||
|
||||
$Author: nxp007753 $
|
||||
$Revision: 1081 $
|
||||
$Date: 2010-07-05 11:48:44 +0200 (Mon, 05 Jul 2010) $
|
||||
|
||||
*****************************************************************************************/
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* Includes */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
|
||||
#include "LVDBE.h"
|
||||
#include "LVDBE_Private.h"
|
||||
#include "VectorArithmetic.h"
|
||||
#include "AGC.h"
|
||||
#include "LVDBE_Coeffs.h" /* Filter coefficients */
|
||||
|
||||
|
||||
/********************************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION: LVDBE_Process */
|
||||
/* */
|
||||
/* DESCRIPTION: */
|
||||
/* Process function for the Bass Enhancement module. */
|
||||
/* */
|
||||
/* Data can be processed in two formats, stereo or mono-in-stereo. Data in mono */
|
||||
/* format is not supported, the calling routine must convert the mono stream to */
|
||||
/* mono-in-stereo. */
|
||||
/* ___________ */
|
||||
/* ________ | | ________ */
|
||||
/* | | _____ |------------------------->| | | | */
|
||||
/* | 16-bit | | | | ________ | | | 32-bit | */
|
||||
/* -+-->| to |-->| HPF |--| | | _____ | AGC Mixer |-->| to |--| */
|
||||
/* | | 32-bit | |_____| | | Stereo | | | | | | 16-bit | | */
|
||||
/* | |________| |-->| to |-->| BPF |-->| | |________| 0 */
|
||||
/* | | Mono | |_____| |___________| \--> */
|
||||
/* | |________| */
|
||||
/* | _________ 0 */
|
||||
/* | | | | */
|
||||
/* |----------------------------------------------------| Volume |-----------------| */
|
||||
/* | Control | */
|
||||
/* |_________| */
|
||||
/* */
|
||||
/* PARAMETERS: */
|
||||
/* hInstance Instance handle */
|
||||
/* pInData Pointer to the input data */
|
||||
/* pOutData Pointer to the output data */
|
||||
/* NumSamples Number of samples in the input buffer */
|
||||
/* */
|
||||
/* RETURNS: */
|
||||
/* LVDBE_SUCCESS Succeeded */
|
||||
/* LVDBE_TOOMANYSAMPLES NumSamples was larger than the maximum block size */
|
||||
/* */
|
||||
/* NOTES: */
|
||||
/* 1. The input and output data must be 32-bit format. The input is scaled by a shift */
|
||||
/* when converting from 16-bit format, this scaling allows for internal headroom in the */
|
||||
/* bass enhancement algorithm. */
|
||||
/* 2. For a 16-bit implementation the converstion to 32-bit is removed and replaced with */
|
||||
/* the headroom loss. This headroom loss is compensated in the volume control so the */
|
||||
/* overall end to end gain is odB. */
|
||||
/* */
|
||||
/********************************************************************************************/
|
||||
|
||||
LVDBE_ReturnStatus_en LVDBE_Process(LVDBE_Handle_t hInstance,
|
||||
const LVM_INT16 *pInData,
|
||||
LVM_INT16 *pOutData,
|
||||
LVM_UINT16 NumSamples)
|
||||
{
|
||||
|
||||
LVDBE_Instance_t *pInstance =(LVDBE_Instance_t *)hInstance;
|
||||
LVM_INT32 *pScratch = (LVM_INT32 *)pInstance->MemoryTable.Region[LVDBE_MEMREGION_SCRATCH].pBaseAddress;
|
||||
LVM_INT32 *pMono = (LVM_INT32 *)pOutData;
|
||||
LVM_INT16 *pInput = (LVM_INT16 *)pInData;
|
||||
|
||||
|
||||
/*
|
||||
* Check the number of samples is not too large
|
||||
*/
|
||||
if (NumSamples > pInstance->Capabilities.MaxBlockSize)
|
||||
{
|
||||
return(LVDBE_TOOMANYSAMPLES);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if the algorithm is enabled
|
||||
*/
|
||||
if ((pInstance->Params.OperatingMode != LVDBE_OFF) ||
|
||||
(pInstance->bTransitionOnToOff == LVM_TRUE))
|
||||
{
|
||||
|
||||
/*
|
||||
* Convert 16-bit samples to 32-bit and scale
|
||||
* (For a 16-bit implementation apply headroom loss here)
|
||||
*/
|
||||
Int16LShiftToInt32_16x32(pInput, /* Source 16-bit data */
|
||||
pScratch, /* Destination 32-bit data */
|
||||
(LVM_INT16)(2*NumSamples), /* Left and right */
|
||||
LVDBE_SCALESHIFT); /* Shift scale */
|
||||
|
||||
|
||||
/*
|
||||
* Apply the high pass filter if selected
|
||||
*/
|
||||
if (pInstance->Params.HPFSelect == LVDBE_HPF_ON)
|
||||
{
|
||||
BQ_2I_D32F32C30_TRC_WRA_01(&pInstance->pCoef->HPFInstance, /* Filter instance */
|
||||
(LVM_INT32 *)pScratch, /* Source */
|
||||
(LVM_INT32 *)pScratch, /* Destination */
|
||||
(LVM_INT16)NumSamples); /* Number of samples */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Create the mono stream
|
||||
*/
|
||||
From2iToMono_32(pScratch, /* Stereo source */
|
||||
pMono, /* Mono destination */
|
||||
(LVM_INT16)NumSamples); /* Number of samples */
|
||||
|
||||
|
||||
/*
|
||||
* Apply the band pass filter
|
||||
*/
|
||||
BP_1I_D32F32C30_TRC_WRA_02(&pInstance->pCoef->BPFInstance, /* Filter instance */
|
||||
(LVM_INT32 *)pMono, /* Source */
|
||||
(LVM_INT32 *)pMono, /* Destination */
|
||||
(LVM_INT16)NumSamples); /* Number of samples */
|
||||
|
||||
|
||||
/*
|
||||
* Apply the AGC and mix
|
||||
*/
|
||||
AGC_MIX_VOL_2St1Mon_D32_WRA(&pInstance->pData->AGCInstance, /* Instance pointer */
|
||||
pScratch, /* Stereo source */
|
||||
pMono, /* Mono band pass source */
|
||||
pScratch, /* Stereo destination */
|
||||
NumSamples); /* Number of samples */
|
||||
|
||||
if(pInstance->bTransitionOnToOff == LVM_TRUE)
|
||||
{
|
||||
if ((pInstance->pData->AGCInstance.AGC_Gain == pInstance->pData->AGCInstance.AGC_Target)&&
|
||||
(pInstance->pData->AGCInstance.AGC_Gain == 0))
|
||||
{
|
||||
pInstance->bTransitionOnToOff = LVM_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Convert 32-bit samples to 16-bit and saturate
|
||||
* (Not required for 16-bit implemenations)
|
||||
*/
|
||||
Int32RShiftToInt16_Sat_32x16(pScratch, /* Source 32-bit data */
|
||||
pOutData, /* Destination 16-bit data */
|
||||
(LVM_INT16)(2*NumSamples), /* Left and right */
|
||||
LVDBE_SCALESHIFT); /* Shift scale */
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
/*
|
||||
* The algorithm is disabled but volume management is required to compensate for
|
||||
* headroom and volume (if enabled)
|
||||
*/
|
||||
LVC_MixSoft_1St_D16C31_SAT(&pInstance->pData->BypassVolume,
|
||||
pInData,
|
||||
pOutData,
|
||||
(LVM_INT16)(2*NumSamples)); /* Left and right */
|
||||
|
||||
}
|
||||
|
||||
return(LVDBE_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
463
media/libeffects/lvm/lib/Bass/src/LVDBE_Tables.c
Executable file
463
media/libeffects/lvm/lib/Bass/src/LVDBE_Tables.c
Executable file
@ -0,0 +1,463 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/************************************************************************************
|
||||
|
||||
$Author: beq07716 $
|
||||
$Revision: 1009 $
|
||||
$Date: 2010-06-28 14:14:15 +0200 (Mon, 28 Jun 2010) $
|
||||
|
||||
*************************************************************************************/
|
||||
|
||||
|
||||
/************************************************************************************/
|
||||
/* */
|
||||
/* Includes */
|
||||
/* */
|
||||
/************************************************************************************/
|
||||
|
||||
#include "LVDBE.h"
|
||||
#include "LVDBE_Coeffs.h" /* Filter coefficients */
|
||||
#include "BIQUAD.h"
|
||||
|
||||
|
||||
/************************************************************************************/
|
||||
/* */
|
||||
/* Coefficients constant table */
|
||||
/* */
|
||||
/************************************************************************************/
|
||||
|
||||
/*
|
||||
* High Pass Filter Coefficient table
|
||||
*/
|
||||
const BQ_C32_Coefs_t LVDBE_HPF_Table[] = {
|
||||
/* Coefficients for 55Hz centre frequency */
|
||||
{HPF_Fs8000_Fc55_A2, /* 8kS/s coefficients */
|
||||
HPF_Fs8000_Fc55_A1,
|
||||
HPF_Fs8000_Fc55_A0,
|
||||
-HPF_Fs8000_Fc55_B2,
|
||||
-HPF_Fs8000_Fc55_B1},
|
||||
{HPF_Fs11025_Fc55_A2, /* 11kS/s coefficients */
|
||||
HPF_Fs11025_Fc55_A1,
|
||||
HPF_Fs11025_Fc55_A0,
|
||||
-HPF_Fs11025_Fc55_B2,
|
||||
-HPF_Fs11025_Fc55_B1},
|
||||
{HPF_Fs12000_Fc55_A2, /* 12kS/s coefficients */
|
||||
HPF_Fs12000_Fc55_A1,
|
||||
HPF_Fs12000_Fc55_A0,
|
||||
-HPF_Fs12000_Fc55_B2,
|
||||
-HPF_Fs12000_Fc55_B1},
|
||||
{HPF_Fs16000_Fc55_A2, /* 16kS/s coefficients */
|
||||
HPF_Fs16000_Fc55_A1,
|
||||
HPF_Fs16000_Fc55_A0,
|
||||
-HPF_Fs16000_Fc55_B2,
|
||||
-HPF_Fs16000_Fc55_B1},
|
||||
{HPF_Fs22050_Fc55_A2, /* 22kS/s coefficients */
|
||||
HPF_Fs22050_Fc55_A1,
|
||||
HPF_Fs22050_Fc55_A0,
|
||||
-HPF_Fs22050_Fc55_B2,
|
||||
-HPF_Fs22050_Fc55_B1},
|
||||
{HPF_Fs24000_Fc55_A2, /* 24kS/s coefficients */
|
||||
HPF_Fs24000_Fc55_A1,
|
||||
HPF_Fs24000_Fc55_A0,
|
||||
-HPF_Fs24000_Fc55_B2,
|
||||
-HPF_Fs24000_Fc55_B1},
|
||||
{HPF_Fs32000_Fc55_A2, /* 32kS/s coefficients */
|
||||
HPF_Fs32000_Fc55_A1,
|
||||
HPF_Fs32000_Fc55_A0,
|
||||
-HPF_Fs32000_Fc55_B2,
|
||||
-HPF_Fs32000_Fc55_B1},
|
||||
{HPF_Fs44100_Fc55_A2, /* 44kS/s coefficients */
|
||||
HPF_Fs44100_Fc55_A1,
|
||||
HPF_Fs44100_Fc55_A0,
|
||||
-HPF_Fs44100_Fc55_B2,
|
||||
-HPF_Fs44100_Fc55_B1},
|
||||
{HPF_Fs48000_Fc55_A2, /* 48kS/s coefficients */
|
||||
HPF_Fs48000_Fc55_A1,
|
||||
HPF_Fs48000_Fc55_A0,
|
||||
-HPF_Fs48000_Fc55_B2,
|
||||
-HPF_Fs48000_Fc55_B1},
|
||||
|
||||
/* Coefficients for 66Hz centre frequency */
|
||||
{HPF_Fs8000_Fc66_A2, /* 8kS/s coefficients */
|
||||
HPF_Fs8000_Fc66_A1,
|
||||
HPF_Fs8000_Fc66_A0,
|
||||
-HPF_Fs8000_Fc66_B2,
|
||||
-HPF_Fs8000_Fc66_B1},
|
||||
{HPF_Fs11025_Fc66_A2, /* 11kS/s coefficients */
|
||||
HPF_Fs11025_Fc66_A1,
|
||||
HPF_Fs11025_Fc66_A0,
|
||||
-HPF_Fs11025_Fc66_B2,
|
||||
-HPF_Fs11025_Fc66_B1},
|
||||
{HPF_Fs12000_Fc66_A2, /* 12kS/s coefficients */
|
||||
HPF_Fs12000_Fc66_A1,
|
||||
HPF_Fs12000_Fc66_A0,
|
||||
-HPF_Fs12000_Fc66_B2,
|
||||
-HPF_Fs12000_Fc66_B1},
|
||||
{HPF_Fs16000_Fc66_A2, /* 16kS/s coefficients */
|
||||
HPF_Fs16000_Fc66_A1,
|
||||
HPF_Fs16000_Fc66_A0,
|
||||
-HPF_Fs16000_Fc66_B2,
|
||||
-HPF_Fs16000_Fc66_B1},
|
||||
{HPF_Fs22050_Fc66_A2, /* 22kS/s coefficients */
|
||||
HPF_Fs22050_Fc66_A1,
|
||||
HPF_Fs22050_Fc66_A0,
|
||||
-HPF_Fs22050_Fc66_B2,
|
||||
-HPF_Fs22050_Fc66_B1},
|
||||
{HPF_Fs24000_Fc66_A2, /* 24kS/s coefficients */
|
||||
HPF_Fs24000_Fc66_A1,
|
||||
HPF_Fs24000_Fc66_A0,
|
||||
-HPF_Fs24000_Fc66_B2,
|
||||
-HPF_Fs24000_Fc66_B1},
|
||||
{HPF_Fs32000_Fc66_A2, /* 32kS/s coefficients */
|
||||
HPF_Fs32000_Fc66_A1,
|
||||
HPF_Fs32000_Fc66_A0,
|
||||
-HPF_Fs32000_Fc66_B2,
|
||||
-HPF_Fs32000_Fc66_B1},
|
||||
{HPF_Fs44100_Fc66_A2, /* 44kS/s coefficients */
|
||||
HPF_Fs44100_Fc66_A1,
|
||||
HPF_Fs44100_Fc66_A0,
|
||||
-HPF_Fs44100_Fc66_B2,
|
||||
-HPF_Fs44100_Fc66_B1},
|
||||
{HPF_Fs48000_Fc66_A2, /* 48kS/s coefficients */
|
||||
HPF_Fs48000_Fc66_A1,
|
||||
HPF_Fs48000_Fc66_A0,
|
||||
-HPF_Fs48000_Fc66_B2,
|
||||
-HPF_Fs48000_Fc66_B1},
|
||||
|
||||
/* Coefficients for 78Hz centre frequency */
|
||||
{HPF_Fs8000_Fc78_A2, /* 8kS/s coefficients */
|
||||
HPF_Fs8000_Fc78_A1,
|
||||
HPF_Fs8000_Fc78_A0,
|
||||
-HPF_Fs8000_Fc78_B2,
|
||||
-HPF_Fs8000_Fc78_B1},
|
||||
{HPF_Fs11025_Fc78_A2, /* 11kS/s coefficients */
|
||||
HPF_Fs11025_Fc78_A1,
|
||||
HPF_Fs11025_Fc78_A0,
|
||||
-HPF_Fs11025_Fc78_B2,
|
||||
-HPF_Fs11025_Fc78_B1},
|
||||
{HPF_Fs12000_Fc78_A2, /* 12kS/s coefficients */
|
||||
HPF_Fs12000_Fc78_A1,
|
||||
HPF_Fs12000_Fc78_A0,
|
||||
-HPF_Fs12000_Fc78_B2,
|
||||
-HPF_Fs12000_Fc78_B1},
|
||||
{HPF_Fs16000_Fc78_A2, /* 16kS/s coefficients */
|
||||
HPF_Fs16000_Fc78_A1,
|
||||
HPF_Fs16000_Fc78_A0,
|
||||
-HPF_Fs16000_Fc78_B2,
|
||||
-HPF_Fs16000_Fc78_B1},
|
||||
{HPF_Fs22050_Fc78_A2, /* 22kS/s coefficients */
|
||||
HPF_Fs22050_Fc78_A1,
|
||||
HPF_Fs22050_Fc78_A0,
|
||||
-HPF_Fs22050_Fc78_B2,
|
||||
-HPF_Fs22050_Fc78_B1},
|
||||
{HPF_Fs24000_Fc78_A2, /* 24kS/s coefficients */
|
||||
HPF_Fs24000_Fc78_A1,
|
||||
HPF_Fs24000_Fc78_A0,
|
||||
-HPF_Fs24000_Fc78_B2,
|
||||
-HPF_Fs24000_Fc78_B1},
|
||||
{HPF_Fs32000_Fc78_A2, /* 32kS/s coefficients */
|
||||
HPF_Fs32000_Fc78_A1,
|
||||
HPF_Fs32000_Fc78_A0,
|
||||
-HPF_Fs32000_Fc78_B2,
|
||||
-HPF_Fs32000_Fc78_B1},
|
||||
{HPF_Fs44100_Fc78_A2, /* 44kS/s coefficients */
|
||||
HPF_Fs44100_Fc78_A1,
|
||||
HPF_Fs44100_Fc78_A0,
|
||||
-HPF_Fs44100_Fc78_B2,
|
||||
-HPF_Fs44100_Fc78_B1},
|
||||
{HPF_Fs48000_Fc78_A2, /* 48kS/s coefficients */
|
||||
HPF_Fs48000_Fc78_A1,
|
||||
HPF_Fs48000_Fc78_A0,
|
||||
-HPF_Fs48000_Fc78_B2,
|
||||
-HPF_Fs48000_Fc78_B1},
|
||||
|
||||
/* Coefficients for 90Hz centre frequency */
|
||||
{HPF_Fs8000_Fc90_A2, /* 8kS/s coefficients */
|
||||
HPF_Fs8000_Fc90_A1,
|
||||
HPF_Fs8000_Fc90_A0,
|
||||
-HPF_Fs8000_Fc90_B2,
|
||||
-HPF_Fs8000_Fc90_B1},
|
||||
{HPF_Fs11025_Fc90_A2, /* 11kS/s coefficients */
|
||||
HPF_Fs11025_Fc90_A1,
|
||||
HPF_Fs11025_Fc90_A0,
|
||||
-HPF_Fs11025_Fc90_B2,
|
||||
-HPF_Fs11025_Fc90_B1},
|
||||
{HPF_Fs12000_Fc90_A2, /* 12kS/s coefficients */
|
||||
HPF_Fs12000_Fc90_A1,
|
||||
HPF_Fs12000_Fc90_A0,
|
||||
-HPF_Fs12000_Fc90_B2,
|
||||
-HPF_Fs12000_Fc90_B1},
|
||||
{HPF_Fs16000_Fc90_A2, /* 16kS/s coefficients */
|
||||
HPF_Fs16000_Fc90_A1,
|
||||
HPF_Fs16000_Fc90_A0,
|
||||
-HPF_Fs16000_Fc90_B2,
|
||||
-HPF_Fs16000_Fc90_B1},
|
||||
{HPF_Fs22050_Fc90_A2, /* 22kS/s coefficients */
|
||||
HPF_Fs22050_Fc90_A1,
|
||||
HPF_Fs22050_Fc90_A0,
|
||||
-HPF_Fs22050_Fc90_B2,
|
||||
-HPF_Fs22050_Fc90_B1},
|
||||
{HPF_Fs24000_Fc90_A2, /* 24kS/s coefficients */
|
||||
HPF_Fs24000_Fc90_A1,
|
||||
HPF_Fs24000_Fc90_A0,
|
||||
-HPF_Fs24000_Fc90_B2,
|
||||
-HPF_Fs24000_Fc90_B1},
|
||||
{HPF_Fs32000_Fc90_A2, /* 32kS/s coefficients */
|
||||
HPF_Fs32000_Fc90_A1,
|
||||
HPF_Fs32000_Fc90_A0,
|
||||
-HPF_Fs32000_Fc90_B2,
|
||||
-HPF_Fs32000_Fc90_B1},
|
||||
{HPF_Fs44100_Fc90_A2, /* 44kS/s coefficients */
|
||||
HPF_Fs44100_Fc90_A1,
|
||||
HPF_Fs44100_Fc90_A0,
|
||||
-HPF_Fs44100_Fc90_B2,
|
||||
-HPF_Fs44100_Fc90_B1},
|
||||
{HPF_Fs48000_Fc90_A2, /* 48kS/s coefficients */
|
||||
HPF_Fs48000_Fc90_A1,
|
||||
HPF_Fs48000_Fc90_A0,
|
||||
-HPF_Fs48000_Fc90_B2,
|
||||
-HPF_Fs48000_Fc90_B1}};
|
||||
|
||||
/*
|
||||
* Band Pass Filter coefficient table
|
||||
*/
|
||||
const BP_C32_Coefs_t LVDBE_BPF_Table[] = {
|
||||
/* Coefficients for 55Hz centre frequency */
|
||||
{BPF_Fs8000_Fc55_A0, /* 8kS/s coefficients */
|
||||
-BPF_Fs8000_Fc55_B2,
|
||||
-BPF_Fs8000_Fc55_B1},
|
||||
{BPF_Fs11025_Fc55_A0, /* 11kS/s coefficients */
|
||||
-BPF_Fs11025_Fc55_B2,
|
||||
-BPF_Fs11025_Fc55_B1},
|
||||
{BPF_Fs12000_Fc55_A0, /* 12kS/s coefficients */
|
||||
-BPF_Fs12000_Fc55_B2,
|
||||
-BPF_Fs12000_Fc55_B1},
|
||||
{BPF_Fs16000_Fc55_A0, /* 16kS/s coefficients */
|
||||
-BPF_Fs16000_Fc55_B2,
|
||||
-BPF_Fs16000_Fc55_B1},
|
||||
{BPF_Fs22050_Fc55_A0, /* 22kS/s coefficients */
|
||||
-BPF_Fs22050_Fc55_B2,
|
||||
-BPF_Fs22050_Fc55_B1},
|
||||
{BPF_Fs24000_Fc55_A0, /* 24kS/s coefficients */
|
||||
-BPF_Fs24000_Fc55_B2,
|
||||
-BPF_Fs24000_Fc55_B1},
|
||||
{BPF_Fs32000_Fc55_A0, /* 32kS/s coefficients */
|
||||
-BPF_Fs32000_Fc55_B2,
|
||||
-BPF_Fs32000_Fc55_B1},
|
||||
{BPF_Fs44100_Fc55_A0, /* 44kS/s coefficients */
|
||||
-BPF_Fs44100_Fc55_B2,
|
||||
-BPF_Fs44100_Fc55_B1},
|
||||
{BPF_Fs48000_Fc55_A0, /* 48kS/s coefficients */
|
||||
-BPF_Fs48000_Fc55_B2,
|
||||
-BPF_Fs48000_Fc55_B1},
|
||||
|
||||
/* Coefficients for 66Hz centre frequency */
|
||||
{BPF_Fs8000_Fc66_A0, /* 8kS/s coefficients */
|
||||
-BPF_Fs8000_Fc66_B2,
|
||||
-BPF_Fs8000_Fc66_B1},
|
||||
{BPF_Fs11025_Fc66_A0, /* 11kS/s coefficients */
|
||||
-BPF_Fs11025_Fc66_B2,
|
||||
-BPF_Fs11025_Fc66_B1},
|
||||
{BPF_Fs12000_Fc66_A0, /* 12kS/s coefficients */
|
||||
-BPF_Fs12000_Fc66_B2,
|
||||
-BPF_Fs12000_Fc66_B1},
|
||||
{BPF_Fs16000_Fc66_A0, /* 16kS/s coefficients */
|
||||
-BPF_Fs16000_Fc66_B2,
|
||||
-BPF_Fs16000_Fc66_B1},
|
||||
{BPF_Fs22050_Fc66_A0, /* 22kS/s coefficients */
|
||||
-BPF_Fs22050_Fc66_B2,
|
||||
-BPF_Fs22050_Fc66_B1},
|
||||
{BPF_Fs24000_Fc66_A0, /* 24kS/s coefficients */
|
||||
-BPF_Fs24000_Fc66_B2,
|
||||
-BPF_Fs24000_Fc66_B1},
|
||||
{BPF_Fs32000_Fc66_A0, /* 32kS/s coefficients */
|
||||
-BPF_Fs32000_Fc66_B2,
|
||||
-BPF_Fs32000_Fc66_B1},
|
||||
{BPF_Fs44100_Fc66_A0, /* 44kS/s coefficients */
|
||||
-BPF_Fs44100_Fc66_B2,
|
||||
-BPF_Fs44100_Fc66_B1},
|
||||
{BPF_Fs48000_Fc66_A0, /* 48kS/s coefficients */
|
||||
-BPF_Fs48000_Fc66_B2,
|
||||
-BPF_Fs48000_Fc66_B1},
|
||||
|
||||
/* Coefficients for 78Hz centre frequency */
|
||||
{BPF_Fs8000_Fc78_A0, /* 8kS/s coefficients */
|
||||
-BPF_Fs8000_Fc78_B2,
|
||||
-BPF_Fs8000_Fc78_B1},
|
||||
{BPF_Fs11025_Fc78_A0, /* 11kS/s coefficients */
|
||||
-BPF_Fs11025_Fc78_B2,
|
||||
-BPF_Fs11025_Fc78_B1},
|
||||
{BPF_Fs12000_Fc78_A0, /* 12kS/s coefficients */
|
||||
-BPF_Fs12000_Fc78_B2,
|
||||
-BPF_Fs12000_Fc78_B1},
|
||||
{BPF_Fs16000_Fc78_A0, /* 16kS/s coefficients */
|
||||
-BPF_Fs16000_Fc78_B2,
|
||||
-BPF_Fs16000_Fc78_B1},
|
||||
{BPF_Fs22050_Fc78_A0, /* 22kS/s coefficients */
|
||||
-BPF_Fs22050_Fc78_B2,
|
||||
-BPF_Fs22050_Fc78_B1},
|
||||
{BPF_Fs24000_Fc78_A0, /* 24kS/s coefficients */
|
||||
-BPF_Fs24000_Fc78_B2,
|
||||
-BPF_Fs24000_Fc78_B1},
|
||||
{BPF_Fs32000_Fc78_A0, /* 32kS/s coefficients */
|
||||
-BPF_Fs32000_Fc78_B2,
|
||||
-BPF_Fs32000_Fc78_B1},
|
||||
{BPF_Fs44100_Fc78_A0, /* 44kS/s coefficients */
|
||||
-BPF_Fs44100_Fc78_B2,
|
||||
-BPF_Fs44100_Fc78_B1},
|
||||
{BPF_Fs48000_Fc78_A0, /* 48kS/s coefficients */
|
||||
-BPF_Fs48000_Fc78_B2,
|
||||
-BPF_Fs48000_Fc78_B1},
|
||||
|
||||
/* Coefficients for 90Hz centre frequency */
|
||||
{BPF_Fs8000_Fc90_A0, /* 8kS/s coefficients */
|
||||
-BPF_Fs8000_Fc90_B2,
|
||||
-BPF_Fs8000_Fc90_B1},
|
||||
{BPF_Fs11025_Fc90_A0, /* 11kS/s coefficients */
|
||||
-BPF_Fs11025_Fc90_B2,
|
||||
-BPF_Fs11025_Fc90_B1},
|
||||
{BPF_Fs12000_Fc90_A0, /* 12kS/s coefficients */
|
||||
-BPF_Fs12000_Fc90_B2,
|
||||
-BPF_Fs12000_Fc90_B1},
|
||||
{BPF_Fs16000_Fc90_A0, /* 16kS/s coefficients */
|
||||
-BPF_Fs16000_Fc90_B2,
|
||||
-BPF_Fs16000_Fc90_B1},
|
||||
{BPF_Fs22050_Fc90_A0, /* 22kS/s coefficients */
|
||||
-BPF_Fs22050_Fc90_B2,
|
||||
-BPF_Fs22050_Fc90_B1},
|
||||
{BPF_Fs24000_Fc90_A0, /* 24kS/s coefficients */
|
||||
-BPF_Fs24000_Fc90_B2,
|
||||
-BPF_Fs24000_Fc90_B1},
|
||||
{BPF_Fs32000_Fc90_A0, /* 32kS/s coefficients */
|
||||
-BPF_Fs32000_Fc90_B2,
|
||||
-BPF_Fs32000_Fc90_B1},
|
||||
{BPF_Fs44100_Fc90_A0, /* 44kS/s coefficients */
|
||||
-BPF_Fs44100_Fc90_B2,
|
||||
-BPF_Fs44100_Fc90_B1},
|
||||
{BPF_Fs48000_Fc90_A0, /* 48kS/s coefficients */
|
||||
-BPF_Fs48000_Fc90_B2,
|
||||
-BPF_Fs48000_Fc90_B1}};
|
||||
|
||||
|
||||
/************************************************************************************/
|
||||
/* */
|
||||
/* AGC constant tables */
|
||||
/* */
|
||||
/************************************************************************************/
|
||||
|
||||
/* Attack time (signal too large) */
|
||||
const LVM_INT16 LVDBE_AGC_ATTACK_Table[] = {
|
||||
AGC_ATTACK_Fs8000,
|
||||
AGC_ATTACK_Fs11025,
|
||||
AGC_ATTACK_Fs12000,
|
||||
AGC_ATTACK_Fs16000,
|
||||
AGC_ATTACK_Fs22050,
|
||||
AGC_ATTACK_Fs24000,
|
||||
AGC_ATTACK_Fs32000,
|
||||
AGC_ATTACK_Fs44100,
|
||||
AGC_ATTACK_Fs48000};
|
||||
|
||||
/* Decay time (signal too small) */
|
||||
const LVM_INT16 LVDBE_AGC_DECAY_Table[] = {
|
||||
AGC_DECAY_Fs8000,
|
||||
AGC_DECAY_Fs11025,
|
||||
AGC_DECAY_Fs12000,
|
||||
AGC_DECAY_Fs16000,
|
||||
AGC_DECAY_Fs22050,
|
||||
AGC_DECAY_Fs24000,
|
||||
AGC_DECAY_Fs32000,
|
||||
AGC_DECAY_Fs44100,
|
||||
AGC_DECAY_Fs48000};
|
||||
|
||||
/* Gain for use without the high pass filter */
|
||||
const LVM_INT32 LVDBE_AGC_GAIN_Table[] = {
|
||||
AGC_GAIN_0dB,
|
||||
AGC_GAIN_1dB,
|
||||
AGC_GAIN_2dB,
|
||||
AGC_GAIN_3dB,
|
||||
AGC_GAIN_4dB,
|
||||
AGC_GAIN_5dB,
|
||||
AGC_GAIN_6dB,
|
||||
AGC_GAIN_7dB,
|
||||
AGC_GAIN_8dB,
|
||||
AGC_GAIN_9dB,
|
||||
AGC_GAIN_10dB,
|
||||
AGC_GAIN_11dB,
|
||||
AGC_GAIN_12dB,
|
||||
AGC_GAIN_13dB,
|
||||
AGC_GAIN_14dB,
|
||||
AGC_GAIN_15dB};
|
||||
|
||||
/* Gain for use with the high pass filter */
|
||||
const LVM_INT32 LVDBE_AGC_HPFGAIN_Table[] = {
|
||||
AGC_HPFGAIN_0dB,
|
||||
AGC_HPFGAIN_1dB,
|
||||
AGC_HPFGAIN_2dB,
|
||||
AGC_HPFGAIN_3dB,
|
||||
AGC_HPFGAIN_4dB,
|
||||
AGC_HPFGAIN_5dB,
|
||||
AGC_HPFGAIN_6dB,
|
||||
AGC_HPFGAIN_7dB,
|
||||
AGC_HPFGAIN_8dB,
|
||||
AGC_HPFGAIN_9dB,
|
||||
AGC_HPFGAIN_10dB,
|
||||
AGC_HPFGAIN_11dB,
|
||||
AGC_HPFGAIN_12dB,
|
||||
AGC_HPFGAIN_13dB,
|
||||
AGC_HPFGAIN_14dB,
|
||||
AGC_HPFGAIN_15dB};
|
||||
|
||||
|
||||
/************************************************************************************/
|
||||
/* */
|
||||
/* Volume control gain and time constant tables */
|
||||
/* */
|
||||
/************************************************************************************/
|
||||
|
||||
/* dB to linear conversion table */
|
||||
const LVM_INT16 LVDBE_VolumeTable[] = {
|
||||
0x4000, /* -6dB */
|
||||
0x47FB, /* -5dB */
|
||||
0x50C3, /* -4dB */
|
||||
0x5A9E, /* -3dB */
|
||||
0x65AD, /* -2dB */
|
||||
0x7215, /* -1dB */
|
||||
0x7FFF}; /* 0dB */
|
||||
|
||||
const LVM_INT16 LVDBE_VolumeTCTable[] = {
|
||||
VOL_TC_Fs8000,
|
||||
VOL_TC_Fs11025,
|
||||
VOL_TC_Fs12000,
|
||||
VOL_TC_Fs16000,
|
||||
VOL_TC_Fs22050,
|
||||
VOL_TC_Fs24000,
|
||||
VOL_TC_Fs32000,
|
||||
VOL_TC_Fs44100,
|
||||
VOL_TC_Fs48000};
|
||||
|
||||
const LVM_INT16 LVDBE_MixerTCTable[] = {
|
||||
MIX_TC_Fs8000,
|
||||
MIX_TC_Fs11025,
|
||||
MIX_TC_Fs12000,
|
||||
MIX_TC_Fs16000,
|
||||
MIX_TC_Fs22050,
|
||||
MIX_TC_Fs24000,
|
||||
MIX_TC_Fs32000,
|
||||
MIX_TC_Fs44100,
|
||||
MIX_TC_Fs48000};
|
||||
|
||||
|
93
media/libeffects/lvm/lib/Bass/src/LVDBE_Tables.h
Executable file
93
media/libeffects/lvm/lib/Bass/src/LVDBE_Tables.h
Executable file
@ -0,0 +1,93 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/************************************************************************************
|
||||
|
||||
$Author: beq07716 $
|
||||
$Revision: 1009 $
|
||||
$Date: 2010-06-28 14:14:15 +0200 (Mon, 28 Jun 2010) $
|
||||
|
||||
*************************************************************************************/
|
||||
|
||||
|
||||
/************************************************************************************/
|
||||
/* */
|
||||
/* Includes */
|
||||
/* */
|
||||
/************************************************************************************/
|
||||
#ifndef __LVBDE_TABLES_H__
|
||||
#define __LVBDE_TABLES_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include "BIQUAD.h"
|
||||
#include "LVM_Types.h"
|
||||
|
||||
/************************************************************************************/
|
||||
/* */
|
||||
/* Coefficients constant table */
|
||||
/* */
|
||||
/************************************************************************************/
|
||||
|
||||
/*
|
||||
* High Pass Filter Coefficient table
|
||||
*/
|
||||
extern const BQ_C32_Coefs_t LVDBE_HPF_Table[];
|
||||
|
||||
/*
|
||||
* Band Pass Filter coefficient table
|
||||
*/
|
||||
extern const BP_C32_Coefs_t LVDBE_BPF_Table[];
|
||||
|
||||
/************************************************************************************/
|
||||
/* */
|
||||
/* AGC constant tables */
|
||||
/* */
|
||||
/************************************************************************************/
|
||||
|
||||
/* Attack time (signal too large) */
|
||||
extern const LVM_INT16 LVDBE_AGC_ATTACK_Table[];
|
||||
|
||||
/* Decay time (signal too small) */
|
||||
extern const LVM_INT16 LVDBE_AGC_DECAY_Table[];
|
||||
|
||||
/* Gain for use without the high pass filter */
|
||||
extern const LVM_INT32 LVDBE_AGC_GAIN_Table[];
|
||||
|
||||
/* Gain for use with the high pass filter */
|
||||
extern const LVM_INT32 LVDBE_AGC_HPFGAIN_Table[];
|
||||
|
||||
/************************************************************************************/
|
||||
/* */
|
||||
/* Volume control gain and time constant tables */
|
||||
/* */
|
||||
/************************************************************************************/
|
||||
|
||||
/* dB to linear conversion table */
|
||||
extern const LVM_INT16 LVDBE_VolumeTable[];
|
||||
|
||||
extern const LVM_INT16 LVDBE_VolumeTCTable[];
|
||||
|
||||
extern const LVM_INT16 LVDBE_MixerTCTable[];
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __LVBDE_TABLES_H__ */
|
637
media/libeffects/lvm/lib/Bundle/lib/LVM.h
Executable file
637
media/libeffects/lvm/lib/Bundle/lib/LVM.h
Executable file
@ -0,0 +1,637 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*****************************************************************************************
|
||||
|
||||
$Author: beq07716 $
|
||||
$Revision: 1002 $
|
||||
$Date: 2010-06-28 13:40:09 +0200 (Mon, 28 Jun 2010) $
|
||||
|
||||
*****************************************************************************************/
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* Header file for the application layer interface of Concert Sound, Bass Enhancement, */
|
||||
/* Equalizer, Power Spectrum Analyzer, Trebble Enhancement and volume management */
|
||||
/* bundle. */
|
||||
/* */
|
||||
/* This files includes all definitions, types, structures and function */
|
||||
/* prototypes required by the calling layer. All other types, structures and */
|
||||
/* functions are private. */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* Note: 1 */
|
||||
/* ======= */
|
||||
/* The algorithm can execute either with separate input and output buffers or with */
|
||||
/* a common buffer, i.e. the data is processed in-place. */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* Note: 2 */
|
||||
/* ======= */
|
||||
/* Three data formats are support Stereo,Mono-In-Stereo and Mono. The data is */
|
||||
/* interleaved as follows: */
|
||||
/* */
|
||||
/* Byte Offset Stereo Input Mono-In-Stereo Input Mono Input */
|
||||
/* =========== ============ ==================== ============== */
|
||||
/* 0 Left Sample #1 Mono Sample #1 Mono Sample #1 */
|
||||
/* 2 Right Sample #1 Mono Sample #1 Mono Sample #2 */
|
||||
/* 4 Left Sample #2 Mono Sample #2 Mono Sample #3 */
|
||||
/* 6 Right Sample #2 Mono Sample #2 Mono Sample #4 */
|
||||
/* . . . . */
|
||||
/* . . . . */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
|
||||
#ifndef __LVM_H__
|
||||
#define __LVM_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* Includes */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
|
||||
#include "LVM_Types.h"
|
||||
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* Definitions */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
|
||||
/* Memory table*/
|
||||
#define LVM_NR_MEMORY_REGIONS 4 /* Number of memory regions */
|
||||
|
||||
/* Concert Sound effect level presets */
|
||||
#define LVM_CS_EFFECT_NONE 0 /* 0% effect, minimum value */
|
||||
#define LVM_CS_EFFECT_LOW 16384 /* 50% effect */
|
||||
#define LVM_CS_EFFECT_MED 24576 /* 75% effect */
|
||||
#define LVM_CS_EFFECT_HIGH 32767 /* 100% effect, maximum value */
|
||||
|
||||
/* Treble enhancement */
|
||||
#define LVM_TE_LOW_MIPS 32767
|
||||
|
||||
/* Bass enhancement effect level presets */
|
||||
#define LVM_BE_0DB 0 /* 0dB boost, no effect */
|
||||
#define LVM_BE_3DB 3 /* +3dB boost */
|
||||
#define LVM_BE_6DB 6 /* +6dB boost */
|
||||
#define LVM_BE_9DB 9 /* +9dB boost */
|
||||
#define LVM_BE_12DB 12 /* +12dB boost */
|
||||
#define LVM_BE_15DB 15 /* +15dB boost */
|
||||
|
||||
/* N-Band Equalizer */
|
||||
#define LVM_EQ_NBANDS 5 /* Number of bands for equalizer */
|
||||
|
||||
/* Headroom management */
|
||||
#define LVM_HEADROOM_MAX_NBANDS 5
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* Types */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
|
||||
/* Instance handle */
|
||||
typedef void *LVM_Handle_t;
|
||||
|
||||
|
||||
/* Status return values */
|
||||
typedef enum
|
||||
{
|
||||
LVM_SUCCESS = 0, /* Successful return from a routine */
|
||||
LVM_ALIGNMENTERROR = 1, /* Memory alignment error */
|
||||
LVM_NULLADDRESS = 2, /* NULL allocation address */
|
||||
LVM_OUTOFRANGE = 3, /* Out of range control parameter */
|
||||
LVM_INVALIDNUMSAMPLES = 4, /* Invalid number of samples */
|
||||
LVM_WRONGAUDIOTIME = 5, /* Wrong time value for audio time*/
|
||||
LVM_ALGORITHMDISABLED = 6, /* Algorithm is disabled*/
|
||||
LVM_ALGORITHMPSA = 7, /* Algorithm PSA returns an error */
|
||||
LVM_RETURNSTATUS_DUMMY = LVM_MAXENUM
|
||||
} LVM_ReturnStatus_en;
|
||||
|
||||
|
||||
/* Buffer Management mode */
|
||||
typedef enum
|
||||
{
|
||||
LVM_MANAGED_BUFFERS = 0,
|
||||
LVM_UNMANAGED_BUFFERS = 1,
|
||||
LVM_BUFFERS_DUMMY = LVM_MAXENUM
|
||||
} LVM_BufferMode_en;
|
||||
|
||||
/* Output device type */
|
||||
typedef enum
|
||||
{
|
||||
LVM_HEADPHONES = 0,
|
||||
LVM_EX_HEADPHONES = 1,
|
||||
LVM_SPEAKERTYPE_MAX = LVM_MAXENUM
|
||||
} LVM_OutputDeviceType_en;
|
||||
|
||||
/* Virtualizer mode selection*/
|
||||
typedef enum
|
||||
{
|
||||
LVM_CONCERTSOUND = 0,
|
||||
LVM_VIRTUALIZERTYPE_DUMMY = LVM_MAXENUM
|
||||
} LVM_VirtualizerType_en;
|
||||
|
||||
/* N-Band Equaliser operating mode */
|
||||
typedef enum
|
||||
{
|
||||
LVM_EQNB_OFF = 0,
|
||||
LVM_EQNB_ON = 1,
|
||||
LVM_EQNB_DUMMY = LVM_MAXENUM
|
||||
} LVM_EQNB_Mode_en;
|
||||
|
||||
/* Bass Enhancement operating mode */
|
||||
typedef enum
|
||||
{
|
||||
LVM_BE_OFF = 0,
|
||||
LVM_BE_ON = 1,
|
||||
LVM_BE_DUMMY = LVM_MAXENUM
|
||||
} LVM_BE_Mode_en;
|
||||
|
||||
/* Bass Enhancement centre frequency selection control */
|
||||
typedef enum
|
||||
{
|
||||
LVM_BE_CENTRE_55Hz = 0,
|
||||
LVM_BE_CENTRE_66Hz = 1,
|
||||
LVM_BE_CENTRE_78Hz = 2,
|
||||
LVM_BE_CENTRE_90Hz = 3,
|
||||
LVM_BE_CENTRE_DUMMY = LVM_MAXENUM
|
||||
} LVM_BE_CentreFreq_en;
|
||||
|
||||
/* Bass Enhancement HPF selection control */
|
||||
typedef enum
|
||||
{
|
||||
LVM_BE_HPF_OFF = 0,
|
||||
LVM_BE_HPF_ON = 1,
|
||||
LVM_BE_HPF_DUMMY = LVM_MAXENUM
|
||||
} LVM_BE_FilterSelect_en;
|
||||
|
||||
/* Volume Control operating mode */
|
||||
typedef enum
|
||||
{
|
||||
LVM_VC_OFF = 0,
|
||||
LVM_VC_ON = 1,
|
||||
LVM_VC_DUMMY = LVM_MAXENUM
|
||||
} LVM_VC_Mode_en;
|
||||
|
||||
/* Treble Enhancement operating mode */
|
||||
typedef enum
|
||||
{
|
||||
LVM_TE_OFF = 0,
|
||||
LVM_TE_ON = 1,
|
||||
LVM_TE_DUMMY = LVM_MAXENUM
|
||||
} LVM_TE_Mode_en;
|
||||
|
||||
/* Headroom management operating mode */
|
||||
typedef enum
|
||||
{
|
||||
LVM_HEADROOM_OFF = 0,
|
||||
LVM_HEADROOM_ON = 1,
|
||||
LVM_Headroom_DUMMY = LVM_MAXENUM
|
||||
} LVM_Headroom_Mode_en;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
LVM_PSA_SPEED_SLOW, /* Peak decaying at slow speed */
|
||||
LVM_PSA_SPEED_MEDIUM, /* Peak decaying at medium speed */
|
||||
LVM_PSA_SPEED_FAST, /* Peak decaying at fast speed */
|
||||
LVM_PSA_SPEED_DUMMY = LVM_MAXENUM
|
||||
} LVM_PSA_DecaySpeed_en;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
LVM_PSA_OFF = 0,
|
||||
LVM_PSA_ON = 1,
|
||||
LVM_PSA_DUMMY = LVM_MAXENUM
|
||||
} LVM_PSA_Mode_en;
|
||||
|
||||
/* Version information */
|
||||
typedef struct
|
||||
{
|
||||
LVM_CHAR *pVersionNumber; /* Pointer to the version number in the format X.YY.ZZ */
|
||||
LVM_CHAR *pPlatform; /* Pointer to the library platform type */
|
||||
} LVM_VersionInfo_st;
|
||||
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* Structures */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
|
||||
/* Memory table containing the region definitions */
|
||||
typedef struct
|
||||
{
|
||||
LVM_MemoryRegion_st Region[LVM_NR_MEMORY_REGIONS]; /* One definition for each region */
|
||||
} LVM_MemTab_t;
|
||||
|
||||
/* N-Band equaliser band definition */
|
||||
typedef struct
|
||||
{
|
||||
LVM_INT16 Gain; /* Band gain in dB */
|
||||
LVM_UINT16 Frequency; /* Band centre frequency in Hz */
|
||||
LVM_UINT16 QFactor; /* Band quality factor (x100) */
|
||||
} LVM_EQNB_BandDef_t;
|
||||
|
||||
|
||||
/* Headroom band definition */
|
||||
typedef struct
|
||||
{
|
||||
LVM_UINT16 Limit_Low; /* Low frequency limit of the band in Hertz */
|
||||
LVM_UINT16 Limit_High; /* High frequency limit of the band in Hertz */
|
||||
LVM_INT16 Headroom_Offset; /* Headroom = biggest band gain - Headroom_Offset */
|
||||
} LVM_HeadroomBandDef_t;
|
||||
|
||||
|
||||
/* Control Parameter structure */
|
||||
typedef struct
|
||||
{
|
||||
/* General parameters */
|
||||
LVM_Mode_en OperatingMode; /* Bundle operating mode On/Bypass */
|
||||
LVM_Fs_en SampleRate; /* Sample rate */
|
||||
LVM_Format_en SourceFormat; /* Input data format */
|
||||
LVM_OutputDeviceType_en SpeakerType; /* Output device type */
|
||||
|
||||
/* Concert Sound Virtualizer parameters*/
|
||||
LVM_Mode_en VirtualizerOperatingMode; /* Virtualizer operating mode On/Off */
|
||||
LVM_VirtualizerType_en VirtualizerType; /* Virtualizer type: ConcertSound */
|
||||
LVM_UINT16 VirtualizerReverbLevel; /* Virtualizer reverb level in % */
|
||||
LVM_INT16 CS_EffectLevel; /* Concert Sound effect level */
|
||||
|
||||
/* N-Band Equaliser parameters */
|
||||
LVM_EQNB_Mode_en EQNB_OperatingMode; /* N-Band Equaliser operating mode */
|
||||
LVM_UINT16 EQNB_NBands; /* Number of bands */
|
||||
LVM_EQNB_BandDef_t *pEQNB_BandDefinition; /* Pointer to equaliser definitions */
|
||||
|
||||
/* Bass Enhancement parameters */
|
||||
LVM_BE_Mode_en BE_OperatingMode; /* Bass Enhancement operating mode */
|
||||
LVM_INT16 BE_EffectLevel; /* Bass Enhancement effect level */
|
||||
LVM_BE_CentreFreq_en BE_CentreFreq; /* Bass Enhancement centre frequency */
|
||||
LVM_BE_FilterSelect_en BE_HPF; /* Bass Enhancement high pass filter selector */
|
||||
|
||||
/* Volume Control parameters */
|
||||
LVM_INT16 VC_EffectLevel; /* Volume Control setting in dBs */
|
||||
LVM_INT16 VC_Balance; /* Left Right Balance control in dB (-96 to 96 dB), -ve values reduce
|
||||
Right channel while +ve value reduces Left channel*/
|
||||
|
||||
/* Treble Enhancement parameters */
|
||||
LVM_TE_Mode_en TE_OperatingMode; /* Treble Enhancement On/Off */
|
||||
LVM_INT16 TE_EffectLevel; /* Treble Enhancement gain dBs */
|
||||
|
||||
/* Spectrum Analyzer parameters Control */
|
||||
LVM_PSA_Mode_en PSA_Enable;
|
||||
LVM_PSA_DecaySpeed_en PSA_PeakDecayRate; /* Peak value decay rate*/
|
||||
|
||||
} LVM_ControlParams_t;
|
||||
|
||||
|
||||
/* Instance Parameter structure */
|
||||
typedef struct
|
||||
{
|
||||
/* General */
|
||||
LVM_BufferMode_en BufferMode; /* Buffer management mode */
|
||||
LVM_UINT16 MaxBlockSize; /* Maximum processing block size */
|
||||
|
||||
/* N-Band Equaliser */
|
||||
LVM_UINT16 EQNB_NumBands; /* Maximum number of equaliser bands */
|
||||
|
||||
/* PSA */
|
||||
LVM_PSA_Mode_en PSA_Included; /* Controls the instance memory allocation for PSA: ON/OFF */
|
||||
} LVM_InstParams_t;
|
||||
|
||||
/* Headroom management parameter structure */
|
||||
typedef struct
|
||||
{
|
||||
LVM_Headroom_Mode_en Headroom_OperatingMode; /* Headroom Control On/Off */
|
||||
LVM_HeadroomBandDef_t *pHeadroomDefinition; /* Pointer to headroom bands definition */
|
||||
LVM_UINT16 NHeadroomBands; /* Number of headroom bands */
|
||||
|
||||
} LVM_HeadroomParams_t;
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* Function Prototypes */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION: LVM_GetVersionInfo */
|
||||
/* */
|
||||
/* DESCRIPTION: */
|
||||
/* This function is used to retrieve information about the library's version. */
|
||||
/* */
|
||||
/* PARAMETERS: */
|
||||
/* pVersion Pointer to an empty version info structure */
|
||||
/* */
|
||||
/* RETURNS: */
|
||||
/* LVM_SUCCESS Succeeded */
|
||||
/* LVM_NULLADDRESS when pVersion is NULL */
|
||||
/* */
|
||||
/* NOTES: */
|
||||
/* 1. This function may be interrupted by the LVM_Process function */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
LVM_ReturnStatus_en LVM_GetVersionInfo(LVM_VersionInfo_st *pVersion);
|
||||
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION: LVM_GetMemoryTable */
|
||||
/* */
|
||||
/* DESCRIPTION: */
|
||||
/* This function is used for memory allocation and free. It can be called in */
|
||||
/* two ways: */
|
||||
/* */
|
||||
/* hInstance = NULL Returns the memory requirements */
|
||||
/* hInstance = Instance handle Returns the memory requirements and */
|
||||
/* allocated base addresses for the instance */
|
||||
/* */
|
||||
/* When this function is called for memory allocation (hInstance=NULL) the memory */
|
||||
/* base address pointers are NULL on return. */
|
||||
/* */
|
||||
/* When the function is called for free (hInstance = Instance Handle) the memory */
|
||||
/* table returns the allocated memory and base addresses used during initialisation. */
|
||||
/* */
|
||||
/* PARAMETERS: */
|
||||
/* hInstance Instance Handle */
|
||||
/* pMemoryTable Pointer to an empty memory definition table */
|
||||
/* pInstParams Pointer to the instance parameters */
|
||||
/* */
|
||||
/* RETURNS: */
|
||||
/* LVM_SUCCESS Succeeded */
|
||||
/* LVM_NULLADDRESS When one of pMemoryTable or pInstParams is NULL */
|
||||
/* LVM_OUTOFRANGE When any of the Instance parameters are out of range */
|
||||
/* */
|
||||
/* NOTES: */
|
||||
/* 1. This function may be interrupted by the LVM_Process function */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
LVM_ReturnStatus_en LVM_GetMemoryTable(LVM_Handle_t hInstance,
|
||||
LVM_MemTab_t *pMemoryTable,
|
||||
LVM_InstParams_t *pInstParams);
|
||||
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION: LVM_GetInstanceHandle */
|
||||
/* */
|
||||
/* DESCRIPTION: */
|
||||
/* This function is used to create a bundle instance. It returns the created instance */
|
||||
/* handle through phInstance. All parameters are set to their default, inactive state. */
|
||||
/* */
|
||||
/* PARAMETERS: */
|
||||
/* phInstance pointer to the instance handle */
|
||||
/* pMemoryTable Pointer to the memory definition table */
|
||||
/* pInstParams Pointer to the instance parameters */
|
||||
/* */
|
||||
/* RETURNS: */
|
||||
/* LVM_SUCCESS Initialisation succeeded */
|
||||
/* LVM_NULLADDRESS One or more memory has a NULL pointer */
|
||||
/* LVM_OUTOFRANGE When any of the Instance parameters are out of range */
|
||||
/* */
|
||||
/* NOTES: */
|
||||
/* 1. This function must not be interrupted by the LVM_Process function */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
LVM_ReturnStatus_en LVM_GetInstanceHandle(LVM_Handle_t *phInstance,
|
||||
LVM_MemTab_t *pMemoryTable,
|
||||
LVM_InstParams_t *pInstParams);
|
||||
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION: LVM_ClearAudioBuffers */
|
||||
/* */
|
||||
/* DESCRIPTION: */
|
||||
/* This function is used to clear the internal audio buffers of the bundle. */
|
||||
/* */
|
||||
/* PARAMETERS: */
|
||||
/* hInstance Instance handle */
|
||||
/* */
|
||||
/* RETURNS: */
|
||||
/* LVM_SUCCESS Initialisation succeeded */
|
||||
/* LVM_NULLADDRESS Instance memory has a NULL pointer */
|
||||
/* */
|
||||
/* NOTES: */
|
||||
/* 1. This function must not be interrupted by the LVM_Process function */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
LVM_ReturnStatus_en LVM_ClearAudioBuffers(LVM_Handle_t hInstance);
|
||||
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION: LVM_GetControlParameters */
|
||||
/* */
|
||||
/* DESCRIPTION: */
|
||||
/* Request the LifeVibes module parameters. The current parameter set is returned */
|
||||
/* via the parameter pointer. */
|
||||
/* */
|
||||
/* PARAMETERS: */
|
||||
/* hInstance Instance handle */
|
||||
/* pParams Pointer to an empty parameter structure */
|
||||
/* */
|
||||
/* RETURNS: */
|
||||
/* LVM_SUCCESS Succeeded */
|
||||
/* LVM_NULLADDRESS when any of hInstance or pParams is NULL */
|
||||
/* */
|
||||
/* NOTES: */
|
||||
/* 1. This function may be interrupted by the LVM_Process function */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
LVM_ReturnStatus_en LVM_GetControlParameters(LVM_Handle_t hInstance,
|
||||
LVM_ControlParams_t *pParams);
|
||||
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION: LVM_SetControlParameters */
|
||||
/* */
|
||||
/* DESCRIPTION: */
|
||||
/* Sets or changes the LifeVibes module parameters. */
|
||||
/* */
|
||||
/* PARAMETERS: */
|
||||
/* hInstance Instance handle */
|
||||
/* pParams Pointer to a parameter structure */
|
||||
/* */
|
||||
/* RETURNS: */
|
||||
/* LVM_SUCCESS Succeeded */
|
||||
/* LVM_NULLADDRESS When hInstance, pParams or any control pointers are NULL */
|
||||
/* LVM_OUTOFRANGE When any of the control parameters are out of range */
|
||||
/* */
|
||||
/* NOTES: */
|
||||
/* 1. This function may be interrupted by the LVM_Process function */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
LVM_ReturnStatus_en LVM_SetControlParameters(LVM_Handle_t hInstance,
|
||||
LVM_ControlParams_t *pParams);
|
||||
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION: LVM_Process */
|
||||
/* */
|
||||
/* DESCRIPTION: */
|
||||
/* Process function for the LifeVibes module. */
|
||||
/* */
|
||||
/* PARAMETERS: */
|
||||
/* hInstance Instance handle */
|
||||
/* pInData Pointer to the input data */
|
||||
/* pOutData Pointer to the output data */
|
||||
/* NumSamples Number of samples in the input buffer */
|
||||
/* AudioTime Audio Time of the current input data in milli-seconds */
|
||||
/* */
|
||||
/* RETURNS: */
|
||||
/* LVM_SUCCESS Succeeded */
|
||||
/* LVM_INVALIDNUMSAMPLES When the NumSamples is not a valied multiple in unmanaged */
|
||||
/* buffer mode */
|
||||
/* LVM_ALIGNMENTERROR When either the input our output buffers are not 32-bit */
|
||||
/* aligned in unmanaged mode */
|
||||
/* LVM_NULLADDRESS When one of hInstance, pInData or pOutData is NULL */
|
||||
/* */
|
||||
/* NOTES: */
|
||||
/* 1. The input and output buffers must be 32-bit aligned */
|
||||
/* 2. Number of samples is defined as follows: */
|
||||
/* MONO the number of samples in the block */
|
||||
/* MONOINSTEREO the number of sample pairs in the block */
|
||||
/* STEREO the number of sample pairs in the block */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
LVM_ReturnStatus_en LVM_Process(LVM_Handle_t hInstance,
|
||||
const LVM_INT16 *pInData,
|
||||
LVM_INT16 *pOutData,
|
||||
LVM_UINT16 NumSamples,
|
||||
LVM_UINT32 AudioTime);
|
||||
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION: LVM_SetHeadroomParams */
|
||||
/* */
|
||||
/* DESCRIPTION: */
|
||||
/* This function is used to set the automatic headroom management parameters. */
|
||||
/* */
|
||||
/* PARAMETERS: */
|
||||
/* hInstance Instance Handle */
|
||||
/* pHeadroomParams Pointer to headroom parameter structure */
|
||||
/* */
|
||||
/* RETURNS: */
|
||||
/* LVM_NULLADDRESS When hInstance or pHeadroomParams is NULL */
|
||||
/* LVM_SUCCESS Succeeded */
|
||||
/* */
|
||||
/* NOTES: */
|
||||
/* 1. This function may be interrupted by the LVM_Process function */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
LVM_ReturnStatus_en LVM_SetHeadroomParams( LVM_Handle_t hInstance,
|
||||
LVM_HeadroomParams_t *pHeadroomParams);
|
||||
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION: LVM_GetHeadroomParams */
|
||||
/* */
|
||||
/* DESCRIPTION: */
|
||||
/* This function is used to get the automatic headroom management parameters. */
|
||||
/* */
|
||||
/* PARAMETERS: */
|
||||
/* hInstance Instance Handle */
|
||||
/* pHeadroomParams Pointer to headroom parameter structure (output) */
|
||||
/* */
|
||||
/* RETURNS: */
|
||||
/* LVM_SUCCESS Succeeded */
|
||||
/* LVM_NULLADDRESS When hInstance or pHeadroomParams are NULL */
|
||||
/* */
|
||||
/* NOTES: */
|
||||
/* 1. This function may be interrupted by the LVM_Process function */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
LVM_ReturnStatus_en LVM_GetHeadroomParams( LVM_Handle_t hInstance,
|
||||
LVM_HeadroomParams_t *pHeadroomParams);
|
||||
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION: LVM_GetSpectrum */
|
||||
/* */
|
||||
/* DESCRIPTION: */
|
||||
/* This function is used to retrieve Spectral information at a given Audio time */
|
||||
/* for display usage */
|
||||
/* */
|
||||
/* PARAMETERS: */
|
||||
/* hInstance Instance Handle */
|
||||
/* pCurrentPeaks Pointer to location where currents peaks are to be saved */
|
||||
/* pPastPeaks Pointer to location where past peaks are to be saved */
|
||||
/* pCentreFreqs Pointer to location where centre frequency of each band is */
|
||||
/* to be saved */
|
||||
/* AudioTime Audio time at which the spectral information is needed */
|
||||
/* */
|
||||
/* RETURNS: */
|
||||
/* LVM_SUCCESS Succeeded */
|
||||
/* LVM_NULLADDRESS If any of input addresses are NULL */
|
||||
/* LVM_WRONGAUDIOTIME Failure due to audio time error */
|
||||
/* */
|
||||
/* NOTES: */
|
||||
/* 1. This function may be interrupted by the LVM_Process function */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
LVM_ReturnStatus_en LVM_GetSpectrum( LVM_Handle_t hInstance,
|
||||
LVM_UINT8 *pCurrentPeaks,
|
||||
LVM_UINT8 *pPastPeaks,
|
||||
LVM_INT32 AudioTime);
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION: LVM_SetVolumeNoSmoothing */
|
||||
/* */
|
||||
/* DESCRIPTION: */
|
||||
/* This function is used to set output volume without any smoothing */
|
||||
/* */
|
||||
/* PARAMETERS: */
|
||||
/* hInstance Instance Handle */
|
||||
/* pParams Control Parameters, only volume value is used here */
|
||||
/* */
|
||||
/* RETURNS: */
|
||||
/* LVM_SUCCESS Succeeded */
|
||||
/* LVM_NULLADDRESS If any of input addresses are NULL */
|
||||
/* LVM_OUTOFRANGE When any of the control parameters are out of range */
|
||||
/* */
|
||||
/* NOTES: */
|
||||
/* 1. This function may be interrupted by the LVM_Process function */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
LVM_ReturnStatus_en LVM_SetVolumeNoSmoothing( LVM_Handle_t hInstance,
|
||||
LVM_ControlParams_t *pParams);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __LVM_H__ */
|
||||
|
158
media/libeffects/lvm/lib/Bundle/src/LVM_API_Specials.c
Executable file
158
media/libeffects/lvm/lib/Bundle/src/LVM_API_Specials.c
Executable file
@ -0,0 +1,158 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/****************************************************************************************
|
||||
|
||||
$Author: beq07716 $
|
||||
$Revision: 1002 $
|
||||
$Date: 2010-06-28 13:40:09 +0200 (Mon, 28 Jun 2010) $
|
||||
|
||||
*****************************************************************************************/
|
||||
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* Includes */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
|
||||
#include "LVM_Private.h"
|
||||
#include "LVM_Tables.h"
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION: LVM_GetSpectrum */
|
||||
/* */
|
||||
/* DESCRIPTION: */
|
||||
/* This function is used to retrieve Spectral information at a given Audio time */
|
||||
/* for display usage */
|
||||
/* */
|
||||
/* PARAMETERS: */
|
||||
/* hInstance Instance Handle */
|
||||
/* pCurrentPeaks Pointer to location where currents peaks are to be saved */
|
||||
/* pPastPeaks Pointer to location where past peaks are to be saved */
|
||||
/* AudioTime Audio time at which the spectral information is needed */
|
||||
/* */
|
||||
/* RETURNS: */
|
||||
/* LVM_SUCCESS Succeeded */
|
||||
/* LVM_NULLADDRESS If any of input addresses are NULL */
|
||||
/* LVM_WRONGAUDIOTIME Failure due to audio time error */
|
||||
/* */
|
||||
/* NOTES: */
|
||||
/* 1. This function may be interrupted by the LVM_Process function */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
LVM_ReturnStatus_en LVM_GetSpectrum(
|
||||
LVM_Handle_t hInstance,
|
||||
LVM_UINT8 *pCurrentPeaks,
|
||||
LVM_UINT8 *pPastPeaks,
|
||||
LVM_INT32 AudioTime
|
||||
)
|
||||
{
|
||||
LVM_Instance_t *pInstance = (LVM_Instance_t *)hInstance;
|
||||
|
||||
pLVPSA_Handle_t *hPSAInstance;
|
||||
LVPSA_RETURN LVPSA_Status;
|
||||
|
||||
|
||||
if(pInstance == LVM_NULL)
|
||||
{
|
||||
return LVM_NULLADDRESS;
|
||||
}
|
||||
|
||||
/*If PSA is not included at the time of instance creation, return without any processing*/
|
||||
if(pInstance->InstParams.PSA_Included!=LVM_PSA_ON)
|
||||
{
|
||||
return LVM_SUCCESS;
|
||||
}
|
||||
|
||||
hPSAInstance = pInstance->hPSAInstance;
|
||||
|
||||
if((pCurrentPeaks == LVM_NULL) ||
|
||||
(pPastPeaks == LVM_NULL))
|
||||
{
|
||||
return LVM_NULLADDRESS;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Update new parameters if necessary
|
||||
*/
|
||||
if (pInstance->ControlPending == LVM_TRUE)
|
||||
{
|
||||
LVM_ApplyNewSettings(hInstance);
|
||||
}
|
||||
|
||||
/* If PSA module is disabled, do nothing */
|
||||
if(pInstance->Params.PSA_Enable==LVM_PSA_OFF)
|
||||
{
|
||||
return LVM_ALGORITHMDISABLED;
|
||||
}
|
||||
|
||||
LVPSA_Status = LVPSA_GetSpectrum(hPSAInstance,
|
||||
(LVPSA_Time) (AudioTime),
|
||||
(LVM_UINT8*) pCurrentPeaks,
|
||||
(LVM_UINT8*) pPastPeaks );
|
||||
|
||||
if(LVPSA_Status != LVPSA_OK)
|
||||
{
|
||||
if(LVPSA_Status == LVPSA_ERROR_WRONGTIME)
|
||||
{
|
||||
return (LVM_ReturnStatus_en) LVM_WRONGAUDIOTIME;
|
||||
}
|
||||
else
|
||||
{
|
||||
return (LVM_ReturnStatus_en) LVM_NULLADDRESS;
|
||||
}
|
||||
}
|
||||
|
||||
return(LVM_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION: LVM_SetVolumeNoSmoothing */
|
||||
/* */
|
||||
/* DESCRIPTION: */
|
||||
/* This function is used to set output volume without any smoothing */
|
||||
/* */
|
||||
/* PARAMETERS: */
|
||||
/* hInstance Instance Handle */
|
||||
/* pParams Control Parameters, only volume value is used here */
|
||||
/* */
|
||||
/* RETURNS: */
|
||||
/* LVM_SUCCESS Succeeded */
|
||||
/* LVM_NULLADDRESS If any of input addresses are NULL */
|
||||
/* LVM_OUTOFRANGE When any of the control parameters are out of range */
|
||||
/* */
|
||||
/* NOTES: */
|
||||
/* 1. This function may be interrupted by the LVM_Process function */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
LVM_ReturnStatus_en LVM_SetVolumeNoSmoothing( LVM_Handle_t hInstance,
|
||||
LVM_ControlParams_t *pParams)
|
||||
{
|
||||
LVM_Instance_t *pInstance =(LVM_Instance_t *)hInstance;
|
||||
LVM_ReturnStatus_en Error;
|
||||
|
||||
/*Apply new controls*/
|
||||
Error = LVM_SetControlParameters(hInstance,pParams);
|
||||
pInstance->NoSmoothVolume = LVM_TRUE;
|
||||
return Error;
|
||||
}
|
||||
|
878
media/libeffects/lvm/lib/Bundle/src/LVM_Buffers.c
Executable file
878
media/libeffects/lvm/lib/Bundle/src/LVM_Buffers.c
Executable file
@ -0,0 +1,878 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
/****************************************************************************************
|
||||
|
||||
$Author: nxp007753 $
|
||||
$Revision: 1082 $
|
||||
$Date: 2010-07-05 12:44:39 +0200 (Mon, 05 Jul 2010) $
|
||||
|
||||
*****************************************************************************************/
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* Includes */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
|
||||
#include "LVM_Private.h"
|
||||
#include "VectorArithmetic.h"
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION: LVM_BufferManagedIn */
|
||||
/* */
|
||||
/* DESCRIPTION: */
|
||||
/* Full buffer management allowing the user to provide input and output buffers on */
|
||||
/* any alignment and with any number of samples. The alignment is corrected within */
|
||||
/* the buffer management and the samples are grouped in to blocks of the correct size */
|
||||
/* before processing. */
|
||||
/* */
|
||||
/* PARAMETERS: */
|
||||
/* hInstance - Instance handle */
|
||||
/* pInData - Pointer to the input data stream */
|
||||
/* *pToProcess - Pointer to pointer to the start of data processing */
|
||||
/* *pProcessed - Pointer to pointer to the destination of the processed data */
|
||||
/* pNumSamples - Pointer to the number of samples to process */
|
||||
/* */
|
||||
/* RETURNS: */
|
||||
/* None */
|
||||
/* */
|
||||
/* NOTES: */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
|
||||
void LVM_BufferManagedIn(LVM_Handle_t hInstance,
|
||||
const LVM_INT16 *pInData,
|
||||
LVM_INT16 **pToProcess,
|
||||
LVM_INT16 **pProcessed,
|
||||
LVM_UINT16 *pNumSamples)
|
||||
{
|
||||
|
||||
LVM_INT16 SampleCount; /* Number of samples to be processed this call */
|
||||
LVM_INT16 NumSamples; /* Number of samples in scratch buffer */
|
||||
LVM_INT16 *pStart;
|
||||
LVM_Instance_t *pInstance = (LVM_Instance_t *)hInstance;
|
||||
LVM_Buffer_t *pBuffer;
|
||||
LVM_INT16 *pDest;
|
||||
LVM_INT16 NumChannels =2;
|
||||
|
||||
|
||||
/*
|
||||
* Set the processing address pointers
|
||||
*/
|
||||
pBuffer = pInstance->pBufferManagement;
|
||||
pDest = pBuffer->pScratch;
|
||||
*pToProcess = pBuffer->pScratch;
|
||||
*pProcessed = pBuffer->pScratch;
|
||||
|
||||
/*
|
||||
* Check if it is the first call of a block
|
||||
*/
|
||||
if (pInstance->SamplesToProcess == 0)
|
||||
{
|
||||
/*
|
||||
* First call for a new block of samples
|
||||
*/
|
||||
pInstance->SamplesToProcess = (LVM_INT16)(*pNumSamples + pBuffer->InDelaySamples);
|
||||
pInstance->pInputSamples = (LVM_INT16 *)pInData;
|
||||
pBuffer->BufferState = LVM_FIRSTCALL;
|
||||
}
|
||||
pStart = pInstance->pInputSamples; /* Pointer to the input samples */
|
||||
pBuffer->SamplesToOutput = 0; /* Samples to output is same as number read for inplace processing */
|
||||
|
||||
|
||||
/*
|
||||
* Calculate the number of samples to process this call and update the buffer state
|
||||
*/
|
||||
if (pInstance->SamplesToProcess > pInstance->InternalBlockSize)
|
||||
{
|
||||
/*
|
||||
* Process the maximum bock size of samples.
|
||||
*/
|
||||
SampleCount = pInstance->InternalBlockSize;
|
||||
NumSamples = pInstance->InternalBlockSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Last call for the block, so calculate how many frames and samples to process
|
||||
*/
|
||||
LVM_INT16 NumFrames;
|
||||
|
||||
NumSamples = pInstance->SamplesToProcess;
|
||||
NumFrames = (LVM_INT16)(NumSamples >> MIN_INTERNAL_BLOCKSHIFT);
|
||||
SampleCount = (LVM_INT16)(NumFrames << MIN_INTERNAL_BLOCKSHIFT);
|
||||
|
||||
/*
|
||||
* Update the buffer state
|
||||
*/
|
||||
if (pBuffer->BufferState == LVM_FIRSTCALL)
|
||||
{
|
||||
pBuffer->BufferState = LVM_FIRSTLASTCALL;
|
||||
}
|
||||
else
|
||||
{
|
||||
pBuffer->BufferState = LVM_LASTCALL;
|
||||
}
|
||||
}
|
||||
*pNumSamples = (LVM_UINT16)SampleCount; /* Set the number of samples to process this call */
|
||||
|
||||
|
||||
/*
|
||||
* Copy samples from the delay buffer as required
|
||||
*/
|
||||
if (((pBuffer->BufferState == LVM_FIRSTCALL) ||
|
||||
(pBuffer->BufferState == LVM_FIRSTLASTCALL)) &&
|
||||
(pBuffer->InDelaySamples != 0))
|
||||
{
|
||||
Copy_16(&pBuffer->InDelayBuffer[0], /* Source */
|
||||
pDest, /* Destination */
|
||||
(LVM_INT16)(NumChannels*pBuffer->InDelaySamples)); /* Number of delay samples, left and right */
|
||||
NumSamples = (LVM_INT16)(NumSamples - pBuffer->InDelaySamples); /* Update sample count */
|
||||
pDest += NumChannels * pBuffer->InDelaySamples; /* Update the destination pointer */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Copy the rest of the samples for this call from the input buffer
|
||||
*/
|
||||
if (NumSamples > 0)
|
||||
{
|
||||
Copy_16(pStart, /* Source */
|
||||
pDest, /* Destination */
|
||||
(LVM_INT16)(NumChannels*NumSamples)); /* Number of input samples */
|
||||
pStart += NumChannels * NumSamples; /* Update the input pointer */
|
||||
|
||||
/*
|
||||
* Update the input data pointer and samples to output
|
||||
*/
|
||||
pBuffer->SamplesToOutput = (LVM_INT16)(pBuffer->SamplesToOutput + NumSamples); /* Update samples to output */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Update the sample count and input pointer
|
||||
*/
|
||||
pInstance->SamplesToProcess = (LVM_INT16)(pInstance->SamplesToProcess - SampleCount); /* Update the count of samples */
|
||||
pInstance->pInputSamples = pStart; /* Update input sample pointer */
|
||||
|
||||
|
||||
/*
|
||||
* Save samples to the delay buffer if any left unprocessed
|
||||
*/
|
||||
if ((pBuffer->BufferState == LVM_FIRSTLASTCALL) ||
|
||||
(pBuffer->BufferState == LVM_LASTCALL))
|
||||
{
|
||||
NumSamples = pInstance->SamplesToProcess;
|
||||
pStart = pBuffer->pScratch; /* Start of the buffer */
|
||||
pStart += NumChannels*SampleCount; /* Offset by the number of processed samples */
|
||||
if (NumSamples != 0)
|
||||
{
|
||||
Copy_16(pStart, /* Source */
|
||||
&pBuffer->InDelayBuffer[0], /* Destination */
|
||||
(LVM_INT16)(NumChannels*NumSamples)); /* Number of input samples */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Update the delay sample count
|
||||
*/
|
||||
pBuffer->InDelaySamples = NumSamples; /* Number of delay sample pairs */
|
||||
pInstance->SamplesToProcess = 0; /* All Samples used */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION: LVM_BufferUnmanagedIn */
|
||||
/* */
|
||||
/* DESCRIPTION: */
|
||||
/* This mode is selected by the user code and disables the buffer management with the */
|
||||
/* exception of the maximum block size processing. The user must ensure that the */
|
||||
/* input and output buffers are 32-bit aligned and also that the number of samples to */
|
||||
/* process is a correct multiple of samples. */
|
||||
/* */
|
||||
/* PARAMETERS: */
|
||||
/* hInstance - Instance handle */
|
||||
/* *pToProcess - Pointer to the start of data processing */
|
||||
/* *pProcessed - Pointer to the destination of the processed data */
|
||||
/* pNumSamples - Pointer to the number of samples to process */
|
||||
/* */
|
||||
/* RETURNS: */
|
||||
/* None */
|
||||
/* */
|
||||
/* NOTES: */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
|
||||
void LVM_BufferUnmanagedIn(LVM_Handle_t hInstance,
|
||||
LVM_INT16 **pToProcess,
|
||||
LVM_INT16 **pProcessed,
|
||||
LVM_UINT16 *pNumSamples)
|
||||
{
|
||||
|
||||
LVM_Instance_t *pInstance = (LVM_Instance_t *)hInstance;
|
||||
|
||||
|
||||
/*
|
||||
* Check if this is the first call of a block
|
||||
*/
|
||||
if (pInstance->SamplesToProcess == 0)
|
||||
{
|
||||
pInstance->SamplesToProcess = (LVM_INT16)*pNumSamples; /* Get the number of samples on first call */
|
||||
pInstance->pInputSamples = *pToProcess; /* Get the I/O pointers */
|
||||
pInstance->pOutputSamples = *pProcessed;
|
||||
|
||||
|
||||
/*
|
||||
* Set te block size to process
|
||||
*/
|
||||
if (pInstance->SamplesToProcess > pInstance->InternalBlockSize)
|
||||
{
|
||||
*pNumSamples = (LVM_UINT16)pInstance->InternalBlockSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
*pNumSamples = (LVM_UINT16)pInstance->SamplesToProcess;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the process pointers
|
||||
*/
|
||||
*pToProcess = pInstance->pInputSamples;
|
||||
*pProcessed = pInstance->pOutputSamples;
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION: LVM_BufferOptimisedIn */
|
||||
/* */
|
||||
/* DESCRIPTION: */
|
||||
/* Optimised buffer management for the case where the data is outplace processing, */
|
||||
/* the output data is 32-bit aligned and there are sufficient samples to allow some */
|
||||
/* processing directly in the output buffer. This saves one data copy per sample */
|
||||
/* compared with the unoptimsed version. */
|
||||
/* */
|
||||
/* PARAMETERS: */
|
||||
/* hInstance - Instance handle */
|
||||
/* pInData - Pointer to the input data stream */
|
||||
/* *pToProcess - Pointer to the start of data processing */
|
||||
/* *pProcessed - Pointer to the destination of the processed data */
|
||||
/* pNumSamples - Pointer to the number of samples to process */
|
||||
/* */
|
||||
/* RETURNS: */
|
||||
/* None */
|
||||
/* */
|
||||
/* NOTES: */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
|
||||
void LVM_BufferOptimisedIn(LVM_Handle_t hInstance,
|
||||
const LVM_INT16 *pInData,
|
||||
LVM_INT16 **pToProcess,
|
||||
LVM_INT16 **pProcessed,
|
||||
LVM_UINT16 *pNumSamples)
|
||||
{
|
||||
|
||||
LVM_Instance_t *pInstance = (LVM_Instance_t *)hInstance;
|
||||
LVM_Buffer_t *pBuffer = pInstance->pBufferManagement;
|
||||
LVM_INT16 *pDest;
|
||||
LVM_INT16 SampleCount;
|
||||
LVM_INT16 NumSamples;
|
||||
LVM_INT16 NumFrames;
|
||||
|
||||
/*
|
||||
* Check if it is the first call for this block
|
||||
*/
|
||||
if (pInstance->SamplesToProcess == 0)
|
||||
{
|
||||
/*
|
||||
* First call for a new block of samples
|
||||
*/
|
||||
pBuffer->BufferState = LVM_FIRSTCALL;
|
||||
pInstance->pInputSamples = (LVM_INT16 *)pInData;
|
||||
pInstance->SamplesToProcess = (LVM_INT16)*pNumSamples;
|
||||
pBuffer->SamplesToOutput = (LVM_INT16)*pNumSamples;
|
||||
pDest = *pProcessed; /* The start of the output buffer */
|
||||
|
||||
|
||||
/*
|
||||
* Copy the already processed samples to the output buffer
|
||||
*/
|
||||
if (pBuffer->OutDelaySamples != 0)
|
||||
{
|
||||
Copy_16(&pBuffer->OutDelayBuffer[0], /* Source */
|
||||
pDest, /* Detsination */
|
||||
(LVM_INT16)(2*pBuffer->OutDelaySamples)); /* Number of delay samples */
|
||||
pDest += 2 * pBuffer->OutDelaySamples; /* Update the output pointer */
|
||||
pBuffer->SamplesToOutput = (LVM_INT16)(pBuffer->SamplesToOutput - pBuffer->OutDelaySamples); /* Update the numbr of samples to output */
|
||||
}
|
||||
*pToProcess = pDest; /* Set the address to start processing */
|
||||
*pProcessed = pDest; /* Process in the output buffer, now inplace */
|
||||
|
||||
/*
|
||||
* Copy the input delay buffer (unprocessed) samples to the output buffer
|
||||
*/
|
||||
if (pBuffer->InDelaySamples != 0)
|
||||
{
|
||||
Copy_16(&pBuffer->InDelayBuffer[0], /* Source */
|
||||
pDest, /* Destination */
|
||||
(LVM_INT16)(2*pBuffer->InDelaySamples)); /* Number of delay samples */
|
||||
pDest += 2 * pBuffer->InDelaySamples; /* Update the output pointer */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Calculate how many input samples to process and copy
|
||||
*/
|
||||
NumSamples = (LVM_INT16)(*pNumSamples - pBuffer->OutDelaySamples); /* Number that will fit in the output buffer */
|
||||
if (NumSamples >= pInstance->InternalBlockSize)
|
||||
{
|
||||
NumSamples = pInstance->InternalBlockSize;
|
||||
}
|
||||
NumFrames = (LVM_INT16)(NumSamples >> MIN_INTERNAL_BLOCKSHIFT);
|
||||
SampleCount = (LVM_INT16)(NumFrames << MIN_INTERNAL_BLOCKSHIFT);
|
||||
*pNumSamples = (LVM_UINT16)SampleCount; /* The number of samples to process */
|
||||
pBuffer->SamplesToOutput = (LVM_INT16)(pBuffer->SamplesToOutput - SampleCount); /* Update the number of samples to output */
|
||||
SampleCount = (LVM_INT16)(SampleCount - pBuffer->InDelaySamples); /* The number of samples to copy from the input */
|
||||
|
||||
|
||||
/*
|
||||
* Copy samples from the input buffer and update counts and pointers
|
||||
*/
|
||||
Copy_16(pInstance->pInputSamples, /* Source */
|
||||
pDest, /* Destination */
|
||||
(LVM_INT16)(2*SampleCount)); /* Number of input samples */
|
||||
pInstance->pInputSamples += 2 * SampleCount; /* Update the input pointer */
|
||||
pInstance->pOutputSamples = pDest + (2 * SampleCount); /* Update the output pointer */
|
||||
pInstance->SamplesToProcess = (LVM_INT16)(pInstance->SamplesToProcess - SampleCount); /* Samples left in the input buffer */
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Second or subsequent call in optimised mode
|
||||
*/
|
||||
if (pBuffer->SamplesToOutput >= MIN_INTERNAL_BLOCKSIZE)
|
||||
{
|
||||
/*
|
||||
* More samples can be processed directly in the output buffer
|
||||
*/
|
||||
*pToProcess = pInstance->pOutputSamples; /* Set the address to start processing */
|
||||
*pProcessed = pInstance->pOutputSamples; /* Process in the output buffer, now inplace */
|
||||
NumSamples = pBuffer->SamplesToOutput; /* Number that will fit in the output buffer */
|
||||
if (NumSamples >= pInstance->InternalBlockSize)
|
||||
{
|
||||
NumSamples = pInstance->InternalBlockSize;
|
||||
}
|
||||
NumFrames = (LVM_INT16)(NumSamples >> MIN_INTERNAL_BLOCKSHIFT);
|
||||
SampleCount = (LVM_INT16)(NumFrames << MIN_INTERNAL_BLOCKSHIFT);
|
||||
*pNumSamples = (LVM_UINT16)SampleCount; /* The number of samples to process */
|
||||
|
||||
|
||||
/*
|
||||
* Copy samples from the input buffer and update counts and pointers
|
||||
*/
|
||||
Copy_16(pInstance->pInputSamples, /* Source */
|
||||
pInstance->pOutputSamples, /* Destination */
|
||||
(LVM_INT16)(2*SampleCount)); /* Number of input samples */
|
||||
pInstance->pInputSamples += 2 * SampleCount; /* Update the input pointer */
|
||||
pInstance->pOutputSamples += 2 * SampleCount; /* Update the output pointer */
|
||||
pInstance->SamplesToProcess = (LVM_INT16)(pInstance->SamplesToProcess - SampleCount); /* Samples left in the input buffer */
|
||||
pBuffer->SamplesToOutput = (LVM_INT16)(pBuffer->SamplesToOutput - SampleCount); /* Number that will fit in the output buffer */
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* The remaining samples can not be processed in the output buffer
|
||||
*/
|
||||
pBuffer->BufferState = LVM_LASTCALL; /* Indicate this is the last bock to process */
|
||||
*pToProcess = pBuffer->pScratch; /* Set the address to start processing */
|
||||
*pProcessed = pBuffer->pScratch; /* Process in the output buffer, now inplace */
|
||||
NumSamples = pInstance->SamplesToProcess; /* Number left to be processed */
|
||||
NumFrames = (LVM_INT16)(NumSamples >> MIN_INTERNAL_BLOCKSHIFT);
|
||||
SampleCount = (LVM_INT16)(NumFrames << MIN_INTERNAL_BLOCKSHIFT);
|
||||
*pNumSamples = (LVM_UINT16)SampleCount; /* The number of samples to process */
|
||||
|
||||
|
||||
/*
|
||||
* Copy samples from the input buffer and update counts and pointers
|
||||
*/
|
||||
Copy_16(pInstance->pInputSamples, /* Source */
|
||||
pBuffer->pScratch, /* Destination */
|
||||
(LVM_INT16)(2*SampleCount)); /* Number of input samples */
|
||||
pInstance->pInputSamples += 2 * SampleCount; /* Update the input pointer */
|
||||
pInstance->SamplesToProcess = (LVM_INT16)(pInstance->SamplesToProcess - SampleCount); /* Samples left in the input buffer */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION: LVM_BufferIn */
|
||||
/* */
|
||||
/* DESCRIPTION: */
|
||||
/* This function manages the data input, it has the following features: */
|
||||
/* - Accepts data in 16-bit aligned memory */
|
||||
/* - Copies the data to 32-bit aligned memory */
|
||||
/* - Converts Mono inputs to Mono-in-Stereo */
|
||||
/* - Accepts any number of samples as input, except 0 */
|
||||
/* - Breaks the input sample stream in to blocks of the configured frame size or */
|
||||
/* multiples of the frame size */
|
||||
/* - Limits the processing block size to the maximum block size. */
|
||||
/* - Works with inplace or outplace processing automatically */
|
||||
/* */
|
||||
/* To manage the data the function has a number of operating states: */
|
||||
/* LVM_FIRSTCALL - The first call for this block of input samples */
|
||||
/* LVM_MAXBLOCKCALL - The current block is the maximum size. Only used for the */
|
||||
/* second and subsequent blocks. */
|
||||
/* LVM_LASTCALL - The last call for this block of input samples */
|
||||
/* LVM_FIRSTLASTCALL - This is the first and last call for this block of input*/
|
||||
/* samples, this occurs when the number of samples to */
|
||||
/* process is less than the maximum block size. */
|
||||
/* */
|
||||
/* The function uses an internal delay buffer the size of the minimum frame, this is */
|
||||
/* used to temporarily hold samples when the number of samples to process is not a */
|
||||
/* multiple of the frame size. */
|
||||
/* */
|
||||
/* To ensure correct operation with inplace buffering the number of samples to output*/
|
||||
/* per call is calculated in this function and is set to the number of samples read */
|
||||
/* from the input buffer. */
|
||||
/* */
|
||||
/* The total number of samples to process is stored when the function is called for */
|
||||
/* the first time. The value is overwritten by the size of the block to be processed */
|
||||
/* in each call so the size of the processing blocks can be controlled. The number of */
|
||||
/* samples actually processed for each block of input samples is always a multiple of*/
|
||||
/* the frame size so for any particular block of input samples the actual number of */
|
||||
/* processed samples may not match the number of input samples, sometime it will be */
|
||||
/* sometimes less. The average is the same and the difference is never more than the */
|
||||
/* frame size. */
|
||||
/* */
|
||||
/* PARAMETERS: */
|
||||
/* hInstance - Instance handle */
|
||||
/* pInData - Pointer to the input data stream */
|
||||
/* *pToProcess - Pointer to the start of data processing */
|
||||
/* *pProcessed - Pointer to the destination of the processed data */
|
||||
/* pNumSamples - Pointer to the number of samples to process */
|
||||
/* */
|
||||
/* RETURNS: */
|
||||
/* None */
|
||||
/* */
|
||||
/* NOTES: */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
|
||||
void LVM_BufferIn(LVM_Handle_t hInstance,
|
||||
const LVM_INT16 *pInData,
|
||||
LVM_INT16 **pToProcess,
|
||||
LVM_INT16 **pProcessed,
|
||||
LVM_UINT16 *pNumSamples)
|
||||
{
|
||||
|
||||
LVM_Instance_t *pInstance = (LVM_Instance_t *)hInstance;
|
||||
|
||||
|
||||
/*
|
||||
* Check which mode, managed or unmanaged
|
||||
*/
|
||||
if (pInstance->InstParams.BufferMode == LVM_MANAGED_BUFFERS)
|
||||
{
|
||||
LVM_BufferManagedIn(hInstance,
|
||||
pInData,
|
||||
pToProcess,
|
||||
pProcessed,
|
||||
pNumSamples);
|
||||
}
|
||||
else
|
||||
{
|
||||
LVM_BufferUnmanagedIn(hInstance,
|
||||
pToProcess,
|
||||
pProcessed,
|
||||
pNumSamples);
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION: LVM_BufferManagedOut */
|
||||
/* */
|
||||
/* DESCRIPTION: */
|
||||
/* Full buffer management output. This works in conjunction with the managed input */
|
||||
/* routine and ensures the correct number of samples are always output to the output */
|
||||
/* buffer. */
|
||||
/* */
|
||||
/* PARAMETERS: */
|
||||
/* hInstance - Instance handle */
|
||||
/* pOutData - Pointer to the output data stream */
|
||||
/* pNumSamples - Pointer to the number of samples to process */
|
||||
/* */
|
||||
/* RETURNS: */
|
||||
/* None */
|
||||
/* */
|
||||
/* NOTES: */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
|
||||
void LVM_BufferManagedOut(LVM_Handle_t hInstance,
|
||||
LVM_INT16 *pOutData,
|
||||
LVM_UINT16 *pNumSamples)
|
||||
{
|
||||
|
||||
LVM_Instance_t *pInstance = (LVM_Instance_t *)hInstance;
|
||||
LVM_Buffer_t *pBuffer = pInstance->pBufferManagement;
|
||||
LVM_INT16 SampleCount = (LVM_INT16)*pNumSamples;
|
||||
LVM_INT16 NumSamples;
|
||||
LVM_INT16 *pStart;
|
||||
LVM_INT16 *pDest;
|
||||
|
||||
|
||||
/*
|
||||
* Set the pointers
|
||||
*/
|
||||
NumSamples = pBuffer->SamplesToOutput;
|
||||
pStart = pBuffer->pScratch;
|
||||
|
||||
|
||||
/*
|
||||
* check if it is the first call of a block
|
||||
*/
|
||||
if ((pBuffer->BufferState == LVM_FIRSTCALL) ||
|
||||
(pBuffer->BufferState == LVM_FIRSTLASTCALL))
|
||||
{
|
||||
/* First call for a new block */
|
||||
pInstance->pOutputSamples = pOutData; /* Initialise the destination */
|
||||
}
|
||||
pDest = pInstance->pOutputSamples; /* Set the output address */
|
||||
|
||||
|
||||
/*
|
||||
* If the number of samples is non-zero then there are still samples to send to
|
||||
* the output buffer
|
||||
*/
|
||||
if ((NumSamples != 0) &&
|
||||
(pBuffer->OutDelaySamples != 0))
|
||||
{
|
||||
/*
|
||||
* Copy the delayed output buffer samples to the output
|
||||
*/
|
||||
if (pBuffer->OutDelaySamples <= NumSamples)
|
||||
{
|
||||
/*
|
||||
* Copy all output delay samples to the output
|
||||
*/
|
||||
Copy_16(&pBuffer->OutDelayBuffer[0], /* Source */
|
||||
pDest, /* Detsination */
|
||||
(LVM_INT16)(2*pBuffer->OutDelaySamples)); /* Number of delay samples */
|
||||
|
||||
/*
|
||||
* Update the pointer and sample counts
|
||||
*/
|
||||
pDest += 2*pBuffer->OutDelaySamples; /* Output sample pointer */
|
||||
NumSamples = (LVM_INT16)(NumSamples - pBuffer->OutDelaySamples); /* Samples left to send */
|
||||
pBuffer->OutDelaySamples = 0; /* No samples left in the buffer */
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Copy only some of the ouput delay samples to the output
|
||||
*/
|
||||
Copy_16(&pBuffer->OutDelayBuffer[0], /* Source */
|
||||
pDest, /* Detsination */
|
||||
(LVM_INT16)(2*NumSamples)); /* Number of delay samples */
|
||||
|
||||
/*
|
||||
* Update the pointer and sample counts
|
||||
*/
|
||||
pDest += 2*NumSamples; /* Output sample pointer */
|
||||
pBuffer->OutDelaySamples = (LVM_INT16)(pBuffer->OutDelaySamples - NumSamples); /* No samples left in the buffer */
|
||||
|
||||
|
||||
/*
|
||||
* Realign the delay buffer data to avoid using circular buffer management
|
||||
*/
|
||||
Copy_16(&pBuffer->OutDelayBuffer[2*NumSamples], /* Source */
|
||||
&pBuffer->OutDelayBuffer[0], /* Destination */
|
||||
(LVM_INT16)(2*pBuffer->OutDelaySamples)); /* Number of samples to move */
|
||||
NumSamples = 0; /* Samples left to send */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Copy the processed results to the output
|
||||
*/
|
||||
if ((NumSamples != 0) &&
|
||||
(SampleCount != 0))
|
||||
{
|
||||
if (SampleCount <= NumSamples)
|
||||
{
|
||||
/*
|
||||
* Copy all processed samples to the output
|
||||
*/
|
||||
Copy_16(pStart, /* Source */
|
||||
pDest, /* Detsination */
|
||||
(LVM_INT16)(2*SampleCount)); /* Number of processed samples */
|
||||
|
||||
/*
|
||||
* Update the pointer and sample counts
|
||||
*/
|
||||
pDest += 2 * SampleCount; /* Output sample pointer */
|
||||
NumSamples = (LVM_INT16)(NumSamples - SampleCount); /* Samples left to send */
|
||||
SampleCount = 0; /* No samples left in the buffer */
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Copy only some processed samples to the output
|
||||
*/
|
||||
Copy_16(pStart, /* Source */
|
||||
pDest, /* Destination */
|
||||
(LVM_INT16)(2*NumSamples)); /* Number of processed samples */
|
||||
|
||||
|
||||
/*
|
||||
* Update the pointers and sample counts
|
||||
*/
|
||||
pStart += 2 * NumSamples; /* Processed sample pointer */
|
||||
pDest += 2 * NumSamples; /* Output sample pointer */
|
||||
SampleCount = (LVM_INT16)(SampleCount - NumSamples); /* Processed samples left */
|
||||
NumSamples = 0; /* Clear the sample count */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Copy the remaining processed data to the output delay buffer
|
||||
*/
|
||||
if (SampleCount != 0)
|
||||
{
|
||||
Copy_16(pStart, /* Source */
|
||||
&pBuffer->OutDelayBuffer[2*pBuffer->OutDelaySamples], /* Destination */
|
||||
(LVM_INT16)(2*SampleCount)); /* Number of processed samples */
|
||||
pBuffer->OutDelaySamples = (LVM_INT16)(pBuffer->OutDelaySamples + SampleCount); /* Update the buffer count */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* pointers, counts and set default buffer processing
|
||||
*/
|
||||
pBuffer->SamplesToOutput = NumSamples; /* Samples left to send */
|
||||
pInstance->pOutputSamples = pDest; /* Output sample pointer */
|
||||
pBuffer->BufferState = LVM_MAXBLOCKCALL; /* Set for the default call block size */
|
||||
*pNumSamples = (LVM_UINT16)pInstance->SamplesToProcess; /* This will terminate the loop when all samples processed */
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION: LVM_BufferUnmanagedOut */
|
||||
/* */
|
||||
/* DESCRIPTION: */
|
||||
/* This works in conjunction with the unmanaged input routine and updates the number */
|
||||
/* of samples left to be processed and adjusts the buffer pointers. */
|
||||
/* */
|
||||
/* PARAMETERS: */
|
||||
/* hInstance - Instance handle */
|
||||
/* pNumSamples - Pointer to the number of samples to process */
|
||||
/* */
|
||||
/* RETURNS: */
|
||||
/* None */
|
||||
/* */
|
||||
/* NOTES: */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
|
||||
void LVM_BufferUnmanagedOut(LVM_Handle_t hInstance,
|
||||
LVM_UINT16 *pNumSamples)
|
||||
{
|
||||
|
||||
LVM_Instance_t *pInstance = (LVM_Instance_t *)hInstance;
|
||||
LVM_INT16 NumChannels =2;
|
||||
|
||||
|
||||
/*
|
||||
* Update sample counts
|
||||
*/
|
||||
pInstance->pInputSamples += (LVM_INT16)(*pNumSamples * NumChannels); /* Update the I/O pointers */
|
||||
pInstance->pOutputSamples += (LVM_INT16)(*pNumSamples * 2);
|
||||
pInstance->SamplesToProcess = (LVM_INT16)(pInstance->SamplesToProcess - *pNumSamples); /* Update the sample count */
|
||||
|
||||
/*
|
||||
* Set te block size to process
|
||||
*/
|
||||
if (pInstance->SamplesToProcess > pInstance->InternalBlockSize)
|
||||
{
|
||||
*pNumSamples = (LVM_UINT16)pInstance->InternalBlockSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
*pNumSamples = (LVM_UINT16)pInstance->SamplesToProcess;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION: LVM_BufferOptimisedOut */
|
||||
/* */
|
||||
/* DESCRIPTION: */
|
||||
/* This works in conjunction with the optimised input routine and copies the last few */
|
||||
/* processed and unprocessed samples to their respective buffers. */
|
||||
/* */
|
||||
/* PARAMETERS: */
|
||||
/* hInstance - Instance handle */
|
||||
/* pNumSamples - Pointer to the number of samples to process */
|
||||
/* */
|
||||
/* RETURNS: */
|
||||
/* None */
|
||||
/* */
|
||||
/* NOTES: */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
|
||||
void LVM_BufferOptimisedOut(LVM_Handle_t hInstance,
|
||||
LVM_UINT16 *pNumSamples)
|
||||
{
|
||||
|
||||
LVM_Instance_t *pInstance = (LVM_Instance_t *)hInstance;
|
||||
LVM_Buffer_t *pBuffer = pInstance->pBufferManagement;
|
||||
|
||||
/*
|
||||
* Check if it is the last block to process
|
||||
*/
|
||||
if (pBuffer->BufferState == LVM_LASTCALL)
|
||||
{
|
||||
LVM_INT16 *pSrc = pBuffer->pScratch;
|
||||
|
||||
/*
|
||||
* Copy the unprocessed samples to the input delay buffer
|
||||
*/
|
||||
if (pInstance->SamplesToProcess != 0)
|
||||
{
|
||||
Copy_16(pInstance->pInputSamples, /* Source */
|
||||
&pBuffer->InDelayBuffer[0], /* Destination */
|
||||
(LVM_INT16)(2*pInstance->SamplesToProcess)); /* Number of input samples */
|
||||
pBuffer->InDelaySamples = pInstance->SamplesToProcess;
|
||||
pInstance->SamplesToProcess = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
pBuffer->InDelaySamples = 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Fill the last empty spaces in the output buffer
|
||||
*/
|
||||
if (pBuffer->SamplesToOutput != 0)
|
||||
{
|
||||
Copy_16(pSrc, /* Source */
|
||||
pInstance->pOutputSamples, /* Destination */
|
||||
(LVM_INT16)(2*pBuffer->SamplesToOutput)); /* Number of input samples */
|
||||
*pNumSamples = (LVM_UINT16)(*pNumSamples - pBuffer->SamplesToOutput);
|
||||
pSrc += 2 * pBuffer->SamplesToOutput; /* Update scratch pointer */
|
||||
pBuffer->SamplesToOutput = 0; /* No more samples in this block */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Save any remaining processed samples in the output delay buffer
|
||||
*/
|
||||
if (*pNumSamples != 0)
|
||||
{
|
||||
Copy_16(pSrc, /* Source */
|
||||
&pBuffer->OutDelayBuffer[0], /* Destination */
|
||||
(LVM_INT16)(2**pNumSamples)); /* Number of input samples */
|
||||
|
||||
pBuffer->OutDelaySamples = (LVM_INT16)*pNumSamples;
|
||||
|
||||
*pNumSamples = 0; /* No more samples in this block */
|
||||
}
|
||||
else
|
||||
{
|
||||
pBuffer->OutDelaySamples = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION: LVM_BufferOut */
|
||||
/* */
|
||||
/* DESCRIPTION: */
|
||||
/* This function manages the data output, it has the following features: */
|
||||
/* - Output data to 16-bit aligned memory */
|
||||
/* - Reads data from 32-bit aligned memory */
|
||||
/* - Reads data only in blocks of frame size or multiples of frame size */
|
||||
/* - Writes the same number of samples as the LVM_BufferIn function reads */
|
||||
/* - Works with inplace or outplace processing automatically */
|
||||
/* */
|
||||
/* To manage the data the function has a number of operating states: */
|
||||
/* LVM_FIRSTCALL - The first call for this block of input samples */
|
||||
/* LVM_FIRSTLASTCALL - This is the first and last call for this block of input*/
|
||||
/* samples, this occurs when the number of samples to */
|
||||
/* process is less than the maximum block size. */
|
||||
/* */
|
||||
/* The function uses an internal delay buffer the size of the minimum frame, this is */
|
||||
/* used to temporarily hold samples when the number of samples to write is not a */
|
||||
/* multiple of the frame size. */
|
||||
/* */
|
||||
/* To ensure correct operation with inplace buffering the number of samples to output*/
|
||||
/* per call is always the same as the number of samples read from the input buffer. */
|
||||
/* */
|
||||
/* PARAMETERS: */
|
||||
/* hInstance - Instance handle */
|
||||
/* pOutData - Pointer to the output data stream */
|
||||
/* pNumSamples - Pointer to the number of samples to process */
|
||||
/* */
|
||||
/* RETURNS: */
|
||||
/* None */
|
||||
/* */
|
||||
/* NOTES: */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
|
||||
void LVM_BufferOut(LVM_Handle_t hInstance,
|
||||
LVM_INT16 *pOutData,
|
||||
LVM_UINT16 *pNumSamples)
|
||||
{
|
||||
|
||||
LVM_Instance_t *pInstance = (LVM_Instance_t *)hInstance;
|
||||
|
||||
|
||||
/*
|
||||
* Check which mode, managed or unmanaged
|
||||
*/
|
||||
if (pInstance->InstParams.BufferMode == LVM_MANAGED_BUFFERS)
|
||||
{
|
||||
LVM_BufferManagedOut(hInstance,
|
||||
pOutData,
|
||||
pNumSamples);
|
||||
}
|
||||
else
|
||||
{
|
||||
LVM_BufferUnmanagedOut(hInstance,
|
||||
pNumSamples);
|
||||
}
|
||||
}
|
||||
|
573
media/libeffects/lvm/lib/Bundle/src/LVM_Coeffs.h
Executable file
573
media/libeffects/lvm/lib/Bundle/src/LVM_Coeffs.h
Executable file
@ -0,0 +1,573 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __LVM_COEFFS_H__
|
||||
#define __LVM_COEFFS_H__
|
||||
|
||||
|
||||
/************************************************************************************/
|
||||
/* */
|
||||
/* High Pass Shelving Filter coefficients */
|
||||
/* */
|
||||
/************************************************************************************/
|
||||
|
||||
#define TrebleBoostCorner 8000
|
||||
#define TrebleBoostMinRate 4
|
||||
#define TrebleBoostSteps 15
|
||||
|
||||
|
||||
/* Coefficients for sample rate 22050Hz */
|
||||
/* Gain = 1.000000 dB */
|
||||
#define HPF_Fs22050_Gain1_A0 5383 /* Floating point value 0.164291 */
|
||||
#define HPF_Fs22050_Gain1_A1 16859 /* Floating point value 0.514492 */
|
||||
#define HPF_Fs22050_Gain1_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs22050_Gain1_B1 12125 /* Floating point value 0.370033 */
|
||||
#define HPF_Fs22050_Gain1_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs22050_Gain1_Shift 1 /* Shift value */
|
||||
/* Gain = 2.000000 dB */
|
||||
#define HPF_Fs22050_Gain2_A0 4683 /* Floating point value 0.142925 */
|
||||
#define HPF_Fs22050_Gain2_A1 17559 /* Floating point value 0.535858 */
|
||||
#define HPF_Fs22050_Gain2_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs22050_Gain2_B1 12125 /* Floating point value 0.370033 */
|
||||
#define HPF_Fs22050_Gain2_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs22050_Gain2_Shift 1 /* Shift value */
|
||||
/* Gain = 3.000000 dB */
|
||||
#define HPF_Fs22050_Gain3_A0 3898 /* Floating point value 0.118953 */
|
||||
#define HPF_Fs22050_Gain3_A1 18345 /* Floating point value 0.559830 */
|
||||
#define HPF_Fs22050_Gain3_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs22050_Gain3_B1 12125 /* Floating point value 0.370033 */
|
||||
#define HPF_Fs22050_Gain3_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs22050_Gain3_Shift 1 /* Shift value */
|
||||
/* Gain = 4.000000 dB */
|
||||
#define HPF_Fs22050_Gain4_A0 3016 /* Floating point value 0.092055 */
|
||||
#define HPF_Fs22050_Gain4_A1 19226 /* Floating point value 0.586728 */
|
||||
#define HPF_Fs22050_Gain4_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs22050_Gain4_B1 12125 /* Floating point value 0.370033 */
|
||||
#define HPF_Fs22050_Gain4_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs22050_Gain4_Shift 1 /* Shift value */
|
||||
/* Gain = 5.000000 dB */
|
||||
#define HPF_Fs22050_Gain5_A0 2028 /* Floating point value 0.061876 */
|
||||
#define HPF_Fs22050_Gain5_A1 20215 /* Floating point value 0.616907 */
|
||||
#define HPF_Fs22050_Gain5_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs22050_Gain5_B1 12125 /* Floating point value 0.370033 */
|
||||
#define HPF_Fs22050_Gain5_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs22050_Gain5_Shift 1 /* Shift value */
|
||||
/* Gain = 6.000000 dB */
|
||||
#define HPF_Fs22050_Gain6_A0 918 /* Floating point value 0.028013 */
|
||||
#define HPF_Fs22050_Gain6_A1 21324 /* Floating point value 0.650770 */
|
||||
#define HPF_Fs22050_Gain6_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs22050_Gain6_B1 12125 /* Floating point value 0.370033 */
|
||||
#define HPF_Fs22050_Gain6_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs22050_Gain6_Shift 1 /* Shift value */
|
||||
/* Gain = 7.000000 dB */
|
||||
#define HPF_Fs22050_Gain7_A0 -164 /* Floating point value -0.005002 */
|
||||
#define HPF_Fs22050_Gain7_A1 11311 /* Floating point value 0.345199 */
|
||||
#define HPF_Fs22050_Gain7_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs22050_Gain7_B1 12125 /* Floating point value 0.370033 */
|
||||
#define HPF_Fs22050_Gain7_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs22050_Gain7_Shift 2 /* Shift value */
|
||||
/* Gain = 8.000000 dB */
|
||||
#define HPF_Fs22050_Gain8_A0 -864 /* Floating point value -0.026368 */
|
||||
#define HPF_Fs22050_Gain8_A1 12012 /* Floating point value 0.366565 */
|
||||
#define HPF_Fs22050_Gain8_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs22050_Gain8_B1 12125 /* Floating point value 0.370033 */
|
||||
#define HPF_Fs22050_Gain8_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs22050_Gain8_Shift 2 /* Shift value */
|
||||
/* Gain = 9.000000 dB */
|
||||
#define HPF_Fs22050_Gain9_A0 -1650 /* Floating point value -0.050340 */
|
||||
#define HPF_Fs22050_Gain9_A1 12797 /* Floating point value 0.390537 */
|
||||
#define HPF_Fs22050_Gain9_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs22050_Gain9_B1 12125 /* Floating point value 0.370033 */
|
||||
#define HPF_Fs22050_Gain9_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs22050_Gain9_Shift 2 /* Shift value */
|
||||
/* Gain = 10.000000 dB */
|
||||
#define HPF_Fs22050_Gain10_A0 -2531 /* Floating point value -0.077238 */
|
||||
#define HPF_Fs22050_Gain10_A1 13679 /* Floating point value 0.417435 */
|
||||
#define HPF_Fs22050_Gain10_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs22050_Gain10_B1 12125 /* Floating point value 0.370033 */
|
||||
#define HPF_Fs22050_Gain10_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs22050_Gain10_Shift 2 /* Shift value */
|
||||
/* Gain = 11.000000 dB */
|
||||
#define HPF_Fs22050_Gain11_A0 -3520 /* Floating point value -0.107417 */
|
||||
#define HPF_Fs22050_Gain11_A1 14667 /* Floating point value 0.447615 */
|
||||
#define HPF_Fs22050_Gain11_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs22050_Gain11_B1 12125 /* Floating point value 0.370033 */
|
||||
#define HPF_Fs22050_Gain11_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs22050_Gain11_Shift 2 /* Shift value */
|
||||
/* Gain = 12.000000 dB */
|
||||
#define HPF_Fs22050_Gain12_A0 -4629 /* Floating point value -0.141279 */
|
||||
#define HPF_Fs22050_Gain12_A1 15777 /* Floating point value 0.481477 */
|
||||
#define HPF_Fs22050_Gain12_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs22050_Gain12_B1 12125 /* Floating point value 0.370033 */
|
||||
#define HPF_Fs22050_Gain12_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs22050_Gain12_Shift 2 /* Shift value */
|
||||
/* Gain = 13.000000 dB */
|
||||
#define HPF_Fs22050_Gain13_A0 -2944 /* Floating point value -0.089849 */
|
||||
#define HPF_Fs22050_Gain13_A1 8531 /* Floating point value 0.260352 */
|
||||
#define HPF_Fs22050_Gain13_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs22050_Gain13_B1 12125 /* Floating point value 0.370033 */
|
||||
#define HPF_Fs22050_Gain13_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs22050_Gain13_Shift 3 /* Shift value */
|
||||
/* Gain = 14.000000 dB */
|
||||
#define HPF_Fs22050_Gain14_A0 -3644 /* Floating point value -0.111215 */
|
||||
#define HPF_Fs22050_Gain14_A1 9231 /* Floating point value 0.281718 */
|
||||
#define HPF_Fs22050_Gain14_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs22050_Gain14_B1 12125 /* Floating point value 0.370033 */
|
||||
#define HPF_Fs22050_Gain14_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs22050_Gain14_Shift 3 /* Shift value */
|
||||
/* Gain = 15.000000 dB */
|
||||
#define HPF_Fs22050_Gain15_A0 -4430 /* Floating point value -0.135187 */
|
||||
#define HPF_Fs22050_Gain15_A1 10017 /* Floating point value 0.305690 */
|
||||
#define HPF_Fs22050_Gain15_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs22050_Gain15_B1 12125 /* Floating point value 0.370033 */
|
||||
#define HPF_Fs22050_Gain15_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs22050_Gain15_Shift 3 /* Shift value */
|
||||
|
||||
|
||||
/* Coefficients for sample rate 24000Hz */
|
||||
/* Gain = 1.000000 dB */
|
||||
#define HPF_Fs24000_Gain1_A0 3625 /* Floating point value 0.110628 */
|
||||
#define HPF_Fs24000_Gain1_A1 16960 /* Floating point value 0.517578 */
|
||||
#define HPF_Fs24000_Gain1_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs24000_Gain1_B1 8780 /* Floating point value 0.267949 */
|
||||
#define HPF_Fs24000_Gain1_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs24000_Gain1_Shift 1 /* Shift value */
|
||||
/* Gain = 2.000000 dB */
|
||||
#define HPF_Fs24000_Gain2_A0 2811 /* Floating point value 0.085800 */
|
||||
#define HPF_Fs24000_Gain2_A1 17774 /* Floating point value 0.542406 */
|
||||
#define HPF_Fs24000_Gain2_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs24000_Gain2_B1 8780 /* Floating point value 0.267949 */
|
||||
#define HPF_Fs24000_Gain2_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs24000_Gain2_Shift 1 /* Shift value */
|
||||
/* Gain = 3.000000 dB */
|
||||
#define HPF_Fs24000_Gain3_A0 1899 /* Floating point value 0.057943 */
|
||||
#define HPF_Fs24000_Gain3_A1 18686 /* Floating point value 0.570263 */
|
||||
#define HPF_Fs24000_Gain3_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs24000_Gain3_B1 8780 /* Floating point value 0.267949 */
|
||||
#define HPF_Fs24000_Gain3_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs24000_Gain3_Shift 1 /* Shift value */
|
||||
/* Gain = 4.000000 dB */
|
||||
#define HPF_Fs24000_Gain4_A0 874 /* Floating point value 0.026687 */
|
||||
#define HPF_Fs24000_Gain4_A1 19711 /* Floating point value 0.601519 */
|
||||
#define HPF_Fs24000_Gain4_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs24000_Gain4_B1 8780 /* Floating point value 0.267949 */
|
||||
#define HPF_Fs24000_Gain4_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs24000_Gain4_Shift 1 /* Shift value */
|
||||
/* Gain = 5.000000 dB */
|
||||
#define HPF_Fs24000_Gain5_A0 -275 /* Floating point value -0.008383 */
|
||||
#define HPF_Fs24000_Gain5_A1 20860 /* Floating point value 0.636589 */
|
||||
#define HPF_Fs24000_Gain5_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs24000_Gain5_B1 8780 /* Floating point value 0.267949 */
|
||||
#define HPF_Fs24000_Gain5_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs24000_Gain5_Shift 1 /* Shift value */
|
||||
/* Gain = 6.000000 dB */
|
||||
#define HPF_Fs24000_Gain6_A0 -1564 /* Floating point value -0.047733 */
|
||||
#define HPF_Fs24000_Gain6_A1 22149 /* Floating point value 0.675938 */
|
||||
#define HPF_Fs24000_Gain6_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs24000_Gain6_B1 8780 /* Floating point value 0.267949 */
|
||||
#define HPF_Fs24000_Gain6_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs24000_Gain6_Shift 1 /* Shift value */
|
||||
/* Gain = 7.000000 dB */
|
||||
#define HPF_Fs24000_Gain7_A0 -1509 /* Floating point value -0.046051 */
|
||||
#define HPF_Fs24000_Gain7_A1 11826 /* Floating point value 0.360899 */
|
||||
#define HPF_Fs24000_Gain7_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs24000_Gain7_B1 8780 /* Floating point value 0.267949 */
|
||||
#define HPF_Fs24000_Gain7_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs24000_Gain7_Shift 2 /* Shift value */
|
||||
/* Gain = 8.000000 dB */
|
||||
#define HPF_Fs24000_Gain8_A0 -2323 /* Floating point value -0.070878 */
|
||||
#define HPF_Fs24000_Gain8_A1 12640 /* Floating point value 0.385727 */
|
||||
#define HPF_Fs24000_Gain8_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs24000_Gain8_B1 8780 /* Floating point value 0.267949 */
|
||||
#define HPF_Fs24000_Gain8_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs24000_Gain8_Shift 2 /* Shift value */
|
||||
/* Gain = 9.000000 dB */
|
||||
#define HPF_Fs24000_Gain9_A0 -3235 /* Floating point value -0.098736 */
|
||||
#define HPF_Fs24000_Gain9_A1 13552 /* Floating point value 0.413584 */
|
||||
#define HPF_Fs24000_Gain9_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs24000_Gain9_B1 8780 /* Floating point value 0.267949 */
|
||||
#define HPF_Fs24000_Gain9_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs24000_Gain9_Shift 2 /* Shift value */
|
||||
/* Gain = 10.000000 dB */
|
||||
#define HPF_Fs24000_Gain10_A0 -4260 /* Floating point value -0.129992 */
|
||||
#define HPF_Fs24000_Gain10_A1 14577 /* Floating point value 0.444841 */
|
||||
#define HPF_Fs24000_Gain10_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs24000_Gain10_B1 8780 /* Floating point value 0.267949 */
|
||||
#define HPF_Fs24000_Gain10_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs24000_Gain10_Shift 2 /* Shift value */
|
||||
/* Gain = 11.000000 dB */
|
||||
#define HPF_Fs24000_Gain11_A0 -5409 /* Floating point value -0.165062 */
|
||||
#define HPF_Fs24000_Gain11_A1 15726 /* Floating point value 0.479911 */
|
||||
#define HPF_Fs24000_Gain11_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs24000_Gain11_B1 8780 /* Floating point value 0.267949 */
|
||||
#define HPF_Fs24000_Gain11_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs24000_Gain11_Shift 2 /* Shift value */
|
||||
/* Gain = 12.000000 dB */
|
||||
#define HPF_Fs24000_Gain12_A0 -6698 /* Floating point value -0.204411 */
|
||||
#define HPF_Fs24000_Gain12_A1 17015 /* Floating point value 0.519260 */
|
||||
#define HPF_Fs24000_Gain12_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs24000_Gain12_B1 8780 /* Floating point value 0.267949 */
|
||||
#define HPF_Fs24000_Gain12_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs24000_Gain12_Shift 2 /* Shift value */
|
||||
/* Gain = 13.000000 dB */
|
||||
#define HPF_Fs24000_Gain13_A0 -4082 /* Floating point value -0.124576 */
|
||||
#define HPF_Fs24000_Gain13_A1 9253 /* Floating point value 0.282374 */
|
||||
#define HPF_Fs24000_Gain13_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs24000_Gain13_B1 8780 /* Floating point value 0.267949 */
|
||||
#define HPF_Fs24000_Gain13_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs24000_Gain13_Shift 3 /* Shift value */
|
||||
/* Gain = 14.000000 dB */
|
||||
#define HPF_Fs24000_Gain14_A0 -4896 /* Floating point value -0.149404 */
|
||||
#define HPF_Fs24000_Gain14_A1 10066 /* Floating point value 0.307202 */
|
||||
#define HPF_Fs24000_Gain14_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs24000_Gain14_B1 8780 /* Floating point value 0.267949 */
|
||||
#define HPF_Fs24000_Gain14_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs24000_Gain14_Shift 3 /* Shift value */
|
||||
/* Gain = 15.000000 dB */
|
||||
#define HPF_Fs24000_Gain15_A0 -5808 /* Floating point value -0.177261 */
|
||||
#define HPF_Fs24000_Gain15_A1 10979 /* Floating point value 0.335059 */
|
||||
#define HPF_Fs24000_Gain15_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs24000_Gain15_B1 8780 /* Floating point value 0.267949 */
|
||||
#define HPF_Fs24000_Gain15_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs24000_Gain15_Shift 3 /* Shift value */
|
||||
|
||||
|
||||
/* Coefficients for sample rate 32000Hz */
|
||||
/* Gain = 1.000000 dB */
|
||||
#define HPF_Fs32000_Gain1_A0 17225 /* Floating point value 0.525677 */
|
||||
#define HPF_Fs32000_Gain1_A1 -990 /* Floating point value -0.030227 */
|
||||
#define HPF_Fs32000_Gain1_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs32000_Gain1_B1 0 /* Floating point value -0.000000 */
|
||||
#define HPF_Fs32000_Gain1_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs32000_Gain1_Shift 1 /* Shift value */
|
||||
/* Gain = 2.000000 dB */
|
||||
#define HPF_Fs32000_Gain2_A0 18337 /* Floating point value 0.559593 */
|
||||
#define HPF_Fs32000_Gain2_A1 -2102 /* Floating point value -0.064142 */
|
||||
#define HPF_Fs32000_Gain2_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs32000_Gain2_B1 0 /* Floating point value -0.000000 */
|
||||
#define HPF_Fs32000_Gain2_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs32000_Gain2_Shift 1 /* Shift value */
|
||||
/* Gain = 3.000000 dB */
|
||||
#define HPF_Fs32000_Gain3_A0 19584 /* Floating point value 0.597646 */
|
||||
#define HPF_Fs32000_Gain3_A1 -3349 /* Floating point value -0.102196 */
|
||||
#define HPF_Fs32000_Gain3_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs32000_Gain3_B1 0 /* Floating point value -0.000000 */
|
||||
#define HPF_Fs32000_Gain3_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs32000_Gain3_Shift 1 /* Shift value */
|
||||
/* Gain = 4.000000 dB */
|
||||
#define HPF_Fs32000_Gain4_A0 20983 /* Floating point value 0.640343 */
|
||||
#define HPF_Fs32000_Gain4_A1 -4748 /* Floating point value -0.144893 */
|
||||
#define HPF_Fs32000_Gain4_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs32000_Gain4_B1 0 /* Floating point value -0.000000 */
|
||||
#define HPF_Fs32000_Gain4_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs32000_Gain4_Shift 1 /* Shift value */
|
||||
/* Gain = 5.000000 dB */
|
||||
#define HPF_Fs32000_Gain5_A0 22553 /* Floating point value 0.688250 */
|
||||
#define HPF_Fs32000_Gain5_A1 -6318 /* Floating point value -0.192799 */
|
||||
#define HPF_Fs32000_Gain5_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs32000_Gain5_B1 0 /* Floating point value -0.000000 */
|
||||
#define HPF_Fs32000_Gain5_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs32000_Gain5_Shift 1 /* Shift value */
|
||||
/* Gain = 6.000000 dB */
|
||||
#define HPF_Fs32000_Gain6_A0 24314 /* Floating point value 0.742002 */
|
||||
#define HPF_Fs32000_Gain6_A1 -8079 /* Floating point value -0.246551 */
|
||||
#define HPF_Fs32000_Gain6_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs32000_Gain6_B1 0 /* Floating point value -0.000000 */
|
||||
#define HPF_Fs32000_Gain6_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs32000_Gain6_Shift 1 /* Shift value */
|
||||
/* Gain = 7.000000 dB */
|
||||
#define HPF_Fs32000_Gain7_A0 13176 /* Floating point value 0.402109 */
|
||||
#define HPF_Fs32000_Gain7_A1 -5040 /* Floating point value -0.153795 */
|
||||
#define HPF_Fs32000_Gain7_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs32000_Gain7_B1 0 /* Floating point value -0.000000 */
|
||||
#define HPF_Fs32000_Gain7_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs32000_Gain7_Shift 2 /* Shift value */
|
||||
/* Gain = 8.000000 dB */
|
||||
#define HPF_Fs32000_Gain8_A0 14288 /* Floating point value 0.436024 */
|
||||
#define HPF_Fs32000_Gain8_A1 -6151 /* Floating point value -0.187711 */
|
||||
#define HPF_Fs32000_Gain8_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs32000_Gain8_B1 0 /* Floating point value -0.000000 */
|
||||
#define HPF_Fs32000_Gain8_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs32000_Gain8_Shift 2 /* Shift value */
|
||||
/* Gain = 9.000000 dB */
|
||||
#define HPF_Fs32000_Gain9_A0 15535 /* Floating point value 0.474078 */
|
||||
#define HPF_Fs32000_Gain9_A1 -7398 /* Floating point value -0.225764 */
|
||||
#define HPF_Fs32000_Gain9_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs32000_Gain9_B1 0 /* Floating point value -0.000000 */
|
||||
#define HPF_Fs32000_Gain9_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs32000_Gain9_Shift 2 /* Shift value */
|
||||
/* Gain = 10.000000 dB */
|
||||
#define HPF_Fs32000_Gain10_A0 16934 /* Floating point value 0.516774 */
|
||||
#define HPF_Fs32000_Gain10_A1 -8797 /* Floating point value -0.268461 */
|
||||
#define HPF_Fs32000_Gain10_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs32000_Gain10_B1 0 /* Floating point value -0.000000 */
|
||||
#define HPF_Fs32000_Gain10_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs32000_Gain10_Shift 2 /* Shift value */
|
||||
/* Gain = 11.000000 dB */
|
||||
#define HPF_Fs32000_Gain11_A0 18503 /* Floating point value 0.564681 */
|
||||
#define HPF_Fs32000_Gain11_A1 -10367 /* Floating point value -0.316368 */
|
||||
#define HPF_Fs32000_Gain11_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs32000_Gain11_B1 0 /* Floating point value -0.000000 */
|
||||
#define HPF_Fs32000_Gain11_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs32000_Gain11_Shift 2 /* Shift value */
|
||||
/* Gain = 12.000000 dB */
|
||||
#define HPF_Fs32000_Gain12_A0 20265 /* Floating point value 0.618433 */
|
||||
#define HPF_Fs32000_Gain12_A1 -12128 /* Floating point value -0.370120 */
|
||||
#define HPF_Fs32000_Gain12_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs32000_Gain12_B1 0 /* Floating point value -0.000000 */
|
||||
#define HPF_Fs32000_Gain12_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs32000_Gain12_Shift 2 /* Shift value */
|
||||
/* Gain = 13.000000 dB */
|
||||
#define HPF_Fs32000_Gain13_A0 11147 /* Floating point value 0.340178 */
|
||||
#define HPF_Fs32000_Gain13_A1 -7069 /* Floating point value -0.215726 */
|
||||
#define HPF_Fs32000_Gain13_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs32000_Gain13_B1 0 /* Floating point value -0.000000 */
|
||||
#define HPF_Fs32000_Gain13_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs32000_Gain13_Shift 3 /* Shift value */
|
||||
/* Gain = 14.000000 dB */
|
||||
#define HPF_Fs32000_Gain14_A0 12258 /* Floating point value 0.374093 */
|
||||
#define HPF_Fs32000_Gain14_A1 -8180 /* Floating point value -0.249642 */
|
||||
#define HPF_Fs32000_Gain14_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs32000_Gain14_B1 0 /* Floating point value -0.000000 */
|
||||
#define HPF_Fs32000_Gain14_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs32000_Gain14_Shift 3 /* Shift value */
|
||||
/* Gain = 15.000000 dB */
|
||||
#define HPF_Fs32000_Gain15_A0 13505 /* Floating point value 0.412147 */
|
||||
#define HPF_Fs32000_Gain15_A1 -9427 /* Floating point value -0.287695 */
|
||||
#define HPF_Fs32000_Gain15_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs32000_Gain15_B1 0 /* Floating point value -0.000000 */
|
||||
#define HPF_Fs32000_Gain15_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs32000_Gain15_Shift 3 /* Shift value */
|
||||
|
||||
|
||||
/* Coefficients for sample rate 44100Hz */
|
||||
/* Gain = 1.000000 dB */
|
||||
#define HPF_Fs44100_Gain1_A0 17442 /* Floating point value 0.532294 */
|
||||
#define HPF_Fs44100_Gain1_A1 -4761 /* Floating point value -0.145294 */
|
||||
#define HPF_Fs44100_Gain1_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs44100_Gain1_B1 -7173 /* Floating point value -0.218894 */
|
||||
#define HPF_Fs44100_Gain1_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs44100_Gain1_Shift 1 /* Shift value */
|
||||
/* Gain = 2.000000 dB */
|
||||
#define HPF_Fs44100_Gain2_A0 18797 /* Floating point value 0.573633 */
|
||||
#define HPF_Fs44100_Gain2_A1 -6116 /* Floating point value -0.186634 */
|
||||
#define HPF_Fs44100_Gain2_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs44100_Gain2_B1 -7173 /* Floating point value -0.218894 */
|
||||
#define HPF_Fs44100_Gain2_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs44100_Gain2_Shift 1 /* Shift value */
|
||||
/* Gain = 3.000000 dB */
|
||||
#define HPF_Fs44100_Gain3_A0 20317 /* Floating point value 0.620016 */
|
||||
#define HPF_Fs44100_Gain3_A1 -7635 /* Floating point value -0.233017 */
|
||||
#define HPF_Fs44100_Gain3_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs44100_Gain3_B1 -7173 /* Floating point value -0.218894 */
|
||||
#define HPF_Fs44100_Gain3_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs44100_Gain3_Shift 1 /* Shift value */
|
||||
/* Gain = 4.000000 dB */
|
||||
#define HPF_Fs44100_Gain4_A0 22022 /* Floating point value 0.672059 */
|
||||
#define HPF_Fs44100_Gain4_A1 -9341 /* Floating point value -0.285060 */
|
||||
#define HPF_Fs44100_Gain4_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs44100_Gain4_B1 -7173 /* Floating point value -0.218894 */
|
||||
#define HPF_Fs44100_Gain4_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs44100_Gain4_Shift 1 /* Shift value */
|
||||
/* Gain = 5.000000 dB */
|
||||
#define HPF_Fs44100_Gain5_A0 23935 /* Floating point value 0.730452 */
|
||||
#define HPF_Fs44100_Gain5_A1 -11254 /* Floating point value -0.343453 */
|
||||
#define HPF_Fs44100_Gain5_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs44100_Gain5_B1 -7173 /* Floating point value -0.218894 */
|
||||
#define HPF_Fs44100_Gain5_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs44100_Gain5_Shift 1 /* Shift value */
|
||||
/* Gain = 6.000000 dB */
|
||||
#define HPF_Fs44100_Gain6_A0 26082 /* Floating point value 0.795970 */
|
||||
#define HPF_Fs44100_Gain6_A1 -13401 /* Floating point value -0.408971 */
|
||||
#define HPF_Fs44100_Gain6_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs44100_Gain6_B1 -7173 /* Floating point value -0.218894 */
|
||||
#define HPF_Fs44100_Gain6_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs44100_Gain6_Shift 1 /* Shift value */
|
||||
/* Gain = 7.000000 dB */
|
||||
#define HPF_Fs44100_Gain7_A0 14279 /* Floating point value 0.435774 */
|
||||
#define HPF_Fs44100_Gain7_A1 -7924 /* Floating point value -0.241815 */
|
||||
#define HPF_Fs44100_Gain7_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs44100_Gain7_B1 -7173 /* Floating point value -0.218894 */
|
||||
#define HPF_Fs44100_Gain7_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs44100_Gain7_Shift 2 /* Shift value */
|
||||
/* Gain = 8.000000 dB */
|
||||
#define HPF_Fs44100_Gain8_A0 15634 /* Floating point value 0.477113 */
|
||||
#define HPF_Fs44100_Gain8_A1 -9278 /* Floating point value -0.283154 */
|
||||
#define HPF_Fs44100_Gain8_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs44100_Gain8_B1 -7173 /* Floating point value -0.218894 */
|
||||
#define HPF_Fs44100_Gain8_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs44100_Gain8_Shift 2 /* Shift value */
|
||||
/* Gain = 9.000000 dB */
|
||||
#define HPF_Fs44100_Gain9_A0 17154 /* Floating point value 0.523496 */
|
||||
#define HPF_Fs44100_Gain9_A1 -10798 /* Floating point value -0.329537 */
|
||||
#define HPF_Fs44100_Gain9_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs44100_Gain9_B1 -7173 /* Floating point value -0.218894 */
|
||||
#define HPF_Fs44100_Gain9_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs44100_Gain9_Shift 2 /* Shift value */
|
||||
/* Gain = 10.000000 dB */
|
||||
#define HPF_Fs44100_Gain10_A0 18859 /* Floating point value 0.575539 */
|
||||
#define HPF_Fs44100_Gain10_A1 -12504 /* Floating point value -0.381580 */
|
||||
#define HPF_Fs44100_Gain10_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs44100_Gain10_B1 -7173 /* Floating point value -0.218894 */
|
||||
#define HPF_Fs44100_Gain10_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs44100_Gain10_Shift 2 /* Shift value */
|
||||
/* Gain = 11.000000 dB */
|
||||
#define HPF_Fs44100_Gain11_A0 20773 /* Floating point value 0.633932 */
|
||||
#define HPF_Fs44100_Gain11_A1 -14417 /* Floating point value -0.439973 */
|
||||
#define HPF_Fs44100_Gain11_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs44100_Gain11_B1 -7173 /* Floating point value -0.218894 */
|
||||
#define HPF_Fs44100_Gain11_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs44100_Gain11_Shift 2 /* Shift value */
|
||||
/* Gain = 12.000000 dB */
|
||||
#define HPF_Fs44100_Gain12_A0 22920 /* Floating point value 0.699450 */
|
||||
#define HPF_Fs44100_Gain12_A1 -16564 /* Floating point value -0.505491 */
|
||||
#define HPF_Fs44100_Gain12_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs44100_Gain12_B1 -7173 /* Floating point value -0.218894 */
|
||||
#define HPF_Fs44100_Gain12_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs44100_Gain12_Shift 2 /* Shift value */
|
||||
/* Gain = 13.000000 dB */
|
||||
#define HPF_Fs44100_Gain13_A0 12694 /* Floating point value 0.387399 */
|
||||
#define HPF_Fs44100_Gain13_A1 -9509 /* Floating point value -0.290189 */
|
||||
#define HPF_Fs44100_Gain13_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs44100_Gain13_B1 -7173 /* Floating point value -0.218894 */
|
||||
#define HPF_Fs44100_Gain13_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs44100_Gain13_Shift 3 /* Shift value */
|
||||
/* Gain = 14.000000 dB */
|
||||
#define HPF_Fs44100_Gain14_A0 14049 /* Floating point value 0.428738 */
|
||||
#define HPF_Fs44100_Gain14_A1 -10864 /* Floating point value -0.331528 */
|
||||
#define HPF_Fs44100_Gain14_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs44100_Gain14_B1 -7173 /* Floating point value -0.218894 */
|
||||
#define HPF_Fs44100_Gain14_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs44100_Gain14_Shift 3 /* Shift value */
|
||||
/* Gain = 15.000000 dB */
|
||||
#define HPF_Fs44100_Gain15_A0 15569 /* Floating point value 0.475121 */
|
||||
#define HPF_Fs44100_Gain15_A1 -12383 /* Floating point value -0.377912 */
|
||||
#define HPF_Fs44100_Gain15_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs44100_Gain15_B1 -7173 /* Floating point value -0.218894 */
|
||||
#define HPF_Fs44100_Gain15_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs44100_Gain15_Shift 3 /* Shift value */
|
||||
|
||||
|
||||
/* Coefficients for sample rate 48000Hz */
|
||||
/* Gain = 1.000000 dB */
|
||||
#define HPF_Fs48000_Gain1_A0 17491 /* Floating point value 0.533777 */
|
||||
#define HPF_Fs48000_Gain1_A1 -5606 /* Floating point value -0.171082 */
|
||||
#define HPF_Fs48000_Gain1_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs48000_Gain1_B1 -8780 /* Floating point value -0.267949 */
|
||||
#define HPF_Fs48000_Gain1_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs48000_Gain1_Shift 1 /* Shift value */
|
||||
/* Gain = 2.000000 dB */
|
||||
#define HPF_Fs48000_Gain2_A0 18900 /* Floating point value 0.576779 */
|
||||
#define HPF_Fs48000_Gain2_A1 -7015 /* Floating point value -0.214085 */
|
||||
#define HPF_Fs48000_Gain2_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs48000_Gain2_B1 -8780 /* Floating point value -0.267949 */
|
||||
#define HPF_Fs48000_Gain2_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs48000_Gain2_Shift 1 /* Shift value */
|
||||
/* Gain = 3.000000 dB */
|
||||
#define HPF_Fs48000_Gain3_A0 20481 /* Floating point value 0.625029 */
|
||||
#define HPF_Fs48000_Gain3_A1 -8596 /* Floating point value -0.262335 */
|
||||
#define HPF_Fs48000_Gain3_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs48000_Gain3_B1 -8780 /* Floating point value -0.267949 */
|
||||
#define HPF_Fs48000_Gain3_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs48000_Gain3_Shift 1 /* Shift value */
|
||||
/* Gain = 4.000000 dB */
|
||||
#define HPF_Fs48000_Gain4_A0 22255 /* Floating point value 0.679167 */
|
||||
#define HPF_Fs48000_Gain4_A1 -10370 /* Floating point value -0.316472 */
|
||||
#define HPF_Fs48000_Gain4_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs48000_Gain4_B1 -8780 /* Floating point value -0.267949 */
|
||||
#define HPF_Fs48000_Gain4_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs48000_Gain4_Shift 1 /* Shift value */
|
||||
/* Gain = 5.000000 dB */
|
||||
#define HPF_Fs48000_Gain5_A0 24245 /* Floating point value 0.739910 */
|
||||
#define HPF_Fs48000_Gain5_A1 -12361 /* Floating point value -0.377215 */
|
||||
#define HPF_Fs48000_Gain5_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs48000_Gain5_B1 -8780 /* Floating point value -0.267949 */
|
||||
#define HPF_Fs48000_Gain5_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs48000_Gain5_Shift 1 /* Shift value */
|
||||
/* Gain = 6.000000 dB */
|
||||
#define HPF_Fs48000_Gain6_A0 26479 /* Floating point value 0.808065 */
|
||||
#define HPF_Fs48000_Gain6_A1 -14594 /* Floating point value -0.445370 */
|
||||
#define HPF_Fs48000_Gain6_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs48000_Gain6_B1 -8780 /* Floating point value -0.267949 */
|
||||
#define HPF_Fs48000_Gain6_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs48000_Gain6_Shift 1 /* Shift value */
|
||||
/* Gain = 7.000000 dB */
|
||||
#define HPF_Fs48000_Gain7_A0 14527 /* Floating point value 0.443318 */
|
||||
#define HPF_Fs48000_Gain7_A1 -8570 /* Floating point value -0.261540 */
|
||||
#define HPF_Fs48000_Gain7_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs48000_Gain7_B1 -8780 /* Floating point value -0.267949 */
|
||||
#define HPF_Fs48000_Gain7_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs48000_Gain7_Shift 2 /* Shift value */
|
||||
/* Gain = 8.000000 dB */
|
||||
#define HPF_Fs48000_Gain8_A0 15936 /* Floating point value 0.486321 */
|
||||
#define HPF_Fs48000_Gain8_A1 -9979 /* Floating point value -0.304543 */
|
||||
#define HPF_Fs48000_Gain8_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs48000_Gain8_B1 -8780 /* Floating point value -0.267949 */
|
||||
#define HPF_Fs48000_Gain8_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs48000_Gain8_Shift 2 /* Shift value */
|
||||
/* Gain = 9.000000 dB */
|
||||
#define HPF_Fs48000_Gain9_A0 17517 /* Floating point value 0.534571 */
|
||||
#define HPF_Fs48000_Gain9_A1 -11560 /* Floating point value -0.352793 */
|
||||
#define HPF_Fs48000_Gain9_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs48000_Gain9_B1 -8780 /* Floating point value -0.267949 */
|
||||
#define HPF_Fs48000_Gain9_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs48000_Gain9_Shift 2 /* Shift value */
|
||||
/* Gain = 10.000000 dB */
|
||||
#define HPF_Fs48000_Gain10_A0 19291 /* Floating point value 0.588708 */
|
||||
#define HPF_Fs48000_Gain10_A1 -13334 /* Floating point value -0.406930 */
|
||||
#define HPF_Fs48000_Gain10_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs48000_Gain10_B1 -8780 /* Floating point value -0.267949 */
|
||||
#define HPF_Fs48000_Gain10_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs48000_Gain10_Shift 2 /* Shift value */
|
||||
/* Gain = 11.000000 dB */
|
||||
#define HPF_Fs48000_Gain11_A0 21281 /* Floating point value 0.649452 */
|
||||
#define HPF_Fs48000_Gain11_A1 -15325 /* Floating point value -0.467674 */
|
||||
#define HPF_Fs48000_Gain11_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs48000_Gain11_B1 -8780 /* Floating point value -0.267949 */
|
||||
#define HPF_Fs48000_Gain11_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs48000_Gain11_Shift 2 /* Shift value */
|
||||
/* Gain = 12.000000 dB */
|
||||
#define HPF_Fs48000_Gain12_A0 23515 /* Floating point value 0.717607 */
|
||||
#define HPF_Fs48000_Gain12_A1 -17558 /* Floating point value -0.535829 */
|
||||
#define HPF_Fs48000_Gain12_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs48000_Gain12_B1 -8780 /* Floating point value -0.267949 */
|
||||
#define HPF_Fs48000_Gain12_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs48000_Gain12_Shift 2 /* Shift value */
|
||||
/* Gain = 13.000000 dB */
|
||||
#define HPF_Fs48000_Gain13_A0 13041 /* Floating point value 0.397982 */
|
||||
#define HPF_Fs48000_Gain13_A1 -10056 /* Floating point value -0.306877 */
|
||||
#define HPF_Fs48000_Gain13_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs48000_Gain13_B1 -8780 /* Floating point value -0.267949 */
|
||||
#define HPF_Fs48000_Gain13_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs48000_Gain13_Shift 3 /* Shift value */
|
||||
/* Gain = 14.000000 dB */
|
||||
#define HPF_Fs48000_Gain14_A0 14450 /* Floating point value 0.440984 */
|
||||
#define HPF_Fs48000_Gain14_A1 -11465 /* Floating point value -0.349880 */
|
||||
#define HPF_Fs48000_Gain14_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs48000_Gain14_B1 -8780 /* Floating point value -0.267949 */
|
||||
#define HPF_Fs48000_Gain14_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs48000_Gain14_Shift 3 /* Shift value */
|
||||
/* Gain = 15.000000 dB */
|
||||
#define HPF_Fs48000_Gain15_A0 16031 /* Floating point value 0.489234 */
|
||||
#define HPF_Fs48000_Gain15_A1 -13046 /* Floating point value -0.398130 */
|
||||
#define HPF_Fs48000_Gain15_A2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs48000_Gain15_B1 -8780 /* Floating point value -0.267949 */
|
||||
#define HPF_Fs48000_Gain15_B2 0 /* Floating point value 0.000000 */
|
||||
#define HPF_Fs48000_Gain15_Shift 3 /* Shift value */
|
||||
|
||||
|
||||
#endif
|
1032
media/libeffects/lvm/lib/Bundle/src/LVM_Control.c
Executable file
1032
media/libeffects/lvm/lib/Bundle/src/LVM_Control.c
Executable file
File diff suppressed because it is too large
Load Diff
1003
media/libeffects/lvm/lib/Bundle/src/LVM_Init.c
Executable file
1003
media/libeffects/lvm/lib/Bundle/src/LVM_Init.c
Executable file
File diff suppressed because it is too large
Load Diff
292
media/libeffects/lvm/lib/Bundle/src/LVM_Private.h
Executable file
292
media/libeffects/lvm/lib/Bundle/src/LVM_Private.h
Executable file
@ -0,0 +1,292 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**********************************************************************************
|
||||
|
||||
$Author: nxp007753 $
|
||||
$Revision: 1082 $
|
||||
$Date: 2010-07-05 12:44:39 +0200 (Mon, 05 Jul 2010) $
|
||||
|
||||
***********************************************************************************/
|
||||
|
||||
/************************************************************************************/
|
||||
/* */
|
||||
/* Header file for the private layer interface of concert sound bundle */
|
||||
/* */
|
||||
/* This files includes all definitions, types, structures and function */
|
||||
/* prototypes required by the execution layer. */
|
||||
/* */
|
||||
/************************************************************************************/
|
||||
|
||||
#ifndef __LVM_PRIVATE_H__
|
||||
#define __LVM_PRIVATE_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
/************************************************************************************/
|
||||
/* */
|
||||
/* Includes */
|
||||
/* */
|
||||
/************************************************************************************/
|
||||
|
||||
#include "LVM.h" /* LifeVibes */
|
||||
#include "LVM_Common.h" /* LifeVibes common */
|
||||
#include "BIQUAD.h" /* Biquad library */
|
||||
#include "LVC_Mixer.h" /* Mixer library */
|
||||
#include "LVCS_Private.h" /* Concert Sound */
|
||||
#include "LVDBE_Private.h" /* Dynamic Bass Enhancement */
|
||||
#include "LVEQNB_Private.h" /* N-Band equaliser */
|
||||
#include "LVPSA_Private.h" /* Parametric Spectrum Analyzer */
|
||||
|
||||
|
||||
/************************************************************************************/
|
||||
/* */
|
||||
/* Defines */
|
||||
/* */
|
||||
/************************************************************************************/
|
||||
|
||||
/* General */
|
||||
#define LVM_INVALID 0xFFFF /* Invalid init parameter */
|
||||
|
||||
/* Memory */
|
||||
#define LVM_INSTANCE_ALIGN 4 /* 32-bit for structures */
|
||||
#define LVM_FIRSTCALL 0 /* First call to the buffer */
|
||||
#define LVM_MAXBLOCKCALL 1 /* Maximum block size calls to the buffer */
|
||||
#define LVM_LASTCALL 2 /* Last call to the buffer */
|
||||
#define LVM_FIRSTLASTCALL 3 /* Single call for small number of samples */
|
||||
|
||||
/* Block Size */
|
||||
#define LVM_MIN_MAXBLOCKSIZE 16 /* Minimum MaxBlockSize Limit*/
|
||||
#define LVM_MANAGED_MAX_MAXBLOCKSIZE 8191 /* Maximum MaxBlockSzie Limit for Managed Buffer Mode*/
|
||||
#define LVM_UNMANAGED_MAX_MAXBLOCKSIZE 4096 /* Maximum MaxBlockSzie Limit for Unmanaged Buffer Mode */
|
||||
|
||||
#define MAX_INTERNAL_BLOCKSIZE 8128 /* Maximum multiple of 64 below 8191*/
|
||||
|
||||
#define MIN_INTERNAL_BLOCKSIZE 16 /* Minimum internal block size */
|
||||
#define MIN_INTERNAL_BLOCKSHIFT 4 /* Minimum internal block size as a power of 2 */
|
||||
#define MIN_INTERNAL_BLOCKMASK 0xFFF0 /* Minimum internal block size mask */
|
||||
|
||||
#define LVM_PSA_DYNAMICRANGE 60 /* Spectral Dynamic range: used for offseting output*/
|
||||
#define LVM_PSA_BARHEIGHT 127 /* Spectral Bar Height*/
|
||||
|
||||
#define LVM_TE_MIN_EFFECTLEVEL 0 /*TE Minimum EffectLevel*/
|
||||
#define LVM_TE_MAX_EFFECTLEVEL 15 /*TE Maximum Effect level*/
|
||||
|
||||
#define LVM_VC_MIN_EFFECTLEVEL -96 /*VC Minimum EffectLevel*/
|
||||
#define LVM_VC_MAX_EFFECTLEVEL 0 /*VC Maximum Effect level*/
|
||||
|
||||
#define LVM_BE_MIN_EFFECTLEVEL 0 /*BE Minimum EffectLevel*/
|
||||
#define LVM_BE_MAX_EFFECTLEVEL 15 /*BE Maximum Effect level*/
|
||||
|
||||
#define LVM_EQNB_MIN_BAND_FREQ 20 /*EQNB Minimum Band Frequency*/
|
||||
#define LVM_EQNB_MAX_BAND_FREQ 24000 /*EQNB Maximum Band Frequency*/
|
||||
#define LVM_EQNB_MIN_BAND_GAIN -15 /*EQNB Minimum Band Frequency*/
|
||||
#define LVM_EQNB_MAX_BAND_GAIN 15 /*EQNB Maximum Band Frequency*/
|
||||
#define LVM_EQNB_MIN_QFACTOR 25 /*EQNB Minimum Q Factor*/
|
||||
#define LVM_EQNB_MAX_QFACTOR 1200 /*EQNB Maximum Q Factor*/
|
||||
#define LVM_EQNB_MIN_LPF_FREQ 1000 /*EQNB Minimum Low Pass Corner frequency*/
|
||||
#define LVM_EQNB_MIN_HPF_FREQ 20 /*EQNB Minimum High Pass Corner frequency*/
|
||||
#define LVM_EQNB_MAX_HPF_FREQ 1000 /*EQNB Maximum High Pass Corner frequency*/
|
||||
|
||||
#define LVM_CS_MIN_EFFECT_LEVEL 0 /*CS Minimum Effect Level*/
|
||||
#define LVM_CS_MAX_REVERB_LEVEL 100 /*CS Maximum Reverb Level*/
|
||||
#define LVM_VIRTUALIZER_MAX_REVERB_LEVEL 100 /*Vitrualizer Maximum Reverb Level*/
|
||||
|
||||
#define LVM_VC_MIXER_TIME 100 /*VC mixer time*/
|
||||
#define LVM_VC_BALANCE_MAX 96 /*VC balance max value*/
|
||||
#define LVM_VC_BALANCE_MIN -96 /*VC balance min value*/
|
||||
|
||||
/* Algorithm masks */
|
||||
#define LVM_CS_MASK 1
|
||||
#define LVM_EQNB_MASK 2
|
||||
#define LVM_DBE_MASK 4
|
||||
#define LVM_VC_MASK 16
|
||||
#define LVM_TE_MASK 32
|
||||
#define LVM_PSA_MASK 2048
|
||||
|
||||
|
||||
/************************************************************************************/
|
||||
/* */
|
||||
/* Structures */
|
||||
/* */
|
||||
/************************************************************************************/
|
||||
|
||||
/* Memory region definition */
|
||||
typedef struct
|
||||
{
|
||||
LVM_UINT32 Size; /* Region size in bytes */
|
||||
LVM_UINT16 Alignment; /* Byte alignment */
|
||||
LVM_MemoryTypes_en Type; /* Region type */
|
||||
void *pBaseAddress; /* Pointer to the region base address */
|
||||
} LVM_IntMemoryRegion_t;
|
||||
|
||||
|
||||
/* Memory table containing the region definitions */
|
||||
typedef struct
|
||||
{
|
||||
LVM_IntMemoryRegion_t Region[LVM_NR_MEMORY_REGIONS]; /* One definition for each region */
|
||||
} LVM_IntMemTab_t;
|
||||
|
||||
|
||||
/* Buffer Management */
|
||||
typedef struct
|
||||
{
|
||||
LVM_INT16 *pScratch; /* Bundle scratch buffer */
|
||||
|
||||
LVM_INT16 BufferState; /* Buffer status */
|
||||
LVM_INT16 InDelayBuffer[6*MIN_INTERNAL_BLOCKSIZE]; /* Input buffer delay line, left and right */
|
||||
LVM_INT16 InDelaySamples; /* Number of samples in the input delay buffer */
|
||||
|
||||
LVM_INT16 OutDelayBuffer[2*MIN_INTERNAL_BLOCKSIZE]; /* Output buffer delay line */
|
||||
LVM_INT16 OutDelaySamples; /* Number of samples in the output delay buffer, left and right */
|
||||
LVM_INT16 SamplesToOutput; /* Samples to write to the output */
|
||||
} LVM_Buffer_t;
|
||||
|
||||
|
||||
/* Filter taps */
|
||||
typedef struct
|
||||
{
|
||||
Biquad_2I_Order1_Taps_t TrebleBoost_Taps; /* Treble boost Taps */
|
||||
} LVM_TE_Data_t;
|
||||
|
||||
|
||||
/* Coefficients */
|
||||
typedef struct
|
||||
{
|
||||
Biquad_Instance_t TrebleBoost_State; /* State for the treble boost filter */
|
||||
} LVM_TE_Coefs_t;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/* Public parameters */
|
||||
LVM_MemTab_t MemoryTable; /* Instance memory allocation table */
|
||||
LVM_ControlParams_t Params; /* Control parameters */
|
||||
LVM_InstParams_t InstParams; /* Instance parameters */
|
||||
|
||||
/* Private parameters */
|
||||
LVM_UINT16 ControlPending; /* Control flag to indicate update pending */
|
||||
LVM_ControlParams_t NewParams; /* New control parameters pending update */
|
||||
|
||||
/* Buffer control */
|
||||
LVM_INT16 InternalBlockSize; /* Maximum internal block size */
|
||||
LVM_Buffer_t *pBufferManagement; /* Buffer management variables */
|
||||
LVM_INT16 SamplesToProcess; /* Input samples left to process */
|
||||
LVM_INT16 *pInputSamples; /* External input sample pointer */
|
||||
LVM_INT16 *pOutputSamples; /* External output sample pointer */
|
||||
|
||||
/* Configuration number */
|
||||
LVM_INT32 ConfigurationNumber;
|
||||
LVM_INT32 BlickSizeMultiple;
|
||||
|
||||
/* DC removal */
|
||||
Biquad_Instance_t DC_RemovalInstance; /* DC removal filter instance */
|
||||
|
||||
/* Concert Sound */
|
||||
LVCS_Handle_t hCSInstance; /* Concert Sound instance handle */
|
||||
LVCS_Instance_t CS_Instance; /* Concert Sound instance */
|
||||
LVM_INT16 CS_Active; /* Control flag */
|
||||
|
||||
/* Equalizer */
|
||||
LVEQNB_Handle_t hEQNBInstance; /* N-Band Equaliser instance handle */
|
||||
LVEQNB_Instance_t EQNB_Instance; /* N-Band Equaliser instance */
|
||||
LVM_EQNB_BandDef_t *pEQNB_BandDefs; /* Local storage for new definitions */
|
||||
LVM_EQNB_BandDef_t *pEQNB_UserDefs; /* Local storage for the user's definitions */
|
||||
LVM_INT16 EQNB_Active; /* Control flag */
|
||||
|
||||
/* Dynamic Bass Enhancement */
|
||||
LVDBE_Handle_t hDBEInstance; /* Dynamic Bass Enhancement instance handle */
|
||||
LVDBE_Instance_t DBE_Instance; /* Dynamic Bass Enhancement instance */
|
||||
LVM_INT16 DBE_Active; /* Control flag */
|
||||
|
||||
/* Volume Control */
|
||||
LVMixer3_1St_st VC_Volume; /* Volume scaler */
|
||||
LVMixer3_2St_st VC_BalanceMix; /* VC balance mixer */
|
||||
LVM_INT16 VC_VolumedB; /* Gain in dB */
|
||||
LVM_INT16 VC_Active; /* Control flag */
|
||||
LVM_INT16 VC_AVLFixedVolume; /* AVL fixed volume */
|
||||
|
||||
/* Treble Enhancement */
|
||||
LVM_TE_Data_t *pTE_Taps; /* Treble boost Taps */
|
||||
LVM_TE_Coefs_t *pTE_State; /* State for the treble boost filter */
|
||||
LVM_INT16 TE_Active; /* Control flag */
|
||||
|
||||
/* Headroom */
|
||||
LVM_HeadroomParams_t NewHeadroomParams; /* New headroom parameters pending update */
|
||||
LVM_HeadroomParams_t HeadroomParams; /* Headroom parameters */
|
||||
LVM_HeadroomBandDef_t *pHeadroom_BandDefs; /* Local storage for new definitions */
|
||||
LVM_HeadroomBandDef_t *pHeadroom_UserDefs; /* Local storage for the user's definitions */
|
||||
LVM_UINT16 Headroom; /* Value of the current headroom */
|
||||
|
||||
/* Spectrum Analyzer */
|
||||
pLVPSA_Handle_t hPSAInstance; /* Spectrum Analyzer instance handle */
|
||||
LVPSA_InstancePr_t PSA_Instance; /* Spectrum Analyzer instance */
|
||||
LVPSA_InitParams_t PSA_InitParams; /* Spectrum Analyzer initialization parameters */
|
||||
LVPSA_ControlParams_t PSA_ControlParams; /* Spectrum Analyzer control parameters */
|
||||
LVM_INT16 PSA_GainOffset; /* Tone control flag */
|
||||
LVM_Callback CallBack;
|
||||
LVM_INT16 *pPSAInput; /* PSA input pointer */
|
||||
|
||||
LVM_INT16 NoSmoothVolume; /* Enable or disable smooth volume changes*/
|
||||
|
||||
} LVM_Instance_t;
|
||||
|
||||
|
||||
/************************************************************************************/
|
||||
/* */
|
||||
/* Function Prototypes */
|
||||
/* */
|
||||
/************************************************************************************/
|
||||
|
||||
LVM_ReturnStatus_en LVM_ApplyNewSettings(LVM_Handle_t hInstance);
|
||||
|
||||
void LVM_SetTrebleBoost( LVM_Instance_t *pInstance,
|
||||
LVM_ControlParams_t *pParams);
|
||||
|
||||
void LVM_SetVolume( LVM_Instance_t *pInstance,
|
||||
LVM_ControlParams_t *pParams);
|
||||
|
||||
LVM_INT32 LVM_VCCallBack(void* pBundleHandle,
|
||||
void* pGeneralPurpose,
|
||||
short CallBackParam);
|
||||
|
||||
void LVM_SetHeadroom( LVM_Instance_t *pInstance,
|
||||
LVM_ControlParams_t *pParams);
|
||||
|
||||
void LVM_BufferIn( LVM_Handle_t hInstance,
|
||||
const LVM_INT16 *pInData,
|
||||
LVM_INT16 **pToProcess,
|
||||
LVM_INT16 **pProcessed,
|
||||
LVM_UINT16 *pNumSamples);
|
||||
|
||||
void LVM_BufferOut( LVM_Handle_t hInstance,
|
||||
LVM_INT16 *pOutData,
|
||||
LVM_UINT16 *pNumSamples);
|
||||
|
||||
LVM_INT32 LVM_AlgoCallBack( void *pBundleHandle,
|
||||
void *pData,
|
||||
LVM_INT16 callbackId);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __LVM_PRIVATE_H__ */
|
||||
|
283
media/libeffects/lvm/lib/Bundle/src/LVM_Process.c
Executable file
283
media/libeffects/lvm/lib/Bundle/src/LVM_Process.c
Executable file
@ -0,0 +1,283 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/****************************************************************************************
|
||||
|
||||
$Author: beq07716 $
|
||||
$Revision: 1002 $
|
||||
$Date: 2010-06-28 13:40:09 +0200 (Mon, 28 Jun 2010) $
|
||||
|
||||
*****************************************************************************************/
|
||||
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* Includes */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
|
||||
#include "LVM_Private.h"
|
||||
#include "VectorArithmetic.h"
|
||||
#include "LVM_Coeffs.h"
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION: LVM_Process */
|
||||
/* */
|
||||
/* DESCRIPTION: */
|
||||
/* Process function for the LifeVibes module. */
|
||||
/* */
|
||||
/* PARAMETERS: */
|
||||
/* hInstance Instance handle */
|
||||
/* pInData Pointer to the input data */
|
||||
/* pOutData Pointer to the output data */
|
||||
/* NumSamples Number of samples in the input buffer */
|
||||
/* AudioTime Audio Time of the current input buffer in ms */
|
||||
/* */
|
||||
/* RETURNS: */
|
||||
/* LVM_SUCCESS Succeeded */
|
||||
/* LVM_INVALIDNUMSAMPLES When the NumSamples is not a valied multiple in unmanaged */
|
||||
/* buffer mode */
|
||||
/* LVM_ALIGNMENTERROR When either the input our output buffers are not 32-bit */
|
||||
/* aligned in unmanaged mode */
|
||||
/* LVM_NULLADDRESS When one of hInstance, pInData or pOutData is NULL */
|
||||
/* */
|
||||
/* NOTES: */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
|
||||
LVM_ReturnStatus_en LVM_Process(LVM_Handle_t hInstance,
|
||||
const LVM_INT16 *pInData,
|
||||
LVM_INT16 *pOutData,
|
||||
LVM_UINT16 NumSamples,
|
||||
LVM_UINT32 AudioTime)
|
||||
{
|
||||
|
||||
LVM_Instance_t *pInstance = (LVM_Instance_t *)hInstance;
|
||||
LVM_UINT16 SampleCount = NumSamples;
|
||||
LVM_INT16 *pInput = (LVM_INT16 *)pInData;
|
||||
LVM_INT16 *pToProcess = (LVM_INT16 *)pInData;
|
||||
LVM_INT16 *pProcessed = pOutData;
|
||||
LVM_ReturnStatus_en Status;
|
||||
|
||||
/*
|
||||
* Check if the number of samples is zero
|
||||
*/
|
||||
if (NumSamples == 0)
|
||||
{
|
||||
return(LVM_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Check valid points have been given
|
||||
*/
|
||||
if ((hInstance == LVM_NULL) || (pInData == LVM_NULL) || (pOutData == LVM_NULL))
|
||||
{
|
||||
return (LVM_NULLADDRESS);
|
||||
}
|
||||
|
||||
/*
|
||||
* For unmanaged mode only
|
||||
*/
|
||||
if(pInstance->InstParams.BufferMode == LVM_UNMANAGED_BUFFERS)
|
||||
{
|
||||
/*
|
||||
* Check if the number of samples is a good multiple (unmanaged mode only)
|
||||
*/
|
||||
if((NumSamples % pInstance->BlickSizeMultiple) != 0)
|
||||
{
|
||||
return(LVM_INVALIDNUMSAMPLES);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check the buffer alignment
|
||||
*/
|
||||
if((((LVM_UINT32)pInData % 4) != 0) || (((LVM_UINT32)pOutData % 4) != 0))
|
||||
{
|
||||
return(LVM_ALIGNMENTERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Update new parameters if necessary
|
||||
*/
|
||||
if (pInstance->ControlPending == LVM_TRUE)
|
||||
{
|
||||
Status = LVM_ApplyNewSettings(hInstance);
|
||||
|
||||
if(Status != LVM_SUCCESS)
|
||||
{
|
||||
return Status;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Convert from Mono if necessary
|
||||
*/
|
||||
if (pInstance->Params.SourceFormat == LVM_MONO)
|
||||
{
|
||||
MonoTo2I_16(pInData, /* Source */
|
||||
pOutData, /* Destination */
|
||||
(LVM_INT16)NumSamples); /* Number of input samples */
|
||||
pInput = pOutData;
|
||||
pToProcess = pOutData;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Process the data with managed buffers
|
||||
*/
|
||||
while (SampleCount != 0)
|
||||
{
|
||||
/*
|
||||
* Manage the input buffer and frame processing
|
||||
*/
|
||||
LVM_BufferIn(hInstance,
|
||||
pInput,
|
||||
&pToProcess,
|
||||
&pProcessed,
|
||||
&SampleCount);
|
||||
|
||||
/*
|
||||
* Only process data when SampleCount is none zero, a zero count can occur when
|
||||
* the BufferIn routine is working in managed mode.
|
||||
*/
|
||||
if (SampleCount != 0)
|
||||
{
|
||||
|
||||
/*
|
||||
* Apply ConcertSound if required
|
||||
*/
|
||||
if (pInstance->CS_Active == LVM_TRUE)
|
||||
{
|
||||
(void)LVCS_Process(pInstance->hCSInstance, /* Concert Sound instance handle */
|
||||
pToProcess,
|
||||
pProcessed,
|
||||
SampleCount);
|
||||
pToProcess = pProcessed;
|
||||
}
|
||||
|
||||
/*
|
||||
* Apply volume if required
|
||||
*/
|
||||
if (pInstance->VC_Active!=0)
|
||||
{
|
||||
LVC_MixSoft_1St_D16C31_SAT(&pInstance->VC_Volume,
|
||||
pToProcess,
|
||||
pProcessed,
|
||||
(LVM_INT16)(2*SampleCount)); /* Left and right*/
|
||||
pToProcess = pProcessed;
|
||||
}
|
||||
|
||||
/*
|
||||
* Call N-Band equaliser if enabled
|
||||
*/
|
||||
if (pInstance->EQNB_Active == LVM_TRUE)
|
||||
{
|
||||
LVEQNB_Process(pInstance->hEQNBInstance, /* N-Band equaliser instance handle */
|
||||
pToProcess,
|
||||
pProcessed,
|
||||
SampleCount);
|
||||
pToProcess = pProcessed;
|
||||
}
|
||||
|
||||
/*
|
||||
* Call bass enhancement if enabled
|
||||
*/
|
||||
if (pInstance->DBE_Active == LVM_TRUE)
|
||||
{
|
||||
LVDBE_Process(pInstance->hDBEInstance, /* Dynamic Bass Enhancement instance handle */
|
||||
pToProcess,
|
||||
pProcessed,
|
||||
SampleCount);
|
||||
pToProcess = pProcessed;
|
||||
}
|
||||
|
||||
/*
|
||||
* Bypass mode or everything off, so copy the input to the output
|
||||
*/
|
||||
if (pToProcess != pProcessed)
|
||||
{
|
||||
Copy_16(pToProcess, /* Source */
|
||||
pProcessed, /* Destination */
|
||||
(LVM_INT16)(2*SampleCount)); /* Left and right */
|
||||
}
|
||||
|
||||
/*
|
||||
* Apply treble boost if required
|
||||
*/
|
||||
if (pInstance->TE_Active == LVM_TRUE)
|
||||
{
|
||||
/*
|
||||
* Apply the filter
|
||||
*/
|
||||
FO_2I_D16F32C15_LShx_TRC_WRA_01(&pInstance->pTE_State->TrebleBoost_State,
|
||||
pProcessed,
|
||||
pProcessed,
|
||||
(LVM_INT16)SampleCount);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Volume balance
|
||||
*/
|
||||
LVC_MixSoft_1St_2i_D16C31_SAT(&pInstance->VC_BalanceMix,
|
||||
pProcessed,
|
||||
pProcessed,
|
||||
SampleCount);
|
||||
|
||||
/*
|
||||
* Perform Parametric Spectum Analysis
|
||||
*/
|
||||
if ((pInstance->Params.PSA_Enable == LVM_PSA_ON)&&(pInstance->InstParams.PSA_Included==LVM_PSA_ON))
|
||||
{
|
||||
From2iToMono_16(pProcessed,
|
||||
pInstance->pPSAInput,
|
||||
(LVM_INT16) (SampleCount));
|
||||
|
||||
LVPSA_Process(pInstance->hPSAInstance,
|
||||
pInstance->pPSAInput,
|
||||
(LVM_UINT16) (SampleCount),
|
||||
AudioTime);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* DC removal
|
||||
*/
|
||||
DC_2I_D16_TRC_WRA_01(&pInstance->DC_RemovalInstance,
|
||||
pProcessed,
|
||||
pProcessed,
|
||||
(LVM_INT16)SampleCount);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Manage the output buffer
|
||||
*/
|
||||
LVM_BufferOut(hInstance,
|
||||
pOutData,
|
||||
&SampleCount);
|
||||
|
||||
}
|
||||
|
||||
return(LVM_SUCCESS);
|
||||
}
|
397
media/libeffects/lvm/lib/Bundle/src/LVM_Tables.c
Executable file
397
media/libeffects/lvm/lib/Bundle/src/LVM_Tables.c
Executable file
@ -0,0 +1,397 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/************************************************************************************
|
||||
|
||||
$Author: beq07716 $
|
||||
$Revision: 1002 $
|
||||
$Date: 2010-06-28 13:40:09 +0200 (Mon, 28 Jun 2010) $
|
||||
|
||||
*************************************************************************************/
|
||||
|
||||
/************************************************************************************/
|
||||
/* */
|
||||
/* Includes */
|
||||
/* */
|
||||
/************************************************************************************/
|
||||
|
||||
#include "LVM_Tables.h"
|
||||
#include "LVM_Coeffs.h"
|
||||
|
||||
/************************************************************************************/
|
||||
/* */
|
||||
/* Treble Boost Filter Coefficients */
|
||||
/* */
|
||||
/************************************************************************************/
|
||||
|
||||
FO_C16_LShx_Coefs_t LVM_TrebleBoostCoefs[] = {
|
||||
|
||||
/* 22kHz sampling rate */
|
||||
{HPF_Fs22050_Gain1_A1, /* Gain setting 1 */
|
||||
HPF_Fs22050_Gain1_A0,
|
||||
-HPF_Fs22050_Gain1_B1,
|
||||
HPF_Fs22050_Gain1_Shift},
|
||||
{HPF_Fs22050_Gain2_A1, /* Gain setting 2 */
|
||||
HPF_Fs22050_Gain2_A0,
|
||||
-HPF_Fs22050_Gain2_B1,
|
||||
HPF_Fs22050_Gain2_Shift},
|
||||
{HPF_Fs22050_Gain3_A1, /* Gain setting 3 */
|
||||
HPF_Fs22050_Gain3_A0,
|
||||
-HPF_Fs22050_Gain3_B1,
|
||||
HPF_Fs22050_Gain3_Shift},
|
||||
{HPF_Fs22050_Gain4_A1, /* Gain setting 4 */
|
||||
HPF_Fs22050_Gain4_A0,
|
||||
-HPF_Fs22050_Gain4_B1,
|
||||
HPF_Fs22050_Gain4_Shift},
|
||||
{HPF_Fs22050_Gain5_A1, /* Gain setting 5 */
|
||||
HPF_Fs22050_Gain5_A0,
|
||||
-HPF_Fs22050_Gain5_B1,
|
||||
HPF_Fs22050_Gain5_Shift},
|
||||
{HPF_Fs22050_Gain6_A1, /* Gain setting 6 */
|
||||
HPF_Fs22050_Gain6_A0,
|
||||
-HPF_Fs22050_Gain6_B1,
|
||||
HPF_Fs22050_Gain6_Shift},
|
||||
{HPF_Fs22050_Gain7_A1, /* Gain setting 7 */
|
||||
HPF_Fs22050_Gain7_A0,
|
||||
-HPF_Fs22050_Gain7_B1,
|
||||
HPF_Fs22050_Gain7_Shift},
|
||||
{HPF_Fs22050_Gain8_A1, /* Gain setting 8 */
|
||||
HPF_Fs22050_Gain8_A0,
|
||||
-HPF_Fs22050_Gain8_B1,
|
||||
HPF_Fs22050_Gain8_Shift},
|
||||
{HPF_Fs22050_Gain9_A1, /* Gain setting 9 */
|
||||
HPF_Fs22050_Gain9_A0,
|
||||
-HPF_Fs22050_Gain9_B1,
|
||||
HPF_Fs22050_Gain9_Shift},
|
||||
{HPF_Fs22050_Gain10_A1, /* Gain setting 10 */
|
||||
HPF_Fs22050_Gain10_A0,
|
||||
-HPF_Fs22050_Gain10_B1,
|
||||
HPF_Fs22050_Gain10_Shift},
|
||||
{HPF_Fs22050_Gain11_A1, /* Gain setting 11 */
|
||||
HPF_Fs22050_Gain11_A0,
|
||||
-HPF_Fs22050_Gain11_B1,
|
||||
HPF_Fs22050_Gain11_Shift},
|
||||
{HPF_Fs22050_Gain12_A1, /* Gain setting 12 */
|
||||
HPF_Fs22050_Gain12_A0,
|
||||
-HPF_Fs22050_Gain12_B1,
|
||||
HPF_Fs22050_Gain12_Shift},
|
||||
{HPF_Fs22050_Gain13_A1, /* Gain setting 13 */
|
||||
HPF_Fs22050_Gain13_A0,
|
||||
-HPF_Fs22050_Gain13_B1,
|
||||
HPF_Fs22050_Gain13_Shift},
|
||||
{HPF_Fs22050_Gain14_A1, /* Gain setting 14 */
|
||||
HPF_Fs22050_Gain14_A0,
|
||||
-HPF_Fs22050_Gain14_B1,
|
||||
HPF_Fs22050_Gain14_Shift},
|
||||
{HPF_Fs22050_Gain15_A1, /* Gain setting 15 */
|
||||
HPF_Fs22050_Gain15_A0,
|
||||
-HPF_Fs22050_Gain15_B1,
|
||||
HPF_Fs22050_Gain15_Shift},
|
||||
|
||||
/* 24kHz sampling rate */
|
||||
{HPF_Fs24000_Gain1_A1, /* Gain setting 1 */
|
||||
HPF_Fs24000_Gain1_A0,
|
||||
-HPF_Fs24000_Gain1_B1,
|
||||
HPF_Fs24000_Gain1_Shift},
|
||||
{HPF_Fs24000_Gain2_A1, /* Gain setting 2 */
|
||||
HPF_Fs24000_Gain2_A0,
|
||||
-HPF_Fs24000_Gain2_B1,
|
||||
HPF_Fs24000_Gain2_Shift},
|
||||
{HPF_Fs24000_Gain3_A1, /* Gain setting 3 */
|
||||
HPF_Fs24000_Gain3_A0,
|
||||
-HPF_Fs24000_Gain3_B1,
|
||||
HPF_Fs24000_Gain3_Shift},
|
||||
{HPF_Fs24000_Gain4_A1, /* Gain setting 4 */
|
||||
HPF_Fs24000_Gain4_A0,
|
||||
-HPF_Fs24000_Gain4_B1,
|
||||
HPF_Fs24000_Gain4_Shift},
|
||||
{HPF_Fs24000_Gain5_A1, /* Gain setting 5 */
|
||||
HPF_Fs24000_Gain5_A0,
|
||||
-HPF_Fs24000_Gain5_B1,
|
||||
HPF_Fs24000_Gain5_Shift},
|
||||
{HPF_Fs24000_Gain6_A1, /* Gain setting 6 */
|
||||
HPF_Fs24000_Gain6_A0,
|
||||
-HPF_Fs24000_Gain6_B1,
|
||||
HPF_Fs24000_Gain6_Shift},
|
||||
{HPF_Fs24000_Gain7_A1, /* Gain setting 7 */
|
||||
HPF_Fs24000_Gain7_A0,
|
||||
-HPF_Fs24000_Gain7_B1,
|
||||
HPF_Fs24000_Gain7_Shift},
|
||||
{HPF_Fs24000_Gain8_A1, /* Gain setting 8 */
|
||||
HPF_Fs24000_Gain8_A0,
|
||||
-HPF_Fs24000_Gain8_B1,
|
||||
HPF_Fs24000_Gain8_Shift},
|
||||
{HPF_Fs24000_Gain9_A1, /* Gain setting 9 */
|
||||
HPF_Fs24000_Gain9_A0,
|
||||
-HPF_Fs24000_Gain9_B1,
|
||||
HPF_Fs24000_Gain9_Shift},
|
||||
{HPF_Fs24000_Gain10_A1, /* Gain setting 10 */
|
||||
HPF_Fs24000_Gain10_A0,
|
||||
-HPF_Fs24000_Gain10_B1,
|
||||
HPF_Fs24000_Gain10_Shift},
|
||||
{HPF_Fs24000_Gain11_A1, /* Gain setting 11 */
|
||||
HPF_Fs24000_Gain11_A0,
|
||||
-HPF_Fs24000_Gain11_B1,
|
||||
HPF_Fs24000_Gain11_Shift},
|
||||
{HPF_Fs24000_Gain12_A1, /* Gain setting 12 */
|
||||
HPF_Fs24000_Gain12_A0,
|
||||
-HPF_Fs24000_Gain12_B1,
|
||||
HPF_Fs24000_Gain12_Shift},
|
||||
{HPF_Fs24000_Gain13_A1, /* Gain setting 13 */
|
||||
HPF_Fs24000_Gain13_A0,
|
||||
-HPF_Fs24000_Gain13_B1,
|
||||
HPF_Fs24000_Gain13_Shift},
|
||||
{HPF_Fs24000_Gain14_A1, /* Gain setting 14 */
|
||||
HPF_Fs24000_Gain14_A0,
|
||||
-HPF_Fs24000_Gain14_B1,
|
||||
HPF_Fs24000_Gain14_Shift},
|
||||
{HPF_Fs24000_Gain15_A1, /* Gain setting 15 */
|
||||
HPF_Fs24000_Gain15_A0,
|
||||
-HPF_Fs24000_Gain15_B1,
|
||||
HPF_Fs24000_Gain15_Shift},
|
||||
|
||||
/* 32kHz sampling rate */
|
||||
{HPF_Fs32000_Gain1_A1, /* Gain setting 1 */
|
||||
HPF_Fs32000_Gain1_A0,
|
||||
-HPF_Fs32000_Gain1_B1,
|
||||
HPF_Fs32000_Gain1_Shift},
|
||||
{HPF_Fs32000_Gain2_A1, /* Gain setting 2 */
|
||||
HPF_Fs32000_Gain2_A0,
|
||||
-HPF_Fs32000_Gain2_B1,
|
||||
HPF_Fs32000_Gain2_Shift},
|
||||
{HPF_Fs32000_Gain3_A1, /* Gain setting 3 */
|
||||
HPF_Fs32000_Gain3_A0,
|
||||
-HPF_Fs32000_Gain3_B1,
|
||||
HPF_Fs32000_Gain3_Shift},
|
||||
{HPF_Fs32000_Gain4_A1, /* Gain setting 4 */
|
||||
HPF_Fs32000_Gain4_A0,
|
||||
-HPF_Fs32000_Gain4_B1,
|
||||
HPF_Fs32000_Gain4_Shift},
|
||||
{HPF_Fs32000_Gain5_A1, /* Gain setting 5 */
|
||||
HPF_Fs32000_Gain5_A0,
|
||||
-HPF_Fs32000_Gain5_B1,
|
||||
HPF_Fs32000_Gain5_Shift},
|
||||
{HPF_Fs32000_Gain6_A1, /* Gain setting 6 */
|
||||
HPF_Fs32000_Gain6_A0,
|
||||
-HPF_Fs32000_Gain6_B1,
|
||||
HPF_Fs32000_Gain6_Shift},
|
||||
{HPF_Fs32000_Gain7_A1, /* Gain setting 7 */
|
||||
HPF_Fs32000_Gain7_A0,
|
||||
-HPF_Fs32000_Gain7_B1,
|
||||
HPF_Fs32000_Gain7_Shift},
|
||||
{HPF_Fs32000_Gain8_A1, /* Gain setting 8 */
|
||||
HPF_Fs32000_Gain8_A0,
|
||||
-HPF_Fs32000_Gain8_B1,
|
||||
HPF_Fs32000_Gain8_Shift},
|
||||
{HPF_Fs32000_Gain9_A1, /* Gain setting 9 */
|
||||
HPF_Fs32000_Gain9_A0,
|
||||
-HPF_Fs32000_Gain9_B1,
|
||||
HPF_Fs32000_Gain9_Shift},
|
||||
{HPF_Fs32000_Gain10_A1, /* Gain setting 10 */
|
||||
HPF_Fs32000_Gain10_A0,
|
||||
-HPF_Fs32000_Gain10_B1,
|
||||
HPF_Fs32000_Gain10_Shift},
|
||||
{HPF_Fs32000_Gain11_A1, /* Gain setting 11 */
|
||||
HPF_Fs32000_Gain11_A0,
|
||||
-HPF_Fs32000_Gain11_B1,
|
||||
HPF_Fs32000_Gain11_Shift},
|
||||
{HPF_Fs32000_Gain12_A1, /* Gain setting 12 */
|
||||
HPF_Fs32000_Gain12_A0,
|
||||
-HPF_Fs32000_Gain12_B1,
|
||||
HPF_Fs32000_Gain12_Shift},
|
||||
{HPF_Fs32000_Gain13_A1, /* Gain setting 13 */
|
||||
HPF_Fs32000_Gain13_A0,
|
||||
-HPF_Fs32000_Gain13_B1,
|
||||
HPF_Fs32000_Gain13_Shift},
|
||||
{HPF_Fs32000_Gain14_A1, /* Gain setting 14 */
|
||||
HPF_Fs32000_Gain14_A0,
|
||||
-HPF_Fs32000_Gain14_B1,
|
||||
HPF_Fs32000_Gain14_Shift},
|
||||
{HPF_Fs32000_Gain15_A1, /* Gain setting 15 */
|
||||
HPF_Fs32000_Gain15_A0,
|
||||
-HPF_Fs32000_Gain15_B1,
|
||||
HPF_Fs32000_Gain15_Shift},
|
||||
|
||||
/* 44kHz sampling rate */
|
||||
{HPF_Fs44100_Gain1_A1, /* Gain setting 1 */
|
||||
HPF_Fs44100_Gain1_A0,
|
||||
-HPF_Fs44100_Gain1_B1,
|
||||
HPF_Fs44100_Gain1_Shift},
|
||||
{HPF_Fs44100_Gain2_A1, /* Gain setting 2 */
|
||||
HPF_Fs44100_Gain2_A0,
|
||||
-HPF_Fs44100_Gain2_B1,
|
||||
HPF_Fs44100_Gain2_Shift},
|
||||
{HPF_Fs44100_Gain3_A1, /* Gain setting 3 */
|
||||
HPF_Fs44100_Gain3_A0,
|
||||
-HPF_Fs44100_Gain3_B1,
|
||||
HPF_Fs44100_Gain3_Shift},
|
||||
{HPF_Fs44100_Gain4_A1, /* Gain setting 4 */
|
||||
HPF_Fs44100_Gain4_A0,
|
||||
-HPF_Fs44100_Gain4_B1,
|
||||
HPF_Fs44100_Gain4_Shift},
|
||||
{HPF_Fs44100_Gain5_A1, /* Gain setting 5 */
|
||||
HPF_Fs44100_Gain5_A0,
|
||||
-HPF_Fs44100_Gain5_B1,
|
||||
HPF_Fs44100_Gain5_Shift},
|
||||
{HPF_Fs44100_Gain6_A1, /* Gain setting 6 */
|
||||
HPF_Fs44100_Gain6_A0,
|
||||
-HPF_Fs44100_Gain6_B1,
|
||||
HPF_Fs44100_Gain6_Shift},
|
||||
{HPF_Fs44100_Gain7_A1, /* Gain setting 7 */
|
||||
HPF_Fs44100_Gain7_A0,
|
||||
-HPF_Fs44100_Gain7_B1,
|
||||
HPF_Fs44100_Gain7_Shift},
|
||||
{HPF_Fs44100_Gain8_A1, /* Gain setting 8 */
|
||||
HPF_Fs44100_Gain8_A0,
|
||||
-HPF_Fs44100_Gain8_B1,
|
||||
HPF_Fs44100_Gain8_Shift},
|
||||
{HPF_Fs44100_Gain9_A1, /* Gain setting 9 */
|
||||
HPF_Fs44100_Gain9_A0,
|
||||
-HPF_Fs44100_Gain9_B1,
|
||||
HPF_Fs44100_Gain9_Shift},
|
||||
{HPF_Fs44100_Gain10_A1, /* Gain setting 10 */
|
||||
HPF_Fs44100_Gain10_A0,
|
||||
-HPF_Fs44100_Gain10_B1,
|
||||
HPF_Fs44100_Gain10_Shift},
|
||||
{HPF_Fs44100_Gain11_A1, /* Gain setting 11 */
|
||||
HPF_Fs44100_Gain11_A0,
|
||||
-HPF_Fs44100_Gain11_B1,
|
||||
HPF_Fs44100_Gain11_Shift},
|
||||
{HPF_Fs44100_Gain12_A1, /* Gain setting 12 */
|
||||
HPF_Fs44100_Gain12_A0,
|
||||
-HPF_Fs44100_Gain12_B1,
|
||||
HPF_Fs44100_Gain12_Shift},
|
||||
{HPF_Fs44100_Gain13_A1, /* Gain setting 13 */
|
||||
HPF_Fs44100_Gain13_A0,
|
||||
-HPF_Fs44100_Gain13_B1,
|
||||
HPF_Fs44100_Gain13_Shift},
|
||||
{HPF_Fs44100_Gain14_A1, /* Gain setting 14 */
|
||||
HPF_Fs44100_Gain14_A0,
|
||||
-HPF_Fs44100_Gain14_B1,
|
||||
HPF_Fs44100_Gain14_Shift},
|
||||
{HPF_Fs44100_Gain15_A1, /* Gain setting 15 */
|
||||
HPF_Fs44100_Gain15_A0,
|
||||
-HPF_Fs44100_Gain15_B1,
|
||||
HPF_Fs44100_Gain15_Shift},
|
||||
|
||||
/* 48kHz sampling rate */
|
||||
{HPF_Fs48000_Gain1_A1, /* Gain setting 1 */
|
||||
HPF_Fs48000_Gain1_A0,
|
||||
-HPF_Fs48000_Gain1_B1,
|
||||
HPF_Fs48000_Gain1_Shift},
|
||||
{HPF_Fs48000_Gain2_A1, /* Gain setting 2 */
|
||||
HPF_Fs48000_Gain2_A0,
|
||||
-HPF_Fs48000_Gain2_B1,
|
||||
HPF_Fs48000_Gain2_Shift},
|
||||
{HPF_Fs48000_Gain3_A1, /* Gain setting 3 */
|
||||
HPF_Fs48000_Gain3_A0,
|
||||
-HPF_Fs48000_Gain3_B1,
|
||||
HPF_Fs48000_Gain3_Shift},
|
||||
{HPF_Fs48000_Gain4_A1, /* Gain setting 4 */
|
||||
HPF_Fs48000_Gain4_A0,
|
||||
-HPF_Fs48000_Gain4_B1,
|
||||
HPF_Fs48000_Gain4_Shift},
|
||||
{HPF_Fs48000_Gain5_A1, /* Gain setting 5 */
|
||||
HPF_Fs48000_Gain5_A0,
|
||||
-HPF_Fs48000_Gain5_B1,
|
||||
HPF_Fs48000_Gain5_Shift},
|
||||
{HPF_Fs48000_Gain6_A1, /* Gain setting 6 */
|
||||
HPF_Fs48000_Gain6_A0,
|
||||
-HPF_Fs48000_Gain6_B1,
|
||||
HPF_Fs48000_Gain6_Shift},
|
||||
{HPF_Fs48000_Gain7_A1, /* Gain setting 7 */
|
||||
HPF_Fs48000_Gain7_A0,
|
||||
-HPF_Fs48000_Gain7_B1,
|
||||
HPF_Fs48000_Gain7_Shift},
|
||||
{HPF_Fs48000_Gain8_A1, /* Gain setting 8 */
|
||||
HPF_Fs48000_Gain8_A0,
|
||||
-HPF_Fs48000_Gain8_B1,
|
||||
HPF_Fs48000_Gain8_Shift},
|
||||
{HPF_Fs48000_Gain9_A1, /* Gain setting 9 */
|
||||
HPF_Fs48000_Gain9_A0,
|
||||
-HPF_Fs48000_Gain9_B1,
|
||||
HPF_Fs48000_Gain9_Shift},
|
||||
{HPF_Fs48000_Gain10_A1, /* Gain setting 10 */
|
||||
HPF_Fs48000_Gain10_A0,
|
||||
-HPF_Fs48000_Gain10_B1,
|
||||
HPF_Fs48000_Gain10_Shift},
|
||||
{HPF_Fs48000_Gain11_A1, /* Gain setting 11 */
|
||||
HPF_Fs48000_Gain11_A0,
|
||||
-HPF_Fs48000_Gain11_B1,
|
||||
HPF_Fs48000_Gain11_Shift},
|
||||
{HPF_Fs48000_Gain12_A1, /* Gain setting 12 */
|
||||
HPF_Fs48000_Gain12_A0,
|
||||
-HPF_Fs48000_Gain12_B1,
|
||||
HPF_Fs48000_Gain12_Shift},
|
||||
{HPF_Fs48000_Gain13_A1, /* Gain setting 13 */
|
||||
HPF_Fs48000_Gain13_A0,
|
||||
-HPF_Fs48000_Gain13_B1,
|
||||
HPF_Fs48000_Gain13_Shift},
|
||||
{HPF_Fs48000_Gain14_A1, /* Gain setting 14 */
|
||||
HPF_Fs48000_Gain14_A0,
|
||||
-HPF_Fs48000_Gain14_B1,
|
||||
HPF_Fs48000_Gain14_Shift},
|
||||
{HPF_Fs48000_Gain15_A1, /* Gain setting 15 */
|
||||
HPF_Fs48000_Gain15_A0,
|
||||
-HPF_Fs48000_Gain15_B1,
|
||||
HPF_Fs48000_Gain15_Shift}};
|
||||
|
||||
|
||||
/************************************************************************************/
|
||||
/* */
|
||||
/* Volume control gain and time constant tables */
|
||||
/* */
|
||||
/************************************************************************************/
|
||||
|
||||
/* dB to linear conversion table */
|
||||
const LVM_INT16 LVM_VolumeTable[] = {
|
||||
0x7FFF, /* 0dB */
|
||||
0x7215, /* -1dB */
|
||||
0x65AD, /* -2dB */
|
||||
0x5A9E, /* -3dB */
|
||||
0x50C3, /* -4dB */
|
||||
0x47FB, /* -5dB */
|
||||
0x4000}; /* -6dB */
|
||||
|
||||
/************************************************************************************/
|
||||
/* */
|
||||
/* Volume mixer time constants (100ms) */
|
||||
/* */
|
||||
/************************************************************************************/
|
||||
|
||||
#define LVM_MIX_TC_Fs8000 32580 /* Floating point value 0.994262695 */
|
||||
#define LVM_MIX_TC_Fs11025 32632 /* Floating point value 0.995849609 */
|
||||
#define LVM_MIX_TC_Fs12000 32643 /* Floating point value 0.996185303 */
|
||||
#define LVM_MIX_TC_Fs16000 32674 /* Floating point value 0.997131348 */
|
||||
#define LVM_MIX_TC_Fs22050 32700 /* Floating point value 0.997924805 */
|
||||
#define LVM_MIX_TC_Fs24000 32705 /* Floating point value 0.998077393 */
|
||||
#define LVM_MIX_TC_Fs32000 32721 /* Floating point value 0.998565674 */
|
||||
#define LVM_MIX_TC_Fs44100 32734 /* Floating point value 0.998962402 */
|
||||
#define LVM_MIX_TC_Fs48000 32737 /* Floating point value 0.999053955 */
|
||||
|
||||
|
||||
const LVM_INT16 LVM_MixerTCTable[] = {
|
||||
LVM_MIX_TC_Fs8000,
|
||||
LVM_MIX_TC_Fs11025,
|
||||
LVM_MIX_TC_Fs12000,
|
||||
LVM_MIX_TC_Fs16000,
|
||||
LVM_MIX_TC_Fs22050,
|
||||
LVM_MIX_TC_Fs24000,
|
||||
LVM_MIX_TC_Fs32000,
|
||||
LVM_MIX_TC_Fs44100,
|
||||
LVM_MIX_TC_Fs48000};
|
||||
|
67
media/libeffects/lvm/lib/Bundle/src/LVM_Tables.h
Executable file
67
media/libeffects/lvm/lib/Bundle/src/LVM_Tables.h
Executable file
@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/************************************************************************************
|
||||
|
||||
$Author: beq07716 $
|
||||
$Revision: 1002 $
|
||||
$Date: 2010-06-28 13:40:09 +0200 (Mon, 28 Jun 2010) $
|
||||
|
||||
*************************************************************************************/
|
||||
|
||||
#ifndef __LVM_TABLES_H__
|
||||
#define __LVM_TABLES_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/************************************************************************************/
|
||||
/* */
|
||||
/* Includes */
|
||||
/* */
|
||||
/************************************************************************************/
|
||||
|
||||
#include "BIQUAD.h"
|
||||
#include "LVM_Types.h"
|
||||
|
||||
/************************************************************************************/
|
||||
/* */
|
||||
/* Treble Boost Filter Coefficients */
|
||||
/* */
|
||||
/************************************************************************************/
|
||||
|
||||
extern FO_C16_LShx_Coefs_t LVM_TrebleBoostCoefs[];
|
||||
|
||||
|
||||
/************************************************************************************/
|
||||
/* */
|
||||
/* Volume control gain and time constant tables */
|
||||
/* */
|
||||
/************************************************************************************/
|
||||
|
||||
extern const LVM_INT16 LVM_VolumeTable[];
|
||||
extern const LVM_INT16 LVM_MixerTCTable[];
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __LVM_TABLES_H__ */
|
||||
|
||||
|
92
media/libeffects/lvm/lib/Common/lib/AGC.h
Executable file
92
media/libeffects/lvm/lib/Common/lib/AGC.h
Executable file
@ -0,0 +1,92 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**********************************************************************************
|
||||
|
||||
$Author: beq07716 $
|
||||
$Revision: 1000 $
|
||||
$Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $
|
||||
|
||||
***********************************************************************************/
|
||||
|
||||
#ifndef __AGC_H__
|
||||
#define __AGC_H__
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**********************************************************************************/
|
||||
/* */
|
||||
/* Includes */
|
||||
/* */
|
||||
/**********************************************************************************/
|
||||
|
||||
#include "LVM_Types.h"
|
||||
|
||||
|
||||
/**********************************************************************************/
|
||||
/* */
|
||||
/* Types */
|
||||
/* */
|
||||
/**********************************************************************************/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
LVM_INT32 AGC_Gain; /* The current AGC gain */
|
||||
LVM_INT32 AGC_MaxGain; /* The maximum AGC gain */
|
||||
LVM_INT32 Volume; /* The current volume setting */
|
||||
LVM_INT32 Target; /* The target volume setting */
|
||||
LVM_INT32 AGC_Target; /* AGC target level */
|
||||
LVM_INT16 AGC_Attack; /* AGC attack scaler */
|
||||
LVM_INT16 AGC_Decay; /* AGC decay scaler */
|
||||
LVM_INT16 AGC_GainShift; /* The gain shift */
|
||||
LVM_INT16 VolumeShift; /* Volume shift scaling */
|
||||
LVM_INT16 VolumeTC; /* Volume update time constant */
|
||||
|
||||
} AGC_MIX_VOL_2St1Mon_D32_t;
|
||||
|
||||
|
||||
/**********************************************************************************/
|
||||
/* */
|
||||
/* Function Prototypes */
|
||||
/* */
|
||||
/**********************************************************************************/
|
||||
|
||||
void AGC_MIX_VOL_2St1Mon_D32_WRA(AGC_MIX_VOL_2St1Mon_D32_t *pInstance, /* Instance pointer */
|
||||
const LVM_INT32 *pStSrc, /* Stereo source */
|
||||
const LVM_INT32 *pMonoSrc, /* Mono source */
|
||||
LVM_INT32 *pDst, /* Stereo destination */
|
||||
LVM_UINT16 n); /* Number of samples */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#endif /* __AGC_H__ */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
341
media/libeffects/lvm/lib/Common/lib/BIQUAD.h
Executable file
341
media/libeffects/lvm/lib/Common/lib/BIQUAD.h
Executable file
@ -0,0 +1,341 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**********************************************************************************
|
||||
|
||||
$Author: beq07716 $
|
||||
$Revision: 722 $
|
||||
$Date: 2010-06-10 15:12:34 +0200 (Thu, 10 Jun 2010) $
|
||||
|
||||
***********************************************************************************/
|
||||
|
||||
#ifndef _BIQUAD_H_
|
||||
#define _BIQUAD_H_
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include "LVM_Types.h"
|
||||
/**********************************************************************************
|
||||
INSTANCE MEMORY TYPE DEFINITION
|
||||
***********************************************************************************/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
LVM_INT32 Storage[6];
|
||||
|
||||
} Biquad_Instance_t;
|
||||
|
||||
|
||||
/**********************************************************************************
|
||||
COEFFICIENT TYPE DEFINITIONS
|
||||
***********************************************************************************/
|
||||
|
||||
/*** Biquad coefficients **********************************************************/
|
||||
typedef struct
|
||||
{
|
||||
LVM_INT16 A2; /* a2 */
|
||||
LVM_INT16 A1; /* a1 */
|
||||
LVM_INT16 A0; /* a0 */
|
||||
LVM_INT16 B2; /* -b2! */
|
||||
LVM_INT16 B1; /* -b1! */
|
||||
} BQ_C16_Coefs_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
LVM_INT32 A2; /* a2 */
|
||||
LVM_INT32 A1; /* a1 */
|
||||
LVM_INT32 A0; /* a0 */
|
||||
LVM_INT32 B2; /* -b2! */
|
||||
LVM_INT32 B1; /* -b1! */
|
||||
} BQ_C32_Coefs_t;
|
||||
|
||||
/*** First order coefficients *****************************************************/
|
||||
typedef struct
|
||||
{
|
||||
LVM_INT16 A1; /* a1 */
|
||||
LVM_INT16 A0; /* a0 */
|
||||
LVM_INT16 B1; /* -b1! */
|
||||
} FO_C16_Coefs_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
LVM_INT32 A1; /* a1 */
|
||||
LVM_INT32 A0; /* a0 */
|
||||
LVM_INT32 B1; /* -b1! */
|
||||
} FO_C32_Coefs_t;
|
||||
|
||||
/*** First order coefficients with Shift*****************************************************/
|
||||
typedef struct
|
||||
{
|
||||
LVM_INT16 A1; /* a1 */
|
||||
LVM_INT16 A0; /* a0 */
|
||||
LVM_INT16 B1; /* -b1! */
|
||||
LVM_INT16 Shift; /* Shift */
|
||||
} FO_C16_LShx_Coefs_t;
|
||||
|
||||
/*** Band pass coefficients *******************************************************/
|
||||
typedef struct
|
||||
{
|
||||
LVM_INT16 A0; /* a0 */
|
||||
LVM_INT16 B2; /* -b2! */
|
||||
LVM_INT16 B1; /* -b1! */
|
||||
} BP_C16_Coefs_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
LVM_INT32 A0; /* a0 */
|
||||
LVM_INT32 B2; /* -b2! */
|
||||
LVM_INT32 B1; /* -b1! */
|
||||
} BP_C32_Coefs_t;
|
||||
|
||||
/*** Peaking coefficients *********************************************************/
|
||||
typedef struct
|
||||
{
|
||||
LVM_INT16 A0; /* a0 */
|
||||
LVM_INT16 B2; /* -b2! */
|
||||
LVM_INT16 B1; /* -b1! */
|
||||
LVM_INT16 G; /* Gain */
|
||||
} PK_C16_Coefs_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
LVM_INT32 A0; /* a0 */
|
||||
LVM_INT32 B2; /* -b2! */
|
||||
LVM_INT32 B1; /* -b1! */
|
||||
LVM_INT16 G; /* Gain */
|
||||
} PK_C32_Coefs_t;
|
||||
|
||||
|
||||
/**********************************************************************************
|
||||
TAPS TYPE DEFINITIONS
|
||||
***********************************************************************************/
|
||||
|
||||
/*** Types used for first order and shelving filter *******************************/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
LVM_INT32 Storage[ (1*2) ]; /* One channel, two taps of size LVM_INT32 */
|
||||
} Biquad_1I_Order1_Taps_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
LVM_INT32 Storage[ (2*2) ]; /* Two channels, two taps of size LVM_INT32 */
|
||||
} Biquad_2I_Order1_Taps_t;
|
||||
|
||||
|
||||
/*** Types used for biquad, band pass and peaking filter **************************/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
LVM_INT32 Storage[ (1*4) ]; /* One channel, four taps of size LVM_INT32 */
|
||||
} Biquad_1I_Order2_Taps_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
LVM_INT32 Storage[ (2*4) ]; /* Two channels, four taps of size LVM_INT32 */
|
||||
} Biquad_2I_Order2_Taps_t;
|
||||
|
||||
/* The names of the functions are changed to satisfy QAC rules: Name should be Unique withing 16 characters*/
|
||||
#define BQ_2I_D32F32Cll_TRC_WRA_01_Init Init_BQ_2I_D32F32Cll_TRC_WRA_01
|
||||
#define BP_1I_D32F32C30_TRC_WRA_02 TWO_BP_1I_D32F32C30_TRC_WRA_02
|
||||
|
||||
/**********************************************************************************
|
||||
FUNCTION PROTOTYPES: BIQUAD FILTERS
|
||||
***********************************************************************************/
|
||||
|
||||
/*** 16 bit data path *************************************************************/
|
||||
|
||||
void BQ_2I_D16F32Css_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
|
||||
Biquad_2I_Order2_Taps_t *pTaps,
|
||||
BQ_C16_Coefs_t *pCoef);
|
||||
|
||||
void BQ_2I_D16F32C15_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
|
||||
LVM_INT16 *pDataIn,
|
||||
LVM_INT16 *pDataOut,
|
||||
LVM_INT16 NrSamples);
|
||||
|
||||
void BQ_2I_D16F32C14_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
|
||||
LVM_INT16 *pDataIn,
|
||||
LVM_INT16 *pDataOut,
|
||||
LVM_INT16 NrSamples);
|
||||
|
||||
void BQ_2I_D16F32C13_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
|
||||
LVM_INT16 *pDataIn,
|
||||
LVM_INT16 *pDataOut,
|
||||
LVM_INT16 NrSamples);
|
||||
|
||||
void BQ_2I_D16F16Css_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
|
||||
Biquad_2I_Order2_Taps_t *pTaps,
|
||||
BQ_C16_Coefs_t *pCoef);
|
||||
|
||||
void BQ_2I_D16F16C15_TRC_WRA_01( Biquad_Instance_t *pInstance,
|
||||
LVM_INT16 *pDataIn,
|
||||
LVM_INT16 *pDataOut,
|
||||
LVM_INT16 NrSamples);
|
||||
|
||||
void BQ_2I_D16F16C14_TRC_WRA_01( Biquad_Instance_t *pInstance,
|
||||
LVM_INT16 *pDataIn,
|
||||
LVM_INT16 *pDataOut,
|
||||
LVM_INT16 NrSamples);
|
||||
|
||||
void BQ_1I_D16F16Css_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
|
||||
Biquad_1I_Order2_Taps_t *pTaps,
|
||||
BQ_C16_Coefs_t *pCoef);
|
||||
|
||||
void BQ_1I_D16F16C15_TRC_WRA_01( Biquad_Instance_t *pInstance,
|
||||
LVM_INT16 *pDataIn,
|
||||
LVM_INT16 *pDataOut,
|
||||
LVM_INT16 NrSamples);
|
||||
|
||||
void BQ_1I_D16F32Css_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
|
||||
Biquad_1I_Order2_Taps_t *pTaps,
|
||||
BQ_C16_Coefs_t *pCoef);
|
||||
|
||||
void BQ_1I_D16F32C14_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
|
||||
LVM_INT16 *pDataIn,
|
||||
LVM_INT16 *pDataOut,
|
||||
LVM_INT16 NrSamples);
|
||||
|
||||
/*** 32 bit data path *************************************************************/
|
||||
|
||||
void BQ_2I_D32F32Cll_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
|
||||
Biquad_2I_Order2_Taps_t *pTaps,
|
||||
BQ_C32_Coefs_t *pCoef);
|
||||
|
||||
void BQ_2I_D32F32C30_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
|
||||
LVM_INT32 *pDataIn,
|
||||
LVM_INT32 *pDataOut,
|
||||
LVM_INT16 NrSamples);
|
||||
|
||||
/**********************************************************************************
|
||||
FUNCTION PROTOTYPES: FIRST ORDER FILTERS
|
||||
***********************************************************************************/
|
||||
|
||||
/*** 16 bit data path *************************************************************/
|
||||
|
||||
void FO_1I_D16F16Css_TRC_WRA_01_Init( Biquad_Instance_t *pInstance,
|
||||
Biquad_1I_Order1_Taps_t *pTaps,
|
||||
FO_C16_Coefs_t *pCoef);
|
||||
|
||||
void FO_1I_D16F16C15_TRC_WRA_01( Biquad_Instance_t *pInstance,
|
||||
LVM_INT16 *pDataIn,
|
||||
LVM_INT16 *pDataOut,
|
||||
LVM_INT16 NrSamples);
|
||||
|
||||
void FO_2I_D16F32Css_LShx_TRC_WRA_01_Init(Biquad_Instance_t *pInstance,
|
||||
Biquad_2I_Order1_Taps_t *pTaps,
|
||||
FO_C16_LShx_Coefs_t *pCoef);
|
||||
|
||||
void FO_2I_D16F32C15_LShx_TRC_WRA_01(Biquad_Instance_t *pInstance,
|
||||
LVM_INT16 *pDataIn,
|
||||
LVM_INT16 *pDataOut,
|
||||
LVM_INT16 NrSamples);
|
||||
|
||||
/*** 32 bit data path *************************************************************/
|
||||
|
||||
void FO_1I_D32F32Cll_TRC_WRA_01_Init( Biquad_Instance_t *pInstance,
|
||||
Biquad_1I_Order1_Taps_t *pTaps,
|
||||
FO_C32_Coefs_t *pCoef);
|
||||
|
||||
void FO_1I_D32F32C31_TRC_WRA_01( Biquad_Instance_t *pInstance,
|
||||
LVM_INT32 *pDataIn,
|
||||
LVM_INT32 *pDataOut,
|
||||
LVM_INT16 NrSamples);
|
||||
|
||||
/**********************************************************************************
|
||||
FUNCTION PROTOTYPES: BAND PASS FILTERS
|
||||
***********************************************************************************/
|
||||
|
||||
/*** 16 bit data path *************************************************************/
|
||||
|
||||
void BP_1I_D16F16Css_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
|
||||
Biquad_1I_Order2_Taps_t *pTaps,
|
||||
BP_C16_Coefs_t *pCoef);
|
||||
|
||||
void BP_1I_D16F16C14_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
|
||||
LVM_INT16 *pDataIn,
|
||||
LVM_INT16 *pDataOut,
|
||||
LVM_INT16 NrSamples);
|
||||
|
||||
void BP_1I_D16F32Cll_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
|
||||
Biquad_1I_Order2_Taps_t *pTaps,
|
||||
BP_C32_Coefs_t *pCoef);
|
||||
|
||||
void BP_1I_D16F32C30_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
|
||||
LVM_INT16 *pDataIn,
|
||||
LVM_INT16 *pDataOut,
|
||||
LVM_INT16 NrSamples);
|
||||
|
||||
|
||||
/*** 32 bit data path *************************************************************/
|
||||
|
||||
void BP_1I_D32F32Cll_TRC_WRA_02_Init ( Biquad_Instance_t *pInstance,
|
||||
Biquad_1I_Order2_Taps_t *pTaps,
|
||||
BP_C32_Coefs_t *pCoef);
|
||||
|
||||
void BP_1I_D32F32C30_TRC_WRA_02( Biquad_Instance_t *pInstance,
|
||||
LVM_INT32 *pDataIn,
|
||||
LVM_INT32 *pDataOut,
|
||||
LVM_INT16 NrSamples);
|
||||
|
||||
|
||||
/*** 32 bit data path STEREO ******************************************************/
|
||||
|
||||
void PK_2I_D32F32CllGss_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
|
||||
Biquad_2I_Order2_Taps_t *pTaps,
|
||||
PK_C32_Coefs_t *pCoef);
|
||||
|
||||
void PK_2I_D32F32C30G11_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
|
||||
LVM_INT32 *pDataIn,
|
||||
LVM_INT32 *pDataOut,
|
||||
LVM_INT16 NrSamples);
|
||||
|
||||
void PK_2I_D32F32CssGss_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
|
||||
Biquad_2I_Order2_Taps_t *pTaps,
|
||||
PK_C16_Coefs_t *pCoef);
|
||||
|
||||
void PK_2I_D32F32C14G11_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
|
||||
LVM_INT32 *pDataIn,
|
||||
LVM_INT32 *pDataOut,
|
||||
LVM_INT16 NrSamples);
|
||||
|
||||
|
||||
/**********************************************************************************
|
||||
FUNCTION PROTOTYPES: DC REMOVAL FILTERS
|
||||
***********************************************************************************/
|
||||
|
||||
/*** 16 bit data path STEREO ******************************************************/
|
||||
|
||||
void DC_2I_D16_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance);
|
||||
|
||||
void DC_2I_D16_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
|
||||
LVM_INT16 *pDataIn,
|
||||
LVM_INT16 *pDataOut,
|
||||
LVM_INT16 NrSamples);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
/**********************************************************************************/
|
||||
|
||||
#endif /** _BIQUAD_H_ **/
|
||||
|
91
media/libeffects/lvm/lib/Common/lib/CompLim.h
Executable file
91
media/libeffects/lvm/lib/Common/lib/CompLim.h
Executable file
@ -0,0 +1,91 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**********************************************************************************
|
||||
|
||||
$Author: nxp27078 $
|
||||
$Revision: 672 $
|
||||
$Date: 2010-06-08 19:39:38 +0200 (Tue, 08 Jun 2010) $
|
||||
|
||||
***********************************************************************************/
|
||||
|
||||
#ifndef _COMP_LIM_H
|
||||
#define _COMP_LIM_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
/************************************************************************************/
|
||||
/* */
|
||||
/* Includes */
|
||||
/* */
|
||||
/************************************************************************************/
|
||||
|
||||
#include "LVM_Types.h"
|
||||
|
||||
|
||||
/************************************************************************************/
|
||||
/* */
|
||||
/* Structures */
|
||||
/* */
|
||||
/************************************************************************************/
|
||||
|
||||
typedef struct /* Compressor state */
|
||||
{
|
||||
/* Normaliser */
|
||||
LVM_INT16 Norm_Attack; /* Attack time constant of the Normaliser integrator */
|
||||
LVM_INT16 Norm_Decay; /* Decay time constant of the Normaliser integrator */
|
||||
LVM_INT32 NormInt; /* Normaliser integrator current value */
|
||||
LVM_INT16 Shift; /* Shift gain */
|
||||
LVM_INT16 Threshold; /* Target threshold */
|
||||
|
||||
/* Compressor */
|
||||
LVM_INT16 Comp_Atten; /* Attenuation applied before soft knee compressor */
|
||||
LVM_INT16 Comp_Attack_S; /* Attack time constant of the slow integrator */
|
||||
LVM_INT16 Comp_Decay_S; /* Decay time constant of slow the integrator */
|
||||
LVM_INT16 Comp_Attack_F; /* Attack time constant of fast the integrator */
|
||||
LVM_INT16 Comp_Decay_F; /* Decay time constant of fast the integrator */
|
||||
LVM_INT16 SoftClipGain; /* Soft clip gain control */
|
||||
LVM_INT32 CompIntSlow; /* Compressor slow integrator current value */
|
||||
LVM_INT32 CompIntFast; /* Compressor fast integrator current value */
|
||||
|
||||
|
||||
} CompLim_Instance_t;
|
||||
|
||||
|
||||
/************************************************************************************/
|
||||
/* */
|
||||
/* Function Prototypes */
|
||||
/* */
|
||||
/************************************************************************************/
|
||||
|
||||
void NonLinComp_D16(LVM_INT16 Gain,
|
||||
LVM_INT16 *pSterBfIn,
|
||||
LVM_INT16 *pSterBfOut,
|
||||
LVM_INT32 BlockLength);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* #ifndef _COMP_LIM_H */
|
||||
|
||||
|
||||
|
71
media/libeffects/lvm/lib/Common/lib/Filter.h
Executable file
71
media/libeffects/lvm/lib/Common/lib/Filter.h
Executable file
@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* Project:: */
|
||||
/* $Author: beq07716 $*/
|
||||
/* $Revision: 771 $*/
|
||||
/* $Date: 2010-06-14 10:41:36 +0200 (Mon, 14 Jun 2010) $*/
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
#ifndef _FILTER_H_
|
||||
#define _FILTER_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**********************************************************************************
|
||||
INCLUDES
|
||||
***********************************************************************************/
|
||||
#include "LVM_Types.h"
|
||||
#include "BIQUAD.h"
|
||||
|
||||
|
||||
/**********************************************************************************
|
||||
DEFINES
|
||||
***********************************************************************************/
|
||||
#define FILTER_LOSS 32730 /* -0.01dB loss to avoid wrapping due to band ripple */
|
||||
|
||||
/**********************************************************************************
|
||||
FUNCTION PROTOTYPES
|
||||
***********************************************************************************/
|
||||
|
||||
LVM_INT32 LVM_Polynomial(LVM_UINT16 N,
|
||||
LVM_INT32 *pCoefficients,
|
||||
LVM_INT32 X);
|
||||
|
||||
LVM_INT32 LVM_Power10( LVM_INT32 X);
|
||||
|
||||
LVM_INT32 LVM_FO_LPF( LVM_INT32 w,
|
||||
FO_C32_Coefs_t *pCoeffs);
|
||||
|
||||
LVM_INT32 LVM_FO_HPF( LVM_INT32 w,
|
||||
FO_C32_Coefs_t *pCoeffs);
|
||||
|
||||
LVM_INT32 LVM_GetOmega(LVM_UINT16 Fc,
|
||||
LVM_Fs_en SampleRate);
|
||||
|
||||
/**********************************************************************************/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /** _FILTER_H_ **/
|
||||
|
99
media/libeffects/lvm/lib/Common/lib/InstAlloc.h
Executable file
99
media/libeffects/lvm/lib/Common/lib/InstAlloc.h
Executable file
@ -0,0 +1,99 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* $Author: beq07716 $*/
|
||||
/* $Revision: 1000 $*/
|
||||
/* $Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $*/
|
||||
/* */
|
||||
/************************************************************************/
|
||||
#ifndef __INSTALLOC_H__
|
||||
#define __INSTALLOC_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include "LVM_Types.h"
|
||||
/*######################################################################################*/
|
||||
/* Type declarations */
|
||||
/*######################################################################################*/
|
||||
typedef struct
|
||||
{
|
||||
LVM_UINT32 TotalSize; /* Accumulative total memory size */
|
||||
LVM_UINT32 pNextMember; /* Pointer to the next instance member to be allocated */
|
||||
} INST_ALLOC;
|
||||
|
||||
|
||||
/*######################################################################################*/
|
||||
/* Function prototypes */
|
||||
/*######################################################################################*/
|
||||
|
||||
/****************************************************************************************
|
||||
* Name : InstAlloc_Init()
|
||||
* Input : pms - Pointer to the INST_ALLOC instance
|
||||
StartAddr - Base address of the instance memory
|
||||
* Returns : Error code
|
||||
* Description : Initializes the instance distribution and memory size calculation function
|
||||
* Remarks :
|
||||
****************************************************************************************/
|
||||
|
||||
void InstAlloc_Init( INST_ALLOC *pms, void *StartAddr );
|
||||
|
||||
|
||||
/****************************************************************************************
|
||||
* Name : InstAlloc_AddMember()
|
||||
* Input : pms - Pointer to the INST_ALLOC instance
|
||||
Size - The size in bytes of the new added member
|
||||
* Returns : A pointer to the new added member
|
||||
* Description : Allocates space for a new member in the instance memory and returns
|
||||
a pointer to this new member. The start address of all members will
|
||||
be 32 bit alligned.
|
||||
* Remarks :
|
||||
****************************************************************************************/
|
||||
|
||||
void* InstAlloc_AddMember( INST_ALLOC *pms, LVM_UINT32 Size );
|
||||
|
||||
/****************************************************************************************
|
||||
* Name : InstAlloc_GetTotal()
|
||||
* Input : pms - Pointer to the INST_ALLOC instance
|
||||
* Returns : The instance memory size
|
||||
* Description : This functions returns the calculated instance memory size
|
||||
* Remarks :
|
||||
****************************************************************************************/
|
||||
|
||||
LVM_UINT32 InstAlloc_GetTotal( INST_ALLOC *pms);
|
||||
|
||||
void* InstAlloc_AddMemberAllRet( INST_ALLOC *pms,
|
||||
LVM_UINT32 Size[],
|
||||
void **ptr);
|
||||
|
||||
void* InstAlloc_AddMemberAll( INST_ALLOC *pms,
|
||||
LVM_UINT32 Size[],
|
||||
LVM_MemoryTable_st *pMemoryTable);
|
||||
|
||||
void InstAlloc_InitAll( INST_ALLOC *pms,
|
||||
LVM_MemoryTable_st *pMemoryTable);
|
||||
|
||||
void InstAlloc_InitAll_NULL( INST_ALLOC *pms);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __JBS_INSTALLOC_H__ */
|
69
media/libeffects/lvm/lib/Common/lib/LVM_Common.h
Executable file
69
media/libeffects/lvm/lib/Common/lib/LVM_Common.h
Executable file
@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*****************************************************************************************
|
||||
|
||||
$Author: nxp27078 $
|
||||
$Revision: 672 $
|
||||
$Date: 2010-06-08 19:39:38 +0200 (Tue, 08 Jun 2010) $
|
||||
|
||||
*****************************************************************************************/
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* Header file for the common definitions used within the bundle and its algorithms. */
|
||||
/* */
|
||||
/* This files includes all definitions, types, structures and function prototypes. */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
|
||||
|
||||
#ifndef __LVM_COMMON_H__
|
||||
#define __LVM_COMMON_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* Includes */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
#include "LVM_Types.h"
|
||||
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* Definitions */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
/* Algorithm identification */
|
||||
#define ALGORITHM_NONE_ID 0x0000
|
||||
#define ALGORITHM_CS_ID 0x0100
|
||||
#define ALGORITHM_EQNB_ID 0x0200
|
||||
#define ALGORITHM_DBE_ID 0x0300
|
||||
#define ALGORITHM_VC_ID 0x0500
|
||||
#define ALGORITHM_TE_ID 0x0600
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __LVM_COMMON_H__ */
|
||||
|
130
media/libeffects/lvm/lib/Common/lib/LVM_Macros.h
Executable file
130
media/libeffects/lvm/lib/Common/lib/LVM_Macros.h
Executable file
@ -0,0 +1,130 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**********************************************************************************
|
||||
|
||||
$Author: beq07716 $
|
||||
$Revision: 1000 $
|
||||
$Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $
|
||||
|
||||
***********************************************************************************/
|
||||
|
||||
#ifndef _LVM_MACROS_H_
|
||||
#define _LVM_MACROS_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**********************************************************************************
|
||||
MUL32x32INTO32(A,B,C,ShiftR)
|
||||
C = (A * B) >> ShiftR
|
||||
|
||||
A, B and C are all 32 bit SIGNED numbers and ShiftR can vary from 0 to 64
|
||||
|
||||
The user has to take care that C does not overflow. The result in case
|
||||
of overflow is undefined.
|
||||
|
||||
***********************************************************************************/
|
||||
#ifndef MUL32x32INTO32
|
||||
#define MUL32x32INTO32(A,B,C,ShiftR) \
|
||||
{LVM_INT32 MUL32x32INTO32_temp,MUL32x32INTO32_temp2,MUL32x32INTO32_mask,MUL32x32INTO32_HH,MUL32x32INTO32_HL,MUL32x32INTO32_LH,MUL32x32INTO32_LL;\
|
||||
LVM_INT32 shiftValue;\
|
||||
shiftValue = (ShiftR);\
|
||||
MUL32x32INTO32_mask=0x0000FFFF;\
|
||||
MUL32x32INTO32_HH= ((LVM_INT32)((LVM_INT16)((A)>>16))*((LVM_INT16)((B)>>16)) );\
|
||||
MUL32x32INTO32_HL= ((LVM_INT32)((B)&MUL32x32INTO32_mask)*((LVM_INT16)((A)>>16))) ;\
|
||||
MUL32x32INTO32_LH= ((LVM_INT32)((A)&MUL32x32INTO32_mask)*((LVM_INT16)((B)>>16)));\
|
||||
MUL32x32INTO32_LL= (LVM_INT32)((A)&MUL32x32INTO32_mask)*(LVM_INT32)((B)&MUL32x32INTO32_mask);\
|
||||
MUL32x32INTO32_temp= (LVM_INT32)(MUL32x32INTO32_HL&MUL32x32INTO32_mask)+(LVM_INT32)(MUL32x32INTO32_LH&MUL32x32INTO32_mask)+(LVM_INT32)((MUL32x32INTO32_LL>>16)&MUL32x32INTO32_mask);\
|
||||
MUL32x32INTO32_HH= MUL32x32INTO32_HH+(LVM_INT32)(MUL32x32INTO32_HL>>16)+(LVM_INT32)(MUL32x32INTO32_LH>>16)+(LVM_INT32)(MUL32x32INTO32_temp>>16);\
|
||||
MUL32x32INTO32_LL=MUL32x32INTO32_LL+(LVM_INT32)(MUL32x32INTO32_HL<<16)+(LVM_INT32)(MUL32x32INTO32_LH<<16);\
|
||||
if(shiftValue<32)\
|
||||
{\
|
||||
MUL32x32INTO32_HH=MUL32x32INTO32_HH<<(32-shiftValue);\
|
||||
MUL32x32INTO32_mask=((LVM_INT32)1<<(32-shiftValue))-1;\
|
||||
MUL32x32INTO32_LL=(MUL32x32INTO32_LL>>shiftValue)&MUL32x32INTO32_mask;\
|
||||
MUL32x32INTO32_temp2=MUL32x32INTO32_HH|MUL32x32INTO32_LL;\
|
||||
}\
|
||||
else\
|
||||
{\
|
||||
MUL32x32INTO32_temp2=(LVM_INT32)MUL32x32INTO32_HH>>(shiftValue-32);\
|
||||
}\
|
||||
(C) = MUL32x32INTO32_temp2;\
|
||||
}
|
||||
#endif
|
||||
|
||||
/**********************************************************************************
|
||||
MUL32x16INTO32(A,B,C,ShiftR)
|
||||
C = (A * B) >> ShiftR
|
||||
|
||||
A and C are 32 bit SIGNED numbers. B is a 16 bit SIGNED number.
|
||||
ShiftR can vary from 0 to 48
|
||||
|
||||
The user has to take care that C does not overflow. The result in case
|
||||
of overflow is undefined.
|
||||
|
||||
***********************************************************************************/
|
||||
#ifndef MUL32x16INTO32
|
||||
#define MUL32x16INTO32(A,B,C,ShiftR) \
|
||||
{LVM_INT32 MUL32x16INTO32_mask,MUL32x16INTO32_HH,MUL32x16INTO32_LL;\
|
||||
LVM_INT32 shiftValue;\
|
||||
shiftValue = (ShiftR);\
|
||||
MUL32x16INTO32_mask=0x0000FFFF;\
|
||||
MUL32x16INTO32_HH= ((LVM_INT32)(B)*((LVM_INT16)((A)>>16)));\
|
||||
MUL32x16INTO32_LL= ((LVM_INT32)((A)&MUL32x16INTO32_mask)*(B));\
|
||||
if(shiftValue<16)\
|
||||
{\
|
||||
MUL32x16INTO32_HH=(LVM_INT32)((LVM_UINT32)MUL32x16INTO32_HH<<(16-shiftValue));\
|
||||
(C)=MUL32x16INTO32_HH+(LVM_INT32)(MUL32x16INTO32_LL>>shiftValue);\
|
||||
}\
|
||||
else if(shiftValue<32) {\
|
||||
MUL32x16INTO32_HH=(LVM_INT32)(MUL32x16INTO32_HH>>(shiftValue-16));\
|
||||
(C)=MUL32x16INTO32_HH+(LVM_INT32)(MUL32x16INTO32_LL>>shiftValue);\
|
||||
}\
|
||||
else {\
|
||||
(C)=MUL32x16INTO32_HH>>(shiftValue-16);}\
|
||||
}
|
||||
#endif
|
||||
|
||||
/**********************************************************************************
|
||||
ADD2_SAT_32x32(A,B,C)
|
||||
C = SAT(A + B)
|
||||
|
||||
A,B and C are 32 bit SIGNED numbers.
|
||||
***********************************************************************************/
|
||||
#ifndef ADD2_SAT_32x32
|
||||
#define ADD2_SAT_32x32(A,B,C) \
|
||||
{(C)=(A)+(B);\
|
||||
if ((((C) ^ (A)) & ((C) ^ (B))) >> 31)\
|
||||
{\
|
||||
if((A)<0)\
|
||||
(C)=0x80000000l;\
|
||||
else\
|
||||
(C)=0x7FFFFFFFl;\
|
||||
}\
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* _LVM_MACROS_H_ */
|
||||
|
||||
/*** End of file ******************************************************************/
|
89
media/libeffects/lvm/lib/Common/lib/LVM_Timer.h
Executable file
89
media/libeffects/lvm/lib/Common/lib/LVM_Timer.h
Executable file
@ -0,0 +1,89 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __LVM_TIMER_H__
|
||||
#define __LVM_TIMER_H__
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* Project:: My Project */
|
||||
/* $Author: beq07716 $*/
|
||||
/* $Revision: 1000 $*/
|
||||
/* $Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $*/
|
||||
/* */
|
||||
/************************************************************************/
|
||||
#include "LVM_Types.h"
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* Header file for the LVM_Timer library */
|
||||
/* */
|
||||
/* Functionality: */
|
||||
/* The timer will count down a number of ms, based on the number of samples it */
|
||||
/* sees and the curent sampling rate. When the timer expires, a registered */
|
||||
/* callback function will be called. */
|
||||
/* The maximal number of sampless that can be called by the timer is 2^32, which */
|
||||
/* corresponds to 24.8 hours at a sampling rate of 48 kHz */
|
||||
/* The timer currently does not suport changes in sampling rate while timing. */
|
||||
/****************************************************************************************/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/****************************************************************************************/
|
||||
/* TYPE DEFINITIONS */
|
||||
/****************************************************************************************/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
LVM_INT32 Storage[6];
|
||||
|
||||
} LVM_Timer_Instance_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
LVM_INT32 SamplingRate;
|
||||
LVM_INT16 TimeInMs;
|
||||
LVM_INT32 CallBackParam;
|
||||
void *pCallBackParams;
|
||||
void *pCallbackInstance;
|
||||
void (*pCallBack)(void*,void*,LVM_INT32);
|
||||
|
||||
} LVM_Timer_Params_t;
|
||||
|
||||
/****************************************************************************************/
|
||||
/* FUNCTION PROTOTYPES */
|
||||
/****************************************************************************************/
|
||||
|
||||
void LVM_Timer_Init ( LVM_Timer_Instance_t *pInstance,
|
||||
LVM_Timer_Params_t *pParams );
|
||||
|
||||
|
||||
void LVM_Timer ( LVM_Timer_Instance_t *pInstance,
|
||||
LVM_INT16 BlockSize );
|
||||
|
||||
|
||||
/****************************************************************************************/
|
||||
/* END OF HEADER */
|
||||
/****************************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __LVM_TIMER_H__ */
|
195
media/libeffects/lvm/lib/Common/lib/LVM_Types.h
Executable file
195
media/libeffects/lvm/lib/Common/lib/LVM_Types.h
Executable file
@ -0,0 +1,195 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/****************************************************************************************
|
||||
|
||||
$Author: beq07716 $
|
||||
$Revision: 1000 $
|
||||
$Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $
|
||||
|
||||
*****************************************************************************************/
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* Header file defining the standard LifeVibes types for use in the application layer */
|
||||
/* interface of all LifeVibes modules */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
|
||||
#ifndef LVM_TYPES_H
|
||||
#define LVM_TYPES_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* definitions */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
|
||||
#define LVM_NULL 0 /* NULL pointer */
|
||||
|
||||
#define LVM_TRUE 1 /* Booleans */
|
||||
#define LVM_FALSE 0
|
||||
|
||||
#define LVM_MAXINT_8 127 /* Maximum positive integer size */
|
||||
#define LVM_MAXINT_16 32767
|
||||
#define LVM_MAXINT_32 2147483647
|
||||
#define LVM_MAXENUM 2147483647
|
||||
|
||||
#define LVM_MODULEID_MASK 0xFF00 /* Mask to extract the calling module ID from callbackId */
|
||||
#define LVM_EVENTID_MASK 0x00FF /* Mask to extract the callback event from callbackId */
|
||||
|
||||
/* Memory table*/
|
||||
#define LVM_MEMREGION_PERSISTENT_SLOW_DATA 0 /* Offset to the instance memory region */
|
||||
#define LVM_MEMREGION_PERSISTENT_FAST_DATA 1 /* Offset to the persistent data memory region */
|
||||
#define LVM_MEMREGION_PERSISTENT_FAST_COEF 2 /* Offset to the persistent coefficient memory region */
|
||||
#define LVM_MEMREGION_TEMPORARY_FAST 3 /* Offset to temporary memory region */
|
||||
|
||||
#define LVM_NR_MEMORY_REGIONS 4 /* Number of memory regions */
|
||||
|
||||
/* Memory partition type */
|
||||
#define LVM_MEM_PARTITION0 0 /* 1st memory partition */
|
||||
#define LVM_MEM_PARTITION1 1 /* 2nd memory partition */
|
||||
#define LVM_MEM_PARTITION2 2 /* 3rd memory partition */
|
||||
#define LVM_MEM_PARTITION3 3 /* 4th memory partition */
|
||||
|
||||
/* Use type */
|
||||
#define LVM_MEM_PERSISTENT 0 /* Persistent memory type */
|
||||
#define LVM_MEM_SCRATCH 4 /* Scratch memory type */
|
||||
|
||||
/* Access type */
|
||||
#define LVM_MEM_INTERNAL 0 /* Internal (fast) access memory */
|
||||
#define LVM_MEM_EXTERNAL 8 /* External (slow) access memory */
|
||||
|
||||
/* Platform specific */
|
||||
#define LVM_PERSISTENT LVM_MEM_PARTITION0+LVM_MEM_PERSISTENT+LVM_MEM_INTERNAL
|
||||
#define LVM_PERSISTENT_DATA LVM_MEM_PARTITION1+LVM_MEM_PERSISTENT+LVM_MEM_INTERNAL
|
||||
#define LVM_PERSISTENT_COEF LVM_MEM_PARTITION2+LVM_MEM_PERSISTENT+LVM_MEM_INTERNAL
|
||||
#define LVM_SCRATCH LVM_MEM_PARTITION3+LVM_MEM_SCRATCH+LVM_MEM_INTERNAL
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* Basic types */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
|
||||
typedef char LVM_CHAR; /* ASCII character */
|
||||
|
||||
typedef char LVM_INT8; /* Signed 8-bit word */
|
||||
typedef unsigned char LVM_UINT8; /* Unsigned 8-bit word */
|
||||
|
||||
typedef short LVM_INT16; /* Signed 16-bit word */
|
||||
typedef unsigned short LVM_UINT16; /* Unsigned 16-bit word */
|
||||
|
||||
typedef long LVM_INT32; /* Signed 32-bit word */
|
||||
typedef unsigned long LVM_UINT32; /* Unsigned 32-bit word */
|
||||
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* Standard Enumerated types */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
|
||||
/* Operating mode */
|
||||
typedef enum
|
||||
{
|
||||
LVM_MODE_OFF = 0,
|
||||
LVM_MODE_ON = 1,
|
||||
LVM_MODE_DUMMY = LVM_MAXENUM
|
||||
} LVM_Mode_en;
|
||||
|
||||
|
||||
/* Format */
|
||||
typedef enum
|
||||
{
|
||||
LVM_STEREO = 0,
|
||||
LVM_MONOINSTEREO = 1,
|
||||
LVM_MONO = 2,
|
||||
LVM_SOURCE_DUMMY = LVM_MAXENUM
|
||||
} LVM_Format_en;
|
||||
|
||||
|
||||
/* LVM sampling rates */
|
||||
typedef enum
|
||||
{
|
||||
LVM_FS_8000 = 0,
|
||||
LVM_FS_11025 = 1,
|
||||
LVM_FS_12000 = 2,
|
||||
LVM_FS_16000 = 3,
|
||||
LVM_FS_22050 = 4,
|
||||
LVM_FS_24000 = 5,
|
||||
LVM_FS_32000 = 6,
|
||||
LVM_FS_44100 = 7,
|
||||
LVM_FS_48000 = 8,
|
||||
LVM_FS_INVALID = LVM_MAXENUM-1,
|
||||
LVM_FS_DUMMY = LVM_MAXENUM
|
||||
} LVM_Fs_en;
|
||||
|
||||
|
||||
/* Memory Types */
|
||||
typedef enum
|
||||
{
|
||||
LVM_PERSISTENT_SLOW_DATA = LVM_MEMREGION_PERSISTENT_SLOW_DATA,
|
||||
LVM_PERSISTENT_FAST_DATA = LVM_MEMREGION_PERSISTENT_FAST_DATA,
|
||||
LVM_PERSISTENT_FAST_COEF = LVM_MEMREGION_PERSISTENT_FAST_COEF,
|
||||
LVM_TEMPORARY_FAST = LVM_MEMREGION_TEMPORARY_FAST,
|
||||
LVM_MEMORYTYPE_DUMMY = LVM_MAXENUM
|
||||
} LVM_MemoryTypes_en;
|
||||
|
||||
|
||||
/* Memory region definition */
|
||||
typedef struct
|
||||
{
|
||||
LVM_UINT32 Size; /* Region size in bytes */
|
||||
LVM_MemoryTypes_en Type; /* Region type */
|
||||
void *pBaseAddress; /* Pointer to the region base address */
|
||||
} LVM_MemoryRegion_st;
|
||||
|
||||
|
||||
/* Memory table containing the region definitions */
|
||||
typedef struct
|
||||
{
|
||||
LVM_MemoryRegion_st Region[LVM_NR_MEMORY_REGIONS]; /* One definition for each region */
|
||||
} LVM_MemoryTable_st;
|
||||
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* Standard Function Prototypes */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
typedef LVM_INT32 (*LVM_Callback)(void *pCallbackData, /* Pointer to the callback data structure */
|
||||
void *pGeneralPurpose, /* General purpose pointer (e.g. to a data structure needed in the callback) */
|
||||
LVM_INT16 GeneralPurpose ); /* General purpose variable (e.g. to be used as callback ID) */
|
||||
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* End of file */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* LVM_TYPES_H */
|
135
media/libeffects/lvm/lib/Common/lib/Mixer.h
Executable file
135
media/libeffects/lvm/lib/Common/lib/Mixer.h
Executable file
@ -0,0 +1,135 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**********************************************************************************
|
||||
|
||||
$Author: beq07716 $
|
||||
$Revision: 1000 $
|
||||
$Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $
|
||||
|
||||
***********************************************************************************/
|
||||
|
||||
#ifndef __MIXER_H__
|
||||
#define __MIXER_H__
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#include "LVM_Types.h"
|
||||
|
||||
/**********************************************************************************
|
||||
INSTANCE MEMORY TYPE DEFINITION
|
||||
***********************************************************************************/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
LVM_INT32 Alpha; /* Time constant. Set by calling application. Can be changed at any time */
|
||||
LVM_INT32 Target; /* Target value. Set by calling application. Can be changed at any time */
|
||||
LVM_INT32 Current; /* Current value. Set by the mixer function. */
|
||||
LVM_INT16 CallbackSet; /* Boolean. Should be set by calling application each time the target value is updated */
|
||||
LVM_INT16 CallbackParam; /* Parameter that will be used in the calback function */
|
||||
void *pCallbackHandle; /* Pointer to the instance of the callback function */
|
||||
void *pGeneralPurpose; /* Pointer for general purpose usage */
|
||||
LVM_Callback pCallBack; /* Pointer to the callback function */
|
||||
} Mix_1St_Cll_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
LVM_INT32 Alpha1;
|
||||
LVM_INT32 Target1;
|
||||
LVM_INT32 Current1;
|
||||
LVM_INT16 CallbackSet1;
|
||||
LVM_INT16 CallbackParam1;
|
||||
void *pCallbackHandle1;
|
||||
void *pGeneralPurpose1;
|
||||
LVM_Callback pCallBack1;
|
||||
|
||||
LVM_INT32 Alpha2; /* Warning the address of this location is passed as a pointer to Mix_1St_Cll_t in some functions */
|
||||
LVM_INT32 Target2;
|
||||
LVM_INT32 Current2;
|
||||
LVM_INT16 CallbackSet2;
|
||||
LVM_INT16 CallbackParam2;
|
||||
void *pCallbackHandle2;
|
||||
void *pGeneralPurpose2;
|
||||
LVM_Callback pCallBack2;
|
||||
|
||||
} Mix_2St_Cll_t;
|
||||
|
||||
|
||||
/*** General functions ************************************************************/
|
||||
|
||||
LVM_UINT32 LVM_Mixer_TimeConstant(LVM_UINT32 tc,
|
||||
LVM_UINT16 Fs,
|
||||
LVM_UINT16 NumChannels);
|
||||
|
||||
|
||||
void MixSoft_1St_D32C31_WRA( Mix_1St_Cll_t *pInstance,
|
||||
const LVM_INT32 *src,
|
||||
LVM_INT32 *dst,
|
||||
LVM_INT16 n);
|
||||
|
||||
void MixSoft_2St_D32C31_SAT( Mix_2St_Cll_t *pInstance,
|
||||
const LVM_INT32 *src1,
|
||||
const LVM_INT32 *src2,
|
||||
LVM_INT32 *dst,
|
||||
LVM_INT16 n);
|
||||
|
||||
void MixInSoft_D32C31_SAT( Mix_1St_Cll_t *pInstance,
|
||||
const LVM_INT32 *src,
|
||||
LVM_INT32 *dst,
|
||||
LVM_INT16 n);
|
||||
|
||||
/**********************************************************************************
|
||||
FUNCTION PROTOTYPES (LOW LEVEL SUBFUNCTIONS)
|
||||
***********************************************************************************/
|
||||
|
||||
void Core_MixSoft_1St_D32C31_WRA( Mix_1St_Cll_t *pInstance,
|
||||
const LVM_INT32 *src,
|
||||
LVM_INT32 *dst,
|
||||
LVM_INT16 n);
|
||||
|
||||
void Core_MixHard_2St_D32C31_SAT( Mix_2St_Cll_t *pInstance,
|
||||
const LVM_INT32 *src1,
|
||||
const LVM_INT32 *src2,
|
||||
LVM_INT32 *dst,
|
||||
LVM_INT16 n);
|
||||
|
||||
void Core_MixInSoft_D32C31_SAT( Mix_1St_Cll_t *pInstance,
|
||||
const LVM_INT32 *src,
|
||||
LVM_INT32 *dst,
|
||||
LVM_INT16 n);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
/**********************************************************************************/
|
||||
|
||||
#endif /* __MIXER_H__ */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
68
media/libeffects/lvm/lib/Common/lib/ScalarArithmetic.h
Executable file
68
media/libeffects/lvm/lib/Common/lib/ScalarArithmetic.h
Executable file
@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* $Author: beq07716 $*/
|
||||
/* $Revision: 1000 $*/
|
||||
/* $Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $*/
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
#ifndef __SCALARARITHMETIC_H__
|
||||
#define __SCALARARITHMETIC_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
/*######################################################################################*/
|
||||
/* Include files */
|
||||
/*######################################################################################*/
|
||||
|
||||
#include "LVM_Types.h"
|
||||
|
||||
/*######################################################################################*/
|
||||
/* Extern function prototypes */
|
||||
/*######################################################################################*/
|
||||
|
||||
/* Absolute value including the corner case for the extreme negative value */
|
||||
LVM_INT32 Abs_32(LVM_INT32 input);
|
||||
|
||||
/****************************************************************************************
|
||||
* Name : dB_to_Lin32()
|
||||
* Input : Signed 16-bit integer
|
||||
* MSB (16) = sign bit
|
||||
* (15->05) = integer part
|
||||
* (04->01) = decimal part
|
||||
* Output : Signed 32-bit integer
|
||||
* MSB (32) = sign bit
|
||||
* (31->16) = integer part
|
||||
* (15->01) = decimal part
|
||||
* Returns : Lin value format 1.16.15
|
||||
****************************************************************************************/
|
||||
|
||||
LVM_INT32 dB_to_Lin32(LVM_INT16 db_fix);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __SCALARARITHMETIC_H__ */
|
||||
|
||||
|
189
media/libeffects/lvm/lib/Common/lib/VectorArithmetic.h
Executable file
189
media/libeffects/lvm/lib/Common/lib/VectorArithmetic.h
Executable file
@ -0,0 +1,189 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**********************************************************************************
|
||||
|
||||
$Author: beq07716 $
|
||||
$Revision: 853 $
|
||||
$Date: 2010-06-16 15:10:28 +0200 (Wed, 16 Jun 2010) $
|
||||
|
||||
***********************************************************************************/
|
||||
|
||||
#ifndef _VECTOR_ARITHMETIC_H_
|
||||
#define _VECTOR_ARITHMETIC_H_
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include "LVM_Types.h"
|
||||
|
||||
/**********************************************************************************
|
||||
VARIOUS FUNCTIONS
|
||||
***********************************************************************************/
|
||||
|
||||
void LoadConst_16( const LVM_INT16 val,
|
||||
LVM_INT16 *dst,
|
||||
LVM_INT16 n );
|
||||
|
||||
void LoadConst_32( const LVM_INT32 val,
|
||||
LVM_INT32 *dst,
|
||||
LVM_INT16 n );
|
||||
|
||||
void Copy_16( const LVM_INT16 *src,
|
||||
LVM_INT16 *dst,
|
||||
LVM_INT16 n );
|
||||
|
||||
/*********************************************************************************
|
||||
* note: In Mult3s_16x16() saturation of result is not taken care when *
|
||||
* overflow occurs. *
|
||||
* For example when *src = 0x8000, val = *0x8000 *
|
||||
* The function gives the output as 0x8000 instead of 0x7fff *
|
||||
* This is the only case which will give wrong result. *
|
||||
* For more information refer to Vector_Arithmetic.doc in /doc folder *
|
||||
*********************************************************************************/
|
||||
void Mult3s_16x16( const LVM_INT16 *src,
|
||||
const LVM_INT16 val,
|
||||
LVM_INT16 *dst,
|
||||
LVM_INT16 n);
|
||||
|
||||
/*********************************************************************************
|
||||
* note: In Mult3s_32x16() saturation of result is not taken care when *
|
||||
* overflow occurs. *
|
||||
* For example when *src = 0x8000000, val = *0x8000 *
|
||||
* The function gives the output as 0x8000000 instead of 0x7fffffff *
|
||||
* This is the only extreme condition which is giving unexpected result *
|
||||
* For more information refer to Vector_Arithmetic.doc in /doc folder *
|
||||
*********************************************************************************/
|
||||
void Mult3s_32x16( const LVM_INT32 *src,
|
||||
const LVM_INT16 val,
|
||||
LVM_INT32 *dst,
|
||||
LVM_INT16 n);
|
||||
|
||||
void DelayMix_16x16( const LVM_INT16 *src,
|
||||
LVM_INT16 *delay,
|
||||
LVM_INT16 size,
|
||||
LVM_INT16 *dst,
|
||||
LVM_INT16 *pOffset,
|
||||
LVM_INT16 n);
|
||||
|
||||
void DelayWrite_32( const LVM_INT32 *src, /* Source 1, to be delayed */
|
||||
LVM_INT32 *delay, /* Delay buffer */
|
||||
LVM_UINT16 size, /* Delay size */
|
||||
LVM_UINT16 *pOffset, /* Delay offset */
|
||||
LVM_INT16 n);
|
||||
|
||||
void Add2_Sat_16x16( const LVM_INT16 *src,
|
||||
LVM_INT16 *dst,
|
||||
LVM_INT16 n );
|
||||
|
||||
void Add2_Sat_32x32( const LVM_INT32 *src,
|
||||
LVM_INT32 *dst,
|
||||
LVM_INT16 n );
|
||||
|
||||
void Mac3s_Sat_16x16( const LVM_INT16 *src,
|
||||
const LVM_INT16 val,
|
||||
LVM_INT16 *dst,
|
||||
LVM_INT16 n);
|
||||
|
||||
void Mac3s_Sat_32x16( const LVM_INT32 *src,
|
||||
const LVM_INT16 val,
|
||||
LVM_INT32 *dst,
|
||||
LVM_INT16 n);
|
||||
|
||||
void DelayAllPass_Sat_32x16To32( LVM_INT32 *delay, /* Delay buffer */
|
||||
LVM_UINT16 size, /* Delay size */
|
||||
LVM_INT16 coeff, /* All pass filter coefficient */
|
||||
LVM_UINT16 DelayOffset, /* Simple delay offset */
|
||||
LVM_UINT16 *pAllPassOffset, /* All pass filter delay offset */
|
||||
LVM_INT32 *dst, /* Source/destination */
|
||||
LVM_INT16 n);
|
||||
|
||||
/**********************************************************************************
|
||||
SHIFT FUNCTIONS
|
||||
***********************************************************************************/
|
||||
|
||||
void Shift_Sat_v16xv16 ( const LVM_INT16 val,
|
||||
const LVM_INT16 *src,
|
||||
LVM_INT16 *dst,
|
||||
LVM_INT16 n);
|
||||
|
||||
void Shift_Sat_v32xv32 ( const LVM_INT16 val,
|
||||
const LVM_INT32 *src,
|
||||
LVM_INT32 *dst,
|
||||
LVM_INT16 n);
|
||||
|
||||
/**********************************************************************************
|
||||
AUDIO FORMAT CONVERSION FUNCTIONS
|
||||
***********************************************************************************/
|
||||
|
||||
void MonoTo2I_16( const LVM_INT16 *src,
|
||||
LVM_INT16 *dst,
|
||||
LVM_INT16 n);
|
||||
|
||||
void MonoTo2I_32( const LVM_INT32 *src,
|
||||
LVM_INT32 *dst,
|
||||
LVM_INT16 n);
|
||||
|
||||
void From2iToMono_32( const LVM_INT32 *src,
|
||||
LVM_INT32 *dst,
|
||||
LVM_INT16 n);
|
||||
|
||||
void MSTo2i_Sat_16x16( const LVM_INT16 *srcM,
|
||||
const LVM_INT16 *srcS,
|
||||
LVM_INT16 *dst,
|
||||
LVM_INT16 n );
|
||||
|
||||
void From2iToMS_16x16( const LVM_INT16 *src,
|
||||
LVM_INT16 *dstM,
|
||||
LVM_INT16 *dstS,
|
||||
LVM_INT16 n );
|
||||
|
||||
void From2iToMono_16( const LVM_INT16 *src,
|
||||
LVM_INT16 *dst,
|
||||
LVM_INT16 n);
|
||||
|
||||
void JoinTo2i_32x32( const LVM_INT32 *srcL,
|
||||
const LVM_INT32 *srcR,
|
||||
LVM_INT32 *dst,
|
||||
LVM_INT16 n );
|
||||
|
||||
/**********************************************************************************
|
||||
DATA TYPE CONVERSION FUNCTIONS
|
||||
***********************************************************************************/
|
||||
|
||||
void Int16LShiftToInt32_16x32(const LVM_INT16 *src,
|
||||
LVM_INT32 *dst,
|
||||
LVM_INT16 n,
|
||||
LVM_INT16 shift );
|
||||
|
||||
void Int32RShiftToInt16_Sat_32x16(const LVM_INT32 *src,
|
||||
LVM_INT16 *dst,
|
||||
LVM_INT16 n,
|
||||
LVM_INT16 shift );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
/**********************************************************************************/
|
||||
|
||||
#endif /* _VECTOR_ARITHMETIC_H_ */
|
||||
|
||||
/**********************************************************************************/
|
204
media/libeffects/lvm/lib/Common/src/AGC_MIX_VOL_2St1Mon_D32_WRA.c
Executable file
204
media/libeffects/lvm/lib/Common/src/AGC_MIX_VOL_2St1Mon_D32_WRA.c
Executable file
@ -0,0 +1,204 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/****************************************************************************************
|
||||
|
||||
$Author: beq07716 $
|
||||
$Revision: 1070 $
|
||||
$Date: 2010-07-02 11:22:18 +0200 (Fri, 02 Jul 2010) $
|
||||
|
||||
*****************************************************************************************/
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* Includes */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
|
||||
#include "AGC.h"
|
||||
#include "ScalarArithmetic.h"
|
||||
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* Defines */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
|
||||
#define VOL_TC_SHIFT 21 /* As a power of 2 */
|
||||
#define DECAY_SHIFT 10 /* As a power of 2 */
|
||||
|
||||
|
||||
/****************************************************************************************/
|
||||
/* */
|
||||
/* FUNCTION: AGC_MIX_VOL_2St1Mon_D32_WRA */
|
||||
/* */
|
||||
/* DESCRIPTION: */
|
||||
/* Apply AGC and mix signals */
|
||||
/* */
|
||||
/* */
|
||||
/* StSrc ------------------| */
|
||||
/* | */
|
||||
/* ______ _|_ ________ */
|
||||
/* | | | | | | */
|
||||
/* MonoSrc -->| AGC |---->| + |----->| Volume |------------------------------+---> */
|
||||
/* | Gain | |___| | Gain | | */
|
||||
/* |______| |________| | */
|
||||
/* /|\ __________ ________ | */
|
||||
/* | | | | | | */
|
||||
/* |-------------------------------| AGC Gain |<--| Peak |<--| */
|
||||
/* | Update | | Detect | */
|
||||
/* |__________| |________| */
|
||||
/* */
|
||||
/* */
|
||||
/* PARAMETERS: */
|
||||
/* pInstance Instance pointer */
|
||||
/* pStereoIn Stereo source */
|
||||
/* pMonoIn Mono band pass source */
|
||||
/* pStereoOut Stereo destination */
|
||||
/* */
|
||||
/* RETURNS: */
|
||||
/* Void */
|
||||
/* */
|
||||
/* NOTES: */
|
||||
/* */
|
||||
/****************************************************************************************/
|
||||
|
||||
void AGC_MIX_VOL_2St1Mon_D32_WRA(AGC_MIX_VOL_2St1Mon_D32_t *pInstance, /* Instance pointer */
|
||||
const LVM_INT32 *pStSrc, /* Stereo source */
|
||||
const LVM_INT32 *pMonoSrc, /* Mono source */
|
||||
LVM_INT32 *pDst, /* Stereo destination */
|
||||
LVM_UINT16 NumSamples) /* Number of samples */
|
||||
{
|
||||
|
||||
/*
|
||||
* General variables
|
||||
*/
|
||||
LVM_UINT16 i; /* Sample index */
|
||||
LVM_INT32 Left; /* Left sample */
|
||||
LVM_INT32 Right; /* Right sample */
|
||||
LVM_INT32 Mono; /* Mono sample */
|
||||
LVM_INT32 AbsPeak; /* Absolute peak signal */
|
||||
LVM_INT32 HighWord; /* High word in intermediate calculations */
|
||||
LVM_INT32 LowWord; /* Low word in intermediate calculations */
|
||||
LVM_INT16 AGC_Mult; /* Short AGC gain */
|
||||
LVM_INT16 Vol_Mult; /* Short volume */
|
||||
|
||||
|
||||
/*
|
||||
* Instance control variables
|
||||
*/
|
||||
LVM_INT32 AGC_Gain = pInstance->AGC_Gain; /* Get the current AGC gain */
|
||||
LVM_INT32 AGC_MaxGain = pInstance->AGC_MaxGain; /* Get maximum AGC gain */
|
||||
LVM_INT16 AGC_GainShift = pInstance->AGC_GainShift; /* Get the AGC shift */
|
||||
LVM_INT16 AGC_Attack = pInstance->AGC_Attack; /* Attack scaler */
|
||||
LVM_INT16 AGC_Decay = pInstance->AGC_Decay; /* Decay scaler */
|
||||
LVM_INT32 AGC_Target = pInstance->AGC_Target; /* Get the target level */
|
||||
LVM_INT32 Vol_Current = pInstance->Volume; /* Actual volume setting */
|
||||
LVM_INT32 Vol_Target = pInstance->Target; /* Target volume setting */
|
||||
LVM_INT16 Vol_Shift = pInstance->VolumeShift; /* Volume shift scaling */
|
||||
LVM_INT16 Vol_TC = pInstance->VolumeTC; /* Time constant */
|
||||
|
||||
|
||||
/*
|
||||
* Process on a sample by sample basis
|
||||
*/
|
||||
for (i=0;i<NumSamples;i++) /* For each sample */
|
||||
{
|
||||
|
||||
/*
|
||||
* Get the short scalers
|
||||
*/
|
||||
AGC_Mult = (LVM_INT16)(AGC_Gain >> 16); /* Get the short AGC gain */
|
||||
Vol_Mult = (LVM_INT16)(Vol_Current >> 16); /* Get the short volume gain */
|
||||
|
||||
|
||||
/*
|
||||
* Get the input samples
|
||||
*/
|
||||
Left = *pStSrc++; /* Get the left sample */
|
||||
Right = *pStSrc++; /* Get the right sample */
|
||||
Mono = *pMonoSrc++; /* Get the mono sample */
|
||||
|
||||
|
||||
/*
|
||||
* Apply the AGC gain to the mono input and mix with the stereo signal
|
||||
*/
|
||||
HighWord = (AGC_Mult * (Mono >> 16)); /* signed long (Mono) by unsigned short (AGC_Mult) multiply */
|
||||
LowWord = (AGC_Mult * (Mono & 0xffff));
|
||||
Mono = (HighWord + (LowWord >> 16)) << (AGC_GainShift);
|
||||
Left += Mono; /* Mix in the mono signal */
|
||||
Right += Mono;
|
||||
|
||||
|
||||
/*
|
||||
* Apply the volume and write to the output stream
|
||||
*/
|
||||
HighWord = (Vol_Mult * (Left >> 16)); /* signed long (Left) by unsigned short (Vol_Mult) multiply */
|
||||
LowWord = (Vol_Mult * (Left & 0xffff));
|
||||
Left = (HighWord + (LowWord >> 16)) << (Vol_Shift);
|
||||
HighWord = (Vol_Mult * (Right >> 16)); /* signed long (Right) by unsigned short (Vol_Mult) multiply */
|
||||
LowWord = (Vol_Mult * (Right & 0xffff));
|
||||
Right = (HighWord + (LowWord >> 16)) << (Vol_Shift);
|
||||
*pDst++ = Left; /* Save the results */
|
||||
*pDst++ = Right;
|
||||
|
||||
|
||||
/*
|
||||
* Update the AGC gain
|
||||
*/
|
||||
AbsPeak = (Abs_32(Left)>Abs_32(Right)) ? Abs_32(Left) : Abs_32(Right); /* Get the absolute peak */
|
||||
if (AbsPeak > AGC_Target)
|
||||
{
|
||||
/*
|
||||
* The signal is too large so decrease the gain
|
||||
*/
|
||||
HighWord = (AGC_Attack * (AGC_Gain >> 16)); /* signed long (AGC_Gain) by unsigned short (AGC_Attack) multiply */
|
||||
LowWord = (AGC_Attack * (AGC_Gain & 0xffff));
|
||||
AGC_Gain = (HighWord + (LowWord >> 16)) << 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* The signal is too small so increase the gain
|
||||
*/
|
||||
if (AGC_Gain > AGC_MaxGain)
|
||||
{
|
||||
AGC_Gain -= (AGC_Decay << DECAY_SHIFT);
|
||||
}
|
||||
else
|
||||
{
|
||||
AGC_Gain += (AGC_Decay << DECAY_SHIFT);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Update the gain
|
||||
*/
|
||||
Vol_Current += Vol_TC * ((Vol_Target - Vol_Current) >> VOL_TC_SHIFT);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Update the parameters
|
||||
*/
|
||||
pInstance->Volume = Vol_Current; /* Actual volume setting */
|
||||
pInstance->AGC_Gain = AGC_Gain;
|
||||
|
||||
return;
|
||||
}
|
||||
|
58
media/libeffects/lvm/lib/Common/src/Abs_32.c
Executable file
58
media/libeffects/lvm/lib/Common/src/Abs_32.c
Executable file
@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* $Author: beq07716 $*/
|
||||
/* $Revision: 1000 $*/
|
||||
/* $Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $*/
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
/*######################################################################################*/
|
||||
/* Include files */
|
||||
/*######################################################################################*/
|
||||
|
||||
#include "ScalarArithmetic.h"
|
||||
|
||||
/****************************************************************************************
|
||||
* Name : Abs_32()
|
||||
* Input : Signed 32-bit integer
|
||||
* Output :
|
||||
* Returns : Absolute value
|
||||
* Description : Absolute value with maximum negative value corner case
|
||||
* Remarks :
|
||||
****************************************************************************************/
|
||||
|
||||
LVM_INT32 Abs_32(LVM_INT32 input)
|
||||
{
|
||||
if(input < 0)
|
||||
{
|
||||
if (input == (LVM_INT32)(0x80000000U))
|
||||
{
|
||||
/* The corner case, so set to the maximum positive value */
|
||||
input=(LVM_INT32) 0x7fffffff;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Negative input, so invert */
|
||||
input = (LVM_INT32)(-input);
|
||||
}
|
||||
}
|
||||
return input;
|
||||
}
|
||||
|
64
media/libeffects/lvm/lib/Common/src/Add2_Sat_16x16.c
Executable file
64
media/libeffects/lvm/lib/Common/src/Add2_Sat_16x16.c
Executable file
@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**********************************************************************************
|
||||
|
||||
$Author: beq07716 $
|
||||
$Revision: 1000 $
|
||||
$Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $
|
||||
|
||||
***********************************************************************************/
|
||||
|
||||
/**********************************************************************************
|
||||
INCLUDE FILES
|
||||
***********************************************************************************/
|
||||
|
||||
#include "VectorArithmetic.h"
|
||||
|
||||
/**********************************************************************************
|
||||
FUNCTION ADD2_SAT_16X16
|
||||
***********************************************************************************/
|
||||
|
||||
void Add2_Sat_16x16( const LVM_INT16 *src,
|
||||
LVM_INT16 *dst,
|
||||
LVM_INT16 n )
|
||||
{
|
||||
LVM_INT32 Temp;
|
||||
LVM_INT16 ii;
|
||||
for (ii = n; ii != 0; ii--)
|
||||
{
|
||||
Temp = ((LVM_INT32) *src) + ((LVM_INT32) *dst);
|
||||
src++;
|
||||
|
||||
if (Temp > 0x00007FFF)
|
||||
{
|
||||
*dst = 0x7FFF;
|
||||
}
|
||||
else if (Temp < -0x00008000)
|
||||
{
|
||||
*dst = - 0x8000;
|
||||
}
|
||||
else
|
||||
{
|
||||
*dst = (LVM_INT16)Temp;
|
||||
}
|
||||
dst++;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/**********************************************************************************/
|
69
media/libeffects/lvm/lib/Common/src/Add2_Sat_32x32.c
Executable file
69
media/libeffects/lvm/lib/Common/src/Add2_Sat_32x32.c
Executable file
@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* Project:: */
|
||||
/* $Author: beq07716 $*/
|
||||
/* $Revision: 1000 $*/
|
||||
/* $Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $*/
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
/**********************************************************************************
|
||||
INCLUDE FILES
|
||||
***********************************************************************************/
|
||||
|
||||
#include "VectorArithmetic.h"
|
||||
|
||||
|
||||
/**********************************************************************************
|
||||
FUNCTION ADD2_SAT_32X32
|
||||
***********************************************************************************/
|
||||
|
||||
void Add2_Sat_32x32( const LVM_INT32 *src,
|
||||
LVM_INT32 *dst,
|
||||
LVM_INT16 n )
|
||||
{
|
||||
LVM_INT32 a,b,c;
|
||||
LVM_INT16 ii;
|
||||
for (ii = n; ii != 0; ii--)
|
||||
{
|
||||
a=*src;
|
||||
src++;
|
||||
|
||||
b=*dst;
|
||||
c=a+b;
|
||||
if ((((c ^ a) & (c ^ b)) >> 31)!=0) /* overflow / underflow */
|
||||
{
|
||||
if(a<0)
|
||||
{
|
||||
c=0x80000000l;
|
||||
}
|
||||
else
|
||||
{
|
||||
c=0x7FFFFFFFl;
|
||||
}
|
||||
}
|
||||
|
||||
*dst = c;
|
||||
dst++;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/**********************************************************************************/
|
90
media/libeffects/lvm/lib/Common/src/BP_1I_D16F16C14_TRC_WRA_01.c
Executable file
90
media/libeffects/lvm/lib/Common/src/BP_1I_D16F16C14_TRC_WRA_01.c
Executable file
@ -0,0 +1,90 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* Project:: */
|
||||
/* $Author: beq07716 $*/
|
||||
/* $Revision: 1000 $*/
|
||||
/* $Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $*/
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
#include "BIQUAD.h"
|
||||
#include "BP_1I_D16F16Css_TRC_WRA_01_Private.h"
|
||||
#include "LVM_Macros.h"
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
ASSUMPTIONS:
|
||||
COEFS-
|
||||
pBiquadState->coefs[0] is A0,
|
||||
pBiquadState->coefs[1] is -B2,
|
||||
pBiquadState->coefs[2] is -B1, these are in Q14 format
|
||||
|
||||
DELAYS-
|
||||
pBiquadState->pDelays[0] is x(n-1)L in Q0 format
|
||||
pBiquadState->pDelays[1] is x(n-2)L in Q0 format
|
||||
pBiquadState->pDelays[2] is y(n-1)L in Q0 format
|
||||
pBiquadState->pDelays[3] is y(n-2)L in Q0 format
|
||||
***************************************************************************/
|
||||
|
||||
void BP_1I_D16F16C14_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
|
||||
LVM_INT16 *pDataIn,
|
||||
LVM_INT16 *pDataOut,
|
||||
LVM_INT16 NrSamples)
|
||||
|
||||
|
||||
{
|
||||
LVM_INT32 ynL;
|
||||
LVM_INT16 ii;
|
||||
PFilter_State pBiquadState = (PFilter_State) pInstance;
|
||||
|
||||
for (ii = NrSamples; ii != 0; ii--)
|
||||
{
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
PROCESSING OF THE LEFT CHANNEL
|
||||
***************************************************************************/
|
||||
// ynL= (A0 (Q14) * (x(n)L (Q0) - x(n-2)L (Q0) ) ) in Q14
|
||||
ynL=(LVM_INT32)pBiquadState->coefs[0]* ((*pDataIn)-pBiquadState->pDelays[1]);
|
||||
|
||||
// ynL+= ((-B2 (Q14) * y(n-2)L (Q0) ) ) in Q14
|
||||
ynL+=(LVM_INT32)pBiquadState->coefs[1]*pBiquadState->pDelays[3];
|
||||
|
||||
// ynL+= ((-B1 (Q30) * y(n-1)L (Q0) ) ) in Q14
|
||||
ynL+=(LVM_INT32)pBiquadState->coefs[2]*pBiquadState->pDelays[2];
|
||||
|
||||
ynL=(LVM_INT16)(ynL>>14); // ynL in Q0
|
||||
/**************************************************************************
|
||||
UPDATING THE DELAYS
|
||||
***************************************************************************/
|
||||
pBiquadState->pDelays[3]=pBiquadState->pDelays[2]; // y(n-2)L=y(n-1)L
|
||||
pBiquadState->pDelays[1]=pBiquadState->pDelays[0]; // x(n-2)L=x(n-1)L
|
||||
pBiquadState->pDelays[2]=ynL; // Update y(n-1)L in Q0
|
||||
pBiquadState->pDelays[0]=(*pDataIn++); // Update x(n-1)L in Q0
|
||||
|
||||
/**************************************************************************
|
||||
WRITING THE OUTPUT
|
||||
***************************************************************************/
|
||||
*pDataOut++=(LVM_INT16)ynL; // Write Left output in Q0
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
59
media/libeffects/lvm/lib/Common/src/BP_1I_D16F16Css_TRC_WRA_01_Init.c
Executable file
59
media/libeffects/lvm/lib/Common/src/BP_1I_D16F16Css_TRC_WRA_01_Init.c
Executable file
@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* */
|
||||
/* $Author: beq07716 $*/
|
||||
/* $Revision: 1000 $*/
|
||||
/* $Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $*/
|
||||
/* */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
#include "BIQUAD.h"
|
||||
#include "BP_1I_D16F16Css_TRC_WRA_01_Private.h"
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* FUNCTION: */
|
||||
/* BP_1I_D16F16Css_TRC_WRA_01_Init */
|
||||
/* */
|
||||
/* DESCRIPTION: */
|
||||
/* These functions initializes a BIQUAD filter defined as a cascade of */
|
||||
/* biquadratic Filter Sections. */
|
||||
/* */
|
||||
/* PARAMETERS: */
|
||||
/* pInstance - output, returns the pointer to the State Variable */
|
||||
/* This state pointer must be passed to any subsequent */
|
||||
/* call to "Biquad" functions. */
|
||||
/* pTaps - input, pointer to the taps memory */
|
||||
/* pCoef - input, pointer to the coefficient structure */
|
||||
/* N - M coefficient factor of QM.N */
|
||||
/* RETURNS: */
|
||||
/* void return code */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
void BP_1I_D16F16Css_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
|
||||
Biquad_1I_Order2_Taps_t *pTaps,
|
||||
BP_C16_Coefs_t *pCoef)
|
||||
{
|
||||
PFilter_State pBiquadState = (PFilter_State) pInstance;
|
||||
pBiquadState->pDelays =(LVM_INT32 *) pTaps;
|
||||
|
||||
pBiquadState->coefs[0]=pCoef->A0;
|
||||
pBiquadState->coefs[1]=pCoef->B2;
|
||||
pBiquadState->coefs[2]=pCoef->B1;
|
||||
}
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* End Of File: BP_1I_D16F16Css_TRC_WRA_01_Init.c */
|
||||
|
38
media/libeffects/lvm/lib/Common/src/BP_1I_D16F16Css_TRC_WRA_01_Private.h
Executable file
38
media/libeffects/lvm/lib/Common/src/BP_1I_D16F16Css_TRC_WRA_01_Private.h
Executable file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef _BP_1I_D16F16CSS_TRC_WRA_01_PRIVATE_H_
|
||||
#define _BP_1I_D16F16CSS_TRC_WRA_01_PRIVATE_H_
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* Project:: */
|
||||
/* $Author: beq07716 $*/
|
||||
/* $Revision: 1000 $*/
|
||||
/* $Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $*/
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
/* The internal state variables are implemented in a (for the user) hidden structure */
|
||||
/* In this (private) file, the internal structure is declared fro private use. */
|
||||
typedef struct _Filter_State_
|
||||
{
|
||||
LVM_INT32 * pDelays; /* pointer to the delayed samples (data of 32 bits) */
|
||||
LVM_INT32 coefs[3]; /* pointer to the filter coefficients */
|
||||
}Filter_State;
|
||||
|
||||
typedef Filter_State * PFilter_State ;
|
||||
|
||||
#endif /*_BP_1I_D16F16CSS_TRC_WRA_01_PRIVATE_H_*/
|
92
media/libeffects/lvm/lib/Common/src/BP_1I_D16F32C30_TRC_WRA_01.c
Executable file
92
media/libeffects/lvm/lib/Common/src/BP_1I_D16F32C30_TRC_WRA_01.c
Executable file
@ -0,0 +1,92 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* Project:: */
|
||||
/* $Author: beq07716 $*/
|
||||
/* $Revision: 1000 $*/
|
||||
/* $Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $*/
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
#include "BIQUAD.h"
|
||||
#include "BP_1I_D16F32Cll_TRC_WRA_01_Private.h"
|
||||
#include "LVM_Macros.h"
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
ASSUMPTIONS:
|
||||
COEFS-
|
||||
pBiquadState->coefs[0] is A0,
|
||||
pBiquadState->coefs[1] is -B2,
|
||||
pBiquadState->coefs[2] is -B1, these are in Q30 format
|
||||
|
||||
DELAYS-
|
||||
pBiquadState->pDelays[0] is x(n-1)L in Q0 format
|
||||
pBiquadState->pDelays[1] is x(n-2)L in Q0 format
|
||||
pBiquadState->pDelays[2] is y(n-1)L in Q16 format
|
||||
pBiquadState->pDelays[3] is y(n-2)L in Q16 format
|
||||
***************************************************************************/
|
||||
|
||||
void BP_1I_D16F32C30_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
|
||||
LVM_INT16 *pDataIn,
|
||||
LVM_INT16 *pDataOut,
|
||||
LVM_INT16 NrSamples)
|
||||
|
||||
|
||||
{
|
||||
LVM_INT32 ynL,templ;
|
||||
LVM_INT16 ii;
|
||||
PFilter_State pBiquadState = (PFilter_State) pInstance;
|
||||
|
||||
for (ii = NrSamples; ii != 0; ii--)
|
||||
{
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
PROCESSING OF THE LEFT CHANNEL
|
||||
***************************************************************************/
|
||||
// ynL= (A0 (Q30) * (x(n)L (Q0) - x(n-2)L (Q0) ) >>14) in Q16
|
||||
templ= (LVM_INT32) *pDataIn-pBiquadState->pDelays[1];
|
||||
MUL32x32INTO32(pBiquadState->coefs[0],templ,ynL,14)
|
||||
|
||||
// ynL+= ((-B2 (Q30) * y(n-2)L (Q16) ) >>30) in Q16
|
||||
MUL32x32INTO32(pBiquadState->coefs[1],pBiquadState->pDelays[3],templ,30)
|
||||
ynL+=templ;
|
||||
|
||||
// ynL+= ((-B1 (Q30) * y(n-1)L (Q16) ) >>30) in Q16
|
||||
MUL32x32INTO32(pBiquadState->coefs[2],pBiquadState->pDelays[2],templ,30)
|
||||
ynL+=templ;
|
||||
|
||||
/**************************************************************************
|
||||
UPDATING THE DELAYS
|
||||
***************************************************************************/
|
||||
pBiquadState->pDelays[3]=pBiquadState->pDelays[2]; // y(n-2)L=y(n-1)L
|
||||
pBiquadState->pDelays[1]=pBiquadState->pDelays[0]; // x(n-2)L=x(n-1)L
|
||||
pBiquadState->pDelays[2]=ynL; // Update y(n-1)L in Q16
|
||||
pBiquadState->pDelays[0]=(*pDataIn++); // Update x(n-1)L in Q0
|
||||
|
||||
/**************************************************************************
|
||||
WRITING THE OUTPUT
|
||||
***************************************************************************/
|
||||
*pDataOut++=(LVM_INT16)(ynL>>16); // Write Left output in Q0
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
69
media/libeffects/lvm/lib/Common/src/BP_1I_D16F32Cll_TRC_WRA_01_Init.c
Executable file
69
media/libeffects/lvm/lib/Common/src/BP_1I_D16F32Cll_TRC_WRA_01_Init.c
Executable file
@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* */
|
||||
/* $Author: beq07716 $*/
|
||||
/* $Revision: 1000 $*/
|
||||
/* $Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $*/
|
||||
/* */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
#include "BIQUAD.h"
|
||||
#include "BP_1I_D16F32Cll_TRC_WRA_01_Private.h"
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* FUNCTION: */
|
||||
/* BP_1I_D16F32Cll_TRC_WRA_01_Init */
|
||||
/* */
|
||||
/* DESCRIPTION: */
|
||||
/* These functions initializes a Band pass filter (BIQUAD) */
|
||||
/* biquadratic Filter Sections. */
|
||||
/* */
|
||||
/* PARAMETERS: */
|
||||
/* pInstance - output, returns the pointer to the State Variable */
|
||||
/* This state pointer must be passed to any subsequent */
|
||||
/* call to "Biquad" functions. */
|
||||
/* pTaps - input, pointer to the taps memory */
|
||||
/* pCoef - input, pointer to the coefficient structure */
|
||||
/* N - M coefficient factor of QM.N */
|
||||
/* */
|
||||
/* The coefficients are modified in the init() function such that lower */
|
||||
/* half word is right shifted by one and most significant bit of the lower */
|
||||
/* word is made to be zero. */
|
||||
/* */
|
||||
/* Reason: For MIPS effciency,we are using DSP 32*16 multiplication */
|
||||
/* instruction. But we have 32*32 multiplication. This can be realized by two 32*16 */
|
||||
/* multiplication. But 16th bit in the 32 bit word is not a sign bit. So this is done */
|
||||
/* by putting 16th bit to zero and lossing one bit precision by division of lower */
|
||||
/* half word by 2. */
|
||||
/* RETURNS: */
|
||||
/* void return code */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
void BP_1I_D16F32Cll_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
|
||||
Biquad_1I_Order2_Taps_t *pTaps,
|
||||
BP_C32_Coefs_t *pCoef)
|
||||
{
|
||||
PFilter_State pBiquadState = (PFilter_State) pInstance;
|
||||
pBiquadState->pDelays =(LVM_INT32 *) pTaps;
|
||||
|
||||
pBiquadState->coefs[0] = pCoef->A0;
|
||||
pBiquadState->coefs[1] = pCoef->B2;
|
||||
pBiquadState->coefs[2] = pCoef->B1;
|
||||
}
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* End Of File: BP_1I_D16F32Cll_TRC_WRA_01_Init.c */
|
||||
|
38
media/libeffects/lvm/lib/Common/src/BP_1I_D16F32Cll_TRC_WRA_01_Private.h
Executable file
38
media/libeffects/lvm/lib/Common/src/BP_1I_D16F32Cll_TRC_WRA_01_Private.h
Executable file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef _BP_1I_D16F32CLL_TRC_WRA_01_PRIVATE_H_
|
||||
#define _BP_1I_D16F32CLL_TRC_WRA_01_PRIVATE_H_
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* Project:: */
|
||||
/* $Author: beq07716 $*/
|
||||
/* $Revision: 1000 $*/
|
||||
/* $Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $*/
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
/* The internal state variables are implemented in a (for the user) hidden structure */
|
||||
/* In this (private) file, the internal structure is declared fro private use. */
|
||||
typedef struct _Filter_State_
|
||||
{
|
||||
LVM_INT32 * pDelays; /* pointer to the delayed samples (data of 32 bits) */
|
||||
LVM_INT32 coefs[3]; /* pointer to the filter coefficients */
|
||||
}Filter_State;
|
||||
|
||||
typedef Filter_State * PFilter_State ;
|
||||
|
||||
#endif /*_BP_1I_D16F32CLL_TRC_WRA_01_PRIVATE_H_*/
|
90
media/libeffects/lvm/lib/Common/src/BP_1I_D32F32C30_TRC_WRA_02.c
Executable file
90
media/libeffects/lvm/lib/Common/src/BP_1I_D32F32C30_TRC_WRA_02.c
Executable file
@ -0,0 +1,90 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* Project:: */
|
||||
/* $Author: beq07716 $*/
|
||||
/* $Revision: 1000 $*/
|
||||
/* $Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $*/
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
#include "BIQUAD.h"
|
||||
#include "BP_1I_D32F32Cll_TRC_WRA_02_Private.h"
|
||||
#include "LVM_Macros.h"
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
ASSUMPTIONS:
|
||||
COEFS-
|
||||
pBiquadState->coefs[0] is A0,
|
||||
pBiquadState->coefs[1] is -B2,
|
||||
pBiquadState->coefs[2] is -B1, these are in Q30 format
|
||||
|
||||
DELAYS-
|
||||
pBiquadState->pDelays[0] is x(n-1)L in Q0 format
|
||||
pBiquadState->pDelays[1] is x(n-2)L in Q0 format
|
||||
pBiquadState->pDelays[2] is y(n-1)L in Q0 format
|
||||
pBiquadState->pDelays[3] is y(n-2)L in Q0 format
|
||||
***************************************************************************/
|
||||
|
||||
void BP_1I_D32F32C30_TRC_WRA_02 ( Biquad_Instance_t *pInstance,
|
||||
LVM_INT32 *pDataIn,
|
||||
LVM_INT32 *pDataOut,
|
||||
LVM_INT16 NrSamples)
|
||||
{
|
||||
LVM_INT32 ynL,templ;
|
||||
LVM_INT16 ii;
|
||||
PFilter_State pBiquadState = (PFilter_State) pInstance;
|
||||
|
||||
for (ii = NrSamples; ii != 0; ii--)
|
||||
{
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
PROCESSING OF THE LEFT CHANNEL
|
||||
***************************************************************************/
|
||||
// ynL= (A0 (Q30) * (x(n)L (Q0) - x(n-2)L (Q0) ) >>30) in Q0
|
||||
templ=(*pDataIn)-pBiquadState->pDelays[1];
|
||||
MUL32x32INTO32(pBiquadState->coefs[0],templ,ynL,30)
|
||||
|
||||
// ynL+= ((-B2 (Q30) * y(n-2)L (Q0) ) >>30) in Q0
|
||||
MUL32x32INTO32(pBiquadState->coefs[1],pBiquadState->pDelays[3],templ,30)
|
||||
ynL+=templ;
|
||||
|
||||
// ynL+= ((-B1 (Q30) * y(n-1)L (Q0) ) >>30) in Q0
|
||||
MUL32x32INTO32(pBiquadState->coefs[2],pBiquadState->pDelays[2],templ,30)
|
||||
ynL+=templ;
|
||||
|
||||
/**************************************************************************
|
||||
UPDATING THE DELAYS
|
||||
***************************************************************************/
|
||||
pBiquadState->pDelays[3]=pBiquadState->pDelays[2]; // y(n-2)L=y(n-1)L
|
||||
pBiquadState->pDelays[1]=pBiquadState->pDelays[0]; // x(n-2)L=x(n-1)L
|
||||
pBiquadState->pDelays[2]=ynL; // Update y(n-1)L in Q0
|
||||
pBiquadState->pDelays[0]=(*pDataIn++); // Update x(n-1)L in Q0
|
||||
|
||||
/**************************************************************************
|
||||
WRITING THE OUTPUT
|
||||
***************************************************************************/
|
||||
*pDataOut++=ynL; // Write Left output in Q0
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
60
media/libeffects/lvm/lib/Common/src/BP_1I_D32F32Cll_TRC_WRA_02_Init.c
Executable file
60
media/libeffects/lvm/lib/Common/src/BP_1I_D32F32Cll_TRC_WRA_02_Init.c
Executable file
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* */
|
||||
/* $Author: beq07716 $*/
|
||||
/* $Revision: 1000 $*/
|
||||
/* $Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $*/
|
||||
/* */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
#include "BIQUAD.h"
|
||||
#include "BP_1I_D32F32Cll_TRC_WRA_02_Private.h"
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* FUNCTION: */
|
||||
/* BP_1I_D32F32Cll_TRC_WRA_02_Init */
|
||||
/* */
|
||||
/* DESCRIPTION: */
|
||||
/* These functions initializes a BIQUAD filter defined as a cascade of */
|
||||
/* biquadratic Filter Sections. */
|
||||
/* */
|
||||
/* PARAMETERS: */
|
||||
/* pInstance - output, returns the pointer to the State Variable */
|
||||
/* This state pointer must be passed to any subsequent */
|
||||
/* call to "Biquad" functions. */
|
||||
/* pTaps - input, pointer to the taps memory */
|
||||
/* pCoef - input, pointer to the coefficient structure */
|
||||
/* N - M coefficient factor of QM.N */
|
||||
/* RETURNS: */
|
||||
/* void return code */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
void BP_1I_D32F32Cll_TRC_WRA_02_Init ( Biquad_Instance_t *pInstance,
|
||||
Biquad_1I_Order2_Taps_t *pTaps,
|
||||
BP_C32_Coefs_t *pCoef)
|
||||
{
|
||||
PFilter_State pBiquadState = (PFilter_State) pInstance;
|
||||
pBiquadState->pDelays =(LVM_INT32 *) pTaps;
|
||||
|
||||
pBiquadState->coefs[0]=pCoef->A0;
|
||||
|
||||
pBiquadState->coefs[1]=pCoef->B2;
|
||||
|
||||
pBiquadState->coefs[2]=pCoef->B1;
|
||||
}
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* End Of File: BP_1I_D32F32Cll_TRC_WRA_02_Init.c */
|
||||
|
38
media/libeffects/lvm/lib/Common/src/BP_1I_D32F32Cll_TRC_WRA_02_Private.h
Executable file
38
media/libeffects/lvm/lib/Common/src/BP_1I_D32F32Cll_TRC_WRA_02_Private.h
Executable file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef _BP_1I_D32F32CLL_TRC_WRA_02_PRIVATE_H_
|
||||
#define _BP_1I_D32F32CLL_TRC_WRA_02_PRIVATE_H_
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* Project:: */
|
||||
/* $Author: beq07716 $*/
|
||||
/* $Revision: 1000 $*/
|
||||
/* $Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $*/
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
/* The internal state variables are implemented in a (for the user) hidden structure */
|
||||
/* In this (private) file, the internal structure is declared fro private use. */
|
||||
typedef struct _Filter_State_
|
||||
{
|
||||
LVM_INT32 * pDelays; /* pointer to the delayed samples (data of 32 bits) */
|
||||
LVM_INT32 coefs[3]; /* pointer to the filter coefficients */
|
||||
}Filter_State;
|
||||
|
||||
typedef Filter_State * PFilter_State ;
|
||||
|
||||
#endif /*_BP_1I_D32F32CLL_TRC_WRA_02_PRIVATE_H_*/
|
94
media/libeffects/lvm/lib/Common/src/BQ_1I_D16F16C15_TRC_WRA_01.c
Executable file
94
media/libeffects/lvm/lib/Common/src/BQ_1I_D16F16C15_TRC_WRA_01.c
Executable file
@ -0,0 +1,94 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* Project:: */
|
||||
/* $Author: beq07716 $*/
|
||||
/* $Revision: 1000 $*/
|
||||
/* $Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $*/
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
#include "BIQUAD.h"
|
||||
#include "BQ_1I_D16F16Css_TRC_WRA_01_Private.h"
|
||||
#include "LVM_Macros.h"
|
||||
|
||||
/**************************************************************************
|
||||
ASSUMPTIONS:
|
||||
COEFS-
|
||||
pBiquadState->coefs[0] is A2, pBiquadState->coefs[1] is A1
|
||||
pBiquadState->coefs[2] is A0, pBiquadState->coefs[3] is -B2
|
||||
pBiquadState->coefs[4] is -B1, these are in Q15 format
|
||||
|
||||
DELAYS-
|
||||
pBiquadState->pDelays[0] is x(n-1)L in Q0 format
|
||||
pBiquadState->pDelays[1] is x(n-2)L in Q0 format
|
||||
pBiquadState->pDelays[2] is y(n-1)L in Q0 format
|
||||
pBiquadState->pDelays[3] is y(n-2)L in Q0 format
|
||||
***************************************************************************/
|
||||
|
||||
void BQ_1I_D16F16C15_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
|
||||
LVM_INT16 *pDataIn,
|
||||
LVM_INT16 *pDataOut,
|
||||
LVM_INT16 NrSamples)
|
||||
{
|
||||
LVM_INT32 ynL;
|
||||
LVM_INT16 ii;
|
||||
PFilter_State pBiquadState = (PFilter_State) pInstance;
|
||||
|
||||
for (ii = NrSamples; ii != 0; ii--)
|
||||
{
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
PROCESSING OF THE LEFT CHANNEL
|
||||
***************************************************************************/
|
||||
// ynL=A2 (Q15) * x(n-2)L (Q0) in Q15
|
||||
ynL=(LVM_INT32)pBiquadState->coefs[0]* pBiquadState->pDelays[1];
|
||||
|
||||
// ynL+=A1 (Q15) * x(n-1)L (Q0) in Q15
|
||||
ynL+=(LVM_INT32)pBiquadState->coefs[1]* pBiquadState->pDelays[0];
|
||||
|
||||
// ynL+=A0 (Q15) * x(n)L (Q0) in Q15
|
||||
ynL+=(LVM_INT32)pBiquadState->coefs[2]* (*pDataIn);
|
||||
|
||||
// ynL+= (-B2 (Q15) * y(n-2)L (Q0) ) in Q15
|
||||
ynL+=(LVM_INT32)pBiquadState->coefs[3]*pBiquadState->pDelays[3];
|
||||
|
||||
// ynL+= (-B1 (Q15) * y(n-1)L (Q0) ) in Q15
|
||||
ynL+=(LVM_INT32)pBiquadState->coefs[4]*pBiquadState->pDelays[2];
|
||||
|
||||
ynL=ynL>>15; // ynL in Q0 format
|
||||
/**************************************************************************
|
||||
UPDATING THE DELAYS
|
||||
***************************************************************************/
|
||||
pBiquadState->pDelays[3]=pBiquadState->pDelays[2]; // y(n-2)L=y(n-1)L
|
||||
pBiquadState->pDelays[1]=pBiquadState->pDelays[0]; // x(n-2)L=x(n-1)L
|
||||
pBiquadState->pDelays[2]=ynL; // Update y(n-1)L in Q0
|
||||
pBiquadState->pDelays[0]=(*pDataIn++); // Update x(n-1)L in Q0
|
||||
|
||||
/**************************************************************************
|
||||
WRITING THE OUTPUT
|
||||
***************************************************************************/
|
||||
*pDataOut++=(LVM_INT16)ynL; // Write Left output in Q0
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
66
media/libeffects/lvm/lib/Common/src/BQ_1I_D16F16Css_TRC_WRA_01_Init.c
Executable file
66
media/libeffects/lvm/lib/Common/src/BQ_1I_D16F16Css_TRC_WRA_01_Init.c
Executable file
@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* */
|
||||
/* $Author: beq07716 $*/
|
||||
/* $Revision: 1000 $*/
|
||||
/* $Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $*/
|
||||
/* */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
#include "BIQUAD.h"
|
||||
#include "BQ_1I_D16F16Css_TRC_WRA_01_Private.h"
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* FUNCTION: */
|
||||
/* BQ_1I_D16F16Css_TRC_WRA_01_Init */
|
||||
/* */
|
||||
/* DESCRIPTION: */
|
||||
/* These functions initializes a BIQUAD filter defined as a cascade of */
|
||||
/* biquadratic Filter Sections. */
|
||||
/* */
|
||||
/* PARAMETERS: */
|
||||
/* pInstance - output, returns the pointer to the State Variable */
|
||||
/* This state pointer must be passed to any subsequent */
|
||||
/* call to "Biquad" functions. */
|
||||
/* pTaps - input, pointer to the taps memory */
|
||||
/* pCoef - input, pointer to the coefficient structure */
|
||||
/* N - M coefficient factor of QM.N */
|
||||
/* RETURNS: */
|
||||
/* void return code */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
void BQ_1I_D16F16Css_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
|
||||
Biquad_1I_Order2_Taps_t *pTaps,
|
||||
BQ_C16_Coefs_t *pCoef)
|
||||
{
|
||||
LVM_INT16 temp;
|
||||
PFilter_State pBiquadState = (PFilter_State) pInstance;
|
||||
pBiquadState->pDelays =(LVM_INT32 *) pTaps ;
|
||||
|
||||
temp=pCoef->A2;
|
||||
pBiquadState->coefs[0]=temp;
|
||||
temp=pCoef->A1;
|
||||
pBiquadState->coefs[1]=temp;
|
||||
temp=pCoef->A0;
|
||||
pBiquadState->coefs[2]=temp;
|
||||
temp=pCoef->B2;
|
||||
pBiquadState->coefs[3]=temp;
|
||||
temp=pCoef->B1;
|
||||
pBiquadState->coefs[4]=temp;
|
||||
}
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* End Of File: BQ_1I_D16F16Css_TRC_WRA_01_Init.c */
|
||||
|
38
media/libeffects/lvm/lib/Common/src/BQ_1I_D16F16Css_TRC_WRA_01_Private.h
Executable file
38
media/libeffects/lvm/lib/Common/src/BQ_1I_D16F16Css_TRC_WRA_01_Private.h
Executable file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef _BQ_1I_D16F16CSS_TRC_WRA_01_PRIVATE_H_
|
||||
#define _BQ_1I_D16F16CSS_TRC_WRA_01_PRIVATE_H_
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* Project:: */
|
||||
/* $Author: beq07716 $*/
|
||||
/* $Revision: 1000 $*/
|
||||
/* $Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $*/
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
/* The internal state variables are implemented in a (for the user) hidden structure */
|
||||
/* In this (private) file, the internal structure is declared fro private use. */
|
||||
typedef struct _Filter_State_
|
||||
{
|
||||
LVM_INT32 * pDelays; /* pointer to the delayed samples (data of 32 bits) */
|
||||
LVM_INT16 coefs[5]; /* pointer to the filter coefficients */
|
||||
}Filter_State;
|
||||
|
||||
typedef Filter_State * PFilter_State ;
|
||||
|
||||
#endif /*_BQ_1I_D16F16CSS_TRC_WRA_01_PRIVATE_H_ */
|
93
media/libeffects/lvm/lib/Common/src/BQ_1I_D16F32C14_TRC_WRA_01.c
Executable file
93
media/libeffects/lvm/lib/Common/src/BQ_1I_D16F32C14_TRC_WRA_01.c
Executable file
@ -0,0 +1,93 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* Project:: */
|
||||
/* $Author: beq07716 $*/
|
||||
/* $Revision: 1000 $*/
|
||||
/* $Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $*/
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
#include "BIQUAD.h"
|
||||
#include "BQ_1I_D16F32Css_TRC_WRA_01_Private.h"
|
||||
#include "LVM_Macros.h"
|
||||
|
||||
/**************************************************************************
|
||||
ASSUMPTIONS:
|
||||
COEFS-
|
||||
pBiquadState->coefs[0] is A2, pBiquadState->coefs[1] is A1
|
||||
pBiquadState->coefs[2] is A0, pBiquadState->coefs[3] is -B2
|
||||
pBiquadState->coefs[4] is -B1, these are in Q14 format
|
||||
|
||||
DELAYS-
|
||||
pBiquadState->pDelays[0] is x(n-1)L in Q0 format
|
||||
pBiquadState->pDelays[1] is x(n-2)L in Q0 format
|
||||
pBiquadState->pDelays[2] is y(n-1)L in Q16 format
|
||||
pBiquadState->pDelays[3] is y(n-2)L in Q16 format
|
||||
***************************************************************************/
|
||||
|
||||
void BQ_1I_D16F32C14_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
|
||||
LVM_INT16 *pDataIn,
|
||||
LVM_INT16 *pDataOut,
|
||||
LVM_INT16 NrSamples)
|
||||
{
|
||||
LVM_INT32 ynL,templ;
|
||||
LVM_INT16 ii;
|
||||
PFilter_State pBiquadState = (PFilter_State) pInstance;
|
||||
|
||||
for (ii = NrSamples; ii != 0; ii--)
|
||||
{
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
PROCESSING OF THE LEFT CHANNEL
|
||||
***************************************************************************/
|
||||
// ynL=A2 (Q14) * x(n-2)L (Q0) in Q14
|
||||
ynL=(LVM_INT32)pBiquadState->coefs[0]* pBiquadState->pDelays[1];
|
||||
|
||||
// ynL+=A1 (Q14) * x(n-1)L (Q0) in Q14
|
||||
ynL+=(LVM_INT32)pBiquadState->coefs[1]* pBiquadState->pDelays[0];
|
||||
|
||||
// ynL+=A0 (Q14) * x(n)L (Q0) in Q14
|
||||
ynL+=(LVM_INT32)pBiquadState->coefs[2]* (*pDataIn);
|
||||
|
||||
// ynL+= ( (-B2 (Q14) * y(n-2)L (Q16) )>>16) in Q14
|
||||
MUL32x16INTO32(pBiquadState->pDelays[3],pBiquadState->coefs[3],templ,16)
|
||||
ynL+=templ;
|
||||
|
||||
// ynL+= ( (-B1 (Q14) * y(n-1)L (Q16) )>>16) in Q14
|
||||
MUL32x16INTO32(pBiquadState->pDelays[2],pBiquadState->coefs[4],templ,16)
|
||||
ynL+=templ;
|
||||
|
||||
/**************************************************************************
|
||||
UPDATING THE DELAYS
|
||||
***************************************************************************/
|
||||
pBiquadState->pDelays[3]=pBiquadState->pDelays[2]; // y(n-2)L=y(n-1)L
|
||||
pBiquadState->pDelays[1]=pBiquadState->pDelays[0]; // x(n-2)L=x(n-1)L
|
||||
pBiquadState->pDelays[2]=ynL<<2; // Update y(n-1)L in Q16
|
||||
pBiquadState->pDelays[0]=(*pDataIn++); // Update x(n-1)L in Q0
|
||||
|
||||
/**************************************************************************
|
||||
WRITING THE OUTPUT
|
||||
***************************************************************************/
|
||||
*pDataOut++=(LVM_INT16)(ynL>>14); // Write Left output in Q0
|
||||
|
||||
}
|
||||
}
|
||||
|
38
media/libeffects/lvm/lib/Common/src/BQ_1I_D16F32Css_TRC_WRA_01_Private.h
Executable file
38
media/libeffects/lvm/lib/Common/src/BQ_1I_D16F32Css_TRC_WRA_01_Private.h
Executable file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef _BQ_1I_D16F32CSS_TRC_WRA_01_PRIVATE_H_
|
||||
#define _BQ_1I_D16F32CSS_TRC_WRA_01_PRIVATE_H_
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* Project:: */
|
||||
/* $Author: beq07716 $*/
|
||||
/* $Revision: 1000 $*/
|
||||
/* $Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $*/
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
/* The internal state variables are implemented in a (for the user) hidden structure */
|
||||
/* In this (private) file, the internal structure is declared fro private use. */
|
||||
typedef struct _Filter_State_
|
||||
{
|
||||
LVM_INT32 * pDelays; /* pointer to the delayed samples (data of 32 bits) */
|
||||
LVM_INT16 coefs[5]; /* pointer to the filter coefficients */
|
||||
}Filter_State;
|
||||
|
||||
typedef Filter_State * PFilter_State ;
|
||||
|
||||
#endif /*_BQ_1I_D16F32CSS_TRC_WRA_01_PRIVATE_H_*/
|
67
media/libeffects/lvm/lib/Common/src/BQ_1I_D16F32Css_TRC_WRA_01_init.c
Executable file
67
media/libeffects/lvm/lib/Common/src/BQ_1I_D16F32Css_TRC_WRA_01_init.c
Executable file
@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* */
|
||||
/* $Author: beq07716 $*/
|
||||
/* $Revision: 1000 $*/
|
||||
/* $Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $*/
|
||||
/* */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
#include "BIQUAD.h"
|
||||
#include "BQ_1I_D16F32Css_TRC_WRA_01_Private.h"
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* FUNCTION: */
|
||||
/* BQ_1I_D16F32Css_TRC_WRA_01_Init */
|
||||
/* */
|
||||
/* DESCRIPTION: */
|
||||
/* These functions initializes a BIQUAD filter defined as a cascade of */
|
||||
/* biquadratic Filter Sections. */
|
||||
/* */
|
||||
/* PARAMETERS: */
|
||||
/* pInstance - output, returns the pointer to the State Variable */
|
||||
/* This state pointer must be passed to any subsequent */
|
||||
/* call to "Biquad" functions. */
|
||||
/* pTaps - input, pointer to the taps memory */
|
||||
/* pCoef - input, pointer to the coefficient structure */
|
||||
/* N - M coefficient factor of QM.N */
|
||||
/* RETURNS: */
|
||||
/* void return code */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
void BQ_1I_D16F32Css_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
|
||||
Biquad_1I_Order2_Taps_t *pTaps,
|
||||
BQ_C16_Coefs_t *pCoef)
|
||||
{
|
||||
LVM_INT16 temp;
|
||||
PFilter_State pBiquadState = (PFilter_State) pInstance;
|
||||
pBiquadState->pDelays =(LVM_INT32 *) pTaps ;
|
||||
|
||||
temp=pCoef->A2;
|
||||
pBiquadState->coefs[0]=temp;
|
||||
temp=pCoef->A1;
|
||||
pBiquadState->coefs[1]=temp;
|
||||
temp=pCoef->A0;
|
||||
pBiquadState->coefs[2]=temp;
|
||||
temp=pCoef->B2;
|
||||
pBiquadState->coefs[3]=temp;
|
||||
temp=pCoef->B1;
|
||||
pBiquadState->coefs[4]=temp;
|
||||
}
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* End Of File: BQ_1I_D16F32Css_TRC_WRA_01_Init */
|
||||
|
123
media/libeffects/lvm/lib/Common/src/BQ_2I_D16F16C14_TRC_WRA_01.c
Executable file
123
media/libeffects/lvm/lib/Common/src/BQ_2I_D16F16C14_TRC_WRA_01.c
Executable file
@ -0,0 +1,123 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* Project:: */
|
||||
/* $Author: beq07716 $*/
|
||||
/* $Revision: 1000 $*/
|
||||
/* $Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $*/
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
#include "BIQUAD.h"
|
||||
#include "BQ_2I_D16F16Css_TRC_WRA_01_Private.h"
|
||||
#include "LVM_Macros.h"
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
ASSUMPTIONS:
|
||||
COEFS-
|
||||
pBiquadState->coefs[0] is A2, pBiquadState->coefs[1] is A1
|
||||
pBiquadState->coefs[2] is A0, pBiquadState->coefs[3] is -B2
|
||||
pBiquadState->coefs[4] is -B1, these are in Q14 format
|
||||
|
||||
DELAYS-
|
||||
pBiquadState->pDelays[0] is x(n-1)L in Q0 format
|
||||
pBiquadState->pDelays[1] is x(n-1)R in Q0 format
|
||||
pBiquadState->pDelays[2] is x(n-2)L in Q0 format
|
||||
pBiquadState->pDelays[3] is x(n-2)R in Q0 format
|
||||
pBiquadState->pDelays[4] is y(n-1)L in Q0 format
|
||||
pBiquadState->pDelays[5] is y(n-1)R in Q0 format
|
||||
pBiquadState->pDelays[6] is y(n-2)L in Q0 format
|
||||
pBiquadState->pDelays[7] is y(n-2)R in Q0 format
|
||||
***************************************************************************/
|
||||
|
||||
void BQ_2I_D16F16C14_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
|
||||
LVM_INT16 *pDataIn,
|
||||
LVM_INT16 *pDataOut,
|
||||
LVM_INT16 NrSamples)
|
||||
{
|
||||
LVM_INT32 ynL,ynR;
|
||||
LVM_INT16 ii;
|
||||
PFilter_State pBiquadState = (PFilter_State) pInstance;
|
||||
|
||||
for (ii = NrSamples; ii != 0; ii--)
|
||||
{
|
||||
|
||||
/**************************************************************************
|
||||
PROCESSING OF THE LEFT CHANNEL
|
||||
***************************************************************************/
|
||||
// ynL=A2 (Q14) * x(n-2)L (Q0) in Q14
|
||||
ynL=(LVM_INT32)pBiquadState->coefs[0]* pBiquadState->pDelays[2];
|
||||
|
||||
// ynL+=A1 (Q14) * x(n-1)L (Q0) in Q14
|
||||
ynL+=(LVM_INT32)pBiquadState->coefs[1]* pBiquadState->pDelays[0];
|
||||
|
||||
// ynL+=A0 (Q14) * x(n)L (Q0) in Q14
|
||||
ynL+=(LVM_INT32)pBiquadState->coefs[2]* (*pDataIn);
|
||||
|
||||
// ynL+= ( -B2 (Q14) * y(n-2)L (Q0) ) in Q14
|
||||
ynL+=(LVM_INT32)pBiquadState->coefs[3]*pBiquadState->pDelays[6];
|
||||
|
||||
// ynL+=( -B1 (Q14) * y(n-1)L (Q0) ) in Q14
|
||||
ynL+=(LVM_INT32)pBiquadState->coefs[4]*pBiquadState->pDelays[4];
|
||||
|
||||
ynL=ynL>>14; // ynL in Q0 format
|
||||
|
||||
/**************************************************************************
|
||||
PROCESSING OF THE RIGHT CHANNEL
|
||||
***************************************************************************/
|
||||
// ynR=A2 (Q14) * x(n-2)R (Q0) in Q14
|
||||
ynR=(LVM_INT32)pBiquadState->coefs[0]*pBiquadState->pDelays[3];
|
||||
|
||||
// ynR+=A1 (Q14) * x(n-1)R (Q0) in Q14
|
||||
ynR+=(LVM_INT32)pBiquadState->coefs[1]*pBiquadState->pDelays[1];
|
||||
|
||||
// ynR+=A0 (Q14) * x(n)R (Q0) in Q14
|
||||
ynR+=(LVM_INT32)pBiquadState->coefs[2]*(*(pDataIn+1));
|
||||
|
||||
// ynR+= ( -B2 (Q14) * y(n-2)R (Q0) ) in Q14
|
||||
ynR+=(LVM_INT32)pBiquadState->coefs[3]*pBiquadState->pDelays[7];
|
||||
|
||||
// ynR+=( -B1 (Q14) * y(n-1)R (Q0) ) in Q14
|
||||
ynR+=(LVM_INT32)pBiquadState->coefs[4]*pBiquadState->pDelays[5];
|
||||
|
||||
ynR=ynR>>14; // ynL in Q0 format
|
||||
/**************************************************************************
|
||||
UPDATING THE DELAYS
|
||||
***************************************************************************/
|
||||
pBiquadState->pDelays[7]=pBiquadState->pDelays[5]; // y(n-2)R=y(n-1)R
|
||||
pBiquadState->pDelays[6]=pBiquadState->pDelays[4]; // y(n-2)L=y(n-1)L
|
||||
pBiquadState->pDelays[3]=pBiquadState->pDelays[1]; // x(n-2)R=x(n-1)R
|
||||
pBiquadState->pDelays[2]=pBiquadState->pDelays[0]; // x(n-2)L=x(n-1)L
|
||||
pBiquadState->pDelays[5]=ynR; // Update y(n-1)R in Q0
|
||||
pBiquadState->pDelays[4]=ynL; // Update y(n-1)L in Q0
|
||||
pBiquadState->pDelays[0]=(*pDataIn++); // Update x(n-1)L in Q0
|
||||
pBiquadState->pDelays[1]=(*pDataIn++); // Update x(n-1)R in Q0
|
||||
|
||||
/**************************************************************************
|
||||
WRITING THE OUTPUT
|
||||
***************************************************************************/
|
||||
*pDataOut++=(LVM_INT16)ynL; // Write Left output in Q0
|
||||
*pDataOut++=(LVM_INT16)ynR; // Write Right ouput in Q0
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
123
media/libeffects/lvm/lib/Common/src/BQ_2I_D16F16C15_TRC_WRA_01.c
Executable file
123
media/libeffects/lvm/lib/Common/src/BQ_2I_D16F16C15_TRC_WRA_01.c
Executable file
@ -0,0 +1,123 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* Project:: */
|
||||
/* $Author: beq07716 $*/
|
||||
/* $Revision: 1000 $*/
|
||||
/* $Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $*/
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
#include "BIQUAD.h"
|
||||
#include "BQ_2I_D16F16Css_TRC_WRA_01_Private.h"
|
||||
#include "LVM_Macros.h"
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
ASSUMPTIONS:
|
||||
COEFS-
|
||||
pBiquadState->coefs[0] is A2, pBiquadState->coefs[1] is A1
|
||||
pBiquadState->coefs[2] is A0, pBiquadState->coefs[3] is -B2
|
||||
pBiquadState->coefs[4] is -B1, these are in Q15 format
|
||||
|
||||
DELAYS-
|
||||
pBiquadState->pDelays[0] is x(n-1)L in Q0 format
|
||||
pBiquadState->pDelays[1] is x(n-1)R in Q0 format
|
||||
pBiquadState->pDelays[2] is x(n-2)L in Q0 format
|
||||
pBiquadState->pDelays[3] is x(n-2)R in Q0 format
|
||||
pBiquadState->pDelays[4] is y(n-1)L in Q0 format
|
||||
pBiquadState->pDelays[5] is y(n-1)R in Q0 format
|
||||
pBiquadState->pDelays[6] is y(n-2)L in Q0 format
|
||||
pBiquadState->pDelays[7] is y(n-2)R in Q0 format
|
||||
***************************************************************************/
|
||||
|
||||
void BQ_2I_D16F16C15_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
|
||||
LVM_INT16 *pDataIn,
|
||||
LVM_INT16 *pDataOut,
|
||||
LVM_INT16 NrSamples)
|
||||
{
|
||||
LVM_INT32 ynL,ynR;
|
||||
LVM_INT16 ii;
|
||||
PFilter_State pBiquadState = (PFilter_State) pInstance;
|
||||
|
||||
for (ii = NrSamples; ii != 0; ii--)
|
||||
{
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
PROCESSING OF THE LEFT CHANNEL
|
||||
***************************************************************************/
|
||||
// ynL=A2 (Q15) * x(n-2)L (Q0) in Q15
|
||||
ynL=(LVM_INT32)pBiquadState->coefs[0]* pBiquadState->pDelays[2];
|
||||
|
||||
// ynL+=A1 (Q15) * x(n-1)L (Q0) in Q15
|
||||
ynL+=(LVM_INT32)pBiquadState->coefs[1]* pBiquadState->pDelays[0];
|
||||
|
||||
// ynL+=A0 (Q15) * x(n)L (Q0) in Q15
|
||||
ynL+=(LVM_INT32)pBiquadState->coefs[2]* (*pDataIn);
|
||||
|
||||
// ynL+= ( -B2 (Q15) * y(n-2)L (Q0) ) in Q15
|
||||
ynL+=(LVM_INT32)pBiquadState->coefs[3]*pBiquadState->pDelays[6];
|
||||
|
||||
// ynL+=( -B1 (Q15) * y(n-1)L (Q0) ) in Q15
|
||||
ynL+=(LVM_INT32)pBiquadState->coefs[4]*pBiquadState->pDelays[4];
|
||||
|
||||
ynL=ynL>>15; // ynL in Q0 format
|
||||
|
||||
/**************************************************************************
|
||||
PROCESSING OF THE RIGHT CHANNEL
|
||||
***************************************************************************/
|
||||
// ynR=A2 (Q15) * x(n-2)R (Q0) in Q15
|
||||
ynR=(LVM_INT32)pBiquadState->coefs[0]*pBiquadState->pDelays[3];
|
||||
|
||||
// ynR+=A1 (Q15) * x(n-1)R (Q0) in Q15
|
||||
ynR+=(LVM_INT32)pBiquadState->coefs[1]*pBiquadState->pDelays[1];
|
||||
|
||||
// ynR+=A0 (Q15) * x(n)R (Q0) in Q15
|
||||
ynR+=(LVM_INT32)pBiquadState->coefs[2]*(*(pDataIn+1));
|
||||
|
||||
// ynR+= ( -B2 (Q15) * y(n-2)R (Q0) ) in Q15
|
||||
ynR+=(LVM_INT32)pBiquadState->coefs[3]*pBiquadState->pDelays[7];
|
||||
|
||||
// ynR+=( -B1 (Q15) * y(n-1)R (Q0) ) in Q15
|
||||
ynR+=(LVM_INT32)pBiquadState->coefs[4]*pBiquadState->pDelays[5];
|
||||
|
||||
ynR=ynR>>15; // ynL in Q0 format
|
||||
/**************************************************************************
|
||||
UPDATING THE DELAYS
|
||||
***************************************************************************/
|
||||
pBiquadState->pDelays[7]=pBiquadState->pDelays[5]; // y(n-2)R=y(n-1)R
|
||||
pBiquadState->pDelays[6]=pBiquadState->pDelays[4]; // y(n-2)L=y(n-1)L
|
||||
pBiquadState->pDelays[3]=pBiquadState->pDelays[1]; // x(n-2)R=x(n-1)R
|
||||
pBiquadState->pDelays[2]=pBiquadState->pDelays[0]; // x(n-2)L=x(n-1)L
|
||||
pBiquadState->pDelays[5]=ynR; // Update y(n-1)R in Q0
|
||||
pBiquadState->pDelays[4]=ynL; // Update y(n-1)L in Q0
|
||||
pBiquadState->pDelays[0]=(*pDataIn++); // Update x(n-1)L in Q0
|
||||
pBiquadState->pDelays[1]=(*pDataIn++); // Update x(n-1)R in Q0
|
||||
|
||||
/**************************************************************************
|
||||
WRITING THE OUTPUT
|
||||
***************************************************************************/
|
||||
*pDataOut++=(LVM_INT16)ynL; // Write Left output in Q0
|
||||
*pDataOut++=(LVM_INT16)ynR; // Write Right ouput in Q0
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
67
media/libeffects/lvm/lib/Common/src/BQ_2I_D16F16Css_TRC_WRA_01_Init.c
Executable file
67
media/libeffects/lvm/lib/Common/src/BQ_2I_D16F16Css_TRC_WRA_01_Init.c
Executable file
@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* */
|
||||
/* $Author: beq07716 $*/
|
||||
/* $Revision: 1000 $*/
|
||||
/* $Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $*/
|
||||
/* */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
#include "BIQUAD.h"
|
||||
#include "BQ_2I_D16F16Css_TRC_WRA_01_Private.h"
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* FUNCTION: */
|
||||
/* BQ_2I_D16F16Css_TRC_WRA_01_Init */
|
||||
/* */
|
||||
/* DESCRIPTION: */
|
||||
/* These functions initializes a BIQUAD filter defined as a cascade of */
|
||||
/* biquadratic Filter Sections. */
|
||||
/* */
|
||||
/* PARAMETERS: */
|
||||
/* pInstance - output, returns the pointer to the State Variable */
|
||||
/* This state pointer must be passed to any subsequent */
|
||||
/* call to "Biquad" functions. */
|
||||
/* pTaps - input, pointer to the taps memory */
|
||||
/* pCoef - input, pointer to the coefficient structure */
|
||||
/* N - M coefficient factor of QM.N */
|
||||
/* RETURNS: */
|
||||
/* void return code */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
void BQ_2I_D16F16Css_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
|
||||
Biquad_2I_Order2_Taps_t *pTaps,
|
||||
BQ_C16_Coefs_t *pCoef)
|
||||
{
|
||||
LVM_INT16 temp;
|
||||
PFilter_State pBiquadState = (PFilter_State) pInstance;
|
||||
pBiquadState->pDelays =(LVM_INT32 *) pTaps ;
|
||||
|
||||
temp=pCoef->A2;
|
||||
pBiquadState->coefs[0]=temp;
|
||||
temp=pCoef->A1;
|
||||
pBiquadState->coefs[1]=temp;
|
||||
temp=pCoef->A0;
|
||||
pBiquadState->coefs[2]=temp;
|
||||
temp=pCoef->B2;
|
||||
pBiquadState->coefs[3]=temp;
|
||||
temp=pCoef->B1;
|
||||
pBiquadState->coefs[4]=temp;
|
||||
}
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* End Of File: BQ_2I_D16F16Css_TRC_WRA_01_Init.c */
|
||||
|
40
media/libeffects/lvm/lib/Common/src/BQ_2I_D16F16Css_TRC_WRA_01_Private.h
Executable file
40
media/libeffects/lvm/lib/Common/src/BQ_2I_D16F16Css_TRC_WRA_01_Private.h
Executable file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef _BQ_2I_D16F16CSS_TRC_WRA_01_PRIVATE_H_
|
||||
#define _BQ_2I_D16F16CSS_TRC_WRA_01_PRIVATE_H_
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* Project:: */
|
||||
/* $Author: beq07716 $*/
|
||||
/* $Revision: 1000 $*/
|
||||
/* $Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $*/
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
/* The internal state variables are implemented in a (for the user) hidden structure */
|
||||
/* In this (private) file, the internal structure is declared fro private use. */
|
||||
typedef struct _Filter_State_
|
||||
{
|
||||
LVM_INT32 * pDelays; /* pointer to the delayed samples (data of 32 bits) */
|
||||
LVM_INT16 coefs[5]; /* pointer to the filter coefficients */
|
||||
}Filter_State;
|
||||
|
||||
typedef Filter_State * PFilter_State ;
|
||||
|
||||
#endif /* _BQ_2I_D16F16CSS_TRC_WRA_01_PRIVATE_H_ */
|
127
media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32C13_TRC_WRA_01.c
Executable file
127
media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32C13_TRC_WRA_01.c
Executable file
@ -0,0 +1,127 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* Project:: */
|
||||
/* $Author: beq07716 $*/
|
||||
/* $Revision: 1000 $*/
|
||||
/* $Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $*/
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
#include "BIQUAD.h"
|
||||
#include "BQ_2I_D16F32Css_TRC_WRA_01_Private.h"
|
||||
#include "LVM_Macros.h"
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
ASSUMPTIONS:
|
||||
COEFS-
|
||||
pBiquadState->coefs[0] is A2, pBiquadState->coefs[1] is A1
|
||||
pBiquadState->coefs[2] is A0, pBiquadState->coefs[3] is -B2
|
||||
pBiquadState->coefs[4] is -B1, these are in Q13 format
|
||||
|
||||
DELAYS-
|
||||
pBiquadState->pDelays[0] is x(n-1)L in Q0 format
|
||||
pBiquadState->pDelays[1] is x(n-1)R in Q0 format
|
||||
pBiquadState->pDelays[2] is x(n-2)L in Q0 format
|
||||
pBiquadState->pDelays[3] is x(n-2)R in Q0 format
|
||||
pBiquadState->pDelays[4] is y(n-1)L in Q16 format
|
||||
pBiquadState->pDelays[5] is y(n-1)R in Q16 format
|
||||
pBiquadState->pDelays[6] is y(n-2)L in Q16 format
|
||||
pBiquadState->pDelays[7] is y(n-2)R in Q16 format
|
||||
***************************************************************************/
|
||||
|
||||
void BQ_2I_D16F32C13_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
|
||||
LVM_INT16 *pDataIn,
|
||||
LVM_INT16 *pDataOut,
|
||||
LVM_INT16 NrSamples)
|
||||
{
|
||||
LVM_INT32 ynL,ynR,templ;
|
||||
LVM_INT16 ii;
|
||||
PFilter_State pBiquadState = (PFilter_State) pInstance;
|
||||
|
||||
for (ii = NrSamples; ii != 0; ii--)
|
||||
{
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
PROCESSING OF THE LEFT CHANNEL
|
||||
***************************************************************************/
|
||||
/* ynL=A2 (Q13) * x(n-2)L (Q0) in Q13*/
|
||||
ynL=(LVM_INT32)pBiquadState->coefs[0]* pBiquadState->pDelays[2];
|
||||
|
||||
/* ynL+=A1 (Q13) * x(n-1)L (Q0) in Q13*/
|
||||
ynL+=(LVM_INT32)pBiquadState->coefs[1]* pBiquadState->pDelays[0];
|
||||
|
||||
/* ynL+=A0 (Q13) * x(n)L (Q0) in Q13*/
|
||||
ynL+=(LVM_INT32)pBiquadState->coefs[2]* (*pDataIn);
|
||||
|
||||
/* ynL+= ( (-B2 (Q13) * y(n-2)L (Q16) )>>16) in Q13 */
|
||||
MUL32x16INTO32(pBiquadState->pDelays[6],pBiquadState->coefs[3],templ,16)
|
||||
ynL+=templ;
|
||||
|
||||
/* ynL+=( (-B1 (Q13) * y(n-1)L (Q16) )>>16) in Q13 */
|
||||
MUL32x16INTO32(pBiquadState->pDelays[4],pBiquadState->coefs[4],templ,16)
|
||||
ynL+=templ;
|
||||
|
||||
/**************************************************************************
|
||||
PROCESSING OF THE RIGHT CHANNEL
|
||||
***************************************************************************/
|
||||
/* ynR=A2 (Q13) * x(n-2)R (Q0) in Q13*/
|
||||
ynR=(LVM_INT32)pBiquadState->coefs[0]*pBiquadState->pDelays[3];
|
||||
|
||||
/* ynR+=A1 (Q13) * x(n-1)R (Q0) in Q13*/
|
||||
ynR+=(LVM_INT32)pBiquadState->coefs[1]*pBiquadState->pDelays[1];
|
||||
|
||||
/* ynR+=A0 (Q13) * x(n)R (Q0) in Q13*/
|
||||
ynR+=(LVM_INT32)pBiquadState->coefs[2]*(*(pDataIn+1));
|
||||
|
||||
/* ynR+= ( (-B2 (Q13) * y(n-2)R (Q16) )>>16) in Q13*/
|
||||
MUL32x16INTO32(pBiquadState->pDelays[7],pBiquadState->coefs[3],templ,16)
|
||||
ynR+=templ;
|
||||
|
||||
/* ynR+=( (-B1 (Q13) * y(n-1)R (Q16) )>>16) in Q13 */
|
||||
MUL32x16INTO32(pBiquadState->pDelays[5],pBiquadState->coefs[4],templ,16)
|
||||
ynR+=templ;
|
||||
|
||||
/**************************************************************************
|
||||
UPDATING THE DELAYS
|
||||
***************************************************************************/
|
||||
pBiquadState->pDelays[7]=pBiquadState->pDelays[5]; /* y(n-2)R=y(n-1)R*/
|
||||
pBiquadState->pDelays[6]=pBiquadState->pDelays[4]; /* y(n-2)L=y(n-1)L*/
|
||||
pBiquadState->pDelays[3]=pBiquadState->pDelays[1]; /* x(n-2)R=x(n-1)R*/
|
||||
pBiquadState->pDelays[2]=pBiquadState->pDelays[0]; /* x(n-2)L=x(n-1)L*/
|
||||
pBiquadState->pDelays[5]=ynR<<3; /* Update y(n-1)R in Q16*/
|
||||
pBiquadState->pDelays[4]=ynL<<3; /* Update y(n-1)L in Q16*/
|
||||
pBiquadState->pDelays[0]=(*pDataIn); /* Update x(n-1)L in Q0*/
|
||||
pDataIn++;
|
||||
pBiquadState->pDelays[1]=(*pDataIn); /* Update x(n-1)R in Q0*/
|
||||
pDataIn++;
|
||||
|
||||
/**************************************************************************
|
||||
WRITING THE OUTPUT
|
||||
***************************************************************************/
|
||||
*pDataOut=(LVM_INT16)(ynL>>13); /* Write Left output in Q0*/
|
||||
pDataOut++;
|
||||
*pDataOut=(LVM_INT16)(ynR>>13); /* Write Right ouput in Q0*/
|
||||
pDataOut++;
|
||||
}
|
||||
|
||||
}
|
||||
|
126
media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32C14_TRC_WRA_01.c
Executable file
126
media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32C14_TRC_WRA_01.c
Executable file
@ -0,0 +1,126 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* Project:: */
|
||||
/* $Author: beq07716 $*/
|
||||
/* $Revision: 1000 $*/
|
||||
/* $Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $*/
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
#include "BIQUAD.h"
|
||||
#include "BQ_2I_D16F32Css_TRC_WRA_01_Private.h"
|
||||
#include "LVM_Macros.h"
|
||||
|
||||
/**************************************************************************
|
||||
ASSUMPTIONS:
|
||||
COEFS-
|
||||
pBiquadState->coefs[0] is A2, pBiquadState->coefs[1] is A1
|
||||
pBiquadState->coefs[2] is A0, pBiquadState->coefs[3] is -B2
|
||||
pBiquadState->coefs[4] is -B1, these are in Q14 format
|
||||
|
||||
DELAYS-
|
||||
pBiquadState->pDelays[0] is x(n-1)L in Q0 format
|
||||
pBiquadState->pDelays[1] is x(n-1)R in Q0 format
|
||||
pBiquadState->pDelays[2] is x(n-2)L in Q0 format
|
||||
pBiquadState->pDelays[3] is x(n-2)R in Q0 format
|
||||
pBiquadState->pDelays[4] is y(n-1)L in Q16 format
|
||||
pBiquadState->pDelays[5] is y(n-1)R in Q16 format
|
||||
pBiquadState->pDelays[6] is y(n-2)L in Q16 format
|
||||
pBiquadState->pDelays[7] is y(n-2)R in Q16 format
|
||||
***************************************************************************/
|
||||
|
||||
void BQ_2I_D16F32C14_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
|
||||
LVM_INT16 *pDataIn,
|
||||
LVM_INT16 *pDataOut,
|
||||
LVM_INT16 NrSamples)
|
||||
{
|
||||
LVM_INT32 ynL,ynR,templ;
|
||||
LVM_INT16 ii;
|
||||
PFilter_State pBiquadState = (PFilter_State) pInstance;
|
||||
|
||||
for (ii = NrSamples; ii != 0; ii--)
|
||||
{
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
PROCESSING OF THE LEFT CHANNEL
|
||||
***************************************************************************/
|
||||
/* ynL=A2 (Q14) * x(n-2)L (Q0) in Q14*/
|
||||
ynL=(LVM_INT32)pBiquadState->coefs[0]* pBiquadState->pDelays[2];
|
||||
|
||||
/* ynL+=A1 (Q14) * x(n-1)L (Q0) in Q14*/
|
||||
ynL+=(LVM_INT32)pBiquadState->coefs[1]* pBiquadState->pDelays[0];
|
||||
|
||||
/* ynL+=A0 (Q14) * x(n)L (Q0) in Q14*/
|
||||
ynL+=(LVM_INT32)pBiquadState->coefs[2]* (*pDataIn);
|
||||
|
||||
/* ynL+= ( (-B2 (Q14) * y(n-2)L (Q16) )>>16) in Q14 */
|
||||
MUL32x16INTO32(pBiquadState->pDelays[6],pBiquadState->coefs[3],templ,16)
|
||||
ynL+=templ;
|
||||
|
||||
/* ynL+=( (-B1 (Q14) * y(n-1)L (Q16) )>>16) in Q14 */
|
||||
MUL32x16INTO32(pBiquadState->pDelays[4],pBiquadState->coefs[4],templ,16)
|
||||
ynL+=templ;
|
||||
|
||||
/**************************************************************************
|
||||
PROCESSING OF THE RIGHT CHANNEL
|
||||
***************************************************************************/
|
||||
/* ynR=A2 (Q14) * x(n-2)R (Q0) in Q14*/
|
||||
ynR=(LVM_INT32)pBiquadState->coefs[0]*pBiquadState->pDelays[3];
|
||||
|
||||
/* ynR+=A1 (Q14) * x(n-1)R (Q0) in Q14*/
|
||||
ynR+=(LVM_INT32)pBiquadState->coefs[1]*pBiquadState->pDelays[1];
|
||||
|
||||
/* ynR+=A0 (Q14) * x(n)R (Q0) in Q14*/
|
||||
ynR+=(LVM_INT32)pBiquadState->coefs[2]*(*(pDataIn+1));
|
||||
|
||||
/* ynR+= ( (-B2 (Q14) * y(n-2)R (Q16) )>>16) in Q14*/
|
||||
MUL32x16INTO32(pBiquadState->pDelays[7],pBiquadState->coefs[3],templ,16)
|
||||
ynR+=templ;
|
||||
|
||||
/* ynR+=( (-B1 (Q14) * y(n-1)R (Q16) )>>16) in Q14 */
|
||||
MUL32x16INTO32(pBiquadState->pDelays[5],pBiquadState->coefs[4],templ,16)
|
||||
ynR+=templ;
|
||||
|
||||
/**************************************************************************
|
||||
UPDATING THE DELAYS
|
||||
***************************************************************************/
|
||||
pBiquadState->pDelays[7]=pBiquadState->pDelays[5]; /* y(n-2)R=y(n-1)R*/
|
||||
pBiquadState->pDelays[6]=pBiquadState->pDelays[4]; /* y(n-2)L=y(n-1)L*/
|
||||
pBiquadState->pDelays[3]=pBiquadState->pDelays[1]; /* x(n-2)R=x(n-1)R*/
|
||||
pBiquadState->pDelays[2]=pBiquadState->pDelays[0]; /* x(n-2)L=x(n-1)L*/
|
||||
pBiquadState->pDelays[5]=ynR<<2; /* Update y(n-1)R in Q16*/
|
||||
pBiquadState->pDelays[4]=ynL<<2; /* Update y(n-1)L in Q16*/
|
||||
pBiquadState->pDelays[0]=(*pDataIn); /* Update x(n-1)L in Q0*/
|
||||
pDataIn++;
|
||||
pBiquadState->pDelays[1]=(*pDataIn); /* Update x(n-1)R in Q0*/
|
||||
pDataIn++;
|
||||
|
||||
/**************************************************************************
|
||||
WRITING THE OUTPUT
|
||||
***************************************************************************/
|
||||
*pDataOut=(LVM_INT16)(ynL>>14); /* Write Left output in Q0*/
|
||||
pDataOut++;
|
||||
*pDataOut=(LVM_INT16)(ynR>>14); /* Write Right ouput in Q0*/
|
||||
pDataOut++;
|
||||
}
|
||||
|
||||
}
|
||||
|
126
media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32C15_TRC_WRA_01.c
Executable file
126
media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32C15_TRC_WRA_01.c
Executable file
@ -0,0 +1,126 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* Project:: */
|
||||
/* $Author: beq07716 $*/
|
||||
/* $Revision: 1000 $*/
|
||||
/* $Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $*/
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
#include "BIQUAD.h"
|
||||
#include "BQ_2I_D16F32Css_TRC_WRA_01_Private.h"
|
||||
#include "LVM_Macros.h"
|
||||
|
||||
/**************************************************************************
|
||||
ASSUMPTIONS:
|
||||
COEFS-
|
||||
pBiquadState->coefs[0] is A2, pBiquadState->coefs[1] is A1
|
||||
pBiquadState->coefs[2] is A0, pBiquadState->coefs[3] is -B2
|
||||
pBiquadState->coefs[4] is -B1, these are in Q15 format
|
||||
|
||||
DELAYS-
|
||||
pBiquadState->pDelays[0] is x(n-1)L in Q0 format
|
||||
pBiquadState->pDelays[1] is x(n-1)R in Q0 format
|
||||
pBiquadState->pDelays[2] is x(n-2)L in Q0 format
|
||||
pBiquadState->pDelays[3] is x(n-2)R in Q0 format
|
||||
pBiquadState->pDelays[4] is y(n-1)L in Q16 format
|
||||
pBiquadState->pDelays[5] is y(n-1)R in Q16 format
|
||||
pBiquadState->pDelays[6] is y(n-2)L in Q16 format
|
||||
pBiquadState->pDelays[7] is y(n-2)R in Q16 format
|
||||
***************************************************************************/
|
||||
|
||||
void BQ_2I_D16F32C15_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
|
||||
LVM_INT16 *pDataIn,
|
||||
LVM_INT16 *pDataOut,
|
||||
LVM_INT16 NrSamples)
|
||||
{
|
||||
LVM_INT32 ynL,ynR,templ;
|
||||
LVM_INT16 ii;
|
||||
PFilter_State pBiquadState = (PFilter_State) pInstance;
|
||||
|
||||
for (ii = NrSamples; ii != 0; ii--)
|
||||
{
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
PROCESSING OF THE LEFT CHANNEL
|
||||
***************************************************************************/
|
||||
/* ynL=A2 (Q15) * x(n-2)L (Q0) in Q15*/
|
||||
ynL=(LVM_INT32)pBiquadState->coefs[0]* pBiquadState->pDelays[2];
|
||||
|
||||
/* ynL+=A1 (Q15) * x(n-1)L (Q0) in Q15*/
|
||||
ynL+=(LVM_INT32)pBiquadState->coefs[1]* pBiquadState->pDelays[0];
|
||||
|
||||
/* ynL+=A0 (Q15) * x(n)L (Q0) in Q15*/
|
||||
ynL+=(LVM_INT32)pBiquadState->coefs[2]* (*pDataIn);
|
||||
|
||||
/* ynL+= ( (-B2 (Q15) * y(n-2)L (Q16) )>>16) in Q15 */
|
||||
MUL32x16INTO32(pBiquadState->pDelays[6],pBiquadState->coefs[3],templ,16)
|
||||
ynL+=templ;
|
||||
|
||||
/* ynL+=( (-B1 (Q15) * y(n-1)L (Q16) )>>16) in Q15 */
|
||||
MUL32x16INTO32(pBiquadState->pDelays[4],pBiquadState->coefs[4],templ,16)
|
||||
ynL+=templ;
|
||||
|
||||
/**************************************************************************
|
||||
PROCESSING OF THE RIGHT CHANNEL
|
||||
***************************************************************************/
|
||||
/* ynR=A2 (Q15) * x(n-2)R (Q0) in Q15*/
|
||||
ynR=(LVM_INT32)pBiquadState->coefs[0]*pBiquadState->pDelays[3];
|
||||
|
||||
/* ynR+=A1 (Q15) * x(n-1)R (Q0) in Q15*/
|
||||
ynR+=(LVM_INT32)pBiquadState->coefs[1]*pBiquadState->pDelays[1];
|
||||
|
||||
/* ynR+=A0 (Q15) * x(n)R (Q0) in Q15*/
|
||||
ynR+=(LVM_INT32)pBiquadState->coefs[2]*(*(pDataIn+1));
|
||||
|
||||
/* ynR+= ( (-B2 (Q15) * y(n-2)R (Q16) )>>16) in Q15 */
|
||||
MUL32x16INTO32(pBiquadState->pDelays[7],pBiquadState->coefs[3],templ,16)
|
||||
ynR+=templ;
|
||||
|
||||
/* ynR+=( (-B1 (Q15) * y(n-1)R (Q16) )>>16) in Q15 */
|
||||
MUL32x16INTO32(pBiquadState->pDelays[5],pBiquadState->coefs[4],templ,16)
|
||||
ynR+=templ;
|
||||
|
||||
/**************************************************************************
|
||||
UPDATING THE DELAYS
|
||||
***************************************************************************/
|
||||
pBiquadState->pDelays[7]=pBiquadState->pDelays[5]; /* y(n-2)R=y(n-1)R*/
|
||||
pBiquadState->pDelays[6]=pBiquadState->pDelays[4]; /* y(n-2)L=y(n-1)L*/
|
||||
pBiquadState->pDelays[3]=pBiquadState->pDelays[1]; /* x(n-2)R=x(n-1)R*/
|
||||
pBiquadState->pDelays[2]=pBiquadState->pDelays[0]; /* x(n-2)L=x(n-1)L*/
|
||||
pBiquadState->pDelays[5]=ynR<<1; /* Update y(n-1)R in Q16*/
|
||||
pBiquadState->pDelays[4]=ynL<<1; /* Update y(n-1)L in Q16*/
|
||||
pBiquadState->pDelays[0]=(*pDataIn); /* Update x(n-1)L in Q0*/
|
||||
pDataIn++;
|
||||
pBiquadState->pDelays[1]=(*pDataIn); /* Update x(n-1)R in Q0*/
|
||||
pDataIn++;
|
||||
|
||||
/**************************************************************************
|
||||
WRITING THE OUTPUT
|
||||
***************************************************************************/
|
||||
*pDataOut=(LVM_INT16)(ynL>>15); /* Write Left output in Q0*/
|
||||
pDataOut++;
|
||||
*pDataOut=(LVM_INT16)(ynR>>15); /* Write Right ouput in Q0*/
|
||||
pDataOut++;
|
||||
}
|
||||
|
||||
}
|
||||
|
40
media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32Css_TRC_WRA_01_Private.h
Executable file
40
media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32Css_TRC_WRA_01_Private.h
Executable file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef _BQ_2I_D16F32CSS_TRC_WRA_01_PRIVATE_H_
|
||||
#define _BQ_2I_D16F32CSS_TRC_WRA_01_PRIVATE_H_
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* Project:: */
|
||||
/* $Author: beq07716 $*/
|
||||
/* $Revision: 1000 $*/
|
||||
/* $Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $*/
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
/* The internal state variables are implemented in a (for the user) hidden structure */
|
||||
/* In this (private) file, the internal structure is declared fro private use. */
|
||||
typedef struct _Filter_State_
|
||||
{
|
||||
LVM_INT32 * pDelays; /* pointer to the delayed samples (data of 32 bits) */
|
||||
LVM_INT16 coefs[5]; /* pointer to the filter coefficients */
|
||||
}Filter_State;
|
||||
|
||||
typedef Filter_State * PFilter_State ;
|
||||
|
||||
#endif /* _BQ_2I_D16F32CSS_TRC_WRA_01_PRIVATE_H_ */
|
67
media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32Css_TRC_WRA_01_init.c
Executable file
67
media/libeffects/lvm/lib/Common/src/BQ_2I_D16F32Css_TRC_WRA_01_init.c
Executable file
@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/************************************************************************/
|
||||
/* $Author: beq07716 $*/
|
||||
/* $Revision: 1000 $*/
|
||||
/* $Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $*/
|
||||
/* */
|
||||
/************************************************************************/
|
||||
#include "BIQUAD.h"
|
||||
#include "BQ_2I_D16F32Css_TRC_WRA_01_Private.h"
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* FUNCTION: */
|
||||
/* BQ_2I_D16F32Css_TRC_WRA_01_Init */
|
||||
/* */
|
||||
/* DESCRIPTION: */
|
||||
/* These functions initializes a BIQUAD filter defined as a cascade of */
|
||||
/* biquadratic Filter Sections. */
|
||||
/* */
|
||||
/* PARAMETERS: */
|
||||
/* pInstance - output, returns the pointer to the State Variable */
|
||||
/* This state pointer must be passed to any subsequent */
|
||||
/* call to "Biquad" functions. */
|
||||
/* pTaps - input, pointer to the taps memory */
|
||||
/* pCoef - input, pointer to the coefficient structure */
|
||||
/* N - M coefficient factor of QM.N */
|
||||
/* RETURNS: */
|
||||
/* void return code */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
void BQ_2I_D16F32Css_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
|
||||
Biquad_2I_Order2_Taps_t *pTaps,
|
||||
BQ_C16_Coefs_t *pCoef)
|
||||
{
|
||||
LVM_INT16 temp;
|
||||
PFilter_State pBiquadState = (PFilter_State) pInstance;
|
||||
pBiquadState->pDelays =(LVM_INT32 *) pTaps ;
|
||||
|
||||
temp=pCoef->A2;
|
||||
pBiquadState->coefs[0]=temp;
|
||||
temp=pCoef->A1;
|
||||
pBiquadState->coefs[1]=temp;
|
||||
temp=pCoef->A0;
|
||||
pBiquadState->coefs[2]=temp;
|
||||
temp=pCoef->B2;
|
||||
pBiquadState->coefs[3]=temp;
|
||||
temp=pCoef->B1;
|
||||
pBiquadState->coefs[4]=temp;
|
||||
}
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* End Of File: BQ_2I_D16F32Css_TRC_WRA_01_Init */
|
||||
|
135
media/libeffects/lvm/lib/Common/src/BQ_2I_D32F32C30_TRC_WRA_01.c
Executable file
135
media/libeffects/lvm/lib/Common/src/BQ_2I_D32F32C30_TRC_WRA_01.c
Executable file
@ -0,0 +1,135 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* Project:: */
|
||||
/* $Author: beq07716 $*/
|
||||
/* $Revision: 1000 $*/
|
||||
/* $Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $*/
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
#include "BIQUAD.h"
|
||||
#include "BQ_2I_D32F32Cll_TRC_WRA_01_Private.h"
|
||||
#include "LVM_Macros.h"
|
||||
|
||||
/**************************************************************************
|
||||
ASSUMPTIONS:
|
||||
COEFS-
|
||||
pBiquadState->coefs[0] is A2, pBiquadState->coefs[1] is A1
|
||||
pBiquadState->coefs[2] is A0, pBiquadState->coefs[3] is -B2
|
||||
pBiquadState->coefs[4] is -B1, these are in Q30 format
|
||||
|
||||
DELAYS-
|
||||
pBiquadState->pDelays[0] is x(n-1)L in Q0 format
|
||||
pBiquadState->pDelays[1] is x(n-1)R in Q0 format
|
||||
pBiquadState->pDelays[2] is x(n-2)L in Q0 format
|
||||
pBiquadState->pDelays[3] is x(n-2)R in Q0 format
|
||||
pBiquadState->pDelays[4] is y(n-1)L in Q0 format
|
||||
pBiquadState->pDelays[5] is y(n-1)R in Q0 format
|
||||
pBiquadState->pDelays[6] is y(n-2)L in Q0 format
|
||||
pBiquadState->pDelays[7] is y(n-2)R in Q0 format
|
||||
***************************************************************************/
|
||||
|
||||
void BQ_2I_D32F32C30_TRC_WRA_01 ( Biquad_Instance_t *pInstance,
|
||||
LVM_INT32 *pDataIn,
|
||||
LVM_INT32 *pDataOut,
|
||||
LVM_INT16 NrSamples)
|
||||
|
||||
|
||||
{
|
||||
LVM_INT32 ynL,ynR,templ,tempd;
|
||||
LVM_INT16 ii;
|
||||
PFilter_State pBiquadState = (PFilter_State) pInstance;
|
||||
|
||||
for (ii = NrSamples; ii != 0; ii--)
|
||||
{
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
PROCESSING OF THE LEFT CHANNEL
|
||||
***************************************************************************/
|
||||
/* ynL= ( A2 (Q30) * x(n-2)L (Q0) ) >>30 in Q0*/
|
||||
MUL32x32INTO32(pBiquadState->coefs[0],pBiquadState->pDelays[2],ynL,30)
|
||||
|
||||
/* ynL+= ( A1 (Q30) * x(n-1)L (Q0) ) >> 30 in Q0*/
|
||||
MUL32x32INTO32(pBiquadState->coefs[1],pBiquadState->pDelays[0],templ,30)
|
||||
ynL+=templ;
|
||||
|
||||
/* ynL+= ( A0 (Q30) * x(n)L (Q0) ) >> 30 in Q0*/
|
||||
MUL32x32INTO32(pBiquadState->coefs[2],*pDataIn,templ,30)
|
||||
ynL+=templ;
|
||||
|
||||
/* ynL+= (-B2 (Q30) * y(n-2)L (Q0) ) >> 30 in Q0*/
|
||||
MUL32x32INTO32(pBiquadState->coefs[3],pBiquadState->pDelays[6],templ,30)
|
||||
ynL+=templ;
|
||||
|
||||
/* ynL+= (-B1 (Q30) * y(n-1)L (Q0) ) >> 30 in Q0 */
|
||||
MUL32x32INTO32(pBiquadState->coefs[4],pBiquadState->pDelays[4],templ,30)
|
||||
ynL+=templ;
|
||||
|
||||
/**************************************************************************
|
||||
PROCESSING OF THE RIGHT CHANNEL
|
||||
***************************************************************************/
|
||||
/* ynR= ( A2 (Q30) * x(n-2)R (Q0) ) >> 30 in Q0*/
|
||||
MUL32x32INTO32(pBiquadState->coefs[0],pBiquadState->pDelays[3],ynR,30)
|
||||
|
||||
/* ynR+= ( A1 (Q30) * x(n-1)R (Q0) ) >> 30 in Q0*/
|
||||
MUL32x32INTO32(pBiquadState->coefs[1],pBiquadState->pDelays[1],templ,30)
|
||||
ynR+=templ;
|
||||
|
||||
/* ynR+= ( A0 (Q30) * x(n)R (Q0) ) >> 30 in Q0*/
|
||||
tempd=*(pDataIn+1);
|
||||
MUL32x32INTO32(pBiquadState->coefs[2],tempd,templ,30)
|
||||
ynR+=templ;
|
||||
|
||||
/* ynR+= (-B2 (Q30) * y(n-2)R (Q0) ) >> 30 in Q0*/
|
||||
MUL32x32INTO32(pBiquadState->coefs[3],pBiquadState->pDelays[7],templ,30)
|
||||
ynR+=templ;
|
||||
|
||||
/* ynR+= (-B1 (Q30) * y(n-1)R (Q0) ) >> 30 in Q0 */
|
||||
MUL32x32INTO32(pBiquadState->coefs[4],pBiquadState->pDelays[5],templ,30)
|
||||
ynR+=templ;
|
||||
|
||||
/**************************************************************************
|
||||
UPDATING THE DELAYS
|
||||
***************************************************************************/
|
||||
pBiquadState->pDelays[7]=pBiquadState->pDelays[5]; /* y(n-2)R=y(n-1)R*/
|
||||
pBiquadState->pDelays[6]=pBiquadState->pDelays[4]; /* y(n-2)L=y(n-1)L*/
|
||||
pBiquadState->pDelays[3]=pBiquadState->pDelays[1]; /* x(n-2)R=x(n-1)R*/
|
||||
pBiquadState->pDelays[2]=pBiquadState->pDelays[0]; /* x(n-2)L=x(n-1)L*/
|
||||
pBiquadState->pDelays[5]=(LVM_INT32)ynR; /* Update y(n-1)R in Q0*/
|
||||
pBiquadState->pDelays[4]=(LVM_INT32)ynL; /* Update y(n-1)L in Q0*/
|
||||
pBiquadState->pDelays[0]=(*pDataIn); /* Update x(n-1)L in Q0*/
|
||||
pDataIn++;
|
||||
pBiquadState->pDelays[1]=(*pDataIn); /* Update x(n-1)R in Q0*/
|
||||
pDataIn++;
|
||||
|
||||
/**************************************************************************
|
||||
WRITING THE OUTPUT
|
||||
***************************************************************************/
|
||||
*pDataOut=(LVM_INT32)ynL; /* Write Left output in Q0*/
|
||||
pDataOut++;
|
||||
*pDataOut=(LVM_INT32)ynR; /* Write Right ouput in Q0*/
|
||||
pDataOut++;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
66
media/libeffects/lvm/lib/Common/src/BQ_2I_D32F32Cll_TRC_WRA_01_Init.c
Executable file
66
media/libeffects/lvm/lib/Common/src/BQ_2I_D32F32Cll_TRC_WRA_01_Init.c
Executable file
@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* */
|
||||
/* $Author: beq07716 $*/
|
||||
/* $Revision: 1000 $*/
|
||||
/* $Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $*/
|
||||
/* */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
#include "BIQUAD.h"
|
||||
#include "BQ_2I_D32F32Cll_TRC_WRA_01_Private.h"
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* FUNCTION: */
|
||||
/* BQ_2I_D32F32Cll_TRC_WRA_01_Init */
|
||||
/* */
|
||||
/* DESCRIPTION: */
|
||||
/* These functions initializes a BIQUAD filter defined as a cascade of */
|
||||
/* biquadratic Filter Sections. */
|
||||
/* */
|
||||
/* PARAMETERS: */
|
||||
/* pInstance - output, returns the pointer to the State Variable */
|
||||
/* This state pointer must be passed to any subsequent */
|
||||
/* call to "Biquad" functions. */
|
||||
/* pTaps - input, pointer to the taps memory */
|
||||
/* pCoef - input, pointer to the coefficient structure */
|
||||
/* N - M coefficient factor of QM.N */
|
||||
/* RETURNS: */
|
||||
/* void return code */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
void BQ_2I_D32F32Cll_TRC_WRA_01_Init ( Biquad_Instance_t *pInstance,
|
||||
Biquad_2I_Order2_Taps_t *pTaps,
|
||||
BQ_C32_Coefs_t *pCoef)
|
||||
{
|
||||
LVM_INT32 temp;
|
||||
PFilter_State pBiquadState = (PFilter_State) pInstance;
|
||||
pBiquadState->pDelays =(LVM_INT32 *) pTaps ;
|
||||
|
||||
temp=pCoef->A2;
|
||||
pBiquadState->coefs[0]=temp;
|
||||
temp=pCoef->A1;
|
||||
pBiquadState->coefs[1]=temp;
|
||||
temp=pCoef->A0;
|
||||
pBiquadState->coefs[2]=temp;
|
||||
temp=pCoef->B2;
|
||||
pBiquadState->coefs[3]=temp;
|
||||
temp=pCoef->B1;
|
||||
pBiquadState->coefs[4]=temp;
|
||||
}
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* End Of File: BQ_2I_D32F32C32_TRC_WRA_01_Init.c */
|
||||
|
41
media/libeffects/lvm/lib/Common/src/BQ_2I_D32F32Cll_TRC_WRA_01_Private.h
Executable file
41
media/libeffects/lvm/lib/Common/src/BQ_2I_D32F32Cll_TRC_WRA_01_Private.h
Executable file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef _BQ_2I_D32F32CLL_TRC_WRA_01_PRIVATE_H_
|
||||
#define _BQ_2I_D32F32CLL_TRC_WRA_01_PRIVATE_H_
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* Project:: */
|
||||
/* $Author: beq07716 $*/
|
||||
/* $Revision: 1000 $*/
|
||||
/* $Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $*/
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
/* The internal state variables are implemented in a (for the user) hidden structure */
|
||||
/* In this (private) file, the internal structure is declared fro private use. */
|
||||
typedef struct _Filter_State_
|
||||
{
|
||||
LVM_INT32 * pDelays; /* pointer to the delayed samples (data of 32 bits) */
|
||||
LVM_INT32 coefs[5]; /* pointer to the filter coefficients */
|
||||
}Filter_State;
|
||||
|
||||
typedef Filter_State * PFilter_State ;
|
||||
|
||||
#endif /* _BQ_2I_D32F32CLL_TRC_WRA_01_PRIVATE_H_*/
|
52
media/libeffects/lvm/lib/Common/src/CompLim_private.h
Executable file
52
media/libeffects/lvm/lib/Common/src/CompLim_private.h
Executable file
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**********************************************************************************
|
||||
|
||||
$Author: beq07716 $
|
||||
$Revision: 1000 $
|
||||
$Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $
|
||||
|
||||
***********************************************************************************/
|
||||
|
||||
#ifndef _COMP_LIM_PRIVATE_
|
||||
#define _COMP_LIM_PRIVATE_
|
||||
|
||||
/**********************************************************************************
|
||||
INCLUDE FILES
|
||||
***********************************************************************************/
|
||||
|
||||
#include "CompLim.h"
|
||||
|
||||
/**********************************************************************************
|
||||
DEFINITIONS
|
||||
***********************************************************************************/
|
||||
|
||||
#define FS_48K 48000
|
||||
|
||||
#define INTEGER_16 0xFFFF /* 65535*/
|
||||
#define INTEGER_15 0x7FFF /* 32767*/
|
||||
|
||||
#define GAIN_6DB 1
|
||||
#define GAIN_12DB 2
|
||||
#define GAIN_18DB 3
|
||||
#define GAIN_24DB 4
|
||||
|
||||
#endif /* #ifndef _COMP_LIM_PRIVATE_ */
|
||||
|
||||
/*** End of file ******************************************************************/
|
||||
|
66
media/libeffects/lvm/lib/Common/src/Copy_16.c
Executable file
66
media/libeffects/lvm/lib/Common/src/Copy_16.c
Executable file
@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**********************************************************************************
|
||||
|
||||
$Author: beq07716 $
|
||||
$Revision: 1000 $
|
||||
$Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $
|
||||
|
||||
***********************************************************************************/
|
||||
|
||||
/**********************************************************************************
|
||||
INCLUDE FILES
|
||||
***********************************************************************************/
|
||||
|
||||
#include "VectorArithmetic.h"
|
||||
|
||||
/**********************************************************************************
|
||||
FUNCTION COPY_16
|
||||
***********************************************************************************/
|
||||
|
||||
void Copy_16( const LVM_INT16 *src,
|
||||
LVM_INT16 *dst,
|
||||
LVM_INT16 n )
|
||||
{
|
||||
LVM_INT16 ii;
|
||||
|
||||
if (src > dst)
|
||||
{
|
||||
for (ii = n; ii != 0; ii--)
|
||||
{
|
||||
*dst = *src;
|
||||
dst++;
|
||||
src++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
src += n - 1;
|
||||
dst += n - 1;
|
||||
for (ii = n; ii != 0; ii--)
|
||||
{
|
||||
*dst = *src;
|
||||
dst--;
|
||||
src--;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**********************************************************************************/
|
69
media/libeffects/lvm/lib/Common/src/Core_MixHard_2St_D32C31_SAT.c
Executable file
69
media/libeffects/lvm/lib/Common/src/Core_MixHard_2St_D32C31_SAT.c
Executable file
@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* Project:: */
|
||||
/* $Author: beq07716 $*/
|
||||
/* $Revision: 1000 $*/
|
||||
/* $Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $*/
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
/**********************************************************************************
|
||||
INCLUDE FILES
|
||||
***********************************************************************************/
|
||||
|
||||
#include "Mixer_private.h"
|
||||
#include "LVM_Macros.h"
|
||||
|
||||
/**********************************************************************************
|
||||
FUNCTION CORE_MIXHARD_2ST_D32C31_SAT
|
||||
***********************************************************************************/
|
||||
|
||||
void Core_MixHard_2St_D32C31_SAT( Mix_2St_Cll_t *pInstance,
|
||||
const LVM_INT32 *src1,
|
||||
const LVM_INT32 *src2,
|
||||
LVM_INT32 *dst,
|
||||
LVM_INT16 n)
|
||||
{
|
||||
LVM_INT32 Temp1,Temp2,Temp3;
|
||||
LVM_INT16 ii;
|
||||
LVM_INT16 Current1Short;
|
||||
LVM_INT16 Current2Short;
|
||||
|
||||
Current1Short = (LVM_INT16)(pInstance->Current1 >> 16);
|
||||
Current2Short = (LVM_INT16)(pInstance->Current2 >> 16);
|
||||
|
||||
for (ii = n; ii != 0; ii--){
|
||||
Temp1=*src1++;
|
||||
MUL32x16INTO32(Temp1,Current1Short,Temp3,15)
|
||||
Temp2=*src2++;
|
||||
MUL32x16INTO32(Temp2,Current2Short,Temp1,15)
|
||||
Temp2=(Temp1>>1)+(Temp3>>1);
|
||||
if (Temp2 > 0x3FFFFFFF)
|
||||
Temp2 = 0x7FFFFFFF;
|
||||
else if (Temp2 < - 0x40000000)
|
||||
Temp2 = 0x80000000;
|
||||
else
|
||||
Temp2=(Temp2<<1);
|
||||
*dst++ = Temp2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************************/
|
103
media/libeffects/lvm/lib/Common/src/Core_MixInSoft_D32C31_SAT.c
Executable file
103
media/libeffects/lvm/lib/Common/src/Core_MixInSoft_D32C31_SAT.c
Executable file
@ -0,0 +1,103 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* Project:: */
|
||||
/* $Author: beq07716 $*/
|
||||
/* $Revision: 1000 $*/
|
||||
/* $Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $*/
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
/**********************************************************************************
|
||||
INCLUDE FILES
|
||||
***********************************************************************************/
|
||||
|
||||
#include "Mixer_private.h"
|
||||
#include "LVM_Macros.h"
|
||||
|
||||
/**********************************************************************************
|
||||
FUNCTION CORE_MIXSOFT_1ST_D32C31_WRA
|
||||
***********************************************************************************/
|
||||
|
||||
void Core_MixInSoft_D32C31_SAT( Mix_1St_Cll_t *pInstance,
|
||||
const LVM_INT32 *src,
|
||||
LVM_INT32 *dst,
|
||||
LVM_INT16 n)
|
||||
{
|
||||
LVM_INT32 Temp1,Temp2,Temp3;
|
||||
LVM_INT16 OutLoop;
|
||||
LVM_INT16 InLoop;
|
||||
LVM_INT32 TargetTimesOneMinAlpha;
|
||||
LVM_INT32 CurrentTimesAlpha;
|
||||
LVM_INT16 ii,jj;
|
||||
LVM_INT16 CurrentShort;
|
||||
|
||||
InLoop = (LVM_INT16)(n >> 2); /* Process per 4 samples */
|
||||
OutLoop = (LVM_INT16)(n - (InLoop << 2));
|
||||
|
||||
MUL32x32INTO32((0x7FFFFFFF-pInstance->Alpha),pInstance->Target,TargetTimesOneMinAlpha,31); /* Q31 * Q0 in Q0 */
|
||||
if (pInstance->Target >= pInstance->Current){
|
||||
TargetTimesOneMinAlpha +=2; /* Ceil*/
|
||||
}
|
||||
|
||||
if (OutLoop){
|
||||
MUL32x32INTO32(pInstance->Current,pInstance->Alpha,CurrentTimesAlpha,31); /* Q0 * Q31 in Q0 */
|
||||
pInstance->Current = TargetTimesOneMinAlpha + CurrentTimesAlpha; /* Q0 + Q0 into Q0*/
|
||||
CurrentShort = (LVM_INT16)(pInstance->Current>>16); /* From Q31 to Q15*/
|
||||
|
||||
for (ii = OutLoop; ii != 0; ii--){
|
||||
Temp1=*src++;
|
||||
Temp2=*dst;
|
||||
MUL32x16INTO32(Temp1,CurrentShort,Temp3,15)
|
||||
Temp1=(Temp2>>1)+(Temp3>>1);
|
||||
|
||||
if (Temp1 > 0x3FFFFFFF)
|
||||
Temp1 = 0x7FFFFFFF;
|
||||
else if (Temp1 < - 0x40000000)
|
||||
Temp1 = 0x80000000;
|
||||
else
|
||||
Temp1=(Temp1<<1);
|
||||
*dst++ = Temp1;
|
||||
}
|
||||
}
|
||||
|
||||
for (ii = InLoop; ii != 0; ii--){
|
||||
MUL32x32INTO32(pInstance->Current,pInstance->Alpha,CurrentTimesAlpha,31); /* Q0 * Q31 in Q0 */
|
||||
pInstance->Current = TargetTimesOneMinAlpha + CurrentTimesAlpha; /* Q0 + Q0 into Q0*/
|
||||
CurrentShort = (LVM_INT16)(pInstance->Current>>16); /* From Q31 to Q15*/
|
||||
|
||||
for (jj = 4; jj!=0 ; jj--){
|
||||
Temp1=*src++;
|
||||
Temp2=*dst;
|
||||
MUL32x16INTO32(Temp1,CurrentShort,Temp3,15)
|
||||
Temp1=(Temp2>>1)+(Temp3>>1);
|
||||
|
||||
if (Temp1 > 0x3FFFFFFF)
|
||||
Temp1 = 0x7FFFFFFF;
|
||||
else if (Temp1 < - 0x40000000)
|
||||
Temp1 = 0x80000000;
|
||||
else
|
||||
Temp1=(Temp1<<1);
|
||||
*dst++ = Temp1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************************/
|
112
media/libeffects/lvm/lib/Common/src/Core_MixSoft_1St_D32C31_WRA.c
Executable file
112
media/libeffects/lvm/lib/Common/src/Core_MixSoft_1St_D32C31_WRA.c
Executable file
@ -0,0 +1,112 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* Project:: */
|
||||
/* $Author: beq07716 $*/
|
||||
/* $Revision: 1000 $*/
|
||||
/* $Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $*/
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
/**********************************************************************************
|
||||
INCLUDE FILES
|
||||
***********************************************************************************/
|
||||
|
||||
#include "Mixer_private.h"
|
||||
#include "LVM_Macros.h"
|
||||
|
||||
/**********************************************************************************
|
||||
FUNCTION CORE_MIXSOFT_1ST_D32C31_WRA
|
||||
***********************************************************************************/
|
||||
|
||||
void Core_MixSoft_1St_D32C31_WRA( Mix_1St_Cll_t *pInstance,
|
||||
const LVM_INT32 *src,
|
||||
LVM_INT32 *dst,
|
||||
LVM_INT16 n)
|
||||
{
|
||||
LVM_INT32 Temp1,Temp2;
|
||||
LVM_INT16 OutLoop;
|
||||
LVM_INT16 InLoop;
|
||||
LVM_INT32 TargetTimesOneMinAlpha;
|
||||
LVM_INT32 CurrentTimesAlpha;
|
||||
LVM_INT16 CurrentShort;
|
||||
LVM_INT16 ii;
|
||||
|
||||
InLoop = (LVM_INT16)(n >> 2); /* Process per 4 samples */
|
||||
OutLoop = (LVM_INT16)(n - (InLoop << 2));
|
||||
|
||||
MUL32x32INTO32((0x7FFFFFFF-pInstance->Alpha),pInstance->Target,TargetTimesOneMinAlpha,31) /* Q31 * Q31 in Q31 */
|
||||
if (pInstance->Target >= pInstance->Current)
|
||||
{
|
||||
TargetTimesOneMinAlpha +=2; /* Ceil*/
|
||||
}
|
||||
|
||||
if (OutLoop!=0)
|
||||
{
|
||||
MUL32x32INTO32(pInstance->Current,pInstance->Alpha,CurrentTimesAlpha,31) /* Q31 * Q31 in Q31 */
|
||||
pInstance->Current = TargetTimesOneMinAlpha + CurrentTimesAlpha; /* Q31 + Q31 into Q31*/
|
||||
CurrentShort = (LVM_INT16)(pInstance->Current>>16); /* From Q31 to Q15*/
|
||||
|
||||
for (ii = OutLoop; ii != 0; ii--)
|
||||
{
|
||||
Temp1=*src;
|
||||
src++;
|
||||
|
||||
MUL32x16INTO32(Temp1,CurrentShort,Temp2,15)
|
||||
*dst = Temp2;
|
||||
dst++;
|
||||
}
|
||||
}
|
||||
|
||||
for (ii = InLoop; ii != 0; ii--)
|
||||
{
|
||||
MUL32x32INTO32(pInstance->Current,pInstance->Alpha,CurrentTimesAlpha,31) /* Q31 * Q31 in Q31 */
|
||||
pInstance->Current = TargetTimesOneMinAlpha + CurrentTimesAlpha; /* Q31 + Q31 into Q31*/
|
||||
CurrentShort = (LVM_INT16)(pInstance->Current>>16); /* From Q31 to Q15*/
|
||||
Temp1=*src;
|
||||
src++;
|
||||
|
||||
MUL32x16INTO32(Temp1,CurrentShort,Temp2,15)
|
||||
*dst = Temp2;
|
||||
dst++;
|
||||
|
||||
Temp1=*src;
|
||||
src++;
|
||||
|
||||
MUL32x16INTO32(Temp1,CurrentShort,Temp2,15)
|
||||
*dst = Temp2;
|
||||
dst++;
|
||||
|
||||
Temp1=*src;
|
||||
src++;
|
||||
|
||||
MUL32x16INTO32(Temp1,CurrentShort,Temp2,15)
|
||||
*dst = Temp2;
|
||||
dst++;
|
||||
|
||||
Temp1=*src;
|
||||
src++;
|
||||
MUL32x16INTO32(Temp1,CurrentShort,Temp2,15)
|
||||
*dst = Temp2;
|
||||
dst++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************************/
|
76
media/libeffects/lvm/lib/Common/src/DC_2I_D16_TRC_WRA_01.c
Executable file
76
media/libeffects/lvm/lib/Common/src/DC_2I_D16_TRC_WRA_01.c
Executable file
@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* Project:: */
|
||||
/* $Author: beq07716 $*/
|
||||
/* $Revision: 1000 $*/
|
||||
/* $Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $*/
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
#include "BIQUAD.h"
|
||||
#include "DC_2I_D16_TRC_WRA_01_Private.h"
|
||||
#include "LVM_Macros.h"
|
||||
|
||||
void DC_2I_D16_TRC_WRA_01( Biquad_Instance_t *pInstance,
|
||||
LVM_INT16 *pDataIn,
|
||||
LVM_INT16 *pDataOut,
|
||||
LVM_INT16 NrSamples)
|
||||
{
|
||||
LVM_INT32 LeftDC,RightDC;
|
||||
LVM_INT32 Diff;
|
||||
LVM_INT32 j;
|
||||
PFilter_State pBiquadState = (PFilter_State) pInstance;
|
||||
|
||||
LeftDC = pBiquadState->LeftDC;
|
||||
RightDC = pBiquadState->RightDC;
|
||||
for(j=NrSamples-1;j>=0;j--)
|
||||
{
|
||||
/* Subtract DC an saturate */
|
||||
Diff=*(pDataIn++)-(LeftDC>>16);
|
||||
if (Diff > 32767) {
|
||||
Diff = 32767; }
|
||||
else if (Diff < -32768) {
|
||||
Diff = -32768; }
|
||||
*(pDataOut++)=(LVM_INT16)Diff;
|
||||
if (Diff < 0) {
|
||||
LeftDC -= DC_D16_STEP; }
|
||||
else {
|
||||
LeftDC += DC_D16_STEP; }
|
||||
|
||||
|
||||
/* Subtract DC an saturate */
|
||||
Diff=*(pDataIn++)-(RightDC>>16);
|
||||
if (Diff > 32767) {
|
||||
Diff = 32767; }
|
||||
else if (Diff < -32768) {
|
||||
Diff = -32768; }
|
||||
*(pDataOut++)=(LVM_INT16)Diff;
|
||||
if (Diff < 0) {
|
||||
RightDC -= DC_D16_STEP; }
|
||||
else {
|
||||
RightDC += DC_D16_STEP; }
|
||||
|
||||
}
|
||||
pBiquadState->LeftDC = LeftDC;
|
||||
pBiquadState->RightDC = RightDC;
|
||||
|
||||
|
||||
}
|
||||
|
36
media/libeffects/lvm/lib/Common/src/DC_2I_D16_TRC_WRA_01_Init.c
Executable file
36
media/libeffects/lvm/lib/Common/src/DC_2I_D16_TRC_WRA_01_Init.c
Executable file
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* Project:: */
|
||||
/* $Author: beq07716 $*/
|
||||
/* $Revision: 1000 $*/
|
||||
/* $Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $*/
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
#include "BIQUAD.h"
|
||||
#include "DC_2I_D16_TRC_WRA_01_Private.h"
|
||||
|
||||
void DC_2I_D16_TRC_WRA_01_Init(Biquad_Instance_t *pInstance)
|
||||
{
|
||||
PFilter_State pBiquadState = (PFilter_State) pInstance;
|
||||
pBiquadState->LeftDC = 0;
|
||||
pBiquadState->RightDC = 0;
|
||||
}
|
||||
|
43
media/libeffects/lvm/lib/Common/src/DC_2I_D16_TRC_WRA_01_Private.h
Executable file
43
media/libeffects/lvm/lib/Common/src/DC_2I_D16_TRC_WRA_01_Private.h
Executable file
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef _DC_2I_D16_TRC_WRA_01_PRIVATE_H_
|
||||
#define _DC_2I_D16_TRC_WRA_01_PRIVATE_H_
|
||||
|
||||
#define DC_D16_STEP 0x200;
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* Project:: */
|
||||
/* $Author: beq07716 $*/
|
||||
/* $Revision: 1000 $*/
|
||||
/* $Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $*/
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
|
||||
/* The internal state variables are implemented in a (for the user) hidden structure */
|
||||
/* In this (private) file, the internal structure is declared fro private use.*/
|
||||
typedef struct _Filter_State_
|
||||
{
|
||||
LVM_INT32 LeftDC; /* LeftDC */
|
||||
LVM_INT32 RightDC; /* RightDC */
|
||||
}Filter_State;
|
||||
|
||||
typedef Filter_State * PFilter_State ;
|
||||
|
||||
#endif /* _DC_2I_D16_TRC_WRA_01_PRIVATE_H_ */
|
113
media/libeffects/lvm/lib/Common/src/DelayAllPass_Sat_32x16To32.c
Executable file
113
media/libeffects/lvm/lib/Common/src/DelayAllPass_Sat_32x16To32.c
Executable file
@ -0,0 +1,113 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* Project:: */
|
||||
/* $Author: beq07716 $*/
|
||||
/* $Revision: 1000 $*/
|
||||
/* $Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $*/
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
/**********************************************************************************
|
||||
INCLUDE FILES
|
||||
***********************************************************************************/
|
||||
|
||||
#include "LVM_Types.h"
|
||||
#include "LVM_Macros.h"
|
||||
#include "VectorArithmetic.h"
|
||||
|
||||
/**********************************************************************************
|
||||
FUNCTION DelayAllPass_32x32
|
||||
***********************************************************************************/
|
||||
|
||||
void DelayAllPass_Sat_32x16To32( LVM_INT32 *delay, /* Delay buffer */
|
||||
LVM_UINT16 size, /* Delay size */
|
||||
LVM_INT16 coeff, /* All pass filter coefficient */
|
||||
LVM_UINT16 DelayOffset, /* Simple delay offset */
|
||||
LVM_UINT16 *pAllPassOffset, /* All pass filter delay offset */
|
||||
LVM_INT32 *dst, /* Source/destination */
|
||||
LVM_INT16 n) /* Number of samples */
|
||||
{
|
||||
LVM_INT16 i;
|
||||
LVM_UINT16 AllPassOffset = *pAllPassOffset;
|
||||
LVM_INT32 temp;
|
||||
LVM_INT32 a,b,c;
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
|
||||
MUL32x16INTO32(delay[AllPassOffset], coeff, temp, 15)
|
||||
a = temp;
|
||||
b = delay[DelayOffset];
|
||||
DelayOffset++;
|
||||
|
||||
c = a + b;
|
||||
if ((((c ^ a) & (c ^ b)) >> 31) != 0) /* overflow / underflow */
|
||||
{
|
||||
if(a < 0)
|
||||
{
|
||||
c = 0x80000000l;
|
||||
}
|
||||
else
|
||||
{
|
||||
c = 0x7FFFFFFFl;
|
||||
}
|
||||
}
|
||||
*dst = c;
|
||||
dst++;
|
||||
|
||||
|
||||
MUL32x16INTO32(c, -coeff, temp, 15)
|
||||
a = temp;
|
||||
b = delay[AllPassOffset];
|
||||
c = a + b;
|
||||
if ((((c ^ a) & (c ^ b)) >> 31)!=0) /* overflow / underflow */
|
||||
{
|
||||
if(a < 0)
|
||||
{
|
||||
c = 0x80000000l;
|
||||
}
|
||||
else
|
||||
{
|
||||
c = 0x7FFFFFFFl;
|
||||
}
|
||||
}
|
||||
delay[AllPassOffset] = c;
|
||||
AllPassOffset++;
|
||||
|
||||
/* Make the delay buffer a circular buffer */
|
||||
if (DelayOffset >= size)
|
||||
{
|
||||
DelayOffset = 0;
|
||||
}
|
||||
|
||||
if (AllPassOffset >= size)
|
||||
{
|
||||
AllPassOffset = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Update the offset */
|
||||
*pAllPassOffset = AllPassOffset;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**********************************************************************************/
|
||||
|
81
media/libeffects/lvm/lib/Common/src/DelayMix_16x16.c
Executable file
81
media/libeffects/lvm/lib/Common/src/DelayMix_16x16.c
Executable file
@ -0,0 +1,81 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**********************************************************************************
|
||||
|
||||
$Author: beq07716 $
|
||||
$Revision: 1000 $
|
||||
$Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $
|
||||
|
||||
***********************************************************************************/
|
||||
|
||||
/**********************************************************************************
|
||||
INCLUDE FILES
|
||||
***********************************************************************************/
|
||||
|
||||
#include "VectorArithmetic.h"
|
||||
|
||||
/**********************************************************************************
|
||||
FUNCTION DelayMix_16x16
|
||||
***********************************************************************************/
|
||||
|
||||
void DelayMix_16x16(const LVM_INT16 *src, /* Source 1, to be delayed */
|
||||
LVM_INT16 *delay, /* Delay buffer */
|
||||
LVM_INT16 size, /* Delay size */
|
||||
LVM_INT16 *dst, /* Source/destination */
|
||||
LVM_INT16 *pOffset, /* Delay offset */
|
||||
LVM_INT16 n) /* Number of stereo samples */
|
||||
{
|
||||
LVM_INT16 i;
|
||||
LVM_INT16 Offset = *pOffset;
|
||||
LVM_INT16 temp;
|
||||
|
||||
for (i=0; i<n; i++)
|
||||
{
|
||||
/* Left channel */
|
||||
temp = (LVM_INT16)((LVM_UINT32)((LVM_INT32)(*dst) + (LVM_INT32)delay[Offset]) >> 1);
|
||||
*dst = temp;
|
||||
dst++;
|
||||
|
||||
delay[Offset] = *src;
|
||||
Offset++;
|
||||
src++;
|
||||
|
||||
|
||||
/* Right channel */
|
||||
temp = (LVM_INT16)((LVM_UINT32)((LVM_INT32)(*dst) - (LVM_INT32)delay[Offset]) >> 1);
|
||||
*dst = temp;
|
||||
dst++;
|
||||
|
||||
delay[Offset] = *src;
|
||||
Offset++;
|
||||
src++;
|
||||
|
||||
/* Make the reverb delay buffer a circular buffer */
|
||||
if (Offset >= size)
|
||||
{
|
||||
Offset = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Update the offset */
|
||||
*pOffset = Offset;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**********************************************************************************/
|
66
media/libeffects/lvm/lib/Common/src/DelayWrite_32.c
Executable file
66
media/libeffects/lvm/lib/Common/src/DelayWrite_32.c
Executable file
@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* Project:: */
|
||||
/* $Author: beq07716 $*/
|
||||
/* $Revision: 1000 $*/
|
||||
/* $Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $*/
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
/**********************************************************************************
|
||||
INCLUDE FILES
|
||||
***********************************************************************************/
|
||||
|
||||
#include "VectorArithmetic.h"
|
||||
|
||||
/**********************************************************************************
|
||||
FUNCTION DelayMix_16x16
|
||||
***********************************************************************************/
|
||||
|
||||
void DelayWrite_32(const LVM_INT32 *src, /* Source 1, to be delayed */
|
||||
LVM_INT32 *delay, /* Delay buffer */
|
||||
LVM_UINT16 size, /* Delay size */
|
||||
LVM_UINT16 *pOffset, /* Delay offset */
|
||||
LVM_INT16 n) /* Number of samples */
|
||||
{
|
||||
LVM_INT16 i;
|
||||
LVM_INT16 Offset = (LVM_INT16)*pOffset;
|
||||
|
||||
for (i=0; i<n; i++)
|
||||
{
|
||||
delay[Offset] = *src;
|
||||
Offset++;
|
||||
src++;
|
||||
|
||||
/* Make the delay buffer a circular buffer */
|
||||
if (Offset >= size)
|
||||
{
|
||||
Offset = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Update the offset */
|
||||
*pOffset = (LVM_UINT16)Offset;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**********************************************************************************/
|
||||
|
83
media/libeffects/lvm/lib/Common/src/FO_1I_D16F16C15_TRC_WRA_01.c
Executable file
83
media/libeffects/lvm/lib/Common/src/FO_1I_D16F16C15_TRC_WRA_01.c
Executable file
@ -0,0 +1,83 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* Project:: */
|
||||
/* $Author: beq07716 $*/
|
||||
/* $Revision: 1000 $*/
|
||||
/* $Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $*/
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
#include "BIQUAD.h"
|
||||
#include "FO_1I_D16F16Css_TRC_WRA_01_Private.h"
|
||||
#include "LVM_Macros.h"
|
||||
|
||||
/**************************************************************************
|
||||
ASSUMPTIONS:
|
||||
COEFS-
|
||||
pBiquadState->coefs[0] is A1,
|
||||
pBiquadState->coefs[1] is A0,
|
||||
pBiquadState->coefs[2] is -B1, these are in Q15 format
|
||||
|
||||
DELAYS-
|
||||
pBiquadState->pDelays[0] is x(n-1)L in Q0 format
|
||||
pBiquadState->pDelays[1] is y(n-1)L in Q0 format
|
||||
***************************************************************************/
|
||||
|
||||
void FO_1I_D16F16C15_TRC_WRA_01( Biquad_Instance_t *pInstance,
|
||||
LVM_INT16 *pDataIn,
|
||||
LVM_INT16 *pDataOut,
|
||||
LVM_INT16 NrSamples)
|
||||
{
|
||||
LVM_INT32 ynL;
|
||||
LVM_INT16 ii;
|
||||
PFilter_State pBiquadState = (PFilter_State) pInstance;
|
||||
|
||||
for (ii = NrSamples; ii != 0; ii--)
|
||||
{
|
||||
|
||||
/**************************************************************************
|
||||
PROCESSING OF THE LEFT CHANNEL
|
||||
***************************************************************************/
|
||||
// ynL=A1 (Q15) * x(n-1)L (Q0) in Q15
|
||||
ynL=(LVM_INT32)pBiquadState->coefs[0]* pBiquadState->pDelays[0];
|
||||
|
||||
// ynL+=A0 (Q15) * x(n)L (Q0) in Q15
|
||||
ynL+=(LVM_INT32)pBiquadState->coefs[1]* (*pDataIn);
|
||||
|
||||
// ynL+= (-B1 (Q15) * y(n-1)L (Q0) ) in Q15
|
||||
ynL+=(LVM_INT32)pBiquadState->coefs[2]*pBiquadState->pDelays[1];
|
||||
|
||||
|
||||
ynL=(LVM_INT16)(ynL>>15); // ynL in Q0 format
|
||||
/**************************************************************************
|
||||
UPDATING THE DELAYS
|
||||
***************************************************************************/
|
||||
pBiquadState->pDelays[1]=ynL; // Update y(n-1)L in Q0
|
||||
pBiquadState->pDelays[0]=(*pDataIn++); // Update x(n-1)L in Q0
|
||||
|
||||
/**************************************************************************
|
||||
WRITING THE OUTPUT
|
||||
***************************************************************************/
|
||||
*pDataOut++=(LVM_INT16)ynL; // Write Left output in Q0
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
63
media/libeffects/lvm/lib/Common/src/FO_1I_D16F16Css_TRC_WRA_01_Init.c
Executable file
63
media/libeffects/lvm/lib/Common/src/FO_1I_D16F16Css_TRC_WRA_01_Init.c
Executable file
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* */
|
||||
/* $Author: beq07716 $*/
|
||||
/* $Revision: 1000 $*/
|
||||
/* $Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $*/
|
||||
/* */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
#include "BIQUAD.h"
|
||||
#include "FO_1I_D16F16Css_TRC_WRA_01_Private.h"
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* FUNCTION: */
|
||||
/* FO_1I_D16F16Css_TRC_WRA_01_Init */
|
||||
/* */
|
||||
/* DESCRIPTION: */
|
||||
/* These functions initializes a BIQUAD filter defined as a cascade of */
|
||||
/* biquadratic Filter Sections. */
|
||||
/* */
|
||||
/* PARAMETERS: */
|
||||
/* pInstance - output, returns the pointer to the State Variable */
|
||||
/* This state pointer must be passed to any subsequent */
|
||||
/* call to "Biquad" functions. */
|
||||
/* pTaps - input, pointer to the taps memory */
|
||||
/* pCoef - input, pointer to the coefficient structure */
|
||||
/* N - M coefficient factor of QM.N */
|
||||
/* RETURNS: */
|
||||
/* void return code */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
void FO_1I_D16F16Css_TRC_WRA_01_Init( Biquad_Instance_t *pInstance,
|
||||
Biquad_1I_Order1_Taps_t *pTaps,
|
||||
FO_C16_Coefs_t *pCoef)
|
||||
{
|
||||
LVM_INT16 temp;
|
||||
PFilter_State pBiquadState = (PFilter_State) pInstance;
|
||||
pBiquadState->pDelays =(LVM_INT32 *) pTaps;
|
||||
|
||||
temp=pCoef->A1;
|
||||
pBiquadState->coefs[0]=temp;
|
||||
temp=pCoef->A0;
|
||||
pBiquadState->coefs[1]=temp;
|
||||
temp=pCoef->B1;
|
||||
pBiquadState->coefs[2]=temp;
|
||||
}
|
||||
/*------------------------------------------------*/
|
||||
/* End Of File: FO_1I_D16F16Css_TRC_WRA_01_Init.c */
|
||||
|
40
media/libeffects/lvm/lib/Common/src/FO_1I_D16F16Css_TRC_WRA_01_Private.h
Executable file
40
media/libeffects/lvm/lib/Common/src/FO_1I_D16F16Css_TRC_WRA_01_Private.h
Executable file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef _FO_1I_D16F16CSS_TRC_WRA_01_PRIVATE_H_
|
||||
#define _FO_1I_D16F16CSS_TRC_WRA_01_PRIVATE_H_
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* Project:: */
|
||||
/* $Author: beq07716 $*/
|
||||
/* $Revision: 1000 $*/
|
||||
/* $Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $ */
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
/* The internal state variables are implemented in a (for the user) hidden structure */
|
||||
/* In this (private) file, the internal structure is declared fro private use. */
|
||||
typedef struct _Filter_State_
|
||||
{
|
||||
LVM_INT32* pDelays; /* pointer to the delayed samples (data of 32 bits) */
|
||||
LVM_INT16 coefs[3]; /* pointer to the filter coefficients */
|
||||
}Filter_State;
|
||||
|
||||
typedef Filter_State * PFilter_State ;
|
||||
|
||||
#endif /* _FO_1I_D16F16CSS_TRC_WRA_01_PRIVATE_H_ */
|
83
media/libeffects/lvm/lib/Common/src/FO_1I_D32F32C31_TRC_WRA_01.c
Executable file
83
media/libeffects/lvm/lib/Common/src/FO_1I_D32F32C31_TRC_WRA_01.c
Executable file
@ -0,0 +1,83 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* Project:: */
|
||||
/* $Author: beq07716 $*/
|
||||
/* $Revision: 1000 $*/
|
||||
/* $Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $*/
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
#include "BIQUAD.h"
|
||||
#include "FO_1I_D32F32Cll_TRC_WRA_01_Private.h"
|
||||
#include "LVM_Macros.h"
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
ASSUMPTIONS:
|
||||
COEFS-
|
||||
pBiquadState->coefs[0] is A1,
|
||||
pBiquadState->coefs[1] is A0,
|
||||
pBiquadState->coefs[2] is -B1, these are in Q31 format
|
||||
|
||||
DELAYS-
|
||||
pBiquadState->pDelays[0] is x(n-1)L in Q0 format
|
||||
pBiquadState->pDelays[1] is y(n-1)L in Q0 format
|
||||
***************************************************************************/
|
||||
|
||||
void FO_1I_D32F32C31_TRC_WRA_01( Biquad_Instance_t *pInstance,
|
||||
LVM_INT32 *pDataIn,
|
||||
LVM_INT32 *pDataOut,
|
||||
LVM_INT16 NrSamples)
|
||||
{
|
||||
LVM_INT32 ynL,templ;
|
||||
LVM_INT16 ii;
|
||||
PFilter_State pBiquadState = (PFilter_State) pInstance;
|
||||
|
||||
for (ii = NrSamples; ii != 0; ii--)
|
||||
{
|
||||
|
||||
/**************************************************************************
|
||||
PROCESSING OF THE LEFT CHANNEL
|
||||
***************************************************************************/
|
||||
// ynL=A1 (Q31) * x(n-1)L (Q0) >>31 in Q0
|
||||
MUL32x32INTO32(pBiquadState->coefs[0],pBiquadState->pDelays[0],ynL,31)
|
||||
|
||||
// ynL+=A0 (Q31) * x(n)L (Q0) >> 31 in Q0
|
||||
MUL32x32INTO32(pBiquadState->coefs[1],*pDataIn,templ,31)
|
||||
ynL+=templ;
|
||||
|
||||
// ynL+= (-B1 (Q31) * y(n-1)L (Q0) ) >> 31 in Q0
|
||||
MUL32x32INTO32(pBiquadState->coefs[2],pBiquadState->pDelays[1],templ,31)
|
||||
ynL+=templ;
|
||||
|
||||
/**************************************************************************
|
||||
UPDATING THE DELAYS
|
||||
***************************************************************************/
|
||||
pBiquadState->pDelays[1]=ynL; // Update y(n-1)L in Q0
|
||||
pBiquadState->pDelays[0]=(*pDataIn++); // Update x(n-1)L in Q0
|
||||
|
||||
/**************************************************************************
|
||||
WRITING THE OUTPUT
|
||||
***************************************************************************/
|
||||
*pDataOut++=(LVM_INT32)ynL; // Write Left output in Q0
|
||||
}
|
||||
|
||||
}
|
||||
|
66
media/libeffects/lvm/lib/Common/src/FO_1I_D32F32Cll_TRC_WRA_01_Init.c
Executable file
66
media/libeffects/lvm/lib/Common/src/FO_1I_D32F32Cll_TRC_WRA_01_Init.c
Executable file
@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* Project:: */
|
||||
/* $Author: beq07716 $*/
|
||||
/* $Revision: 1000 $*/
|
||||
/* $Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $*/
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
#include "BIQUAD.h"
|
||||
#include "FO_1I_D32F32Cll_TRC_WRA_01_Private.h"
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* FUNCTION: */
|
||||
/* FO_1I_D32F32Cll_TRC_WRA_01_Init */
|
||||
/* */
|
||||
/* DESCRIPTION: */
|
||||
/* These functions initializes a BIQUAD filter defined as a cascade of */
|
||||
/* biquadratic Filter Sections. */
|
||||
/* */
|
||||
/* PARAMETERS: */
|
||||
/* pInstance - output, returns the pointer to the State Variable */
|
||||
/* This state pointer must be passed to any subsequent */
|
||||
/* call to "Biquad" functions. */
|
||||
/* pTaps - input, pointer to the taps memory */
|
||||
/* pCoef - input, pointer to the coefficient structure */
|
||||
/* N - M coefficient factor of QM.N */
|
||||
/* RETURNS: */
|
||||
/* void return code */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
void FO_1I_D32F32Cll_TRC_WRA_01_Init( Biquad_Instance_t *pInstance,
|
||||
Biquad_1I_Order1_Taps_t *pTaps,
|
||||
FO_C32_Coefs_t *pCoef)
|
||||
{
|
||||
LVM_INT32 temp;
|
||||
PFilter_State pBiquadState = (PFilter_State) pInstance;
|
||||
pBiquadState->pDelays = (LVM_INT32 *) pTaps;
|
||||
|
||||
temp=pCoef->A1;
|
||||
pBiquadState->coefs[0]=temp;
|
||||
temp=pCoef->A0;
|
||||
pBiquadState->coefs[1]=temp;
|
||||
temp=pCoef->B1;
|
||||
pBiquadState->coefs[2]=temp;
|
||||
}
|
||||
/*------------------------------------------------*/
|
||||
/* End Of File: FO_1I_D32F32Cll_TRC_WRA_01_Init.c */
|
||||
|
41
media/libeffects/lvm/lib/Common/src/FO_1I_D32F32Cll_TRC_WRA_01_Private.h
Executable file
41
media/libeffects/lvm/lib/Common/src/FO_1I_D32F32Cll_TRC_WRA_01_Private.h
Executable file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* Project:: */
|
||||
/* $Author: beq07716 $*/
|
||||
/* $Revision: 1000 $*/
|
||||
/* $Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $*/
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
#ifndef _FO_1I_D32F32CLL_TRC_WRA_01_PRIVATE_H_
|
||||
#define _FO_1I_D32F32CLL_TRC_WRA_01_PRIVATE_H_
|
||||
|
||||
|
||||
/* The internal state variables are implemented in a (for the user) hidden structure */
|
||||
/* In this (private) file, the internal structure is declared fro private use. */
|
||||
typedef struct _Filter_State_
|
||||
{
|
||||
LVM_INT32 * pDelays; /* pointer to the delayed samples (data of 32 bits) */
|
||||
LVM_INT32 coefs[3]; /* pointer to the filter coefficients */
|
||||
}Filter_State;
|
||||
|
||||
typedef Filter_State * PFilter_State ;
|
||||
|
||||
#endif /* _FO_1I_D32F32CLL_TRC_WRA_01_PRIVATE_H_ */
|
137
media/libeffects/lvm/lib/Common/src/FO_2I_D16F32C15_LShx_TRC_WRA_01.c
Executable file
137
media/libeffects/lvm/lib/Common/src/FO_2I_D16F32C15_LShx_TRC_WRA_01.c
Executable file
@ -0,0 +1,137 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* Project:: */
|
||||
/* $Author: beq07716 $*/
|
||||
/* $Revision: 1000 $*/
|
||||
/* $Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $*/
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
#include "BIQUAD.h"
|
||||
#include "FO_2I_D16F32Css_LShx_TRC_WRA_01_Private.h"
|
||||
#include "LVM_Macros.h"
|
||||
|
||||
/**************************************************************************
|
||||
ASSUMPTIONS:
|
||||
COEFS-
|
||||
pBiquadState->coefs[0] is A1,
|
||||
pBiquadState->coefs[1] is A0,
|
||||
pBiquadState->coefs[2] is -B1, these are in Q15 format
|
||||
pBiquadState->Shift is Shift value
|
||||
DELAYS-
|
||||
pBiquadState->pDelays[0] is x(n-1)L in Q15 format
|
||||
pBiquadState->pDelays[1] is y(n-1)L in Q30 format
|
||||
pBiquadState->pDelays[2] is x(n-1)R in Q15 format
|
||||
pBiquadState->pDelays[3] is y(n-1)R in Q30 format
|
||||
***************************************************************************/
|
||||
|
||||
void FO_2I_D16F32C15_LShx_TRC_WRA_01(Biquad_Instance_t *pInstance,
|
||||
LVM_INT16 *pDataIn,
|
||||
LVM_INT16 *pDataOut,
|
||||
LVM_INT16 NrSamples)
|
||||
{
|
||||
LVM_INT32 ynL,ynR;
|
||||
LVM_INT32 Temp;
|
||||
LVM_INT32 NegSatValue;
|
||||
LVM_INT16 ii;
|
||||
LVM_INT16 Shift;
|
||||
PFilter_State pBiquadState = (PFilter_State) pInstance;
|
||||
|
||||
NegSatValue = LVM_MAXINT_16 +1;
|
||||
NegSatValue = -NegSatValue;
|
||||
|
||||
Shift = pBiquadState->Shift;
|
||||
|
||||
|
||||
for (ii = NrSamples; ii != 0; ii--)
|
||||
{
|
||||
|
||||
/**************************************************************************
|
||||
PROCESSING OF THE LEFT CHANNEL
|
||||
***************************************************************************/
|
||||
|
||||
// ynL =A1 (Q15) * x(n-1)L (Q15) in Q30
|
||||
ynL=(LVM_INT32)pBiquadState->coefs[0]* pBiquadState->pDelays[0];
|
||||
// ynR =A1 (Q15) * x(n-1)R (Q15) in Q30
|
||||
ynR=(LVM_INT32)pBiquadState->coefs[0]* pBiquadState->pDelays[2];
|
||||
|
||||
|
||||
// ynL+=A0 (Q15) * x(n)L (Q15) in Q30
|
||||
ynL+=(LVM_INT32)pBiquadState->coefs[1]* (*pDataIn);
|
||||
// ynR+=A0 (Q15) * x(n)L (Q15) in Q30
|
||||
ynR+=(LVM_INT32)pBiquadState->coefs[1]* (*(pDataIn+1));
|
||||
|
||||
|
||||
// ynL += (-B1 (Q15) * y(n-1)L (Q30) ) in Q30
|
||||
MUL32x16INTO32(pBiquadState->pDelays[1],pBiquadState->coefs[2],Temp,15);
|
||||
ynL +=Temp;
|
||||
// ynR += (-B1 (Q15) * y(n-1)R (Q30) ) in Q30
|
||||
MUL32x16INTO32(pBiquadState->pDelays[3],pBiquadState->coefs[2],Temp,15);
|
||||
ynR +=Temp;
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
UPDATING THE DELAYS
|
||||
***************************************************************************/
|
||||
pBiquadState->pDelays[1]=ynL; // Update y(n-1)L in Q30
|
||||
pBiquadState->pDelays[0]=(*pDataIn++); // Update x(n-1)L in Q15
|
||||
|
||||
pBiquadState->pDelays[3]=ynR; // Update y(n-1)R in Q30
|
||||
pBiquadState->pDelays[2]=(*pDataIn++); // Update x(n-1)R in Q15
|
||||
|
||||
/**************************************************************************
|
||||
WRITING THE OUTPUT
|
||||
***************************************************************************/
|
||||
/*Apply shift: Instead of left shift on 16-bit result, right shift of (15-shift) is applied
|
||||
for better SNR*/
|
||||
ynL = ynL>>(15-Shift);
|
||||
ynR = ynR>>(15-Shift);
|
||||
|
||||
/*Saturate results*/
|
||||
if(ynL > LVM_MAXINT_16)
|
||||
{
|
||||
ynL = LVM_MAXINT_16;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(ynL < NegSatValue)
|
||||
{
|
||||
ynL = NegSatValue;
|
||||
}
|
||||
}
|
||||
|
||||
if(ynR > LVM_MAXINT_16)
|
||||
{
|
||||
ynR = LVM_MAXINT_16;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(ynR < NegSatValue)
|
||||
{
|
||||
ynR = NegSatValue;
|
||||
}
|
||||
}
|
||||
|
||||
*pDataOut++=(LVM_INT16)ynL;
|
||||
*pDataOut++=(LVM_INT16)ynR;
|
||||
}
|
||||
|
||||
}
|
||||
|
65
media/libeffects/lvm/lib/Common/src/FO_2I_D16F32Css_LShx_TRC_WRA_01_Init.c
Executable file
65
media/libeffects/lvm/lib/Common/src/FO_2I_D16F32Css_LShx_TRC_WRA_01_Init.c
Executable file
@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* */
|
||||
/* $Author: beq07716 $*/
|
||||
/* $Revision: 1000 $*/
|
||||
/* $Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $*/
|
||||
/* */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
#include "BIQUAD.h"
|
||||
#include "FO_2I_D16F32Css_LShx_TRC_WRA_01_Private.h"
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* FUNCTION: */
|
||||
/* FO_2I_D16F32Css_LShx_TRC_WRA_01_Init */
|
||||
/* */
|
||||
/* DESCRIPTION: */
|
||||
/* These functions initializes a BIQUAD filter defined as a cascade of */
|
||||
/* biquadratic Filter Sections. */
|
||||
/* */
|
||||
/* PARAMETERS: */
|
||||
/* pInstance - output, returns the pointer to the State Variable */
|
||||
/* This state pointer must be passed to any subsequent */
|
||||
/* call to "Biquad" functions. */
|
||||
/* pTaps - input, pointer to the taps memory */
|
||||
/* pCoef - input, pointer to the coefficient structure */
|
||||
/* N - M coefficient factor of QM.N */
|
||||
/* RETURNS: */
|
||||
/* void return code */
|
||||
/*-------------------------------------------------------------------------*/
|
||||
void FO_2I_D16F32Css_LShx_TRC_WRA_01_Init(Biquad_Instance_t *pInstance,
|
||||
Biquad_2I_Order1_Taps_t *pTaps,
|
||||
FO_C16_LShx_Coefs_t *pCoef)
|
||||
{
|
||||
LVM_INT16 temp;
|
||||
PFilter_State pBiquadState = (PFilter_State) pInstance;
|
||||
pBiquadState->pDelays =(LVM_INT32 *) pTaps ;
|
||||
|
||||
temp=pCoef->A1;
|
||||
pBiquadState->coefs[0]=temp;
|
||||
temp=pCoef->A0;
|
||||
pBiquadState->coefs[1]=temp;
|
||||
temp=pCoef->B1;
|
||||
pBiquadState->coefs[2]=temp;
|
||||
|
||||
temp=pCoef->Shift;
|
||||
pBiquadState->Shift = temp;
|
||||
}
|
||||
/*-------------------------------------------------------------------------*/
|
||||
/* End Of File: FO_2I_D16F32Css_LShx_TRC_WRA_01_Init.c */
|
||||
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef _FO_2I_D16F32CSS_LSHX_TRC_WRA_01_PRIVATE_H_
|
||||
#define _FO_2I_D16F32CSS_LSHX_TRC_WRA_01_PRIVATE_H_
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* Project:: */
|
||||
/* $Author: beq07716 $*/
|
||||
/* $Revision: 1000 $*/
|
||||
/* $Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $*/
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
/* The internal state variables are implemented in a (for the user) hidden structure */
|
||||
/* In this (private) file, the internal structure is declared fro private use. */
|
||||
typedef struct _Filter_State_
|
||||
{
|
||||
LVM_INT32 *pDelays; /* pointer to the delayed samples (data of 32 bits) */
|
||||
LVM_INT16 coefs[3]; /* pointer to the filter coefficients */
|
||||
LVM_INT16 Shift; /* Shift value*/
|
||||
}Filter_State;
|
||||
|
||||
typedef Filter_State * PFilter_State ;
|
||||
|
||||
#endif /* _FO_2I_D16F32CSS_LSHX_TRC_WRA_01_PRIVATE_H_ */
|
74
media/libeffects/lvm/lib/Common/src/Filters.h
Executable file
74
media/libeffects/lvm/lib/Common/src/Filters.h
Executable file
@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/************************************************************************************
|
||||
|
||||
$Author: beq07716 $
|
||||
$Revision: 1001 $
|
||||
$Date: 2010-06-28 13:23:02 +0200 (Mon, 28 Jun 2010) $
|
||||
|
||||
*************************************************************************************/
|
||||
|
||||
#ifndef FILTERS_H
|
||||
#define FILTERS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include "LVM_Types.h"
|
||||
|
||||
/************************************************************************************/
|
||||
/* */
|
||||
/* Structures */
|
||||
/* */
|
||||
/************************************************************************************/
|
||||
|
||||
/*
|
||||
* Biquad with coefficients A0, A1, A2, B1 and B2 coefficients
|
||||
*/
|
||||
/* Single precision (16-bit) Biquad section coefficients */
|
||||
typedef struct
|
||||
{
|
||||
LVM_INT16 A0;
|
||||
LVM_INT16 A1;
|
||||
LVM_INT16 A2;
|
||||
LVM_INT16 B1;
|
||||
LVM_INT16 B2;
|
||||
LVM_UINT16 Scale;
|
||||
} BiquadA012B12CoefsSP_t;
|
||||
|
||||
|
||||
/*
|
||||
* Biquad with coefficients A0, A1 and B1 coefficients
|
||||
*/
|
||||
/* Single precision (16-bit) Biquad section coefficients */
|
||||
typedef struct
|
||||
{
|
||||
LVM_INT16 A0;
|
||||
LVM_INT16 A1;
|
||||
LVM_INT16 B1;
|
||||
LVM_UINT16 Scale;
|
||||
} BiquadA01B1CoefsSP_t;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* FILTERS_H */
|
||||
|
65
media/libeffects/lvm/lib/Common/src/From2iToMS_16x16.c
Executable file
65
media/libeffects/lvm/lib/Common/src/From2iToMS_16x16.c
Executable file
@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**********************************************************************************
|
||||
|
||||
$Author: beq07716 $
|
||||
$Revision: 1000 $
|
||||
$Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $
|
||||
|
||||
***********************************************************************************/
|
||||
|
||||
/**********************************************************************************
|
||||
INCLUDE FILES
|
||||
***********************************************************************************/
|
||||
|
||||
#include "VectorArithmetic.h"
|
||||
|
||||
/**********************************************************************************
|
||||
FUNCTION From2iToMS_16x16
|
||||
***********************************************************************************/
|
||||
|
||||
void From2iToMS_16x16( const LVM_INT16 *src,
|
||||
LVM_INT16 *dstM,
|
||||
LVM_INT16 *dstS,
|
||||
LVM_INT16 n )
|
||||
{
|
||||
LVM_INT32 temp1,left,right;
|
||||
LVM_INT16 ii;
|
||||
for (ii = n; ii != 0; ii--)
|
||||
{
|
||||
left = (LVM_INT32)*src;
|
||||
src++;
|
||||
|
||||
right = (LVM_INT32)*src;
|
||||
src++;
|
||||
|
||||
/* Compute M signal*/
|
||||
temp1 = (left+right)>>1;
|
||||
*dstM = (LVM_INT16)temp1;
|
||||
dstM++;
|
||||
|
||||
/* Compute S signal*/
|
||||
temp1 = (left-right)>>1;
|
||||
*dstS = (LVM_INT16)temp1;
|
||||
dstS++;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**********************************************************************************/
|
57
media/libeffects/lvm/lib/Common/src/From2iToMono_16.c
Executable file
57
media/libeffects/lvm/lib/Common/src/From2iToMono_16.c
Executable file
@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**********************************************************************************
|
||||
|
||||
$Author: beq07716 $
|
||||
$Revision: 1000 $
|
||||
$Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $
|
||||
|
||||
***********************************************************************************/
|
||||
|
||||
/**********************************************************************************
|
||||
INCLUDE FILES
|
||||
***********************************************************************************/
|
||||
|
||||
#include "VectorArithmetic.h"
|
||||
|
||||
/**********************************************************************************
|
||||
FUNCTION From2iToMono_16
|
||||
***********************************************************************************/
|
||||
|
||||
void From2iToMono_16( const LVM_INT16 *src,
|
||||
LVM_INT16 *dst,
|
||||
LVM_INT16 n)
|
||||
{
|
||||
LVM_INT16 ii;
|
||||
LVM_INT32 Temp;
|
||||
for (ii = n; ii != 0; ii--)
|
||||
{
|
||||
Temp = (LVM_INT32)*src;
|
||||
src++;
|
||||
|
||||
Temp += (LVM_INT32)*src;
|
||||
src++;
|
||||
|
||||
*dst = (LVM_INT16)(Temp >>1);
|
||||
dst++;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**********************************************************************************/
|
58
media/libeffects/lvm/lib/Common/src/From2iToMono_32.c
Executable file
58
media/libeffects/lvm/lib/Common/src/From2iToMono_32.c
Executable file
@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**********************************************************************************
|
||||
|
||||
$Author: beq07716 $
|
||||
$Revision: 1000 $
|
||||
$Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $
|
||||
|
||||
***********************************************************************************/
|
||||
|
||||
/**********************************************************************************
|
||||
INCLUDE FILES
|
||||
***********************************************************************************/
|
||||
|
||||
#include "VectorArithmetic.h"
|
||||
|
||||
/**********************************************************************************
|
||||
FUNCTION From2iToMono_32
|
||||
***********************************************************************************/
|
||||
|
||||
void From2iToMono_32( const LVM_INT32 *src,
|
||||
LVM_INT32 *dst,
|
||||
LVM_INT16 n)
|
||||
{
|
||||
LVM_INT16 ii;
|
||||
LVM_INT32 Temp;
|
||||
|
||||
for (ii = n; ii != 0; ii--)
|
||||
{
|
||||
Temp = (*src>>1);
|
||||
src++;
|
||||
|
||||
Temp +=(*src>>1);
|
||||
src++;
|
||||
|
||||
*dst = Temp;
|
||||
dst++;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**********************************************************************************/
|
194
media/libeffects/lvm/lib/Common/src/InstAlloc.c
Executable file
194
media/libeffects/lvm/lib/Common/src/InstAlloc.c
Executable file
@ -0,0 +1,194 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* $Author: beq07716 $*/
|
||||
/* $Revision: 1000 $*/
|
||||
/* $Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $*/
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
#include "InstAlloc.h"
|
||||
|
||||
/****************************************************************************************
|
||||
* Name : InstAlloc_Init()
|
||||
* Input : pms - Pointer to the INST_ALLOC instance
|
||||
StartAddr - Base address of the instance memory
|
||||
* Returns : Error code
|
||||
* Description : Initializes the instance distribution and memory size calculation function
|
||||
* Remarks :
|
||||
****************************************************************************************/
|
||||
|
||||
void InstAlloc_Init( INST_ALLOC *pms,
|
||||
void *StartAddr )
|
||||
{
|
||||
pms->TotalSize = 3;
|
||||
pms->pNextMember = (LVM_UINT32)(((LVM_UINT32)StartAddr + 3) & 0xFFFFFFFC);/* This code will fail if the platform address space is more than 32-bits*/
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************************
|
||||
* Name : InstAlloc_AddMember()
|
||||
* Input : pms - Pointer to the INST_ALLOC instance
|
||||
Size - The size in bytes of the new added member
|
||||
* Returns : A pointer to the new added member
|
||||
* Description : Allocates space for a new member in the instance memory and returns
|
||||
a pointer to this new member. The start address of all members will
|
||||
be 32 bit alligned.
|
||||
* Remarks :
|
||||
****************************************************************************************/
|
||||
|
||||
void* InstAlloc_AddMember( INST_ALLOC *pms,
|
||||
LVM_UINT32 Size )
|
||||
{
|
||||
void *NewMemberAddress; /* Variable to temporarily store the return value */
|
||||
NewMemberAddress = (void*)pms->pNextMember;
|
||||
|
||||
Size = ((Size + 3) & 0xFFFFFFFC); /* Ceil the size to a multiple of four */
|
||||
|
||||
pms->TotalSize += Size;
|
||||
pms->pNextMember += Size;
|
||||
|
||||
return(NewMemberAddress);
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************************
|
||||
* Name : InstAlloc_GetTotal()
|
||||
* Input : pms - Pointer to the INST_ALLOC instance
|
||||
* Returns : The instance memory size
|
||||
* Description : This functions returns the calculated instance memory size
|
||||
* Remarks :
|
||||
****************************************************************************************/
|
||||
|
||||
LVM_UINT32 InstAlloc_GetTotal( INST_ALLOC *pms)
|
||||
{
|
||||
if (pms->TotalSize > 3)
|
||||
{
|
||||
return(pms->TotalSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0; /* No memory added */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void InstAlloc_InitAll( INST_ALLOC *pms,
|
||||
LVM_MemoryTable_st *pMemoryTable)
|
||||
{
|
||||
LVM_UINT32 StartAddr;
|
||||
|
||||
StartAddr = (LVM_UINT32)pMemoryTable->Region[LVM_PERSISTENT_SLOW_DATA].pBaseAddress;
|
||||
|
||||
pms[0].TotalSize = 3;
|
||||
pms[0].pNextMember = (LVM_UINT32)(((LVM_UINT32)StartAddr + 3) & 0xFFFFFFFC);
|
||||
|
||||
|
||||
StartAddr = (LVM_UINT32)pMemoryTable->Region[LVM_PERSISTENT_FAST_DATA].pBaseAddress;
|
||||
|
||||
pms[1].TotalSize = 3;
|
||||
pms[1].pNextMember = (LVM_UINT32)(((LVM_UINT32)StartAddr + 3) & 0xFFFFFFFC);
|
||||
|
||||
|
||||
StartAddr = (LVM_UINT32)pMemoryTable->Region[LVM_PERSISTENT_FAST_COEF].pBaseAddress;
|
||||
|
||||
pms[2].TotalSize = 3;
|
||||
pms[2].pNextMember = (LVM_UINT32)(((LVM_UINT32)StartAddr + 3) & 0xFFFFFFFC);
|
||||
|
||||
|
||||
StartAddr = (LVM_UINT32)pMemoryTable->Region[LVM_TEMPORARY_FAST].pBaseAddress;
|
||||
|
||||
pms[3].TotalSize = 3;
|
||||
pms[3].pNextMember = (LVM_UINT32)(((LVM_UINT32)StartAddr + 3) & 0xFFFFFFFC);
|
||||
|
||||
}
|
||||
|
||||
/****************************************************************************************
|
||||
* Name : InstAlloc_InitAll_NULL()
|
||||
* Input : pms - Pointer to array of four INST_ALLOC instances
|
||||
* Returns : Nothing
|
||||
* Description : This function reserves Size of 3 bytes for all memory regions and
|
||||
* intializes pNextMember for all regions to 0
|
||||
* Remarks :
|
||||
****************************************************************************************/
|
||||
|
||||
void InstAlloc_InitAll_NULL( INST_ALLOC *pms)
|
||||
{
|
||||
pms[0].TotalSize = 3;
|
||||
pms[0].pNextMember = 0;
|
||||
|
||||
|
||||
pms[1].TotalSize = 3;
|
||||
pms[1].pNextMember = 0;
|
||||
|
||||
pms[2].TotalSize = 3;
|
||||
pms[2].pNextMember = 0;
|
||||
|
||||
pms[3].TotalSize = 3;
|
||||
pms[3].pNextMember = 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void* InstAlloc_AddMemberAll( INST_ALLOC *pms,
|
||||
LVM_UINT32 Size[],
|
||||
LVM_MemoryTable_st *pMemoryTable)
|
||||
{
|
||||
void *NewMemberAddress; /* Variable to temporarily store the return value */
|
||||
|
||||
/* coverity[returned_pointer] Ignore coverity warning that ptr is not used */
|
||||
NewMemberAddress = InstAlloc_AddMember(&pms[LVM_PERSISTENT_SLOW_DATA], Size[LVM_PERSISTENT_SLOW_DATA]);
|
||||
|
||||
pMemoryTable->Region[LVM_PERSISTENT_SLOW_DATA].Size = InstAlloc_GetTotal(&pms[LVM_PERSISTENT_SLOW_DATA]);
|
||||
pMemoryTable->Region[LVM_PERSISTENT_SLOW_DATA].Type = LVM_PERSISTENT_SLOW_DATA;
|
||||
pMemoryTable->Region[LVM_PERSISTENT_SLOW_DATA].pBaseAddress = LVM_NULL;
|
||||
|
||||
NewMemberAddress = InstAlloc_AddMember(&pms[LVM_PERSISTENT_FAST_DATA], Size[LVM_PERSISTENT_FAST_DATA]);
|
||||
|
||||
pMemoryTable->Region[LVM_PERSISTENT_FAST_DATA].Size = InstAlloc_GetTotal(&pms[LVM_PERSISTENT_FAST_DATA]);
|
||||
pMemoryTable->Region[LVM_PERSISTENT_FAST_DATA].Type = LVM_PERSISTENT_FAST_DATA;
|
||||
pMemoryTable->Region[LVM_PERSISTENT_FAST_DATA].pBaseAddress = LVM_NULL;
|
||||
|
||||
NewMemberAddress = InstAlloc_AddMember(&pms[LVM_PERSISTENT_FAST_COEF], Size[LVM_PERSISTENT_FAST_COEF]);
|
||||
|
||||
pMemoryTable->Region[LVM_PERSISTENT_FAST_COEF].Size = InstAlloc_GetTotal(&pms[LVM_PERSISTENT_FAST_COEF]);
|
||||
pMemoryTable->Region[LVM_PERSISTENT_FAST_COEF].Type = LVM_PERSISTENT_FAST_COEF;
|
||||
pMemoryTable->Region[LVM_PERSISTENT_FAST_COEF].pBaseAddress = LVM_NULL;
|
||||
|
||||
NewMemberAddress = InstAlloc_AddMember(&pms[LVM_TEMPORARY_FAST], Size[LVM_TEMPORARY_FAST]);
|
||||
|
||||
pMemoryTable->Region[LVM_TEMPORARY_FAST].Size = InstAlloc_GetTotal(&pms[LVM_TEMPORARY_FAST]);
|
||||
pMemoryTable->Region[LVM_TEMPORARY_FAST].Type = LVM_TEMPORARY_FAST;
|
||||
pMemoryTable->Region[LVM_TEMPORARY_FAST].pBaseAddress = LVM_NULL;
|
||||
|
||||
return(NewMemberAddress);
|
||||
}
|
||||
|
||||
|
||||
void* InstAlloc_AddMemberAllRet( INST_ALLOC *pms,
|
||||
LVM_UINT32 Size[],
|
||||
void **ptr)
|
||||
{
|
||||
ptr[0] = InstAlloc_AddMember(&pms[LVM_PERSISTENT_SLOW_DATA], Size[LVM_PERSISTENT_SLOW_DATA]);
|
||||
ptr[1] = InstAlloc_AddMember(&pms[LVM_PERSISTENT_FAST_DATA], Size[LVM_PERSISTENT_FAST_DATA]);
|
||||
ptr[2] = InstAlloc_AddMember(&pms[LVM_PERSISTENT_FAST_COEF], Size[LVM_PERSISTENT_FAST_COEF]);
|
||||
ptr[3] = InstAlloc_AddMember(&pms[LVM_TEMPORARY_FAST], Size[LVM_TEMPORARY_FAST]);
|
||||
|
||||
return (ptr[0]);
|
||||
}
|
56
media/libeffects/lvm/lib/Common/src/Int16LShiftToInt32_16x32.c
Executable file
56
media/libeffects/lvm/lib/Common/src/Int16LShiftToInt32_16x32.c
Executable file
@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**********************************************************************************
|
||||
|
||||
$Author: beq07716 $
|
||||
$Revision: 1000 $
|
||||
$Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $
|
||||
|
||||
***********************************************************************************/
|
||||
|
||||
/**********************************************************************************
|
||||
INCLUDE FILES
|
||||
***********************************************************************************/
|
||||
|
||||
#include "VectorArithmetic.h"
|
||||
|
||||
/**********************************************************************************
|
||||
FUNCTION INT16LSHIFTTOINT32_16X32
|
||||
***********************************************************************************/
|
||||
|
||||
void Int16LShiftToInt32_16x32(const LVM_INT16 *src,
|
||||
LVM_INT32 *dst,
|
||||
LVM_INT16 n,
|
||||
LVM_INT16 shift )
|
||||
{
|
||||
LVM_INT16 ii;
|
||||
|
||||
src += n-1;
|
||||
dst += n-1;
|
||||
|
||||
for (ii = n; ii != 0; ii--)
|
||||
{
|
||||
*dst = ( ((LVM_INT32)*src) << shift);
|
||||
src--;
|
||||
dst--;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**********************************************************************************/
|
68
media/libeffects/lvm/lib/Common/src/Int32RShiftToInt16_Sat_32x16.c
Executable file
68
media/libeffects/lvm/lib/Common/src/Int32RShiftToInt16_Sat_32x16.c
Executable file
@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**********************************************************************************
|
||||
|
||||
$Author: beq07716 $
|
||||
$Revision: 1000 $
|
||||
$Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $
|
||||
|
||||
***********************************************************************************/
|
||||
|
||||
/**********************************************************************************
|
||||
INCLUDE FILES
|
||||
***********************************************************************************/
|
||||
|
||||
#include "VectorArithmetic.h"
|
||||
|
||||
/**********************************************************************************
|
||||
FUNCTION INT32RSHIFTTOINT16_SAT_32X16
|
||||
***********************************************************************************/
|
||||
|
||||
void Int32RShiftToInt16_Sat_32x16(const LVM_INT32 *src,
|
||||
LVM_INT16 *dst,
|
||||
LVM_INT16 n,
|
||||
LVM_INT16 shift )
|
||||
{
|
||||
LVM_INT32 temp;
|
||||
LVM_INT16 ii;
|
||||
|
||||
for (ii = n; ii != 0; ii--)
|
||||
{
|
||||
temp = *src >> shift;
|
||||
src++;
|
||||
|
||||
if (temp > 0x00007FFF)
|
||||
{
|
||||
*dst = 0x7FFF;
|
||||
}
|
||||
else if (temp < -0x00008000)
|
||||
{
|
||||
*dst = - 0x8000;
|
||||
}
|
||||
else
|
||||
{
|
||||
*dst = (LVM_INT16)temp;
|
||||
}
|
||||
|
||||
dst++;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**********************************************************************************/
|
63
media/libeffects/lvm/lib/Common/src/JoinTo2i_32x32.c
Executable file
63
media/libeffects/lvm/lib/Common/src/JoinTo2i_32x32.c
Executable file
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* Project:: */
|
||||
/* $Author: beq07716 $*/
|
||||
/* $Revision: 1000 $*/
|
||||
/* $Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $*/
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
/**********************************************************************************
|
||||
INCLUDE FILES
|
||||
***********************************************************************************/
|
||||
|
||||
#include "VectorArithmetic.h"
|
||||
|
||||
/**********************************************************************************
|
||||
FUNCTION JoinTo2i_32x32
|
||||
***********************************************************************************/
|
||||
|
||||
void JoinTo2i_32x32( const LVM_INT32 *srcL,
|
||||
const LVM_INT32 *srcR,
|
||||
LVM_INT32 *dst,
|
||||
LVM_INT16 n )
|
||||
{
|
||||
LVM_INT16 ii;
|
||||
|
||||
srcL += n-1;
|
||||
srcR += n-1;
|
||||
dst += ((2*n)-1);
|
||||
|
||||
for (ii = n; ii != 0; ii--)
|
||||
{
|
||||
*dst = *srcR;
|
||||
dst--;
|
||||
srcR--;
|
||||
|
||||
*dst = *srcL;
|
||||
dst--;
|
||||
srcL--;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**********************************************************************************/
|
||||
|
77
media/libeffects/lvm/lib/Common/src/LVC_Core_MixHard_1St_2i_D16C31_SAT.c
Executable file
77
media/libeffects/lvm/lib/Common/src/LVC_Core_MixHard_1St_2i_D16C31_SAT.c
Executable file
@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**********************************************************************************
|
||||
|
||||
$Author: beq07716 $
|
||||
$Revision: 1000 $
|
||||
$Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $
|
||||
|
||||
***********************************************************************************/
|
||||
|
||||
/**********************************************************************************
|
||||
INCLUDE FILES
|
||||
***********************************************************************************/
|
||||
|
||||
#include "LVC_Mixer_Private.h"
|
||||
#include "LVM_Macros.h"
|
||||
#include "ScalarArithmetic.h"
|
||||
|
||||
|
||||
/**********************************************************************************
|
||||
FUNCTION LVC_Core_MixHard_1St_2i_D16C31_SAT
|
||||
***********************************************************************************/
|
||||
|
||||
void LVC_Core_MixHard_1St_2i_D16C31_SAT( LVMixer3_st *ptrInstance1,
|
||||
LVMixer3_st *ptrInstance2,
|
||||
const LVM_INT16 *src,
|
||||
LVM_INT16 *dst,
|
||||
LVM_INT16 n)
|
||||
{
|
||||
LVM_INT32 Temp;
|
||||
LVM_INT16 ii;
|
||||
LVM_INT16 Current1Short;
|
||||
LVM_INT16 Current2Short;
|
||||
Mix_Private_st *pInstance1=(Mix_Private_st *)(ptrInstance1->PrivateParams);
|
||||
Mix_Private_st *pInstance2=(Mix_Private_st *)(ptrInstance2->PrivateParams);
|
||||
|
||||
|
||||
Current1Short = (LVM_INT16)(pInstance1->Current >> 16);
|
||||
Current2Short = (LVM_INT16)(pInstance2->Current >> 16);
|
||||
|
||||
for (ii = n; ii != 0; ii--)
|
||||
{
|
||||
Temp = ((LVM_INT32)*(src++) * (LVM_INT32)Current1Short)>>15;
|
||||
if (Temp > 0x00007FFF)
|
||||
*dst++ = 0x7FFF;
|
||||
else if (Temp < -0x00008000)
|
||||
*dst++ = - 0x8000;
|
||||
else
|
||||
*dst++ = (LVM_INT16)Temp;
|
||||
|
||||
Temp = ((LVM_INT32)*(src++) * (LVM_INT32)Current2Short)>>15;
|
||||
if (Temp > 0x00007FFF)
|
||||
*dst++ = 0x7FFF;
|
||||
else if (Temp < -0x00008000)
|
||||
*dst++ = - 0x8000;
|
||||
else
|
||||
*dst++ = (LVM_INT16)Temp;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
/**********************************************************************************/
|
67
media/libeffects/lvm/lib/Common/src/LVC_Core_MixHard_2St_D16C31_SAT.c
Executable file
67
media/libeffects/lvm/lib/Common/src/LVC_Core_MixHard_2St_D16C31_SAT.c
Executable file
@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**********************************************************************************
|
||||
|
||||
$Author: beq07716 $
|
||||
$Revision: 1000 $
|
||||
$Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $
|
||||
|
||||
***********************************************************************************/
|
||||
|
||||
/**********************************************************************************
|
||||
INCLUDE FILES
|
||||
***********************************************************************************/
|
||||
|
||||
#include "LVC_Mixer_Private.h"
|
||||
|
||||
/**********************************************************************************
|
||||
FUNCTION LVCore_MIXHARD_2ST_D16C31_SAT
|
||||
***********************************************************************************/
|
||||
|
||||
void LVC_Core_MixHard_2St_D16C31_SAT( LVMixer3_st *ptrInstance1,
|
||||
LVMixer3_st *ptrInstance2,
|
||||
const LVM_INT16 *src1,
|
||||
const LVM_INT16 *src2,
|
||||
LVM_INT16 *dst,
|
||||
LVM_INT16 n)
|
||||
{
|
||||
LVM_INT32 Temp;
|
||||
LVM_INT16 ii;
|
||||
LVM_INT16 Current1Short;
|
||||
LVM_INT16 Current2Short;
|
||||
Mix_Private_st *pInstance1=(Mix_Private_st *)(ptrInstance1->PrivateParams);
|
||||
Mix_Private_st *pInstance2=(Mix_Private_st *)(ptrInstance2->PrivateParams);
|
||||
|
||||
|
||||
Current1Short = (LVM_INT16)(pInstance1->Current >> 16);
|
||||
Current2Short = (LVM_INT16)(pInstance2->Current >> 16);
|
||||
|
||||
for (ii = n; ii != 0; ii--){
|
||||
Temp = (((LVM_INT32)*(src1++) * (LVM_INT32)Current1Short)>>15) +
|
||||
(((LVM_INT32)*(src2++) * (LVM_INT32)Current2Short)>>15);
|
||||
if (Temp > 0x00007FFF)
|
||||
*dst++ = 0x7FFF;
|
||||
else if (Temp < -0x00008000)
|
||||
*dst++ = - 0x8000;
|
||||
else
|
||||
*dst++ = (LVM_INT16)Temp;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************************/
|
136
media/libeffects/lvm/lib/Common/src/LVC_Core_MixInSoft_D16C31_SAT.c
Executable file
136
media/libeffects/lvm/lib/Common/src/LVC_Core_MixInSoft_D16C31_SAT.c
Executable file
@ -0,0 +1,136 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**********************************************************************************
|
||||
|
||||
$Author: beq07716 $
|
||||
$Revision: 1000 $
|
||||
$Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $
|
||||
|
||||
***********************************************************************************/
|
||||
|
||||
/**********************************************************************************
|
||||
INCLUDE FILES
|
||||
***********************************************************************************/
|
||||
|
||||
#include "LVC_Mixer_Private.h"
|
||||
#include "LVM_Macros.h"
|
||||
|
||||
/**********************************************************************************
|
||||
FUNCTION LVCore_MIXSOFT_1ST_D16C31_WRA
|
||||
***********************************************************************************/
|
||||
|
||||
void LVC_Core_MixInSoft_D16C31_SAT( LVMixer3_st *ptrInstance,
|
||||
const LVM_INT16 *src,
|
||||
LVM_INT16 *dst,
|
||||
LVM_INT16 n)
|
||||
{
|
||||
|
||||
LVM_INT16 OutLoop;
|
||||
LVM_INT16 InLoop;
|
||||
LVM_INT16 CurrentShort;
|
||||
LVM_INT32 ii,jj;
|
||||
Mix_Private_st *pInstance=(Mix_Private_st *)(ptrInstance->PrivateParams);
|
||||
LVM_INT32 Delta=pInstance->Delta;
|
||||
LVM_INT32 Current=pInstance->Current;
|
||||
LVM_INT32 Target=pInstance->Target;
|
||||
LVM_INT32 Temp;
|
||||
|
||||
InLoop = (LVM_INT16)(n >> 2); /* Process per 4 samples */
|
||||
OutLoop = (LVM_INT16)(n - (InLoop << 2));
|
||||
|
||||
if(Current<Target){
|
||||
if (OutLoop){
|
||||
ADD2_SAT_32x32(Current,Delta,Temp); /* Q31 + Q31 into Q31*/
|
||||
Current=Temp;
|
||||
if (Current > Target)
|
||||
Current = Target;
|
||||
|
||||
CurrentShort = (LVM_INT16)(Current>>16); /* From Q31 to Q15*/
|
||||
|
||||
for (ii = OutLoop; ii != 0; ii--){
|
||||
Temp = ((LVM_INT32)*dst) + (((LVM_INT32)*(src++) * CurrentShort)>>15); /* Q15 + Q15*Q15>>15 into Q15 */
|
||||
if (Temp > 0x00007FFF)
|
||||
*dst++ = 0x7FFF;
|
||||
else if (Temp < -0x00008000)
|
||||
*dst++ = - 0x8000;
|
||||
else
|
||||
*dst++ = (LVM_INT16)Temp;
|
||||
}
|
||||
}
|
||||
|
||||
for (ii = InLoop; ii != 0; ii--){
|
||||
ADD2_SAT_32x32(Current,Delta,Temp); /* Q31 + Q31 into Q31*/
|
||||
Current=Temp;
|
||||
if (Current > Target)
|
||||
Current = Target;
|
||||
|
||||
CurrentShort = (LVM_INT16)(Current>>16); /* From Q31 to Q15*/
|
||||
|
||||
for (jj = 4; jj!=0 ; jj--){
|
||||
Temp = ((LVM_INT32)*dst) + (((LVM_INT32)*(src++) * CurrentShort)>>15); /* Q15 + Q15*Q15>>15 into Q15 */
|
||||
if (Temp > 0x00007FFF)
|
||||
*dst++ = 0x7FFF;
|
||||
else if (Temp < -0x00008000)
|
||||
*dst++ = - 0x8000;
|
||||
else
|
||||
*dst++ = (LVM_INT16)Temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
if (OutLoop){
|
||||
Current -= Delta; /* Q31 + Q31 into Q31*/
|
||||
if (Current < Target)
|
||||
Current = Target;
|
||||
|
||||
CurrentShort = (LVM_INT16)(Current>>16); /* From Q31 to Q15*/
|
||||
|
||||
for (ii = OutLoop; ii != 0; ii--){
|
||||
Temp = ((LVM_INT32)*dst) + (((LVM_INT32)*(src++) * CurrentShort)>>15); /* Q15 + Q15*Q15>>15 into Q15 */
|
||||
if (Temp > 0x00007FFF)
|
||||
*dst++ = 0x7FFF;
|
||||
else if (Temp < -0x00008000)
|
||||
*dst++ = - 0x8000;
|
||||
else
|
||||
*dst++ = (LVM_INT16)Temp;
|
||||
}
|
||||
}
|
||||
|
||||
for (ii = InLoop; ii != 0; ii--){
|
||||
Current -= Delta; /* Q31 + Q31 into Q31*/
|
||||
if (Current < Target)
|
||||
Current = Target;
|
||||
|
||||
CurrentShort = (LVM_INT16)(Current>>16); /* From Q31 to Q15*/
|
||||
|
||||
for (jj = 4; jj!=0 ; jj--){
|
||||
Temp = ((LVM_INT32)*dst) + (((LVM_INT32)*(src++) * CurrentShort)>>15); /* Q15 + Q15*Q15>>15 into Q15 */
|
||||
if (Temp > 0x00007FFF)
|
||||
*dst++ = 0x7FFF;
|
||||
else if (Temp < -0x00008000)
|
||||
*dst++ = - 0x8000;
|
||||
else
|
||||
*dst++ = (LVM_INT16)Temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
pInstance->Current=Current;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************************/
|
151
media/libeffects/lvm/lib/Common/src/LVC_Core_MixSoft_1St_2i_D16C31_WRA.c
Executable file
151
media/libeffects/lvm/lib/Common/src/LVC_Core_MixSoft_1St_2i_D16C31_WRA.c
Executable file
@ -0,0 +1,151 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**********************************************************************************
|
||||
|
||||
$Author: beq07716 $
|
||||
$Revision: 1000 $
|
||||
$Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $
|
||||
|
||||
***********************************************************************************/
|
||||
|
||||
/**********************************************************************************
|
||||
INCLUDE FILES
|
||||
***********************************************************************************/
|
||||
|
||||
#include "LVC_Mixer_Private.h"
|
||||
#include "ScalarArithmetic.h"
|
||||
#include "LVM_Macros.h"
|
||||
|
||||
/**********************************************************************************
|
||||
FUNCTION LVC_Core_MixSoft_1St_2i_D16C31_WRA
|
||||
***********************************************************************************/
|
||||
|
||||
void LVC_Core_MixSoft_1St_2i_D16C31_WRA( LVMixer3_st *ptrInstance1,
|
||||
LVMixer3_st *ptrInstance2,
|
||||
const LVM_INT16 *src,
|
||||
LVM_INT16 *dst,
|
||||
LVM_INT16 n)
|
||||
{
|
||||
LVM_INT16 OutLoop;
|
||||
LVM_INT16 InLoop;
|
||||
LVM_INT16 CurrentShortL;
|
||||
LVM_INT16 CurrentShortR;
|
||||
LVM_INT32 ii;
|
||||
Mix_Private_st *pInstanceL=(Mix_Private_st *)(ptrInstance1->PrivateParams);
|
||||
Mix_Private_st *pInstanceR=(Mix_Private_st *)(ptrInstance2->PrivateParams);
|
||||
|
||||
LVM_INT32 DeltaL=pInstanceL->Delta;
|
||||
LVM_INT32 CurrentL=pInstanceL->Current;
|
||||
LVM_INT32 TargetL=pInstanceL->Target;
|
||||
|
||||
LVM_INT32 DeltaR=pInstanceR->Delta;
|
||||
LVM_INT32 CurrentR=pInstanceR->Current;
|
||||
LVM_INT32 TargetR=pInstanceR->Target;
|
||||
|
||||
LVM_INT32 Temp;
|
||||
|
||||
InLoop = (LVM_INT16)(n >> 2); /* Process per 4 samples */
|
||||
OutLoop = (LVM_INT16)(n - (InLoop << 2));
|
||||
|
||||
if (OutLoop)
|
||||
{
|
||||
if(CurrentL<TargetL)
|
||||
{
|
||||
ADD2_SAT_32x32(CurrentL,DeltaL,Temp); /* Q31 + Q31 into Q31*/
|
||||
CurrentL=Temp;
|
||||
if (CurrentL > TargetL)
|
||||
CurrentL = TargetL;
|
||||
}
|
||||
else
|
||||
{
|
||||
CurrentL -= DeltaL; /* Q31 + Q31 into Q31*/
|
||||
if (CurrentL < TargetL)
|
||||
CurrentL = TargetL;
|
||||
}
|
||||
|
||||
if(CurrentR<TargetR)
|
||||
{
|
||||
ADD2_SAT_32x32(CurrentR,DeltaR,Temp); /* Q31 + Q31 into Q31*/
|
||||
CurrentR=Temp;
|
||||
if (CurrentR > TargetR)
|
||||
CurrentR = TargetR;
|
||||
}
|
||||
else
|
||||
{
|
||||
CurrentR -= DeltaR; /* Q31 + Q31 into Q31*/
|
||||
if (CurrentR < TargetR)
|
||||
CurrentR = TargetR;
|
||||
}
|
||||
|
||||
CurrentShortL = (LVM_INT16)(CurrentL>>16); /* From Q31 to Q15*/
|
||||
CurrentShortR = (LVM_INT16)(CurrentR>>16); /* From Q31 to Q15*/
|
||||
|
||||
for (ii = OutLoop*2; ii != 0; ii-=2)
|
||||
{
|
||||
*(dst++) = (LVM_INT16)(((LVM_INT32)*(src++) * (LVM_INT32)CurrentShortL)>>15); /* Q15*Q15>>15 into Q15 */
|
||||
*(dst++) = (LVM_INT16)(((LVM_INT32)*(src++) * (LVM_INT32)CurrentShortR)>>15); /* Q15*Q15>>15 into Q15 */
|
||||
}
|
||||
}
|
||||
|
||||
for (ii = InLoop*2; ii != 0; ii-=2)
|
||||
{
|
||||
if(CurrentL<TargetL)
|
||||
{
|
||||
ADD2_SAT_32x32(CurrentL,DeltaL,Temp); /* Q31 + Q31 into Q31*/
|
||||
CurrentL=Temp;
|
||||
if (CurrentL > TargetL)
|
||||
CurrentL = TargetL;
|
||||
}
|
||||
else
|
||||
{
|
||||
CurrentL -= DeltaL; /* Q31 + Q31 into Q31*/
|
||||
if (CurrentL < TargetL)
|
||||
CurrentL = TargetL;
|
||||
}
|
||||
|
||||
if(CurrentR<TargetR)
|
||||
{
|
||||
ADD2_SAT_32x32(CurrentR,DeltaR,Temp); /* Q31 + Q31 into Q31*/
|
||||
CurrentR=Temp;
|
||||
if (CurrentR > TargetR)
|
||||
CurrentR = TargetR;
|
||||
}
|
||||
else
|
||||
{
|
||||
CurrentR -= DeltaR; /* Q31 + Q31 into Q31*/
|
||||
if (CurrentR < TargetR)
|
||||
CurrentR = TargetR;
|
||||
}
|
||||
|
||||
CurrentShortL = (LVM_INT16)(CurrentL>>16); /* From Q31 to Q15*/
|
||||
CurrentShortR = (LVM_INT16)(CurrentR>>16); /* From Q31 to Q15*/
|
||||
|
||||
*(dst++) = (LVM_INT16)(((LVM_INT32)*(src++) * (LVM_INT32)CurrentShortL)>>15); /* Q15*Q15>>15 into Q15 */
|
||||
*(dst++) = (LVM_INT16)(((LVM_INT32)*(src++) * (LVM_INT32)CurrentShortR)>>15); /* Q15*Q15>>15 into Q15 */
|
||||
*(dst++) = (LVM_INT16)(((LVM_INT32)*(src++) * (LVM_INT32)CurrentShortL)>>15);
|
||||
*(dst++) = (LVM_INT16)(((LVM_INT32)*(src++) * (LVM_INT32)CurrentShortR)>>15);
|
||||
*(dst++) = (LVM_INT16)(((LVM_INT32)*(src++) * (LVM_INT32)CurrentShortL)>>15);
|
||||
*(dst++) = (LVM_INT16)(((LVM_INT32)*(src++) * (LVM_INT32)CurrentShortR)>>15);
|
||||
*(dst++) = (LVM_INT16)(((LVM_INT32)*(src++) * (LVM_INT32)CurrentShortL)>>15);
|
||||
*(dst++) = (LVM_INT16)(((LVM_INT32)*(src++) * (LVM_INT32)CurrentShortR)>>15);
|
||||
}
|
||||
pInstanceL->Current=CurrentL;
|
||||
pInstanceR->Current=CurrentR;
|
||||
|
||||
}
|
||||
/**********************************************************************************/
|
114
media/libeffects/lvm/lib/Common/src/LVC_Core_MixSoft_1St_D16C31_WRA.c
Executable file
114
media/libeffects/lvm/lib/Common/src/LVC_Core_MixSoft_1St_D16C31_WRA.c
Executable file
@ -0,0 +1,114 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**********************************************************************************
|
||||
|
||||
$Author: beq07716 $
|
||||
$Revision: 1000 $
|
||||
$Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $
|
||||
|
||||
***********************************************************************************/
|
||||
|
||||
/**********************************************************************************
|
||||
INCLUDE FILES
|
||||
***********************************************************************************/
|
||||
|
||||
#include "LVC_Mixer_Private.h"
|
||||
#include "LVM_Macros.h"
|
||||
#include "ScalarArithmetic.h"
|
||||
|
||||
/**********************************************************************************
|
||||
FUNCTION LVCore_MIXSOFT_1ST_D16C31_WRA
|
||||
***********************************************************************************/
|
||||
|
||||
void LVC_Core_MixSoft_1St_D16C31_WRA( LVMixer3_st *ptrInstance,
|
||||
const LVM_INT16 *src,
|
||||
LVM_INT16 *dst,
|
||||
LVM_INT16 n)
|
||||
{
|
||||
LVM_INT16 OutLoop;
|
||||
LVM_INT16 InLoop;
|
||||
LVM_INT16 CurrentShort;
|
||||
LVM_INT32 ii;
|
||||
Mix_Private_st *pInstance=(Mix_Private_st *)(ptrInstance->PrivateParams);
|
||||
LVM_INT32 Delta=pInstance->Delta;
|
||||
LVM_INT32 Current=pInstance->Current;
|
||||
LVM_INT32 Target=pInstance->Target;
|
||||
LVM_INT32 Temp;
|
||||
|
||||
InLoop = (LVM_INT16)(n >> 2); /* Process per 4 samples */
|
||||
OutLoop = (LVM_INT16)(n - (InLoop << 2));
|
||||
|
||||
if(Current<Target){
|
||||
if (OutLoop){
|
||||
ADD2_SAT_32x32(Current,Delta,Temp); /* Q31 + Q31 into Q31*/
|
||||
Current=Temp;
|
||||
if (Current > Target)
|
||||
Current = Target;
|
||||
|
||||
CurrentShort = (LVM_INT16)(Current>>16); /* From Q31 to Q15*/
|
||||
|
||||
for (ii = OutLoop; ii != 0; ii--){
|
||||
*(dst++) = (LVM_INT16)(((LVM_INT32)*(src++) * (LVM_INT32)CurrentShort)>>15); /* Q15*Q15>>15 into Q15 */
|
||||
}
|
||||
}
|
||||
|
||||
for (ii = InLoop; ii != 0; ii--){
|
||||
ADD2_SAT_32x32(Current,Delta,Temp); /* Q31 + Q31 into Q31*/
|
||||
Current=Temp;
|
||||
if (Current > Target)
|
||||
Current = Target;
|
||||
|
||||
CurrentShort = (LVM_INT16)(Current>>16); /* From Q31 to Q15*/
|
||||
|
||||
*(dst++) = (LVM_INT16)(((LVM_INT32)*(src++) * (LVM_INT32)CurrentShort)>>15); /* Q15*Q15>>15 into Q15 */
|
||||
*(dst++) = (LVM_INT16)(((LVM_INT32)*(src++) * (LVM_INT32)CurrentShort)>>15);
|
||||
*(dst++) = (LVM_INT16)(((LVM_INT32)*(src++) * (LVM_INT32)CurrentShort)>>15);
|
||||
*(dst++) = (LVM_INT16)(((LVM_INT32)*(src++) * (LVM_INT32)CurrentShort)>>15);
|
||||
}
|
||||
}
|
||||
else{
|
||||
if (OutLoop){
|
||||
Current -= Delta; /* Q31 + Q31 into Q31*/
|
||||
if (Current < Target)
|
||||
Current = Target;
|
||||
|
||||
CurrentShort = (LVM_INT16)(Current>>16); /* From Q31 to Q15*/
|
||||
|
||||
for (ii = OutLoop; ii != 0; ii--){
|
||||
*(dst++) = (LVM_INT16)(((LVM_INT32)*(src++) * (LVM_INT32)CurrentShort)>>15); /* Q15*Q15>>15 into Q15 */
|
||||
}
|
||||
}
|
||||
|
||||
for (ii = InLoop; ii != 0; ii--){
|
||||
Current -= Delta; /* Q31 + Q31 into Q31*/
|
||||
if (Current < Target)
|
||||
Current = Target;
|
||||
|
||||
CurrentShort = (LVM_INT16)(Current>>16); /* From Q31 to Q15*/
|
||||
|
||||
*(dst++) = (LVM_INT16)(((LVM_INT32)*(src++) * (LVM_INT32)CurrentShort)>>15); /* Q15*Q15>>15 into Q15 */
|
||||
*(dst++) = (LVM_INT16)(((LVM_INT32)*(src++) * (LVM_INT32)CurrentShort)>>15);
|
||||
*(dst++) = (LVM_INT16)(((LVM_INT32)*(src++) * (LVM_INT32)CurrentShort)>>15);
|
||||
*(dst++) = (LVM_INT16)(((LVM_INT32)*(src++) * (LVM_INT32)CurrentShort)>>15);
|
||||
}
|
||||
}
|
||||
pInstance->Current=Current;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************************/
|
120
media/libeffects/lvm/lib/Common/src/LVC_MixInSoft_D16C31_SAT.c
Executable file
120
media/libeffects/lvm/lib/Common/src/LVC_MixInSoft_D16C31_SAT.c
Executable file
@ -0,0 +1,120 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**********************************************************************************
|
||||
|
||||
$Author: beq07716 $
|
||||
$Revision: 1000 $
|
||||
$Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $
|
||||
|
||||
***********************************************************************************/
|
||||
|
||||
/**********************************************************************************
|
||||
INCLUDE FILES
|
||||
***********************************************************************************/
|
||||
|
||||
#include "LVC_Mixer_Private.h"
|
||||
#include "VectorArithmetic.h"
|
||||
#include "ScalarArithmetic.h"
|
||||
|
||||
/**********************************************************************************
|
||||
DEFINITIONS
|
||||
***********************************************************************************/
|
||||
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
|
||||
/**********************************************************************************
|
||||
FUNCTION MIXINSOFT_D16C31_SAT
|
||||
***********************************************************************************/
|
||||
|
||||
void LVC_MixInSoft_D16C31_SAT( LVMixer3_1St_st *ptrInstance,
|
||||
LVM_INT16 *src,
|
||||
LVM_INT16 *dst,
|
||||
LVM_INT16 n)
|
||||
{
|
||||
char HardMixing = TRUE;
|
||||
LVM_INT32 TargetGain;
|
||||
Mix_Private_st *pInstance=(Mix_Private_st *)(ptrInstance->MixerStream[0].PrivateParams);
|
||||
|
||||
if(n<=0) return;
|
||||
|
||||
/******************************************************************************
|
||||
SOFT MIXING
|
||||
*******************************************************************************/
|
||||
if (pInstance->Current != pInstance->Target)
|
||||
{
|
||||
if(pInstance->Delta == 0x7FFFFFFF){
|
||||
pInstance->Current = pInstance->Target;
|
||||
TargetGain=pInstance->Target>>(16-pInstance->Shift); // TargetGain in Q16.15 format
|
||||
LVC_Mixer_SetTarget(&(ptrInstance->MixerStream[0]),TargetGain);
|
||||
}else if (Abs_32(pInstance->Current-pInstance->Target) < pInstance->Delta){
|
||||
pInstance->Current = pInstance->Target; /* Difference is not significant anymore. Make them equal. */
|
||||
TargetGain=pInstance->Target>>(16-pInstance->Shift); // TargetGain in Q16.15 format
|
||||
LVC_Mixer_SetTarget(&(ptrInstance->MixerStream[0]),TargetGain);
|
||||
}else{
|
||||
/* Soft mixing has to be applied */
|
||||
HardMixing = FALSE;
|
||||
if(pInstance->Shift!=0){
|
||||
Shift_Sat_v16xv16 ((LVM_INT16)pInstance->Shift,src,src,n);
|
||||
LVC_Core_MixInSoft_D16C31_SAT( &(ptrInstance->MixerStream[0]), src, dst, n);
|
||||
}
|
||||
else
|
||||
LVC_Core_MixInSoft_D16C31_SAT( &(ptrInstance->MixerStream[0]), src, dst, n);
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
HARD MIXING
|
||||
*******************************************************************************/
|
||||
|
||||
if (HardMixing){
|
||||
if (pInstance->Target != 0){ /* Nothing to do in case Target = 0 */
|
||||
if ((pInstance->Target>>16) == 0x7FFF){
|
||||
if(pInstance->Shift!=0)
|
||||
Shift_Sat_v16xv16 ((LVM_INT16)pInstance->Shift,src,src,n);
|
||||
Add2_Sat_16x16( src, dst, n );
|
||||
}
|
||||
else{
|
||||
if(pInstance->Shift!=0)
|
||||
Shift_Sat_v16xv16 ((LVM_INT16)pInstance->Shift,src,src,n);
|
||||
Mac3s_Sat_16x16(src,(LVM_INT16)(pInstance->Target>>16),dst,n);
|
||||
pInstance->Current = pInstance->Target; /* In case the LVCore function would have changed the Current value */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
CALL BACK
|
||||
*******************************************************************************/
|
||||
|
||||
if (ptrInstance->MixerStream[0].CallbackSet){
|
||||
if (Abs_32(pInstance->Current-pInstance->Target) < pInstance->Delta){
|
||||
pInstance->Current = pInstance->Target; /* Difference is not significant anymore. Make them equal. */
|
||||
TargetGain=pInstance->Target>>(16-pInstance->Shift); // TargetGain in Q16.15 format
|
||||
LVC_Mixer_SetTarget(ptrInstance->MixerStream,TargetGain);
|
||||
ptrInstance->MixerStream[0].CallbackSet = FALSE;
|
||||
if (ptrInstance->MixerStream[0].pCallBack != 0){
|
||||
(*ptrInstance->MixerStream[0].pCallBack) ( ptrInstance->MixerStream[0].pCallbackHandle, ptrInstance->MixerStream[0].pGeneralPurpose,ptrInstance->MixerStream[0].CallbackParam );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**********************************************************************************/
|
160
media/libeffects/lvm/lib/Common/src/LVC_MixSoft_1St_2i_D16C31_SAT.c
Executable file
160
media/libeffects/lvm/lib/Common/src/LVC_MixSoft_1St_2i_D16C31_SAT.c
Executable file
@ -0,0 +1,160 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2010 NXP Software
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**********************************************************************************
|
||||
|
||||
$Author: beq07716 $
|
||||
$Revision: 1000 $
|
||||
$Date: 2010-06-28 13:08:20 +0200 (Mon, 28 Jun 2010) $
|
||||
|
||||
***********************************************************************************/
|
||||
|
||||
/**********************************************************************************
|
||||
INCLUDE FILES
|
||||
***********************************************************************************/
|
||||
|
||||
#include "LVC_Mixer_Private.h"
|
||||
#include "VectorArithmetic.h"
|
||||
#include "ScalarArithmetic.h"
|
||||
|
||||
/**********************************************************************************
|
||||
DEFINITIONS
|
||||
***********************************************************************************/
|
||||
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
|
||||
/**********************************************************************************
|
||||
FUNCTION LVC_MixSoft_1St_2i_D16C31_SAT
|
||||
***********************************************************************************/
|
||||
|
||||
void LVC_MixSoft_1St_2i_D16C31_SAT( LVMixer3_2St_st *ptrInstance,
|
||||
const LVM_INT16 *src,
|
||||
LVM_INT16 *dst,
|
||||
LVM_INT16 n)
|
||||
{
|
||||
char HardMixing = TRUE;
|
||||
LVM_INT32 TargetGain;
|
||||
Mix_Private_st *pInstance1=(Mix_Private_st *)(ptrInstance->MixerStream[0].PrivateParams);
|
||||
Mix_Private_st *pInstance2=(Mix_Private_st *)(ptrInstance->MixerStream[1].PrivateParams);
|
||||
|
||||
if(n<=0) return;
|
||||
|
||||
/******************************************************************************
|
||||
SOFT MIXING
|
||||
*******************************************************************************/
|
||||
if ((pInstance1->Current != pInstance1->Target)||(pInstance2->Current != pInstance2->Target))
|
||||
{
|
||||
if(pInstance1->Delta == 0x7FFFFFFF)
|
||||
{
|
||||
pInstance1->Current = pInstance1->Target;
|
||||
TargetGain=pInstance1->Target>>16; // TargetGain in Q16.15 format, no integer part
|
||||
LVC_Mixer_SetTarget(&(ptrInstance->MixerStream[0]),TargetGain);
|
||||
}
|
||||
else if (Abs_32(pInstance1->Current-pInstance1->Target) < pInstance1->Delta)
|
||||
{
|
||||
pInstance1->Current = pInstance1->Target; /* Difference is not significant anymore. Make them equal. */
|
||||
TargetGain=pInstance1->Target>>16; // TargetGain in Q16.15 format, no integer part
|
||||
LVC_Mixer_SetTarget(&(ptrInstance->MixerStream[0]),TargetGain);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Soft mixing has to be applied */
|
||||
HardMixing = FALSE;
|
||||
}
|
||||
|
||||
if(HardMixing == TRUE)
|
||||
{
|
||||
if(pInstance2->Delta == 0x7FFFFFFF)
|
||||
{
|
||||
pInstance2->Current = pInstance2->Target;
|
||||
TargetGain=pInstance2->Target>>16; // TargetGain in Q16.15 format, no integer part
|
||||
LVC_Mixer_SetTarget(&(ptrInstance->MixerStream[1]),TargetGain);
|
||||
}
|
||||
else if (Abs_32(pInstance2->Current-pInstance2->Target) < pInstance2->Delta)
|
||||
{
|
||||
pInstance2->Current = pInstance2->Target; /* Difference is not significant anymore. Make them equal. */
|
||||
TargetGain=pInstance2->Target>>16; // TargetGain in Q16.15 format, no integer part
|
||||
LVC_Mixer_SetTarget(&(ptrInstance->MixerStream[1]),TargetGain);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Soft mixing has to be applied */
|
||||
HardMixing = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if(HardMixing == FALSE)
|
||||
{
|
||||
LVC_Core_MixSoft_1St_2i_D16C31_WRA( &(ptrInstance->MixerStream[0]),&(ptrInstance->MixerStream[1]), src, dst, n);
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
HARD MIXING
|
||||
*******************************************************************************/
|
||||
|
||||
if (HardMixing)
|
||||
{
|
||||
if (((pInstance1->Target>>16) == 0x7FFF)&&((pInstance2->Target>>16) == 0x7FFF))
|
||||
{
|
||||
if(src!=dst)
|
||||
{
|
||||
Copy_16(src, dst, n);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LVC_Core_MixHard_1St_2i_D16C31_SAT(&(ptrInstance->MixerStream[0]),&(ptrInstance->MixerStream[1]), src, dst, n);
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
CALL BACK
|
||||
*******************************************************************************/
|
||||
|
||||
if (ptrInstance->MixerStream[0].CallbackSet)
|
||||
{
|
||||
if (Abs_32(pInstance1->Current-pInstance1->Target) < pInstance1->Delta)
|
||||
{
|
||||
pInstance1->Current = pInstance1->Target; /* Difference is not significant anymore. Make them equal. */
|
||||
TargetGain=pInstance1->Target>>(16-pInstance1->Shift); // TargetGain in Q16.15 format
|
||||
LVC_Mixer_SetTarget(&ptrInstance->MixerStream[0],TargetGain);
|
||||
ptrInstance->MixerStream[0].CallbackSet = FALSE;
|
||||
if (ptrInstance->MixerStream[0].pCallBack != 0)
|
||||
{
|
||||
(*ptrInstance->MixerStream[0].pCallBack) ( ptrInstance->MixerStream[0].pCallbackHandle, ptrInstance->MixerStream[0].pGeneralPurpose,ptrInstance->MixerStream[0].CallbackParam );
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ptrInstance->MixerStream[1].CallbackSet)
|
||||
{
|
||||
if (Abs_32(pInstance2->Current-pInstance2->Target) < pInstance2->Delta)
|
||||
{
|
||||
pInstance2->Current = pInstance2->Target; /* Difference is not significant anymore. Make them equal. */
|
||||
TargetGain=pInstance2->Target>>(16-pInstance2->Shift); // TargetGain in Q16.15 format
|
||||
LVC_Mixer_SetTarget(&ptrInstance->MixerStream[1],TargetGain);
|
||||
ptrInstance->MixerStream[1].CallbackSet = FALSE;
|
||||
if (ptrInstance->MixerStream[1].pCallBack != 0)
|
||||
{
|
||||
(*ptrInstance->MixerStream[1].pCallBack) ( ptrInstance->MixerStream[1].pCallbackHandle, ptrInstance->MixerStream[1].pGeneralPurpose,ptrInstance->MixerStream[1].CallbackParam );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**********************************************************************************/
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user