commit | 7cfbf3a0ffc888e411a677a3402961792bba92aa | [log] [tgz] |
---|---|---|
author | Alex Loiko <aleloi@webrtc.org> | Tue Nov 07 16:34:32 2017 +0100 |
committer | Commit Bot <commit-bot@chromium.org> | Tue Nov 07 15:37:55 2017 +0000 |
tree | cb5e3471148f90c57e4136a7857b3a0f2bfae37b | |
parent | fbb3b7d004424d5247efe5583f429f447290a49c [diff] |
Make energy calculation in AGC not overflow. An energy value is calculated by summing squares of processed audio samples. The expression 'out*out >> 6' could overflow. In this CL we change it to 'out*(out>>6) + out*(out*(out%(1<<6))>>6)'. The which is verified and proven to be equal, but doesn't overflow. The change also passes our change-detection tests in GainControlBitExactnessTest.* We verified with Godbolt that the modulo and divisions are converted into branch-free bitwise operations. NOTRY=True # changing comment, tests just passed. Bug: chromium:780638, chromium:780376 Change-Id: I415535193433a2fbc275c643fb4e4026ba3e0bdd Reviewed-on: https://webrtc-review.googlesource.com/20867 Commit-Queue: Alex Loiko <aleloi@webrtc.org> Reviewed-by: Sam Zackrisson <saza@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20589}
WebRTC is a free, open software project that provides browsers and mobile applications with Real-Time Communications (RTC) capabilities via simple APIs. The WebRTC components have been optimized to best serve this purpose.
Our mission: To enable rich, high-quality RTC applications to be developed for the browser, mobile platforms, and IoT devices, and allow them all to communicate via a common set of protocols.
The WebRTC initiative is a project supported by Google, Mozilla and Opera, amongst others.
See http://www.webrtc.org/native-code/development for instructions on how to get started developing with the native code.