Corrected conditional compilations for spl inline functions in ARM.
Review URL: http://webrtc-codereview.appspot.com/140004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@571 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
6f54c20703
commit
0ada410d37
@ -60,6 +60,8 @@
|
|||||||
((val) << (8 * ((index) & 0x1)))
|
((val) << (8 * ((index) & 0x1)))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define WEBRTC_SPL_MUL(a, b) \
|
||||||
|
((WebRtc_Word32) ((WebRtc_Word32)(a) * (WebRtc_Word32)(b)))
|
||||||
#define WEBRTC_SPL_UMUL(a, b) \
|
#define WEBRTC_SPL_UMUL(a, b) \
|
||||||
((WebRtc_UWord32) ((WebRtc_UWord32)(a) * (WebRtc_UWord32)(b)))
|
((WebRtc_UWord32) ((WebRtc_UWord32)(a) * (WebRtc_UWord32)(b)))
|
||||||
#define WEBRTC_SPL_UMUL_RSFT16(a, b) \
|
#define WEBRTC_SPL_UMUL_RSFT16(a, b) \
|
||||||
@ -79,6 +81,23 @@
|
|||||||
#define WEBRTC_SPL_UDIV(a, b) \
|
#define WEBRTC_SPL_UDIV(a, b) \
|
||||||
((WebRtc_UWord32) ((WebRtc_UWord32)(a) / (WebRtc_UWord32)(b)))
|
((WebRtc_UWord32) ((WebRtc_UWord32)(a) / (WebRtc_UWord32)(b)))
|
||||||
|
|
||||||
|
#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) \
|
#define WEBRTC_SPL_MUL_16_32_RSFT11(a, b) \
|
||||||
((WEBRTC_SPL_MUL_16_16(a, (b) >> 16) << 5) \
|
((WEBRTC_SPL_MUL_16_16(a, (b) >> 16) << 5) \
|
||||||
+ (((WEBRTC_SPL_MUL_16_U16(a, (WebRtc_UWord16)(b)) >> 1) + 0x0200) >> 10))
|
+ (((WEBRTC_SPL_MUL_16_U16(a, (WebRtc_UWord16)(b)) >> 1) + 0x0200) >> 10))
|
||||||
@ -165,33 +184,8 @@ extern WebRtc_Word16 WebRtcSpl_kHanningTable[];
|
|||||||
// Random table
|
// Random table
|
||||||
extern WebRtc_Word16 WebRtcSpl_kRandNTable[];
|
extern WebRtc_Word16 WebRtcSpl_kRandNTable[];
|
||||||
|
|
||||||
#ifndef WEBRTC_ARM_INLINE_CALLS
|
// inline functions:
|
||||||
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
|
|
||||||
#include "spl_inl.h"
|
#include "spl_inl.h"
|
||||||
#endif // WEBRTC_ARM_INLINE_CALLS
|
|
||||||
|
|
||||||
// Get SPL Version
|
// Get SPL Version
|
||||||
WebRtc_Word16 WebRtcSpl_get_version(char* version,
|
WebRtc_Word16 WebRtcSpl_get_version(char* version,
|
||||||
|
@ -15,139 +15,12 @@
|
|||||||
#ifndef WEBRTC_SPL_SPL_INL_H_
|
#ifndef WEBRTC_SPL_SPL_INL_H_
|
||||||
#define WEBRTC_SPL_SPL_INL_H_
|
#define WEBRTC_SPL_SPL_INL_H_
|
||||||
|
|
||||||
#ifdef WEBRTC_ARM_INLINE_CALLS
|
#ifdef WEBRTC_ARCH_ARM_V7A
|
||||||
|
#include "spl_inl_armv7.h"
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
WEBRTC_INLINE WebRtc_Word16 WebRtcSpl_AddSatW16(WebRtc_Word16 a,
|
static __inline WebRtc_Word16 WebRtcSpl_AddSatW16(WebRtc_Word16 a,
|
||||||
WebRtc_Word16 b)
|
WebRtc_Word16 b) {
|
||||||
{
|
|
||||||
WebRtc_Word32 s_sum = (WebRtc_Word32) a + (WebRtc_Word32) 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)
|
||||||
@ -158,26 +31,20 @@ WEBRTC_INLINE WebRtc_Word16 WebRtcSpl_AddSatW16(WebRtc_Word16 a,
|
|||||||
return (WebRtc_Word16)s_sum;
|
return (WebRtc_Word16)s_sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
WEBRTC_INLINE WebRtc_Word32 WebRtcSpl_AddSatW32(WebRtc_Word32 l_var1,
|
static __inline WebRtc_Word32 WebRtcSpl_AddSatW32(WebRtc_Word32 l_var1,
|
||||||
WebRtc_Word32 l_var2)
|
WebRtc_Word32 l_var2) {
|
||||||
{
|
|
||||||
WebRtc_Word32 l_sum;
|
WebRtc_Word32 l_sum;
|
||||||
|
|
||||||
// perform long addition
|
// perform long addition
|
||||||
l_sum = l_var1 + l_var2;
|
l_sum = l_var1 + l_var2;
|
||||||
|
|
||||||
// check for under or overflow
|
// check for under or overflow
|
||||||
if (WEBRTC_SPL_IS_NEG (l_var1))
|
if (WEBRTC_SPL_IS_NEG(l_var1)) {
|
||||||
{
|
if (WEBRTC_SPL_IS_NEG(l_var2) && !WEBRTC_SPL_IS_NEG(l_sum)) {
|
||||||
if (WEBRTC_SPL_IS_NEG (l_var2) && !WEBRTC_SPL_IS_NEG (l_sum))
|
|
||||||
{
|
|
||||||
l_sum = (WebRtc_Word32)0x80000000;
|
l_sum = (WebRtc_Word32)0x80000000;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
if (!WEBRTC_SPL_IS_NEG(l_var2) && WEBRTC_SPL_IS_NEG(l_sum)) {
|
||||||
{
|
|
||||||
if (!WEBRTC_SPL_IS_NEG (l_var2) && WEBRTC_SPL_IS_NEG (l_sum))
|
|
||||||
{
|
|
||||||
l_sum = (WebRtc_Word32)0x7FFFFFFF;
|
l_sum = (WebRtc_Word32)0x7FFFFFFF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -185,9 +52,8 @@ WEBRTC_INLINE WebRtc_Word32 WebRtcSpl_AddSatW32(WebRtc_Word32 l_var1,
|
|||||||
return l_sum;
|
return l_sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
WEBRTC_INLINE WebRtc_Word16 WebRtcSpl_SubSatW16( WebRtc_Word16 var1,
|
static __inline WebRtc_Word16 WebRtcSpl_SubSatW16(WebRtc_Word16 var1,
|
||||||
WebRtc_Word16 var2)
|
WebRtc_Word16 var2) {
|
||||||
{
|
|
||||||
WebRtc_Word32 l_diff;
|
WebRtc_Word32 l_diff;
|
||||||
WebRtc_Word16 s_diff;
|
WebRtc_Word16 s_diff;
|
||||||
|
|
||||||
@ -208,9 +74,8 @@ WEBRTC_INLINE WebRtc_Word16 WebRtcSpl_SubSatW16( WebRtc_Word16 var1,
|
|||||||
return s_diff;
|
return s_diff;
|
||||||
}
|
}
|
||||||
|
|
||||||
WEBRTC_INLINE WebRtc_Word32 WebRtcSpl_SubSatW32(WebRtc_Word32 l_var1,
|
static __inline WebRtc_Word32 WebRtcSpl_SubSatW32(WebRtc_Word32 l_var1,
|
||||||
WebRtc_Word32 l_var2)
|
WebRtc_Word32 l_var2) {
|
||||||
{
|
|
||||||
WebRtc_Word32 l_diff;
|
WebRtc_Word32 l_diff;
|
||||||
|
|
||||||
// perform subtraction
|
// perform subtraction
|
||||||
@ -226,28 +91,33 @@ WEBRTC_INLINE WebRtc_Word32 WebRtcSpl_SubSatW32(WebRtc_Word32 l_var1,
|
|||||||
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 (0xFFFF0000 & n) {
|
||||||
if ((0x0000FF00 & (n >> bits))) bits += 8;
|
bits = 16;
|
||||||
if ((0x000000F0 & (n >> bits))) bits += 4;
|
} else {
|
||||||
if ((0x0000000C & (n >> bits))) bits += 2;
|
bits = 0;
|
||||||
if ((0x00000002 & (n >> bits))) bits += 1;
|
}
|
||||||
if ((0x00000001 & (n >> bits))) bits += 1;
|
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)
|
static __inline int WebRtcSpl_NormW32(WebRtc_Word32 a) {
|
||||||
{
|
|
||||||
int zeros;
|
int zeros;
|
||||||
|
|
||||||
if (a <= 0) a ^= 0xFFFFFFFF;
|
if (a <= 0) a ^= 0xFFFFFFFF;
|
||||||
|
|
||||||
if (!(0xFFFF8000 & a)) zeros = 16; else zeros = 0;
|
if (!(0xFFFF8000 & a)) {
|
||||||
|
zeros = 16;
|
||||||
|
} else {
|
||||||
|
zeros = 0;
|
||||||
|
}
|
||||||
if (!(0xFF800000 & (a << zeros))) zeros += 8;
|
if (!(0xFF800000 & (a << zeros))) zeros += 8;
|
||||||
if (!(0xF8000000 & (a << zeros))) zeros += 4;
|
if (!(0xF8000000 & (a << zeros))) zeros += 4;
|
||||||
if (!(0xE0000000 & (a << zeros))) zeros += 2;
|
if (!(0xE0000000 & (a << zeros))) zeros += 2;
|
||||||
@ -256,27 +126,16 @@ WEBRTC_INLINE int WebRtcSpl_NormW32(WebRtc_Word32 a)
|
|||||||
return zeros;
|
return zeros;
|
||||||
}
|
}
|
||||||
|
|
||||||
WEBRTC_INLINE int WebRtcSpl_NormW16(WebRtc_Word16 a)
|
static __inline int WebRtcSpl_NormU32(WebRtc_UWord32 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 zeros;
|
int zeros;
|
||||||
|
|
||||||
if (a == 0) return 0;
|
if (a == 0) return 0;
|
||||||
|
|
||||||
if (!(0xFFFF0000 & a)) zeros = 16; else zeros = 0;
|
if (!(0xFFFF0000 & a)) {
|
||||||
|
zeros = 16;
|
||||||
|
} else {
|
||||||
|
zeros = 0;
|
||||||
|
}
|
||||||
if (!(0xFF000000 & (a << zeros))) zeros += 8;
|
if (!(0xFF000000 & (a << zeros))) zeros += 8;
|
||||||
if (!(0xF0000000 & (a << zeros))) zeros += 4;
|
if (!(0xF0000000 & (a << zeros))) zeros += 4;
|
||||||
if (!(0xC0000000 & (a << zeros))) zeros += 2;
|
if (!(0xC0000000 & (a << zeros))) zeros += 2;
|
||||||
@ -285,5 +144,23 @@ WEBRTC_INLINE int WebRtcSpl_NormU32(WebRtc_UWord32 a)
|
|||||||
return zeros;
|
return zeros;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // WEBRTC_ARM_INLINE_CALLS
|
static __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;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // WEBRTC_ARCH_ARM_V7A
|
||||||
|
|
||||||
#endif // WEBRTC_SPL_SPL_INL_H_
|
#endif // WEBRTC_SPL_SPL_INL_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_
|
@ -17,8 +17,6 @@ LOCAL_MODULE_CLASS := STATIC_LIBRARIES
|
|||||||
LOCAL_MODULE := libwebrtc_spl
|
LOCAL_MODULE := libwebrtc_spl
|
||||||
LOCAL_MODULE_TAGS := optional
|
LOCAL_MODULE_TAGS := optional
|
||||||
LOCAL_SRC_FILES := \
|
LOCAL_SRC_FILES := \
|
||||||
add_sat_w16.c \
|
|
||||||
add_sat_w32.c \
|
|
||||||
auto_corr_to_refl_coef.c \
|
auto_corr_to_refl_coef.c \
|
||||||
auto_correlation.c \
|
auto_correlation.c \
|
||||||
complex_fft.c \
|
complex_fft.c \
|
||||||
@ -36,15 +34,11 @@ LOCAL_SRC_FILES := \
|
|||||||
filter_ma_fast_q12.c \
|
filter_ma_fast_q12.c \
|
||||||
get_hanning_window.c \
|
get_hanning_window.c \
|
||||||
get_scaling_square.c \
|
get_scaling_square.c \
|
||||||
get_size_in_bits.c \
|
|
||||||
hanning_table.c \
|
hanning_table.c \
|
||||||
ilbc_specific_functions.c \
|
ilbc_specific_functions.c \
|
||||||
levinson_durbin.c \
|
levinson_durbin.c \
|
||||||
lpc_to_refl_coef.c \
|
lpc_to_refl_coef.c \
|
||||||
min_max_operations.c \
|
min_max_operations.c \
|
||||||
norm_u32.c \
|
|
||||||
norm_w16.c \
|
|
||||||
norm_w32.c \
|
|
||||||
randn_table.c \
|
randn_table.c \
|
||||||
randomization_functions.c \
|
randomization_functions.c \
|
||||||
refl_coef_to_lpc.c \
|
refl_coef_to_lpc.c \
|
||||||
@ -60,8 +54,6 @@ LOCAL_SRC_FILES := \
|
|||||||
spl_version.c \
|
spl_version.c \
|
||||||
splitting_filter.c \
|
splitting_filter.c \
|
||||||
sqrt_of_one_minus_x_squared.c \
|
sqrt_of_one_minus_x_squared.c \
|
||||||
sub_sat_w16.c \
|
|
||||||
sub_sat_w32.c \
|
|
||||||
vector_scaling_operations.c
|
vector_scaling_operations.c
|
||||||
|
|
||||||
# Flags passed to both C and C++ files.
|
# Flags passed to both C and C++ files.
|
||||||
|
@ -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;
|
|
||||||
}
|
|
@ -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;
|
|
||||||
}
|
|
@ -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;
|
|
||||||
}
|
|
@ -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;
|
|
||||||
}
|
|
@ -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;
|
|
||||||
}
|
|
@ -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;
|
|
||||||
}
|
|
@ -25,8 +25,6 @@
|
|||||||
'sources': [
|
'sources': [
|
||||||
'../interface/signal_processing_library.h',
|
'../interface/signal_processing_library.h',
|
||||||
'../interface/spl_inl.h',
|
'../interface/spl_inl.h',
|
||||||
'add_sat_w16.c',
|
|
||||||
'add_sat_w32.c',
|
|
||||||
'auto_corr_to_refl_coef.c',
|
'auto_corr_to_refl_coef.c',
|
||||||
'auto_correlation.c',
|
'auto_correlation.c',
|
||||||
'complex_fft.c',
|
'complex_fft.c',
|
||||||
@ -44,15 +42,11 @@
|
|||||||
'filter_ma_fast_q12.c',
|
'filter_ma_fast_q12.c',
|
||||||
'get_hanning_window.c',
|
'get_hanning_window.c',
|
||||||
'get_scaling_square.c',
|
'get_scaling_square.c',
|
||||||
'get_size_in_bits.c',
|
|
||||||
'hanning_table.c',
|
'hanning_table.c',
|
||||||
'ilbc_specific_functions.c',
|
'ilbc_specific_functions.c',
|
||||||
'levinson_durbin.c',
|
'levinson_durbin.c',
|
||||||
'lpc_to_refl_coef.c',
|
'lpc_to_refl_coef.c',
|
||||||
'min_max_operations.c',
|
'min_max_operations.c',
|
||||||
'norm_u32.c',
|
|
||||||
'norm_w16.c',
|
|
||||||
'norm_w32.c',
|
|
||||||
'randn_table.c',
|
'randn_table.c',
|
||||||
'randomization_functions.c',
|
'randomization_functions.c',
|
||||||
'refl_coef_to_lpc.c',
|
'refl_coef_to_lpc.c',
|
||||||
@ -69,8 +63,6 @@
|
|||||||
'spl_version.c',
|
'spl_version.c',
|
||||||
'splitting_filter.c',
|
'splitting_filter.c',
|
||||||
'sqrt_of_one_minus_x_squared.c',
|
'sqrt_of_one_minus_x_squared.c',
|
||||||
'sub_sat_w16.c',
|
|
||||||
'sub_sat_w32.c',
|
|
||||||
'vector_scaling_operations.c',
|
'vector_scaling_operations.c',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
@ -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
|
|
@ -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;
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user