common_audio: Re-enable WebRtcSpl_AddSatW32() and WebRtcSpl_SubSatW32() optimizations on armv7
According to the issue, common_audio_unittests failed on armv7. It currently pass, so we should turn it on again. There is no print out in the issue, so the cause of failure is unknown. BUG=740 TESTED=locally on N7 R=tina.legrand@webrtc.org Review URL: https://webrtc-codereview.appspot.com/14199004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@6975 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@ -35,6 +35,44 @@ static __inline int16_t WebRtcSpl_SatW32ToW16(int32_t value32) {
|
|||||||
return out16;
|
return out16;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static __inline int32_t WebRtcSpl_AddSatW32(int32_t l_var1, int32_t l_var2) {
|
||||||
|
int32_t l_sum;
|
||||||
|
|
||||||
|
// Perform long addition
|
||||||
|
l_sum = l_var1 + l_var2;
|
||||||
|
|
||||||
|
if (l_var1 < 0) { // Check for underflow.
|
||||||
|
if ((l_var2 < 0) && (l_sum >= 0)) {
|
||||||
|
l_sum = (int32_t)0x80000000;
|
||||||
|
}
|
||||||
|
} else { // Check for overflow.
|
||||||
|
if ((l_var2 > 0) && (l_sum < 0)) {
|
||||||
|
l_sum = (int32_t)0x7FFFFFFF;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return l_sum;
|
||||||
|
}
|
||||||
|
|
||||||
|
static __inline int32_t WebRtcSpl_SubSatW32(int32_t l_var1, int32_t l_var2) {
|
||||||
|
int32_t l_diff;
|
||||||
|
|
||||||
|
// Perform subtraction.
|
||||||
|
l_diff = l_var1 - l_var2;
|
||||||
|
|
||||||
|
if (l_var1 < 0) { // Check for underflow.
|
||||||
|
if ((l_var2 > 0) && (l_diff > 0)) {
|
||||||
|
l_diff = (int32_t)0x80000000;
|
||||||
|
}
|
||||||
|
} else { // Check for overflow.
|
||||||
|
if ((l_var2 < 0) && (l_diff < 0)) {
|
||||||
|
l_diff = (int32_t)0x7FFFFFFF;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return l_diff;
|
||||||
|
}
|
||||||
|
|
||||||
static __inline int16_t WebRtcSpl_AddSatW16(int16_t a, int16_t b) {
|
static __inline int16_t WebRtcSpl_AddSatW16(int16_t a, int16_t b) {
|
||||||
return WebRtcSpl_SatW32ToW16((int32_t) a + (int32_t) b);
|
return WebRtcSpl_SatW32ToW16((int32_t) a + (int32_t) b);
|
||||||
}
|
}
|
||||||
@ -132,46 +170,4 @@ static __inline int32_t WebRtc_MulAccumW16(int16_t a, int16_t b, int32_t c) {
|
|||||||
|
|
||||||
#endif // WEBRTC_ARCH_ARM_V7
|
#endif // WEBRTC_ARCH_ARM_V7
|
||||||
|
|
||||||
// The following functions have no optimized versions.
|
|
||||||
// TODO(kma): Consider saturating add/sub instructions in X86 platform.
|
|
||||||
#if !defined(MIPS_DSP_R1_LE)
|
|
||||||
static __inline int32_t WebRtcSpl_AddSatW32(int32_t l_var1, int32_t l_var2) {
|
|
||||||
int32_t l_sum;
|
|
||||||
|
|
||||||
// Perform long addition
|
|
||||||
l_sum = l_var1 + l_var2;
|
|
||||||
|
|
||||||
if (l_var1 < 0) { // Check for underflow.
|
|
||||||
if ((l_var2 < 0) && (l_sum >= 0)) {
|
|
||||||
l_sum = (int32_t)0x80000000;
|
|
||||||
}
|
|
||||||
} else { // Check for overflow.
|
|
||||||
if ((l_var2 > 0) && (l_sum < 0)) {
|
|
||||||
l_sum = (int32_t)0x7FFFFFFF;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return l_sum;
|
|
||||||
}
|
|
||||||
|
|
||||||
static __inline int32_t WebRtcSpl_SubSatW32(int32_t l_var1, int32_t l_var2) {
|
|
||||||
int32_t l_diff;
|
|
||||||
|
|
||||||
// Perform subtraction.
|
|
||||||
l_diff = l_var1 - l_var2;
|
|
||||||
|
|
||||||
if (l_var1 < 0) { // Check for underflow.
|
|
||||||
if ((l_var2 > 0) && (l_diff > 0)) {
|
|
||||||
l_diff = (int32_t)0x80000000;
|
|
||||||
}
|
|
||||||
} else { // Check for overflow.
|
|
||||||
if ((l_var2 < 0) && (l_diff < 0)) {
|
|
||||||
l_diff = (int32_t)0x7FFFFFFF;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return l_diff;
|
|
||||||
}
|
|
||||||
#endif // #if !defined(MIPS_DSP_R1_LE)
|
|
||||||
|
|
||||||
#endif // WEBRTC_SPL_SPL_INL_H_
|
#endif // WEBRTC_SPL_SPL_INL_H_
|
||||||
|
@ -51,10 +51,6 @@ static __inline int16_t WebRtcSpl_AddSatW16(int16_t a, int16_t b) {
|
|||||||
return (int16_t) s_sum;
|
return (int16_t) s_sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO(kma): find the cause of unittest errors by the next two functions:
|
|
||||||
* http://code.google.com/p/webrtc/issues/detail?id=740.
|
|
||||||
*/
|
|
||||||
#if 0
|
|
||||||
static __inline int32_t WebRtcSpl_AddSatW32(int32_t l_var1, int32_t l_var2) {
|
static __inline int32_t WebRtcSpl_AddSatW32(int32_t l_var1, int32_t l_var2) {
|
||||||
int32_t l_sum = 0;
|
int32_t l_sum = 0;
|
||||||
|
|
||||||
@ -70,7 +66,6 @@ static __inline int32_t WebRtcSpl_SubSatW32(int32_t l_var1, int32_t l_var2) {
|
|||||||
|
|
||||||
return l_sub;
|
return l_sub;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static __inline int16_t WebRtcSpl_SubSatW16(int16_t var1, int16_t var2) {
|
static __inline int16_t WebRtcSpl_SubSatW16(int16_t var1, int16_t var2) {
|
||||||
int32_t s_sub = 0;
|
int32_t s_sub = 0;
|
||||||
|
Reference in New Issue
Block a user