Skip to main content

Crate zencodec

Crate zencodec 

Source
Expand description

Shared traits and types for zen* image codecs.

This crate defines the common API surface that all zen* codecs implement.

§Module organization

  • encode — encoder traits, dyn dispatch, output types
  • decode — decoder traits, streaming/animation decode, dyn dispatch, output types
  • Root — shared types used by both encode and decode paths

§Shared types (root)

§Re-exported crates

The enough crate is re-exported for cooperative cancellation (enough::Stop).

use enough::Stop;

Individual codecs (zenjpeg, zenwebp, zengif, zenavif) implement the encode and decode traits on their own config types. Format-specific methods live on the concrete types, not on the traits.

zencodecs provides multi-format dispatch and convenience entry points.

Re-exports§

pub use exif::Exif;
pub use exif::ExifPolicy;
pub use exif::Retention;
pub use exif::TextEncoding;
pub use gainmap::GainMapChannel;
pub use gainmap::GainMapDirection;
pub use gainmap::GainMapInfo;
pub use gainmap::GainMapParams;
pub use gainmap::GainMapPresence;
pub use gainmap::GainMapRender;
pub use gainmap::ISO_21496_1_PRIMARY_APP2_BODY;
pub use gainmap::ISO_21496_1_URN;
pub use gainmap::Iso21496Format;
pub use icc::icc_extract_cicp;Deprecated
pub use enough;
pub use whereat;

Modules§

decode
Decode traits, types, and configuration.
encode
Encode traits, types, and configuration.
estimate
Unified resource estimation for encode/decode operations.
exif
Structured EXIF/TIFF parsing, pruning, and serialization. Structured, borrowing EXIF/TIFF model: parse → inspect/prune → serialize.
gainmap
Cross-codec gain map types (ISO 21496-1). Cross-codec gain map types (ISO 21496-1).
helpers
Codec implementation helpers (not consumer API). Codec implementation helpers.
icc
Lightweight ICC profile inspection (tag extraction, no full parse). Lightweight ICC profile inspection.

Structs§

AnimationFrame
A composited full-canvas animation frame, borrowing the decoder’s canvas.
At
An error with location tracking - wraps any error type.
Cicp
CICP color description (ITU-T H.273).
CodecError
The error a zen codec returns: a coarse ErrorCategory for routing, the name of the originating codec, and (optionally) the codec’s own detailed error.
CodecIoKind
The kind of an I/O failure carried by ErrorCategory::Io.
ColorEmitFields
Mechanism fields behind ColorEmitPolicy::Custom.
ColorEmitPlan
A resolved plan for emitting an image’s color description on encode.
ContentLightLevel
HDR content light level metadata (CEA-861.3 / CTA-861-H).
Extensions
A type-map storing multiple independently-typed extension values.
ImageFormatDefinition
Describes an image format’s metadata, capabilities, and detection logic.
ImageFormatRegistry
A collection of ImageFormatDefinitions with lookup methods.
ImageInfo
Image metadata obtained from probing or decoding.
MasteringDisplay
Mastering display color volume metadata (SMPTE ST 2086).
Metadata
Owned image metadata for encode/decode roundtrip.
MetadataFields
Per-field metadata retention for MetadataPolicy::Custom.
OwnedAnimationFrame
A composited full-canvas animation frame with owned pixel data.
Resolution
Physical pixel resolution (DPI or pixels-per-unit).
ResourceLimits
Resource limits for encode/decode operations.
SourceColor
Source color description from the image file.
StopToken
Owned, clonable, type-erased stop token.
StreamOffset
A byte offset into the encoded input, for attaching to an error’s location trace as retrievable context.
Supplements
Supplemental content that accompanies the primary image(s).
Unstoppable
A Stop implementation that never stops (no cooperative cancellation).
Unsupported
Stub type for codecs that don’t support an operation.

Enums§

AllocPreference
Caller preference for how a codec sizes buffers from untrusted input: the fallible try_reserve path (graceful out-of-memory error) or the faster infallible vec! / Vec::with_capacity path (aborts on OOM).
CicpEmission
Whether CICP is emitted, behind ColorEmitPolicy::Custom.
ColorAuthority
Which color metadata a CMS should prefer when building transforms.
ColorEmitPolicy
How an image’s color description (ICC profile vs CICP code points) is emitted when encoding or transcoding — the obvious, intent-named knob.
ErrorCategory
Coarse, codec-agnostic classification of a codec error.
IccDisposition
What to do with the ICC profile channel for one encode.
IccRetention
How to treat the ICC profile when filtering Metadata.
ImageError
Image-bytes-origin failure kind — the payload of ErrorCategory::Image.
ImageFormat
Supported image formats.
ImageSequence
What kind of image sequence the file contains.
InternalKind
Which kind of ErrorCategory::Internal failure — a coarse split for telemetry/triage, not a replacement for the downcast-recoverable detail error (CodecErrorExt::find_cause, the At trace).
InvalidKind
Which caller-request “invalid” — the payload of RequestError::Invalid.
LimitExceeded
A resource limit was exceeded.
LimitKind
Which resource cap a LimitExceeded refers to, without the actual/max values. Carried by ResourceError::Limits (the payload of ErrorCategory::Resource) for routing; obtain it from LimitExceeded::kind.
MetadataPolicy
Field-level metadata retention policy applied by Metadata::filtered.
Orientation
Image orientation — the 8-element D4 dihedral group.
OrientationHint
How the decoder should handle orientation during decode.
PolicyKind
Which side of the encode/decode boundary a ErrorCategory::Policy rejection applies to — mirrors the crate’s existing DecodePolicy / EncodePolicy split, so a codec constructing the error already knows which one at the call site.
RequestError
Caller-request-origin failure kind — the payload of ErrorCategory::Request.
ResolutionUnit
Unit for Resolution values.
ResourceError
Resource-origin failure kind — the payload of ErrorCategory::Resource.
ThreadingPolicy
Threading policy for codec operations.
UnsupportedImageKind
Which image-bytes-origin “unsupported” — the payload of ImageError::Unsupported.
UnsupportedOperation
Identifies an operation that a codec does not support.

Traits§

CategorizedError
Declares a codec error’s coarse ErrorCategory.
CodecErrorExt
Extension trait for inspecting codec errors.
ErrorAtExt
Extension trait that allows calling .start_at() on error types.
ResultAtExt
Extension trait for adding location tracking to Result<T, At<E>>.
SourceEncodingDetails
Codec-agnostic interface for source encoding properties.

Functions§

find_cause
Walk an error’s source() chain to find a cause of type T.
resolve_color_emit
Reconcile a source’s color description against a target’s capabilities under a ColorEmitPolicy, returning what to emit.