ProtoTracer  1.0
Real-time 3D rendering and animation engine
Loading...
Searching...
No Matches
MaxFilter< memory > Class Template Reference

Implements a maximum filter over a sliding window. More...

#include <MaxFilter.h>

Public Member Functions

 MaxFilter ()
 Constructs a MaxFilter with the specified memory size.
 
float Filter (float value)
 Filters the given value, updating the maximum value within the memory window.
 

Private Member Functions

void ShiftArray (uint8_t mem, float *arr)
 Shifts the values in the specified array to make room for a new value.
 

Private Attributes

const int maxMemory = static_cast<int>(std::ceil(memory / 10.0))
 Number of memory blocks for peak tracking.
 
float values [memory]
 Circular buffer of values.
 
float maxValues [memory/10]
 Array of maximum values in each block.
 
uint8_t currentAmount = 0
 Number of values currently stored in the buffer.
 

Detailed Description

template<size_t memory>
class MaxFilter< memory >

Implements a maximum filter over a sliding window.

This class filters input data by maintaining a history of maximum values over a specified memory window. It is particularly useful for detecting and tracking peak values in data streams.

Template Parameters
memoryThe size of the memory window for tracking maximum values.

Definition at line 28 of file MaxFilter.h.

Constructor & Destructor Documentation

◆ MaxFilter()

template<size_t memory>
MaxFilter ( )

Constructs a MaxFilter with the specified memory size.

Member Function Documentation

◆ Filter()

template<size_t memory>
float Filter ( float  value)

Filters the given value, updating the maximum value within the memory window.

Parameters
valueThe input value to filter.
Returns
The maximum value within the memory window after updating with the new value.

Referenced by Oscilloscope::Update().

◆ ShiftArray()

template<size_t memory>
void ShiftArray ( uint8_t  mem,
float arr 
)
private

Shifts the values in the specified array to make room for a new value.

Parameters
memThe size of the array.
arrThe array to shift.

Member Data Documentation

◆ currentAmount

template<size_t memory>
uint8_t currentAmount = 0
private

Number of values currently stored in the buffer.

Definition at line 33 of file MaxFilter.h.

◆ maxMemory

template<size_t memory>
const int maxMemory = static_cast<int>(std::ceil(memory / 10.0))
private

Number of memory blocks for peak tracking.

Definition at line 30 of file MaxFilter.h.

◆ maxValues

template<size_t memory>
float maxValues[memory/10]
private

Array of maximum values in each block.

Definition at line 32 of file MaxFilter.h.

◆ values

template<size_t memory>
float values[memory]
private

Circular buffer of values.

Definition at line 31 of file MaxFilter.h.


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