Bug 1499597 - Don't clamp the Q of a BiquadFilterNode when in low-pass and high-pass mode. r=karlt
authorPaul Adenot <paul@paul.cx>
Fri, 18 Oct 2019 01:52:39 +0000
changeset 559466 6ecf31593df4637e62d0e053fe9ce1d8885258b2
parent 559465 bd3e04ade52aa7a1cd9847672cc91633154f3961
child 559467 f809ef4ac99402dbd3a4128687abe2cd5b18cf28
push id12177
push usercsabou@mozilla.com
push dateMon, 21 Oct 2019 14:52:16 +0000
treeherdermozilla-beta@1918a9cd33bc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskarlt
bugs1499597, 1265395
milestone71.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1499597 - Don't clamp the Q of a BiquadFilterNode when in low-pass and high-pass mode. r=karlt Bug 1265395 implemented the new filter equations from https://github.com/webaudio/web-audio-api/commit/a6842f2f733911a8ac6b330a405eac19878adc15, but missed removing the clamping. Differential Revision: https://phabricator.services.mozilla.com/D49600
dom/media/webaudio/blink/Biquad.cpp
--- a/dom/media/webaudio/blink/Biquad.cpp
+++ b/dom/media/webaudio/blink/Biquad.cpp
@@ -99,17 +99,16 @@ void Biquad::setLowpassParams(double cut
   // Limit cutoff to 0 to 1.
   cutoff = std::max(0.0, std::min(cutoff, 1.0));
 
   if (cutoff == 1) {
     // When cutoff is 1, the z-transform is 1.
     setNormalizedCoefficients(1, 0, 0, 1, 0, 0);
   } else if (cutoff > 0) {
     // Compute biquad coefficients for lowpass filter
-    resonance = std::max(0.0, resonance);  // can't go negative
     double g = pow(10.0, -0.05 * resonance);
     double w0 = M_PI * cutoff;
     double cos_w0 = cos(w0);
     double alpha = 0.5 * sin(w0) * g;
 
     double b1 = 1.0 - cos_w0;
     double b0 = 0.5 * b1;
     double b2 = b0;
@@ -129,17 +128,16 @@ void Biquad::setHighpassParams(double cu
   // Limit cutoff to 0 to 1.
   cutoff = std::max(0.0, std::min(cutoff, 1.0));
 
   if (cutoff == 1) {
     // The z-transform is 0.
     setNormalizedCoefficients(0, 0, 0, 1, 0, 0);
   } else if (cutoff > 0) {
     // Compute biquad coefficients for highpass filter
-    resonance = std::max(0.0, resonance);  // can't go negative
     double g = pow(10.0, -0.05 * resonance);
     double w0 = M_PI * cutoff;
     double cos_w0 = cos(w0);
     double alpha = 0.5 * sin(w0) * g;
 
     double b1 = -1.0 - cos_w0;
     double b0 = -0.5 * b1;
     double b2 = b0;