feat(imaging): add pure-Rust JPEG 2000 backend (#109)
Some checks failed
CI / required (push) Failing after 3m18s

This commit is contained in:
2026-08-13 05:44:30 +00:00
parent 27c860c225
commit 0bab5b4c8d
28 changed files with 2770 additions and 109 deletions

View File

@@ -61,6 +61,7 @@ The currently available opt-in codec backends are:
| Capability | Feature | Build command | External prerequisite |
| --- | --- | --- | --- |
| Raw J2K and JP2 decoding/encoding through OpenJPEG | `libremetaverse/jpeg2000` | `cargo build -p libremetaverse --features jpeg2000` | OpenJPEG 2.5.4 or newer |
| Raw J2K and JP2 decoding/encoding in pure Rust | `libremetaverse/rust-j2k` | `cargo build -p libremetaverse --no-default-features --features rust-j2k` | none |
| BMP, GIF, ICO, JPEG, PNG, WBMP, and WebP decoding through Skia | `libremetaverse-imaging-skia/skia` | `cargo build -p libremetaverse-imaging-skia --features skia` | A matching rust-skia binary cache, or the documented native source-build tools |
| PCM to Ogg Vorbis encoding | `libremetaverse/vorbis` | `cargo build -p libremetaverse --features vorbis` | `vorbis_rs` 0.5.6 and its native encoder build prerequisites |
@@ -68,6 +69,7 @@ Run their focused test suites with:
```sh
cargo test -p libremetaverse-imaging --features jpeg2000
cargo test -p libremetaverse-imaging --no-default-features --features rust-j2k
cargo test -p libremetaverse-imaging-skia --features skia
cargo test -p libremetaverse --no-default-features --features vorbis
```
@@ -91,9 +93,10 @@ Deterministic task, socket, file, subscription, cancellation, and allocation
baselines are documented in the
[concurrency hardening guide](docs/concurrency-hardening.md).
An independent optional `rust-j2k` backend is planned but has not been
implemented yet. There is deliberately no enablement command for it today;
the existing `jpeg2000` feature always selects the OpenJPEG backend.
The independent `rust-j2k` backend is off by default and never enables the
native OpenJPEG adapter. Its explicit `RustJ2kCodec` preserves the existing
`J2kCodec` meaning when both features are enabled. Use the combined feature set
to run backend-interoperability tests without changing application selection.
`tests/upstream-tests.json` is the machine-readable NUnit parity catalog.
Translated tests live in hand-written Rust files with the `parity-case` marker
@@ -212,6 +215,12 @@ including its alpha-only and opaque-alpha substitutions. See
[`crates/libremetaverse-openjpeg/README.md`](crates/libremetaverse-openjpeg/README.md)
for OpenJPEG prerequisites, licensing, and deployment details. Default builds
do not discover or link OpenJPEG.
The independent opt-in `rust-j2k` feature provides the same bounded public
options through `RustJ2kCodec`, backed by the exact pure-Rust `j2k` 0.8.1
release. It supports J2K and JP2, reversible and irreversible encoding,
native component precision/signedness/order, reduced-resolution and progressive
quality-layer decoding, and strict or explicitly permissive truncation handling.
It has no C/C++ codec, CMake, pkg-config, vcpkg, CLR, or platform-specific API.
The optional Skia adapter decodes BMP, GIF, ICO, JPEG, PNG, WBMP, and WebP into
the same checked planar representation. Its `skia` feature uses pinned
rust-skia binary-cache configurations on macOS, Linux, and Windows, normalizes