FastLED 3.9.3
Loading...
Searching...
No Matches
bilinear_expansion.h
1
5
6#pragma once
7
8#include <stdint.h>
9
10#include "crgb.h"
11#include "namespace.h"
12#include "xymap.h"
13
14
15FASTLED_NAMESPACE_BEGIN
16
26void bilinearExpandArbitrary(const CRGB *input, CRGB *output,
27 uint16_t inputWidth, uint16_t inputHeight,
28 XYMap xyMap);
29
37void bilinearExpandPowerOf2(const CRGB *input, CRGB *output, uint8_t inputWidth, uint8_t inputHeight, XYMap xyMap);
38
39//
40inline void bilinearExpand(const CRGB *input, CRGB *output, uint16_t inputWidth,
41 uint16_t inputHeight, XYMap xyMap) {
42 uint16_t outputWidth = xyMap.getWidth();
43 uint16_t outputHeight = xyMap.getHeight();
44 const bool wontFit = (outputWidth != xyMap.getWidth() || outputHeight != xyMap.getHeight());
45 // if the input dimensions are not a power of 2 then we can't use the
46 // optimized version.
47 if (wontFit || (inputWidth & (inputWidth - 1)) || (inputHeight & (inputHeight - 1))) {
48 bilinearExpandArbitrary(input, output, inputWidth, inputHeight, xyMap);
49 } else {
50 bilinearExpandPowerOf2(input, output, inputWidth, inputHeight, xyMap);
51 }
52}
53
54void bilinearExpandFloat(const CRGB *input, CRGB *output,
55 uint8_t inputWidth, uint8_t inputHeight,
56 XYMap xyMap);
57
58FASTLED_NAMESPACE_END
Definition xymap.h:39
Representation of an RGB pixel (Red, Green, Blue)
Definition crgb.h:39