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 strictness: Strictness, pub cpu_level: CpuLevel, }
Expand description

Decoder configuration settings

Construct with Settings::default(), then assign the fields to customize. This type is non-exhaustive; downstream callers cannot use struct literals.

use rav1d_safe::{Settings, Strictness};
let mut settings = Settings::default();
settings.threads = 4;
settings.strictness = Strictness::Lenient;
assert_eq!(settings.strictness, Strictness::Lenient);

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 the worker count
  • 1 = single-threaded (default, simpler synchronous behavior)
  • 2+ = multiple workers, including tile parallelism within a frame

With multiple workers, decode() may return None even when complete frame data is provided, as frames are processed asynchronously. Poll get_frame() between chunks, and call flush() once at end of input — it drains every frame still owed (in flight or queued in the last chunk) before it resets.

Tile threading works in the default checked build. Decoding multiple frames in flight also requires the unchecked feature; without it, frame delay is capped at one while the requested worker count is retained. For stills, additional workers help mainly when the image has multiple tiles. Set max_frame_delay to one for explicit single-frame latency measurements.

§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: 120,000,000 (120 MP — admits 108 MP phone photos). 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
👎Deprecated since 0.6.0:

use strictness

Enforce strict standard compliance.

Deprecated alias for strictness: true behaves as Strictness::Strict. When both are set, the stricter one applies. Kept so Settings { strict_std_compliance: true, ..Default::default() } keeps compiling; it will be removed in a later 0.x release.

§strictness: Strictness

How the decoder treats a stream that violates the AV1 specification.

Default: Strictness::Strict — corrupt or non-conforming tile data is an Error::InvalidData instead of garbage pixels. Set Strictness::Lenient for dav1d’s conceal-and-continue behaviour.

§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 (const: unstable) · 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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 = !

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.