зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1577932 - Remove using namespace std from dom/media r=padenot
Differential Revision: https://phabricator.services.mozilla.com/D44289 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
fb4596cde5
Коммит
74b57d4f28
|
@ -23,8 +23,6 @@ using WebCore::HRTFPanner;
|
|||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
using namespace std;
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(PannerNode)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(PannerNode, AudioNode)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mPositionX, mPositionY, mPositionZ,
|
||||
|
@ -448,7 +446,7 @@ void PannerNodeEngine::EqualPowerPanningFunction(const AudioBlock& aInput,
|
|||
|
||||
// The following algorithm is described in the spec.
|
||||
// Clamp azimuth in the [-90, 90] range.
|
||||
azimuth = min(180.f, max(-180.f, azimuth));
|
||||
azimuth = std::min(180.f, std::max(-180.f, azimuth));
|
||||
|
||||
// Wrap around
|
||||
if (azimuth < -90.f) {
|
||||
|
@ -548,7 +546,7 @@ void PannerNodeEngine::EqualPowerPanningFunction(const AudioBlock& aInput,
|
|||
|
||||
// The following algorithm is described in the spec.
|
||||
// Clamp azimuth in the [-90, 90] range.
|
||||
azimuth = min(180.f, max(-180.f, azimuth));
|
||||
azimuth = std::min(180.f, std::max(-180.f, azimuth));
|
||||
|
||||
// Wrap around
|
||||
if (azimuth < -90.f) {
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
using namespace std;
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_INHERITED(StereoPannerNode, AudioNode, mPan)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(StereoPannerNode)
|
||||
|
|
|
@ -38,14 +38,8 @@ const size_t MaxChannelCount = 32;
|
|||
const uint32_t MinSampleRate = 8000;
|
||||
const uint32_t MaxSampleRate = 192000;
|
||||
|
||||
inline bool FuzzyEqual(float v1, float v2) {
|
||||
using namespace std;
|
||||
return fabsf(v1 - v2) < 1e-7f;
|
||||
}
|
||||
inline bool FuzzyEqual(double v1, double v2) {
|
||||
using namespace std;
|
||||
return fabs(v1 - v2) < 1e-7;
|
||||
}
|
||||
inline bool FuzzyEqual(float v1, float v2) { return fabsf(v1 - v2) < 1e-7f; }
|
||||
inline bool FuzzyEqual(double v1, double v2) { return fabs(v1 - v2) < 1e-7; }
|
||||
|
||||
/**
|
||||
* Converts an AudioTimelineEvent's floating point time values to tick values
|
||||
|
@ -160,8 +154,7 @@ inline bool IsTimeValid(double aTime) {
|
|||
*/
|
||||
template <typename IntType, typename FloatType>
|
||||
IntType TruncateFloatToInt(FloatType f) {
|
||||
using namespace std;
|
||||
|
||||
using std::numeric_limits;
|
||||
static_assert(mozilla::IsIntegral<IntType>::value == true,
|
||||
"IntType must be an integral type");
|
||||
static_assert(mozilla::IsFloatingPoint<FloatType>::value == true,
|
||||
|
|
|
@ -35,8 +35,6 @@
|
|||
#include "mozilla/FloatingPoint.h"
|
||||
#include "WebAudioUtils.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
using namespace mozilla::dom; // for WebAudioUtils
|
||||
using mozilla::IsInfinite;
|
||||
using mozilla::IsNaN;
|
||||
|
@ -242,7 +240,7 @@ void DynamicsCompressorKernel::process(
|
|||
WebAudioUtils::ConvertDecibelsToLinear(dbPostGain) * fullRangeMakeupGain;
|
||||
|
||||
// Attack parameters.
|
||||
attackTime = max(0.001f, attackTime);
|
||||
attackTime = std::max(0.001f, attackTime);
|
||||
float attackFrames = attackTime * sampleRate;
|
||||
|
||||
// Release parameters.
|
||||
|
@ -337,8 +335,8 @@ void DynamicsCompressorKernel::process(
|
|||
|
||||
// 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.
|
||||
|
@ -366,7 +364,7 @@ void DynamicsCompressorKernel::process(
|
|||
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);
|
||||
|
@ -415,7 +413,7 @@ void DynamicsCompressorKernel::process(
|
|||
|
||||
float attenuationDb =
|
||||
-WebAudioUtils::ConvertLinearToDecibels(attenuation, -1000.0f);
|
||||
attenuationDb = max(2.0f, attenuationDb);
|
||||
attenuationDb = std::max(2.0f, attenuationDb);
|
||||
|
||||
float dbPerFrame = attenuationDb / satReleaseFrames;
|
||||
|
||||
|
@ -426,7 +424,7 @@ void DynamicsCompressorKernel::process(
|
|||
float rate = isRelease ? satReleaseRate : 1;
|
||||
|
||||
detectorAverage += (attenuation - detectorAverage) * rate;
|
||||
detectorAverage = min(1.0f, detectorAverage);
|
||||
detectorAverage = std::min(1.0f, detectorAverage);
|
||||
|
||||
// Fix gremlins.
|
||||
if (IsNaN(detectorAverage)) detectorAverage = 1;
|
||||
|
@ -439,7 +437,7 @@ void DynamicsCompressorKernel::process(
|
|||
} 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
|
||||
|
|
|
@ -30,8 +30,6 @@
|
|||
|
||||
#include "HRTFElevation.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace WebCore {
|
||||
|
||||
const int HRTFDatabase::MinElevation = -45;
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
|
||||
#include "IRC_Composite_C_R0195-incl.cpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace mozilla;
|
||||
|
||||
namespace WebCore {
|
||||
|
@ -76,7 +75,7 @@ size_t HRTFElevation::fftSizeForSampleRate(float sampleRate) {
|
|||
unsigned resampledLength =
|
||||
floorf(ResponseFrameSize * sampleRate / rawSampleRate);
|
||||
// Keep things semi-sane, with max FFT size of 1024.
|
||||
unsigned size = min(resampledLength, 1023U);
|
||||
unsigned size = std::min(resampledLength, 1023U);
|
||||
// Ensure a minimum of 2 * WEBAUDIO_BLOCK_SIZE (with the size++ below) for
|
||||
// FFTConvolver and set the 8 least significant bits for rounding up to
|
||||
// the next power of 2 below.
|
||||
|
@ -242,7 +241,7 @@ nsReturnRef<HRTFElevation> HRTFElevation::createBuiltin(int elevation,
|
|||
for (unsigned rawIndex = 0; rawIndex < NumberOfRawAzimuths; ++rawIndex) {
|
||||
// Don't let elevation exceed maximum for this azimuth.
|
||||
int maxElevation = maxElevations[rawIndex];
|
||||
int actualElevation = min(elevation, maxElevation);
|
||||
int actualElevation = std::min(elevation, maxElevation);
|
||||
|
||||
kernelListL[interpolatedIndex] = calculateKernelForAzimuthElevation(
|
||||
rawIndex * AzimuthSpacing, actualElevation, resampler, sampleRate);
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
#include "HRTFDatabase.h"
|
||||
#include "AudioBlock.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace mozilla;
|
||||
using dom::ChannelInterpretation;
|
||||
|
||||
|
@ -111,8 +110,8 @@ int HRTFPanner::calculateDesiredAzimuthIndexAndBlend(double azimuth,
|
|||
// We don't immediately start using this azimuth index, but instead approach
|
||||
// this index from the last index we rendered at. This minimizes the clicks
|
||||
// and graininess for moving sources which occur otherwise.
|
||||
desiredAzimuthIndex = max(0, desiredAzimuthIndex);
|
||||
desiredAzimuthIndex = min(numberOfAzimuths - 1, desiredAzimuthIndex);
|
||||
desiredAzimuthIndex = std::max(0, desiredAzimuthIndex);
|
||||
desiredAzimuthIndex = std::min(numberOfAzimuths - 1, desiredAzimuthIndex);
|
||||
return desiredAzimuthIndex;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче