Metal JPEG2000 Rust

Metal JPEG2000 Rust

J2K provides Apple Metal backends for supported JPEG 2000 / HTJ2K device-output and encode-stage paths, plus supported coefficient-domain stages of JPEG-to-HTJ2K transcode workflows on macOS.

Release status: See GitHub Releases and crates.io for the current version.

Expert API: The Metal crates use retained objc2-metal protocol objects directly and no longer depend on metal-rs. This is an intentional 0.9 breaking change; see the 0.9.0 release notes.

Metal JPEG2000 Rust pipeline

Codec backend

j2k-metal exposes Apple Metal-backed JPEG 2000 / HTJ2K decode and encode-stage APIs.

cargo add j2k-metal

JPEG input

j2k-jpeg-metal decodes every JPEG the CPU decoder supports into Metal memory, and encodes baseline and lossless JPEG from Metal buffers.

cargo add j2k-jpeg-metal

Transcode backend

j2k-transcode-metal accelerates supported coefficient-domain stages of JPEG-to-HTJ2K transcode on macOS; packetization remains outside those transform stages.

cargo add j2k-transcode-metal

Supported shape policy

Metal covers selected shapes. Explicit Metal requests return an unsupported-request error for other shapes.

The Metal backends support the same formats as the main crate: JPEG 2000 Part 1, JP2 files, HTJ2K Part 15, and JPH files. Shapes Metal does not support, or was not measured to speed up, run on the CPU. Device decodes of signed grayscale and color sources follow the CPU's sample conversion.

Benchmark results, with the hardware and commands used, are in the J2K Book.