Sound Byte Libs 29c5ff3
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
Loading...
Searching...
No Matches
Public Member Functions | List of all members
sbl::primitives::math::Ewma Class Reference

#include <ewma.hpp>

Collaboration diagram for sbl::primitives::math::Ewma:

Public Member Functions

 Ewma (uint8_t shift=3)
 Construct EWMA filter.
 
uint16_t update (uint16_t raw)
 Feed a new sample and return the smoothed value.
 
uint16_t value () const
 Return current smoothed value without updating.
 
void reset ()
 Reset filter state (next update will re-seed)
 

Detailed Description

Definition at line 29 of file ewma.hpp.

Constructor & Destructor Documentation

◆ Ewma()

sbl::primitives::math::Ewma::Ewma ( uint8_t  shift = 3)
inlineexplicit

Construct EWMA filter.

Parameters
shiftSmoothing exponent (alpha = 1/2^shift). Range: 1–15.

Definition at line 35 of file ewma.hpp.

Member Function Documentation

◆ reset()

void sbl::primitives::math::Ewma::reset ( )
inline

Reset filter state (next update will re-seed)

Definition at line 68 of file ewma.hpp.

Referenced by sbl::components::cv::CvInput::reset().

Here is the caller graph for this function:

◆ update()

uint16_t sbl::primitives::math::Ewma::update ( uint16_t  raw)
inline

Feed a new sample and return the smoothed value.

First call seeds the filter (no smoothing on first sample). Internal state uses Q16 fixed-point for sub-LSB precision.

Parameters
rawRaw input value (16-bit)
Returns
Smoothed output (16-bit)

Definition at line 46 of file ewma.hpp.

Referenced by sbl::components::cv::CvInput::update().

Here is the caller graph for this function:

◆ value()

uint16_t sbl::primitives::math::Ewma::value ( ) const
inline

Return current smoothed value without updating.

Definition at line 63 of file ewma.hpp.

Referenced by sbl::components::cv::CvInput::scaled(), sbl::components::cv::CvInput::scaled_curved(), and sbl::components::cv::CvInput::value().

Here is the caller graph for this function:

The documentation for this class was generated from the following file: