Skip to content

Conversation

@DT-art1
Copy link

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

Description

This PR adds support for configuring the default chroma subsampling mode used by the JPEG encoder.
Up until now, the encoder has always used H2V2 (4:2:0) subsampling internally.
For projects that benefit from higher chroma detail (e.g., thermal imaging, graphics, UI elements), it is useful to be able to select 4:2:2 or 4:4:4 instead.

What’s Added

  • chroma_t enum defining available chroma subsampling modes:

    • CHROMA_444 (4:4:4)
    • CHROMA_422 (4:2:2)
    • CHROMA_420 (4:2:0)
  • jpgSetChroma(chroma_t chroma) to set the global default encoder mode.

  • The encoder now uses default_subsampling instead of a hardcoded subsampling value.
    The existing default behavior (H2V2 / CHROMA_420) remains unchanged unless the user calls jpgSetChroma().

Example Usage

jpgSetChroma(CHROMA_444);  // Use full chroma resolution (higher quality)

Related

Testing


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.

This introduces a new `chroma_t` enum and the function `jpgSetChroma()`
to select the default chroma subsampling (4:4:4, 4:2:2, 4:2:0) used by
the JPEG encoder. This avoids changing existing function signatures and
allows globally configurable encoder behavior. The previous default
(H2V2 / 4:2:0) remains unchanged unless overridden.
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