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;
126 if (weight == 0)
return x;
131 const uint32_t diff = weight * dx;
137 const uint32_t diff = weight * dx;
171 if (weight == 0)
return x;
174 const uint32_t dx = x - mean;
175 const uint32_t diff =
fp_mulu(weight, dx, 8U);
180 const uint32_t dx = mean - x;
181 const uint32_t diff =
fp_mulu(weight, dx, 8U);
198 if (weight == 0)
return x;
201 const uint32_t dx = x - mean;
202 const uint32_t diff =
fp_mulu(weight, dx, 8U);
207 const uint32_t dx = mean - x;
208 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
uint32_t fp_rndu(uint32_t Q, uint_fast8_t n)
Converting with rounding from UQx.n1 to UQx.n2.
Definition fp_rnd.h:60
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:224
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:169
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:196
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
uq12_4_t fp_ema4u(uq12_4_t mean, uq12_4_t x, uq0_8_t weight)
Exponentially weighted moving average using the UQ12.4 format.
Definition fp_ema.h:124
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:153
uint16_t uq12_4_t
Unsigned fixed point number: UQ12.4.
Definition fp_def.h:231
int16_t q11_4_t
Signed fixed point number: Q11.4.
Definition fp_def.h:312