summaryrefslogtreecommitdiffstats
path: root/media/libeffects/lvm/lib
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2010-08-04 06:33:52 -0700
committerEric Laurent <elaurent@google.com>2010-08-20 14:17:41 -0700
commitc59c6fd7f859b4010d788db89b8d4d76bbb70e57 (patch)
treecbdf7a007e63d834652abf8dbdb32a371a59d73c /media/libeffects/lvm/lib
parent3eb2ff224a12b5670f4f62f07a47ffb2fde01548 (diff)
downloadframeworks_av-c59c6fd7f859b4010d788db89b8d4d76bbb70e57.zip
frameworks_av-c59c6fd7f859b4010d788db89b8d4d76bbb70e57.tar.gz
frameworks_av-c59c6fd7f859b4010d788db89b8d4d76bbb70e57.tar.bz2
LVM release 1.05 delivery
- Click have been removed from the HP filter activation in the BassBosst Effect. - SessionId is now stored as a SessionNo - Effects now stop being called after a delay - Unix EOL fixed for .java and .xml - Updated lines limited to 100 characters. - Removed the remaining warnings from the wrapper code - Added reverb Change-Id: I03a2b3b5ee2286958f4901acc8d9b0daf9e2d7c6
Diffstat (limited to 'media/libeffects/lvm/lib')
-rw-r--r--media/libeffects/lvm/lib/Android.mk55
-rwxr-xr-xmedia/libeffects/lvm/lib/Bass/src/LVDBE_Control.c31
-rwxr-xr-xmedia/libeffects/lvm/lib/Bass/src/LVDBE_Init.c41
-rwxr-xr-xmedia/libeffects/lvm/lib/Bass/src/LVDBE_Private.h12
-rwxr-xr-xmedia/libeffects/lvm/lib/Bass/src/LVDBE_Process.c98
-rwxr-xr-xmedia/libeffects/lvm/lib/Bundle/src/LVM_Control.c4
-rwxr-xr-xmedia/libeffects/lvm/lib/Reverb/lib/LVREV.h321
-rwxr-xr-xmedia/libeffects/lvm/lib/Reverb/src/LVREV_ApplyNewSettings.c656
-rwxr-xr-xmedia/libeffects/lvm/lib/Reverb/src/LVREV_ClearAudioBuffers.c113
-rwxr-xr-xmedia/libeffects/lvm/lib/Reverb/src/LVREV_GetControlParameters.c78
-rwxr-xr-xmedia/libeffects/lvm/lib/Reverb/src/LVREV_GetInstanceHandle.c331
-rwxr-xr-xmedia/libeffects/lvm/lib/Reverb/src/LVREV_GetMemoryTable.c254
-rwxr-xr-xmedia/libeffects/lvm/lib/Reverb/src/LVREV_Private.h198
-rwxr-xr-xmedia/libeffects/lvm/lib/Reverb/src/LVREV_Process.c550
-rwxr-xr-xmedia/libeffects/lvm/lib/Reverb/src/LVREV_SetControlParameters.c128
-rwxr-xr-xmedia/libeffects/lvm/lib/Reverb/src/LVREV_Tables.c108
-rwxr-xr-xmedia/libeffects/lvm/lib/Reverb/src/LVREV_Tables.h59
-rwxr-xr-xmedia/libeffects/lvm/lib/StereoWidening/src/LVCS_Control.c6
-rwxr-xr-xmedia/libeffects/lvm/lib/StereoWidening/src/LVCS_Equaliser.c4
-rwxr-xr-xmedia/libeffects/lvm/lib/StereoWidening/src/LVCS_Init.c6
-rwxr-xr-xmedia/libeffects/lvm/lib/StereoWidening/src/LVCS_StereoEnhancer.c4
21 files changed, 2974 insertions, 83 deletions
diff --git a/media/libeffects/lvm/lib/Android.mk b/media/libeffects/lvm/lib/Android.mk
index a944212..ff34707 100644
--- a/media/libeffects/lvm/lib/Android.mk
+++ b/media/libeffects/lvm/lib/Android.mk
@@ -122,3 +122,58 @@ LOCAL_C_INCLUDES += \
$(LOCAL_PATH)/StereoWidening/lib
include $(BUILD_STATIC_LIBRARY)
+
+# Reverb library
+include $(CLEAR_VARS)
+
+LOCAL_ARM_MODE := arm
+
+LOCAL_SRC_FILES:= \
+ Reverb/src/LVREV_ApplyNewSettings.c \
+ Reverb/src/LVREV_ClearAudioBuffers.c \
+ Reverb/src/LVREV_GetControlParameters.c \
+ Reverb/src/LVREV_GetInstanceHandle.c \
+ Reverb/src/LVREV_GetMemoryTable.c \
+ Reverb/src/LVREV_Process.c \
+ Reverb/src/LVREV_SetControlParameters.c \
+ Reverb/src/LVREV_Tables.c \
+ Common/src/Abs_32.c \
+ Common/src/InstAlloc.c \
+ Common/src/LoadConst_16.c \
+ Common/src/LoadConst_32.c \
+ Common/src/From2iToMono_32.c \
+ Common/src/Mult3s_32x16.c \
+ Common/src/FO_1I_D32F32C31_TRC_WRA_01.c \
+ Common/src/FO_1I_D32F32Cll_TRC_WRA_01_Init.c \
+ Common/src/DelayAllPass_Sat_32x16To32.c \
+ Common/src/Copy_16.c \
+ Common/src/Mac3s_Sat_32x16.c \
+ Common/src/DelayWrite_32.c \
+ Common/src/Shift_Sat_v32xv32.c \
+ Common/src/Add2_Sat_32x32.c \
+ Common/src/JoinTo2i_32x32.c \
+ Common/src/MonoTo2I_32.c \
+ Common/src/LVM_FO_HPF.c \
+ Common/src/LVM_FO_LPF.c \
+ Common/src/LVM_Polynomial.c \
+ Common/src/LVM_Power10.c \
+ Common/src/LVM_GetOmega.c \
+ Common/src/MixSoft_2St_D32C31_SAT.c \
+ Common/src/MixSoft_1St_D32C31_WRA.c \
+ Common/src/MixInSoft_D32C31_SAT.c \
+ Common/src/LVM_Mixer_TimeConstant.c \
+ Common/src/Core_MixHard_2St_D32C31_SAT.c \
+ Common/src/Core_MixSoft_1St_D32C31_WRA.c \
+ Common/src/Core_MixInSoft_D32C31_SAT.c
+
+LOCAL_MODULE:= libreverb
+
+LOCAL_PRELINK_MODULE := false
+
+LOCAL_C_INCLUDES += \
+ $(LOCAL_PATH)/Reverb/lib \
+ $(LOCAL_PATH)/Reverb/src \
+ $(LOCAL_PATH)/Common/lib \
+ $(LOCAL_PATH)/Common/src
+
+include $(BUILD_STATIC_LIBRARY)
diff --git a/media/libeffects/lvm/lib/Bass/src/LVDBE_Control.c b/media/libeffects/lvm/lib/Bass/src/LVDBE_Control.c
index 8cf84b7..4a9dc72 100755
--- a/media/libeffects/lvm/lib/Bass/src/LVDBE_Control.c
+++ b/media/libeffects/lvm/lib/Bass/src/LVDBE_Control.c
@@ -17,9 +17,9 @@
/****************************************************************************************
- $Author: nxp007753 $
- $Revision: 1315 $
- $Date: 2010-07-23 11:52:08 +0200 (Fri, 23 Jul 2010) $
+ $Author: beq06068 $
+ $Revision: 1401 $
+ $Date: 2010-08-03 09:52:22 +0200 (Tue, 03 Aug 2010) $
*****************************************************************************************/
@@ -128,7 +128,7 @@ void LVDBE_SetFilters(LVDBE_Instance_t *pInstance,
(void *)&pInstance->pData->HPFTaps, /* Destination Cast to void: \
no dereferencing in function*/
sizeof(pInstance->pData->HPFTaps)/sizeof(LVM_INT16)); /* Number of words */
- BQ_2I_D32F32Cll_TRC_WRA_01_Init(&pInstance->pCoef->HPFInstance, /* Initialise the filter */
+ BQ_2I_D32F32Cll_TRC_WRA_01_Init(&pInstance->pCoef->HPFInstance, /* Initialise the filter */
&pInstance->pData->HPFTaps,
(BQ_C32_Coefs_t *)&LVDBE_HPF_Table[Offset]);
@@ -140,7 +140,7 @@ void LVDBE_SetFilters(LVDBE_Instance_t *pInstance,
(void *)&pInstance->pData->BPFTaps, /* Destination Cast to void:\
no dereferencing in function*/
sizeof(pInstance->pData->BPFTaps)/sizeof(LVM_INT16)); /* Number of words */
- BP_1I_D32F32Cll_TRC_WRA_02_Init(&pInstance->pCoef->BPFInstance, /* Initialise the filter */
+ BP_1I_D32F32Cll_TRC_WRA_02_Init(&pInstance->pCoef->BPFInstance, /* Initialise the filter */
&pInstance->pData->BPFTaps,
(BP_C32_Coefs_t *)&LVDBE_BPF_Table[Offset]);
@@ -317,6 +317,7 @@ LVDBE_ReturnStatus_en LVDBE_Control(LVDBE_Handle_t hInstance,
{
LVDBE_Instance_t *pInstance =(LVDBE_Instance_t *)hInstance;
+ LVMixer3_2St_st *pBypassMixer_Instance = &pInstance->pData->BypassMixer;
/*
@@ -339,6 +340,14 @@ LVDBE_ReturnStatus_en LVDBE_Control(LVDBE_Handle_t hInstance,
{
LVDBE_SetAGC(pInstance, /* Instance pointer */
pParams); /* New parameters */
+
+ LVC_Mixer_SetTimeConstant(&pBypassMixer_Instance->MixerStream[0],
+ LVDBE_BYPASS_MIXER_TC,pParams->SampleRate,2);
+
+ LVC_Mixer_SetTimeConstant(&pBypassMixer_Instance->MixerStream[1],
+ LVDBE_BYPASS_MIXER_TC,pParams->SampleRate,2);
+
+
}
@@ -356,17 +365,13 @@ LVDBE_ReturnStatus_en LVDBE_Control(LVDBE_Handle_t hInstance,
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 */
+ LVC_Mixer_SetTarget(&pInstance->pData->BypassMixer.MixerStream[0],0);
+ LVC_Mixer_SetTarget(&pInstance->pData->BypassMixer.MixerStream[1],0x00007FFF);
}
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 */
+ LVC_Mixer_SetTarget(&pInstance->pData->BypassMixer.MixerStream[0],0x00007FFF);
+ LVC_Mixer_SetTarget(&pInstance->pData->BypassMixer.MixerStream[1],0);
}
/*
diff --git a/media/libeffects/lvm/lib/Bass/src/LVDBE_Init.c b/media/libeffects/lvm/lib/Bass/src/LVDBE_Init.c
index 75869c7..95c421d 100755
--- a/media/libeffects/lvm/lib/Bass/src/LVDBE_Init.c
+++ b/media/libeffects/lvm/lib/Bass/src/LVDBE_Init.c
@@ -17,9 +17,9 @@
/****************************************************************************************
- $Author: nxp007753 $
- $Revision: 1081 $
- $Date: 2010-07-05 11:48:44 +0200 (Mon, 05 Jul 2010) $
+ $Author: beq06068 $
+ $Revision: 1399 $
+ $Date: 2010-08-03 08:16:00 +0200 (Tue, 03 Aug 2010) $
*****************************************************************************************/
@@ -160,6 +160,7 @@ LVDBE_ReturnStatus_en LVDBE_Init(LVDBE_Handle_t *phInstance,
LVDBE_Instance_t *pInstance;
LVMixer3_1St_st *pMixer_Instance;
+ LVMixer3_2St_st *pBypassMixer_Instance;
LVM_INT16 i;
LVM_INT32 MixGain;
@@ -227,7 +228,7 @@ LVDBE_ReturnStatus_en LVDBE_Init(LVDBE_Handle_t *phInstance,
/*
* Initialise the filters
*/
- LVDBE_SetFilters(pInstance, /* Set the filter taps and coefficients */
+ LVDBE_SetFilters(pInstance, /* Set the filter taps and coefficients */
&pInstance->Params);
@@ -236,7 +237,8 @@ LVDBE_ReturnStatus_en LVDBE_Init(LVDBE_Handle_t *phInstance,
*/
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 */
+ pInstance->pData->AGCInstance.AGC_Gain = pInstance->pData->AGCInstance.AGC_MaxGain;
+ /* Default to the bass boost setting */
/*
@@ -245,7 +247,8 @@ LVDBE_ReturnStatus_en LVDBE_Init(LVDBE_Handle_t *phInstance,
LVDBE_SetVolume(pInstance, /* Set the Volume */
&pInstance->Params);
- pInstance->pData->AGCInstance.Volume = pInstance->pData->AGCInstance.Target; /* Initialise as the target */
+ 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]);
@@ -258,9 +261,31 @@ LVDBE_ReturnStatus_en LVDBE_Init(LVDBE_Handle_t *phInstance,
pMixer_Instance->MixerStream[0].CallbackSet = 0;
/*
- * Initialise the clicks minimisation variable
+ * Initialise the clicks minimisation BypassMixer
*/
- pInstance->bTransitionOnToOff = LVM_FALSE;
+
+ pBypassMixer_Instance = &pInstance->pData->BypassMixer;
+
+ /*
+ * Setup the mixer gain for the processed path
+ */
+ pBypassMixer_Instance->MixerStream[0].CallbackParam = 0;
+ pBypassMixer_Instance->MixerStream[0].pCallbackHandle = LVM_NULL;
+ pBypassMixer_Instance->MixerStream[0].pCallBack = LVM_NULL;
+ pBypassMixer_Instance->MixerStream[0].CallbackSet=0;
+ LVC_Mixer_Init(&pBypassMixer_Instance->MixerStream[0],0,0);
+ LVC_Mixer_SetTimeConstant(&pBypassMixer_Instance->MixerStream[0],
+ LVDBE_BYPASS_MIXER_TC,pInstance->Params.SampleRate,2);
+ /*
+ * Setup the mixer gain for the unprocessed path
+ */
+ pBypassMixer_Instance->MixerStream[1].CallbackParam = 0;
+ pBypassMixer_Instance->MixerStream[1].pCallbackHandle = LVM_NULL;
+ pBypassMixer_Instance->MixerStream[1].pCallBack = LVM_NULL;
+ pBypassMixer_Instance->MixerStream[1].CallbackSet=0;
+ LVC_Mixer_Init(&pBypassMixer_Instance->MixerStream[1],0x00007FFF,0x00007FFF);
+ LVC_Mixer_SetTimeConstant(&pBypassMixer_Instance->MixerStream[1],
+ LVDBE_BYPASS_MIXER_TC,pInstance->Params.SampleRate,2);
return(LVDBE_SUCCESS);
}
diff --git a/media/libeffects/lvm/lib/Bass/src/LVDBE_Private.h b/media/libeffects/lvm/lib/Bass/src/LVDBE_Private.h
index 3e09cf4..df32873 100755
--- a/media/libeffects/lvm/lib/Bass/src/LVDBE_Private.h
+++ b/media/libeffects/lvm/lib/Bass/src/LVDBE_Private.h
@@ -17,9 +17,9 @@
/****************************************************************************************
- $Author: nxp007753 $
- $Revision: 1081 $
- $Date: 2010-07-05 11:48:44 +0200 (Mon, 05 Jul 2010) $
+ $Author: beq06068 $
+ $Revision: 1399 $
+ $Date: 2010-08-03 08:16:00 +0200 (Tue, 03 Aug 2010) $
*****************************************************************************************/
@@ -75,6 +75,8 @@ extern "C" {
#define LVDBE_SCRATCHBUFFERS_INPLACE 4 /* Number of buffers required for inplace processing */
#define LVDBE_MIXER_TC 5 /* Mixer time */
+#define LVDBE_BYPASS_MIXER_TC 100 /* Bypass mixer time */
+
/****************************************************************************************/
/* */
@@ -92,6 +94,7 @@ typedef struct
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 */
+ LVMixer3_2St_st BypassMixer; /* Bypass Mixer for Click Removal */
} LVDBE_Data_t;
@@ -115,9 +118,6 @@ typedef struct
/* Data and coefficient pointers */
LVDBE_Data_t *pData; /* Instance data */
LVDBE_Coef_t *pCoef; /* Instance coefficients */
-
- LVM_INT32 bTransitionOnToOff;
-
} LVDBE_Instance_t;
diff --git a/media/libeffects/lvm/lib/Bass/src/LVDBE_Process.c b/media/libeffects/lvm/lib/Bass/src/LVDBE_Process.c
index 35eec07..04032c0 100755
--- a/media/libeffects/lvm/lib/Bass/src/LVDBE_Process.c
+++ b/media/libeffects/lvm/lib/Bass/src/LVDBE_Process.c
@@ -17,9 +17,9 @@
/****************************************************************************************
- $Author: nxp007753 $
- $Revision: 1081 $
- $Date: 2010-07-05 11:48:44 +0200 (Mon, 05 Jul 2010) $
+ $Author: beq06068 $
+ $Revision: 1400 $
+ $Date: 2010-08-03 09:22:37 +0200 (Tue, 03 Aug 2010) $
*****************************************************************************************/
@@ -89,10 +89,16 @@ LVDBE_ReturnStatus_en LVDBE_Process(LVDBE_Handle_t hInstance,
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_INT32 *pMono;
LVM_INT16 *pInput = (LVM_INT16 *)pInData;
+ /* Scratch for Volume Control starts at offset of 2*NumSamples short values from pScratch */
+ LVM_INT16 *pScratchVol = (LVM_INT16 *)(&pScratch[NumSamples]);
+
+ /* Scratch for Mono path starts at offset of 2*NumSamples 32-bit values from pScratch */
+ pMono = &pScratch[2*NumSamples];
+
/*
* Check the number of samples is not too large
*/
@@ -104,18 +110,20 @@ LVDBE_ReturnStatus_en LVDBE_Process(LVDBE_Handle_t hInstance,
/*
* Check if the algorithm is enabled
*/
- if ((pInstance->Params.OperatingMode != LVDBE_OFF) ||
- (pInstance->bTransitionOnToOff == LVM_TRUE))
+ /* DBE path is processed when DBE is ON or during On/Off transitions */
+ if ((pInstance->Params.OperatingMode == LVDBE_ON)||
+ (LVC_Mixer_GetCurrent(&pInstance->pData->BypassMixer.MixerStream[0])
+ !=LVC_Mixer_GetTarget(&pInstance->pData->BypassMixer.MixerStream[0])))
{
/*
* 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 */
+ Int16LShiftToInt32_16x32(pInput, /* Source 16-bit data */
+ pScratch, /* Dest. 32-bit data */
+ (LVM_INT16)(2*NumSamples), /* Left and right */
+ LVDBE_SCALESHIFT); /* Shift scale */
/*
@@ -123,61 +131,54 @@ LVDBE_ReturnStatus_en LVDBE_Process(LVDBE_Handle_t hInstance,
*/
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 */
+ 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 */
+ 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 */
+ 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;
- }
- }
-
-
+ 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 */
/*
* 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 */
+ Int32RShiftToInt16_Sat_32x16(pScratch, /* Source 32-bit data */
+ (LVM_INT16 *)pScratch, /* Dest. 16-bit data */
+ (LVM_INT16)(2*NumSamples), /* Left and right */
+ LVDBE_SCALESHIFT); /* Shift scale */
}
- else
+
+ /* Bypass Volume path is processed when DBE is OFF or during On/Off transitions */
+ if ((pInstance->Params.OperatingMode == LVDBE_OFF)||
+ (LVC_Mixer_GetCurrent(&pInstance->pData->BypassMixer.MixerStream[1])
+ !=LVC_Mixer_GetTarget(&pInstance->pData->BypassMixer.MixerStream[1])))
{
/*
@@ -186,11 +187,20 @@ LVDBE_ReturnStatus_en LVDBE_Process(LVDBE_Handle_t hInstance,
*/
LVC_MixSoft_1St_D16C31_SAT(&pInstance->pData->BypassVolume,
pInData,
- pOutData,
- (LVM_INT16)(2*NumSamples)); /* Left and right */
+ pScratchVol,
+ (LVM_INT16)(2*NumSamples)); /* Left and right */
}
+ /*
+ * Mix DBE processed path and bypass volume path
+ */
+ LVC_MixSoft_2St_D16C31_SAT(&pInstance->pData->BypassMixer,
+ (LVM_INT16 *) pScratch,
+ pScratchVol,
+ pOutData,
+ (LVM_INT16)(2*NumSamples));
+
return(LVDBE_SUCCESS);
}
diff --git a/media/libeffects/lvm/lib/Bundle/src/LVM_Control.c b/media/libeffects/lvm/lib/Bundle/src/LVM_Control.c
index 922f77d..cec7501 100755
--- a/media/libeffects/lvm/lib/Bundle/src/LVM_Control.c
+++ b/media/libeffects/lvm/lib/Bundle/src/LVM_Control.c
@@ -18,8 +18,8 @@
/****************************************************************************************
$Author: nxp007753 $
- $Revision: 1316 $
- $Date: 2010-07-23 11:53:24 +0200 (Fri, 23 Jul 2010) $
+ $Revision: 1331 $
+ $Date: 2010-07-27 12:26:23 +0200 (Tue, 27 Jul 2010) $
*****************************************************************************************/
diff --git a/media/libeffects/lvm/lib/Reverb/lib/LVREV.h b/media/libeffects/lvm/lib/Reverb/lib/LVREV.h
new file mode 100755
index 0000000..4c32db0
--- /dev/null
+++ b/media/libeffects/lvm/lib/Reverb/lib/LVREV.h
@@ -0,0 +1,321 @@
+/*
+ * 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: beq03888 $*/
+/* $Revision: 1204 $*/
+/* $Date: 2010-07-14 08:55:43 +0200 (Wed, 14 Jul 2010) $*/
+/* */
+/************************************************************************/
+
+/****************************************************************************************/
+/* */
+/* Header file for the application layer interface of the LVREV module */
+/* */
+/* This files includes all definitions, types, structures and function prototypes */
+/* required by the calling layer. All other types, structures and functions are */
+/* private. */
+/* */
+/****************************************************************************************/
+
+#ifndef __LVREV_H__
+#define __LVREV_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+/****************************************************************************************/
+/* */
+/* Includes */
+/* */
+/****************************************************************************************/
+#include "LVM_Types.h"
+
+
+/****************************************************************************************/
+/* */
+/* Definitions */
+/* */
+/****************************************************************************************/
+/* General */
+#define LVREV_BLOCKSIZE_MULTIPLE 1 /* Processing block size multiple */
+#define LVREV_MAX_T60 7000 /* Maximum decay time is 7000ms */
+
+/* Memory table*/
+#define LVREV_NR_MEMORY_REGIONS 4 /* Number of memory regions */
+
+
+/****************************************************************************************/
+/* */
+/* Types */
+/* */
+/****************************************************************************************/
+/* Instance handle */
+typedef void *LVREV_Handle_t;
+
+
+/* Status return values */
+typedef enum
+{
+ LVREV_SUCCESS = 0, /* Successful return from a routine */
+ LVREV_NULLADDRESS = 1, /* NULL allocation address */
+ LVREV_OUTOFRANGE = 2, /* Out of range control parameter */
+ LVREV_INVALIDNUMSAMPLES = 3, /* Invalid number of samples */
+ LVREV_RETURNSTATUS_DUMMY = LVM_MAXENUM
+} LVREV_ReturnStatus_en;
+
+
+/* Reverb delay lines */
+typedef enum
+{
+ LVREV_DELAYLINES_1 = 1, /* One delay line */
+ LVREV_DELAYLINES_2 = 2, /* Two delay lines */
+ LVREV_DELAYLINES_4 = 4, /* Four delay lines */
+ LVREV_DELAYLINES_DUMMY = LVM_MAXENUM
+} LVREV_NumDelayLines_en;
+
+
+/****************************************************************************************/
+/* */
+/* Structures */
+/* */
+/****************************************************************************************/
+
+/* Memory table containing the region definitions */
+typedef struct
+{
+ LVM_MemoryRegion_st Region[LVREV_NR_MEMORY_REGIONS]; /* One definition for each region */
+} LVREV_MemoryTable_st;
+
+
+/* Control Parameter structure */
+typedef struct
+{
+ /* General parameters */
+ LVM_Mode_en OperatingMode; /* Operating mode */
+ LVM_Fs_en SampleRate; /* Sample rate */
+ LVM_Format_en SourceFormat; /* Source data format */
+
+ /* Parameters for REV */
+ LVM_UINT16 Level; /* Level, 0 to 100 representing percentage of reverb */
+ LVM_UINT16 LPF; /* Low pass filter, in Hz */
+ LVM_UINT16 HPF; /* High pass filter, in Hz */
+ LVM_UINT16 T60; /* Decay time constant, in ms */
+ LVM_UINT16 Density; /* Echo density, 0 to 100 for minimum to maximum density */
+ LVM_UINT16 Damping; /* Damping */
+ LVM_UINT16 RoomSize; /* Simulated room size, 1 to 100 for minimum to maximum size */
+
+} LVREV_ControlParams_st;
+
+
+/* Instance Parameter structure */
+typedef struct
+{
+ /* General */
+ LVM_UINT16 MaxBlockSize; /* Maximum processing block size */
+
+ /* Reverb */
+ LVM_Format_en SourceFormat; /* Source data formats to support */
+ LVREV_NumDelayLines_en NumDelays; /* The number of delay lines, 1, 2 or 4 */
+
+} LVREV_InstanceParams_st;
+
+
+/****************************************************************************************/
+/* */
+/* Function Prototypes */
+/* */
+/****************************************************************************************/
+
+/****************************************************************************************/
+/* */
+/* FUNCTION: LVREV_GetMemoryTable */
+/* */
+/* DESCRIPTION: */
+/* This function is used to obtain the LVREV module memory requirements to support */
+/* memory allocation. It can also be used to return the memory base address provided */
+/* during memory allocation to support freeing of memory when the LVREV module is no */
+/* longer required. It is called in two ways: */
+/* */
+/* hInstance = NULL Returns the memory requirements */
+/* hInstance = Instance handle Returns the memory requirements and allocated */
+/* base addresses. */
+/* */
+/* When this function is called with hInstance = NULL the memory base address pointers */
+/* will be NULL on return. */
+/* */
+/* When the function is called for freeing memory, 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 table */
+/* pInstanceParams Pointer to the instance parameters */
+/* */
+/* RETURNS: */
+/* LVREV_SUCCESS Succeeded */
+/* LVREV_NULLADDRESS When pMemoryTable is NULL */
+/* LVREV_NULLADDRESS When requesting memory requirements and pInstanceParams */
+/* is NULL */
+/* */
+/* NOTES: */
+/* 1. This function may be interrupted by the LVREV_Process function */
+/* */
+/****************************************************************************************/
+LVREV_ReturnStatus_en LVREV_GetMemoryTable(LVREV_Handle_t hInstance,
+ LVREV_MemoryTable_st *pMemoryTable,
+ LVREV_InstanceParams_st *pInstanceParams);
+
+
+/****************************************************************************************/
+/* */
+/* FUNCTION: LVREV_GetInstanceHandle */
+/* */
+/* DESCRIPTION: */
+/* This function is used to create a LVREV module instance. It returns the created */
+/* instance handle through phInstance. All parameters are set to invalid values, the */
+/* LVREV_SetControlParameters function must be called with a set of valid control */
+/* parameters before the LVREV_Process function can be called. */
+/* */
+/* The memory allocation must be provided by the application by filling in the memory */
+/* region base addresses in the memory table before calling this function. */
+/* */
+/* PARAMETERS: */
+/* phInstance Pointer to the instance handle */
+/* pMemoryTable Pointer to the memory definition table */
+/* pInstanceParams Pointer to the instance parameters */
+/* */
+/* RETURNS: */
+/* LVREV_SUCCESS Succeeded */
+/* LVREV_NULLADDRESS When phInstance or pMemoryTable or pInstanceParams is NULL */
+/* LVREV_NULLADDRESS When one of the memory regions has a NULL pointer */
+/* */
+/* NOTES: */
+/* */
+/****************************************************************************************/
+LVREV_ReturnStatus_en LVREV_GetInstanceHandle(LVREV_Handle_t *phInstance,
+ LVREV_MemoryTable_st *pMemoryTable,
+ LVREV_InstanceParams_st *pInstanceParams);
+
+
+/****************************************************************************************/
+/* */
+/* FUNCTION: LVXX_GetControlParameters */
+/* */
+/* DESCRIPTION: */
+/* Request the LVREV module control parameters. The current parameter set is returned */
+/* via the parameter pointer. */
+/* */
+/* PARAMETERS: */
+/* hInstance Instance handle */
+/* pControlParams Pointer to an empty parameter structure */
+/* */
+/* RETURNS: */
+/* LVREV_SUCCESS Succeeded */
+/* LVREV_NULLADDRESS When hInstance or pControlParams is NULL */
+/* */
+/* NOTES: */
+/* 1. This function may be interrupted by the LVREV_Process function */
+/* */
+/****************************************************************************************/
+LVREV_ReturnStatus_en LVREV_GetControlParameters(LVREV_Handle_t hInstance,
+ LVREV_ControlParams_st *pControlParams);
+
+
+/****************************************************************************************/
+/* */
+/* FUNCTION: LVREV_SetControlParameters */
+/* */
+/* DESCRIPTION: */
+/* Sets or changes the LVREV module parameters. */
+/* */
+/* PARAMETERS: */
+/* hInstance Instance handle */
+/* pNewParams Pointer to a parameter structure */
+/* */
+/* RETURNS: */
+/* LVREV_SUCCESS Succeeded */
+/* LVREV_NULLADDRESS When hInstance or pNewParams is NULL */
+/* */
+/* NOTES: */
+/* 1. This function may be interrupted by the LVREV_Process function */
+/* */
+/****************************************************************************************/
+LVREV_ReturnStatus_en LVREV_SetControlParameters(LVREV_Handle_t hInstance,
+ LVREV_ControlParams_st *pNewParams);
+
+
+/****************************************************************************************/
+/* */
+/* FUNCTION: LVREV_ClearAudioBuffers */
+/* */
+/* DESCRIPTION: */
+/* This function is used to clear the internal audio buffers of the module. */
+/* */
+/* PARAMETERS: */
+/* hInstance Instance handle */
+/* */
+/* RETURNS: */
+/* LVREV_SUCCESS Initialisation succeeded */
+/* LVREV_NULLADDRESS Instance is NULL */
+/* */
+/* NOTES: */
+/* 1. This function must not be interrupted by the LVREV_Process function */
+/* */
+/****************************************************************************************/
+LVREV_ReturnStatus_en LVREV_ClearAudioBuffers(LVREV_Handle_t hInstance);
+
+
+/****************************************************************************************/
+/* */
+/* FUNCTION: LVREV_Process */
+/* */
+/* DESCRIPTION: */
+/* Process function for the LVREV 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: */
+/* LVREV_SUCCESS Succeeded */
+/* LVREV_INVALIDNUMSAMPLES NumSamples was larger than the maximum block size */
+/* */
+/* NOTES: */
+/* 1. The input and output buffers must be 32-bit aligned */
+/* */
+/****************************************************************************************/
+LVREV_ReturnStatus_en LVREV_Process(LVREV_Handle_t hInstance,
+ const LVM_INT32 *pInData,
+ LVM_INT32 *pOutData,
+ const LVM_UINT16 NumSamples);
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __LVREV_H__ */
+
+/* End of file */
diff --git a/media/libeffects/lvm/lib/Reverb/src/LVREV_ApplyNewSettings.c b/media/libeffects/lvm/lib/Reverb/src/LVREV_ApplyNewSettings.c
new file mode 100755
index 0000000..0026652
--- /dev/null
+++ b/media/libeffects/lvm/lib/Reverb/src/LVREV_ApplyNewSettings.c
@@ -0,0 +1,656 @@
+/*
+ * 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: nxp007753 $ */
+/* $Revision: 1316 $ */
+/* $Date: 2010-07-23 11:53:24 +0200 (Fri, 23 Jul 2010) $ */
+/* */
+/****************************************************************************************/
+
+/****************************************************************************************/
+/* */
+/* Includes */
+/* */
+/****************************************************************************************/
+#include "LVREV_Private.h"
+#include "Filter.h"
+
+/****************************************************************************************/
+/* */
+/* FUNCTION: LVREV_ApplyNewSettings */
+/* */
+/* DESCRIPTION: */
+/* Applies the new control parameters */
+/* */
+/* PARAMETERS: */
+/* pPrivate Pointer to the instance private parameters */
+/* */
+/* RETURNS: */
+/* LVREV_Success Succeeded */
+/* LVREV_NULLADDRESS When pPrivate is NULL */
+/* */
+/* NOTES: */
+/* */
+/****************************************************************************************/
+
+LVREV_ReturnStatus_en LVREV_ApplyNewSettings (LVREV_Instance_st *pPrivate)
+{
+
+ LVM_Mode_en OperatingMode;
+ LVM_INT32 NumberOfDelayLines;
+
+
+ /* Check for NULL pointer */
+ if(pPrivate == LVM_NULL)
+ {
+ return LVREV_NULLADDRESS;
+ }
+
+ OperatingMode = pPrivate->NewParams.OperatingMode;
+
+ if(pPrivate->InstanceParams.NumDelays == LVREV_DELAYLINES_4)
+ {
+ NumberOfDelayLines = 4;
+ }
+ else if(pPrivate->InstanceParams.NumDelays == LVREV_DELAYLINES_2)
+ {
+ NumberOfDelayLines = 2;
+ }
+ else
+ {
+ NumberOfDelayLines = 1;
+ }
+
+ /*
+ * Update the high pass filter coefficients
+ */
+ if((pPrivate->NewParams.HPF != pPrivate->CurrentParams.HPF) ||
+ (pPrivate->NewParams.SampleRate != pPrivate->CurrentParams.SampleRate) ||
+ (pPrivate->bFirstControl == LVM_TRUE))
+ {
+ LVM_INT32 Omega;
+ FO_C32_Coefs_t Coeffs;
+
+ Omega = LVM_GetOmega(pPrivate->NewParams.HPF, pPrivate->NewParams.SampleRate);
+ LVM_FO_HPF(Omega, &Coeffs);
+ FO_1I_D32F32Cll_TRC_WRA_01_Init( &pPrivate->pFastCoef->HPCoefs, &pPrivate->pFastData->HPTaps, &Coeffs);
+ LoadConst_32(0,
+ (void *)&pPrivate->pFastData->HPTaps, /* Destination Cast to void: no dereferencing in function*/
+ sizeof(Biquad_1I_Order1_Taps_t)/sizeof(LVM_INT32));
+ }
+
+
+ /*
+ * Update the low pass filter coefficients
+ */
+ if((pPrivate->NewParams.LPF != pPrivate->CurrentParams.LPF) ||
+ (pPrivate->NewParams.SampleRate != pPrivate->CurrentParams.SampleRate) ||
+ (pPrivate->bFirstControl == LVM_TRUE))
+ {
+ LVM_INT32 Omega;
+ FO_C32_Coefs_t Coeffs;
+
+
+ Coeffs.A0 = 0x7FFFFFFF;
+ Coeffs.A1 = 0;
+ Coeffs.B1 = 0;
+ if(pPrivate->NewParams.LPF <= (LVM_FsTable[pPrivate->NewParams.SampleRate] >> 1))
+ {
+ Omega = LVM_GetOmega(pPrivate->NewParams.LPF, pPrivate->NewParams.SampleRate);
+
+ /*
+ * Do not apply filter if w =2*pi*fc/fs >= 2.9
+ */
+ if(Omega<=LVREV_2_9_INQ29)
+ {
+ LVM_FO_LPF(Omega, &Coeffs);
+ }
+ }
+ FO_1I_D32F32Cll_TRC_WRA_01_Init( &pPrivate->pFastCoef->LPCoefs, &pPrivate->pFastData->LPTaps, &Coeffs);
+ LoadConst_32(0,
+ (void *)&pPrivate->pFastData->LPTaps, /* Destination Cast to void: no dereferencing in function*/
+ sizeof(Biquad_1I_Order1_Taps_t)/sizeof(LVM_INT32));
+ }
+
+
+ /*
+ * Calculate the room size parameter
+ */
+ if( pPrivate->NewParams.RoomSize != pPrivate->CurrentParams.RoomSize)
+ {
+ /* Room size range is 10ms to 200ms
+ * 0% -- 10ms
+ * 50% -- 65ms
+ * 100% -- 120ms
+ */
+ pPrivate->RoomSizeInms = 10 + (((pPrivate->NewParams.RoomSize*11) + 5)/10);
+ }
+
+
+ /*
+ * Update the T delay number of samples and the all pass delay number of samples
+ */
+ if( (pPrivate->NewParams.RoomSize != pPrivate->CurrentParams.RoomSize) ||
+ (pPrivate->NewParams.SampleRate != pPrivate->CurrentParams.SampleRate) ||
+ (pPrivate->bFirstControl == LVM_TRUE))
+ {
+
+ LVM_UINT32 Temp;
+ LVM_INT32 APDelaySize;
+ LVM_INT32 Fs = LVM_GetFsFromTable(pPrivate->NewParams.SampleRate);
+ LVM_UINT32 DelayLengthSamples = (LVM_UINT32)(Fs * pPrivate->RoomSizeInms);
+ LVM_INT16 i;
+ LVM_INT16 ScaleTable[] = {LVREV_T_3_Power_minus0_on_4, LVREV_T_3_Power_minus1_on_4, LVREV_T_3_Power_minus2_on_4, LVREV_T_3_Power_minus3_on_4};
+ LVM_INT16 MaxT_Delay[] = {LVREV_MAX_T0_DELAY, LVREV_MAX_T1_DELAY, LVREV_MAX_T2_DELAY, LVREV_MAX_T3_DELAY};
+ LVM_INT16 MaxAP_Delay[] = {LVREV_MAX_AP0_DELAY, LVREV_MAX_AP1_DELAY, LVREV_MAX_AP2_DELAY, LVREV_MAX_AP3_DELAY};
+
+
+ /*
+ * For each delay line
+ */
+ for (i=0; i<NumberOfDelayLines; i++)
+ {
+ if (i != 0)
+ {
+ LVM_INT32 Temp1; /* to avoid QAC warning on type conversion */
+ LVM_INT32 Temp2; /* to avoid QAC warning on type conversion */
+
+ Temp2=(LVM_INT32)DelayLengthSamples;
+ MUL32x16INTO32(Temp2, ScaleTable[i], Temp1, 15)
+ Temp=(LVM_UINT32)Temp1;
+ }
+ else
+ {
+ Temp = DelayLengthSamples;
+ }
+ APDelaySize = Temp / 1500;
+
+
+ /*
+ * Set the fixed delay
+ */
+ Temp = (MaxT_Delay[i] - MaxAP_Delay[i]) * Fs / 48000;
+ pPrivate->Delay_AP[i] = pPrivate->T[i] - Temp;
+
+
+ /*
+ * Set the tap selection
+ */
+ if (pPrivate->AB_Selection)
+ {
+ /* Smooth from tap A to tap B */
+ pPrivate->pOffsetB[i] = &pPrivate->pDelay_T[i][pPrivate->T[i] - Temp - APDelaySize];
+ pPrivate->B_DelaySize[i] = APDelaySize;
+ pPrivate->Mixer_APTaps[i].Target1 = 0;
+ pPrivate->Mixer_APTaps[i].Target2 = 0x7fffffff;
+ }
+ else
+ {
+ /* Smooth from tap B to tap A */
+ pPrivate->pOffsetA[i] = &pPrivate->pDelay_T[i][pPrivate->T[i] - Temp - APDelaySize];
+ pPrivate->A_DelaySize[i] = APDelaySize;
+ pPrivate->Mixer_APTaps[i].Target2 = 0;
+ pPrivate->Mixer_APTaps[i].Target1 = 0x7fffffff;
+ }
+
+ /*
+ * Set the maximum block size to the smallest delay size
+ */
+ pPrivate->MaxBlkLen = Temp;
+ if (pPrivate->MaxBlkLen > pPrivate->A_DelaySize[i])
+ {
+ pPrivate->MaxBlkLen = pPrivate->A_DelaySize[i];
+ }
+ if (pPrivate->MaxBlkLen > pPrivate->B_DelaySize[i])
+ {
+ pPrivate->MaxBlkLen = pPrivate->B_DelaySize[i];
+ }
+ }
+ if (pPrivate->AB_Selection)
+ {
+ pPrivate->AB_Selection = 0;
+ }
+ else
+ {
+ pPrivate->AB_Selection = 1;
+ }
+
+
+ /*
+ * Limit the maximum block length
+ */
+ pPrivate->MaxBlkLen=pPrivate->MaxBlkLen-2; /* Just as a precausion, but no problem if we remove this line */
+ if(pPrivate->MaxBlkLen > pPrivate->InstanceParams.MaxBlockSize)
+ {
+ pPrivate->MaxBlkLen = (LVM_INT32)pPrivate->InstanceParams.MaxBlockSize;
+ }
+ }
+
+
+ /*
+ * Update the low pass filter coefficient
+ */
+ if( (pPrivate->NewParams.Damping != pPrivate->CurrentParams.Damping) ||
+ (pPrivate->NewParams.SampleRate != pPrivate->CurrentParams.SampleRate) ||
+ (pPrivate->bFirstControl == LVM_TRUE))
+ {
+
+ LVM_INT32 Temp;
+ LVM_INT32 Omega;
+ FO_C32_Coefs_t Coeffs;
+ LVM_INT16 i;
+ LVM_INT16 Damping = (LVM_INT16)((pPrivate->NewParams.Damping * 100) + 1000);
+ LVM_INT32 ScaleTable[] = {LVREV_T_3_Power_0_on_4, LVREV_T_3_Power_1_on_4, LVREV_T_3_Power_2_on_4, LVREV_T_3_Power_3_on_4};
+
+
+ /*
+ * For each filter
+ */
+ for (i=0; i<NumberOfDelayLines; i++)
+ {
+ if (i != 0)
+ {
+ MUL32x16INTO32(ScaleTable[i], Damping, Temp, 15)
+ }
+ else
+ {
+ Temp = Damping;
+ }
+ if(Temp <= (LVM_FsTable[pPrivate->NewParams.SampleRate] >> 1))
+ {
+ Omega = LVM_GetOmega((LVM_UINT16)Temp, pPrivate->NewParams.SampleRate);
+ LVM_FO_LPF(Omega, &Coeffs);
+ }
+ else
+ {
+ Coeffs.A0 = 0x7FF00000;
+ Coeffs.A1 = 0;
+ Coeffs.B1 = 0;
+ }
+ FO_1I_D32F32Cll_TRC_WRA_01_Init(&pPrivate->pFastCoef->RevLPCoefs[i], &pPrivate->pFastData->RevLPTaps[i], &Coeffs);
+ }
+ }
+
+
+ /*
+ * Update All-pass filter mixer time constants
+ */
+ if( (pPrivate->NewParams.RoomSize != pPrivate->CurrentParams.RoomSize) ||
+ (pPrivate->NewParams.SampleRate != pPrivate->CurrentParams.SampleRate) ||
+ (pPrivate->NewParams.Density != pPrivate->CurrentParams.Density))
+ {
+ LVM_INT16 i;
+ LVM_INT32 Alpha = (LVM_INT32)LVM_Mixer_TimeConstant(LVREV_ALLPASS_TC, LVM_GetFsFromTable(pPrivate->NewParams.SampleRate), 1);
+ LVM_INT32 AlphaTap = (LVM_INT32)LVM_Mixer_TimeConstant(LVREV_ALLPASS_TAP_TC, LVM_GetFsFromTable(pPrivate->NewParams.SampleRate), 1);
+
+ for (i=0; i<4; i++)
+ {
+ pPrivate->Mixer_APTaps[i].Alpha1 = AlphaTap;
+ pPrivate->Mixer_APTaps[i].Alpha2 = AlphaTap;
+ pPrivate->Mixer_SGFeedback[i].Alpha = Alpha;
+ pPrivate->Mixer_SGFeedforward[i].Alpha = Alpha;
+ }
+ }
+
+
+ /*
+ * Update the feed back gain
+ */
+ if( (pPrivate->NewParams.RoomSize != pPrivate->CurrentParams.RoomSize) ||
+ (pPrivate->NewParams.SampleRate != pPrivate->CurrentParams.SampleRate) ||
+ (pPrivate->NewParams.T60 != pPrivate->CurrentParams.T60) ||
+ (pPrivate->bFirstControl == LVM_TRUE))
+ {
+
+ LVM_INT32 G[4]; /* Feedback gain (Q7.24) */
+
+ if(pPrivate->NewParams.T60 == 0)
+ {
+ G[3] = 0;
+ G[2] = 0;
+ G[1] = 0;
+ G[0] = 0;
+ }
+ else
+ {
+ LVM_INT32 Temp1;
+ LVM_INT32 Temp2;
+ LVM_INT16 i;
+ LVM_INT16 ScaleTable[] = {LVREV_T_3_Power_minus0_on_4, LVREV_T_3_Power_minus1_on_4, LVREV_T_3_Power_minus2_on_4, LVREV_T_3_Power_minus3_on_4};
+
+
+ /*
+ * For each delay line
+ */
+ for (i=0; i<NumberOfDelayLines; i++)
+ {
+ Temp1 = (3 * pPrivate->RoomSizeInms * ScaleTable[i]) / pPrivate->NewParams.T60;
+ if(Temp1 >= (4 << 15))
+ {
+ G[i] = 0;
+ }
+ else if((Temp1 >= (2 << 15)))
+ {
+ Temp2 = LVM_Power10(-(Temp1 << 14));
+ Temp1 = LVM_Power10(-(Temp1 << 14));
+ MUL32x32INTO32(Temp1,Temp2,Temp1,24)
+ }
+ else
+ {
+ Temp1 = LVM_Power10(-(Temp1 << 15));
+ }
+ if (NumberOfDelayLines == 1)
+ {
+ G[i] = Temp1;
+ }
+ else
+ {
+ LVM_INT32 TempG;
+ MUL32x16INTO32(Temp1,ONE_OVER_SQRT_TWO,TempG,15)
+ G[i]=TempG;
+ }
+ }
+ }
+
+ /* Set up the feedback mixers for four delay lines */
+ pPrivate->FeedbackMixer[0].Target=G[0]<<7;
+ pPrivate->FeedbackMixer[1].Target=G[1]<<7;
+ pPrivate->FeedbackMixer[2].Target=G[2]<<7;
+ pPrivate->FeedbackMixer[3].Target=G[3]<<7;
+ }
+
+
+ /*
+ * Calculate the gain correction
+ */
+ if((pPrivate->NewParams.RoomSize != pPrivate->CurrentParams.RoomSize) ||
+ (pPrivate->NewParams.Level != pPrivate->CurrentParams.Level) ||
+ (pPrivate->NewParams.T60 != pPrivate->CurrentParams.T60) )
+ {
+ LVM_INT32 Index=0;
+ LVM_INT32 i=0;
+ LVM_INT32 Gain=0;
+ LVM_INT32 RoomSize=0;
+ LVM_INT32 T60;
+ LVM_INT32 Coefs[5];
+
+ if(pPrivate->NewParams.RoomSize==0)
+ {
+ RoomSize=1;
+ }
+ else
+ {
+ RoomSize=(LVM_INT32)pPrivate->NewParams.RoomSize;
+ }
+
+ if(pPrivate->NewParams.T60<100)
+ {
+ T60 = 100 * LVREV_T60_SCALE;
+ }
+ else
+ {
+ T60 = pPrivate->NewParams.T60 * LVREV_T60_SCALE;
+ }
+
+ /* Find the nearest room size in table */
+ for(i=0;i<24;i++)
+ {
+ if(RoomSize<= LVREV_GainPolyTable[i][0])
+ {
+ Index=i;
+ break;
+ }
+ }
+
+
+ if(RoomSize==LVREV_GainPolyTable[Index][0])
+ {
+ /* Take table values if the room size is in table */
+ for(i=1;i<5;i++)
+ {
+ Coefs[i-1]=LVREV_GainPolyTable[Index][i];
+ }
+ Coefs[4]=0;
+ Gain=LVM_Polynomial(3,Coefs,T60); /* Q.24 result */
+ }
+ else
+ {
+ /* Interpolate the gain between nearest room sizes */
+
+ LVM_INT32 Gain1,Gain2;
+ LVM_INT32 Tot_Dist,Dist;
+
+ Tot_Dist=LVREV_GainPolyTable[Index][0]-LVREV_GainPolyTable[Index-1][0];
+ Dist=RoomSize-LVREV_GainPolyTable[Index-1][0];
+
+
+ /* Get gain for first */
+ for(i=1;i<5;i++)
+ {
+ Coefs[i-1]=LVREV_GainPolyTable[Index-1][i];
+ }
+ Coefs[4]=0;
+
+ Gain1=LVM_Polynomial(3,Coefs,T60); /* Q.24 result */
+
+ /* Get gain for second */
+ for(i=1;i<5;i++)
+ {
+ Coefs[i-1]=LVREV_GainPolyTable[Index][i];
+ }
+ Coefs[4]=0;
+
+ Gain2=LVM_Polynomial(3,Coefs,T60); /* Q.24 result */
+
+ /* Linear Interpolate the gain */
+ Gain = Gain1+ (((Gain2-Gain1)*Dist)/(Tot_Dist));
+ }
+
+
+ /*
+ * Get the inverse of gain: Q.15
+ * Gain is mostly above one except few cases, take only gains above 1
+ */
+ if(Gain < 16777216L)
+ {
+ pPrivate->Gain= 32767;
+ }
+ else
+ {
+ pPrivate->Gain=(LVM_INT16)(LVM_MAXINT_32/(Gain>>8));
+ }
+
+
+ Index=((32767*100)/(100+pPrivate->NewParams.Level));
+ pPrivate->Gain=(LVM_INT16)((pPrivate->Gain*Index)>>15);
+ pPrivate->GainMixer.Target = pPrivate->Gain*Index;
+ }
+
+
+ /*
+ * Update the all pass comb filter coefficient
+ */
+ if( (pPrivate->NewParams.Density != pPrivate->CurrentParams.Density) ||
+ (pPrivate->bFirstControl == LVM_TRUE))
+ {
+ LVM_INT16 i;
+ LVM_INT32 b = pPrivate->NewParams.Density * LVREV_B_8_on_1000;
+
+ for (i=0;i<4; i++)
+ {
+ pPrivate->Mixer_SGFeedback[i].Target = b;
+ pPrivate->Mixer_SGFeedforward[i].Target = b;
+ }
+ }
+
+
+ /*
+ * Update the bypass mixer time constant
+ */
+ if((pPrivate->NewParams.SampleRate != pPrivate->CurrentParams.SampleRate) ||
+ (pPrivate->NewParams.SourceFormat != pPrivate->CurrentParams.SourceFormat) ||
+ (pPrivate->bFirstControl == LVM_TRUE))
+ {
+ LVM_UINT16 NumChannels = 1; /* Assume MONO format */
+ LVM_INT32 Alpha;
+
+ Alpha = (LVM_INT32)LVM_Mixer_TimeConstant(LVREV_FEEDBACKMIXER_TC, LVM_GetFsFromTable(pPrivate->NewParams.SampleRate), NumChannels);
+ pPrivate->FeedbackMixer[0].Alpha=Alpha;
+ pPrivate->FeedbackMixer[1].Alpha=Alpha;
+ pPrivate->FeedbackMixer[2].Alpha=Alpha;
+ pPrivate->FeedbackMixer[3].Alpha=Alpha;
+
+ if (pPrivate->NewParams.SourceFormat != LVM_MONO)
+ {
+ /* Stereo or Mono-in-Stereo format data */
+ NumChannels = 2;
+ }
+ pPrivate->BypassMixer.Alpha1 = (LVM_INT32)LVM_Mixer_TimeConstant(LVREV_BYPASSMIXER_TC, LVM_GetFsFromTable(pPrivate->NewParams.SampleRate), NumChannels);
+ pPrivate->BypassMixer.Alpha2 = pPrivate->BypassMixer.Alpha1;
+ pPrivate->GainMixer.Alpha = pPrivate->BypassMixer.Alpha1;
+ }
+
+
+ /*
+ * Update the bypass mixer targets
+ */
+ if( (pPrivate->NewParams.Level != pPrivate->CurrentParams.Level) &&
+ (pPrivate->NewParams.OperatingMode == LVM_MODE_ON))
+ {
+ pPrivate->BypassMixer.Target2 = ((LVM_INT32)(pPrivate->NewParams.Level * 32767)/100)<<16;
+ pPrivate->BypassMixer.Target1 = LVREV_HEADROOM << 16;
+ if ((pPrivate->NewParams.Level == 0) && (pPrivate->bFirstControl == LVM_FALSE))
+ {
+ pPrivate->BypassMixer.CallbackSet2 = LVM_TRUE;
+ }
+ if (pPrivate->NewParams.Level != 0)
+ {
+ pPrivate->bDisableReverb = LVM_FALSE;
+ }
+ }
+
+ if(pPrivate->NewParams.OperatingMode != pPrivate->CurrentParams.OperatingMode)
+ {
+ if(pPrivate->NewParams.OperatingMode == LVM_MODE_ON)
+ {
+ pPrivate->BypassMixer.Target2 = ((LVM_INT32)(pPrivate->NewParams.Level * 32767)/100)<<16;
+ pPrivate->BypassMixer.Target1 = LVREV_HEADROOM << 16;
+
+ pPrivate->BypassMixer.CallbackSet2 = LVM_FALSE;
+ OperatingMode = LVM_MODE_ON;
+ if (pPrivate->NewParams.Level == 0)
+ {
+ pPrivate->bDisableReverb = LVM_TRUE;
+ }
+ else
+ {
+ pPrivate->bDisableReverb = LVM_FALSE;
+ }
+ }
+ else if (pPrivate->bFirstControl == LVM_FALSE)
+ {
+ pPrivate->BypassMixer.Target2 = 0x00000000;
+ pPrivate->BypassMixer.Target1 = 0x7FFFFFFF;
+ pPrivate->BypassMixer.CallbackSet2 = LVM_TRUE;
+ pPrivate->GainMixer.Target = 0x03FFFFFF;
+ OperatingMode = LVM_MODE_ON;
+ }
+ else
+ {
+ OperatingMode = LVM_MODE_OFF;
+ }
+ }
+
+
+ /*
+ * If it is the first call to ApplyNew settings force the current to the target to begin immediate playback of the effect
+ */
+ if(pPrivate->bFirstControl == LVM_TRUE)
+ {
+ pPrivate->BypassMixer.Current1 = pPrivate->BypassMixer.Target1;
+ pPrivate->BypassMixer.Current2 = pPrivate->BypassMixer.Target2;
+ }
+
+
+ /*
+ * Copy the new parameters
+ */
+ pPrivate->CurrentParams = pPrivate->NewParams;
+ pPrivate->CurrentParams.OperatingMode = OperatingMode;
+
+
+ /*
+ * Update flag
+ */
+ if(pPrivate->bFirstControl == LVM_TRUE)
+ {
+ pPrivate->bFirstControl = LVM_FALSE;
+ }
+
+
+ return LVREV_SUCCESS;
+}
+
+
+/****************************************************************************************/
+/* */
+/* FUNCTION: BypassMixer_Callback */
+/* */
+/* DESCRIPTION: */
+/* Controls the On to Off operating mode transition */
+/* */
+/* PARAMETERS: */
+/* pPrivate Pointer to the instance private parameters */
+/* */
+/* RETURNS: */
+/* LVREV_Success Succeeded */
+/* LVREV_NULLADDRESS When pPrivate is NULL */
+/* */
+/* NOTES: */
+/* */
+/****************************************************************************************/
+LVM_INT32 BypassMixer_Callback (void *pCallbackData,
+ void *pGeneralPurpose,
+ LVM_INT16 GeneralPurpose )
+{
+
+ LVREV_Instance_st *pLVREV_Private = (LVREV_Instance_st *)pCallbackData;
+
+
+ /*
+ * Avoid build warnings
+ */
+ (void)pGeneralPurpose;
+ (void)GeneralPurpose;
+
+
+ /*
+ * Turn off
+ */
+ pLVREV_Private->CurrentParams.OperatingMode = LVM_MODE_OFF;
+ pLVREV_Private->bDisableReverb = LVM_TRUE;
+ LVREV_ClearAudioBuffers((LVREV_Handle_t)pCallbackData);
+
+
+ return 0;
+}
+
+/* End of file */
+
diff --git a/media/libeffects/lvm/lib/Reverb/src/LVREV_ClearAudioBuffers.c b/media/libeffects/lvm/lib/Reverb/src/LVREV_ClearAudioBuffers.c
new file mode 100755
index 0000000..b02b1a7
--- /dev/null
+++ b/media/libeffects/lvm/lib/Reverb/src/LVREV_ClearAudioBuffers.c
@@ -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: nxp007753 $ */
+/* $Revision: 1316 $ */
+/* $Date: 2010-07-23 11:53:24 +0200 (Fri, 23 Jul 2010) $ */
+/* */
+/****************************************************************************************/
+
+/****************************************************************************************/
+/* */
+/* Includes */
+/* */
+/****************************************************************************************/
+#include "LVREV_Private.h"
+#include "VectorArithmetic.h"
+
+
+/****************************************************************************************/
+/* */
+/* FUNCTION: LVREV_ClearAudioBuffers */
+/* */
+/* DESCRIPTION: */
+/* This function is used to clear the internal audio buffers of the module. */
+/* */
+/* PARAMETERS: */
+/* hInstance Instance handle */
+/* */
+/* RETURNS: */
+/* LVREV_SUCCESS Initialisation succeeded */
+/* LVREV_NULLADDRESS Instance is NULL */
+/* */
+/* NOTES: */
+/* 1. This function must not be interrupted by the LVM_Process function */
+/* */
+/****************************************************************************************/
+LVREV_ReturnStatus_en LVREV_ClearAudioBuffers(LVREV_Handle_t hInstance)
+{
+
+ LVREV_Instance_st *pLVREV_Private = (LVREV_Instance_st *)hInstance;
+
+
+ /*
+ * Check for error conditions
+ */
+ /* Check for NULL pointers */
+ if(hInstance == LVM_NULL)
+ {
+ return LVREV_NULLADDRESS;
+ }
+
+ /*
+ * Clear all filter tap data, delay-lines and other signal related data
+ */
+
+
+ LoadConst_32(0,
+ (void *)&pLVREV_Private->pFastData->HPTaps, /* Destination Cast to void: no dereferencing in function*/
+ 2);
+ LoadConst_32(0,
+ (void *)&pLVREV_Private->pFastData->LPTaps, /* Destination Cast to void: no dereferencing in function*/
+ 2);
+
+ if((LVM_UINT16)pLVREV_Private->InstanceParams.NumDelays == LVREV_DELAYLINES_4)
+ {
+ LoadConst_32(0, (LVM_INT32 *)&pLVREV_Private->pFastData->RevLPTaps[3], 2);
+ LoadConst_32(0, (LVM_INT32 *)&pLVREV_Private->pFastData->RevLPTaps[2], 2);
+ LoadConst_32(0, (LVM_INT32 *)&pLVREV_Private->pFastData->RevLPTaps[1], 2);
+ LoadConst_32(0, (LVM_INT32 *)&pLVREV_Private->pFastData->RevLPTaps[0], 2);
+
+ LoadConst_32(0,pLVREV_Private->pDelay_T[3], (LVM_INT16)LVREV_MAX_T3_DELAY);
+ LoadConst_32(0,pLVREV_Private->pDelay_T[2], (LVM_INT16)LVREV_MAX_T2_DELAY);
+ LoadConst_32(0,pLVREV_Private->pDelay_T[1], (LVM_INT16)LVREV_MAX_T1_DELAY);
+ LoadConst_32(0,pLVREV_Private->pDelay_T[0], (LVM_INT16)LVREV_MAX_T0_DELAY);
+
+ }
+
+ if((LVM_UINT16)pLVREV_Private->InstanceParams.NumDelays >= LVREV_DELAYLINES_2)
+ {
+ LoadConst_32(0, (LVM_INT32 *)&pLVREV_Private->pFastData->RevLPTaps[1], 2);
+ LoadConst_32(0, (LVM_INT32 *)&pLVREV_Private->pFastData->RevLPTaps[0], 2);
+
+ LoadConst_32(0,pLVREV_Private->pDelay_T[1], (LVM_INT16)LVREV_MAX_T1_DELAY);
+ LoadConst_32(0,pLVREV_Private->pDelay_T[0], (LVM_INT16)LVREV_MAX_T0_DELAY);
+ }
+
+ if((LVM_UINT16)pLVREV_Private->InstanceParams.NumDelays >= LVREV_DELAYLINES_1)
+ {
+ LoadConst_32(0, (LVM_INT32 *)&pLVREV_Private->pFastData->RevLPTaps[0], 2);
+ LoadConst_32(0,pLVREV_Private->pDelay_T[0], (LVM_INT16)LVREV_MAX_T0_DELAY);
+ }
+
+ return LVREV_SUCCESS;
+}
+
+/* End of file */
diff --git a/media/libeffects/lvm/lib/Reverb/src/LVREV_GetControlParameters.c b/media/libeffects/lvm/lib/Reverb/src/LVREV_GetControlParameters.c
new file mode 100755
index 0000000..ebf145e
--- /dev/null
+++ b/media/libeffects/lvm/lib/Reverb/src/LVREV_GetControlParameters.c
@@ -0,0 +1,78 @@
+/*
+ * 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: nxp27078 $*/
+/* $Revision: 762 $*/
+/* $Date: 2010-06-11 14:50:33 +0200 (Fri, 11 Jun 2010) $*/
+/* */
+/****************************************************************************************/
+
+/****************************************************************************************/
+/* */
+/* Includes */
+/* */
+/****************************************************************************************/
+#include "LVREV_Private.h"
+
+
+/****************************************************************************************/
+/* */
+/* FUNCTION: LVREV_GetControlParameters */
+/* */
+/* DESCRIPTION: */
+/* Request the LVREV module control parameters. The current parameter set is returned */
+/* via the parameter pointer. */
+/* */
+/* PARAMETERS: */
+/* hInstance Instance handle */
+/* pControlParams Pointer to an empty parameter structure */
+/* */
+/* RETURNS: */
+/* LVREV_Success Succeeded */
+/* LVREV_NULLADDRESS When hInstance or pControlParams is NULL */
+/* */
+/* NOTES: */
+/* 1. This function may be interrupted by the LVREV_Process function */
+/* */
+/****************************************************************************************/
+LVREV_ReturnStatus_en LVREV_GetControlParameters(LVREV_Handle_t hInstance,
+ LVREV_ControlParams_st *pControlParams)
+{
+
+ LVREV_Instance_st *pLVREV_Private = (LVREV_Instance_st *)hInstance;
+
+
+ /*
+ * Check for error conditions
+ */
+ if((hInstance == LVM_NULL) || (pControlParams == LVM_NULL))
+ {
+ return LVREV_NULLADDRESS;
+ }
+
+ /*
+ * Return the current parameters
+ */
+ *pControlParams = pLVREV_Private->NewParams;
+
+ return LVREV_SUCCESS;
+}
+
+/* End of file */
diff --git a/media/libeffects/lvm/lib/Reverb/src/LVREV_GetInstanceHandle.c b/media/libeffects/lvm/lib/Reverb/src/LVREV_GetInstanceHandle.c
new file mode 100755
index 0000000..ca1c84d
--- /dev/null
+++ b/media/libeffects/lvm/lib/Reverb/src/LVREV_GetInstanceHandle.c
@@ -0,0 +1,331 @@
+/*
+ * 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: nxp007753 $ */
+/* $Revision: 1316 $ */
+/* $Date: 2010-07-23 11:53:24 +0200 (Fri, 23 Jul 2010) $ */
+/* */
+/****************************************************************************************/
+
+/****************************************************************************************/
+/* */
+/* Includes */
+/* */
+/****************************************************************************************/
+#include "LVREV_Private.h"
+#include "InstAlloc.h"
+
+
+/****************************************************************************************/
+/* */
+/* FUNCTION: LVREV_GetInstanceHandle */
+/* */
+/* DESCRIPTION: */
+/* This function is used to create a LVREV module 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 */
+/* pInstanceParams Pointer to the instance parameters */
+/* */
+/* RETURNS: */
+/* LVREV_SUCCESS Succeeded */
+/* LVREV_NULLADDRESS When phInstance or pMemoryTable or pInstanceParams is NULL */
+/* LVREV_NULLADDRESS When one of the memory regions has a NULL pointer */
+/* */
+/* NOTES: */
+/* */
+/****************************************************************************************/
+LVREV_ReturnStatus_en LVREV_GetInstanceHandle(LVREV_Handle_t *phInstance,
+ LVREV_MemoryTable_st *pMemoryTable,
+ LVREV_InstanceParams_st *pInstanceParams)
+{
+
+ INST_ALLOC SlowData;
+ INST_ALLOC FastData;
+ INST_ALLOC FastCoef;
+ INST_ALLOC Temporary;
+ LVREV_Instance_st *pLVREV_Private;
+ LVM_INT16 i;
+ LVM_UINT16 MaxBlockSize;
+
+
+ /*
+ * Check for error conditions
+ */
+ /* Check for NULL pointers */
+ if((phInstance == LVM_NULL) || (pMemoryTable == LVM_NULL) || (pInstanceParams == LVM_NULL))
+ {
+ return LVREV_NULLADDRESS;
+ }
+ /* Check the memory table for NULL pointers */
+ for (i = 0; i < LVREV_NR_MEMORY_REGIONS; i++)
+ {
+ if (pMemoryTable->Region[i].Size!=0)
+ {
+ if (pMemoryTable->Region[i].pBaseAddress==LVM_NULL)
+ {
+ return(LVREV_NULLADDRESS);
+ }
+ }
+ }
+
+ /*
+ * Check all instance parameters are in range
+ */
+ /* Check for a non-zero block size */
+ if (pInstanceParams->MaxBlockSize == 0)
+ {
+ return LVREV_OUTOFRANGE;
+ }
+
+ /* Check for a valid number of delay lines */
+ if ((pInstanceParams->NumDelays != LVREV_DELAYLINES_1)&&
+ (pInstanceParams->NumDelays != LVREV_DELAYLINES_2)&&
+ (pInstanceParams->NumDelays != LVREV_DELAYLINES_4))
+ {
+ return LVREV_OUTOFRANGE;
+ }
+
+ /*
+ * Initialise the InstAlloc instances
+ */
+ InstAlloc_Init(&SlowData, pMemoryTable->Region[LVM_PERSISTENT_SLOW_DATA].pBaseAddress);
+ InstAlloc_Init(&FastData, pMemoryTable->Region[LVM_PERSISTENT_FAST_DATA].pBaseAddress);
+ InstAlloc_Init(&FastCoef, pMemoryTable->Region[LVM_PERSISTENT_FAST_COEF].pBaseAddress);
+ InstAlloc_Init(&Temporary, pMemoryTable->Region[LVM_TEMPORARY_FAST].pBaseAddress);
+
+ /*
+ * Zero all memory regions
+ */
+ LoadConst_16(0, (LVM_INT16 *)pMemoryTable->Region[LVM_PERSISTENT_SLOW_DATA].pBaseAddress, (LVM_INT16)((pMemoryTable->Region[LVM_PERSISTENT_SLOW_DATA].Size)/sizeof(LVM_INT16)));
+ LoadConst_16(0, (LVM_INT16 *)pMemoryTable->Region[LVM_PERSISTENT_FAST_DATA].pBaseAddress, (LVM_INT16)((pMemoryTable->Region[LVM_PERSISTENT_FAST_DATA].Size)/sizeof(LVM_INT16)));
+ LoadConst_16(0, (LVM_INT16 *)pMemoryTable->Region[LVM_PERSISTENT_FAST_COEF].pBaseAddress, (LVM_INT16)((pMemoryTable->Region[LVM_PERSISTENT_FAST_COEF].Size)/sizeof(LVM_INT16)));
+ LoadConst_16(0, (LVM_INT16 *)pMemoryTable->Region[LVM_TEMPORARY_FAST].pBaseAddress, (LVM_INT16)((pMemoryTable->Region[LVM_TEMPORARY_FAST].Size)/sizeof(LVM_INT16)));
+
+ /*
+ * Set the instance handle if not already initialised
+ */
+ if (*phInstance == LVM_NULL)
+ {
+ *phInstance = InstAlloc_AddMember(&SlowData, sizeof(LVREV_Instance_st));
+ }
+ pLVREV_Private =(LVREV_Instance_st *)*phInstance;
+ pLVREV_Private->MemoryTable = *pMemoryTable;
+
+ if(pInstanceParams->NumDelays ==LVREV_DELAYLINES_4)
+ {
+ MaxBlockSize = LVREV_MAX_AP3_DELAY;
+ }
+ else if(pInstanceParams->NumDelays ==LVREV_DELAYLINES_2)
+ {
+ MaxBlockSize = LVREV_MAX_AP1_DELAY;
+ }
+ else
+ {
+ MaxBlockSize = LVREV_MAX_AP0_DELAY;
+ }
+
+ if(MaxBlockSize>pInstanceParams->MaxBlockSize)
+ {
+ MaxBlockSize=pInstanceParams->MaxBlockSize;
+ }
+
+
+ /*
+ * Set the data, coefficient and temporary memory pointers
+ */
+ pLVREV_Private->pFastData = InstAlloc_AddMember(&FastData, sizeof(LVREV_FastData_st)); /* Fast data memory base address */
+
+ if(pInstanceParams->NumDelays == LVREV_DELAYLINES_4)
+ {
+ pLVREV_Private->pDelay_T[3] = InstAlloc_AddMember(&FastData, LVREV_MAX_T3_DELAY * sizeof(LVM_INT32));
+ pLVREV_Private->pDelay_T[2] = InstAlloc_AddMember(&FastData, LVREV_MAX_T2_DELAY * sizeof(LVM_INT32));
+ pLVREV_Private->pDelay_T[1] = InstAlloc_AddMember(&FastData, LVREV_MAX_T1_DELAY * sizeof(LVM_INT32));
+ pLVREV_Private->pDelay_T[0] = InstAlloc_AddMember(&FastData, LVREV_MAX_T0_DELAY * sizeof(LVM_INT32));
+
+ for( i = 0; i < 4; i++)
+ {
+ pLVREV_Private->pScratchDelayLine[i] = InstAlloc_AddMember(&Temporary, sizeof(LVM_INT32) * MaxBlockSize); /* Scratch for each delay line output */
+ }
+
+ LoadConst_32(0,pLVREV_Private->pDelay_T[3] ,(LVM_INT16)LVREV_MAX_T3_DELAY);
+ LoadConst_32(0,pLVREV_Private->pDelay_T[2] ,(LVM_INT16)LVREV_MAX_T2_DELAY);
+ LoadConst_32(0,pLVREV_Private->pDelay_T[1] ,(LVM_INT16)LVREV_MAX_T1_DELAY);
+ LoadConst_32(0,pLVREV_Private->pDelay_T[0] ,(LVM_INT16)LVREV_MAX_T0_DELAY);
+ }
+
+ if(pInstanceParams->NumDelays == LVREV_DELAYLINES_2)
+ {
+ pLVREV_Private->pDelay_T[1] = InstAlloc_AddMember(&FastData, LVREV_MAX_T1_DELAY * sizeof(LVM_INT32));
+ pLVREV_Private->pDelay_T[0] = InstAlloc_AddMember(&FastData, LVREV_MAX_T0_DELAY * sizeof(LVM_INT32));
+
+ for( i = 0; i < 2; i++)
+ {
+ pLVREV_Private->pScratchDelayLine[i] = InstAlloc_AddMember(&Temporary, sizeof(LVM_INT32) * MaxBlockSize); /* Scratch for each delay line output */
+ }
+
+ LoadConst_32(0,pLVREV_Private->pDelay_T[1] , (LVM_INT16)LVREV_MAX_T1_DELAY);
+ LoadConst_32(0,pLVREV_Private->pDelay_T[0] , (LVM_INT16)LVREV_MAX_T0_DELAY);
+ }
+
+ if(pInstanceParams->NumDelays == LVREV_DELAYLINES_1)
+ {
+ pLVREV_Private->pDelay_T[0] = InstAlloc_AddMember(&FastData, LVREV_MAX_T0_DELAY * sizeof(LVM_INT32));
+
+ for( i = 0; i < 1; i++)
+ {
+ pLVREV_Private->pScratchDelayLine[i] = InstAlloc_AddMember(&Temporary, sizeof(LVM_INT32) * MaxBlockSize); /* Scratch for each delay line output */
+ }
+
+ LoadConst_32(0,pLVREV_Private->pDelay_T[0] , (LVM_INT16)LVREV_MAX_T0_DELAY);
+ }
+
+ /* All-pass delay buffer addresses and sizes */
+ pLVREV_Private->T[0] = LVREV_MAX_T0_DELAY;
+ pLVREV_Private->T[1] = LVREV_MAX_T1_DELAY;
+ pLVREV_Private->T[2] = LVREV_MAX_T2_DELAY;
+ pLVREV_Private->T[3] = LVREV_MAX_T3_DELAY;
+ pLVREV_Private->AB_Selection = 1; /* Select smoothing A to B */
+
+
+ pLVREV_Private->pFastCoef = InstAlloc_AddMember(&FastCoef, sizeof(LVREV_FastCoef_st)); /* Fast coefficient memory base address */
+ pLVREV_Private->pScratch = InstAlloc_AddMember(&Temporary, sizeof(LVM_INT32) * MaxBlockSize); /* General purpose scratch */
+ pLVREV_Private->pInputSave = InstAlloc_AddMember(&Temporary, 2 * sizeof(LVM_INT32) * MaxBlockSize); /* Mono->stereo input save for end mix */
+ LoadConst_32(0, pLVREV_Private->pInputSave, (LVM_INT16)(MaxBlockSize*2));
+
+
+ /*
+ * Save the instance parameters in the instance structure
+ */
+ pLVREV_Private->InstanceParams = *pInstanceParams;
+
+
+ /*
+ * Set the parameters to invalid
+ */
+ pLVREV_Private->CurrentParams.SampleRate = LVM_FS_INVALID;
+ pLVREV_Private->CurrentParams.OperatingMode = LVM_MODE_DUMMY;
+ pLVREV_Private->CurrentParams.SourceFormat = LVM_SOURCE_DUMMY;
+
+ pLVREV_Private->bControlPending = LVM_FALSE;
+ pLVREV_Private->bFirstControl = LVM_TRUE;
+ pLVREV_Private->bDisableReverb = LVM_FALSE;
+
+
+ /*
+ * Set mixer parameters
+ */
+ pLVREV_Private->BypassMixer.CallbackParam2 = 0;
+ pLVREV_Private->BypassMixer.pCallbackHandle2 = pLVREV_Private;
+ pLVREV_Private->BypassMixer.pGeneralPurpose2 = LVM_NULL;
+ pLVREV_Private->BypassMixer.pCallBack2 = BypassMixer_Callback;
+ pLVREV_Private->BypassMixer.CallbackSet2 = LVM_FALSE;
+ pLVREV_Private->BypassMixer.Current2 = 0;
+ pLVREV_Private->BypassMixer.Target2 = 0;
+ pLVREV_Private->BypassMixer.CallbackParam1 = 0;
+ pLVREV_Private->BypassMixer.pCallbackHandle1 = LVM_NULL;
+ pLVREV_Private->BypassMixer.pGeneralPurpose1 = LVM_NULL;
+ pLVREV_Private->BypassMixer.pCallBack1 = LVM_NULL;
+ pLVREV_Private->BypassMixer.CallbackSet1 = LVM_FALSE;
+ pLVREV_Private->BypassMixer.Current1 = 0x7fffffff;
+ pLVREV_Private->BypassMixer.Target1 = 0x7fffffff;
+
+ pLVREV_Private->RoomSizeInms = 100; // 100 msec
+
+
+ /*
+ * Set the output gain mixer parameters
+ */
+ pLVREV_Private->GainMixer.CallbackParam = 0;
+ pLVREV_Private->GainMixer.pCallbackHandle = LVM_NULL;
+ pLVREV_Private->GainMixer.pGeneralPurpose = LVM_NULL;
+ pLVREV_Private->GainMixer.pCallBack = LVM_NULL;
+ pLVREV_Private->GainMixer.CallbackSet = LVM_FALSE;
+ pLVREV_Private->GainMixer.Current = 0x03ffffff;
+ pLVREV_Private->GainMixer.Target = 0x03ffffff;
+
+
+ /*
+ * Set the All-Pass Filter mixers
+ */
+ for (i=0; i<4; i++)
+ {
+ pLVREV_Private->pOffsetA[i] = pLVREV_Private->pDelay_T[i];
+ pLVREV_Private->pOffsetB[i] = pLVREV_Private->pDelay_T[i];
+ /* Delay tap selection mixer */
+ pLVREV_Private->Mixer_APTaps[i].CallbackParam2 = 0;
+ pLVREV_Private->Mixer_APTaps[i].pCallbackHandle2 = LVM_NULL;
+ pLVREV_Private->Mixer_APTaps[i].pGeneralPurpose2 = LVM_NULL;
+ pLVREV_Private->Mixer_APTaps[i].pCallBack2 = LVM_NULL;
+ pLVREV_Private->Mixer_APTaps[i].CallbackSet2 = LVM_FALSE;
+ pLVREV_Private->Mixer_APTaps[i].Current2 = 0;
+ pLVREV_Private->Mixer_APTaps[i].Target2 = 0;
+ pLVREV_Private->Mixer_APTaps[i].CallbackParam1 = 0;
+ pLVREV_Private->Mixer_APTaps[i].pCallbackHandle1 = LVM_NULL;
+ pLVREV_Private->Mixer_APTaps[i].pGeneralPurpose1 = LVM_NULL;
+ pLVREV_Private->Mixer_APTaps[i].pCallBack1 = LVM_NULL;
+ pLVREV_Private->Mixer_APTaps[i].CallbackSet1 = LVM_FALSE;
+ pLVREV_Private->Mixer_APTaps[i].Current1 = 0;
+ pLVREV_Private->Mixer_APTaps[i].Target1 = 0x7fffffff;
+ /* Feedforward mixer */
+ pLVREV_Private->Mixer_SGFeedforward[i].CallbackParam = 0;
+ pLVREV_Private->Mixer_SGFeedforward[i].pCallbackHandle = LVM_NULL;
+ pLVREV_Private->Mixer_SGFeedforward[i].pGeneralPurpose = LVM_NULL;
+ pLVREV_Private->Mixer_SGFeedforward[i].pCallBack = LVM_NULL;
+ pLVREV_Private->Mixer_SGFeedforward[i].CallbackSet = LVM_FALSE;
+ pLVREV_Private->Mixer_SGFeedforward[i].Current = 0;
+ pLVREV_Private->Mixer_SGFeedforward[i].Target = 0;
+ /* Feedback mixer */
+ pLVREV_Private->Mixer_SGFeedback[i].CallbackParam = 0;
+ pLVREV_Private->Mixer_SGFeedback[i].pCallbackHandle = LVM_NULL;
+ pLVREV_Private->Mixer_SGFeedback[i].pGeneralPurpose = LVM_NULL;
+ pLVREV_Private->Mixer_SGFeedback[i].pCallBack = LVM_NULL;
+ pLVREV_Private->Mixer_SGFeedback[i].CallbackSet = LVM_FALSE;
+ pLVREV_Private->Mixer_SGFeedback[i].Current = 0;
+ pLVREV_Private->Mixer_SGFeedback[i].Target = 0;
+ /* Feedback gain mixer */
+ pLVREV_Private->FeedbackMixer[i].CallbackParam = 0;
+ pLVREV_Private->FeedbackMixer[i].pCallbackHandle = LVM_NULL;
+ pLVREV_Private->FeedbackMixer[i].pGeneralPurpose = LVM_NULL;
+ pLVREV_Private->FeedbackMixer[i].pCallBack = LVM_NULL;
+ pLVREV_Private->FeedbackMixer[i].CallbackSet = LVM_FALSE;
+ pLVREV_Private->FeedbackMixer[i].Current = 0;
+ pLVREV_Private->FeedbackMixer[i].Target = 0;
+ }
+ /* Delay tap index */
+ pLVREV_Private->A_DelaySize[0] = LVREV_MAX_AP0_DELAY;
+ pLVREV_Private->B_DelaySize[0] = LVREV_MAX_AP0_DELAY;
+ pLVREV_Private->A_DelaySize[1] = LVREV_MAX_AP1_DELAY;
+ pLVREV_Private->B_DelaySize[1] = LVREV_MAX_AP1_DELAY;
+ pLVREV_Private->A_DelaySize[2] = LVREV_MAX_AP2_DELAY;
+ pLVREV_Private->B_DelaySize[2] = LVREV_MAX_AP2_DELAY;
+ pLVREV_Private->A_DelaySize[3] = LVREV_MAX_AP3_DELAY;
+ pLVREV_Private->B_DelaySize[3] = LVREV_MAX_AP3_DELAY;
+
+
+ LVREV_ClearAudioBuffers(*phInstance);
+
+ return LVREV_SUCCESS;
+}
+
+/* End of file */
diff --git a/media/libeffects/lvm/lib/Reverb/src/LVREV_GetMemoryTable.c b/media/libeffects/lvm/lib/Reverb/src/LVREV_GetMemoryTable.c
new file mode 100755
index 0000000..e16a3d3
--- /dev/null
+++ b/media/libeffects/lvm/lib/Reverb/src/LVREV_GetMemoryTable.c
@@ -0,0 +1,254 @@
+/*
+ * 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: 1007 $*/
+/* $Date: 2010-06-28 14:06:36 +0200 (Mon, 28 Jun 2010) $*/
+/* */
+/****************************************************************************************/
+
+/****************************************************************************************/
+/* */
+/* Includes */
+/* */
+/****************************************************************************************/
+#include "LVREV_Private.h"
+#include "InstAlloc.h"
+
+/****************************************************************************************/
+/* */
+/* FUNCTION: LVREV_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. */
+/* */
+/* 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 table */
+/* pInstanceParams Pointer to the instance parameters */
+/* */
+/* RETURNS: */
+/* LVREV_Success Succeeded */
+/* LVREV_NULLADDRESS When pMemoryTable is NULL */
+/* LVREV_NULLADDRESS When requesting memory requirements and pInstanceParams */
+/* is NULL */
+/* */
+/* NOTES: */
+/* 1. This function may be interrupted by the LVREV_Process function */
+/* */
+/****************************************************************************************/
+LVREV_ReturnStatus_en LVREV_GetMemoryTable(LVREV_Handle_t hInstance,
+ LVREV_MemoryTable_st *pMemoryTable,
+ LVREV_InstanceParams_st *pInstanceParams)
+{
+
+ INST_ALLOC SlowData;
+ INST_ALLOC FastData;
+ INST_ALLOC FastCoef;
+ INST_ALLOC Temporary;
+ LVM_INT16 i;
+ LVM_UINT16 MaxBlockSize;
+
+
+ /*
+ * Check for error conditions
+ */
+ /* Check for NULL pointer */
+ if (pMemoryTable == LVM_NULL)
+ {
+ return(LVREV_NULLADDRESS);
+ }
+
+ /*
+ * Check all instance parameters are in range
+ */
+ if (pInstanceParams != LVM_NULL)
+ {
+ /*
+ * Call for memory allocation, so check the parameters
+ */
+ /* Check for a non-zero block size */
+ if (pInstanceParams->MaxBlockSize == 0)
+ {
+ return LVREV_OUTOFRANGE;
+ }
+
+ /* Check for a valid number of delay lines */
+ if ((pInstanceParams->NumDelays != LVREV_DELAYLINES_1) &&
+ (pInstanceParams->NumDelays != LVREV_DELAYLINES_2) &&
+ (pInstanceParams->NumDelays != LVREV_DELAYLINES_4))
+ {
+ return LVREV_OUTOFRANGE;
+ }
+ }
+
+ /*
+ * Initialise the InstAlloc instances
+ */
+ InstAlloc_Init(&SlowData, (void *)LVM_NULL);
+ InstAlloc_Init(&FastData, (void *)LVM_NULL);
+ InstAlloc_Init(&FastCoef, (void *)LVM_NULL);
+ InstAlloc_Init(&Temporary, (void *)LVM_NULL);
+
+
+ /*
+ * Fill in the memory table
+ */
+ if (hInstance == LVM_NULL)
+ {
+ /*
+ * Check for null pointers
+ */
+ if (pInstanceParams == LVM_NULL)
+ {
+ return(LVREV_NULLADDRESS);
+ }
+
+
+ /*
+ * Select the maximum internal block size
+ */
+ if(pInstanceParams->NumDelays ==LVREV_DELAYLINES_4)
+ {
+ MaxBlockSize = LVREV_MAX_AP3_DELAY;
+ }
+ else if(pInstanceParams->NumDelays ==LVREV_DELAYLINES_2)
+ {
+ MaxBlockSize = LVREV_MAX_AP1_DELAY;
+ }
+ else
+ {
+ MaxBlockSize = LVREV_MAX_AP0_DELAY;
+ }
+
+ if(MaxBlockSize>pInstanceParams->MaxBlockSize)
+ {
+ MaxBlockSize=pInstanceParams->MaxBlockSize;
+ }
+
+
+ /*
+ * Slow data memory
+ */
+ InstAlloc_AddMember(&SlowData, sizeof(LVREV_Instance_st));
+ pMemoryTable->Region[LVM_PERSISTENT_SLOW_DATA].Size = InstAlloc_GetTotal(&SlowData);
+ pMemoryTable->Region[LVM_PERSISTENT_SLOW_DATA].Type = LVM_PERSISTENT_SLOW_DATA;
+ pMemoryTable->Region[LVM_PERSISTENT_SLOW_DATA].pBaseAddress = LVM_NULL;
+
+
+ /*
+ * Persistent fast data memory
+ */
+ InstAlloc_AddMember(&FastData, sizeof(LVREV_FastData_st));
+ if(pInstanceParams->NumDelays == LVREV_DELAYLINES_4)
+ {
+ InstAlloc_AddMember(&FastData, LVREV_MAX_T3_DELAY * sizeof(LVM_INT32));
+ InstAlloc_AddMember(&FastData, LVREV_MAX_T2_DELAY * sizeof(LVM_INT32));
+ InstAlloc_AddMember(&FastData, LVREV_MAX_T1_DELAY * sizeof(LVM_INT32));
+ InstAlloc_AddMember(&FastData, LVREV_MAX_T0_DELAY * sizeof(LVM_INT32));
+ }
+
+ if(pInstanceParams->NumDelays == LVREV_DELAYLINES_2)
+ {
+ InstAlloc_AddMember(&FastData, LVREV_MAX_T1_DELAY * sizeof(LVM_INT32));
+ InstAlloc_AddMember(&FastData, LVREV_MAX_T0_DELAY * sizeof(LVM_INT32));
+ }
+
+ if(pInstanceParams->NumDelays == LVREV_DELAYLINES_1)
+ {
+ InstAlloc_AddMember(&FastData, LVREV_MAX_T0_DELAY * sizeof(LVM_INT32));
+ }
+
+ pMemoryTable->Region[LVM_PERSISTENT_FAST_DATA].Size = InstAlloc_GetTotal(&FastData);
+ pMemoryTable->Region[LVM_PERSISTENT_FAST_DATA].Type = LVM_PERSISTENT_FAST_DATA;
+ pMemoryTable->Region[LVM_PERSISTENT_FAST_DATA].pBaseAddress = LVM_NULL;
+
+
+ /*
+ * Persistent fast coefficient memory
+ */
+ InstAlloc_AddMember(&FastCoef, sizeof(LVREV_FastCoef_st));
+ pMemoryTable->Region[LVM_PERSISTENT_FAST_COEF].Size = InstAlloc_GetTotal(&FastCoef);
+ pMemoryTable->Region[LVM_PERSISTENT_FAST_COEF].Type = LVM_PERSISTENT_FAST_COEF;
+ pMemoryTable->Region[LVM_PERSISTENT_FAST_COEF].pBaseAddress = LVM_NULL;
+
+
+ /*
+ * Temporary fast memory
+ */
+ InstAlloc_AddMember(&Temporary, sizeof(LVM_INT32) * MaxBlockSize); /* General purpose scratch memory */
+ InstAlloc_AddMember(&Temporary, 2*sizeof(LVM_INT32) * MaxBlockSize); /* Mono->stereo input saved for end mix */
+
+ if(pInstanceParams->NumDelays == LVREV_DELAYLINES_4)
+ {
+ for(i=0; i<4; i++)
+ {
+ InstAlloc_AddMember(&Temporary, sizeof(LVM_INT32) * MaxBlockSize); /* A Scratch buffer for each delay line */
+ }
+ }
+
+ if(pInstanceParams->NumDelays == LVREV_DELAYLINES_2)
+ {
+ for(i=0; i<2; i++)
+ {
+ InstAlloc_AddMember(&Temporary, sizeof(LVM_INT32) * MaxBlockSize); /* A Scratch buffer for each delay line */
+ }
+ }
+
+ if(pInstanceParams->NumDelays == LVREV_DELAYLINES_1)
+ {
+ for(i=0; i<1; i++)
+ {
+ InstAlloc_AddMember(&Temporary, sizeof(LVM_INT32) * MaxBlockSize); /* A Scratch buffer for each delay line */
+ }
+ }
+
+ pMemoryTable->Region[LVM_TEMPORARY_FAST].Size = InstAlloc_GetTotal(&Temporary);
+ pMemoryTable->Region[LVM_TEMPORARY_FAST].Type = LVM_TEMPORARY_FAST;
+ pMemoryTable->Region[LVM_TEMPORARY_FAST].pBaseAddress = LVM_NULL;
+
+ }
+ else
+ {
+ LVREV_Instance_st *pLVREV_Private = (LVREV_Instance_st *)hInstance;
+
+
+ /*
+ * Read back memory allocation table
+ */
+ *pMemoryTable = pLVREV_Private->MemoryTable;
+ }
+
+
+ return(LVREV_SUCCESS);
+}
+
+/* End of file */
diff --git a/media/libeffects/lvm/lib/Reverb/src/LVREV_Private.h b/media/libeffects/lvm/lib/Reverb/src/LVREV_Private.h
new file mode 100755
index 0000000..896b051
--- /dev/null
+++ b/media/libeffects/lvm/lib/Reverb/src/LVREV_Private.h
@@ -0,0 +1,198 @@
+/*
+ * 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: nxp007753 $ */
+/* $Revision: 1316 $ */
+/* $Date: 2010-07-23 11:53:24 +0200 (Fri, 23 Jul 2010) $ */
+/* */
+/****************************************************************************************/
+
+#ifndef __LVREV_PRIVATE_H__
+#define __LVREV_PRIVATE_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/****************************************************************************************/
+/* */
+/* Includes */
+/* */
+/****************************************************************************************/
+#include "LVREV.h"
+#include "LVREV_Tables.h"
+#include "BIQUAD.h"
+#include "Filter.h"
+#include "VectorArithmetic.h"
+#include "Mixer.h"
+#include "LVM_Macros.h"
+
+
+/****************************************************************************************/
+/* */
+/* Defines */
+/* */
+/****************************************************************************************/
+/* General */
+#define ONE_OVER_SQRT_TWO 23170 /* 1/sqrt(2) * 2^15 */
+#define LVREV_B_8_on_1000 17179869 /* 0.8 * 2^31 */
+#define LVREV_HEADROOM 8192 /* -12dB * 2^15 */
+#define LVREV_2_9_INQ29 1583769190L /* 2.9 in Q29 format */
+#define LVREV_MIN3DB 0x5A82 /* -3dB in Q15 format */
+
+/* Intenal constants */
+#define LVREV_LP_Poly_Order 4
+#define LVREV_LP_Poly_Shift 5
+#define LVREV_T_3_Power_0_on_4 32768
+#define LVREV_T_3_Power_1_on_4 43125
+#define LVREV_T_3_Power_2_on_4 56755
+#define LVREV_T_3_Power_3_on_4 74694
+#define LVREV_T60_SCALE 306774 /*(32767/7000)<<16 */
+#define LVREV_T_3_Power_minus0_on_4 32767 /* 3^(-0/4) * 2^15 */
+#define LVREV_T_3_Power_minus1_on_4 24898 /* 3^(-1/4) * 2^15 */
+#define LVREV_T_3_Power_minus2_on_4 18919 /* 3^(-2/4) * 2^15 */
+#define LVREV_T_3_Power_minus3_on_4 14375 /* 3^(-3/4) * 2^15 */
+#define LVREV_MAX_T3_DELAY 2527 /* ((48000 * 120 * LVREV_T_3_Power_minus3_on_4) >> 15) / 1000 */
+#define LVREV_MAX_T2_DELAY 3326 /* ((48000 * 120 * LVREV_T_3_Power_minus2_on_4) >> 15) / 1000 */
+#define LVREV_MAX_T1_DELAY 4377 /* ((48000 * 120 * LVREV_T_3_Power_minus1_on_4) >> 15) / 1000 */
+#define LVREV_MAX_T0_DELAY 5760 /* ((48000 * 120 * LVREV_T_3_Power_minus0_on_4) >> 15) / 1000 */
+#define LVREV_MAX_AP3_DELAY 1685 /* ((48000 * 120 * LVREV_T_3_Power_minus3_on_4) >> 15) / 1500 */
+#define LVREV_MAX_AP2_DELAY 2218 /* ((48000 * 120 * LVREV_T_3_Power_minus2_on_4) >> 15) / 1500 */
+#define LVREV_MAX_AP1_DELAY 2918 /* ((48000 * 120 * LVREV_T_3_Power_minus1_on_4) >> 15) / 1500 */
+#define LVREV_MAX_AP0_DELAY 3840 /* ((48000 * 120 * LVREV_T_3_Power_minus0_on_4) >> 15) / 1500 */
+#define LVREV_BYPASSMIXER_TC 1000 /* Bypass mixer time constant*/
+#define LVREV_ALLPASS_TC 1000 /* All-pass filter time constant */
+#define LVREV_ALLPASS_TAP_TC 10000 /* All-pass filter dely tap change */
+#define LVREV_FEEDBACKMIXER_TC 100 /* Feedback mixer time constant*/
+#define LVREV_OUTPUTGAIN_SHIFT 5 /* Bits shift for output gain correction */
+
+/* Parameter limits */
+#define LVREV_NUM_FS 9 /* Number of supported sample rates */
+#define LVREV_MAXBLKSIZE_LIMIT 64 /* Maximum block size low limit */
+#define LVREV_MAX_LEVEL 100 /* Maximum level, 100% */
+#define LVREV_MIN_LPF_CORNER 50 /* Low pass filter limits */
+#define LVREV_MAX_LPF_CORNER 23999
+#define LVREV_MIN_HPF_CORNER 20 /* High pass filrer limits */
+#define LVREV_MAX_HPF_CORNER 1000
+#define LVREV_MAX_T60 7000 /* Maximum T60 time in ms */
+#define LVREV_MAX_DENSITY 100 /* Maximum density, 100% */
+#define LVREV_MAX_DAMPING 100 /* Maximum damping, 100% */
+#define LVREV_MAX_ROOMSIZE 100 /* Maximum room size, 100% */
+
+
+
+/****************************************************************************************/
+/* */
+/* Structures */
+/* */
+/****************************************************************************************/
+/* Fast data structure */
+typedef struct
+{
+
+ Biquad_1I_Order1_Taps_t HPTaps; /* High pass filter taps */
+ Biquad_1I_Order1_Taps_t LPTaps; /* Low pass filter taps */
+ Biquad_1I_Order1_Taps_t RevLPTaps[4]; /* Reverb low pass filters taps */
+
+} LVREV_FastData_st;
+
+
+/* Fast coefficient structure */
+typedef struct
+{
+
+ Biquad_Instance_t HPCoefs; /* High pass filter coefficients */
+ Biquad_Instance_t LPCoefs; /* Low pass filter coefficients */
+ Biquad_Instance_t RevLPCoefs[4]; /* Reverb low pass filters coefficients */
+
+} LVREV_FastCoef_st;
+
+
+/* Instance parameter structure */
+typedef struct
+{
+ /* General */
+ LVREV_InstanceParams_st InstanceParams; /* Initialisation time instance parameters */
+ LVREV_MemoryTable_st MemoryTable; /* Memory table */
+ LVREV_ControlParams_st CurrentParams; /* Parameters being used */
+ LVREV_ControlParams_st NewParams; /* New parameters from the calling application */
+ LVM_CHAR bControlPending; /* Flag to indicate new parameters are available */
+ LVM_CHAR bFirstControl; /* Flag to indicate that the control function is called for the first time */
+ LVM_CHAR bDisableReverb; /* Flag to indicate that the mix level is 0% and the reverb can be disabled */
+ LVM_INT32 RoomSizeInms; /* Room size in msec */
+ LVM_INT32 MaxBlkLen; /* Maximum block size for internal processing */
+
+ /* Aligned memory pointers */
+ LVREV_FastData_st *pFastData; /* Fast data memory base address */
+ LVREV_FastCoef_st *pFastCoef; /* Fast coefficient memory base address */
+ LVM_INT32 *pScratchDelayLine[4]; /* Delay line scratch memory */
+ LVM_INT32 *pScratch; /* Multi ussge scratch */
+ LVM_INT32 *pInputSave; /* Reverb block input save for dry/wet mixing*/
+
+ /* Feedback matrix */
+ Mix_1St_Cll_t FeedbackMixer[4]; /* Mixer for Pop and Click Supression caused by feedback Gain */
+
+ /* All-Pass Filter */
+ LVM_INT32 T[4]; /* Maximum delay size of buffer */
+ LVM_INT32 *pDelay_T[4]; /* Pointer to delay buffers */
+ LVM_INT32 Delay_AP[4]; /* Offset to AP delay buffer start */
+ LVM_INT16 AB_Selection; /* Smooth from tap A to B when 1 otherwise B to A */
+ LVM_INT32 A_DelaySize[4]; /* A delay length in samples */
+ LVM_INT32 B_DelaySize[4]; /* B delay length in samples */
+ LVM_INT32 *pOffsetA[4]; /* Offset for the A delay tap */
+ LVM_INT32 *pOffsetB[4]; /* Offset for the B delay tap */
+ Mix_2St_Cll_t Mixer_APTaps[4]; /* Smoothed AP delay mixer */
+ Mix_1St_Cll_t Mixer_SGFeedback[4]; /* Smoothed SAfeedback gain */
+ Mix_1St_Cll_t Mixer_SGFeedforward[4]; /* Smoothed AP feedforward gain */
+
+ /* Output gain */
+ Mix_2St_Cll_t BypassMixer; /* Dry/wet mixer */
+ LVM_INT16 Gain; /* Gain applied to output to maintain average signal power */
+ Mix_1St_Cll_t GainMixer; /* Gain smoothing */
+
+} LVREV_Instance_st;
+
+
+/****************************************************************************************/
+/* */
+/* Function prototypes */
+/* */
+/****************************************************************************************/
+
+LVREV_ReturnStatus_en LVREV_ApplyNewSettings(LVREV_Instance_st *pPrivate);
+
+void ReverbBlock(LVM_INT32 *pInput,
+ LVM_INT32 *pOutput,
+ LVREV_Instance_st *pPrivate,
+ LVM_UINT16 NumSamples);
+
+LVM_INT32 BypassMixer_Callback(void *pCallbackData,
+ void *pGeneralPurpose,
+ LVM_INT16 GeneralPurpose );
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /** __LVREV_PRIVATE_H__ **/
+
+/* End of file */
diff --git a/media/libeffects/lvm/lib/Reverb/src/LVREV_Process.c b/media/libeffects/lvm/lib/Reverb/src/LVREV_Process.c
new file mode 100755
index 0000000..822ac8f
--- /dev/null
+++ b/media/libeffects/lvm/lib/Reverb/src/LVREV_Process.c
@@ -0,0 +1,550 @@
+/*
+ * 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: nxp007753 $ */
+/* $Revision: 1316 $ */
+/* $Date: 2010-07-23 11:53:24 +0200 (Fri, 23 Jul 2010) $ */
+/* */
+/****************************************************************************************/
+
+/****************************************************************************************/
+/* */
+/* Includes */
+/* */
+/****************************************************************************************/
+#include "LVREV_Private.h"
+#include "VectorArithmetic.h"
+
+
+/****************************************************************************************/
+/* */
+/* FUNCTION: LVREV_Process */
+/* */
+/* DESCRIPTION: */
+/* Process function for the LVREV 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: */
+/* LVREV_Success Succeeded */
+/* LVREV_INVALIDNUMSAMPLES NumSamples was larger than the maximum block size */
+/* LVREV_NULLADDRESS When one of hInstance, pInData or pOutData is NULL */
+/* */
+/* NOTES: */
+/* 1. The input and output buffers must be 32-bit aligned */
+/* */
+/****************************************************************************************/
+LVREV_ReturnStatus_en LVREV_Process(LVREV_Handle_t hInstance,
+ const LVM_INT32 *pInData,
+ LVM_INT32 *pOutData,
+ const LVM_UINT16 NumSamples)
+{
+ LVREV_Instance_st *pLVREV_Private = (LVREV_Instance_st *)hInstance;
+ LVM_INT32 *pInput = (LVM_INT32 *)pInData;
+ LVM_INT32 *pOutput = pOutData;
+ LVM_INT32 SamplesToProcess, RemainingSamples, format;
+
+ /*
+ * Check for error conditions
+ */
+
+ /* Check for NULL pointers */
+ if((hInstance == LVM_NULL) || (pInData == LVM_NULL) || (pOutData == LVM_NULL))
+ {
+ return LVREV_NULLADDRESS;
+ }
+
+
+ /*
+ * Apply the new controls settings if required
+ */
+ if(pLVREV_Private->bControlPending == LVM_TRUE)
+ {
+ LVREV_ReturnStatus_en errorCode;
+
+ /*
+ * Clear the pending flag and update the control settings
+ */
+ pLVREV_Private->bControlPending = LVM_FALSE;
+
+ errorCode = LVREV_ApplyNewSettings (pLVREV_Private);
+
+ if(errorCode != LVREV_SUCCESS)
+ {
+ return errorCode;
+ }
+ }
+
+ /*
+ * Trap the case where the number of samples is zero.
+ */
+ if (NumSamples == 0)
+ {
+ return LVREV_SUCCESS;
+ }
+
+ RemainingSamples = (LVM_INT32)NumSamples;
+
+ format = 1;
+ if (pLVREV_Private->CurrentParams.SourceFormat != LVM_MONO)
+ {
+ format = 2;
+ }
+
+ while (RemainingSamples!=0)
+ {
+ /*
+ * If OFF copy and reformat the data as necessary
+ */
+ if (pLVREV_Private->CurrentParams.OperatingMode == LVM_MODE_OFF)
+ {
+ if((pInput != pOutput) || (pLVREV_Private->CurrentParams.SourceFormat == LVM_MONO))
+ {
+ /*
+ * Copy the data to the output buffer
+ */
+
+ if (pLVREV_Private->CurrentParams.SourceFormat != LVM_MONO)
+ {
+ RemainingSamples = (RemainingSamples << 1); /* Stereo data */
+ }
+
+ Copy_16((LVM_INT16 *)pInput,
+ (LVM_INT16 *)pOutput,
+ (LVM_INT16)(RemainingSamples << 1));
+ }
+
+ RemainingSamples = 0;
+ }
+
+ /*
+ * Process the data
+ */
+ else
+ {
+
+ if(RemainingSamples > pLVREV_Private->MaxBlkLen)
+ {
+ SamplesToProcess = pLVREV_Private->MaxBlkLen;
+ RemainingSamples = (LVM_INT16)(RemainingSamples - SamplesToProcess);
+ }
+ else
+ {
+ SamplesToProcess = RemainingSamples;
+ RemainingSamples = 0;
+ }
+
+ ReverbBlock(pInput, pOutput, pLVREV_Private, (LVM_UINT16)SamplesToProcess);
+
+ pInput = (LVM_INT32 *)(pInput +(SamplesToProcess*format));
+ pOutput = (LVM_INT32 *)(pOutput+(SamplesToProcess*format));
+ }
+ }
+
+ return LVREV_SUCCESS;
+}
+
+
+
+/****************************************************************************************/
+/* */
+/* FUNCTION: ReverbBlock */
+/* */
+/* DESCRIPTION: */
+/* Process function for the LVREV 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: */
+/* LVREV_Success Succeeded */
+/* LVREV_INVALIDNUMSAMPLES NumSamples was larger than the maximum block size */
+/* LVREV_NULLADDRESS When one of hInstance, pInData or pOutData is NULL */
+/* */
+/* NOTES: */
+/* 1. The input and output buffers must be 32-bit aligned */
+/* */
+/****************************************************************************************/
+
+void ReverbBlock(LVM_INT32 *pInput, LVM_INT32 *pOutput, LVREV_Instance_st *pPrivate, LVM_UINT16 NumSamples)
+{
+ LVM_INT16 j, size;
+ LVM_INT32 *pDelayLine;
+ LVM_INT32 *pDelayLineInput = pPrivate->pScratch;
+ LVM_INT32 *pScratch = pPrivate->pScratch;
+ LVM_INT32 *pIn;
+ LVM_INT32 *pTemp = pPrivate->pInputSave;
+ LVM_INT32 NumberOfDelayLines;
+
+ /******************************************************************************
+ * All calculations will go into the buffer pointed to by pTemp, this will *
+ * then be mixed with the original input to create the final output. *
+ * *
+ * When INPLACE processing is selected this must be a temporary buffer and *
+ * hence this is the worst case, so for simplicity this will ALWAYS be so *
+ * *
+ * The input buffer will remain untouched until the output of the mixer if *
+ * INPLACE processing is selected. *
+ * *
+ * The temp buffer will always be NumSamples in size regardless of MONO or *
+ * STEREO input. In the case of stereo input all processing is done in MONO *
+ * and the final output is converted to STEREO after the mixer *
+ ******************************************************************************/
+
+ if(pPrivate->InstanceParams.NumDelays == LVREV_DELAYLINES_4 )
+ {
+ NumberOfDelayLines = 4;
+ }
+ else if(pPrivate->InstanceParams.NumDelays == LVREV_DELAYLINES_2 )
+ {
+ NumberOfDelayLines = 2;
+ }
+ else
+ {
+ NumberOfDelayLines = 1;
+ }
+
+ if(pPrivate->CurrentParams.SourceFormat == LVM_MONO)
+ {
+ pIn = pInput;
+ }
+ else
+ {
+ /*
+ * Stereo to mono conversion
+ */
+
+ From2iToMono_32( pInput,
+ pTemp,
+ (LVM_INT16)NumSamples);
+
+ pIn = pTemp;
+ }
+
+ Mult3s_32x16(pIn,
+ (LVM_INT16)LVREV_HEADROOM,
+ pTemp,
+ (LVM_INT16)NumSamples);
+
+ /*
+ * High pass filter
+ */
+ FO_1I_D32F32C31_TRC_WRA_01( &pPrivate->pFastCoef->HPCoefs,
+ pTemp,
+ pTemp,
+ (LVM_INT16)NumSamples);
+ /*
+ * Low pass filter
+ */
+ FO_1I_D32F32C31_TRC_WRA_01( &pPrivate->pFastCoef->LPCoefs,
+ pTemp,
+ pTemp,
+ (LVM_INT16)NumSamples);
+
+ /*
+ * Process all delay lines
+ */
+
+ for(j = 0; j < NumberOfDelayLines; j++)
+ {
+ pDelayLine = pPrivate->pScratchDelayLine[j];
+
+ /*
+ * All-pass filter with pop and click suppression
+ */
+ /* Get the smoothed, delayed output. Put it in the output buffer */
+ MixSoft_2St_D32C31_SAT(&pPrivate->Mixer_APTaps[j],
+ pPrivate->pOffsetA[j],
+ pPrivate->pOffsetB[j],
+ pDelayLine,
+ (LVM_INT16)NumSamples);
+ /* Re-align the all pass filter delay buffer and copying the fixed delay data to the AP delay in the process */
+ Copy_16((LVM_INT16 *)&pPrivate->pDelay_T[j][NumSamples],
+ (LVM_INT16 *)pPrivate->pDelay_T[j],
+ (LVM_INT16)((pPrivate->T[j]-NumSamples) << 1)); /* 32-bit data */
+ /* Apply the smoothed feedback and save to fixed delay input (currently empty) */
+ MixSoft_1St_D32C31_WRA(&pPrivate->Mixer_SGFeedback[j],
+ pDelayLine,
+ &pPrivate->pDelay_T[j][pPrivate->T[j]-NumSamples],
+ (LVM_INT16)NumSamples);
+ /* Sum into the AP delay line */
+ Mac3s_Sat_32x16(&pPrivate->pDelay_T[j][pPrivate->T[j]-NumSamples],
+ -0x7fff, /* Invert since the feedback coefficient is negative */
+ &pPrivate->pDelay_T[j][pPrivate->Delay_AP[j]-NumSamples],
+ (LVM_INT16)NumSamples);
+ /* Apply smoothed feedforward sand save to fixed delay input (currently empty) */
+ MixSoft_1St_D32C31_WRA(&pPrivate->Mixer_SGFeedforward[j],
+ &pPrivate->pDelay_T[j][pPrivate->Delay_AP[j]-NumSamples],
+ &pPrivate->pDelay_T[j][pPrivate->T[j]-NumSamples],
+ (LVM_INT16)NumSamples);
+ /* Sum into the AP output */
+ Mac3s_Sat_32x16(&pPrivate->pDelay_T[j][pPrivate->T[j]-NumSamples],
+ 0x7fff,
+ pDelayLine,
+ (LVM_INT16)NumSamples);
+
+ /*
+ * Feedback gain
+ */
+ MixSoft_1St_D32C31_WRA(&pPrivate->FeedbackMixer[j], pDelayLine, pDelayLine, NumSamples);
+
+ /*
+ * Low pass filter
+ */
+ FO_1I_D32F32C31_TRC_WRA_01( &pPrivate->pFastCoef->RevLPCoefs[j],
+ pDelayLine,
+ pDelayLine,
+ (LVM_INT16)NumSamples);
+ }
+
+ /*
+ * Apply rotation matrix and delay samples
+ */
+ for(j = 0; j < NumberOfDelayLines; j++)
+ {
+
+ Copy_16( (LVM_INT16*)(pTemp),
+ (LVM_INT16*)(pDelayLineInput),
+ (LVM_INT16)(NumSamples << 1));
+
+ /*
+ * Rotation matrix mix
+ */
+ switch(j)
+ {
+ case 3:
+ /*
+ * Add delay line 1 and 2 contribution
+ */
+ Mac3s_Sat_32x16(pPrivate->pScratchDelayLine[1], -0x8000, pDelayLineInput, (LVM_INT16)NumSamples);
+ Mac3s_Sat_32x16(pPrivate->pScratchDelayLine[2], -0x8000, pDelayLineInput, (LVM_INT16)NumSamples);
+
+ break;
+ case 2:
+
+ /*
+ * Add delay line 0 and 3 contribution
+ */
+ Mac3s_Sat_32x16(pPrivate->pScratchDelayLine[0], -0x8000, pDelayLineInput, (LVM_INT16)NumSamples);
+ Mac3s_Sat_32x16(pPrivate->pScratchDelayLine[3], -0x8000, pDelayLineInput, (LVM_INT16)NumSamples);
+
+ break;
+ case 1:
+ if(pPrivate->InstanceParams.NumDelays == LVREV_DELAYLINES_4)
+ {
+ /*
+ * Add delay line 0 and 3 contribution
+ */
+ Mac3s_Sat_32x16(pPrivate->pScratchDelayLine[0], -0x8000, pDelayLineInput, (LVM_INT16)NumSamples);
+ Add2_Sat_32x32(pPrivate->pScratchDelayLine[3], pDelayLineInput, (LVM_INT16)NumSamples);
+
+ }
+ else
+ {
+ /*
+ * Add delay line 0 and 1 contribution
+ */
+ Mac3s_Sat_32x16(pPrivate->pScratchDelayLine[0], -0x8000, pDelayLineInput, (LVM_INT16)NumSamples);
+ Mac3s_Sat_32x16(pPrivate->pScratchDelayLine[1], -0x8000, pDelayLineInput, (LVM_INT16)NumSamples);
+
+ }
+ break;
+ case 0:
+ if(pPrivate->InstanceParams.NumDelays == LVREV_DELAYLINES_4)
+ {
+ /*
+ * Add delay line 1 and 2 contribution
+ */
+ Mac3s_Sat_32x16(pPrivate->pScratchDelayLine[1], -0x8000, pDelayLineInput, (LVM_INT16)NumSamples);
+ Add2_Sat_32x32(pPrivate->pScratchDelayLine[2], pDelayLineInput, (LVM_INT16)NumSamples);
+
+ }
+ else if(pPrivate->InstanceParams.NumDelays == LVREV_DELAYLINES_2)
+ {
+ /*
+ * Add delay line 0 and 1 contribution
+ */
+ Add2_Sat_32x32(pPrivate->pScratchDelayLine[0], pDelayLineInput, (LVM_INT16)NumSamples);
+ Mac3s_Sat_32x16(pPrivate->pScratchDelayLine[1], -0x8000, pDelayLineInput, (LVM_INT16)NumSamples);
+
+ }
+ else
+ {
+ /*
+ * Add delay line 0 contribution
+ */
+
+ /* SOURCE DESTINATION*/
+ Add2_Sat_32x32(pPrivate->pScratchDelayLine[0], pDelayLineInput, (LVM_INT16)NumSamples);
+ }
+ break;
+ default:
+ break;
+ }
+
+ /*
+ * Delay samples
+ */
+ Copy_16((LVM_INT16 *)pDelayLineInput,
+ (LVM_INT16 *)&pPrivate->pDelay_T[j][pPrivate->T[j]-NumSamples],
+ (LVM_INT16)(NumSamples << 1)); /* 32-bit data */
+
+ }
+
+
+ /*
+ * Create stereo output
+ */
+ switch(pPrivate->InstanceParams.NumDelays)
+ {
+ case LVREV_DELAYLINES_4:
+ Add2_Sat_32x32(pPrivate->pScratchDelayLine[3],
+ pPrivate->pScratchDelayLine[0],
+ (LVM_INT16)NumSamples);
+ Add2_Sat_32x32(pPrivate->pScratchDelayLine[2],
+ pPrivate->pScratchDelayLine[1],
+ (LVM_INT16)NumSamples);
+
+ if(pPrivate->CurrentParams.SourceFormat != LVM_MONO)
+ {
+ JoinTo2i_32x32(pPrivate->pScratchDelayLine[0],
+ pPrivate->pScratchDelayLine[1],
+ pTemp,
+ (LVM_INT16)NumSamples);
+
+ }
+ else
+ {
+ Add2_Sat_32x32(pPrivate->pScratchDelayLine[1],
+ pPrivate->pScratchDelayLine[0],
+ (LVM_INT16)NumSamples);
+
+ /*Apply 3-dB gain in-order to compensate for the gain change in stereo mode*/
+ Mult3s_32x16(pPrivate->pScratchDelayLine[0],
+ LVREV_MIN3DB,
+ pTemp,
+ (LVM_INT16)NumSamples);
+ }
+ break;
+ case LVREV_DELAYLINES_2:
+
+ Copy_16( (LVM_INT16*)pPrivate->pScratchDelayLine[1],
+ (LVM_INT16*)pScratch,
+ (LVM_INT16)(NumSamples << 1));
+
+
+
+ if(pPrivate->CurrentParams.SourceFormat != LVM_MONO)
+ {
+
+ Mac3s_Sat_32x16(pPrivate->pScratchDelayLine[0],
+ -0x8000,
+ pScratch,
+ (LVM_INT16)NumSamples);
+ }
+
+ Add2_Sat_32x32(pPrivate->pScratchDelayLine[1],
+ pPrivate->pScratchDelayLine[0],
+ (LVM_INT16)NumSamples);
+
+
+ if(pPrivate->CurrentParams.SourceFormat != LVM_MONO)
+ {
+ JoinTo2i_32x32(pPrivate->pScratchDelayLine[0],
+ pScratch,
+ pTemp,
+ (LVM_INT16)NumSamples);
+ }
+ else
+ {
+ Copy_16( (LVM_INT16*)pPrivate->pScratchDelayLine[0],
+ (LVM_INT16*)pTemp,
+ (LVM_INT16)(NumSamples << 1));
+
+ }
+ break;
+ case LVREV_DELAYLINES_1:
+ if(pPrivate->CurrentParams.SourceFormat != LVM_MONO)
+ {
+
+ MonoTo2I_32(pPrivate->pScratchDelayLine[0],
+ pTemp,
+ (LVM_INT16)NumSamples);
+ }
+ else
+ {
+ pTemp = pPrivate->pScratchDelayLine[0];
+ }
+ break;
+ default:
+ break;
+ }
+
+
+ /*
+ * Dry/wet mixer
+ */
+ if(pPrivate->CurrentParams.SourceFormat != LVM_MONO)
+ {
+ size = (LVM_INT16)(NumSamples << 1);
+ }
+ else
+ {
+ size = (LVM_INT16)NumSamples;
+ }
+
+ MixSoft_2St_D32C31_SAT(&pPrivate->BypassMixer,
+ pInput,
+ pTemp,
+ pOutput,
+ size);
+
+ /* Apply Gain*/
+ if(pPrivate->CurrentParams.SourceFormat != LVM_MONO)
+ {
+ size = (LVM_INT16)(NumSamples << 1);
+ }
+ else
+ {
+ size = (LVM_INT16)NumSamples;
+ }
+
+ Shift_Sat_v32xv32 (LVREV_OUTPUTGAIN_SHIFT,
+ pOutput,
+ pOutput,
+ size);
+
+ MixSoft_1St_D32C31_WRA(&pPrivate->GainMixer,
+ pOutput,
+ pOutput,
+ size);
+ return;
+}
+
+
+/* End of file */
+
diff --git a/media/libeffects/lvm/lib/Reverb/src/LVREV_SetControlParameters.c b/media/libeffects/lvm/lib/Reverb/src/LVREV_SetControlParameters.c
new file mode 100755
index 0000000..124fd3b
--- /dev/null
+++ b/media/libeffects/lvm/lib/Reverb/src/LVREV_SetControlParameters.c
@@ -0,0 +1,128 @@
+/*
+ * 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: nxp007753 $ */
+/* $Revision: 1316 $ */
+/* $Date: 2010-07-23 11:53:24 +0200 (Fri, 23 Jul 2010) $ */
+/* */
+/****************************************************************************************/
+
+/****************************************************************************************/
+/* */
+/* Includes */
+/* */
+/****************************************************************************************/
+#include "LVREV_Private.h"
+
+/****************************************************************************************/
+/* */
+/* FUNCTION: LVREV_SetControlParameters */
+/* */
+/* DESCRIPTION: */
+/* Sets or changes the LVREV module parameters. */
+/* */
+/* PARAMETERS: */
+/* hInstance Instance handle */
+/* pNewParams Pointer to a parameter structure */
+/* */
+/* RETURNS: */
+/* LVM_Success Succeeded */
+/* LVREV_NULLADDRESS When hInstance or pNewParams is NULL */
+/* LVREV_OUTOFRANGE When any of the new parameters is out of range */
+/* */
+/* NOTES: */
+/* 1. This function may be interrupted by the LVREV_Process function */
+/* */
+/****************************************************************************************/
+LVREV_ReturnStatus_en LVREV_SetControlParameters(LVREV_Handle_t hInstance,
+ LVREV_ControlParams_st *pNewParams)
+{
+
+ LVREV_Instance_st *pLVREV_Private = (LVREV_Instance_st *)hInstance;
+
+
+ /*
+ * Check for error conditions
+ */
+ if((hInstance == LVM_NULL) || (pNewParams == LVM_NULL))
+ {
+ return LVREV_NULLADDRESS;
+ }
+
+ /*
+ * Check all new control parameters are in range
+ */
+ if( ((pNewParams->OperatingMode != LVM_MODE_OFF) && (pNewParams->OperatingMode != LVM_MODE_ON)) ||
+ ((pNewParams->SampleRate != LVM_FS_8000) && (pNewParams->SampleRate != LVM_FS_11025) && (pNewParams->SampleRate != LVM_FS_12000) &&
+ (pNewParams->SampleRate != LVM_FS_16000) && (pNewParams->SampleRate != LVM_FS_22050) && (pNewParams->SampleRate != LVM_FS_24000) &&
+ (pNewParams->SampleRate != LVM_FS_32000) && (pNewParams->SampleRate != LVM_FS_44100) && (pNewParams->SampleRate != LVM_FS_48000)) ||
+ ((pNewParams->SourceFormat != LVM_STEREO) && (pNewParams->SourceFormat != LVM_MONOINSTEREO) && (pNewParams->SourceFormat != LVM_MONO)) )
+ {
+ return (LVREV_OUTOFRANGE);
+ }
+
+
+ if (pNewParams->Level > LVREV_MAX_LEVEL)
+ {
+ return LVREV_OUTOFRANGE;
+ }
+
+ if ((pNewParams->LPF < LVREV_MIN_LPF_CORNER) || (pNewParams->LPF > LVREV_MAX_LPF_CORNER))
+ {
+ return LVREV_OUTOFRANGE;
+ }
+
+ if ((pNewParams->HPF < LVREV_MIN_HPF_CORNER) || (pNewParams->HPF > LVREV_MAX_HPF_CORNER))
+ {
+ return LVREV_OUTOFRANGE;
+ }
+
+ if (pNewParams->T60 > LVREV_MAX_T60)
+ {
+ return LVREV_OUTOFRANGE;
+ }
+
+ if (pNewParams->Density > LVREV_MAX_DENSITY)
+ {
+ return LVREV_OUTOFRANGE;
+ }
+
+ if (pNewParams->Damping > LVREV_MAX_DAMPING)
+ {
+ return LVREV_OUTOFRANGE;
+ }
+
+ if (pNewParams->RoomSize > LVREV_MAX_ROOMSIZE)
+ {
+ return LVREV_OUTOFRANGE;
+ }
+
+
+
+ /*
+ * Copy the new parameters and set the flag to indicate they are available
+ */
+ pLVREV_Private->NewParams = *pNewParams;
+ pLVREV_Private->bControlPending = LVM_TRUE;
+
+ return LVREV_SUCCESS;
+}
+
+/* End of file */
diff --git a/media/libeffects/lvm/lib/Reverb/src/LVREV_Tables.c b/media/libeffects/lvm/lib/Reverb/src/LVREV_Tables.c
new file mode 100755
index 0000000..9249a31
--- /dev/null
+++ b/media/libeffects/lvm/lib/Reverb/src/LVREV_Tables.c
@@ -0,0 +1,108 @@
+/*
+ * 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: 1011 $ */
+/* $Date: 2010-06-28 15:07:08 +0200 (Mon, 28 Jun 2010) $ */
+/* */
+/****************************************************************************************/
+
+/****************************************************************************************/
+/* */
+/* Includes */
+/* */
+/****************************************************************************************/
+#include "LVREV.h"
+
+/****************************************************************************************/
+/* */
+/* Tables */
+/* */
+/****************************************************************************************/
+
+/* Table with supported sampling rates. The table can be indexed using LVM_Fs_en */
+const LVM_UINT16 LVM_FsTable[] = {
+ 8000 ,
+ 11025,
+ 12000,
+ 16000,
+ 22050,
+ 24000,
+ 32000,
+ 44100,
+ 48000
+};
+
+/* Table with supported sampling rates. The table can be indexed using LVM_Fs_en */
+LVM_UINT16 LVM_GetFsFromTable(LVM_Fs_en FsIndex){
+ if (FsIndex > LVM_FS_48000)
+ return 0;
+
+ return (LVM_FsTable[FsIndex]);
+}
+
+/* In order to maintain consistant input and out put signal strengths
+ output gain/attenuation is applied. This gain depends on T60 and Rooms
+ size parameters. These polynomial coefficients are calculated experimentally.
+ First value in the table is room size
+ second value is A0
+ third value is A1
+ fourth value is A2
+ fifth value is A3
+ sixth value is A4
+
+ shift value is to be added array (to use LVM_Polynomial function)
+
+ The gain is calculated using variable x=(T60*32767/7000)*32768;
+
+ first values is used to get polynomial set for given room size,
+ For room sizes which are not in the table, linear interpolation can be used.
+
+ */
+
+/* Normalizing output including Reverb Level part (only shift up)*/
+const LVM_INT32 LVREV_GainPolyTable[24][5]={{1,17547434,128867434,-120988896,50761228,},
+ {2,18256869,172666902,-193169292,88345744,},
+ {3,16591311,139250151,-149667234,66770059,},
+ {4,17379977,170835131,-173579321,76278163,},
+ {5,18963512,210364934,-228623519,103435022,},
+ {6,17796318,135756417,-144084053,64327698,},
+ {7,17454695,174593214,-187513064,85146582,},
+ {8,17229257,140715570,-145790588,65361740,},
+ {9,17000547,163195946,-176733969,79562130,},
+ {10,16711699,142476304,-133339887,58366547,},
+ {13,18108419,149223697,-161762020,74397589,},
+ {15,16682043,124844884,-134284487,60082180,},
+ {17,16627346,120936430,-121766674,53146421,},
+ {20,17338325,125432694,-126616983,56534237,},
+ {25,16489146,99218217,-94597467,40616506,},
+ {30,15582373,84479043,-75365006,30952348,},
+ {40,16000669,84896611,-75031127,30696306,},
+ {50,15087054,71695031,-59349268,23279669,},
+ {60,15830714,68672971,-58211201,23671158,},
+ {70,15536061,66657972,-55901437,22560153,},
+ {75,15013145,48179917,-24138354,5232074,},
+ {80,15688738,50195036,-34206760,11515792,},
+ {90,16003322,48323661,-35607378,13153872,},
+ {100,15955223,48558201,-33706865,11715792,},
+ };
+
+/* End of file */
+
diff --git a/media/libeffects/lvm/lib/Reverb/src/LVREV_Tables.h b/media/libeffects/lvm/lib/Reverb/src/LVREV_Tables.h
new file mode 100755
index 0000000..98471be
--- /dev/null
+++ b/media/libeffects/lvm/lib/Reverb/src/LVREV_Tables.h
@@ -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.
+ */
+
+/****************************************************************************************/
+/* */
+/* Project:: */
+/* $Author: beq07716 $ */
+/* $Revision: 773 $ */
+/* $Date: 2010-06-14 10:43:54 +0200 (Mon, 14 Jun 2010) $ */
+/* */
+/****************************************************************************************/
+
+
+#ifndef _LVREV_TABLES_H_
+#define _LVREV_TABLES_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/****************************************************************************************/
+/* */
+/* Includes */
+/* */
+/****************************************************************************************/
+#include "LVREV_Private.h"
+
+/****************************************************************************************/
+/* */
+/* Definitions */
+/* */
+/****************************************************************************************/
+
+extern const LVM_UINT16 LVM_FsTable[];
+extern LVM_UINT16 LVM_GetFsFromTable(LVM_Fs_en FsIndex);
+extern LVM_INT32 LVREV_GainPolyTable[24][5];
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /** _LVREV_TABLES_H_ **/
+
+/* End of file */
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Control.c b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Control.c
index fea44bf..668b151 100755
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Control.c
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Control.c
@@ -17,9 +17,9 @@
/************************************************************************************
- $Author: beq06068 $
- $Revision: 1307 $
- $Date: 2010-07-22 17:41:25 +0200 (Thu, 22 Jul 2010) $
+ $Author: nxp007753 $
+ $Revision: 1331 $
+ $Date: 2010-07-27 12:26:23 +0200 (Tue, 27 Jul 2010) $
*************************************************************************************/
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Equaliser.c b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Equaliser.c
index 7ab6571..d8023d6 100755
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Equaliser.c
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Equaliser.c
@@ -18,8 +18,8 @@
/************************************************************************************
$Author: nxp007753 $
- $Revision: 1315 $
- $Date: 2010-07-23 11:52:08 +0200 (Fri, 23 Jul 2010) $
+ $Revision: 1331 $
+ $Date: 2010-07-27 12:26:23 +0200 (Tue, 27 Jul 2010) $
*************************************************************************************/
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Init.c b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Init.c
index f5f7cd0..82a8db2 100755
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Init.c
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_Init.c
@@ -17,9 +17,9 @@
/************************************************************************************
- $Author: beq06068 $
- $Revision: 1307 $
- $Date: 2010-07-22 17:41:25 +0200 (Thu, 22 Jul 2010) $
+ $Author: nxp007753 $
+ $Revision: 1331 $
+ $Date: 2010-07-27 12:26:23 +0200 (Tue, 27 Jul 2010) $
*************************************************************************************/
diff --git a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_StereoEnhancer.c b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_StereoEnhancer.c
index b67d824..83748e6 100755
--- a/media/libeffects/lvm/lib/StereoWidening/src/LVCS_StereoEnhancer.c
+++ b/media/libeffects/lvm/lib/StereoWidening/src/LVCS_StereoEnhancer.c
@@ -18,8 +18,8 @@
/************************************************************************************
$Author: nxp007753 $
- $Revision: 1315 $
- $Date: 2010-07-23 11:52:08 +0200 (Fri, 23 Jul 2010) $
+ $Revision: 1331 $
+ $Date: 2010-07-27 12:26:23 +0200 (Tue, 27 Jul 2010) $
*************************************************************************************/