|
OSSIA
Open Scenario System for Interactive Application
|
One-euro filter: a low-pass whose cutoff rises with the speed of the signal. More...
One-euro filter: a low-pass whose cutoff rises with the speed of the signal.
Casiez, Roussel and Vogel, "1 euro filter: a simple speed-based low-pass filter for noisy input in interactive systems", CHI 2012.
The point is the jitter/lag tradeoff: at rest the cutoff drops to min_cutoff and the output is very smooth, while a fast movement raises the cutoff so the output stays responsive. Per the authors: if lag during fast motion is the problem, raise beta ; if jitter at rest is the problem, lower min_cutoff.
The derivative is taken against the previous raw input, as in the reference implementation.
Public Types | |
| using | value_type = T |
Public Member Functions | |
| OSSIA_INLINE void | reset () noexcept |
| Forget the history: the next sample restarts the filter. | |
| OSSIA_INLINE void | assign_parameters (const one_euro_filter &p) noexcept |
Adopt p's tuning, keeping the history. | |
| OSSIA_INLINE T | operator() (T x, T dt) noexcept |
Public Attributes | |
| T | min_cutoff {1} |
| Cutoff at zero speed, in Hz. Lower is smoother, and laggier. | |
| T | beta {0} |
| How much the speed raises the cutoff. 0 degrades to a plain low-pass. | |
| T | d_cutoff {1} |
| Cutoff of the low-pass applied to the derivative itself, in Hz. | |
| one_pole_filter< T > | x_filter {} |
| Smoother for the value. | |
| one_pole_filter< T > | dx_filter {} |
| Smoother for the derivative. | |
| T | x_prev {} |
| Previous raw input. | |
|
inlinenoexcept |
| x | Input sample. |
| dt | Time since the previous sample, in seconds. |
A dt <= 0 returns the previous output unchanged rather than dividing by zero, so that a duplicated timestamp cannot poison the state.