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

Issue 2808513003: Add SafeClamp(), which accepts args of different types (Closed)

Created:
3 years, 8 months ago by kwiberg-webrtc
Modified:
3 years, 6 months ago
Reviewers:
nisse-webrtc, ossu
CC:
webrtc-reviews_webrtc.org, danilchap, AleBzk, peah-webrtc, zhuangzesen_agora.io, Andrew MacDonald, aleloi, henrika_webrtc, stefan-webrtc, tlegrand-webrtc, tterriberry_mozilla.com, audio-team_agora.io, hlundin-webrtc, mflodman, minyue-webrtc, the sun, aluebs-webrtc, bjornv1
Target Ref:
refs/heads/master
Project:
webrtc
Visibility:
Public.

Description

Add SafeClamp(), which accepts args of different types Specifically, just like SafeMin() and SafeMax() it handles all combinations of integer and all combinations of floating-point arguments by picking a result type that is guaranteed to be able to hold the result. This CL also replaces a bunch of std::min + std:max call pairs with calls to SafeClamp()---the ones that could easily be found by grep because "min" and "max" were on the same line. :-) BUG=webrtc:7459 Review-Url: https://codereview.webrtc.org/2808513003 Cr-Commit-Position: refs/heads/master@{#18542} Committed: https://chromium.googlesource.com/external/webrtc/+/0703856b53e80159d666e289762406989f08ccfa

Patch Set 1 #

Total comments: 4

Patch Set 2 : Change arg positions from (l, h, x) to (x, l, h) #

Total comments: 6

Patch Set 3 : nits #

Patch Set 4 : rebase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+443 lines, -97 lines) Patch
M webrtc/base/safe_minmax.h View 1 2 3 chunks +149 lines, -4 lines 0 comments Download
M webrtc/base/safe_minmax_unittest.cc View 1 2 7 chunks +204 lines, -8 lines 0 comments Download
M webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus.cc View 1 2 chunks +3 lines, -2 lines 0 comments Download
M webrtc/modules/audio_processing/aec3/adaptive_fir_filter_unittest.cc View 1 2 2 chunks +3 lines, -3 lines 0 comments Download
M webrtc/modules/audio_processing/aec3/echo_remover_metrics.cc View 1 2 chunks +2 lines, -1 line 0 comments Download
M webrtc/modules/audio_processing/aec3/erle_estimator.cc View 1 2 chunks +3 lines, -1 line 0 comments Download
M webrtc/modules/audio_processing/aec3/main_filter_update_gain_unittest.cc View 1 3 chunks +5 lines, -6 lines 0 comments Download
M webrtc/modules/audio_processing/aec3/shadow_filter_update_gain_unittest.cc View 1 2 chunks +4 lines, -4 lines 0 comments Download
M webrtc/modules/audio_processing/aec3/subtractor.cc View 1 2 chunks +3 lines, -3 lines 0 comments Download
M webrtc/modules/audio_processing/aec3/suppression_filter.cc View 1 3 chunks +3 lines, -2 lines 0 comments Download
M webrtc/modules/audio_processing/agc/agc_manager_direct.cc View 1 4 chunks +8 lines, -6 lines 0 comments Download
M webrtc/modules/audio_processing/audio_processing_unittest.cc View 1 1 chunk +6 lines, -8 lines 0 comments Download
M webrtc/modules/audio_processing/intelligibility/intelligibility_enhancer.cc View 1 2 chunks +15 lines, -14 lines 0 comments Download
M webrtc/modules/audio_processing/intelligibility/intelligibility_utils.cc View 1 2 chunks +5 lines, -3 lines 0 comments Download
M webrtc/modules/remote_bitrate_estimator/aimd_rate_control.cc View 1 1 chunk +3 lines, -3 lines 0 comments Download
M webrtc/modules/remote_bitrate_estimator/overuse_detector.cc View 1 2 chunks +2 lines, -5 lines 0 comments Download
M webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy.cc View 1 2 chunks +6 lines, -4 lines 0 comments Download
M webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.cc View 1 2 3 2 chunks +3 lines, -2 lines 0 comments Download
M webrtc/modules/rtp_rtcp/source/rtp_sender.cc View 1 2 chunks +7 lines, -6 lines 0 comments Download
M webrtc/p2p/base/port.cc View 1 2 chunks +2 lines, -1 line 0 comments Download
M webrtc/p2p/base/pseudotcp.cc View 1 3 chunks +3 lines, -7 lines 0 comments Download
M webrtc/tools/agc/activity_metric.cc View 1 2 chunks +2 lines, -3 lines 0 comments Download
M webrtc/voice_engine/channel_proxy.cc View 1 2 chunks +2 lines, -1 line 0 comments Download

