From c75fea7e1629c7a0880a92e45438630fb41d306b Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Mon, 2 Jan 2017 16:11:32 -0800 Subject: roto: add TODO comment about faster lerp_color() --- modules/roto/roto.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'modules') diff --git a/modules/roto/roto.c b/modules/roto/roto.c index a7d1750..d789f85 100644 --- a/modules/roto/roto.c +++ b/modules/roto/roto.c @@ -26,6 +26,12 @@ typedef struct color_t { /* linearly interpolate between two colors, alpha is fixed-point value 0-FIXED_EXP. */ static inline color_t lerp_color(color_t *a, color_t *b, int alpha) { + /* TODO: This could be done without multiplies with a bit of effort, + * maybe a simple table mapping integer color deltas to shift values + * for shifting alpha which then gets simply added? A table may not even + * be necessary, use the order of the delta to derive how much to shift + * alpha? + */ color_t c = { .r = a->r + FIXED_MULT(alpha, b->r - a->r), .g = a->g + FIXED_MULT(alpha, b->g - a->g), -- cgit v1.2.3