Metal JPEG2000 Rust

J2K provides Apple Metal acceleration 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 the changelog and crates.io for the current published 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 migration notes.

Metal JPEG2000 Rust pipeline

Codec acceleration

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 acceleration

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.

Metal acceleration covers supported operations on JPEG 2000 Part 1 codestreams, JP2 files, HTJ2K Part 15 codestreams and JPH files. Automatic selection uses the CPU for inputs without a suitable or measured-faster Metal route; explicit Metal requests return an error for unsupported inputs. Device decodes of signed grayscale and color sources follow the CPU's sample conversion.

Benchmark results are in docs/benchmark-evidence.md. Published Metal numbers list the hardware, commands, shapes, skipped rows, and publication_eligible=true from the benchmark tooling.