Skip to content

jpeg: add optimized baseline encoder - #1298

Open
dylanmtaylor wants to merge 3 commits into
storytold:mainfrom
dylanmtaylor:codex/jpeg-baseline-encoder
Open

dylanmtaylor wants to merge 3 commits into
storytold:mainfrom
dylanmtaylor:codex/jpeg-baseline-encoder

Conversation

@dylanmtaylor

@dylanmtaylor dylanmtaylor commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Add a reusable 8-bit baseline JPEG encoder to craft-jpeg with optimized per-image Huffman tables.
  • Support grayscale and YCbCr 4:4:4, 4:2:2, and 4:2:0 sampling, including odd image dimensions; RGBA input ignores alpha.
  • Expose a checked API that rejects malformed dimensions, insufficient sample data, invalid APP markers, and oversized APP payloads.
  • Keep Rayon optional through the parallel feature.
  • Add independent jpeg-decoder and zune-jpeg oracle tests, quantization/Huffman tests, and byte-pinned regressions for the existing LightCraft output modes.

Validation

  • cargo fmt --all -- --check
  • cargo clippy --locked -j2 -p craft-jpeg --all-targets --features parallel -- -D warnings
  • cargo test --locked -j2 -p craft-jpeg --features parallel

The full craft-libs workspace gate has not been run locally; hosted checks are requested through this PR. After merging current main containing #1276 (41fb2275), the refreshed tree passed the full craft-jpeg suite both with and without parallel: 42 unit, 6 conformance, 2 mutation and 2 doctests in each run.

@coderabbitai

coderabbitai Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 29 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 41fb227 and 55901e1.

Files ignored due to path filters: 1

  • Cargo.lock is excluded by !**/*.lock
Files selected for processing: 3

  • crates/jpeg/Cargo.toml
  • crates/jpeg/src/encode.rs
  • crates/jpeg/src/lib.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@dylanmtaylor
dylanmtaylor marked this pull request as ready for review November 14, 2026 11:07
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