49#ifdef FASTLED_FIVE_BIT_HD_BITSHIFT_FUNCTION_OVERRIDE
62 colors, colors_scale, global_brightness, out_colors, out_power_5bit);
79#ifdef FASTLED_FIVE_BIT_HD_GAMMA_FUNCTION_OVERRIDE
96 if (global_brightness == 0) {
97 *out_colors =
CRGB(0, 0, 0);
108 if (colors_scale.r != 0xff) {
111 if (colors_scale.g != 0xff) {
114 if (colors_scale.b != 0xff) {
127 uint8_t *out_power_5bit) {
136 static uint32_t bright_scale[32] = {
137 0, 2023680, 1011840, 674560, 505920, 404736, 337280, 289097,
138 252960, 224853, 202368, 183971, 168640, 155668, 144549, 134912,
139 126480, 119040, 112427, 106509, 101184, 96366, 91985, 87986,
140 84320, 80947, 77834, 74951, 72274, 69782, 67456, 65280};
142 auto max3 = [](u16 a, u16 b, u16 c) {
return fl_max(
fl_max(a, b), c); };
146 *out =
CRGB(0, 0, 0);
150 if (r16 == 0 && g16 == 0 && b16 == 0) {
151 *out =
CRGB(0, 0, 0);
156 uint8_t r8 = 0, g8 = 0, b8 = 0;
166 uint16_t
scale = max3(r16, g16, b16);
169 *out =
CRGB(0, 0, 0);
180 scalef = bright_scale[
scale];
181 r8 = (r16 * scalef + 0x808000) >> 24;
182 g8 = (g16 * scalef + 0x808000) >> 24;
183 b8 = (b16 * scalef + 0x808000) >> 24;
185 *out =
CRGB(r8, g8, b8);
186 *out_power_5bit =
static_cast<uint8_t
>(
scale);
UISlider brightness("Brightness", 128, 0, 255, 1)
Defines the red, green, and blue (RGB) pixel struct.
LIB8STATIC_ALWAYS_INLINE uint16_t scale16by8(uint16_t i, fract8 scale)
Scale a 16-bit unsigned value by an 8-bit value, which is treated as the numerator of a fraction whos...
void five_bit_hd_gamma_bitshift(CRGB colors, CRGB colors_scale, fl::u8 global_brightness, CRGB *out_colors, fl::u8 *out_power_5bit)
FiveBitGammaCorrectionMode
@ kFiveBitGammaCorrectionMode_Null
@ kFiveBitGammaCorrectionMode_BitShift
void gamma16(const CRGB &rgb, u16 *r16, u16 *g16, u16 *b16)
common_type_t< T, U > fl_max(T a, U b)
void five_bit_hd_gamma_function(CRGB color, u16 *r16, u16 *g16, u16 *b16)
void five_bit_bitshift(u16 r16, u16 g16, u16 b16, fl::u8 brightness, CRGB *out, fl::u8 *out_power_5bit)
void internal_builtin_five_bit_hd_gamma_bitshift(CRGB colors, CRGB colors_scale, fl::u8 global_brightness, CRGB *out_colors, fl::u8 *out_power_5bit)
Fast, efficient 8-bit scaling functions specifically designed for high-performance LED programming.
Representation of an RGB pixel (Red, Green, Blue)