Skip to main content

Settings

Struct Settings 

Source
#[non_exhaustive]
pub struct Settings { pub threads: u32, pub apply_grain: bool, pub frame_size_limit: u32, pub all_layers: bool, pub operating_point: u8, pub output_invisible_frames: bool, pub inloop_filters: InloopFilters, pub decode_frame_type: DecodeFrameType, pub max_frame_delay: u32, pub strict_std_compliance: bool, pub cpu_level: CpuLevel, }
Expand description

Decoder configuration settings

Use Settings::default() or struct update syntax (Settings { threads: 4, ..Default::default() }) to construct. New fields may be added in minor releases.

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.
§threads: u32

Number of threads for decoding

  • 0 = auto-detect (enables frame threading for better performance but asynchronous behavior)
  • 1 = single-threaded (default, simpler synchronous behavior)
  • 2+ = multi-threaded with frame threading

With frame threading enabled (threads >= 2 or threads == 0), decode() may return None even when complete frame data is provided, as frames are processed asynchronously. Call decode() or flush() multiple times to drain buffered frames.

Note: Multithreading requires the unchecked feature. Without it, the decoder silently falls back to single-threaded to prevent runtime panics from DisjointMut overlap detection on stride gap bytes.

§apply_grain: bool

Apply film grain synthesis during decoding

§frame_size_limit: u32

Maximum frame size in total pixels, i.e. width * height (0 = unlimited)

Default: 35,389,440 (8K UHD: 8192 × 4320). Set to 0 to disable the limit. Frames exceeding this limit are rejected during OBU parsing with Err(InvalidData).

§all_layers: bool

Decode all layers or just the selected operating point

§operating_point: u8

Operating point to decode (0-31)

§output_invisible_frames: bool

Output invisible frames (frames not meant for display)

§inloop_filters: InloopFilters

Inloop filters to apply during decoding

§decode_frame_type: DecodeFrameType

Which frame types to decode

§max_frame_delay: u32

Maximum number of frames in flight for frame threading.

  • 0 = auto (default, derived from thread count: min(sqrt(threads), 8))
  • 1 = no frame threading (tile parallelism only — ideal for still images)
  • 2+ = up to N frames decoded in parallel

For still image formats (AVIF, HEIC), set this to 1 to get tile-level parallelism without frame threading overhead or async decode behavior.

§strict_std_compliance: bool

Enforce strict standard compliance

§cpu_level: CpuLevel

CPU feature level for SIMD dispatch.

Controls which instruction sets the decoder is allowed to use. Default is CpuLevel::Native (use all detected features).

Set to a lower level to force the decoder through a specific code path, e.g. CpuLevel::Scalar to test the pure-Rust fallback.

Trait Implementations§

Source§

impl Clone for Settings

Source§

fn clone(&self) -> Settings

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Settings

Source§

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

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

impl Default for Settings

Source§

fn default() -> Self

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

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> To for T
where T: ?Sized,

Source§

fn to<T>(self) -> T
where Self: Into<T>,

Converts to T by calling Into<T>::into.
Source§

fn try_to<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Tries to convert to T by calling TryInto<T>::try_into.
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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.