StereoToMono: Remove useless call to WebRtcSpl_SatW32ToW16
The max value is ((2**15 - 1) + (2**15 - 1)) >> 1
== (2**16 - 2) >> 1
== 2**15 - 1
which doesn't overflow.
The min value is (-2**15 + -2**15) >> 1
== -2**16 >> 1
== -2**15
which doesn't overflow.
Since those two bracket all possible results, the call to
WebRtcSpl_SatW32ToW16 is redundant.
BUG=
R=andrew@webrtc.org, bjornv@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/12019004
git-svn-id: http://webrtc.googlecode.com/svn/trunk@5929 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/webrtc/modules/audio_processing/audio_buffer.cc b/webrtc/modules/audio_processing/audio_buffer.cc
index 9082477..8d26f52 100644
--- a/webrtc/modules/audio_processing/audio_buffer.cc
+++ b/webrtc/modules/audio_processing/audio_buffer.cc
@@ -25,12 +25,9 @@
void StereoToMono(const int16_t* left, const int16_t* right,
int16_t* out, int samples_per_channel) {
assert(left != NULL && right != NULL && out != NULL);
- for (int i = 0; i < samples_per_channel; i++) {
- int32_t data32 = (static_cast<int32_t>(left[i]) +
- static_cast<int32_t>(right[i])) >> 1;
-
- out[i] = WebRtcSpl_SatW32ToW16(data32);
- }
+ for (int i = 0; i < samples_per_channel; i++)
+ out[i] = (static_cast<int32_t>(left[i]) +
+ static_cast<int32_t>(right[i])) >> 1;
}
} // namespace