AV module
FPSCounter
FPS counter based on the simple moving average (SMA) algorithm.
FPSCounter
#include <icy/av/fpscounter.h>FPS counter based on the simple moving average (SMA) algorithm.
Public Attributes
fps
double fpsframes
int64_t framesPublic Methods
| Return | Name | Description |
|---|---|---|
FPSCounter inline | Initialise the counter with all zeroes. | |
void | reset inline | Reset all counters and the SMA window to zero. |
void | tick inline | Record a new frame and update the FPS estimate. Must be called once per frame. Updates fps and increments frames. |
FPSCounter
inline
inline FPSCounter()Initialise the counter with all zeroes.
reset
inline
inline void reset()Reset all counters and the SMA window to zero.
tick
inline
inline void tick()Record a new frame and update the FPS estimate. Must be called once per frame. Updates fps and increments frames.
Private Attributes
tickIndex
int tickIndexprevTick
clock_t prevTicktickSum
clock_t tickSumtickList
clock_t tickListPrivate Methods
| Return | Name | Description |
|---|---|---|
double | updateAvg inline |
updateAvg
inline
inline double updateAvg(clock_t newTick)