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

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

Issue 801033003: remove WTF::Complex (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: remove WTF::Complex typedef Created 6 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
« no previous file with comments | « Source/platform/audio/Biquad.cpp ('k') | Source/wtf/Complex.h » ('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 f6de464d4bd85beb6b6d2570a308f38f91165547..e3890aa88250470945afe01e7e79490e62feaefa 100644
--- a/Source/platform/audio/FFTFrame.cpp
+++ b/Source/platform/audio/FFTFrame.cpp
@@ -34,10 +34,11 @@
#include "platform/audio/VectorMath.h"
#include "platform/Logging.h"
-#include "wtf/Complex.h"
#include "wtf/MathExtras.h"
#include "wtf/OwnPtr.h"
+#include <complex>
+
#ifndef NDEBUG
#include <stdio.h>
#endif
@@ -100,8 +101,8 @@ void FFTFrame::interpolateFrequencyComponents(const FFTFrame& frame1, const FFTF
int n = m_FFTSize / 2;
for (int i = 1; i < n; ++i) {
- Complex c1(realP1[i], imagP1[i]);
- Complex c2(realP2[i], imagP2[i]);
+ std::complex<double> c1(realP1[i], imagP1[i]);
+ std::complex<double> c2(realP2[i], imagP2[i]);
double mag1 = abs(c1);
double mag2 = abs(c2);
@@ -167,7 +168,7 @@ void FFTFrame::interpolateFrequencyComponents(const FFTFrame& frame1, const FFTF
if (phaseAccum < -piDouble)
phaseAccum += twoPiDouble;
- Complex c = complexFromMagnitudePhase(mag, phaseAccum);
+ std::complex<double> c = std::polar(mag, phaseAccum);
realP[i] = static_cast<float>(c.real());
imagP[i] = static_cast<float>(c.imag());
@@ -189,7 +190,7 @@ double FFTFrame::extractAverageGroupDelay()
// Calculate weighted average group delay
for (int i = 0; i < halfSize; i++) {
- Complex c(realP[i], imagP[i]);
+ std::complex<double> c(realP[i], imagP[i]);
double mag = abs(c);
double phase = arg(c);
@@ -236,13 +237,13 @@ void FFTFrame::addConstantGroupDelay(double sampleFrameDelay)
// Add constant group delay
for (int i = 1; i < halfSize; i++) {
- Complex c(realP[i], imagP[i]);
+ std::complex<double> c(realP[i], imagP[i]);
double mag = abs(c);
double phase = arg(c);
phase += i * phaseAdj;
- Complex c2 = complexFromMagnitudePhase(mag, phase);
+ std::complex<double> c2 = std::polar(mag, phase);
realP[i] = static_cast<float>(c2.real());
imagP[i] = static_cast<float>(c2.imag());
« no previous file with comments | « Source/platform/audio/Biquad.cpp ('k') | Source/wtf/Complex.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698