frac32 x
frac32 y
frac32 out
text table
float v[3][3] = {attr_table};
int32_t *c[3];
for (int iy = 0; iy < 3; iy++) {
c[iy] = (int32_t *)v[2 - iy];
for (int ix = 0; ix < 3; ix++) {
c[iy][ix] = arm::float_to_q(v[2 - iy][ix], 28 - 6);
}
}
int32_t x = __USAT(inlet_x, 27);
int32_t y = __USAT(inlet_y, 27);
int32_t ix = x >> 26; //[0 1]
int32_t ax = (x & ((1 << 26) - 1)) << 5; // q31
int32_t iy = y >> 26; //[0 1]
int32_t ay = (y & ((1 << 26) - 1)) << 5; // 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;