Skip to content

Add jbrd box support for JPEG reconstruction#590

Open
hjanuschka wants to merge 7 commits into
libjxl:mainfrom
hjanuschka:feature/jbrd-box-support
Open

Add jbrd box support for JPEG reconstruction#590
hjanuschka wants to merge 7 commits into
libjxl:mainfrom
hjanuschka:feature/jbrd-box-support

Conversation

@hjanuschka

@hjanuschka hjanuschka commented Dec 23, 2025

Copy link
Copy Markdown
Collaborator

Summary

  • Add bit-exact JPEG reconstruction from jbrd boxes, including Huffman tables, scans, marker order, and APP markers
  • Preserve and pipe VarDCT quantized coefficients through decode to reconstruction output
  • Use codestream quant tables, ICC data, and sampling factors when writing JPEG; handle subsampled component block grids
  • Feature is behind the jpeg-reconstruction flag and is off by default

@hjanuschka

Copy link
Copy Markdown
Collaborator Author

@veluca93 eventhough you dont want to merge it, it would be now feature complete, lets keep it around and mergeable in case you change your mind.

@hjanuschka hjanuschka force-pushed the feature/jbrd-box-support branch from 3f686ea to 3077a54 Compare December 26, 2025 19:15
@github-actions

github-actions Bot commented Dec 26, 2025

Copy link
Copy Markdown

Benchmark @ 30ebc6d

MULTI-FILE BENCHMARK RESULTS (4 files)
  CPU architecture: x86_64
  WARNING: System appears noisy: high system load (2.26). Results may be unreliable.
Statistics:
  Confidence:               99.0%
  Max relative error:        3.0%

Comparing: 90a2bb2a (Base) vs 45d6dc39 (PR)

File Base (MP/s) PR (MP/s) Δ%
bike.jxl 25.270 24.605 -2.63% ±2.8%
green_queen_modular_e3.jxl 7.918 7.870 -0.60% ±0.4%
green_queen_vardct_e3.jxl 23.329 23.318 -0.05% ±1.1%
sunset_logo.jxl 2.245 2.213 -1.45% ±0.6%

@zone117x

zone117x commented Feb 8, 2026

Copy link
Copy Markdown
Contributor

@hjanuschka @veluca93 are there any blockers on this PR? This is a useful feature that I would like to use.

I'm happy to help contribute if needed, although it looks like @hjanuschka is pretty on top of things :)

- Add JpegReconstructionData struct with all JPEG metadata needed for
  bit-exact reconstruction (quant tables, Huffman codes, scans, markers)
- Implement jbrd box detection and parsing in BoxParser
- Add jpeg module with parsing logic for jbrd box binary format
- Expose has_jpeg_reconstruction() and jpeg_reconstruction_data() via API

Note: Full JPEG reconstruction requires Brotli decompression of marker
data which is not yet implemented. This adds the data structures and
box detection infrastructure.
@hjanuschka hjanuschka force-pushed the feature/jbrd-box-support branch from 2d67bed to a8e437a Compare February 8, 2026 22:46
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.

2 participants