Messages

Total messages: 47 (36 generated)
kwiberg-webrtc
3 years, 6 months ago (2017-06-02 12:47:52 UTC) #22
nisse-webrtc
https://codereview.webrtc.org/2808513003/diff/60001/webrtc/base/safe_minmax.h File webrtc/base/safe_minmax.h (right): https://codereview.webrtc.org/2808513003/diff/60001/webrtc/base/safe_minmax.h#newcode31 webrtc/base/safe_minmax.h:31: // rtc::SafeClamp(a, b, x) Do you have a good ...
3 years, 6 months ago (2017-06-02 13:00:54 UTC) #23
kwiberg-webrtc
https://codereview.webrtc.org/2808513003/diff/60001/webrtc/base/safe_minmax.h File webrtc/base/safe_minmax.h (right): https://codereview.webrtc.org/2808513003/diff/60001/webrtc/base/safe_minmax.h#newcode31 webrtc/base/safe_minmax.h:31: // rtc::SafeClamp(a, b, x) On 2017/06/02 13:00:54, nisse-webrtc wrote: ...
3 years, 6 months ago (2017-06-02 13:12:37 UTC) #24
ossu
https://codereview.webrtc.org/2808513003/diff/60001/webrtc/base/safe_minmax.h File webrtc/base/safe_minmax.h (right): https://codereview.webrtc.org/2808513003/diff/60001/webrtc/base/safe_minmax.h#newcode31 webrtc/base/safe_minmax.h:31: // rtc::SafeClamp(a, b, x) On 2017/06/02 13:00:54, nisse-webrtc wrote: ...
3 years, 6 months ago (2017-06-02 13:22:34 UTC) #25
kwiberg-webrtc
https://codereview.webrtc.org/2808513003/diff/60001/webrtc/base/safe_minmax.h File webrtc/base/safe_minmax.h (right): https://codereview.webrtc.org/2808513003/diff/60001/webrtc/base/safe_minmax.h#newcode31 webrtc/base/safe_minmax.h:31: // rtc::SafeClamp(a, b, x) On 2017/06/02 13:22:33, ossu wrote: ...
3 years, 6 months ago (2017-06-04 01:27:54 UTC) #31
nisse-webrtc
lgtm (but I don't really follow the C++ templating magic).
3 years, 6 months ago (2017-06-08 06:46:45 UTC) #34
kwiberg-webrtc
On 2017/06/08 06:46:45, nisse-webrtc wrote: > lgtm (but I don't really follow the C++ templating ...
3 years, 6 months ago (2017-06-08 08:37:36 UTC) #35
ossu
Couple of tiny nits, but otherwise LGTM. https://codereview.webrtc.org/2808513003/diff/100001/webrtc/base/safe_minmax.h File webrtc/base/safe_minmax.h (right): https://codereview.webrtc.org/2808513003/diff/100001/webrtc/base/safe_minmax.h#newcode296 webrtc/base/safe_minmax.h:296: // Pick ...
3 years, 6 months ago (2017-06-12 12:21:36 UTC) #36
kwiberg-webrtc
https://codereview.webrtc.org/2808513003/diff/100001/webrtc/base/safe_minmax.h File webrtc/base/safe_minmax.h (right): https://codereview.webrtc.org/2808513003/diff/100001/webrtc/base/safe_minmax.h#newcode296 webrtc/base/safe_minmax.h:296: // Pick the best type, preferring the same signedness ...
3 years, 6 months ago (2017-06-12 17:28:12 UTC) #39
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/2808513003/140001
3 years, 6 months ago (2017-06-12 18:38:43 UTC) #44
commit-bot: I haz the power
3 years, 6 months ago (2017-06-12 18:40:55 UTC) #47
Message was sent while issue was closed.
Committed patchset #4 (id:140001) as
https://chromium.googlesource.com/external/webrtc/+/0703856b53e80159d666e2897...

Powered by Google App Engine
This is Rietveld 408576698