Title: [267444] trunk
Revision
267444
Author
[email protected]
Date
2020-09-22 15:54:43 -0700 (Tue, 22 Sep 2020)

Log Message

Fix BiquadFilterNode's lowpass & highpass filters
https://bugs.webkit.org/show_bug.cgi?id=216852

Reviewed by Eric Carlson.

Source/WebCore:

Fix BiquadFilterNode's lowpass & highpass filters. They incorrectly clamp the
resonance to make it positive.

Formulas for the filters are specified here:
- https://www.w3.org/TR/webaudio/#filters-characteristics

No new tests, rebaselined existing tests.

* platform/audio/Biquad.cpp:
(WebCore::pow10):
(WebCore::Biquad::setLowpassParams):
(WebCore::Biquad::setHighpassParams):

LayoutTests:

Rebaseline tests that are now passing.

* webaudio/BiquadFilter/tail-time-highpass-expected.txt:
* webaudio/BiquadFilter/tail-time-lowpass-expected.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (267443 => 267444)


--- trunk/LayoutTests/ChangeLog	2020-09-22 22:52:42 UTC (rev 267443)
+++ trunk/LayoutTests/ChangeLog	2020-09-22 22:54:43 UTC (rev 267444)
@@ -1,5 +1,17 @@
 2020-09-22  Chris Dumez  <[email protected]>
 
+        Fix BiquadFilterNode's lowpass & highpass filters
+        https://bugs.webkit.org/show_bug.cgi?id=216852
+
+        Reviewed by Eric Carlson.
+
+        Rebaseline tests that are now passing.
+
+        * webaudio/BiquadFilter/tail-time-highpass-expected.txt:
+        * webaudio/BiquadFilter/tail-time-lowpass-expected.txt:
+
+2020-09-22  Chris Dumez  <[email protected]>
+
         Merge AudioBufferSourceNode loop fixes from Blink
         https://bugs.webkit.org/show_bug.cgi?id=216849
 

Modified: trunk/LayoutTests/webaudio/BiquadFilter/tail-time-highpass-expected.txt (267443 => 267444)


--- trunk/LayoutTests/webaudio/BiquadFilter/tail-time-highpass-expected.txt	2020-09-22 22:52:42 UTC (rev 267443)
+++ trunk/LayoutTests/webaudio/BiquadFilter/tail-time-highpass-expected.txt	2020-09-22 22:54:43 UTC (rev 267444)
@@ -27,22 +27,22 @@
 PASS   HPF complex roots: Biquad({"type":"highpass","Q":40,"frequency":4096}): output[2432:] equals [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0...] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0}. 
 PASS < [hpf-complex-roots] All assertions passed. (total 19 assertions) 
 PASS > [hpf-real-distinct-roots] real distinct roots 
-FAIL X HPF real distinct roots: Biquad({"type":"highpass","Q":-50,"frequency":2048}): Actual Tail Frame 236 is not greater than or equal to 408. Got 236. assert_true: expected true got false
+PASS   HPF real distinct roots: Biquad({"type":"highpass","Q":-50,"frequency":2048}): Actual Tail Frame 2560 is greater than or equal to 408. 
 PASS   HPF real distinct roots: Biquad({"type":"highpass","Q":-50,"frequency":2048}): output[0:127] is not constantly 0 (contains 128 different values). 
-PASS   HPF real distinct roots: Biquad({"type":"highpass","Q":-50,"frequency":2048}): output[128:255] is not constantly 0 (contains 107 different values). 
-FAIL X HPF real distinct roots: Biquad({"type":"highpass","Q":-50,"frequency":2048}): output[256:383] should have contain at least one value different from 0. assert_true: expected true got false
-FAIL X HPF real distinct roots: Biquad({"type":"highpass","Q":-50,"frequency":2048}): output[384:511] should have contain at least one value different from 0. assert_true: expected true got false
+PASS   HPF real distinct roots: Biquad({"type":"highpass","Q":-50,"frequency":2048}): output[128:255] is not constantly 0 (contains 128 different values). 
+PASS   HPF real distinct roots: Biquad({"type":"highpass","Q":-50,"frequency":2048}): output[256:383] is not constantly 0 (contains 128 different values). 
+PASS   HPF real distinct roots: Biquad({"type":"highpass","Q":-50,"frequency":2048}): output[384:511] is not constantly 0 (contains 128 different values). 
 PASS   HPF real distinct roots: Biquad({"type":"highpass","Q":-50,"frequency":2048}): output[768:] equals [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0...] with an element-wise tolerance of {"absoluteThreshold":0.000030517578125,"relativeThreshold":0}. 
