blad-codec 0.0.1

Lossless image codec backends for blad
Documentation

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 -19 reaches 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.