packJPG v4.0 — cross-component lazy prediction
What's new in v4.0
packJPG v4.0 introduces a format change (version byte 0x28 / 40) that adds cross-component adaptation to the PJG coder: when encoding the chroma components (Cb/Cr) of 4:4:4 JPEGs, the bit-length of the co-located luma (Y) coefficient is folded into the arithmetic model context. This tightens the prediction in exactly the frames where chroma is most correlated with luma (portraits, text, sharp diagonals) and delivers a measurable ratio win on photographic corpora.
A -legacy flag is provided to emit v3.1d-compatible PJGs for interoperability. The decoder auto-detects the version byte, so all existing v3.1d archives decompress without any user action.
Highlights
- Better compression: −0.532 % on a 151-JPEG mixed corpus; up to −5 % on 4:4:4 photographic images. Subsampled (4:2:0 / 4:2:2) files are byte-identical to v3.1d by design
- Parallel encode/decode (
-sfth): 3-worker pipeline (Y/Cb/Cr), unchanged encode speed on 4:2:0, faster on corpora with many files (-th4) - Backward-compatible decoder: v4.0 reads both v4.0 and v3.1d PJG files. v3.1d cannot read v4.0 files — use
-legacyduring the transition -legacyflag: emit v3.1d-format output from v4.0 encoder (byte-identical to v3.1d)- Fuzzer harness:
source/test/pjg_decode_fuzzer.cpp— libFuzzer + ASan + UBSan; 15-min campaign, 0 crashes - LTO build (
-flto=thinon clang): ~8 % encode speedup at no ratio cost - Windows XP: v4.0 is the last feature release for XP. Future XP releases are bugfix-only (v4.0a, v4.0b, …)
Validation
| Check | Result |
|---|---|
| Round-trip (202 JPGs) | 283 / 283 PASS, 0 fail |
-legacy round-trip |
151 / 151 PASS |
MT stress (-th8, 50 iters × 151 files) |
393 / 393 OK |
| ThreadSanitizer (4 threads × 10 iters) | 0 data races |
| libFuzzer + ASan + UBSan | 0 crashes, 0 sanitizer reports |
Incompatibility notice
PJG files produced by v4.0 cannot be decoded by packJPG v3.1d or earlier. Use -legacy if downstream consumers have not been upgraded yet. This is the first intentional format break since v2.0 (2007).
Downloads
| File | Platform |
|---|---|
packJPG_linux_x64 |
Linux x86-64 (generic) |
packJPG_linux_x64_native |
Linux x86-64 (optimized for build host — do not distribute) |
packJPG_win_x64.exe |
Windows x86-64 (Vista+) |
packJPG_win_x86.exe |
Windows x86 32-bit (Vista+) |
packJPG_win_xp.exe |
Windows XP 32-bit |