diff options
Diffstat (limited to 'main/jpeg_decoder.c')
| -rw-r--r-- | main/jpeg_decoder.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/main/jpeg_decoder.c b/main/jpeg_decoder.c index f2a7d92..2538f69 100644 --- a/main/jpeg_decoder.c +++ b/main/jpeg_decoder.c @@ -62,18 +62,20 @@ void jpeg_decoder_unlock(void) void *jpeg_decoder_input_buffer(void) { return s_in_buf; } esp_err_t jpeg_decoder_decode(size_t jpeg_len, - void **out_rgb565, + void **out_bgr888, uint16_t *out_width, uint16_t *out_height) { if (jpeg_len == 0 || jpeg_len > s_in_cap) return ESP_ERR_INVALID_SIZE; + // Hardware decode directly into a panel-native BGR888 buffer. + // _BGR rgb_order swaps the channel layout so memory ends up as + // [B, G, R] per pixel — exactly what the ESP32-P4 DSI engine + + // TC358762 + Pi panel pipeline wants. Total firmware-side cost in + // the hot /frame path: this hardware decode + one DMA hand-off to + // the panel. No CPU pixel work. jpeg_decode_cfg_t dec_cfg = { - .output_format = JPEG_DECODE_OUT_FORMAT_RGB565, - // Empirically: _RGB emits the RGB565 word in big-endian byte order - // (red 0xF800 → bytes f8 00) which our LE uint16 painter reads - // swapped. _BGR emits little-endian to match (despite the - // misleading "BGR" name) — verified by the decode-byte dump. + .output_format = JPEG_DECODE_OUT_FORMAT_RGB888, .rgb_order = JPEG_DEC_RGB_ELEMENT_ORDER_BGR, .conv_std = JPEG_YUV_RGB_CONV_STD_BT601, }; @@ -94,7 +96,7 @@ esp_err_t jpeg_decoder_decode(size_t jpeg_len, return err; } - *out_rgb565 = s_out_buf; + *out_bgr888 = s_out_buf; *out_width = info.width; *out_height = info.height; return ESP_OK; |
