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/webrtc@6975 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/common_audio/signal_processing/include/spl_inl.h b/common_audio/signal_processing/include/spl_inl.h
index a4ddb3f..8bf452f 100644
--- a/common_audio/signal_processing/include/spl_inl.h
+++ b/common_audio/signal_processing/include/spl_inl.h
@@ -35,6 +35,44 @@
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 @@
#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_
diff --git a/common_audio/signal_processing/include/spl_inl_armv7.h b/common_audio/signal_processing/include/spl_inl_armv7.h
index 0f50547..3854715 100644
--- a/common_audio/signal_processing/include/spl_inl_armv7.h
+++ b/common_audio/signal_processing/include/spl_inl_armv7.h
@@ -51,10 +51,6 @@
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 @@
return l_sub;
}
-#endif
static __inline int16_t WebRtcSpl_SubSatW16(int16_t var1, int16_t var2) {
int32_t s_sub = 0;