157 static constexpr uint8_t
FRAMES = sinc16::FRAMES;
177 static constexpr uint8_t TOP = sinc16::DEGREE;
192 static constexpr Group horner8(
const float (&c)[
FRAMES][sinc16::DEGREE + 1], uint8_t i,
float s) {
193 float v0 = c[i][TOP];
194 float v1 = c[i + 1][TOP];
195 float v2 = c[i + 2][TOP];
196 float v3 = c[i + 3][TOP];
197 float v4 = c[i + 4][TOP];
198 float v5 = c[i + 5][TOP];
199 float v6 = c[i + 6][TOP];
200 float v7 = c[i + 7][TOP];
201 for (
int k = TOP - 1; k >= 0; --k) {
202 v0 = v0 * s + c[i][k];
203 v1 = v1 * s + c[i + 1][k];
204 v2 = v2 * s + c[i + 2][k];
205 v3 = v3 * s + c[i + 3][k];
206 v4 = v4 * s + c[i + 4][k];
207 v5 = v5 * s + c[i + 5][k];
208 v6 = v6 * s + c[i + 6][k];
209 v7 = v7 * s + c[i + 7][k];
211 return {{v0, v1, v2, v3, v4, v5, v6, v7}};
215 static constexpr BlepResidual<FRAMES> evaluate(
const float (&c)[
FRAMES][sinc16::DEGREE + 1],
float t) {
216 static_assert(
FRAMES == 16,
"SBL ERROR: Sinc16::evaluate takes its frames as two groups of eight");
217 const float s = 2.0f * t - 1.0f;
218 const Group a = horner8(c, 0, s);
219 const Group b = horner8(c, 8, s);
220 return {{a.v[0], a.v[1], a.v[2], a.v[3], a.v[4], a.v[5], a.v[6], a.v[7], b.v[0], b.v[1], b.v[2], b.v[3], b.v[4],
221 b.v[5], b.v[6], b.v[7]}};
constexpr float polyblep_time(float before, float after, float threshold_before, float threshold_after)
Sub-frame time at which a linear segment crossed a moving threshold.