Loading media/libeffects/lvm/lib/Android.bp +0 −11 Original line number Diff line number Diff line Loading @@ -69,28 +69,20 @@ cc_library_static { "Common/src/PK_2I_D32F32C14G11_TRC_WRA_01.cpp", "Common/src/PK_2I_D32F32CssGss_TRC_WRA_01_Init.cpp", "Common/src/PK_2I_D32F32CllGss_TRC_WRA_01_Init.cpp", "Common/src/Int16LShiftToInt32_16x32.cpp", "Common/src/From2iToMono_16.cpp", "Common/src/Copy_16.cpp", "Common/src/MonoTo2I_16.cpp", "Common/src/MonoTo2I_32.cpp", "Common/src/LoadConst_16.cpp", "Common/src/LoadConst_32.cpp", "Common/src/dB_to_Lin32.cpp", "Common/src/Shift_Sat_v16xv16.cpp", "Common/src/Shift_Sat_v32xv32.cpp", "Common/src/Abs_32.cpp", "Common/src/Int32RShiftToInt16_Sat_32x16.cpp", "Common/src/From2iToMono_32.cpp", "Common/src/mult3s_16x16.cpp", "Common/src/Mult3s_32x16.cpp", "Common/src/NonLinComp_D16.cpp", "Common/src/DelayMix_16x16.cpp", "Common/src/MSTo2i_Sat_16x16.cpp", "Common/src/From2iToMS_16x16.cpp", "Common/src/Mac3s_Sat_16x16.cpp", "Common/src/Mac3s_Sat_32x16.cpp", "Common/src/Add2_Sat_16x16.cpp", "Common/src/Add2_Sat_32x32.cpp", "Common/src/LVC_MixSoft_1St_2i_D16C31_SAT.cpp", "Common/src/LVC_MixSoft_1St_D16C31_SAT.cpp", Loading Loading @@ -168,16 +160,13 @@ cc_library_static { "Reverb/src/LVREV_Tables.cpp", "Common/src/Abs_32.cpp", "Common/src/InstAlloc.cpp", "Common/src/LoadConst_16.cpp", "Common/src/LoadConst_32.cpp", "Common/src/From2iToMono_32.cpp", "Common/src/Mult3s_32x16.cpp", "Common/src/FO_1I_D32F32C31_TRC_WRA_01.cpp", "Common/src/FO_1I_D32F32Cll_TRC_WRA_01_Init.cpp", "Common/src/DelayAllPass_Sat_32x16To32.cpp", "Common/src/Copy_16.cpp", "Common/src/Mac3s_Sat_32x16.cpp", "Common/src/DelayWrite_32.cpp", "Common/src/Shift_Sat_v32xv32.cpp", "Common/src/Add2_Sat_32x32.cpp", "Common/src/JoinTo2i_32x32.cpp", Loading media/libeffects/lvm/lib/Common/lib/AGC.h +0 −5 Original line number Diff line number Diff line Loading @@ -48,11 +48,6 @@ typedef struct { /* Function Prototypes */ /* */ /**********************************************************************************/ void AGC_MIX_VOL_2St1Mon_D32_WRA(AGC_MIX_VOL_2St1Mon_FLOAT_t* pInstance, /* Instance pointer */ const LVM_FLOAT* pStSrc, /* Stereo source */ const LVM_FLOAT* pMonoSrc, /* Mono source */ LVM_FLOAT* pDst, /* Stereo destination */ LVM_UINT16 n); /* Number of samples */ void AGC_MIX_VOL_Mc1Mon_D32_WRA(AGC_MIX_VOL_2St1Mon_FLOAT_t* pInstance, /* Instance pointer */ const LVM_FLOAT* pStSrc, /* Source */ const LVM_FLOAT* pMonoSrc, /* Mono source */ Loading media/libeffects/lvm/lib/Common/lib/BIQUAD.h +0 −4 Original line number Diff line number Diff line Loading @@ -161,8 +161,6 @@ void FO_2I_D16F32Css_LShx_TRC_WRA_01_Init(Biquad_FLOAT_Instance_t* pInstance, Biquad_2I_Order1_FLOAT_Taps_t* pTaps, FO_FLOAT_LShx_Coefs_t* pCoef); void FO_2I_D16F32C15_LShx_TRC_WRA_01(Biquad_FLOAT_Instance_t* pInstance, LVM_FLOAT* pDataIn, LVM_FLOAT* pDataOut, LVM_INT16 NrSamples); /*** 32 bit data path *************************************************************/ void FO_1I_D32F32Cll_TRC_WRA_01_Init(Biquad_FLOAT_Instance_t* pInstance, Biquad_1I_Order1_FLOAT_Taps_t* pTaps, FO_FLOAT_Coefs_t* pCoef); Loading Loading @@ -193,8 +191,6 @@ void BP_1I_D32F32C30_TRC_WRA_02(Biquad_FLOAT_Instance_t* pInstance, LVM_FLOAT* p void PK_2I_D32F32CssGss_TRC_WRA_01_Init(Biquad_FLOAT_Instance_t* pInstance, Biquad_2I_Order2_FLOAT_Taps_t* pTaps, PK_FLOAT_Coefs_t* pCoef); void PK_2I_D32F32C14G11_TRC_WRA_01(Biquad_FLOAT_Instance_t* pInstance, LVM_FLOAT* pDataIn, LVM_FLOAT* pDataOut, LVM_INT16 NrSamples); void PK_Mc_D32F32C14G11_TRC_WRA_01(Biquad_FLOAT_Instance_t* pInstance, LVM_FLOAT* pDataIn, LVM_FLOAT* pDataOut, LVM_INT16 NrFrames, LVM_INT16 NrChannels); Loading media/libeffects/lvm/lib/Common/lib/VectorArithmetic.h +0 −38 Original line number Diff line number Diff line Loading @@ -32,45 +32,16 @@ void Copy_Float_Mc_Stereo(const LVM_FLOAT* src, LVM_FLOAT* dst, LVM_INT16 NrFram void Copy_Float_Stereo_Mc(const LVM_FLOAT* src, LVM_FLOAT* StereoOut, LVM_FLOAT* dst, LVM_INT16 NrFrames, LVM_INT32 NrChannels); /********************************************************************************* * note: In Mult3s_16x16() saturation of result is not taken care when * * overflow occurs. * * For example when *src = 0x8000, val = *0x8000 * * The function gives the output as 0x8000 instead of 0x7fff * * This is the only case which will give wrong result. * * For more information refer to Vector_Arithmetic.doc in /doc folder * *********************************************************************************/ void Mult3s_Float(const LVM_FLOAT* src, const LVM_FLOAT val, LVM_FLOAT* dst, LVM_INT16 n); /********************************************************************************* * note: In Mult3s_32x16() saturation of result is not taken care when * * overflow occurs. * * For example when *src = 0x8000000, val = *0x8000 * * The function gives the output as 0x8000000 instead of 0x7fffffff * * This is the only extreme condition which is giving unexpected result * * For more information refer to Vector_Arithmetic.doc in /doc folder * *********************************************************************************/ void Mult3s_32x16(const LVM_INT32* src, const LVM_INT16 val, LVM_INT32* dst, LVM_INT16 n); void DelayMix_Float(const LVM_FLOAT* src, /* Source 1, to be delayed */ LVM_FLOAT* delay, /* Delay buffer */ LVM_INT16 size, /* Delay size */ LVM_FLOAT* dst, /* Source/destination */ LVM_INT16* pOffset, /* Delay offset */ LVM_INT16 n); /* Number of stereo samples */ void DelayWrite_32(const LVM_INT32* src, /* Source 1, to be delayed */ LVM_INT32* delay, /* Delay buffer */ LVM_UINT16 size, /* Delay size */ LVM_UINT16* pOffset, /* Delay offset */ LVM_INT16 n); void Add2_Sat_Float(const LVM_FLOAT* src, LVM_FLOAT* dst, LVM_INT16 n); void Mac3s_Sat_Float(const LVM_FLOAT* src, const LVM_FLOAT val, LVM_FLOAT* dst, LVM_INT16 n); void DelayAllPass_Sat_32x16To32(LVM_INT32* delay, /* Delay buffer */ LVM_UINT16 size, /* Delay size */ LVM_INT16 coeff, /* All pass filter coefficient */ LVM_UINT16 DelayOffset, /* Simple delay offset */ LVM_UINT16* pAllPassOffset, /* All pass filter delay offset */ LVM_INT32* dst, /* Source/destination */ LVM_INT16 n); /********************************************************************************** SHIFT FUNCTIONS Loading @@ -87,15 +58,6 @@ void MSTo2i_Sat_Float(const LVM_FLOAT* srcM, const LVM_FLOAT* srcS, LVM_FLOAT* d void From2iToMS_Float(const LVM_FLOAT* src, LVM_FLOAT* dstM, LVM_FLOAT* dstS, LVM_INT16 n); void JoinTo2i_Float(const LVM_FLOAT* srcL, const LVM_FLOAT* srcR, LVM_FLOAT* dst, LVM_INT16 n); /********************************************************************************** DATA TYPE CONVERSION FUNCTIONS ***********************************************************************************/ void Int16LShiftToInt32_16x32(const LVM_INT16* src, LVM_INT32* dst, LVM_INT16 n, LVM_INT16 shift); void Int32RShiftToInt16_Sat_32x16(const LVM_INT32* src, LVM_INT16* dst, LVM_INT16 n, LVM_INT16 shift); /**********************************************************************************/ #endif /* _VECTOR_ARITHMETIC_H_ */ Loading media/libeffects/lvm/lib/Common/src/AGC_MIX_VOL_2St1Mon_D32_WRA.cpp +0 −129 Original line number Diff line number Diff line Loading @@ -35,135 +35,6 @@ #define VOL_TC_FLOAT 2.0f /* As a power of 2 */ #define DECAY_FAC_FLOAT 64.0f /* As a power of 2 */ /****************************************************************************************/ /* */ /* FUNCTION: AGC_MIX_VOL_2St1Mon_D32_WRA */ /* */ /* DESCRIPTION: */ /* Apply AGC and mix signals */ /* */ /* */ /* StSrc ------------------| */ /* | */ /* ______ _|_ ________ */ /* | | | | | | */ /* MonoSrc -->| AGC |---->| + |----->| Volume |------------------------------+---> */ /* | Gain | |___| | Gain | | */ /* |______| |________| | */ /* /|\ __________ ________ | */ /* | | | | | | */ /* |-------------------------------| AGC Gain |<--| Peak |<--| */ /* | Update | | Detect | */ /* |__________| |________| */ /* */ /* */ /* PARAMETERS: */ /* pInstance Instance pointer */ /* pStereoIn Stereo source */ /* pMonoIn Mono band pass source */ /* pStereoOut Stereo destination */ /* */ /* RETURNS: */ /* Void */ /* */ /* NOTES: */ /* */ /****************************************************************************************/ void AGC_MIX_VOL_2St1Mon_D32_WRA(AGC_MIX_VOL_2St1Mon_FLOAT_t* pInstance, /* Instance pointer */ const LVM_FLOAT* pStSrc, /* Stereo source */ const LVM_FLOAT* pMonoSrc, /* Mono source */ LVM_FLOAT* pDst, /* Stereo destination */ LVM_UINT16 NumSamples) /* Number of samples */ { /* * General variables */ LVM_UINT16 i; /* Sample index */ LVM_FLOAT Left; /* Left sample */ LVM_FLOAT Right; /* Right sample */ LVM_FLOAT Mono; /* Mono sample */ LVM_FLOAT AbsPeak; /* Absolute peak signal */ LVM_FLOAT AGC_Mult; /* Short AGC gain */ LVM_FLOAT Vol_Mult; /* Short volume */ /* * Instance control variables */ LVM_FLOAT AGC_Gain = pInstance->AGC_Gain; /* Get the current AGC gain */ LVM_FLOAT AGC_MaxGain = pInstance->AGC_MaxGain; /* Get maximum AGC gain */ LVM_FLOAT AGC_Attack = pInstance->AGC_Attack; /* Attack scaler */ LVM_FLOAT AGC_Decay = (pInstance->AGC_Decay * (1 << (DECAY_SHIFT))); /* Decay scaler */ LVM_FLOAT AGC_Target = pInstance->AGC_Target; /* Get the target level */ LVM_FLOAT Vol_Current = pInstance->Volume; /* Actual volume setting */ LVM_FLOAT Vol_Target = pInstance->Target; /* Target volume setting */ LVM_FLOAT Vol_TC = pInstance->VolumeTC; /* Time constant */ /* * Process on a sample by sample basis */ for (i = 0; i < NumSamples; i++) /* For each sample */ { /* * Get the short scalers */ AGC_Mult = (LVM_FLOAT)(AGC_Gain); /* Get the short AGC gain */ Vol_Mult = (LVM_FLOAT)(Vol_Current); /* Get the short volume gain */ /* * Get the input samples */ Left = *pStSrc++; /* Get the left sample */ Right = *pStSrc++; /* Get the right sample */ Mono = *pMonoSrc++; /* Get the mono sample */ /* * Apply the AGC gain to the mono input and mix with the stereo signal */ Left += (Mono * AGC_Mult); /* Mix in the mono signal */ Right += (Mono * AGC_Mult); /* * Apply the volume and write to the output stream */ Left = Left * Vol_Mult; Right = Right * Vol_Mult; *pDst++ = Left; /* Save the results */ *pDst++ = Right; /* * Update the AGC gain */ AbsPeak = Abs_Float(Left) > Abs_Float(Right) ? Abs_Float(Left) : Abs_Float(Right); if (AbsPeak > AGC_Target) { /* * The signal is too large so decrease the gain */ AGC_Gain = AGC_Gain * AGC_Attack; } else { /* * The signal is too small so increase the gain */ if (AGC_Gain > AGC_MaxGain) { AGC_Gain -= (AGC_Decay); } else { AGC_Gain += (AGC_Decay); } } /* * Update the gain */ Vol_Current += (Vol_Target - Vol_Current) * ((LVM_FLOAT)Vol_TC / VOL_TC_FLOAT); } /* * Update the parameters */ pInstance->Volume = Vol_Current; /* Actual volume setting */ pInstance->AGC_Gain = AGC_Gain; return; } /****************************************************************************************/ /* */ /* FUNCTION: AGC_MIX_VOL_Mc1Mon_D32_WRA */ Loading Loading
media/libeffects/lvm/lib/Android.bp +0 −11 Original line number Diff line number Diff line Loading @@ -69,28 +69,20 @@ cc_library_static { "Common/src/PK_2I_D32F32C14G11_TRC_WRA_01.cpp", "Common/src/PK_2I_D32F32CssGss_TRC_WRA_01_Init.cpp", "Common/src/PK_2I_D32F32CllGss_TRC_WRA_01_Init.cpp", "Common/src/Int16LShiftToInt32_16x32.cpp", "Common/src/From2iToMono_16.cpp", "Common/src/Copy_16.cpp", "Common/src/MonoTo2I_16.cpp", "Common/src/MonoTo2I_32.cpp", "Common/src/LoadConst_16.cpp", "Common/src/LoadConst_32.cpp", "Common/src/dB_to_Lin32.cpp", "Common/src/Shift_Sat_v16xv16.cpp", "Common/src/Shift_Sat_v32xv32.cpp", "Common/src/Abs_32.cpp", "Common/src/Int32RShiftToInt16_Sat_32x16.cpp", "Common/src/From2iToMono_32.cpp", "Common/src/mult3s_16x16.cpp", "Common/src/Mult3s_32x16.cpp", "Common/src/NonLinComp_D16.cpp", "Common/src/DelayMix_16x16.cpp", "Common/src/MSTo2i_Sat_16x16.cpp", "Common/src/From2iToMS_16x16.cpp", "Common/src/Mac3s_Sat_16x16.cpp", "Common/src/Mac3s_Sat_32x16.cpp", "Common/src/Add2_Sat_16x16.cpp", "Common/src/Add2_Sat_32x32.cpp", "Common/src/LVC_MixSoft_1St_2i_D16C31_SAT.cpp", "Common/src/LVC_MixSoft_1St_D16C31_SAT.cpp", Loading Loading @@ -168,16 +160,13 @@ cc_library_static { "Reverb/src/LVREV_Tables.cpp", "Common/src/Abs_32.cpp", "Common/src/InstAlloc.cpp", "Common/src/LoadConst_16.cpp", "Common/src/LoadConst_32.cpp", "Common/src/From2iToMono_32.cpp", "Common/src/Mult3s_32x16.cpp", "Common/src/FO_1I_D32F32C31_TRC_WRA_01.cpp", "Common/src/FO_1I_D32F32Cll_TRC_WRA_01_Init.cpp", "Common/src/DelayAllPass_Sat_32x16To32.cpp", "Common/src/Copy_16.cpp", "Common/src/Mac3s_Sat_32x16.cpp", "Common/src/DelayWrite_32.cpp", "Common/src/Shift_Sat_v32xv32.cpp", "Common/src/Add2_Sat_32x32.cpp", "Common/src/JoinTo2i_32x32.cpp", Loading
media/libeffects/lvm/lib/Common/lib/AGC.h +0 −5 Original line number Diff line number Diff line Loading @@ -48,11 +48,6 @@ typedef struct { /* Function Prototypes */ /* */ /**********************************************************************************/ void AGC_MIX_VOL_2St1Mon_D32_WRA(AGC_MIX_VOL_2St1Mon_FLOAT_t* pInstance, /* Instance pointer */ const LVM_FLOAT* pStSrc, /* Stereo source */ const LVM_FLOAT* pMonoSrc, /* Mono source */ LVM_FLOAT* pDst, /* Stereo destination */ LVM_UINT16 n); /* Number of samples */ void AGC_MIX_VOL_Mc1Mon_D32_WRA(AGC_MIX_VOL_2St1Mon_FLOAT_t* pInstance, /* Instance pointer */ const LVM_FLOAT* pStSrc, /* Source */ const LVM_FLOAT* pMonoSrc, /* Mono source */ Loading
media/libeffects/lvm/lib/Common/lib/BIQUAD.h +0 −4 Original line number Diff line number Diff line Loading @@ -161,8 +161,6 @@ void FO_2I_D16F32Css_LShx_TRC_WRA_01_Init(Biquad_FLOAT_Instance_t* pInstance, Biquad_2I_Order1_FLOAT_Taps_t* pTaps, FO_FLOAT_LShx_Coefs_t* pCoef); void FO_2I_D16F32C15_LShx_TRC_WRA_01(Biquad_FLOAT_Instance_t* pInstance, LVM_FLOAT* pDataIn, LVM_FLOAT* pDataOut, LVM_INT16 NrSamples); /*** 32 bit data path *************************************************************/ void FO_1I_D32F32Cll_TRC_WRA_01_Init(Biquad_FLOAT_Instance_t* pInstance, Biquad_1I_Order1_FLOAT_Taps_t* pTaps, FO_FLOAT_Coefs_t* pCoef); Loading Loading @@ -193,8 +191,6 @@ void BP_1I_D32F32C30_TRC_WRA_02(Biquad_FLOAT_Instance_t* pInstance, LVM_FLOAT* p void PK_2I_D32F32CssGss_TRC_WRA_01_Init(Biquad_FLOAT_Instance_t* pInstance, Biquad_2I_Order2_FLOAT_Taps_t* pTaps, PK_FLOAT_Coefs_t* pCoef); void PK_2I_D32F32C14G11_TRC_WRA_01(Biquad_FLOAT_Instance_t* pInstance, LVM_FLOAT* pDataIn, LVM_FLOAT* pDataOut, LVM_INT16 NrSamples); void PK_Mc_D32F32C14G11_TRC_WRA_01(Biquad_FLOAT_Instance_t* pInstance, LVM_FLOAT* pDataIn, LVM_FLOAT* pDataOut, LVM_INT16 NrFrames, LVM_INT16 NrChannels); Loading
media/libeffects/lvm/lib/Common/lib/VectorArithmetic.h +0 −38 Original line number Diff line number Diff line Loading @@ -32,45 +32,16 @@ void Copy_Float_Mc_Stereo(const LVM_FLOAT* src, LVM_FLOAT* dst, LVM_INT16 NrFram void Copy_Float_Stereo_Mc(const LVM_FLOAT* src, LVM_FLOAT* StereoOut, LVM_FLOAT* dst, LVM_INT16 NrFrames, LVM_INT32 NrChannels); /********************************************************************************* * note: In Mult3s_16x16() saturation of result is not taken care when * * overflow occurs. * * For example when *src = 0x8000, val = *0x8000 * * The function gives the output as 0x8000 instead of 0x7fff * * This is the only case which will give wrong result. * * For more information refer to Vector_Arithmetic.doc in /doc folder * *********************************************************************************/ void Mult3s_Float(const LVM_FLOAT* src, const LVM_FLOAT val, LVM_FLOAT* dst, LVM_INT16 n); /********************************************************************************* * note: In Mult3s_32x16() saturation of result is not taken care when * * overflow occurs. * * For example when *src = 0x8000000, val = *0x8000 * * The function gives the output as 0x8000000 instead of 0x7fffffff * * This is the only extreme condition which is giving unexpected result * * For more information refer to Vector_Arithmetic.doc in /doc folder * *********************************************************************************/ void Mult3s_32x16(const LVM_INT32* src, const LVM_INT16 val, LVM_INT32* dst, LVM_INT16 n); void DelayMix_Float(const LVM_FLOAT* src, /* Source 1, to be delayed */ LVM_FLOAT* delay, /* Delay buffer */ LVM_INT16 size, /* Delay size */ LVM_FLOAT* dst, /* Source/destination */ LVM_INT16* pOffset, /* Delay offset */ LVM_INT16 n); /* Number of stereo samples */ void DelayWrite_32(const LVM_INT32* src, /* Source 1, to be delayed */ LVM_INT32* delay, /* Delay buffer */ LVM_UINT16 size, /* Delay size */ LVM_UINT16* pOffset, /* Delay offset */ LVM_INT16 n); void Add2_Sat_Float(const LVM_FLOAT* src, LVM_FLOAT* dst, LVM_INT16 n); void Mac3s_Sat_Float(const LVM_FLOAT* src, const LVM_FLOAT val, LVM_FLOAT* dst, LVM_INT16 n); void DelayAllPass_Sat_32x16To32(LVM_INT32* delay, /* Delay buffer */ LVM_UINT16 size, /* Delay size */ LVM_INT16 coeff, /* All pass filter coefficient */ LVM_UINT16 DelayOffset, /* Simple delay offset */ LVM_UINT16* pAllPassOffset, /* All pass filter delay offset */ LVM_INT32* dst, /* Source/destination */ LVM_INT16 n); /********************************************************************************** SHIFT FUNCTIONS Loading @@ -87,15 +58,6 @@ void MSTo2i_Sat_Float(const LVM_FLOAT* srcM, const LVM_FLOAT* srcS, LVM_FLOAT* d void From2iToMS_Float(const LVM_FLOAT* src, LVM_FLOAT* dstM, LVM_FLOAT* dstS, LVM_INT16 n); void JoinTo2i_Float(const LVM_FLOAT* srcL, const LVM_FLOAT* srcR, LVM_FLOAT* dst, LVM_INT16 n); /********************************************************************************** DATA TYPE CONVERSION FUNCTIONS ***********************************************************************************/ void Int16LShiftToInt32_16x32(const LVM_INT16* src, LVM_INT32* dst, LVM_INT16 n, LVM_INT16 shift); void Int32RShiftToInt16_Sat_32x16(const LVM_INT32* src, LVM_INT16* dst, LVM_INT16 n, LVM_INT16 shift); /**********************************************************************************/ #endif /* _VECTOR_ARITHMETIC_H_ */ Loading
media/libeffects/lvm/lib/Common/src/AGC_MIX_VOL_2St1Mon_D32_WRA.cpp +0 −129 Original line number Diff line number Diff line Loading @@ -35,135 +35,6 @@ #define VOL_TC_FLOAT 2.0f /* As a power of 2 */ #define DECAY_FAC_FLOAT 64.0f /* As a power of 2 */ /****************************************************************************************/ /* */ /* FUNCTION: AGC_MIX_VOL_2St1Mon_D32_WRA */ /* */ /* DESCRIPTION: */ /* Apply AGC and mix signals */ /* */ /* */ /* StSrc ------------------| */ /* | */ /* ______ _|_ ________ */ /* | | | | | | */ /* MonoSrc -->| AGC |---->| + |----->| Volume |------------------------------+---> */ /* | Gain | |___| | Gain | | */ /* |______| |________| | */ /* /|\ __________ ________ | */ /* | | | | | | */ /* |-------------------------------| AGC Gain |<--| Peak |<--| */ /* | Update | | Detect | */ /* |__________| |________| */ /* */ /* */ /* PARAMETERS: */ /* pInstance Instance pointer */ /* pStereoIn Stereo source */ /* pMonoIn Mono band pass source */ /* pStereoOut Stereo destination */ /* */ /* RETURNS: */ /* Void */ /* */ /* NOTES: */ /* */ /****************************************************************************************/ void AGC_MIX_VOL_2St1Mon_D32_WRA(AGC_MIX_VOL_2St1Mon_FLOAT_t* pInstance, /* Instance pointer */ const LVM_FLOAT* pStSrc, /* Stereo source */ const LVM_FLOAT* pMonoSrc, /* Mono source */ LVM_FLOAT* pDst, /* Stereo destination */ LVM_UINT16 NumSamples) /* Number of samples */ { /* * General variables */ LVM_UINT16 i; /* Sample index */ LVM_FLOAT Left; /* Left sample */ LVM_FLOAT Right; /* Right sample */ LVM_FLOAT Mono; /* Mono sample */ LVM_FLOAT AbsPeak; /* Absolute peak signal */ LVM_FLOAT AGC_Mult; /* Short AGC gain */ LVM_FLOAT Vol_Mult; /* Short volume */ /* * Instance control variables */ LVM_FLOAT AGC_Gain = pInstance->AGC_Gain; /* Get the current AGC gain */ LVM_FLOAT AGC_MaxGain = pInstance->AGC_MaxGain; /* Get maximum AGC gain */ LVM_FLOAT AGC_Attack = pInstance->AGC_Attack; /* Attack scaler */ LVM_FLOAT AGC_Decay = (pInstance->AGC_Decay * (1 << (DECAY_SHIFT))); /* Decay scaler */ LVM_FLOAT AGC_Target = pInstance->AGC_Target; /* Get the target level */ LVM_FLOAT Vol_Current = pInstance->Volume; /* Actual volume setting */ LVM_FLOAT Vol_Target = pInstance->Target; /* Target volume setting */ LVM_FLOAT Vol_TC = pInstance->VolumeTC; /* Time constant */ /* * Process on a sample by sample basis */ for (i = 0; i < NumSamples; i++) /* For each sample */ { /* * Get the short scalers */ AGC_Mult = (LVM_FLOAT)(AGC_Gain); /* Get the short AGC gain */ Vol_Mult = (LVM_FLOAT)(Vol_Current); /* Get the short volume gain */ /* * Get the input samples */ Left = *pStSrc++; /* Get the left sample */ Right = *pStSrc++; /* Get the right sample */ Mono = *pMonoSrc++; /* Get the mono sample */ /* * Apply the AGC gain to the mono input and mix with the stereo signal */ Left += (Mono * AGC_Mult); /* Mix in the mono signal */ Right += (Mono * AGC_Mult); /* * Apply the volume and write to the output stream */ Left = Left * Vol_Mult; Right = Right * Vol_Mult; *pDst++ = Left; /* Save the results */ *pDst++ = Right; /* * Update the AGC gain */ AbsPeak = Abs_Float(Left) > Abs_Float(Right) ? Abs_Float(Left) : Abs_Float(Right); if (AbsPeak > AGC_Target) { /* * The signal is too large so decrease the gain */ AGC_Gain = AGC_Gain * AGC_Attack; } else { /* * The signal is too small so increase the gain */ if (AGC_Gain > AGC_MaxGain) { AGC_Gain -= (AGC_Decay); } else { AGC_Gain += (AGC_Decay); } } /* * Update the gain */ Vol_Current += (Vol_Target - Vol_Current) * ((LVM_FLOAT)Vol_TC / VOL_TC_FLOAT); } /* * Update the parameters */ pInstance->Volume = Vol_Current; /* Actual volume setting */ pInstance->AGC_Gain = AGC_Gain; return; } /****************************************************************************************/ /* */ /* FUNCTION: AGC_MIX_VOL_Mc1Mon_D32_WRA */ Loading