#[non_exhaustive]pub struct DecodeOptions {
pub max_width: Option<u32>,
pub max_height: Option<u32>,
pub max_pixels: Option<u64>,
pub max_bytes: Option<u64>,
pub strict: bool,
pub tone_mapped: bool,
pub reference_white_nits: f64,
pub layer: Option<u16>,
pub threads: Option<usize>,
}Expand description
Bounds and switches for crate::decode_with. The limits are
checked against the header before any pixel allocation and reported
as Error::LimitExceeded; None means unlimited.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.max_width: Option<u32>Refuse a picture wider than this (default Some(16384), the
largest AV1 coded extent this crate composes).
max_height: Option<u32>Refuse a picture taller than this (default Some(16384)).
max_pixels: Option<u64>Refuse a picture — or any derived canvas on the way to it —
with more pixels than this (default Some(1 << 28)).
max_bytes: Option<u64>Refuse an input longer than this many bytes (default
Some(1 << 30), 1 GiB).
strict: boolStrict conformance: the ftyp must declare an AVIF brand
(avif / avis / avio; a HEIF-structural-only brand set is
refused) and a file claiming mif1 must carry every HEIF
§10.2.1.1 mandatory box. Default false: the lenient reading
this crate has always applied.
tone_mapped: boolApply the gain map of a tmap alternative (HEIF Amd 1
§6.6.2.4, ISO 21496-1): the reconstructed HDR rendition in the
tmap item’s own colour instead of the base image. Default
false — the base, what readers without tone-map support show.
reference_white_nits: f64HDR reference white (cd/m²) for a PQ-coded reconstruction; default 203.
layer: Option<u16>Render this spatial layer of a layered primary item instead of
the file’s lsel choice (av1-avif §2.3.2.2); None honours the
file.
threads: Option<usize>Worker budget for the AV1 decode of every coded item / sample
(the ExecutionContext handed to oxideav-av1, which walks a
multi-tile intra frame tile-parallel and runs its post-filters
by row band — byte-identical to the serial decode at any
budget). None or Some(1) = serial, the default.
Implementations§
Source§impl DecodeOptions
impl DecodeOptions
Sourcepub fn with_max_width(self, max_width: Option<u32>) -> Self
pub fn with_max_width(self, max_width: Option<u32>) -> Self
Setter: replace max_width (None = unlimited).
Sourcepub fn with_max_height(self, max_height: Option<u32>) -> Self
pub fn with_max_height(self, max_height: Option<u32>) -> Self
Setter: replace max_height (None = unlimited).
Sourcepub fn with_max_pixels(self, max_pixels: Option<u64>) -> Self
pub fn with_max_pixels(self, max_pixels: Option<u64>) -> Self
Setter: replace max_pixels (None = unlimited).
Sourcepub fn with_max_bytes(self, max_bytes: Option<u64>) -> Self
pub fn with_max_bytes(self, max_bytes: Option<u64>) -> Self
Setter: replace max_bytes (None = unlimited).
Sourcepub fn with_strict(self, strict: bool) -> Self
pub fn with_strict(self, strict: bool) -> Self
Setter: replace strict.
Sourcepub fn with_tone_mapped(self, tone_mapped: bool) -> Self
pub fn with_tone_mapped(self, tone_mapped: bool) -> Self
Setter: replace tone_mapped.
Sourcepub fn with_reference_white_nits(self, reference_white_nits: f64) -> Self
pub fn with_reference_white_nits(self, reference_white_nits: f64) -> Self
Setter: replace reference_white_nits.
Sourcepub fn with_layer(self, layer: Option<u16>) -> Self
pub fn with_layer(self, layer: Option<u16>) -> Self
Setter: replace layer.
Sourcepub fn with_threads(self, threads: Option<usize>) -> Self
pub fn with_threads(self, threads: Option<usize>) -> Self
Setter: replace threads (None / Some(1) = serial).
Sourcepub fn worker_count(&self) -> usize
pub fn worker_count(&self) -> usize
The worker budget as a count (threads, at least 1).
Sourcepub fn check_bytes(&self, len: usize) -> Result<()>
pub fn check_bytes(&self, len: usize) -> Result<()>
Check an input length against max_bytes
(Error::LimitExceeded when over).
Sourcepub fn check_dims(&self, width: u32, height: u32) -> Result<()>
pub fn check_dims(&self, width: u32, height: u32) -> Result<()>
Check a picture’s extents against max_width / max_height /
max_pixels (Error::LimitExceeded when over).