27 struct LagrangeResampleHelper
29 static forcedinline
void calc (
float& a,
float b) noexcept { a *= b * (1.0f / k); }
33 struct LagrangeResampleHelper<0>
35 static forcedinline
void calc (
float&,
float) noexcept {}
39 static float calcCoefficient (
float input,
float offset) noexcept
41 LagrangeResampleHelper<0 - k>::calc (input, -2.0f - offset);
42 LagrangeResampleHelper<1 - k>::calc (input, -1.0f - offset);
43 LagrangeResampleHelper<2 - k>::calc (input, 0.0f - offset);
44 LagrangeResampleHelper<3 - k>::calc (input, 1.0f - offset);
45 LagrangeResampleHelper<4 - k>::calc (input, 2.0f - offset);
49 float Interpolators::LagrangeTraits::valueAtOffset (
const float* inputs,
float offset,
int index) noexcept
53 result += calcCoefficient<0> (inputs[index], offset);
if (++index == 5) index = 0;
54 result += calcCoefficient<1> (inputs[index], offset);
if (++index == 5) index = 0;
55 result += calcCoefficient<2> (inputs[index], offset);
if (++index == 5) index = 0;
56 result += calcCoefficient<3> (inputs[index], offset);
if (++index == 5) index = 0;
57 result += calcCoefficient<4> (inputs[index], offset);