Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(494)

Issue 2659423002: Consistent 30% improvement in audio mixer running time. (Closed)

Created:
3 years, 10 months ago by aleloi
Modified:
3 years, 10 months ago
Reviewers:
the sun, hlundin-webrtc
CC:
webrtc-reviews_webrtc.org, tterriberry_mozilla.com
Target Ref:
refs/heads/master
Project:
webrtc
Visibility:
Public.

Description

Consistent 30% improvement in audio mixer running time. (Or, in less flattering terms, fixing a performance issue introduced a few months ago by me). In GN release mode (is_debug = false), the version of the mixer code before this CL generated code that multiplied each sample (tens of thousands/second for each input stream) with a floating point number. This number is almost always exactly 1.0f. The only situation when it's not 1 is when an audio steam is added or removed. For one input stream early return leads to a 30% improvement of audio mixing time profiled on x86-64 under a release build (is_debug = false, enable_profiling, enable_full_stack_frames_for_profiling) with 16kHz and no APM limiter. There can be up to 3 streams. BUG=chromium:687502 Review-Url: https://codereview.webrtc.org/2659423002 Cr-Commit-Position: refs/heads/master@{#16396} Committed: https://chromium.googlesource.com/external/webrtc/+/4637b6afca431be8caf1d22151a2cbb2e86a33d5

Patch Set 1 #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+3 lines, -0 lines) Patch
M webrtc/modules/audio_mixer/audio_frame_manipulator.cc View 1 chunk +3 lines, -0 lines 2 comments Download

Messages

Total messages: 24 (14 generated)
aleloi
Really short one, PTAL! I did some profiling of mixing in floats/int32 and made some ...
3 years, 10 months ago (2017-01-30 15:46:39 UTC) #6
hlundin-webrtc
Sorry for the delayed review. LGTM!
3 years, 10 months ago (2017-02-01 08:33:05 UTC) #10
hlundin-webrtc
On 2017/02/01 08:33:05, hlundin-webrtc wrote: > Sorry for the delayed review. LGTM! Before landing, file ...
3 years, 10 months ago (2017-02-01 08:34:40 UTC) #11
aleloi
Done!
3 years, 10 months ago (2017-02-01 09:54:17 UTC) #13
hlundin-webrtc
lgtm
3 years, 10 months ago (2017-02-01 10:15:35 UTC) #15
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.webrtc.org/2659423002/1
3 years, 10 months ago (2017-02-01 10:18:48 UTC) #17
commit-bot: I haz the power
Committed patchset #1 (id:1) as https://chromium.googlesource.com/external/webrtc/+/4637b6afca431be8caf1d22151a2cbb2e86a33d5
3 years, 10 months ago (2017-02-01 11:43:35 UTC) #20
the sun
https://codereview.webrtc.org/2659423002/diff/1/webrtc/modules/audio_mixer/audio_frame_manipulator.cc File webrtc/modules/audio_mixer/audio_frame_manipulator.cc (right): https://codereview.webrtc.org/2659423002/diff/1/webrtc/modules/audio_mixer/audio_frame_manipulator.cc#newcode32 webrtc/modules/audio_mixer/audio_frame_manipulator.cc:32: if (start_gain == target_gain) { Comparing floats is fuzzy ...
3 years, 10 months ago (2017-02-07 08:53:22 UTC) #22
hlundin-webrtc
https://codereview.webrtc.org/2659423002/diff/1/webrtc/modules/audio_mixer/audio_frame_manipulator.cc File webrtc/modules/audio_mixer/audio_frame_manipulator.cc (right): https://codereview.webrtc.org/2659423002/diff/1/webrtc/modules/audio_mixer/audio_frame_manipulator.cc#newcode32 webrtc/modules/audio_mixer/audio_frame_manipulator.cc:32: if (start_gain == target_gain) { On 2017/02/07 08:53:22, the ...
3 years, 10 months ago (2017-02-07 21:34:51 UTC) #23
aleloi
3 years, 10 months ago (2017-02-08 08:43:18 UTC) #24
Message was sent while issue was closed.
On 2017/02/07 08:53:22, the sun wrote:
>
https://codereview.webrtc.org/2659423002/diff/1/webrtc/modules/audio_mixer/au...
> File webrtc/modules/audio_mixer/audio_frame_manipulator.cc (right):
> 
>
https://codereview.webrtc.org/2659423002/diff/1/webrtc/modules/audio_mixer/au...
> webrtc/modules/audio_mixer/audio_frame_manipulator.cc:32: if (start_gain ==
> target_gain) {
> Comparing floats is fuzzy and operator == is not to be trusted to do what you
> intend. See e.g.:
> 
>
http://stackoverflow.com/questions/41989570/in-c-is-exactly-one-of-and-guaran...
>
http://stackoverflow.com/questions/17333/what-is-the-most-effective-way-for-f...
> 
> hlundin@, do you know if we have any function in the codebase (outside of
gtest)
> for this?

Ramp() is only ever called with 0.0 and 1.0. == works as long as no number is
NaN.

Powered by Google App Engine
This is Rietveld 408576698