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

Unified Diff: Source/platform/audio/Biquad.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.h ('k') | Source/platform/audio/FFTFrame.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/audio/Biquad.cpp
diff --git a/Source/platform/audio/Biquad.cpp b/Source/platform/audio/Biquad.cpp
index 21df7745a9eb198b30491638b5b968fa59a220fb..e614c7c1b62b604727e02254a9f2105b8ef4f914 100644
--- a/Source/platform/audio/Biquad.cpp
+++ b/Source/platform/audio/Biquad.cpp
@@ -524,7 +524,7 @@ void Biquad::setBandpassParams(double frequency, double Q)
}
}
-void Biquad::setZeroPolePairs(const Complex &zero, const Complex &pole)
+void Biquad::setZeroPolePairs(const std::complex<double>&zero, const std::complex<double>&pole)
{
double b0 = 1;
double b1 = -2 * zero.real();
@@ -539,9 +539,9 @@ void Biquad::setZeroPolePairs(const Complex &zero, const Complex &pole)
setNormalizedCoefficients(b0, b1, b2, 1, a1, a2);
}
-void Biquad::setAllpassPole(const Complex &pole)
+void Biquad::setAllpassPole(const std::complex<double>&pole)
{
- Complex zero = Complex(1, 0) / pole;
+ std::complex<double> zero = std::complex<double>(1, 0) / pole;
setZeroPolePairs(zero, pole);
}
@@ -575,10 +575,11 @@ void Biquad::getFrequencyResponse(int nFrequencies,
for (int k = 0; k < nFrequencies; ++k) {
double omega = -piDouble * frequency[k];
- Complex z = Complex(cos(omega), sin(omega));
- Complex numerator = b0 + (b1 + b2 * z) * z;
- Complex denominator = Complex(1, 0) + (a1 + a2 * z) * z;
- Complex response = numerator / denominator;
+ std::complex<double> z = std::complex<double> (cos(omega), sin(omega));
+ std::complex<double> numerator = b0 + (b1 + b2 * z) * z;
+ std::complex<double> denominator =
+ std::complex<double>(1, 0) + (a1 + a2 * z) * z;
+ std::complex<double> response = numerator / denominator;
magResponse[k] = static_cast<float>(abs(response));
phaseResponse[k] = static_cast<float>(atan2(imag(response), real(response)));
}
« no previous file with comments | « Source/platform/audio/Biquad.h ('k') | Source/platform/audio/FFTFrame.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698