-FAIL < [hpf-real-distinct-roots] 3 out of 6 assertions were failed. assert_true: expected true got false
+PASS < [hpf-real-distinct-roots] All assertions passed. (total 6 assertions) 
 PASS > [hpf-repeated-root] repeated real root 
-PASS   HPF repeated roots (approximately): Biquad({"type":"highpass","Q":-6.020599913279624,"frequency":4096}): Actual Tail Frame 160 is greater than or equal to 3. 
-PASS   HPF repeated roots (approximately): Biquad({"type":"highpass","Q":-6.020599913279624,"frequency":4096}): output[0:127] is not constantly 0 (contains 128 different values). 
+PASS   HPF repeated roots (approximately): Biquad({"type":"highpass","Q":-6.020599913279624,"frequency":4096}): Actual Tail Frame 11 is greater than or equal to 3. 
+PASS   HPF repeated roots (approximately): Biquad({"type":"highpass","Q":-6.020599913279624,"frequency":4096}): output[0:127] is not constantly 0 (contains 11 different values). 
 PASS   HPF repeated roots (approximately): Biquad({"type":"highpass","Q":-6.020599913279624,"frequency":4096}): output[384:] equals [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0...] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0}. 
 PASS < [hpf-repeated-root] All assertions passed. (total 3 assertions) 
 PASS > [hpf-real-roots-2] complex roots 
-PASS   HPF repeated roots 2: Biquad({"type":"highpass","Q":-100,"frequency":4096}): Actual Tail Frame 160 is greater than or equal to 0. 
+PASS   HPF repeated roots 2: Biquad({"type":"highpass","Q":-100,"frequency":4096}): Actual Tail Frame 256 is greater than or equal to 0. 
 PASS   HPF repeated roots 2: Biquad({"type":"highpass","Q":-100,"frequency":4096}): output[0:127] is not constantly 0 (contains 128 different values). 
 PASS   HPF repeated roots 2: Biquad({"type":"highpass","Q":-100,"frequency":4096}): output[384:] equals [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0...] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0}. 
 PASS < [hpf-real-roots-2] All assertions passed. (total 3 assertions) 
-FAIL # AUDIT TASK RUNNER FINISHED: 1 out of 4 tasks were failed. assert_true: expected true got false
+PASS # AUDIT TASK RUNNER FINISHED: 4 tasks ran successfully. 
 

Modified: trunk/LayoutTests/webaudio/BiquadFilter/tail-time-lowpass-expected.txt (267443 => 267444)


--- trunk/LayoutTests/webaudio/BiquadFilter/tail-time-lowpass-expected.txt	2020-09-22 22:52:42 UTC (rev 267443)
+++ trunk/LayoutTests/webaudio/BiquadFilter/tail-time-lowpass-expected.txt	2020-09-22 22:54:43 UTC (rev 267444)
@@ -29,30 +29,30 @@
 PASS   LPF complex roots: Biquad({"type":"lowpass","Q":40,"frequency":4096}): output[2432:] equals [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0...] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0}. 
 PASS < [lpf-complex-roots] All assertions passed. (total 19 assertions) 
 PASS > [lpf-real-distinct-roots] real distinct roots 
-FAIL X LPF real distinct roots: Biquad({"type":"lowpass","Q":-50,"frequency":2048}): Actual Tail Frame 236 is not greater than or equal to 1700. Got 236. assert_true: expected true got false
+PASS   LPF real distinct roots: Biquad({"type":"lowpass","Q":-50,"frequency":2048}): Actual Tail Frame 1920 is greater than or equal to 1700. 
 PASS   LPF real distinct roots: Biquad({"type":"lowpass","Q":-50,"frequency":2048}): output[0:127] is not constantly 0 (contains 128 different values). 
