Expand description
C ABI for the Rust OpenJPEG port.
This crate holds the #[no_mangle]/#[repr(C)] surface that produces the
drop-in libopenjp2.a/libopenjp2.so. The safe Rust API lives in the
openjp2 core crate.
Re-exports§
pub use codec::Codec;
Modules§
- codec
- The merged
opj_codec_t*handle (the core split itsCodecintoDecoder/Encoder; this crate keeps the single-pointer contract). The merged codec handle behind the singleopj_codec_t*C-ABI pointer contract. - consts
- cstr_
info - The C-ABI codestream-info mirrors (v1 index and v2 header info) plus the builders that marshal the core’s safe owned structures into them.
- image
- C-ABI image types (
opj_image,opj_image_comp) and the marshalling helpers that cross the boundary between them and the coreCoreImage. - openjpeg
- params
- The C-ABI encoder parameters mirror (
opj_cparameters_t). The core uses the safe ownedopenjp2_core::EncoderParameters; this module owns the#[repr(C)]struct C callers fill in, plus the marshalling setters.
Structs§
- Codestream
Index - Owned codestream index (marker/tile-part/packet layout of a decoded
codestream;
Decoder::cstr_index). - Codestream
Tile Index - One tile’s codestream-index entry.
- Core
Image - A decoded (or to-be-encoded) image: geometry, colour space, components and the ICC profile.
- Core
Image Comp - One image component: geometry, sample format, and the raw sample data.
- Cstr
Comp Info V2 - Per-component tccp info of the codestream header.
- Cstr
Info V2 - Safe, owned codestream info v2 (the C mirror is built by the capi crate).
- Cstr
Tccp Info V2 - Per-component default-tile coding parameters of the codestream header.
- Decode
Area - Rectangular decode area in image coordinates (
x0 <= x < x1). - Decode
Limits - Optional resource limits for decoding untrusted input.
- Decode
Parameters - Decoder settings, built with the fluent builder pattern.
- Dump
Image - Header/decode driver for the codestream index/info and the dump text
(the jpeg2k
DumpImageequivalent). - Encode
Parameters - Encoder settings (builder over the low-level
EncoderParameters). - Encoder
Parameters - Safe, owned encoder parameters. The C ABI mirror (
EncoderParameters) is marshalled into this by the capi crate; the tools build it directly. - Image
- A fully decoded JPEG 2000 image (owned pixel data).
- Stream
- Byte stream the codecs read from / write to (see the
streammodule for the constructors). - Tile
Info - Tile-part header summary returned by
Decoder::read_tile_header. - opj_
dparameters - opj_
image_ comptparm - opj_
marker_ info - opj_
packet_ info - opj_poc
- opj_
tp_ index
Enums§
- CODEC_
FORMAT - Supported codec
- COLOR_
SPACE - Supported image color spaces
- Color
Space - The colour space a codestream declares (the JP2
colr/COD value). - Error
- Errors returned by the safe API.
- ICCProfile
- A colour profile carried by a JP2
colrbox: either a raw ICC profile or a CIELab colour specification (36 bytes, seeCIE_LAB_BYTE_SIZE). - ICCProfile
Mut - Mutable borrowed view of an
ICCProfile. - ICCProfile
Ref - Borrowed view of an
ICCProfile. - J2KFormat
- Supported Jpeg 2000 formats.
- OPJ_
CODEC_ FORMAT - Supported codec
- OPJ_
COLOR_ SPACE - Supported image color spaces
- Progression
Order - Packet progression order (mirrors the C
ProgressionOrdervalues). Packet progression order (the COD marker’s progression field).
Constants§
- CIE_
LAB_ BYTE_ SIZE - The size in bytes of a CIELab colour specification inside the JP2
colrbox. - JP2_
RFC3745_ MAGIC - Magic bytes for JP2 RFC3745.
- OPJ_
CINEM A2K - OPJ_
CINEM A2K_ 24 - OPJ_
CINEM A2K_ 48 - OPJ_
CINEM A4K - OPJ_
CINEM A4K_ 24 - OPJ_
CPRL - OPJ_
LRCP - OPJ_MCT
- OPJ_OFF
- OPJ_
PCRL - OPJ_
PROG_ UNKNOWN - OPJ_
RLCP - OPJ_
RPCL - OPJ_
STD_ RSIZ
Functions§
- detect_
format - Detect Jpeg 2000 format from magic bytes.
- detect_
format_ from_ extension - Detect Jpeg 2000 format from file extension.
- detect_
format_ from_ extension_ os_ str - Detects the format from a file extension (
OsStrflavour). - detect_
format_ from_ file - Detects the format of a file (magic bytes, then extension).
- has_
thread_ support - Whether the build includes the
rayonfeature (the C-ABIhas_thread_supportreports this).
Type Aliases§
- CINEMA_
MODE - OPJ_
BOOL - OPJ_
BYTE - OPJ_
CINEMA_ MODE - OPJ_
FLOA T32 - OPJ_
INT32 - OPJ_
OFF_ T - OPJ_
PROG_ ORDER - OPJ_
RSIZ_ CAPABILITIES - OPJ_
SIZE_ T - OPJ_
UINT16 - OPJ_
UINT32 - OPJ_
UINT64 - PROG_
ORDER - RSIZ_
CAPABILITIES - Result
- The crate’s result alias (
Edefaults toError). - opj_
codec_ t - opj_
dparameters_ t - opj_
flag_ t - opj_
image_ cmptparm_ t - opj_
marker_ info_ t - opj_
packet_ info_ t - opj_
poc_ t - opj_
stream_ free_ user_ data_ fn - opj_
stream_ private_ t - The C stream handle type (the core’s
Stream). - opj_
stream_ read_ fn - opj_
stream_ seek_ fn - opj_
stream_ skip_ fn - opj_
stream_ t - opj_
stream_ write_ fn - opj_
tp_ index_ t