GPU backends

GPU-Accelerated JPEG 2000 in Rust

J2K treats GPU acceleration as an optional backend layer: CPU decode and encode remain the correctness baseline, while CUDA and Apple Metal cover supported JPEG 2000 / HTJ2K paths.

Release status: See the changelog and crates.io for the current published version.

J2K CPU, CUDA, and Metal backend map

CPU baseline

Portable CPU paths remain available for general JPEG 2000 / HTJ2K application code and for unsupported device shapes.

CUDA

j2k-cuda, j2k-jpeg-cuda, and j2k-transcode-cuda provide J2K's own CUDA kernels and CUDA device surfaces for supported shapes.

Metal

j2k-metal, j2k-jpeg-metal, and j2k-transcode-metal provide Apple Metal paths on macOS for the same formats.

Backend selection

BackendRequest::Auto uses the CPU for shapes the GPU does not support or was not measured to speed up. Explicit CUDA or Metal requests return an error for unsupported shapes.

The GPU backends support the same formats as the CPU path: JPEG 2000 Part 1 codestreams, JP2 files, HTJ2K Part 15 codestreams, and JPH files. They speed up selected shapes within those formats; not every stage or shape runs on the GPU.

Use docs/public-support.md for codec support. Benchmark results are in docs/benchmark-evidence.md; published comparisons need an external benchmark bundle with publication_eligible=true.