13template <
typename T, fl::size N = 0>
16 "HampelFilter: N must be odd for an unambiguous median");
24 FL_ERROR(
"HampelFilter: capacity should be odd, adding 1");
33 for (fl::size i = 0; i < values.
size(); ++i) {
49 T deviation =
fl::abs(input - median);
51 if (!(deviation == T(0))) {
62 fl::size idx =
static_cast<fl::size
>(
pos - base);
69 T oldest =
mRing.front();
72 fl::size rm =
static_cast<fl::size
>(rm_pos - base);
77 fl::size idx =
static_cast<fl::size
>(ins_pos - base);
83 mRing.push_back(input);
101 if (new_capacity % 2 == 0) {
102 FL_ERROR(
"HampelFilter: capacity should be odd, adding 1");
circular_buffer< T, N > mSorted
FL_STATIC_ASSERT(N==0||(N % 2==1), "HampelFilter: N must be odd for an unambiguous median")
T update(fl::span< const T > values)
void resize(fl::size new_capacity)
fl::size capacity() const
circular_buffer< T, N > mRing
HampelFilterImpl(T threshold=T(3.0f))
HampelFilterImpl(fl::size capacity, T threshold=T(3.0f))
constexpr fl::size size() const FL_NOEXCEPT
Centralized logging categories for FastLED hardware interfaces and subsystems.
fl::enable_if< fl::is_floating_point< T >::value, T >::type div_by_count(T sum, fl::size count)
Compile-time linker keep-alive hook for a single fl::Bus.
expected< T, E > result
Alias for expected (Rust-style naming)
Iterator lower_bound(Iterator first, Iterator last, const T &value, Compare comp) FL_NOEXCEPT
constexpr enable_if< is_fixed_point< T >::value, T >::type abs(T x) FL_NOEXCEPT
Base definition for an LED controller.
Portable compile-time assertion wrapper.