[gvar] Rewrite linear interpolation

This commit is contained in:
Behdad Esfahbod 2022-06-27 15:22:16 -06:00
parent 57519b532d
commit 5be6e5dd57
1 changed files with 1 additions and 1 deletions

View File

@ -536,7 +536,7 @@ struct gvar
/* linear interpolation */ /* linear interpolation */
float r = (target_val - prev_val) / (next_val - prev_val); float r = (target_val - prev_val) / (next_val - prev_val);
return (1.f - r) * prev_delta + r * next_delta; return prev_delta + r * (next_delta - prev_delta);
} }
static unsigned int next_index (unsigned int i, unsigned int start, unsigned int end) static unsigned int next_index (unsigned int i, unsigned int start, unsigned int end)