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

Unified Diff: third_party/WebKit/Source/modules/webaudio/IIRDSPKernel.cpp

Issue 2851873003: Compute the tail time for an IIRFilter from its coefficients (Closed)
Patch Set: Rebase Created 3 years, 7 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
Index: third_party/WebKit/Source/modules/webaudio/IIRDSPKernel.cpp
diff --git a/third_party/WebKit/Source/modules/webaudio/IIRDSPKernel.cpp b/third_party/WebKit/Source/modules/webaudio/IIRDSPKernel.cpp
index e3e38525c1180bde57f2924d1d8a47e2a44ee4cd..1a86b092464bdc402539a792804fda5a1390af41 100644
--- a/third_party/WebKit/Source/modules/webaudio/IIRDSPKernel.cpp
+++ b/third_party/WebKit/Source/modules/webaudio/IIRDSPKernel.cpp
@@ -8,6 +8,12 @@
namespace blink {
+IIRDSPKernel::IIRDSPKernel(IIRProcessor* processor)
+ : AudioDSPKernel(processor),
+ iir_(processor->Feedforward(), processor->Feedback()) {
+ tail_time_ = iir_.TailTime(processor->SampleRate());
+}
+
void IIRDSPKernel::Process(const float* source,
float* destination,
size_t frames_to_process) {
@@ -41,14 +47,7 @@ void IIRDSPKernel::GetFrequencyResponse(int n_frequencies,
}
double IIRDSPKernel::TailTime() const {
- // TODO(rtoy): This is true mathematically (infinite impulse response), but
- // perhaps it should be limited to a smaller value, possibly based on the
- // actual filter coefficients. To do that, we would probably need to find the
- // pole, r, with largest magnitude and select some threshold, eps, such that
- // |r|^n < eps for all n >= N. N is then the tailTime for the filter. If the
- // the magnitude of r is greater than or equal to 1, the infinity is the right
- // answer. (There is no constraint on the IIR filter that it be stable.)
- return std::numeric_limits<double>::infinity();
+ return tail_time_;
}
double IIRDSPKernel::LatencyTime() const {
« no previous file with comments | « third_party/WebKit/Source/modules/webaudio/IIRDSPKernel.h ('k') | third_party/WebKit/Source/platform/audio/IIRFilter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698