Memory safety
Safe public Rust APIs
Applications use a safe Rust API. Unsafe implementation code is limited to documented FFI, GPU, SIMD, allocation, and pointer or buffer boundaries.
Safe Rust APIs / Optional CUDA + Metal
Safe public Rust APIs for JPEG 2000 Part 1 and HTJ2K Part 15 inspection, decode, encode, recode, and coefficient-domain JPEG-to-HTJ2K transcode workflows.
CPU is the correctness baseline. CUDA and Apple Metal backends accelerate supported paths.
Release statusSee the changelog and crates.io for the current published version.
01 / Public surface
Memory safety
Applications use a safe Rust API. Unsafe implementation code is limited to documented FFI, GPU, SIMD, allocation, and pointer or buffer boundaries.
Routing
Applications keep a portable CPU path and can send supported workloads to CUDA or Apple Metal.
Licensing
The workspace is dual-licensed for use in open-source and commercial projects.
02 / Architecture
J2K/JP2 and HTJ2K/JPH still images are handled by one crate. The CPU path is the reference implementation; CUDA and Metal speed up the shapes they support.
Auto returns CPU output when no GPU path is available, supported, or measured faster for the shape. Explicit CUDA and Metal requests never fall back.03 / Supported formats
Exact coverage is maintained in the public support matrix.
Raw J2K/J2C codestream parse, inspect, decode, encode, ROI, progression, tile-part, packet-marker, signed, high-bit, and component-plane surfaces are tracked by the public support matrix.
HT cleanup and refinement decode/encode, quality layers, rate behavior, raw HT codestreams, and JPH still-image wrapping are in scope.
JP2 and JPH still-image metadata is supported. JPX / JPEG 2000 Part 2 extensions are not.
The full support table is in docs/public-support.md. Benchmark results are in docs/benchmark-evidence.md; comparisons with other codecs use pinned external corpora.
04 / Install
Most applications should start with the public facade crate. The CLI is useful for inspection and conservative JPEG-to-HTJ2K transcode smoke tests.
$ cargo add j2k
Safe public APIs for inspection, decode, encode, recode, JP2, and JPH.
$ cargo install j2k-cli $ j2k inspect input.jp2 $ j2k transcode input.jpg output.j2k \ --htj2k --lossless-53
05 / Workspace
| Crate | Role | Layer |
|---|---|---|
j2k | Public API for JPEG 2000 Part 1 / HTJ2K Part 15 inspection, decode, encode, recode, JP2, and JPH. | Public |
j2k-cuda | NVIDIA CUDA backend for supported JPEG 2000 and HTJ2K paths. | Backend |
j2k-metal | Apple Metal backend for supported macOS GPU paths. | Backend |
j2k-transcode | JPEG-to-HTJ2K coefficient-domain transcode primitives and shared transcode contracts. | Core |
j2k-cli | Command-line inspection and JPEG-to-HTJ2K transcode smoke tests. | Tool |
06 / Documentation