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