FastLED 3.10.8
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 57 of file upscale.h.

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

References FL_NO_EXCEPT, 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: