diff options
author | Eric Laurent <elaurent@google.com> | 2010-07-09 12:28:50 -0700 |
---|---|---|
committer | Eric Laurent <elaurent@google.com> | 2010-07-17 06:33:00 -0700 |
commit | 2c8e5cab3faa6d360e222b7a6c40a80083d021ac (patch) | |
tree | fd19b8baa829edb78116b089d1122ea4ef0921e1 /media/libeffects/lvm/lib/Common/lib | |
parent | ada2ac8e09b6d3f2b3c3155a852ba0fffae1b592 (diff) | |
download | frameworks_av-2c8e5cab3faa6d360e222b7a6c40a80083d021ac.zip frameworks_av-2c8e5cab3faa6d360e222b7a6c40a80083d021ac.tar.gz frameworks_av-2c8e5cab3faa6d360e222b7a6c40a80083d021ac.tar.bz2 |
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
Diffstat (limited to 'media/libeffects/lvm/lib/Common/lib')
-rwxr-xr-x | media/libeffects/lvm/lib/Common/lib/AGC.h | 92 | ||||
-rwxr-xr-x | media/libeffects/lvm/lib/Common/lib/BIQUAD.h | 341 | ||||
-rwxr-xr-x | media/libeffects/lvm/lib/Common/lib/CompLim.h | 91 | ||||
-rwxr-xr-x | media/libeffects/lvm/lib/Common/lib/Filter.h | 71 | ||||
-rwxr-xr-x | media/libeffects/lvm/lib/Common/lib/InstAlloc.h | 99 | ||||
-rwxr-xr-x | media/libeffects/lvm/lib/Common/lib/LVM_Common.h | 69 | ||||
-rwxr-xr-x | media/libeffects/lvm/lib/Common/lib/LVM_Macros.h | 130 | ||||
-rwxr-xr-x | media/libeffects/lvm/lib/Common/lib/LVM_Timer.h | 89 | ||||
-rwxr-xr-x | media/libeffects/lvm/lib/Common/lib/LVM_Types.h | 195 | ||||
-rwxr-xr-x | media/libeffects/lvm/lib/Common/lib/Mixer.h | 135 | ||||
-rwxr-xr-x | media/libeffects/lvm/lib/Common/lib/ScalarArithmetic.h | 68 | ||||
-rwxr-xr-x | media/libeffects/lvm/lib/Common/lib/VectorArithmetic.h | 189 |
12 files changed, 1569 insertions, 0 deletions
diff --git a/media/libeffects/lvm/lib/Common/lib/AGC.h b/media/libeffects/lvm/lib/Common/lib/AGC.h new file mode 100755 index 0000000..980a8e3 --- /dev/null +++ b/media/libeffects/lvm/lib/Common/lib/AGC.h @@ -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__ */ + + + + + + + + + + diff --git a/media/libeffects/lvm/lib/Common/lib/BIQUAD.h b/media/libeffects/lvm/lib/Common/lib/BIQUAD.h new file mode 100755 index 0000000..08e5a6f --- /dev/null +++ b/media/libeffects/lvm/lib/Common/lib/BIQUAD.h @@ -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_ **/ + diff --git a/media/libeffects/lvm/lib/Common/lib/CompLim.h b/media/libeffects/lvm/lib/Common/lib/CompLim.h new file mode 100755 index 0000000..df9b583 --- /dev/null +++ b/media/libeffects/lvm/lib/Common/lib/CompLim.h @@ -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 */ + + + diff --git a/media/libeffects/lvm/lib/Common/lib/Filter.h b/media/libeffects/lvm/lib/Common/lib/Filter.h new file mode 100755 index 0000000..93ccbcb --- /dev/null +++ b/media/libeffects/lvm/lib/Common/lib/Filter.h @@ -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_ **/ + diff --git a/media/libeffects/lvm/lib/Common/lib/InstAlloc.h b/media/libeffects/lvm/lib/Common/lib/InstAlloc.h new file mode 100755 index 0000000..31409bf --- /dev/null +++ b/media/libeffects/lvm/lib/Common/lib/InstAlloc.h @@ -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__ */ diff --git a/media/libeffects/lvm/lib/Common/lib/LVM_Common.h b/media/libeffects/lvm/lib/Common/lib/LVM_Common.h new file mode 100755 index 0000000..f0f893d --- /dev/null +++ b/media/libeffects/lvm/lib/Common/lib/LVM_Common.h @@ -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__ */ + diff --git a/media/libeffects/lvm/lib/Common/lib/LVM_Macros.h b/media/libeffects/lvm/lib/Common/lib/LVM_Macros.h new file mode 100755 index 0000000..8bd363d --- /dev/null +++ b/media/libeffects/lvm/lib/Common/lib/LVM_Macros.h @@ -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 ******************************************************************/ diff --git a/media/libeffects/lvm/lib/Common/lib/LVM_Timer.h b/media/libeffects/lvm/lib/Common/lib/LVM_Timer.h new file mode 100755 index 0000000..22a16d6 --- /dev/null +++ b/media/libeffects/lvm/lib/Common/lib/LVM_Timer.h @@ -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__ */ diff --git a/media/libeffects/lvm/lib/Common/lib/LVM_Types.h b/media/libeffects/lvm/lib/Common/lib/LVM_Types.h new file mode 100755 index 0000000..e4649ba --- /dev/null +++ b/media/libeffects/lvm/lib/Common/lib/LVM_Types.h @@ -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 */ diff --git a/media/libeffects/lvm/lib/Common/lib/Mixer.h b/media/libeffects/lvm/lib/Common/lib/Mixer.h new file mode 100755 index 0000000..d741980 --- /dev/null +++ b/media/libeffects/lvm/lib/Common/lib/Mixer.h @@ -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__ */ + + + + + + + + + + diff --git a/media/libeffects/lvm/lib/Common/lib/ScalarArithmetic.h b/media/libeffects/lvm/lib/Common/lib/ScalarArithmetic.h new file mode 100755 index 0000000..c66e201 --- /dev/null +++ b/media/libeffects/lvm/lib/Common/lib/ScalarArithmetic.h @@ -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__ */ + + diff --git a/media/libeffects/lvm/lib/Common/lib/VectorArithmetic.h b/media/libeffects/lvm/lib/Common/lib/VectorArithmetic.h new file mode 100755 index 0000000..290a996 --- /dev/null +++ b/media/libeffects/lvm/lib/Common/lib/VectorArithmetic.h @@ -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_ */ + +/**********************************************************************************/ |