diff options
author | bjornv@webrtc.org <bjornv@webrtc.org> | 2014-08-26 09:36:25 +0000 |
---|---|---|
committer | bjornv@webrtc.org <bjornv@webrtc.org> | 2014-08-26 09:36:25 +0000 |
commit | 782121c315548375ccbd6809d55e83d40f1e848f (patch) | |
tree | 422b5d695ca0d17d120535dc3528b923e753c0ab /common_audio | |
parent | 0e2b7ecb5b11fce7c2f280c067980ac0696cc955 (diff) | |
download | webrtc-782121c315548375ccbd6809d55e83d40f1e848f.tar.gz |
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
Diffstat (limited to 'common_audio')
-rw-r--r-- | common_audio/signal_processing/include/spl_inl.h | 80 | ||||
-rw-r--r-- | common_audio/signal_processing/include/spl_inl_armv7.h | 5 |
2 files changed, 38 insertions, 47 deletions
diff --git a/common_audio/signal_processing/include/spl_inl.h b/common_audio/signal_processing/include/spl_inl.h index a4ddb3fa..8bf452fe 100644 --- a/common_audio/signal_processing/include/spl_inl.h +++ b/common_audio/signal_processing/include/spl_inl.h @@ -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_ diff --git a/common_audio/signal_processing/include/spl_inl_armv7.h b/common_audio/signal_processing/include/spl_inl_armv7.h index 0f505471..3854715d 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 @@ 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; |