frac32 factor
frac32buffer.bipolar in
frac32buffer out
frac32.u.map factor
float x0, v0, x1, y0, y1;
v0 = 0;
float factor =
0.02f + __USAT(param_factor + inlet_factor, 27) * (0.96f / (1 << 27));
float vmax = 1 / ((1 - factor) * (1 - factor));
float vmin = 1 / ((1 + factor) * (1 + factor));
float coef = 2 / (vmax - vmin);
float offset = -coef * vmin - 1;
// update according to new values
x0 = 1 - factor * v0;
y0 = -1 / x0;
// Integ x^-2 dx = -x^-1 = -1/x
for (int i = 0; i < BUFSIZE; i++) {
x1 = x0;
y1 = y0;
x0 = 1 - factor * (v0 = arm::q_to_float(__SSAT(inlet_in[i], 28), 27));
float dx = x1 - x0;
if (fabs(dx) > 0.005f) {
y0 = -1 / x0;
float dy = y1 - y0;
outlet_out[i] = arm::float_to_q(coef * dy / dx + offset, 27);
} else {
float inv = 1 / x0;
y0 = -inv;
outlet_out[i] = arm::float_to_q(coef * inv * inv + offset, 27);
}
}