FastLED 3.9.15
Loading...
Searching...
No Matches

◆ bilinearInterpolate()

u8 fl::bilinearInterpolate ( u8 v00,
u8 v10,
u8 v01,
u8 v11,
u16 dx,
u16 dy )

Definition at line 151 of file upscale.cpp.

152 {
153 u16 dx_inv = 256 - dx;
154 u16 dy_inv = 256 - dy;
155
156 u32 w00 = (u32)dx_inv * dy_inv;
157 u32 w10 = (u32)dx * dy_inv;
158 u32 w01 = (u32)dx_inv * dy;
159 u32 w11 = (u32)dx * dy;
160
161 u32 sum = v00 * w00 + v10 * w10 + v01 * w01 + v11 * w11;
162
163 // Normalize the result by dividing by 65536 (shift right by 16 bits),
164 // with rounding
165 u8 result = (u8)((sum + 32768) >> 16);
166
167 return result;
168}
Result type for promise operations.
unsigned char u8
Definition int.h:17

Referenced by upscaleArbitrary(), and upscaleRectangular().

+ Here is the caller graph for this function: