| Index: Source/platform/audio/DynamicsCompressorKernel.cpp
|
| diff --git a/Source/platform/audio/DynamicsCompressorKernel.cpp b/Source/platform/audio/DynamicsCompressorKernel.cpp
|
| index fca2d7c37ba1cd6086918b93f9602aea30454d75..1b03ca50665bc1f6c74efd2a594ad3935f0814bb 100644
|
| --- a/Source/platform/audio/DynamicsCompressorKernel.cpp
|
| +++ b/Source/platform/audio/DynamicsCompressorKernel.cpp
|
| @@ -37,8 +37,6 @@
|
| #include "platform/audio/DenormalDisabler.h"
|
| #include "wtf/MathExtras.h"
|
|
|
| -using namespace std;
|
| -
|
| namespace blink {
|
|
|
| using namespace AudioUtilities;
|
| @@ -240,7 +238,7 @@ void DynamicsCompressorKernel::process(const float* sourceChannels[],
|
| float masterLinearGain = decibelsToLinear(dbPostGain) * fullRangeMakeupGain;
|
|
|
| // Attack parameters.
|
| - attackTime = max(0.001f, attackTime);
|
| + attackTime = std::max(0.001f, attackTime);
|
| float attackFrames = attackTime * sampleRate;
|
|
|
| // Release parameters.
|
| @@ -323,8 +321,8 @@ void DynamicsCompressorKernel::process(const float* sourceChannels[],
|
|
|
| // Contain within range: -12 -> 0 then scale to go from 0 -> 3
|
| float x = compressionDiffDb;
|
| - x = max(-12.0f, x);
|
| - x = min(0.0f, x);
|
| + x = std::max(-12.0f, x);
|
| + x = std::min(0.0f, x);
|
| x = 0.25f * (x + 12);
|
|
|
| // Compute adaptive release curve using 4th order polynomial.
|
| @@ -352,7 +350,7 @@ void DynamicsCompressorKernel::process(const float* sourceChannels[],
|
| if (m_maxAttackCompressionDiffDb == -1 || m_maxAttackCompressionDiffDb < compressionDiffDb)
|
| m_maxAttackCompressionDiffDb = compressionDiffDb;
|
|
|
| - float effAttenDiffDb = max(0.5f, m_maxAttackCompressionDiffDb);
|
| + float effAttenDiffDb = std::max(0.5f, m_maxAttackCompressionDiffDb);
|
|
|
| float x = 0.25f / effAttenDiffDb;
|
| envelopeRate = 1 - powf(x, 1 / attackFrames);
|
| @@ -397,7 +395,7 @@ void DynamicsCompressorKernel::process(const float* sourceChannels[],
|
| float attenuation = absInput <= 0.0001f ? 1 : shapedInput / absInput;
|
|
|
| float attenuationDb = -linearToDecibels(attenuation);
|
| - attenuationDb = max(2.0f, attenuationDb);
|
| + attenuationDb = std::max(2.0f, attenuationDb);
|
|
|
| float dbPerFrame = attenuationDb / satReleaseFrames;
|
|
|
| @@ -407,7 +405,7 @@ void DynamicsCompressorKernel::process(const float* sourceChannels[],
|
| float rate = isRelease ? satReleaseRate : 1;
|
|
|
| detectorAverage += (attenuation - detectorAverage) * rate;
|
| - detectorAverage = min(1.0f, detectorAverage);
|
| + detectorAverage = std::min(1.0f, detectorAverage);
|
|
|
| // Fix gremlins.
|
| if (std::isnan(detectorAverage))
|
| @@ -422,7 +420,7 @@ void DynamicsCompressorKernel::process(const float* sourceChannels[],
|
| } else {
|
| // Release - exponentially increase gain to 1.0
|
| compressorGain *= envelopeRate;
|
| - compressorGain = min(1.0f, compressorGain);
|
| + compressorGain = std::min(1.0f, compressorGain);
|
| }
|
|
|
| // Warp pre-compression gain to smooth out sharp exponential transition points.
|
| @@ -432,7 +430,7 @@ void DynamicsCompressorKernel::process(const float* sourceChannels[],
|
| float totalGain = dryMix + wetMix * masterLinearGain * postWarpCompressorGain;
|
|
|
| // Calculate metering.
|
| - float dbRealGain = 20 * log10(postWarpCompressorGain);
|
| + float dbRealGain = 20 * std::log10(postWarpCompressorGain);
|
| if (dbRealGain < m_meteringGain)
|
| m_meteringGain = dbRealGain;
|
| else
|
|
|