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

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: Handling that minimumThumbLength > trackLen. 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 1b03ca50665bc1f6c74efd2a594ad3935f0814bb..8c14cebeb3365e10cc6f2aa2296c1ec0f80031e8 100644
--- a/third_party/WebKit/Source/platform/audio/DynamicsCompressorKernel.cpp
+++ b/third_party/WebKit/Source/platform/audio/DynamicsCompressorKernel.cpp
@@ -32,10 +32,11 @@
#include "platform/audio/DynamicsCompressorKernel.h"
-#include <algorithm>
#include "platform/audio/AudioUtilities.h"
#include "platform/audio/DenormalDisabler.h"
#include "wtf/MathExtras.h"
+#include <algorithm>
+#include <cmath>
Raymond Toy 2015/12/17 19:45:55 Are both of these needed? Previously, you replace
Daniel Bratell 2015/12/17 22:56:16 DynamicsCompressorKernel::process uses std::max()
namespace blink {
@@ -321,8 +322,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.

Powered by Google App Engine
This is Rietveld 408576698