# CUDA JPEG2000 Rust

Canonical page: https://frames-sg.com/j2k/cuda-jpeg2000-rust/

J2K provides NVIDIA CUDA acceleration for supported JPEG 2000 and HTJ2K device-output and encode-stage routes, plus supported coefficient-domain stages of JPEG-to-HTJ2K transcode workflows.

The CUDA kernels are written in Rust and compiled with cuda-oxide.

## Crates

- `j2k-cuda` exposes CUDA-backed JPEG 2000 and HTJ2K decode and encode-stage APIs: `cargo add j2k-cuda --features cuda-runtime`.
- `j2k-jpeg-cuda` provides CUDA device-output integration for supported JPEG decode surfaces, plus baseline and lossless JPEG encode from CUDA buffers: `cargo add j2k-jpeg-cuda --features cuda-runtime`.
- `j2k-transcode-cuda` accelerates supported coefficient-domain stages of JPEG-to-HTJ2K transcode: `cargo add j2k-transcode-cuda --features cuda-runtime`.

Packetization remains outside the accelerated transform stages. `cuda-runtime` exposes CUDA Driver API dispatch. Product CUDA Oxide PTX is built only on supported Linux cuda-oxide hosts. CUDA validation and benchmark hosts can set `J2K_REQUIRE_CUDA_OXIDE_BUILD=1` so placeholder PTX fails the build.

Explicit CUDA requests return an unsupported-request error for shapes without a CUDA route. `BackendRequest::Auto` keeps those shapes on the CPU. Device decodes of signed grayscale and color sources follow the CPU's sample conversion. The [support matrix](https://github.com/frames-sg/j2k/blob/main/docs/public-support.md) is authoritative for current coverage.

## Related resources

- [GPU acceleration overview](https://frames-sg.com/j2k/gpu-jpeg2000-rust/)
- [J2K CUDA API documentation](https://docs.rs/j2k-cuda)
- [Benchmark methodology and evidence](https://github.com/frames-sg/j2k/blob/main/docs/benchmark-evidence.md)
- [Source repository](https://github.com/frames-sg/j2k)
