Repository navigation
J2K 0.14.0 publishes all 25 workspace crates and requires Rust 1.99.0. The shared kernel crates j2k-types and j2k-codec-math retain Rust 1.96 support. Python wheels now require CPython 3.11 or later.
Most Rust code builds unchanged. The reviewed API diff removes nothing apart from eight CUDA error fields now spelled Box<Self>, which callers build and match as before. Three changes can need an edit: struct literals of JpegToHtj2kOptions need the new precision field; decodes that exceed a memory or image-size limit fail with J2kError::ResourceLimit instead of J2kError::NativeDecode; and Metal Tier-1 device failures are Error::Decode and J2kError::Backend instead of Error::MetalKernel. Some outputs change bytes and some files that 0.13 accepted are now refused; the upgrade notes list every case.
Security: a JP2 with a crafted ICC profile could make decoding allocate memory quadratic in the profile's size, outside every decode limit (a 29 KB profile held about 200 MB). Upgrade if you decode untrusted files.
Lossless coding of 21- to 24-bit samples is now exact. It ran in f32, which holds the reversible transforms' values only through 20 bits, so such encodes could decode to other samples and lossless files from other encoders could decode a few code values off. They now use integers, as 25- to 38-bit samples already did, at 2 to 7 times the time and about 2.6 times the memory. 16-bit output of signed sources of at most 8 bits is two's complement on the CPU, Metal and CUDA, and 16-bit and 8-bit output of images deeper than 16 bits is clamped or quantized instead of holding bytes of the wider samples. HTJ2K Qfactor encodes at RGB qualities 1 through 36 no longer fail (#304). Several region, reduced-resolution and ROI cases that returned wrong samples are fixed, including irreversible ROI decodes, 33- to 38-bit colour-transformed images and reduced decodes that skipped packets by a too-short PLT length.
New in 0.14: J2kDecoder::region_decode_plan and PreparedImageOperation plan and decode regions at exact JPEG 2000 reductions on the CPU, Metal and CUDA; J2kDecodeControl gives one operation a memory limit, an output limit and cancellation; and decodes whose planes would exceed the decode budget stream their rows instead of failing. The C and C++ API now lives in this repository as crates/j2k-c, with relocatable libj2k packages for CMake and pkg-config. Python gains j2k.encode and j2k.inspect. j2k decode also runs as opj_decompress for IIIF servers such as Cantaloupe (docs/iiif.md). j2k-jpeg adds lossless MCU-aligned crops and windowed, quantized-only coefficient extraction (#308). Baseline JPEG encode, CUDA JPEG decode, the 9/7 JPEG-to-HTJ2K transcode and more GPU JPEG 2000 paths now match the CPU byte for byte.
Faster, measured end to end against the pre-release main: encodes to a size or bits-per-pixel target are 4 to 7 times as fast; Gray and high-bit-depth HTJ2K lossless encodes take 47-66% less time; Metal classic lossless decode of 4096 x 2048 RGB takes 48-70% less; and CPU JPEG decode takes 4-31% less in every baseline case measured. MetalBatchDecoder groups of 32 Aperio 33003 tiles take about 42% less time, 12.63 to 7.35 ms and 14.94 to 8.52 ms on the two OpenSlide test slides (#300).
Hosted validation and CUDA and Metal hardware validation passed for the tagged source. The release verifier checked the five attached T.803 reports: CPU on Linux x86-64, macOS arm64, and Windows x86-64, CUDA on an NVIDIA GeForce RTX 4070 SUPER, and Metal on an Apple M4. Each passes all 160 selected decoder cases with no skips, and their encoder checks pass. Both GPU reports have 81 hybrid cases and 79 CPU-only cases.
The public API comparison and review compare with 0.13.1.