Skip to main content

Crate openjp2

Crate openjp2 

Source
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 its Codec into Decoder/Encoder; this crate keeps the single-pointer contract). The merged codec handle behind the single opj_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 core CoreImage.
openjpeg
params
The C-ABI encoder parameters mirror (opj_cparameters_t). The core uses the safe owned openjp2_core::EncoderParameters; this module owns the #[repr(C)] struct C callers fill in, plus the marshalling setters.

Structs§

CodestreamIndex
Owned codestream index (marker/tile-part/packet layout of a decoded codestream; Decoder::cstr_index).
CodestreamTileIndex
One tile’s codestream-index entry.
CoreImage
A decoded (or to-be-encoded) image: geometry, colour space, components and the ICC profile.
CoreImageComp
One image component: geometry, sample format, and the raw sample data.
CstrCompInfoV2
Per-component tccp info of the codestream header.
CstrInfoV2
Safe, owned codestream info v2 (the C mirror is built by the capi crate).
CstrTccpInfoV2
Per-component default-tile coding parameters of the codestream header.
DecodeArea
Rectangular decode area in image coordinates (x0 <= x < x1).
DecodeLimits
Optional resource limits for decoding untrusted input.
DecodeParameters
Decoder settings, built with the fluent builder pattern.
DumpImage
Header/decode driver for the codestream index/info and the dump text (the jpeg2k DumpImage equivalent).
EncodeParameters
Encoder settings (builder over the low-level EncoderParameters).
EncoderParameters
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 stream module for the constructors).
TileInfo
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
ColorSpace
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 colr box: either a raw ICC profile or a CIELab colour specification (36 bytes, see CIE_LAB_BYTE_SIZE).
ICCProfileMut
Mutable borrowed view of an ICCProfile.
ICCProfileRef
Borrowed view of an ICCProfile.
J2KFormat
Supported Jpeg 2000 formats.
OPJ_CODEC_FORMAT
Supported codec
OPJ_COLOR_SPACE
Supported image color spaces
ProgressionOrder
Packet progression order (mirrors the C ProgressionOrder values). 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 colr box.
JP2_RFC3745_MAGIC
Magic bytes for JP2 RFC3745.
OPJ_CINEMA2K
OPJ_CINEMA2K_24
OPJ_CINEMA2K_48
OPJ_CINEMA4K
OPJ_CINEMA4K_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 (OsStr flavour).
detect_format_from_file
Detects the format of a file (magic bytes, then extension).
has_thread_support
Whether the build includes the rayon feature (the C-ABI has_thread_support reports this).

Type Aliases§

CINEMA_MODE
OPJ_BOOL
OPJ_BYTE
OPJ_CINEMA_MODE
OPJ_FLOAT32
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 (E defaults to Error).
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