Bug 216183 - Improve interpolation algorithm in OscillatorNode
Summary: Improve interpolation algorithm in OscillatorNode
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Audio (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords: InRadar
Depends on:
Blocks: 212611
  Show dependency treegraph
 
Reported: 2020-09-04 09:35 PDT by Chris Dumez
Modified: 2020-09-04 12:19 PDT (History)
10 users (show)

See Also:


Attachments
Patch (30.33 KB, patch)
2020-09-04 09:50 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (37.98 KB, patch)
2020-09-04 10:11 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2020-09-04 09:35:44 PDT
Improve interpolation algorithm in OscillatorNode.
Comment 1 Chris Dumez 2020-09-04 09:50:41 PDT
Created attachment 407985 [details]
Patch
Comment 2 Chris Dumez 2020-09-04 10:11:28 PDT
Created attachment 407989 [details]
Patch
Comment 3 Geoffrey Garen 2020-09-04 11:21:41 PDT
Comment on attachment 407989 [details]
Patch

r=me
Comment 4 EWS 2020-09-04 11:54:43 PDT
Committed r266627: <https://trac.webkit.org/changeset/266627>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 407989 [details].
Comment 5 Radar WebKit Bug Importer 2020-09-04 11:55:16 PDT
<rdar://problem/68358295>
Comment 6 Eric Carlson 2020-09-04 12:08:02 PDT
Comment on attachment 407989 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=407989&action=review

> Source/WebCore/Modules/webaudio/OscillatorNode.cpp:210
> +    // Consider a typical sample rate of 44100 Hz and max periodic wave
> +    // size of 4096. The relationship between |incr| and the frequency
> +    // of the oscillator is |incr| = freq * 4096/44100. Or freq =
> +    // |incr|*44100/4096 = 10.8*|incr|.
> +    //
> +    // For the |incr| thresholds below, this means that we use linear
> +    // interpolation for all freq >= 3.2 Hz, 3-point Lagrange
> +    // for freq >= 1.7 Hz and 5-point Lagrange for every thing else.
> +    //
> +    // We use Lagrange interpolation because it's relatively simple to
> +    // implement and fairly inexpensive, and the interpolator always
> +    // passes through known points.

You should note somewhere that this is based on code in Chrome's oscillator_node.cc
Comment 7 Chris Dumez 2020-09-04 12:09:00 PDT
Comment on attachment 407989 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=407989&action=review

>> Source/WebCore/Modules/webaudio/OscillatorNode.cpp:210
>> +    // passes through known points.
> 
> You should note somewhere that this is based on code in Chrome's oscillator_node.cc

I said in the Changelog: "Align our OscillatorNode implementation with Chromium". How to you suggest I do better?
Comment 8 Eric Carlson 2020-09-04 12:15:37 PDT
Comment on attachment 407989 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=407989&action=review

>>> Source/WebCore/Modules/webaudio/OscillatorNode.cpp:210
>>> +    // passes through known points.
>> 
>> You should note somewhere that this is based on code in Chrome's oscillator_node.cc
> 
> I said in the Changelog: "Align our OscillatorNode implementation with Chromium". How to you suggest I do better?

Some of you other patches have said something like "cherry picked from Chrome ...", but the ChangeLog comment is fine too.
Comment 9 Chris Dumez 2020-09-04 12:19:39 PDT
(In reply to Eric Carlson from comment #8)
> Comment on attachment 407989 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=407989&action=review
> 
> >>> Source/WebCore/Modules/webaudio/OscillatorNode.cpp:210
> >>> +    // passes through known points.
> >> 
> >> You should note somewhere that this is based on code in Chrome's oscillator_node.cc
> > 
> > I said in the Changelog: "Align our OscillatorNode implementation with Chromium". How to you suggest I do better?
> 
> Some of you other patches have said something like "cherry picked from
> Chrome ...", but the ChangeLog comment is fine too.

Ok, I will try and be clearer.