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

◆ upscale()

void fl::upscale ( const CRGB * input,
CRGB * output,
u16 inputWidth,
u16 inputHeight,
const fl::XYMap & xyMap )
inline

Definition at line 56 of file upscale.h.

57 {
58 u16 outputWidth = xyMap.getWidth();
59 u16 outputHeight = xyMap.getHeight();
60 const bool wontFit =
61 (outputWidth != xyMap.getWidth() || outputHeight != xyMap.getHeight());
62
63 // Check if we can use the optimized rectangular version
64 const bool isRectangular = (xyMap.getType() == XYMap::kLineByLine);
65
66 if (isRectangular) {
67 // Use optimized rectangular version that bypasses XY mapping
68 if (wontFit || (inputWidth & (inputWidth - 1)) ||
69 (inputHeight & (inputHeight - 1))) {
70 upscaleRectangular(input, output, inputWidth, inputHeight,
71 outputWidth, outputHeight);
72 } else {
73 upscaleRectangularPowerOf2(input, output, inputWidth, inputHeight,
74 outputWidth, outputHeight);
75 }
76 } else {
77 // Use the original XY-mapped versions
78 if (wontFit || (inputWidth & (inputWidth - 1)) ||
79 (inputHeight & (inputHeight - 1))) {
80 upscaleArbitrary(input, output, inputWidth, inputHeight, xyMap);
81 } else {
82 upscalePowerOf2(input, output, inputWidth, inputHeight, xyMap);
83 }
84 }
85}
fl::XYMap xyMap
@ kLineByLine
Definition xymap.h:43
void upscaleRectangular(const CRGB *input, CRGB *output, u16 inputWidth, u16 inputHeight, u16 outputWidth, u16 outputHeight)
Optimized upscale for rectangular/line-by-line XY maps.
void upscaleRectangularPowerOf2(const CRGB *input, CRGB *output, u8 inputWidth, u8 inputHeight, u8 outputWidth, u8 outputHeight)
Optimized upscale for rectangular/line-by-line XY maps (power-of-2 version).
void upscaleArbitrary(const CRGB *input, CRGB *output, u16 inputWidth, u16 inputHeight, const XYMap &xyMap)
Performs bilinear interpolation for upscaling an image.
void upscalePowerOf2(const CRGB *input, CRGB *output, u8 inputWidth, u8 inputHeight, const XYMap &xyMap)
Performs bilinear interpolation for upscaling an image.

References fl::XYMap::kLineByLine, upscaleArbitrary(), upscalePowerOf2(), upscaleRectangular(), upscaleRectangularPowerOf2(), and xyMap.

Referenced by fl::ScaleUp::expand(), and fl::CRGB::upscale().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: