| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "platform/audio/IIRFilter.h" | 5 #include "platform/audio/IIRFilter.h" |
| 6 | 6 |
| 7 #include <complex> |
| 7 #include "wtf/MathExtras.h" | 8 #include "wtf/MathExtras.h" |
| 8 #include <complex> | |
| 9 | 9 |
| 10 namespace blink { | 10 namespace blink { |
| 11 | 11 |
| 12 // The length of the memory buffers for the IIR filter. This MUST be a power of | 12 // The length of the memory buffers for the IIR filter. This MUST be a power of |
| 13 // two and must be greater than the possible length of the filter coefficients. | 13 // two and must be greater than the possible length of the filter coefficients. |
| 14 const int kBufferLength = 32; | 14 const int kBufferLength = 32; |
| 15 static_assert(kBufferLength >= IIRFilter::kMaxOrder + 1, | 15 static_assert(kBufferLength >= IIRFilter::kMaxOrder + 1, |
| 16 "Internal IIR buffer length must be greater than maximum IIR " | 16 "Internal IIR buffer length must be greater than maximum IIR " |
| 17 "Filter order."); | 17 "Filter order."); |
| 18 | 18 |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 std::complex<double> denominator = | 132 std::complex<double> denominator = |
| 133 evaluatePolynomial(m_feedback->data(), zRecip, m_feedback->size() - 1); | 133 evaluatePolynomial(m_feedback->data(), zRecip, m_feedback->size() - 1); |
| 134 std::complex<double> response = numerator / denominator; | 134 std::complex<double> response = numerator / denominator; |
| 135 magResponse[k] = static_cast<float>(abs(response)); | 135 magResponse[k] = static_cast<float>(abs(response)); |
| 136 phaseResponse[k] = | 136 phaseResponse[k] = |
| 137 static_cast<float>(atan2(imag(response), real(response))); | 137 static_cast<float>(atan2(imag(response), real(response))); |
| 138 } | 138 } |
| 139 } | 139 } |
| 140 | 140 |
| 141 } // namespace blink | 141 } // namespace blink |
| OLD | NEW |