Skip to main content

Crate j2k

Crate j2k 

Source
Expand description

JPEG 2000 / HTJ2K codec APIs for the Rust programming language, including inspect, decode, encode, recode, and GPU-aware backend dispatch.

This is the public j2k facade crate. CPU JPEG 2000 / HTJ2K decode and encode APIs live here, while CUDA and Apple Metal GPU adapters use the backend traits and encode-stage contracts re-exported by this crate.

Re-exports§

pub use context::J2kContext;
pub use error::J2kError;
pub use scratch::J2kScratchPool;
pub use view::J2kCodec;
pub use view::J2kDecoder;
pub use view::J2kRowDecodeOptions;
pub use view::J2kView;

Modules§

adapter
Adapter-facing planning APIs shared with GPU crates.
context
Reusable JPEG 2000 decode context.
error
JPEG 2000 error type.
scratch
Caller-owned JPEG 2000 scratch pool.
view
Borrowed view and decoder entry points.

Structs§

DecodeOutcome
Successful decode metadata plus non-fatal warnings.
DecoderContext
Wrapper that owns codec context state for repeated decode calls.
EncodedJ2k
Encoded JPEG 2000 lossless codestream and encode metadata.
EncodedLossyJ2k
Encoded JPEG 2000 lossy codestream and encode metadata.
J2kLosslessEncodeOptions
Options controlling JPEG 2000 lossless encoding.
J2kLosslessSamples
Borrowed interleaved samples and image geometry for lossless encoding.
J2kLossyEncodeOptions
Options controlling stable lossy JPEG 2000 encoding.
J2kLossyEncodeReport
Metrics reported by stable lossy JPEG 2000 encoding.
J2kLossySamples
Borrowed interleaved samples and image geometry for lossy encoding.
J2kQualityLayer
One cumulative lossy quality layer request.
J2kToHtj2kOptions
Options for classic JPEG 2000 reversible 5/3 to HTJ2K lossless recoding.
J2kToHtj2kReport
Metadata describing a J2K/JP2 to HTJ2K recode.
PassthroughCandidate
A borrowed compressed frame/tile that may be copied unchanged.
PassthroughRequirements
Destination requirements for copying compressed bytes unchanged.
Rect
Rectangle in source pixel coordinates.
ReencodedHtj2k
HTJ2K codestream bytes and recode metadata.
TileBatchOptions
Worker configuration for CPU tile batches.

Enums§

BackendKind
Runtime backend that executes codec work.
BackendRequest
Caller preference for backend selection.
BufferError
Buffer validation and copy errors.
CompressedPayloadKind
Encapsulation shape of the compressed bytes.
CompressedTransferSyntax
Compressed syntax carried by a source frame or accepted by a destination.
CpuDecodeParallelism
CPU parallelism policy for JPEG 2000 decode.
DecodeRowsError
Error wrapper used by row-streaming decode when either the codec or the caller-provided row sink can fail.
Downscale
Power-of-two downscale requested during decode.
EncodeBackendPreference
Backend preference for JPEG 2000 lossless encoding.
J2kBlockCodingMode
Supported code-block coding modes for the lossless encode facade.
J2kEncodeValidation
Validation policy for the lossless encode facade.
J2kMarkerSegment
Optional JPEG 2000 marker segment requested for lossy encode output.
J2kProgressionOrder
Supported JPEG 2000 progression orders for the lossless encode facade.
J2kRateTarget
Rate target for stable lossy JPEG 2000 encoding.
J2kToHtj2kMode
Recode path used for a J2K/JP2 to HTJ2K request.
PassthroughDecision
Result of a passthrough eligibility check.
PassthroughRejectReason
First reason a compressed payload was rejected for byte-preserving copy.
PixelFormat
Concrete interleaved pixel format.
ReversibleTransform
Reversible transform profile for lossless JPEG 2000 output.

Traits§

CodecError
Shared error classification used by facade traits.
ImageCodec
Common associated types shared by image codecs.
ImageDecode
Borrowed-image decode API for codecs that parse compressed bytes directly.
ImageDecodeRows
Row-streaming decode API for large images or stripe-oriented callers.
RowSink
Destination for row-streaming decode output.
TileBatchDecode
Stateless tile-batch decode helpers that reuse caller-owned context.

Functions§

decode_tile_into_in_context
One-shot parse-plus-decode of an independent J2K/HTJ2K tile into the caller’s buffer, reusing both caller-owned DecoderContext and caller-owned J2kScratchPool.
decode_tile_region_into_in_context
One-shot parse-plus-ROI-decode of an independent J2K/HTJ2K tile into the caller’s buffer, reusing both caller-owned DecoderContext and caller-owned J2kScratchPool.
decode_tile_region_scaled_into_in_context
One-shot parse-plus-ROI-scaled-decode of an independent J2K/HTJ2K tile into the caller’s buffer, reusing both caller-owned DecoderContext and caller-owned J2kScratchPool.
decode_tile_scaled_into_in_context
One-shot parse-plus-scaled-decode of an independent J2K/HTJ2K tile into the caller’s buffer, reusing both caller-owned DecoderContext and caller-owned J2kScratchPool.
decode_tiles_into
Decode independent J2K/HTJ2K tiles into caller-owned output buffers using a scoped CPU worker pool.
decode_tiles_region_into
Decode independent J2K/HTJ2K tile regions into caller-owned output buffers using a scoped CPU worker pool.
decode_tiles_region_scaled_into
Decode independent J2K/HTJ2K tile regions at reduced resolution into caller-owned output buffers using a scoped CPU worker pool.
decode_tiles_scaled_into
Decode independent J2K/HTJ2K tiles at reduced resolution into caller-owned output buffers using a scoped CPU worker pool.
encode_j2k_lossless
Encode interleaved samples into a raw JPEG 2000 lossless codestream.
encode_j2k_lossless_with_accelerator
Encode interleaved samples with an optional device encode-stage accelerator.
encode_j2k_lossy
Encode interleaved samples into a raw JPEG 2000 lossy codestream.
encode_j2k_lossy_with_accelerator
Encode interleaved lossy samples with an optional device encode-stage accelerator.
j2k_lossless_decomposition_levels
Return the default lossless decomposition level policy used by the facade.
j2k_lossless_decomposition_levels_for_options
Return the effective lossless decomposition level policy for encode options.
j2k_lossless_decomposition_levels_for_progression
Return the default lossless decomposition level policy for a progression.
recode_j2k_to_htj2k_lossless
Recode a classic JPEG 2000 reversible 5/3 J2K/JP2 input to lossless HTJ2K.

Type Aliases§

TileBatchError
Error returned by J2K CPU tile batches, annotated with the first failing tile index from the caller’s input order.
TileDecodeJob
One full-tile decode request for decode_tiles_into.
TileRegionDecodeJob
One ROI tile decode request for decode_tiles_region_into.
TileRegionScaledDecodeJob
One ROI+scaled tile decode request for decode_tiles_region_scaled_into.
TileScaledDecodeJob
One scaled tile decode request for decode_tiles_scaled_into.