Convert RGB565 to RGB888 with proper scaling to full 8-bit range using lookup tables
| 21 | |
| 22 | // Convert RGB565 to RGB888 with proper scaling to full 8-bit range using lookup tables |
| 23 | void 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 |
| 30 | r = FL_PGM_READ_BYTE_NEAR(&rgb565_5to8_table[r5]); |
| 31 | g = FL_PGM_READ_BYTE_NEAR(&rgb565_6to8_table[g6]); |
| 32 | b = FL_PGM_READ_BYTE_NEAR(&rgb565_5to8_table[b5]); |
| 33 | } |
| 34 | |
| 35 | } // namespace fl |
no outgoing calls
no test coverage detected