diff --git a/src/common_audio/signal_processing_library/main/interface/signal_processing_library.h b/src/common_audio/signal_processing_library/main/interface/signal_processing_library.h index c4a537b84..1cdea71a5 100644 --- a/src/common_audio/signal_processing_library/main/interface/signal_processing_library.h +++ b/src/common_audio/signal_processing_library/main/interface/signal_processing_library.h @@ -34,78 +34,97 @@ #define WEBRTC_SPL_MAX_SEED_USED 0x80000000L #define WEBRTC_SPL_MIN(A, B) (A < B ? A : B) // Get min value #define WEBRTC_SPL_MAX(A, B) (A > B ? A : B) // Get max value -#define WEBRTC_SPL_ABS_W16(a)\ +#define WEBRTC_SPL_ABS_W16(a) \ (((WebRtc_Word16)a >= 0) ? ((WebRtc_Word16)a) : -((WebRtc_Word16)a)) -#define WEBRTC_SPL_ABS_W32(a)\ +#define WEBRTC_SPL_ABS_W32(a) \ (((WebRtc_Word32)a >= 0) ? ((WebRtc_Word32)a) : -((WebRtc_Word32)a)) #if (defined WEBRTC_TARGET_PC)||(defined __TARGET_XSCALE) #define WEBRTC_SPL_GET_BYTE(a, nr) (((WebRtc_Word8 *)a)[nr]) -#define WEBRTC_SPL_SET_BYTE(d_ptr, val, index) \ - (((WebRtc_Word8 *)d_ptr)[index] = (val)) +#define WEBRTC_SPL_SET_BYTE(d_ptr, val, index) \ + (((WebRtc_Word8 *)d_ptr)[index] = (val)) #elif defined WEBRTC_BIG_ENDIAN -#define WEBRTC_SPL_GET_BYTE(a, nr)\ +#define WEBRTC_SPL_GET_BYTE(a, nr) \ ((((WebRtc_Word16 *)a)[nr >> 1]) >> (((nr + 1) & 0x1) * 8) & 0x00ff) -#define WEBRTC_SPL_SET_BYTE(d_ptr, val, index) \ - ((WebRtc_Word16 *)d_ptr)[index >> 1] = \ - ((((WebRtc_Word16 *)d_ptr)[index >> 1]) \ - & (0x00ff << (8 * ((index) & 0x1)))) | (val << (8 * ((index + 1) & 0x1))) +#define WEBRTC_SPL_SET_BYTE(d_ptr, val, index) \ + ((WebRtc_Word16 *)d_ptr)[index >> 1] = \ + ((((WebRtc_Word16 *)d_ptr)[index >> 1]) \ + & (0x00ff << (8 * ((index) & 0x1)))) | (val << (8 * ((index + 1) & 0x1))) #else -#define WEBRTC_SPL_GET_BYTE(a,nr) \ - ((((WebRtc_Word16 *)(a))[(nr) >> 1]) >> (((nr) & 0x1) * 8) & 0x00ff) -#define WEBRTC_SPL_SET_BYTE(d_ptr, val, index) \ - ((WebRtc_Word16 *)(d_ptr))[(index) >> 1] = \ - ((((WebRtc_Word16 *)(d_ptr))[(index) >> 1]) \ - & (0x00ff << (8 * (((index) + 1) & 0x1)))) | \ - ((val) << (8 * ((index) & 0x1))) +#define WEBRTC_SPL_GET_BYTE(a,nr) \ + ((((WebRtc_Word16 *)(a))[(nr) >> 1]) >> (((nr) & 0x1) * 8) & 0x00ff) +#define WEBRTC_SPL_SET_BYTE(d_ptr, val, index) \ + ((WebRtc_Word16 *)(d_ptr))[(index) >> 1] = \ + ((((WebRtc_Word16 *)(d_ptr))[(index) >> 1]) \ + & (0x00ff << (8 * (((index) + 1) & 0x1)))) | \ + ((val) << (8 * ((index) & 0x1))) #endif -#define WEBRTC_SPL_UMUL(a, b) \ - ((WebRtc_UWord32) ((WebRtc_UWord32)(a) * (WebRtc_UWord32)(b))) -#define WEBRTC_SPL_UMUL_RSFT16(a, b)\ +#define WEBRTC_SPL_MUL(a, b) \ + ((WebRtc_Word32) ((WebRtc_Word32)(a) * (WebRtc_Word32)(b))) +#define WEBRTC_SPL_UMUL(a, b) \ + ((WebRtc_UWord32) ((WebRtc_UWord32)(a) * (WebRtc_UWord32)(b))) +#define WEBRTC_SPL_UMUL_RSFT16(a, b) \ ((WebRtc_UWord32) ((WebRtc_UWord32)(a) * (WebRtc_UWord32)(b)) >> 16) -#define WEBRTC_SPL_UMUL_16_16(a, b)\ +#define WEBRTC_SPL_UMUL_16_16(a, b) \ ((WebRtc_UWord32) (WebRtc_UWord16)(a) * (WebRtc_UWord16)(b)) -#define WEBRTC_SPL_UMUL_16_16_RSFT16(a, b)\ +#define WEBRTC_SPL_UMUL_16_16_RSFT16(a, b) \ (((WebRtc_UWord32) (WebRtc_UWord16)(a) * (WebRtc_UWord16)(b)) >> 16) -#define WEBRTC_SPL_UMUL_32_16(a, b)\ +#define WEBRTC_SPL_UMUL_32_16(a, b) \ ((WebRtc_UWord32) ((WebRtc_UWord32)(a) * (WebRtc_UWord16)(b))) -#define WEBRTC_SPL_UMUL_32_16_RSFT16(a, b)\ +#define WEBRTC_SPL_UMUL_32_16_RSFT16(a, b) \ ((WebRtc_UWord32) ((WebRtc_UWord32)(a) * (WebRtc_UWord16)(b)) >> 16) -#define WEBRTC_SPL_MUL_16_U16(a, b)\ +#define WEBRTC_SPL_MUL_16_U16(a, b) \ ((WebRtc_Word32)(WebRtc_Word16)(a) * (WebRtc_UWord16)(b)) -#define WEBRTC_SPL_DIV(a, b) \ - ((WebRtc_Word32) ((WebRtc_Word32)(a) / (WebRtc_Word32)(b))) -#define WEBRTC_SPL_UDIV(a, b) \ - ((WebRtc_UWord32) ((WebRtc_UWord32)(a) / (WebRtc_UWord32)(b))) +#define WEBRTC_SPL_DIV(a, b) \ + ((WebRtc_Word32) ((WebRtc_Word32)(a) / (WebRtc_Word32)(b))) +#define WEBRTC_SPL_UDIV(a, b) \ + ((WebRtc_UWord32) ((WebRtc_UWord32)(a) / (WebRtc_UWord32)(b))) -#define WEBRTC_SPL_MUL_16_32_RSFT11(a, b)\ - ((WEBRTC_SPL_MUL_16_16(a, (b) >> 16) << 5) \ - + (((WEBRTC_SPL_MUL_16_U16(a, (WebRtc_UWord16)(b)) >> 1) + 0x0200) >> 10)) -#define WEBRTC_SPL_MUL_16_32_RSFT14(a, b)\ - ((WEBRTC_SPL_MUL_16_16(a, (b) >> 16) << 2) \ - + (((WEBRTC_SPL_MUL_16_U16(a, (WebRtc_UWord16)(b)) >> 1) + 0x1000) >> 13)) -#define WEBRTC_SPL_MUL_16_32_RSFT15(a, b) \ - ((WEBRTC_SPL_MUL_16_16(a, (b) >> 16) << 1) \ - + (((WEBRTC_SPL_MUL_16_U16(a, (WebRtc_UWord16)(b)) >> 1) + 0x2000) >> 14)) +#ifndef WEBRTC_ARCH_ARM_V7A +// For ARMv7 platforms, these are inline functions in spl_inl_armv7.h +#define WEBRTC_SPL_MUL_16_16(a, b) \ + ((WebRtc_Word32) (((WebRtc_Word16)(a)) * ((WebRtc_Word16)(b)))) +#define WEBRTC_SPL_MUL_16_32_RSFT16(a, b) \ + (WEBRTC_SPL_MUL_16_16(a, b >> 16) \ + + ((WEBRTC_SPL_MUL_16_16(a, (b & 0xffff) >> 1) + 0x4000) >> 15)) +#define WEBRTC_SPL_MUL_32_32_RSFT32(a32a, a32b, b32) \ + ((WebRtc_Word32)(WEBRTC_SPL_MUL_16_32_RSFT16(a32a, b32) \ + + (WEBRTC_SPL_MUL_16_32_RSFT16(a32b, b32) >> 16))) +#define WEBRTC_SPL_MUL_32_32_RSFT32BI(a32, b32) \ + ((WebRtc_Word32)(WEBRTC_SPL_MUL_16_32_RSFT16(( \ + (WebRtc_Word16)(a32 >> 16)), b32) + \ + (WEBRTC_SPL_MUL_16_32_RSFT16(( \ + (WebRtc_Word16)((a32 & 0x0000FFFF) >> 1)), b32) >> 15))) +#endif + +#define WEBRTC_SPL_MUL_16_32_RSFT11(a, b) \ + ((WEBRTC_SPL_MUL_16_16(a, (b) >> 16) << 5) \ + + (((WEBRTC_SPL_MUL_16_U16(a, (WebRtc_UWord16)(b)) >> 1) + 0x0200) >> 10)) +#define WEBRTC_SPL_MUL_16_32_RSFT14(a, b) \ + ((WEBRTC_SPL_MUL_16_16(a, (b) >> 16) << 2) \ + + (((WEBRTC_SPL_MUL_16_U16(a, (WebRtc_UWord16)(b)) >> 1) + 0x1000) >> 13)) +#define WEBRTC_SPL_MUL_16_32_RSFT15(a, b) \ + ((WEBRTC_SPL_MUL_16_16(a, (b) >> 16) << 1) \ + + (((WEBRTC_SPL_MUL_16_U16(a, (WebRtc_UWord16)(b)) >> 1) + 0x2000) >> 14)) #ifdef ARM_WINM -#define WEBRTC_SPL_MUL_16_16(a, b) \ - _SmulLo_SW_SL((WebRtc_Word16)(a), (WebRtc_Word16)(b)) +#define WEBRTC_SPL_MUL_16_16(a, b) \ + _SmulLo_SW_SL((WebRtc_Word16)(a), (WebRtc_Word16)(b)) #endif -#define WEBRTC_SPL_MUL_16_16_RSFT(a, b, c) \ - (WEBRTC_SPL_MUL_16_16(a, b) >> (c)) +#define WEBRTC_SPL_MUL_16_16_RSFT(a, b, c) \ + (WEBRTC_SPL_MUL_16_16(a, b) >> (c)) -#define WEBRTC_SPL_MUL_16_16_RSFT_WITH_ROUND(a, b, c) \ - ((WEBRTC_SPL_MUL_16_16(a, b) + ((WebRtc_Word32) \ +#define WEBRTC_SPL_MUL_16_16_RSFT_WITH_ROUND(a, b, c) \ + ((WEBRTC_SPL_MUL_16_16(a, b) + ((WebRtc_Word32) \ (((WebRtc_Word32)1) << ((c) - 1)))) >> (c)) -#define WEBRTC_SPL_MUL_16_16_RSFT_WITH_FIXROUND(a, b)\ +#define WEBRTC_SPL_MUL_16_16_RSFT_WITH_FIXROUND(a, b) \ ((WEBRTC_SPL_MUL_16_16(a, b) + ((WebRtc_Word32) (1 << 14))) >> 15) // C + the 32 most significant bits of A * B -#define WEBRTC_SPL_SCALEDIFF32(A, B, C) \ - (C + (B >> 16) * A + (((WebRtc_UWord32)(0x0000FFFF & B) * A) >> 16)) +#define WEBRTC_SPL_SCALEDIFF32(A, B, C) \ + (C + (B >> 16) * A + (((WebRtc_UWord32)(0x0000FFFF & B) * A) >> 16)) #define WEBRTC_SPL_ADD_SAT_W32(a, b) WebRtcSpl_AddSatW32(a, b) #define WEBRTC_SPL_SAT(a, b, c) (b > a ? a : b < c ? c : b) @@ -119,10 +138,10 @@ #define WEBRTC_SPL_IS_NEG(a) ((a) & 0x80000000) // Shifting with negative numbers allowed // Positive means left shift -#define WEBRTC_SPL_SHIFT_W16(x, c) \ - (((c) >= 0) ? ((x) << (c)) : ((x) >> (-(c)))) -#define WEBRTC_SPL_SHIFT_W32(x, c) \ - (((c) >= 0) ? ((x) << (c)) : ((x) >> (-(c)))) +#define WEBRTC_SPL_SHIFT_W16(x, c) \ + (((c) >= 0) ? ((x) << (c)) : ((x) >> (-(c)))) +#define WEBRTC_SPL_SHIFT_W32(x, c) \ + (((c) >= 0) ? ((x) << (c)) : ((x) >> (-(c)))) // Shifting with negative numbers not allowed // We cannot do casting here due to signed/unsigned problem @@ -139,21 +158,21 @@ #define WEBRTC_SPL_VNEW(t, n) (t *) malloc (sizeof (t) * (n)) #define WEBRTC_SPL_FREE free -#define WEBRTC_SPL_RAND(a)\ - ((WebRtc_Word16)(WEBRTC_SPL_MUL_16_16_RSFT((a), 18816, 7) & 0x00007fff)) +#define WEBRTC_SPL_RAND(a) \ + ((WebRtc_Word16)(WEBRTC_SPL_MUL_16_16_RSFT((a), 18816, 7) & 0x00007fff)) #ifdef __cplusplus extern "C" { #endif -#define WEBRTC_SPL_MEMCPY_W8(v1, v2, length) \ - memcpy(v1, v2, (length) * sizeof(char)) -#define WEBRTC_SPL_MEMCPY_W16(v1, v2, length) \ - memcpy(v1, v2, (length) * sizeof(WebRtc_Word16)) +#define WEBRTC_SPL_MEMCPY_W8(v1, v2, length) \ + memcpy(v1, v2, (length) * sizeof(char)) +#define WEBRTC_SPL_MEMCPY_W16(v1, v2, length) \ + memcpy(v1, v2, (length) * sizeof(WebRtc_Word16)) -#define WEBRTC_SPL_MEMMOVE_W16(v1, v2, length) \ - memmove(v1, v2, (length) * sizeof(WebRtc_Word16)) +#define WEBRTC_SPL_MEMMOVE_W16(v1, v2, length) \ + memmove(v1, v2, (length) * sizeof(WebRtc_Word16)) // Trigonometric tables used for quick lookup // default declarations @@ -165,33 +184,8 @@ extern WebRtc_Word16 WebRtcSpl_kHanningTable[]; // Random table extern WebRtc_Word16 WebRtcSpl_kRandNTable[]; -#ifndef WEBRTC_ARM_INLINE_CALLS -WebRtc_Word16 WebRtcSpl_AddSatW16(WebRtc_Word16 var1, WebRtc_Word16 var2); -WebRtc_Word16 WebRtcSpl_SubSatW16(WebRtc_Word16 var1, WebRtc_Word16 var2); -WebRtc_Word32 WebRtcSpl_AddSatW32(WebRtc_Word32 var1, WebRtc_Word32 var2); -WebRtc_Word32 WebRtcSpl_SubSatW32(WebRtc_Word32 var1, WebRtc_Word32 var2); -WebRtc_Word16 WebRtcSpl_GetSizeInBits(WebRtc_UWord32 value); -int WebRtcSpl_NormW32(WebRtc_Word32 value); -int WebRtcSpl_NormW16(WebRtc_Word16 value); -int WebRtcSpl_NormU32(WebRtc_UWord32 value); -#define WEBRTC_SPL_MUL(a, b) \ - ((WebRtc_Word32) ((WebRtc_Word32)(a) * (WebRtc_Word32)(b))) -#define WEBRTC_SPL_MUL_16_16(a, b) \ - ((WebRtc_Word32) (((WebRtc_Word16)(a)) * ((WebRtc_Word16)(b)))) -#define WEBRTC_SPL_MUL_16_32_RSFT16(a, b) \ - (WEBRTC_SPL_MUL_16_16(a, b >> 16) \ - + ((WEBRTC_SPL_MUL_16_16(a, (b & 0xffff) >> 1) + 0x4000) >> 15)) -#define WEBRTC_SPL_MUL_32_32_RSFT32(a32a, a32b, b32) \ - ((WebRtc_Word32)(WEBRTC_SPL_MUL_16_32_RSFT16(a32a, b32) \ - + (WEBRTC_SPL_MUL_16_32_RSFT16(a32b, b32) >> 16))) -#define WEBRTC_SPL_MUL_32_32_RSFT32BI(a32, b32) \ - ((WebRtc_Word32)(WEBRTC_SPL_MUL_16_32_RSFT16(( \ - (WebRtc_Word16)(a32 >> 16)), b32) + \ - (WEBRTC_SPL_MUL_16_32_RSFT16(( \ - (WebRtc_Word16)((a32 & 0x0000FFFF) >> 1)), b32) >> 15))) -#else +// inline functions: #include "spl_inl.h" -#endif // WEBRTC_ARM_INLINE_CALLS // Get SPL Version WebRtc_Word16 WebRtcSpl_get_version(char* version, diff --git a/src/common_audio/signal_processing_library/main/interface/spl_inl.h b/src/common_audio/signal_processing_library/main/interface/spl_inl.h index c7031eba0..e9edd87db 100644 --- a/src/common_audio/signal_processing_library/main/interface/spl_inl.h +++ b/src/common_audio/signal_processing_library/main/interface/spl_inl.h @@ -15,275 +15,152 @@ #ifndef WEBRTC_SPL_SPL_INL_H_ #define WEBRTC_SPL_SPL_INL_H_ -#ifdef WEBRTC_ARM_INLINE_CALLS - -WEBRTC_INLINE WebRtc_Word32 WEBRTC_SPL_MUL(WebRtc_Word32 a, WebRtc_Word32 b) -{ - WebRtc_Word32 tmp; - __asm__("mul %0, %1, %2":"=r"(tmp):"r"(a), "r"(b)); - return tmp; -} - -WEBRTC_INLINE WebRtc_Word32 WEBRTC_SPL_MUL_16_32_RSFT16(WebRtc_Word16 a, - WebRtc_Word32 b) -{ - WebRtc_Word32 tmp; - __asm__("smulwb %0, %1, %2":"=r"(tmp):"r"(b), "r"(a)); - return tmp; -} - -WEBRTC_INLINE WebRtc_Word32 WEBRTC_SPL_MUL_32_32_RSFT32(WebRtc_Word16 a, - WebRtc_Word16 b, - WebRtc_Word32 c) -{ - WebRtc_Word32 tmp; - __asm__("pkhbt %0, %1, %2, lsl #16" : "=r"(tmp) : "r"(b), "r"(a)); - __asm__("smmul %0, %1, %2":"=r"(tmp):"r"(tmp), "r"(c)); - return tmp; -} - -WEBRTC_INLINE WebRtc_Word32 WEBRTC_SPL_MUL_32_32_RSFT32BI(WebRtc_Word32 a, - WebRtc_Word32 b) -{ - WebRtc_Word32 tmp; - __asm__("smmul %0, %1, %2":"=r"(tmp):"r"(a), "r"(b)); - return tmp; -} - -WEBRTC_INLINE WebRtc_Word32 WEBRTC_SPL_MUL_16_16(WebRtc_Word16 a, - WebRtc_Word16 b) -{ - WebRtc_Word32 tmp; - __asm__("smulbb %0, %1, %2":"=r"(tmp):"r"(a), "r"(b)); - return tmp; -} - -WEBRTC_INLINE WebRtc_Word16 WebRtcSpl_AddSatW16(WebRtc_Word16 a, - WebRtc_Word16 b) -{ - WebRtc_Word32 s_sum; - - __asm__("qadd16 %0, %1, %2":"=r"(s_sum):"r"(a), "r"(b)); - - return (WebRtc_Word16) s_sum; -} - -WEBRTC_INLINE WebRtc_Word32 WebRtcSpl_AddSatW32(WebRtc_Word32 l_var1, - WebRtc_Word32 l_var2) -{ - WebRtc_Word32 l_sum; - - __asm__("qadd %0, %1, %2":"=r"(l_sum):"r"(l_var1), "r"(l_var2)); - - return l_sum; -} - -WEBRTC_INLINE WebRtc_Word16 WebRtcSpl_SubSatW16(WebRtc_Word16 var1, - WebRtc_Word16 var2) -{ - WebRtc_Word32 s_sub; - - __asm__("qsub16 %0, %1, %2":"=r"(s_sub):"r"(var1), "r"(var2)); - - return (WebRtc_Word16)s_sub; -} - -WEBRTC_INLINE WebRtc_Word32 WebRtcSpl_SubSatW32(WebRtc_Word32 l_var1, - WebRtc_Word32 l_var2) -{ - WebRtc_Word32 l_sub; - - __asm__("qsub %0, %1, %2":"=r"(l_sub):"r"(l_var1), "r"(l_var2)); - - return l_sub; -} - -WEBRTC_INLINE WebRtc_Word16 WebRtcSpl_GetSizeInBits(WebRtc_UWord32 n) -{ - WebRtc_Word32 tmp; - - __asm__("clz %0, %1":"=r"(tmp):"r"(n)); - - return (WebRtc_Word16)(32 - tmp); -} - -WEBRTC_INLINE int WebRtcSpl_NormW32(WebRtc_Word32 a) -{ - WebRtc_Word32 tmp; - - if (a <= 0) a ^= 0xFFFFFFFF; - - __asm__("clz %0, %1":"=r"(tmp):"r"(a)); - - return tmp - 1; -} - -WEBRTC_INLINE int WebRtcSpl_NormW16(WebRtc_Word16 a) -{ - int zeros; - - if (a <= 0) a ^= 0xFFFF; - - if (!(0xFF80 & a)) zeros = 8; else zeros = 0; - if (!(0xF800 & (a << zeros))) zeros += 4; - if (!(0xE000 & (a << zeros))) zeros += 2; - if (!(0xC000 & (a << zeros))) zeros += 1; - - return zeros; -} - -WEBRTC_INLINE int WebRtcSpl_NormU32(WebRtc_UWord32 a) -{ - int tmp; - - if (a == 0) return 0; - - __asm__("clz %0, %1":"=r"(tmp):"r"(a)); - - return tmp; -} - +#ifdef WEBRTC_ARCH_ARM_V7A +#include "spl_inl_armv7.h" #else -WEBRTC_INLINE WebRtc_Word16 WebRtcSpl_AddSatW16(WebRtc_Word16 a, - WebRtc_Word16 b) -{ - WebRtc_Word32 s_sum = (WebRtc_Word32) a + (WebRtc_Word32) b; +static __inline WebRtc_Word16 WebRtcSpl_AddSatW16(WebRtc_Word16 a, + WebRtc_Word16 b) { + WebRtc_Word32 s_sum = (WebRtc_Word32) a + (WebRtc_Word32) b; - if (s_sum > WEBRTC_SPL_WORD16_MAX) + if (s_sum > WEBRTC_SPL_WORD16_MAX) s_sum = WEBRTC_SPL_WORD16_MAX; - else if (s_sum < WEBRTC_SPL_WORD16_MIN) + else if (s_sum < WEBRTC_SPL_WORD16_MIN) s_sum = WEBRTC_SPL_WORD16_MIN; - return (WebRtc_Word16)s_sum; + return (WebRtc_Word16)s_sum; } -WEBRTC_INLINE WebRtc_Word32 WebRtcSpl_AddSatW32(WebRtc_Word32 l_var1, - WebRtc_Word32 l_var2) -{ - WebRtc_Word32 l_sum; +static __inline WebRtc_Word32 WebRtcSpl_AddSatW32(WebRtc_Word32 l_var1, + WebRtc_Word32 l_var2) { + WebRtc_Word32 l_sum; - // perform long addition - l_sum = l_var1 + l_var2; + // perform long addition + l_sum = l_var1 + l_var2; - // check for under or overflow - if (WEBRTC_SPL_IS_NEG (l_var1)) - { - if (WEBRTC_SPL_IS_NEG (l_var2) && !WEBRTC_SPL_IS_NEG (l_sum)) - { - l_sum = (WebRtc_Word32)0x80000000; - } + // check for under or overflow + if (WEBRTC_SPL_IS_NEG(l_var1)) { + if (WEBRTC_SPL_IS_NEG(l_var2) && !WEBRTC_SPL_IS_NEG(l_sum)) { + l_sum = (WebRtc_Word32)0x80000000; } - else - { - if (!WEBRTC_SPL_IS_NEG (l_var2) && WEBRTC_SPL_IS_NEG (l_sum)) - { - l_sum = (WebRtc_Word32)0x7FFFFFFF; - } + } else { + if (!WEBRTC_SPL_IS_NEG(l_var2) && WEBRTC_SPL_IS_NEG(l_sum)) { + l_sum = (WebRtc_Word32)0x7FFFFFFF; } + } - return l_sum; + return l_sum; } -WEBRTC_INLINE WebRtc_Word16 WebRtcSpl_SubSatW16( WebRtc_Word16 var1, - WebRtc_Word16 var2) -{ - WebRtc_Word32 l_diff; - WebRtc_Word16 s_diff; +static __inline WebRtc_Word16 WebRtcSpl_SubSatW16(WebRtc_Word16 var1, + WebRtc_Word16 var2) { + WebRtc_Word32 l_diff; + WebRtc_Word16 s_diff; - // perform subtraction - l_diff = (WebRtc_Word32)var1 - (WebRtc_Word32)var2; + // perform subtraction + l_diff = (WebRtc_Word32)var1 - (WebRtc_Word32)var2; - // default setting - s_diff = (WebRtc_Word16) l_diff; + // default setting + s_diff = (WebRtc_Word16) l_diff; - // check for overflow - if (l_diff > (WebRtc_Word32)32767) - s_diff = (WebRtc_Word16)32767; + // check for overflow + if (l_diff > (WebRtc_Word32)32767) + s_diff = (WebRtc_Word16)32767; - // check for underflow - if (l_diff < (WebRtc_Word32)-32768) - s_diff = (WebRtc_Word16)-32768; + // check for underflow + if (l_diff < (WebRtc_Word32)-32768) + s_diff = (WebRtc_Word16)-32768; - return s_diff; + return s_diff; } -WEBRTC_INLINE WebRtc_Word32 WebRtcSpl_SubSatW32(WebRtc_Word32 l_var1, - WebRtc_Word32 l_var2) -{ - WebRtc_Word32 l_diff; +static __inline WebRtc_Word32 WebRtcSpl_SubSatW32(WebRtc_Word32 l_var1, + WebRtc_Word32 l_var2) { + WebRtc_Word32 l_diff; - // perform subtraction - l_diff = l_var1 - l_var2; + // perform subtraction + l_diff = l_var1 - l_var2; - // check for underflow - if ((l_var1 < 0) && (l_var2 > 0) && (l_diff > 0)) + // check for underflow + if ((l_var1 < 0) && (l_var2 > 0) && (l_diff > 0)) l_diff = (WebRtc_Word32)0x80000000; - // check for overflow - if ((l_var1 > 0) && (l_var2 < 0) && (l_diff < 0)) + // check for overflow + if ((l_var1 > 0) && (l_var2 < 0) && (l_diff < 0)) l_diff = (WebRtc_Word32)0x7FFFFFFF; - return l_diff; + return l_diff; } -WEBRTC_INLINE WebRtc_Word16 WebRtcSpl_GetSizeInBits(WebRtc_UWord32 n) -{ +static __inline WebRtc_Word16 WebRtcSpl_GetSizeInBits(WebRtc_UWord32 n) { + int bits; - int bits; + if (0xFFFF0000 & n) { + bits = 16; + } else { + bits = 0; + } + if (0x0000FF00 & (n >> bits)) bits += 8; + if (0x000000F0 & (n >> bits)) bits += 4; + if (0x0000000C & (n >> bits)) bits += 2; + if (0x00000002 & (n >> bits)) bits += 1; + if (0x00000001 & (n >> bits)) bits += 1; - if ((0xFFFF0000 & n)) bits = 16; else bits = 0; - if ((0x0000FF00 & (n >> bits))) bits += 8; - if ((0x000000F0 & (n >> bits))) bits += 4; - if ((0x0000000C & (n >> bits))) bits += 2; - if ((0x00000002 & (n >> bits))) bits += 1; - if ((0x00000001 & (n >> bits))) bits += 1; - - return bits; + return bits; } -WEBRTC_INLINE int WebRtcSpl_NormW32(WebRtc_Word32 a) -{ - int zeros; +static __inline int WebRtcSpl_NormW32(WebRtc_Word32 a) { + int zeros; - if (a <= 0) a ^= 0xFFFFFFFF; + if (a <= 0) a ^= 0xFFFFFFFF; - if (!(0xFFFF8000 & a)) zeros = 16; else zeros = 0; - if (!(0xFF800000 & (a << zeros))) zeros += 8; - if (!(0xF8000000 & (a << zeros))) zeros += 4; - if (!(0xE0000000 & (a << zeros))) zeros += 2; - if (!(0xC0000000 & (a << zeros))) zeros += 1; + if (!(0xFFFF8000 & a)) { + zeros = 16; + } else { + zeros = 0; + } + if (!(0xFF800000 & (a << zeros))) zeros += 8; + if (!(0xF8000000 & (a << zeros))) zeros += 4; + if (!(0xE0000000 & (a << zeros))) zeros += 2; + if (!(0xC0000000 & (a << zeros))) zeros += 1; - return zeros; + return zeros; } -WEBRTC_INLINE int WebRtcSpl_NormW16(WebRtc_Word16 a) -{ - int zeros; +static __inline int WebRtcSpl_NormU32(WebRtc_UWord32 a) { + int zeros; - if (a <= 0) a ^= 0xFFFF; + if (a == 0) return 0; - if (!(0xFF80 & a)) zeros = 8; else zeros = 0; - if (!(0xF800 & (a << zeros))) zeros += 4; - if (!(0xE000 & (a << zeros))) zeros += 2; - if (!(0xC000 & (a << zeros))) zeros += 1; + if (!(0xFFFF0000 & a)) { + zeros = 16; + } else { + zeros = 0; + } + if (!(0xFF000000 & (a << zeros))) zeros += 8; + if (!(0xF0000000 & (a << zeros))) zeros += 4; + if (!(0xC0000000 & (a << zeros))) zeros += 2; + if (!(0x80000000 & (a << zeros))) zeros += 1; - return zeros; + return zeros; } -WEBRTC_INLINE int WebRtcSpl_NormU32(WebRtc_UWord32 a) -{ - int zeros; +static __inline int WebRtcSpl_NormW16(WebRtc_Word16 a) { + int zeros; - if (a == 0) return 0; + if (a <= 0) a ^= 0xFFFF; - if (!(0xFFFF0000 & a)) zeros = 16; else zeros = 0; - if (!(0xFF000000 & (a << zeros))) zeros += 8; - if (!(0xF0000000 & (a << zeros))) zeros += 4; - if (!(0xC0000000 & (a << zeros))) zeros += 2; - if (!(0x80000000 & (a << zeros))) zeros += 1; + if (!(0xFF80 & a)) { + zeros = 8; + } else { + zeros = 0; + } + if (!(0xF800 & (a << zeros))) zeros += 4; + if (!(0xE000 & (a << zeros))) zeros += 2; + if (!(0xC000 & (a << zeros))) zeros += 1; - return zeros; + return zeros; } -#endif // WEBRTC_ARM_INLINE_CALLS -#endif // WEBRTC_SPL_SPL_INL_H_ +#endif // WEBRTC_ARCH_ARM_V7A + +#endif // WEBRTC_SPL_SPL_INL_H_ diff --git a/src/common_audio/signal_processing_library/main/interface/spl_inl_armv7.h b/src/common_audio/signal_processing_library/main/interface/spl_inl_armv7.h new file mode 100644 index 000000000..5d9493622 --- /dev/null +++ b/src/common_audio/signal_processing_library/main/interface/spl_inl_armv7.h @@ -0,0 +1,122 @@ +/* + * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + + +// This header file includes the inline functions for ARM processors in +// the fix point signal processing library. + +#ifndef WEBRTC_SPL_SPL_INL_ARMV7_H_ +#define WEBRTC_SPL_SPL_INL_ARMV7_H_ + +static __inline WebRtc_Word32 WEBRTC_SPL_MUL_16_32_RSFT16(WebRtc_Word16 a, + WebRtc_Word32 b) { + WebRtc_Word32 tmp; + __asm__("smulwb %0, %1, %2":"=r"(tmp):"r"(b), "r"(a)); + return tmp; +} + +static __inline WebRtc_Word32 WEBRTC_SPL_MUL_32_32_RSFT32(WebRtc_Word16 a, + WebRtc_Word16 b, + WebRtc_Word32 c) { + WebRtc_Word32 tmp; + __asm__("pkhbt %0, %1, %2, lsl #16" : "=r"(tmp) : "r"(b), "r"(a)); + __asm__("smmul %0, %1, %2":"=r"(tmp):"r"(tmp), "r"(c)); + return tmp; +} + +static __inline WebRtc_Word32 WEBRTC_SPL_MUL_32_32_RSFT32BI(WebRtc_Word32 a, + WebRtc_Word32 b) { + WebRtc_Word32 tmp; + __asm__("smmul %0, %1, %2":"=r"(tmp):"r"(a), "r"(b)); + return tmp; +} + +static __inline WebRtc_Word32 WEBRTC_SPL_MUL_16_16(WebRtc_Word16 a, + WebRtc_Word16 b) { + WebRtc_Word32 tmp; + __asm__("smulbb %0, %1, %2":"=r"(tmp):"r"(a), "r"(b)); + return tmp; +} + +static __inline WebRtc_Word16 WebRtcSpl_AddSatW16(WebRtc_Word16 a, + WebRtc_Word16 b) { + WebRtc_Word32 s_sum; + + __asm__("qadd16 %0, %1, %2":"=r"(s_sum):"r"(a), "r"(b)); + + return (WebRtc_Word16) s_sum; +} + +static __inline WebRtc_Word32 WebRtcSpl_AddSatW32(WebRtc_Word32 l_var1, + WebRtc_Word32 l_var2) { + WebRtc_Word32 l_sum; + + __asm__("qadd %0, %1, %2":"=r"(l_sum):"r"(l_var1), "r"(l_var2)); + + return l_sum; +} + +static __inline WebRtc_Word16 WebRtcSpl_SubSatW16(WebRtc_Word16 var1, + WebRtc_Word16 var2) { + WebRtc_Word32 s_sub; + + __asm__("qsub16 %0, %1, %2":"=r"(s_sub):"r"(var1), "r"(var2)); + + return (WebRtc_Word16)s_sub; +} + +static __inline WebRtc_Word32 WebRtcSpl_SubSatW32(WebRtc_Word32 l_var1, + WebRtc_Word32 l_var2) { + WebRtc_Word32 l_sub; + + __asm__("qsub %0, %1, %2":"=r"(l_sub):"r"(l_var1), "r"(l_var2)); + + return l_sub; +} + +static __inline WebRtc_Word16 WebRtcSpl_GetSizeInBits(WebRtc_UWord32 n) { + WebRtc_Word32 tmp; + + __asm__("clz %0, %1":"=r"(tmp):"r"(n)); + + return (WebRtc_Word16)(32 - tmp); +} + +static __inline int WebRtcSpl_NormW32(WebRtc_Word32 a) { + WebRtc_Word32 tmp; + + if (a <= 0) a ^= 0xFFFFFFFF; + + __asm__("clz %0, %1":"=r"(tmp):"r"(a)); + + return tmp - 1; +} + +static __inline int WebRtcSpl_NormU32(WebRtc_UWord32 a) { + int tmp; + + if (a == 0) return 0; + + __asm__("clz %0, %1":"=r"(tmp):"r"(a)); + + return tmp; +} + +static __inline int WebRtcSpl_NormW16(WebRtc_Word16 a) { + WebRtc_Word32 tmp; + + if (a <= 0) a ^= 0xFFFFFFFF; + + __asm__("clz %0, %1":"=r"(tmp):"r"(a)); + + return tmp - 17; +} + +#endif // WEBRTC_SPL_SPL_INL_ARMV7_H_ diff --git a/src/common_audio/signal_processing_library/main/source/Android.mk b/src/common_audio/signal_processing_library/main/source/Android.mk index 2a91e146d..1eebfebc7 100644 --- a/src/common_audio/signal_processing_library/main/source/Android.mk +++ b/src/common_audio/signal_processing_library/main/source/Android.mk @@ -17,8 +17,6 @@ LOCAL_MODULE_CLASS := STATIC_LIBRARIES LOCAL_MODULE := libwebrtc_spl LOCAL_MODULE_TAGS := optional LOCAL_SRC_FILES := \ - add_sat_w16.c \ - add_sat_w32.c \ auto_corr_to_refl_coef.c \ auto_correlation.c \ complex_fft.c \ @@ -36,15 +34,11 @@ LOCAL_SRC_FILES := \ filter_ma_fast_q12.c \ get_hanning_window.c \ get_scaling_square.c \ - get_size_in_bits.c \ hanning_table.c \ ilbc_specific_functions.c \ levinson_durbin.c \ lpc_to_refl_coef.c \ min_max_operations.c \ - norm_u32.c \ - norm_w16.c \ - norm_w32.c \ randn_table.c \ randomization_functions.c \ refl_coef_to_lpc.c \ @@ -60,8 +54,6 @@ LOCAL_SRC_FILES := \ spl_version.c \ splitting_filter.c \ sqrt_of_one_minus_x_squared.c \ - sub_sat_w16.c \ - sub_sat_w32.c \ vector_scaling_operations.c # Flags passed to both C and C++ files. diff --git a/src/common_audio/signal_processing_library/main/source/add_sat_w16.c b/src/common_audio/signal_processing_library/main/source/add_sat_w16.c deleted file mode 100644 index bb6af81d9..000000000 --- a/src/common_audio/signal_processing_library/main/source/add_sat_w16.c +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - - -/* - * This file contains the function WebRtcSpl_AddSatW16(). - * The description header can be found in signal_processing_library.h - * - */ - -#include "signal_processing_library.h" - -WebRtc_Word16 WebRtcSpl_AddSatW16(WebRtc_Word16 var1, WebRtc_Word16 var2) -{ - WebRtc_Word32 s_sum = (WebRtc_Word32)var1 + (WebRtc_Word32)var2; - - if (s_sum > WEBRTC_SPL_WORD16_MAX) - s_sum = WEBRTC_SPL_WORD16_MAX; - else if (s_sum < WEBRTC_SPL_WORD16_MIN) - s_sum = WEBRTC_SPL_WORD16_MIN; - - return (WebRtc_Word16)s_sum; -} diff --git a/src/common_audio/signal_processing_library/main/source/add_sat_w32.c b/src/common_audio/signal_processing_library/main/source/add_sat_w32.c deleted file mode 100644 index 49c01ab39..000000000 --- a/src/common_audio/signal_processing_library/main/source/add_sat_w32.c +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - - -/* - * This file contains the function WebRtcSpl_AddSatW32(). - * The description header can be found in signal_processing_library.h - * - */ - -#include "signal_processing_library.h" - -WebRtc_Word32 WebRtcSpl_AddSatW32(WebRtc_Word32 var1, WebRtc_Word32 var2) -{ - WebRtc_Word32 l_sum; - - // perform long addition - l_sum = var1 + var2; - - // check for under or overflow - if (WEBRTC_SPL_IS_NEG(var1)) - { - if (WEBRTC_SPL_IS_NEG(var2) && !WEBRTC_SPL_IS_NEG(l_sum)) - { - l_sum = (WebRtc_Word32)0x80000000; - } - } else - { - if (!WEBRTC_SPL_IS_NEG(var2) && WEBRTC_SPL_IS_NEG(l_sum)) - { - l_sum = (WebRtc_Word32)0x7FFFFFFF; - } - } - - return l_sum; -} diff --git a/src/common_audio/signal_processing_library/main/source/get_size_in_bits.c b/src/common_audio/signal_processing_library/main/source/get_size_in_bits.c deleted file mode 100644 index 78a40bb2a..000000000 --- a/src/common_audio/signal_processing_library/main/source/get_size_in_bits.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - - -/* - * This file contains the function WebRtcSpl_GetSizeInBits(). - * The description header can be found in signal_processing_library.h - * - */ - -#include "signal_processing_library.h" - -WebRtc_Word16 WebRtcSpl_GetSizeInBits(WebRtc_UWord32 value) -{ - - int bits = 0; - - // Fast binary search to find the number of bits used - if ((0xFFFF0000 & value)) - bits = 16; - if ((0x0000FF00 & (value >> bits))) - bits += 8; - if ((0x000000F0 & (value >> bits))) - bits += 4; - if ((0x0000000C & (value >> bits))) - bits += 2; - if ((0x00000002 & (value >> bits))) - bits += 1; - if ((0x00000001 & (value >> bits))) - bits += 1; - - return bits; -} diff --git a/src/common_audio/signal_processing_library/main/source/norm_u32.c b/src/common_audio/signal_processing_library/main/source/norm_u32.c deleted file mode 100644 index 339686e08..000000000 --- a/src/common_audio/signal_processing_library/main/source/norm_u32.c +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - - -/* - * This file contains the function WebRtcSpl_NormU32(). - * The description header can be found in signal_processing_library.h - * - */ - -#include "signal_processing_library.h" - -int WebRtcSpl_NormU32(WebRtc_UWord32 value) -{ - int zeros = 0; - - if (value == 0) - return 0; - - if (!(0xFFFF0000 & value)) - zeros = 16; - if (!(0xFF000000 & (value << zeros))) - zeros += 8; - if (!(0xF0000000 & (value << zeros))) - zeros += 4; - if (!(0xC0000000 & (value << zeros))) - zeros += 2; - if (!(0x80000000 & (value << zeros))) - zeros += 1; - - return zeros; -} diff --git a/src/common_audio/signal_processing_library/main/source/norm_w16.c b/src/common_audio/signal_processing_library/main/source/norm_w16.c deleted file mode 100644 index 6f3598b2c..000000000 --- a/src/common_audio/signal_processing_library/main/source/norm_w16.c +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - - -/* - * This file contains the function WebRtcSpl_NormW16(). - * The description header can be found in signal_processing_library.h - * - */ - -#include "signal_processing_library.h" - -int WebRtcSpl_NormW16(WebRtc_Word16 value) -{ - int zeros = 0; - - if (value <= 0) - value ^= 0xFFFF; - - if ( !(0xFF80 & value)) - zeros = 8; - if ( !(0xF800 & (value << zeros))) - zeros += 4; - if ( !(0xE000 & (value << zeros))) - zeros += 2; - if ( !(0xC000 & (value << zeros))) - zeros += 1; - - return zeros; -} diff --git a/src/common_audio/signal_processing_library/main/source/norm_w32.c b/src/common_audio/signal_processing_library/main/source/norm_w32.c deleted file mode 100644 index 8db031fe6..000000000 --- a/src/common_audio/signal_processing_library/main/source/norm_w32.c +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - - -/* - * This file contains the function WebRtcSpl_NormW32(). - * The description header can be found in signal_processing_library.h - * - */ - -#include "signal_processing_library.h" - -int WebRtcSpl_NormW32(WebRtc_Word32 value) -{ - int zeros = 0; - - if (value <= 0) - value ^= 0xFFFFFFFF; - - // Fast binary search to determine the number of left shifts required to 32-bit normalize - // the value - if (!(0xFFFF8000 & value)) - zeros = 16; - if (!(0xFF800000 & (value << zeros))) - zeros += 8; - if (!(0xF8000000 & (value << zeros))) - zeros += 4; - if (!(0xE0000000 & (value << zeros))) - zeros += 2; - if (!(0xC0000000 & (value << zeros))) - zeros += 1; - - return zeros; -} diff --git a/src/common_audio/signal_processing_library/main/source/spl.gyp b/src/common_audio/signal_processing_library/main/source/spl.gyp index 9c052fc60..70cebd1cb 100644 --- a/src/common_audio/signal_processing_library/main/source/spl.gyp +++ b/src/common_audio/signal_processing_library/main/source/spl.gyp @@ -25,8 +25,6 @@ 'sources': [ '../interface/signal_processing_library.h', '../interface/spl_inl.h', - 'add_sat_w16.c', - 'add_sat_w32.c', 'auto_corr_to_refl_coef.c', 'auto_correlation.c', 'complex_fft.c', @@ -44,15 +42,11 @@ 'filter_ma_fast_q12.c', 'get_hanning_window.c', 'get_scaling_square.c', - 'get_size_in_bits.c', 'hanning_table.c', 'ilbc_specific_functions.c', 'levinson_durbin.c', 'lpc_to_refl_coef.c', 'min_max_operations.c', - 'norm_u32.c', - 'norm_w16.c', - 'norm_w32.c', 'randn_table.c', 'randomization_functions.c', 'refl_coef_to_lpc.c', @@ -69,8 +63,6 @@ 'spl_version.c', 'splitting_filter.c', 'sqrt_of_one_minus_x_squared.c', - 'sub_sat_w16.c', - 'sub_sat_w32.c', 'vector_scaling_operations.c', ], }, diff --git a/src/common_audio/signal_processing_library/main/source/sub_sat_w16.c b/src/common_audio/signal_processing_library/main/source/sub_sat_w16.c deleted file mode 100644 index 64ef24cbe..000000000 --- a/src/common_audio/signal_processing_library/main/source/sub_sat_w16.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - - -/* - * This file contains the function WebRtcSpl_SubSatW16(). - * The description header can be found in signal_processing_library.h - * - */ - -#include "signal_processing_library.h" - -#ifndef XSCALE_OPT -WebRtc_Word16 WebRtcSpl_SubSatW16(WebRtc_Word16 var1, WebRtc_Word16 var2) -{ - WebRtc_Word32 l_diff; - WebRtc_Word16 s_diff; - - // perform subtraction - l_diff = (WebRtc_Word32)var1 - (WebRtc_Word32)var2; - - // default setting - s_diff = (WebRtc_Word16)l_diff; - - // check for overflow - if (l_diff > (WebRtc_Word32)32767) - s_diff = (WebRtc_Word16)32767; - - // check for underflow - if (l_diff < (WebRtc_Word32)-32768) - s_diff = (WebRtc_Word16)-32768; - - return s_diff; -} -#else -#pragma message(">> WebRtcSpl_SubSatW16.c is excluded from this build") -#endif // XSCALE_OPT diff --git a/src/common_audio/signal_processing_library/main/source/sub_sat_w32.c b/src/common_audio/signal_processing_library/main/source/sub_sat_w32.c deleted file mode 100644 index 6582faa3a..000000000 --- a/src/common_audio/signal_processing_library/main/source/sub_sat_w32.c +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - - -/* - * This file contains the function WebRtcSpl_SubSatW32(). - * The description header can be found in signal_processing_library.h - * - */ - -#include "signal_processing_library.h" - -WebRtc_Word32 WebRtcSpl_SubSatW32(WebRtc_Word32 var1, WebRtc_Word32 var2) -{ - WebRtc_Word32 l_diff; - - // perform subtraction - l_diff = var1 - var2; - - // check for underflow - if ((var1 < 0) && (var2 > 0) && (l_diff > 0)) - l_diff = (WebRtc_Word32)0x80000000; - // check for overflow - if ((var1 > 0) && (var2 < 0) && (l_diff < 0)) - l_diff = (WebRtc_Word32)0x7FFFFFFF; - - return l_diff; -}