FastLED 3.10.8
Loading...
Searching...
No Matches
pixel.cpp.hpp
Go to the documentation of this file.
1// ok no header
2#include "fl/codec/pixel.h"
3#include "fastled_progmem.h"
4#include "fl/stl/noexcept.h"
5
6namespace fl {
7
8// RGB565 to RGB888 conversion lookup tables (using proper rounding for optimal color accuracy)
9// 5-bit to 8-bit: (i * 255.0) / 31.0 + 0.5 with rounding
11 0, 8, 16, 25, 33, 41, 49, 58, 66, 74, 82, 90, 99, 107, 115, 123,
12 132, 140, 148, 156, 165, 173, 181, 189, 197, 206, 214, 222, 230, 239, 247, 255
13};
14
15// 6-bit to 8-bit: (i * 255.0) / 63.0 + 0.5 with rounding
17 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 45, 49, 53, 57, 61,
18 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125,
19 130, 134, 138, 142, 146, 150, 154, 158, 162, 166, 170, 174, 178, 182, 186, 190,
20 194, 198, 202, 206, 210, 215, 219, 223, 227, 231, 235, 239, 243, 247, 251, 255
21};
22
23// Convert RGB565 to RGB888 with proper scaling to full 8-bit range using lookup tables
24void rgb565ToRgb888(fl::u16 rgb565, fl::u8& r, fl::u8& g, fl::u8& b) FL_NO_EXCEPT {
25 // Extract RGB components from RGB565
26 fl::u8 r5 = (rgb565 >> 11) & 0x1F; // 5-bit red
27 fl::u8 g6 = (rgb565 >> 5) & 0x3F; // 6-bit green
28 fl::u8 b5 = rgb565 & 0x1F; // 5-bit blue
29
30 // Use lookup tables for fast conversion
34}
35
36} // namespace fl
#define FL_PGM_READ_BYTE_NEAR(x)
Read a byte (8-bit) from PROGMEM memory.
#define FL_PROGMEM
PROGMEM keyword for storage.
Wrapper definitions to allow seamless use of PROGMEM in environments that have it.
unsigned char u8
Definition stdint.h:131
u8 u8 fract8 blur_amount FL_NO_EXCEPT
Definition blur.h:186
const fl::u8 rgb565_5to8_table[32]
Definition pixel.cpp.hpp:10
const fl::u8 rgb565_6to8_table[64]
Definition pixel.cpp.hpp:16
void rgb565ToRgb888(fl::u16 rgb565, fl::u8 &r, fl::u8 &g, fl::u8 &b) FL_NO_EXCEPT
Definition pixel.cpp.hpp:24
InputGamut g
Definition rgbw.h:125
Base definition for an LED controller.
Definition crgb.hpp:179