Skip to main content

DecodeOptions

Struct DecodeOptions 

Source
#[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
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional 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: bool

Strict 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: bool

Apply 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: f64

HDR 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

Source

pub fn new() -> Self

The defaults (see the field docs).

Source

pub fn with_max_width(self, max_width: Option<u32>) -> Self

Setter: replace max_width (None = unlimited).

Source

pub fn with_max_height(self, max_height: Option<u32>) -> Self

Setter: replace max_height (None = unlimited).

Source

pub fn with_max_pixels(self, max_pixels: Option<u64>) -> Self

Setter: replace max_pixels (None = unlimited).

Source

pub fn with_max_bytes(self, max_bytes: Option<u64>) -> Self

Setter: replace max_bytes (None = unlimited).

Source

pub fn with_strict(self, strict: bool) -> Self

Setter: replace strict.

Source

pub fn with_tone_mapped(self, tone_mapped: bool) -> Self

Setter: replace tone_mapped.

Source

pub fn with_reference_white_nits(self, reference_white_nits: f64) -> Self

Setter: replace reference_white_nits.

Source

pub fn with_layer(self, layer: Option<u16>) -> Self

Setter: replace layer.

Source

pub fn with_threads(self, threads: Option<usize>) -> Self

Setter: replace threads (None / Some(1) = serial).

Source

pub fn worker_count(&self) -> usize

The worker budget as a count (threads, at least 1).

Source

pub fn check_bytes(&self, len: usize) -> Result<()>

Check an input length against max_bytes (Error::LimitExceeded when over).

Source

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).

Trait Implementations§

Source§

impl Clone for DecodeOptions

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for DecodeOptions

Source§

impl Debug for DecodeOptions

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for DecodeOptions

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for DecodeOptions

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for DecodeOptions

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.