87 if (weight == 0)
return x;
89 const int16_t dx = (int16_t)(x - mean);
90 const int32_t diff = weight * dx;
107 if (weight == 0)
return x;
108 const int32_t dx = x - mean;
109 const int32_t diff = weight * dx;
142 if (weight == 0)
return x;
145 const uint32_t dx = x - mean;
146 const uint32_t diff =
fp_mulu(weight, dx, 8U);
151 const uint32_t dx = mean - x;
152 const uint32_t diff =
fp_mulu(weight, dx, 8U);
169 if (weight == 0)
return x;
172 const uint32_t dx = x - mean;
173 const uint32_t diff =
fp_mulu(weight, dx, 8U);
178 const uint32_t dx = mean - x;
179 const uint32_t diff =
fp_mulu(weight, dx, 8U);
This file is part of the AFBR-S50 API.
This file is part of the AFBR-S50 API.
This file is part of the AFBR-S50 API.
uq1_15_t fp_ema15c(uq1_15_t mean, uq1_15_t x, uq0_8_t weight)
Circular exponentially weighted moving average using UQ1.15 format.
Definition fp_ema.h:85
q15_16_t fp_ema16(q15_16_t mean, q15_16_t x, uq0_8_t weight)
Exponentially weighted moving average using the Q15.16 format.
Definition fp_ema.h:195
uint32_t uint_ema32(uint32_t mean, uint32_t x, uq0_8_t weight)
Exponentially weighted moving average using the Q15.16 format.
Definition fp_ema.h:140
uint8_t uq0_8_t
Unsigned fixed point number: UQ0.8.
Definition fp_def.h:162
uint32_t fp_mulu(uint32_t u, uint32_t v, uint_fast8_t shift)
64-bit implementation of an unsigned multiplication with fixed point format.
Definition fp_mul.h:116
int32_t fp_rnds(int32_t Q, uint_fast8_t n)
Converting with rounding from Qx.n1 to Qx.n2.
Definition fp_rnd.h:80
int32_t int_ema32(int32_t mean, int32_t x, uq0_8_t weight)
Exponentially weighted moving average using the Q15.16 format.
Definition fp_ema.h:167
uint16_t uq1_15_t
Unsigned fixed point number: UQ1.15.
Definition fp_def.h:271
q11_4_t fp_ema4(q11_4_t mean, q11_4_t x, uq0_8_t weight)
Exponentially weighted moving average using the Q11.4 format.
Definition fp_ema.h:105
int16_t q7_8_t
Signed fixed point number: Q7.8.
Definition fp_def.h:335
int32_t q15_16_t
Signed fixed point number: Q15.16.
Definition fp_def.h:515
q7_8_t fp_ema8(q7_8_t mean, q7_8_t x, uq0_8_t weight)
Exponentially weighted moving average using the Q7.8 format.
Definition fp_ema.h:124
int16_t q11_4_t
Signed fixed point number: Q11.4.
Definition fp_def.h:312