Expand description
Lossless codec backends.
§Byte-oriented by design
Encode and decode take and produce raw sample bytes in the source file’s own byte
order, and write through a Write. Materialising an image as Vec<u16> merely to
change endianness duplicates the entire frame — ~300 MB on a 51MP file, twice per
round trip.
§Why JPEG XL
Measured on real 16-bit files, not chosen by reputation:
zstd -19reaches only 0.72 on a Bayer mosaic; LZ looks for repeated byte sequences and photographic data has 2D correlation instead.- AVIF and HEIC cannot participate at all — AV1 tops out at 12 bits per sample.
- PNG handles 16-bit but is well behind JXL’s modular mode.
libjxl is vendored, so the binary links libjxl.a statically and depends on nothing
beyond the platform C/C++ runtime. That also pins the codec version, which keeps
benchmarks comparable over time instead of shifting under someone’s package upgrade.
§Effort is non-monotonic
Default is 4, not 9. Measured: on Bayer planes effort 7 encoded larger than 4 and 3.8x slower; on a 51MP RGB frame effort 9 was larger than 7 and 36x slower than 4. Do not raise the default without measuring on both CFA and RGB content.
Structs§
- Jxl
- JPEG XL via vendored libjxl, in process.
Enums§
- Channels
- Depth
- Bits per sample. Real files mix depths — a 3FR holds a 16-bit sensor mosaic and an 8-bit embedded preview — so this cannot be assumed away.
- Error
Traits§
- Codec
- A lossless image codec operating on raw sample bytes.