16#define FASTLED_SCALE_UP_ALWAYS_POWER_OF_2 0
19#define FASTLED_SCALE_UP_HIGH_PRECISION 1
24#define FASTLED_SCALE_UP_DECIDE_AT_RUNTIME 2
26#define FASTLED_SCALE_UP_FORCE_FLOATING_POINT 3
28#ifndef FASTLED_SCALE_UP
29#define FASTLED_SCALE_UP FASTLED_SCALE_UP_DECIDE_AT_RUNTIME
38 mDelegate->getXYMap().setRectangularGrid();
54 if (in_w == out_w && in_h == out_h) {
63#if FASTLED_SCALE_UP == FASTLED_SCALE_UP_ALWAYS_POWER_OF_2
65#elif FASTLED_SCALE_UP == FASTLED_SCALE_UP_HIGH_PRECISION
67#elif FASTLED_SCALE_UP == FASTLED_SCALE_UP_DECIDE_AT_RUNTIME
69#elif FASTLED_SCALE_UP == FASTLED_SCALE_UP_FORCE_FLOATING_POINT
72#error "Invalid FASTLED_SCALE_UP"
79 for (u16 w = 0; w <
width; w++) {
80 for (u16 h = 0; h <
height; h++) {
81 u16 idx =
mXyMap.mapToIndex(w, h);
83 output[idx] = input[w *
height + h];
void noExpand(fl::span< const CRGB > input, fl::span< CRGB > output, u16 width, u16 height)
Direct copy without expansion (used when resolutions match)
ScaleUp(const XYMap &xymap, Fx2dPtr fx)
Construct a ScaleUp effect wrapper.
void draw(DrawContext context) override
Render the effect by drawing delegate at low-res and scaling up.
fl::vector_psram< CRGB > mSurface
Low-resolution render buffer.
void expand(fl::span< const CRGB > input, fl::span< CRGB > output, u16 width, u16 height, const XYMap &mXyMap)
Expand a low-resolution buffer to high-resolution using bilinear interpolation.
Fx2dPtr mDelegate
The wrapped effect that renders at low resolution.
const T * data() const FL_NOEXCEPT
void upscaleArbitrary(const CRGB *input, CRGB *output, u16 inputWidth, u16 inputHeight, const XYMap &xyMap)
Performs bilinear interpolation for upscaling an image.
u8 upscaleFloat(u8 v00, u8 v10, u8 v01, u8 v11, float dx, float dy)
void upscale(const CRGB *input, CRGB *output, u16 inputWidth, u16 inputHeight, const fl::XYMap &xyMap)
void upscalePowerOf2(const CRGB *input, CRGB *output, u8 inputWidth, u8 inputHeight, const XYMap &xyMap)
Performs bilinear interpolation for upscaling an image.
Base definition for an LED controller.
Expands a grid using bilinear interpolation for upscaling effects.