Files
MetaCrate/crates/libremetaverse-openjpeg/README.md
Chili Palmer 16501f2331
Some checks failed
JPEG 2000 feature / linux (push) Has been cancelled
JPEG 2000 feature / macos (push) Has been cancelled
JPEG 2000 feature / windows (push) Has been cancelled
Implement optional JPEG2000 codec adapter (#40)
2026-08-09 03:42:18 +00:00

39 lines
2.0 KiB
Markdown

# MetaCrate OpenJPEG adapter
This private crate is the unsafe implementation boundary for MetaCrate's
optional `jpeg2000` feature. Its public surface is safe Rust: native handles,
callbacks, and OpenJPEG image structures never cross into the imaging API.
The adapter uses checked arithmetic and bounded memory streams, validates
header dimensions and component counts before decoded sample-plane allocation,
and copies decoded samples into owned Rust vectors.
## Native prerequisite
OpenJPEG **2.5.4 or newer** is required. Versions 2.5.1 through 2.5.3 are not
accepted because they are affected by CVE-2025-54874. No bindgen or libclang
installation is needed; the crate contains the minimal public ABI declarations
used by the adapter.
- Linux and other Unix targets: install OpenJPEG development headers/libraries
and `pkg-config`; `pkg-config --modversion libopenjp2` must report 2.5.4 or
newer.
- macOS: install `openjpeg` and `pkg-config` (for example with Homebrew). This
is the same system-library path used on Linux; no Apple-only API is used.
- Windows MSVC: install `openjpeg` with vcpkg and expose `VCPKG_ROOT` to Cargo.
Use the triplet matching the Rust target and deploy the resulting OpenJPEG
DLL beside the application or on its normal DLL search path when using a
dynamic triplet.
Enable the adapter with `--features jpeg2000` on either
`libremetaverse-imaging` or the umbrella `libremetaverse` crate. Without that
feature, neither the build script nor native library discovery runs.
## License and redistribution
OpenJPEG is BSD-2-Clause licensed. MetaCrate discovers an installation supplied
by the builder and does not redistribute OpenJPEG source or binaries. A product
that redistributes an OpenJPEG shared or static library must also satisfy the
OpenJPEG license's copyright and notice requirements. The ABI declarations in
this crate follow OpenJPEG's public `openjpeg.h`; MetaCrate's adapter code is
licensed under the repository's BSD-3-Clause license.