Re: Fast Interpolation given Left, Right, Intermediate and a shift valu
From
Skybuck Flying@21:1/5 to
All on Sat Jun 4 16:00:08 2022
Unfortunately this does not yet solve the division problem, I am guessing for my purposes the "usage code" would still need a division, which cannot be shifted out currently:
because the columncount is not a power of 2 ?! BLEH !
// untested code, but I think it's a correct usage example for going from 7200 palette to 256 palette:
Left := LargerPaletteIndex div mColumnCount; // painfull div still necessary... ColumnCount would be 450 for mShift = 5
Right := Left + 1;
Intermediate := LargerPaletteIndex mod mColumnCount; // could be down with a single divmod instruction combine with above.
Shift := 5;
function Linear_InterpolateFast( Left, Right, Intermediate, Shift : Integer ) : integer;
So a different larger palette would need to be constructed where column count is a power of 2 but also the multiplier is a power of 2.... the 1 shl Shift in the routine, but I am not sure if such a combination exists for shift range 1 to 9 or so....
anything beyond shifting by 9 would probably be unreasonable, then again 16 bits per R,G,B,A is what adobe uses and maybe future 48 bit displays with 16 bit alpha channel for total of 64 bits... So a shift value would be 16-8 = 8.... so yes... shift
value can range from 1 to 8... even 9 would probably be unreasonable ! ;)
Bye for now,
Skybuck.
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)