-PASS   LPF real distinct roots: Biquad({"type":"lowpass","Q":-50,"frequency":2048}): output[128:255] is not constantly 0 (contains 106 different values). 
-FAIL X LPF real distinct roots: Biquad({"type":"lowpass","Q":-50,"frequency":2048}): output[256:383] should have contain at least one value different from 0. assert_true: expected true got false
-FAIL X LPF real distinct roots: Biquad({"type":"lowpass","Q":-50,"frequency":2048}): output[384:511] should have contain at least one value different from 0. assert_true: expected true got false
-FAIL X LPF real distinct roots: Biquad({"type":"lowpass","Q":-50,"frequency":2048}): output[512:639] should have contain at least one value different from 0. assert_true: expected true got false
-FAIL X LPF real distinct roots: Biquad({"type":"lowpass","Q":-50,"frequency":2048}): output[640:767] should have contain at least one value different from 0. assert_true: expected true got false
-FAIL X LPF real distinct roots: Biquad({"type":"lowpass","Q":-50,"frequency":2048}): output[768:895] should have contain at least one value different from 0. assert_true: expected true got false
-FAIL X LPF real distinct roots: Biquad({"type":"lowpass","Q":-50,"frequency":2048}): output[896:1023] should have contain at least one value different from 0. assert_true: expected true got false
-FAIL X LPF real distinct roots: Biquad({"type":"lowpass","Q":-50,"frequency":2048}): output[1024:1151] should have contain at least one value different from 0. assert_true: expected true got false
-FAIL X LPF real distinct roots: Biquad({"type":"lowpass","Q":-50,"frequency":2048}): output[1152:1279] should have contain at least one value different from 0. assert_true: expected true got false
-FAIL X LPF real distinct roots: Biquad({"type":"lowpass","Q":-50,"frequency":2048}): output[1280:1407] should have contain at least one value different from 0. assert_true: expected true got false
-FAIL X LPF real distinct roots: Biquad({"type":"lowpass","Q":-50,"frequency":2048}): output[1408:1535] should have contain at least one value different from 0. assert_true: expected true got false
-FAIL X LPF real distinct roots: Biquad({"type":"lowpass","Q":-50,"frequency":2048}): output[1536:1663] should have contain at least one value different from 0. assert_true: expected true got false
-FAIL X LPF real distinct roots: Biquad({"type":"lowpass","Q":-50,"frequency":2048}): output[1664:1791] should have contain at least one value different from 0. assert_true: expected true got false
+PASS   LPF real distinct roots: Biquad({"type":"lowpass","Q":-50,"frequency":2048}): output[128:255] is not constantly 0 (contains 128 different values). 
+PASS   LPF real distinct roots: Biquad({"type":"lowpass","Q":-50,"frequency":2048}): output[256:383] is not constantly 0 (contains 128 different values). 
+PASS   LPF real distinct roots: Biquad({"type":"lowpass","Q":-50,"frequency":2048}): output[384:511] is not constantly 0 (contains 128 different values). 
+PASS   LPF real distinct roots: Biquad({"type":"lowpass","Q":-50,"frequency":2048}): output[512:639] is not constantly 0 (contains 128 different values). 
+PASS   LPF real distinct roots: Biquad({"type":"lowpass","Q":-50,"frequency":2048}): output[640:767] is not constantly 0 (contains 128 different values). 
+PASS   LPF real distinct roots: Biquad({"type":"lowpass","Q":-50,"frequency":2048}): output[768:895] is not constantly 0 (contains 128 different values). 
+PASS   LPF real distinct roots: Biquad({"type":"lowpass","Q":-50,"frequency":2048}): output[896:1023] is not constantly 0 (contains 128 different values). 
+PASS   LPF real distinct roots: Biquad({"type":"lowpass","Q":-50,"frequency":2048}): output[1024:1151] is not constantly 0 (contains 128 different values). 
+PASS   LPF real distinct roots: Biquad({"type":"lowpass","Q":-50,"frequency":2048}): output[1152:1279] is not constantly 0 (contains 128 different values). 
+PASS   LPF real distinct roots: Biquad({"type":"lowpass","Q":-50,"frequency":2048}): output[1280:1407] is not constantly 0 (contains 128 different values). 
+PASS   LPF real distinct roots: Biquad({"type":"lowpass","Q":-50,"frequency":2048}): output[1408:1535] is not constantly 0 (contains 128 different values). 
+PASS   LPF real distinct roots: Biquad({"type":"lowpass","Q":-50,"frequency":2048}): output[1536:1663] is not constantly 0 (contains 128 different values). 
+PASS   LPF real distinct roots: Biquad({"type":"lowpass","Q":-50,"frequency":2048}): output[1664:1791] is not constantly 0 (contains 128 different values). 
 PASS   LPF real distinct roots: Biquad({"type":"lowpass","Q":-50,"frequency":2048}): output[2048:] equals [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0...] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0}. 
-FAIL < [lpf-real-distinct-roots] 13 out of 16 assertions were failed. assert_true: expected true got false
+PASS < [lpf-real-distinct-roots] All assertions passed. (total 16 assertions) 
 PASS > [lpf-repeated-root] repeated real root 
