Skip to content

Conversation

@DT-art1
Copy link

@DT-art1 DT-art1 commented Nov 8, 2025

Description

This PR adds support for selecting the byte order when converting RGB565 input to RGB888 in the JPEG encoder. Previously, the encoder always assumed big-endian (MSB-first) RGB565 pixel ordering. This matches most ESP32 camera driver outputs, but does not match some custom frame pipelines and external RGB sources, which instead produce little-endian RGB565.

To support both cases, this PR introduces:

void jpgSetRgb565BE(bool enable);

  • true → Big-endian RGB565 (default, existing behavior)
  • false → Little-endian RGB565

No existing behavior is changed unless the new function is explicitly used.

Changes

  • Adds jpgSetRgb565BE(bool) function
  • Adds internal rgb565_big_endian state flag (default true)
  • Updates convert_line_format() to select byte-order at runtime
  • No performance impact.

Related

Testing

  • Verified BE → unchanged output.
  • Verified LE → correct color output in pipelines producing LE RGB565 frames.

Checklist

Before submitting a Pull Request, please ensure the following:

  • 🚨 This PR does not introduce breaking changes.
  • All CI checks (GH Actions) pass.
  • Documentation is updated as needed.
  • Tests are updated or added as necessary.
  • Code is well-commented, especially in complex areas.
  • Git history is clean — commits are squashed to the minimum necessary.

Adds `jpgSetRgb565BE(bool)` to allow selecting byte order when
converting RGB565 input to RGB888 during JPEG encoding. The previous
behavior (big-endian MSB-first) is preserved as the default. This
improves compatibility with systems and pipelines producing
little-endian RGB565 buffers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant