Second-order antiderivative antialiasing over one shape, in the curve's own argument domain (Bilbao, Esqueda, Parker & Välimäki, IEEE SPL 24(7), 2017). More...
#include <saturator.hpp>
Public Member Functions | |
| void | reset (SaturatorShape shape, double previous, double before) |
| Seeds the two-sample history: previous is the last argument consumed, before the one ahead of it. | |
| double | step (SaturatorShape shape, double u) |
| Consumes the newest argument and returns the antialiased curve value centred one sample back. | |
Static Public Attributes | |
| static constexpr double | kTolerance = 1e-4 |
| Relative spacing below which a divided difference is replaced by its series limit. | |
Second-order antiderivative antialiasing over one shape, in the curve's own argument domain (Bilbao, Esqueda, Parker & Välimäki, IEEE SPL 24(7), 2017).
The output is twice the second divided difference of F2 over the last three arguments; on the linear part of a curve that is the mean of the three samples. Because a divided difference is symmetric in its points, the three arguments are taken in sorted order: the denominator is then the full spread of the three, never the gap between two points that happen to be close, which is what makes a signal turning around (x[n] ≈ x[n−2]) a non-event rather than the ill-conditioned special case it is in the textbook arrangement.
Near-degenerate spacings fall back to series forms that are accurate to the order the fallback threshold leaves: a close pair uses the midpoint rule with its second-order correction, a near-constant triple uses the curve at the triple's mean (the limit of the divided difference, and exact on the linear part). The threshold scales with |u| because F2 grows as u², so the rounding error the division amplifies stays bounded (~1e-8 absolute) at every drive.
The three-point stencil is symmetric about the middle sample, so the output is delayed by exactly one sample. Scalar state only; step() never allocates.
|
inline |
Seeds the two-sample history: previous is the last argument consumed, before the one ahead of it.
A parameter change that remaps the argument domain re-seeds from the same input history, so the stencil never mixes arguments taken under two different settings.
|
inline |
Consumes the newest argument and returns the antialiased curve value centred one sample back.
|
staticconstexpr |
Relative spacing below which a divided difference is replaced by its series limit.
[design parameter] default 1e-4, range 1e-6 .. 1e-3.