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:
bjornv@webrtc.org
2014-08-26 09:36:25 +00:00
parent 047a46f8b4
commit 1de0cc4079
2 changed files with 38 additions and 47 deletions

View File

@ -35,6 +35,44 @@ static __inline int16_t WebRtcSpl_SatW32ToW16(int32_t value32) {
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) {
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
// 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_

View File

@ -51,10 +51,6 @@ static __inline int16_t WebRtcSpl_AddSatW16(int16_t a, int16_t b) {
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) {
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;
}
#endif
static __inline int16_t WebRtcSpl_SubSatW16(int16_t var1, int16_t var2) {
int32_t s_sub = 0;