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

Unified Diff: Source/platform/audio/FFTFrame.cpp

Issue 170453004: Add constant twoPiDouble/twoPiFloat to MathExtras.h (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: add constant values to header Created 6 years, 10 months 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
« no previous file with comments | « Source/platform/audio/EqualPowerPanner.cpp ('k') | Source/platform/audio/SincResampler.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/audio/FFTFrame.cpp
diff --git a/Source/platform/audio/FFTFrame.cpp b/Source/platform/audio/FFTFrame.cpp
index e7e51c354f7a8743e4039e531a942762f13e3277..58df785fbd2f3cb7da97c2625d5ba5c05b34e670 100644
--- a/Source/platform/audio/FFTFrame.cpp
+++ b/Source/platform/audio/FFTFrame.cpp
@@ -151,21 +151,21 @@ void FFTFrame::interpolateFrequencyComponents(const FFTFrame& frame1, const FFTF
// Unwrap phase deltas
if (deltaPhase1 > piDouble)
- deltaPhase1 -= 2.0 * piDouble;
+ deltaPhase1 -= twoPiDouble;
if (deltaPhase1 < -piDouble)
- deltaPhase1 += 2.0 * piDouble;
+ deltaPhase1 += twoPiDouble;
if (deltaPhase2 > piDouble)
- deltaPhase2 -= 2.0 * piDouble;
+ deltaPhase2 -= twoPiDouble;
if (deltaPhase2 < -piDouble)
- deltaPhase2 += 2.0 * piDouble;
+ deltaPhase2 += twoPiDouble;
// Blend group-delays
double deltaPhaseBlend;
if (deltaPhase1 - deltaPhase2 > piDouble)
- deltaPhaseBlend = s1 * deltaPhase1 + s2 * (2.0 * piDouble + deltaPhase2);
+ deltaPhaseBlend = s1 * deltaPhase1 + s2 * (twoPiDouble + deltaPhase2);
else if (deltaPhase2 - deltaPhase1 > piDouble)
- deltaPhaseBlend = s1 * (2.0 * piDouble + deltaPhase1) + s2 * deltaPhase2;
+ deltaPhaseBlend = s1 * (twoPiDouble + deltaPhase1) + s2 * deltaPhase2;
else
deltaPhaseBlend = s1 * deltaPhase1 + s2 * deltaPhase2;
@@ -173,9 +173,9 @@ void FFTFrame::interpolateFrequencyComponents(const FFTFrame& frame1, const FFTF
// Unwrap
if (phaseAccum > piDouble)
- phaseAccum -= 2.0 * piDouble;
+ phaseAccum -= twoPiDouble;
if (phaseAccum < -piDouble)
- phaseAccum += 2.0 * piDouble;
+ phaseAccum += twoPiDouble;
Complex c = complexFromMagnitudePhase(mag, phaseAccum);
@@ -195,7 +195,7 @@ double FFTFrame::extractAverageGroupDelay()
int halfSize = fftSize() / 2;
- const double kSamplePhaseDelay = (2.0 * piDouble) / double(fftSize());
+ const double kSamplePhaseDelay = (twoPiDouble) / double(fftSize());
// Calculate weighted average group delay
for (int i = 0; i < halfSize; i++) {
@@ -208,9 +208,9 @@ double FFTFrame::extractAverageGroupDelay()
// Unwrap
if (deltaPhase < -piDouble)
- deltaPhase += 2.0 * piDouble;
+ deltaPhase += twoPiDouble;
if (deltaPhase > piDouble)
- deltaPhase -= 2.0 * piDouble;
+ deltaPhase -= twoPiDouble;
aveSum += mag * deltaPhase;
weightSum += mag;
@@ -240,7 +240,7 @@ void FFTFrame::addConstantGroupDelay(double sampleFrameDelay)
float* realP = realData();
float* imagP = imagData();
- const double kSamplePhaseDelay = (2.0 * piDouble) / double(fftSize());
+ const double kSamplePhaseDelay = (twoPiDouble) / double(fftSize());
double phaseAdj = -sampleFrameDelay * kSamplePhaseDelay;
« no previous file with comments | « Source/platform/audio/EqualPowerPanner.cpp ('k') | Source/platform/audio/SincResampler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698