frac32 x
frac32 y
frac32 out
text table
float v[5][5] = {attr_table};
int32_t *c[5];
for (int iy = 0; iy < 5; iy++) {
c[iy] = (int32_t *)v[4 - iy];
for (int ix = 0; ix < 5; ix++) {
c[iy][ix] = arm::float_to_q(v[4 - iy][ix], 28 - 6);
}
}
int32_t x = __USAT(inlet_x, 27);
int32_t y = __USAT(inlet_y, 27);
int32_t ix = x >> 25; //[0 3]
int32_t ax = (x & ((1 << 25) - 1)) << 6; // q31
int32_t iy = y >> 25; //[0 3]
int32_t ay = (y & ((1 << 25) - 1)) << 6; // q31
int32_t c00 = c[iy][ix];
int32_t c01 = c[iy][ix + 1];
// q31 q28 q27
int32_t c0 = ___SMMLA(ax, c01 - c00, c00 >> 1);
int32_t c10 = c[iy + 1][ix];
int32_t c11 = c[iy + 1][ix + 1];
// q31 q28 q27
int32_t c1 = ___SMMLA(ax, c11 - c10, c10 >> 1);
// q31 q27 q26
outlet_out = ___SMMLA(ay, c1 - c0, c0 >> 1) << 1;