-PASS   LPF repeated roots (approximately): Biquad({"type":"lowpass","Q":-6.020599913279624,"frequency":4096}): Actual Tail Frame 160 is greater than or equal to 3. 
-PASS   LPF repeated roots (approximately): Biquad({"type":"lowpass","Q":-6.020599913279624,"frequency":4096}): output[0:127] is not constantly 0 (contains 128 different values). 
+PASS   LPF repeated roots (approximately): Biquad({"type":"lowpass","Q":-6.020599913279624,"frequency":4096}): Actual Tail Frame 11 is greater than or equal to 3. 
+PASS   LPF repeated roots (approximately): Biquad({"type":"lowpass","Q":-6.020599913279624,"frequency":4096}): output[0:127] is not constantly 0 (contains 11 different values). 
 PASS   LPF repeated roots (approximately): Biquad({"type":"lowpass","Q":-6.020599913279624,"frequency":4096}): output[384:] equals [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0...] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0}. 
 PASS < [lpf-repeated-root] All assertions passed. (total 3 assertions) 
 PASS > [lpf-real-roots-2] complex roots 
-PASS   LPF repeated roots 2: Biquad({"type":"lowpass","Q":-100,"frequency":4096}): Actual Tail Frame 160 is greater than or equal to 0. 
+PASS   LPF repeated roots 2: Biquad({"type":"lowpass","Q":-100,"frequency":4096}): Actual Tail Frame 256 is greater than or equal to 0. 
 PASS   LPF repeated roots 2: Biquad({"type":"lowpass","Q":-100,"frequency":4096}): output[0:127] is not constantly 0 (contains 128 different values). 
 PASS   LPF repeated roots 2: Biquad({"type":"lowpass","Q":-100,"frequency":4096}): output[384:] equals [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0...] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0}. 
 PASS < [lpf-real-roots-2] All assertions passed. (total 3 assertions) 
@@ -774,5 +774,5 @@
 PASS   LPF repeated roots (approximately): Biquad({"type":"lowpass","Q":500,"frequency":100}): output[640:767] is not constantly 0 (contains 110 different values). 
 PASS   LPF repeated roots (approximately): Biquad({"type":"lowpass","Q":500,"frequency":100}): output[1024:] equals [] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0}. 
 PASS < [ginormous tail] All assertions passed. (total 8 assertions) 
-FAIL # AUDIT TASK RUNNER FINISHED: 1 out of 6 tasks were failed. assert_true: expected true got false
+PASS # AUDIT TASK RUNNER FINISHED: 6 tasks ran successfully. 
 

Modified: trunk/Source/WebCore/ChangeLog (267443 => 267444)


--- trunk/Source/WebCore/ChangeLog	2020-09-22 22:52:42 UTC (rev 267443)
+++ trunk/Source/WebCore/ChangeLog	2020-09-22 22:54:43 UTC (rev 267444)
@@ -1,5 +1,25 @@
 2020-09-22  Chris Dumez  <[email protected]>
 
+        Fix BiquadFilterNode's lowpass & highpass filters
+        https://bugs.webkit.org/show_bug.cgi?id=216852
+
+        Reviewed by Eric Carlson.
+
+        Fix BiquadFilterNode's lowpass & highpass filters. They incorrectly clamp the
+        resonance to make it positive.
+
+        Formulas for the filters are specified here:
+        - https://www.w3.org/TR/webaudio/#filters-characteristics
+
+        No new tests, rebaselined existing tests.
+
+        * platform/audio/Biquad.cpp:
+        (WebCore::pow10):
+        (WebCore::Biquad::setLowpassParams):
+        (WebCore::Biquad::setHighpassParams):
+
+2020-09-22  Chris Dumez  <[email protected]>
+
         Merge AudioBufferSourceNode loop fixes from Blink
         https://bugs.webkit.org/show_bug.cgi?id=216849
 

Modified: trunk/Source/WebCore/platform/audio/Biquad.cpp (267443 => 267444)


--- trunk/Source/WebCore/platform/audio/Biquad.cpp	2020-09-22 22:52:42 UTC (rev 267443)
+++ trunk/Source/WebCore/platform/audio/Biquad.cpp	2020-09-22 22:54:43 UTC (rev 267444)
@@ -271,7 +271,6 @@
         setNormalizedCoefficients(index, 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
         resonance = pow(10.0, 0.05 * resonance);
 
         double theta = piDouble * cutoff;
@@ -305,7 +304,6 @@
         setNormalizedCoefficients(index, 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
         resonance = pow(10.0, 0.05 * resonance);
 
         double theta = piDouble * cutoff;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to