Skip to main content

AV1Metadata

Struct AV1Metadata 

Source
#[non_exhaustive]
pub struct AV1Metadata { pub still_picture: bool, pub max_frame_width: NonZeroU32, pub max_frame_height: NonZeroU32, pub bit_depth: u8, pub seq_profile: u8, pub chroma_subsampling: ChromaSubsampling, pub monochrome: bool, pub base_q_idx: Option<u8>, pub lossless: Option<bool>, }
Expand description

AV1 sequence header metadata parsed from an OBU bitstream.

See AvifParser::primary_metadata() and AV1Metadata::parse_av1_bitstream().

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.
§still_picture: bool

Should be true for non-animated AVIF

§max_frame_width: NonZeroU32§max_frame_height: NonZeroU32§bit_depth: u8

8, 10, or 12

§seq_profile: u8

0, 1 or 2 for the level of complexity

§chroma_subsampling: ChromaSubsampling

Chroma subsampling. Use named fields (horizontal, vertical) or constants like ChromaSubsampling::YUV420.

§monochrome: bool§base_q_idx: Option<u8>

AV1 base quantizer index (0-255) from the first frame header. None if the frame header could not be parsed. 0 = lossless candidate, 255 = worst quality.

§lossless: Option<bool>

Whether the encoding is lossless (all quantization parameters are zero and chroma is not subsampled). None if the frame header could not be parsed.

Implementations§

Source§

impl AV1Metadata

Source

pub fn parse_av1_bitstream(obu_bitstream: &[u8]) -> Result<Self>

Parses raw AV1 bitstream (sequence header + optional frame header).

Extracts sequence-level metadata and attempts to parse the first frame header for quantization/lossless detection.

This is for the bare image payload from an encoder, not an AVIF/HEIF file. To parse AVIF files, see AvifParser::from_reader().

Trait Implementations§

Source§

impl Clone for AV1Metadata

Source§

fn clone(&self) -> AV1Metadata

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 AV1Metadata

Source§

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

Formats the value using the given formatter. 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> 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.