Skip to content

Instantly share code, notes, and snippets.

@mtytel
Created June 4, 2018 20:32
Show Gist options
  • Save mtytel/1b59c2d3ee40f81cc4f3712aca757854 to your computer and use it in GitHub Desktop.
Save mtytel/1b59c2d3ee40f81cc4f3712aca757854 to your computer and use it in GitHub Desktop.
Optimal Interpolation
forcedinline poly_float getOptimalInterpolationValues(mono_float mono_t) {
static const poly_float kOptimalOne(0.00224072707074864375f, 0.20184198969656244725f,
0.59244492420272312725f, 0.20345744715566445625f);
static const poly_float kOptimalTwo(-0.0059513775678254975f, -0.456633315206820491f,
-0.035736698832993691f, 0.4982319203618311775f);
static const poly_float kOptimalThree(0.093515484757265265f, 0.294278871937834749f,
-0.786648885977648931f, 0.398765058036740415f);
static const poly_float kOptimalFour(-0.10174985775982505f, 0.36030925263849456f,
-0.36030925263849456, 0.10174985775982505f);
poly_float t = mono_t;
return ((kOptimalFour * t + kOptimalThree) * t + kOptimalTwo) + kOptimalOne;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment