Loading media/libeffects/lvm/lib/Common/src/LVC_Core_MixSoft_1St_2i_D16C31_WRA.cpp +8 −24 Original line number Diff line number Diff line Loading @@ -18,7 +18,7 @@ /********************************************************************************** INCLUDE FILES ***********************************************************************************/ #include <algorithm> #include "LVC_Mixer_Private.h" #include "ScalarArithmetic.h" #include "LVM_Macros.h" Loading @@ -26,16 +26,8 @@ /********************************************************************************** FUNCTION LVC_Core_MixSoft_1St_2i_D16C31_WRA ***********************************************************************************/ static LVM_FLOAT ADD2_SAT_FLOAT(LVM_FLOAT a, LVM_FLOAT b, LVM_FLOAT c) { LVM_FLOAT temp; temp = a + b; if (temp < -1.0f) c = -1.0f; else if (temp > 1.0f) c = 1.0f; else c = temp; return c; static inline LVM_FLOAT ADD2_SAT_FLOAT(LVM_FLOAT a, LVM_FLOAT b) { return std::clamp(a + b, -1.0f, 1.0f); } void LVC_Core_MixSoft_1St_2i_D16C31_WRA(LVMixer3_FLOAT_st* ptrInstance1, LVMixer3_FLOAT_st* ptrInstance2, const LVM_FLOAT* src, Loading @@ -54,15 +46,12 @@ void LVC_Core_MixSoft_1St_2i_D16C31_WRA(LVMixer3_FLOAT_st* ptrInstance1, LVM_FLOAT CurrentR = pInstanceR->Current; LVM_FLOAT TargetR = pInstanceR->Target; LVM_FLOAT Temp = 0; InLoop = (LVM_INT16)(n >> 2); /* Process per 4 samples */ OutLoop = (LVM_INT16)(n - (InLoop << 2)); if (OutLoop) { if (CurrentL < TargetL) { ADD2_SAT_FLOAT(CurrentL, DeltaL, Temp); CurrentL = Temp; CurrentL = ADD2_SAT_FLOAT(CurrentL, DeltaL); if (CurrentL > TargetL) CurrentL = TargetL; } else { CurrentL -= DeltaL; Loading @@ -70,8 +59,7 @@ void LVC_Core_MixSoft_1St_2i_D16C31_WRA(LVMixer3_FLOAT_st* ptrInstance1, } if (CurrentR < TargetR) { ADD2_SAT_FLOAT(CurrentR, DeltaR, Temp); CurrentR = Temp; CurrentR = ADD2_SAT_FLOAT(CurrentR, DeltaR); if (CurrentR > TargetR) CurrentR = TargetR; } else { CurrentR -= DeltaR; Loading @@ -86,8 +74,7 @@ void LVC_Core_MixSoft_1St_2i_D16C31_WRA(LVMixer3_FLOAT_st* ptrInstance1, for (ii = InLoop * 2; ii != 0; ii -= 2) { if (CurrentL < TargetL) { ADD2_SAT_FLOAT(CurrentL, DeltaL, Temp); CurrentL = Temp; CurrentL = ADD2_SAT_FLOAT(CurrentL, DeltaL); if (CurrentL > TargetL) CurrentL = TargetL; } else { CurrentL -= DeltaL; Loading @@ -95,8 +82,7 @@ void LVC_Core_MixSoft_1St_2i_D16C31_WRA(LVMixer3_FLOAT_st* ptrInstance1, } if (CurrentR < TargetR) { ADD2_SAT_FLOAT(CurrentR, DeltaR, Temp); CurrentR = Temp; CurrentR = ADD2_SAT_FLOAT(CurrentR, DeltaR); if (CurrentR > TargetR) CurrentR = TargetR; } else { CurrentR -= DeltaR; Loading @@ -118,7 +104,6 @@ void LVC_Core_MixSoft_1St_2i_D16C31_WRA(LVMixer3_FLOAT_st* ptrInstance1, void LVC_Core_MixSoft_1St_MC_float_WRA(Mix_Private_FLOAT_st** ptrInstance, const LVM_FLOAT* src, LVM_FLOAT* dst, LVM_INT16 NrFrames, LVM_INT16 NrChannels) { LVM_INT32 ii, ch; LVM_FLOAT Temp = 0.0f; LVM_FLOAT tempCurrent[NrChannels]; for (ch = 0; ch < NrChannels; ch++) { tempCurrent[ch] = ptrInstance[ch]->Current; Loading @@ -130,8 +115,7 @@ void LVC_Core_MixSoft_1St_MC_float_WRA(Mix_Private_FLOAT_st** ptrInstance, const LVM_FLOAT Current = tempCurrent[ch]; const LVM_FLOAT Target = pInstance->Target; if (Current < Target) { ADD2_SAT_FLOAT(Current, Delta, Temp); Current = Temp; Current = ADD2_SAT_FLOAT(Current, Delta); if (Current > Target) Current = Target; } else { Current -= Delta; Loading Loading
media/libeffects/lvm/lib/Common/src/LVC_Core_MixSoft_1St_2i_D16C31_WRA.cpp +8 −24 Original line number Diff line number Diff line Loading @@ -18,7 +18,7 @@ /********************************************************************************** INCLUDE FILES ***********************************************************************************/ #include <algorithm> #include "LVC_Mixer_Private.h" #include "ScalarArithmetic.h" #include "LVM_Macros.h" Loading @@ -26,16 +26,8 @@ /********************************************************************************** FUNCTION LVC_Core_MixSoft_1St_2i_D16C31_WRA ***********************************************************************************/ static LVM_FLOAT ADD2_SAT_FLOAT(LVM_FLOAT a, LVM_FLOAT b, LVM_FLOAT c) { LVM_FLOAT temp; temp = a + b; if (temp < -1.0f) c = -1.0f; else if (temp > 1.0f) c = 1.0f; else c = temp; return c; static inline LVM_FLOAT ADD2_SAT_FLOAT(LVM_FLOAT a, LVM_FLOAT b) { return std::clamp(a + b, -1.0f, 1.0f); } void LVC_Core_MixSoft_1St_2i_D16C31_WRA(LVMixer3_FLOAT_st* ptrInstance1, LVMixer3_FLOAT_st* ptrInstance2, const LVM_FLOAT* src, Loading @@ -54,15 +46,12 @@ void LVC_Core_MixSoft_1St_2i_D16C31_WRA(LVMixer3_FLOAT_st* ptrInstance1, LVM_FLOAT CurrentR = pInstanceR->Current; LVM_FLOAT TargetR = pInstanceR->Target; LVM_FLOAT Temp = 0; InLoop = (LVM_INT16)(n >> 2); /* Process per 4 samples */ OutLoop = (LVM_INT16)(n - (InLoop << 2)); if (OutLoop) { if (CurrentL < TargetL) { ADD2_SAT_FLOAT(CurrentL, DeltaL, Temp); CurrentL = Temp; CurrentL = ADD2_SAT_FLOAT(CurrentL, DeltaL); if (CurrentL > TargetL) CurrentL = TargetL; } else { CurrentL -= DeltaL; Loading @@ -70,8 +59,7 @@ void LVC_Core_MixSoft_1St_2i_D16C31_WRA(LVMixer3_FLOAT_st* ptrInstance1, } if (CurrentR < TargetR) { ADD2_SAT_FLOAT(CurrentR, DeltaR, Temp); CurrentR = Temp; CurrentR = ADD2_SAT_FLOAT(CurrentR, DeltaR); if (CurrentR > TargetR) CurrentR = TargetR; } else { CurrentR -= DeltaR; Loading @@ -86,8 +74,7 @@ void LVC_Core_MixSoft_1St_2i_D16C31_WRA(LVMixer3_FLOAT_st* ptrInstance1, for (ii = InLoop * 2; ii != 0; ii -= 2) { if (CurrentL < TargetL) { ADD2_SAT_FLOAT(CurrentL, DeltaL, Temp); CurrentL = Temp; CurrentL = ADD2_SAT_FLOAT(CurrentL, DeltaL); if (CurrentL > TargetL) CurrentL = TargetL; } else { CurrentL -= DeltaL; Loading @@ -95,8 +82,7 @@ void LVC_Core_MixSoft_1St_2i_D16C31_WRA(LVMixer3_FLOAT_st* ptrInstance1, } if (CurrentR < TargetR) { ADD2_SAT_FLOAT(CurrentR, DeltaR, Temp); CurrentR = Temp; CurrentR = ADD2_SAT_FLOAT(CurrentR, DeltaR); if (CurrentR > TargetR) CurrentR = TargetR; } else { CurrentR -= DeltaR; Loading @@ -118,7 +104,6 @@ void LVC_Core_MixSoft_1St_2i_D16C31_WRA(LVMixer3_FLOAT_st* ptrInstance1, void LVC_Core_MixSoft_1St_MC_float_WRA(Mix_Private_FLOAT_st** ptrInstance, const LVM_FLOAT* src, LVM_FLOAT* dst, LVM_INT16 NrFrames, LVM_INT16 NrChannels) { LVM_INT32 ii, ch; LVM_FLOAT Temp = 0.0f; LVM_FLOAT tempCurrent[NrChannels]; for (ch = 0; ch < NrChannels; ch++) { tempCurrent[ch] = ptrInstance[ch]->Current; Loading @@ -130,8 +115,7 @@ void LVC_Core_MixSoft_1St_MC_float_WRA(Mix_Private_FLOAT_st** ptrInstance, const LVM_FLOAT Current = tempCurrent[ch]; const LVM_FLOAT Target = pInstance->Target; if (Current < Target) { ADD2_SAT_FLOAT(Current, Delta, Temp); Current = Temp; Current = ADD2_SAT_FLOAT(Current, Delta); if (Current > Target) Current = Target; } else { Current -= Delta; Loading