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

ReturnNameDescription
doublefps
int64_tframes

fps

double fps

frames

int64_t frames

Public Methods

ReturnNameDescription
FPSCounter inlineInitialise the counter with all zeroes.
voidreset inlineReset all counters and the SMA window to zero.
voidtick inlineRecord 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

ReturnNameDescription
inttickIndex
clock_tprevTick
clock_ttickSum
clock_ttickList

tickIndex

int tickIndex

prevTick

clock_t prevTick

tickSum

clock_t tickSum

tickList

clock_t tickList

Private Methods

ReturnNameDescription
doubleupdateAvg inline

updateAvg

inline

inline double updateAvg(clock_t newTick)