#[non_exhaustive]pub enum Strictness {
Lenient,
Strict,
}Expand description
How much the decoder tolerates from a stream that violates the AV1 specification.
AV1 leaves the handling of non-conforming streams to the decoder. dav1d conceals what it can and keeps going — a video player would rather show a damaged frame than stop — and that is what this port did unconditionally before 0.6.0. A still-image pipeline usually wants the opposite: a corrupt AVIF should fail instead of yielding garbage pixels, and an encoder bug that desynchronises the symbol stream must not sail through an encode→decode round trip (imazen/rav1d-safe#422 was exactly that).
Every check behind Strict is a comparison at a point the
decoder already evaluates, or a once-per-OBU / once-per-tile header check.
None of them is in a per-pixel loop.
The variants are ordered: Lenient < Strict.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Lenient
dav1d’s library default (strict_std_compliance = 0): conceal and continue.
Non-conforming values are clamped or reset exactly as dav1d does, so output stays bit-exact with dav1d even on corrupt input. Use this when a best-effort frame beats an error, or to reproduce dav1d’s output on a corrupt stream.
Strict
Reject what the AV1 reference decoder (libaom) rejects. Default.
On top of Lenient:
- dav1d’s
strict_std_compliancechecks — OBU trailing bits after sequence and frame headers, the padding after each tile’s symbol decoder (AV1 §8.2.4), the OBU forbidden bit, zerotiming_infofields, anintra_onlyframe refreshing every reference slot,show_existing_frameof a non-showable frame, identity matrix coefficients with subsampled chroma, and — under frame threading — an error in a reference frame failing the frames that depend on it instead of concealing; - the AV1 §6.10.8 requirement that a decoded
segment_idlies in0..=LastActiveSegId(libaom: “Corrupted segment_ids”). dav1d resets an out-of-range id to 0 and keeps parsing a symbol stream that has already desynchronised, so every block after it is garbage.
A rejected frame surfaces as Error::InvalidData.
Trait Implementations§
Source§impl Clone for Strictness
impl Clone for Strictness
Source§fn clone(&self) -> Strictness
fn clone(&self) -> Strictness
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more