⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 267444 in webkit


Ignore:
Timestamp:
Sep 22, 2020, 3:54:43 PM (6 years ago)
Author:
Chris Dumez
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:

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:
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r267443 r267444  
     12020-09-22  Chris Dumez  <cdumez@apple.com>
     2
     3        Fix BiquadFilterNode's lowpass & highpass filters
     4        https://bugs.webkit.org/show_bug.cgi?id=216852
     5
     6        Reviewed by Eric Carlson.
     7
     8        Rebaseline tests that are now passing.
     9
     10        * webaudio/BiquadFilter/tail-time-highpass-expected.txt:
     11        * webaudio/BiquadFilter/tail-time-lowpass-expected.txt:
     12
    1132020-09-22  Chris Dumez  <cdumez@apple.com>
    214
  • trunk/LayoutTests/webaudio/BiquadFilter/tail-time-highpass-expected.txt

    r267307 r267444  
    2828PASS < [hpf-complex-roots] All assertions passed. (total 19 assertions)
    2929PASS > [hpf-real-distinct-roots] real distinct roots
    30 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
     30PASS   HPF real distinct roots: Biquad({"type":"highpass","Q":-50,"frequency":2048}): Actual Tail Frame 2560 is greater than or equal to 408.
    3131PASS   HPF real distinct roots: Biquad({"type":"highpass","Q":-50,"frequency":2048}): output[0:127] is not constantly 0 (contains 128 different values).
    32 PASS   HPF real distinct roots: Biquad({"type":"highpass","Q":-50,"frequency":2048}): output[128:255] is not constantly 0 (contains 107 different values).
    33 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
    34 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
     32PASS   HPF real distinct roots: Biquad({"type":"highpass","Q":-50,"frequency":2048}): output[128:255] is not constantly 0 (contains 128 different values).
     33PASS   HPF real distinct roots: Biquad({"type":"highpass","Q":-50,"frequency":2048}): output[256:383] is not constantly 0 (contains 128 different values).
     34PASS   HPF real distinct roots: Biquad({"type":"highpass","Q":-50,"frequency":2048}): output[384:511] is not constantly 0 (contains 128 different values).
    3535PASS   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}.
    36 FAIL < [hpf-real-distinct-roots] 3 out of 6 assertions were failed. assert_true: expected true got false
     36PASS < [hpf-real-distinct-roots] All assertions passed. (total 6 assertions)
    3737PASS > [hpf-repeated-root] repeated real root
    38 PASS   HPF repeated roots (approximately): Biquad({"type":"highpass","Q":-6.020599913279624,"frequency":4096}): Actual Tail Frame 160 is greater than or equal to 3.
    39 PASS   HPF repeated roots (approximately): Biquad({"type":"highpass","Q":-6.020599913279624,"frequency":4096}): output[0:127] is not constantly 0 (contains 128 different values).
     38PASS   HPF repeated roots (approximately): Biquad({"type":"highpass","Q":-6.020599913279624,"frequency":4096}): Actual Tail Frame 11 is greater than or equal to 3.
     39PASS   HPF repeated roots (approximately): Biquad({"type":"highpass","Q":-6.020599913279624,"frequency":4096}): output[0:127] is not constantly 0 (contains 11 different values).
    4040PASS   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}.
    4141PASS < [hpf-repeated-root] All assertions passed. (total 3 assertions)
    4242PASS > [hpf-real-roots-2] complex roots
    43 PASS   HPF repeated roots 2: Biquad({"type":"highpass","Q":-100,"frequency":4096}): Actual Tail Frame 160 is greater than or equal to 0.
     43PASS   HPF repeated roots 2: Biquad({"type":"highpass","Q":-100,"frequency":4096}): Actual Tail Frame 256 is greater than or equal to 0.
    4444PASS   HPF repeated roots 2: Biquad({"type":"highpass","Q":-100,"frequency":4096}): output[0:127] is not constantly 0 (contains 128 different values).
    4545PASS   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}.
    4646PASS < [hpf-real-roots-2] All assertions passed. (total 3 assertions)
    47 FAIL # AUDIT TASK RUNNER FINISHED: 1 out of 4 tasks were failed. assert_true: expected true got false
     47PASS # AUDIT TASK RUNNER FINISHED: 4 tasks ran successfully.
    4848
  • trunk/LayoutTests/webaudio/BiquadFilter/tail-time-lowpass-expected.txt

    r267307 r267444  
    3030PASS < [lpf-complex-roots] All assertions passed. (total 19 assertions)
    3131PASS > [lpf-real-distinct-roots] real distinct roots
    32 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
     32PASS   LPF real distinct roots: Biquad({"type":"lowpass","Q":-50,"frequency":2048}): Actual Tail Frame 1920 is greater than or equal to 1700.
    3333PASS   LPF real distinct roots: Biquad({"type":"lowpass","Q":-50,"frequency":2048}): output[0:127] is not constantly 0 (contains 128 different values).
    34 PASS   LPF real distinct roots: Biquad({"type":"lowpass","Q":-50,"frequency":2048}): output[128:255] is not constantly 0 (contains 106 different values).
    35 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
    36 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
    37 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
    38 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
    39 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
    40 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
    41 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
    42 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
    43 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
    44 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
    45 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
    46 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
     34PASS   LPF real distinct roots: Biquad({"type":"lowpass","Q":-50,"frequency":2048}): output[128:255] is not constantly 0 (contains 128 different values).
     35PASS   LPF real distinct roots: Biquad({"type":"lowpass","Q":-50,"frequency":2048}): output[256:383] is not constantly 0 (contains 128 different values).
     36PASS   LPF real distinct roots: Biquad({"type":"lowpass","Q":-50,"frequency":2048}): output[384:511] is not constantly 0 (contains 128 different values).
     37PASS   LPF real distinct roots: Biquad({"type":"lowpass","Q":-50,"frequency":2048}): output[512:639] is not constantly 0 (contains 128 different values).
     38PASS   LPF real distinct roots: Biquad({"type":"lowpass","Q":-50,"frequency":2048}): output[640:767] is not constantly 0 (contains 128 different values).
     39PASS   LPF real distinct roots: Biquad({"type":"lowpass","Q":-50,"frequency":2048}): output[768:895] is not constantly 0 (contains 128 different values).
     40PASS   LPF real distinct roots: Biquad({"type":"lowpass","Q":-50,"frequency":2048}): output[896:1023] is not constantly 0 (contains 128 different values).
     41PASS   LPF real distinct roots: Biquad({"type":"lowpass","Q":-50,"frequency":2048}): output[1024:1151] is not constantly 0 (contains 128 different values).
     42PASS   LPF real distinct roots: Biquad({"type":"lowpass","Q":-50,"frequency":2048}): output[1152:1279] is not constantly 0 (contains 128 different values).
     43PASS   LPF real distinct roots: Biquad({"type":"lowpass","Q":-50,"frequency":2048}): output[1280:1407] is not constantly 0 (contains 128 different values).
     44PASS   LPF real distinct roots: Biquad({"type":"lowpass","Q":-50,"frequency":2048}): output[1408:1535] is not constantly 0 (contains 128 different values).
     45PASS   LPF real distinct roots: Biquad({"type":"lowpass","Q":-50,"frequency":2048}): output[1536:1663] is not constantly 0 (contains 128 different values).
     46PASS   LPF real distinct roots: Biquad({"type":"lowpass","Q":-50,"frequency":2048}): output[1664:1791] is not constantly 0 (contains 128 different values).
    4747PASS   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}.
    48 FAIL < [lpf-real-distinct-roots] 13 out of 16 assertions were failed. assert_true: expected true got false
     48PASS < [lpf-real-distinct-roots] All assertions passed. (total 16 assertions)
    4949PASS > [lpf-repeated-root] repeated real root
    50 PASS   LPF repeated roots (approximately): Biquad({"type":"lowpass","Q":-6.020599913279624,"frequency":4096}): Actual Tail Frame 160 is greater than or equal to 3.
    51 PASS   LPF repeated roots (approximately): Biquad({"type":"lowpass","Q":-6.020599913279624,"frequency":4096}): output[0:127] is not constantly 0 (contains 128 different values).
     50PASS   LPF repeated roots (approximately): Biquad({"type":"lowpass","Q":-6.020599913279624,"frequency":4096}): Actual Tail Frame 11 is greater than or equal to 3.
     51PASS   LPF repeated roots (approximately): Biquad({"type":"lowpass","Q":-6.020599913279624,"frequency":4096}): output[0:127] is not constantly 0 (contains 11 different values).
    5252PASS   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}.
    5353PASS < [lpf-repeated-root] All assertions passed. (total 3 assertions)
    5454PASS > [lpf-real-roots-2] complex roots
    55 PASS   LPF repeated roots 2: Biquad({"type":"lowpass","Q":-100,"frequency":4096}): Actual Tail Frame 160 is greater than or equal to 0.
     55PASS   LPF repeated roots 2: Biquad({"type":"lowpass","Q":-100,"frequency":4096}): Actual Tail Frame 256 is greater than or equal to 0.
    5656PASS   LPF repeated roots 2: Biquad({"type":"lowpass","Q":-100,"frequency":4096}): output[0:127] is not constantly 0 (contains 128 different values).
    5757PASS   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}.
     
    775775PASS   LPF repeated roots (approximately): Biquad({"type":"lowpass","Q":500,"frequency":100}): output[1024:] equals [] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0}.
    776776PASS < [ginormous tail] All assertions passed. (total 8 assertions)
    777 FAIL # AUDIT TASK RUNNER FINISHED: 1 out of 6 tasks were failed. assert_true: expected true got false
     777PASS # AUDIT TASK RUNNER FINISHED: 6 tasks ran successfully.
    778778
  • trunk/Source/WebCore/ChangeLog

    r267443 r267444  
     12020-09-22  Chris Dumez  <cdumez@apple.com>
     2
     3        Fix BiquadFilterNode's lowpass & highpass filters
     4        https://bugs.webkit.org/show_bug.cgi?id=216852
     5
     6        Reviewed by Eric Carlson.
     7
     8        Fix BiquadFilterNode's lowpass & highpass filters. They incorrectly clamp the
     9        resonance to make it positive.
     10
     11        Formulas for the filters are specified here:
     12        - https://www.w3.org/TR/webaudio/#filters-characteristics
     13
     14        No new tests, rebaselined existing tests.
     15
     16        * platform/audio/Biquad.cpp:
     17        (WebCore::pow10):
     18        (WebCore::Biquad::setLowpassParams):
     19        (WebCore::Biquad::setHighpassParams):
     20
    1212020-09-22  Chris Dumez  <cdumez@apple.com>
    222
  • trunk/Source/WebCore/platform/audio/Biquad.cpp

    r266541 r267444  
    272272    } else if (cutoff > 0) {
    273273        // Compute biquad coefficients for lowpass filter
    274         resonance = std::max(0.0, resonance); // can't go negative
    275274        resonance = pow(10.0, 0.05 * resonance);
    276275
     
    306305    } else if (cutoff > 0) {
    307306        // Compute biquad coefficients for highpass filter
    308         resonance = std::max(0.0, resonance); // can't go negative
    309307        resonance = pow(10.0, 0.05 * resonance);
    310308
Note: See TracChangeset for help on using the changeset viewer.