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

Unified Diff: third_party/WebKit/Source/platform/audio/DynamicsCompressorKernel.cpp

Issue 1530723004: Use clampTo instead of chaining std::max(std::min(...)) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More rebase Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/audio/DynamicsCompressorKernel.cpp
diff --git a/third_party/WebKit/Source/platform/audio/DynamicsCompressorKernel.cpp b/third_party/WebKit/Source/platform/audio/DynamicsCompressorKernel.cpp
index e0cc41a80b1b444167aabe7c293bc011b95655d4..3bbd761e7ec02095af8fa84beeca84b2799b2f60 100644
--- a/third_party/WebKit/Source/platform/audio/DynamicsCompressorKernel.cpp
+++ b/third_party/WebKit/Source/platform/audio/DynamicsCompressorKernel.cpp
@@ -29,10 +29,11 @@
#include "platform/audio/DynamicsCompressorKernel.h"
#if ENABLE(WEB_AUDIO)
-#include <algorithm>
#include "platform/audio/AudioUtilities.h"
#include "platform/audio/DenormalDisabler.h"
#include "wtf/MathExtras.h"
+#include <algorithm>
+#include <cmath>
namespace blink {
@@ -318,8 +319,7 @@ void DynamicsCompressorKernel::process(const float* sourceChannels[],
// Contain within range: -12 -> 0 then scale to go from 0 -> 3
float x = compressionDiffDb;
- x = std::max(-12.0f, x);
- x = std::min(0.0f, x);
+ x = clampTo(x, -12.0f, 0.0f);
x = 0.25f * (x + 12);
// Compute adaptive release curve using 4th order polynomial.
« no previous file with comments | « third_party/WebKit/Source/platform/audio/Biquad.cpp ('k') | third_party/WebKit/Source/platform/audio/EqualPowerPanner.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698