FastLED 3.9.15
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
5namespace fl {
6
7// RGB565 to RGB888 conversion lookup tables (using proper rounding for optimal color accuracy)
8// 5-bit to 8-bit: (i * 255.0) / 31.0 + 0.5 with rounding
10 0, 8, 16, 25, 33, 41, 49, 58, 66, 74, 82, 90, 99, 107, 115, 123,
11 132, 140, 148, 156, 165, 173, 181, 189, 197, 206, 214, 222, 230, 239, 247, 255
12};
13
14// 6-bit to 8-bit: (i * 255.0) / 63.0 + 0.5 with rounding
16 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 45, 49, 53, 57, 61,
17 65, 69, 73, 77, 81, 85, 89, 93, 97, 101, 105, 109, 113, 117, 121, 125,
18 130, 134, 138, 142, 146, 150, 154, 158, 162, 166, 170, 174, 178, 182, 186, 190,
19 194, 198, 202, 206, 210, 215, 219, 223, 227, 231, 235, 239, 243, 247, 251, 255
20};
21
22// Convert RGB565 to RGB888 with proper scaling to full 8-bit range using lookup tables
23void rgb565ToRgb888(fl::u16 rgb565, fl::u8& r, fl::u8& g, fl::u8& b) {
24 // Extract RGB components from RGB565
25 fl::u8 r5 = (rgb565 >> 11) & 0x1F; // 5-bit red
26 fl::u8 g6 = (rgb565 >> 5) & 0x3F; // 6-bit green
27 fl::u8 b5 = rgb565 & 0x1F; // 5-bit blue
28
29 // Use lookup tables for fast conversion
33}
34
35} // 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 s16x16x4.h:132
const fl::u8 rgb565_5to8_table[32]
Definition pixel.cpp.hpp:9
const fl::u8 rgb565_6to8_table[64]
Definition pixel.cpp.hpp:15
void rgb565ToRgb888(fl::u16 rgb565, fl::u8 &r, fl::u8 &g, fl::u8 &b)
Definition pixel.cpp.hpp:23
Base definition for an LED controller.
Definition crgb.hpp:179