Skip to main content

Vp8CodedHeader

Struct Vp8CodedHeader 

Source
#[non_exhaustive]
pub struct Vp8CodedHeader {
Show 28 fields pub color_space: Option<bool>, pub clamping_type: Option<bool>, pub segmentation_enabled: bool, pub update_segmentation: Option<UpdateSegmentation>, pub filter_type: bool, pub loop_filter_level: u8, pub sharpness_level: u8, pub mb_lf_adjustments: MbLfAdjustments, pub log2_nbr_of_dct_partitions: u8, pub nbr_of_dct_partitions: u8, pub quant_indices: QuantIndices, pub refresh_entropy_probs: bool, pub refresh_golden_frame: Option<bool>, pub refresh_alternate_frame: Option<bool>, pub copy_buffer_to_golden: Option<u8>, pub copy_buffer_to_alternate: Option<u8>, pub sign_bias_golden: Option<bool>, pub sign_bias_alternate: Option<bool>, pub refresh_last: Option<bool>, pub token_prob_updates: TokenProbUpdates, pub mb_no_skip_coeff: bool, pub prob_skip_false: Option<u8>, pub prob_intra: Option<u8>, pub prob_last: Option<u8>, pub prob_gf: Option<u8>, pub intra_y_mode_prob_update: Option<[u8; 4]>, pub intra_uv_mode_prob_update: Option<[u8; 3]>, pub mv_prob_update: Option<MvProbUpdates>,
}
Expand description

Decoded prefix of the boolean-coded frame header — every field up to and including prob_skip_false.

Caller responsibility:

  • Construct via Vp8CodedHeader::parse, passing the parsed uncompressed header’s key_frame flag and the slice &bytes[header_bytes_consumed..][..first_partition_size].
  • The bool decoder cursor inside parse is advanced past every field listed at the module level (including the token_prob_update() sweep); subsequent rounds wiring up prob_intra, prob_last, prob_gf and mv_prob_update() re-init the bool decoder at the same partition start and replay this prefix to reach their entry point.

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

color_space (key frame only). Per §9.2 only value 0 (BT.601-like) is defined; we surface the raw bit so audits can confirm.

§clamping_type: Option<bool>

clamping_type (key frame only). Per §9.2: 0 requires clamping; 1 declares pre-clamped pixels.

§segmentation_enabled: bool

segmentation_enabled — frame-level segmentation toggle.

§update_segmentation: Option<UpdateSegmentation>

update_segmentation() block. None when segmentation_enabled is false.

§filter_type: bool

filter_type — false = normal, true = simple loop filter.

§loop_filter_level: u8

loop_filter_level (6 bits, 0..=63).

§sharpness_level: u8

sharpness_level (3 bits, 0..=7).

§mb_lf_adjustments: MbLfAdjustments

mb_lf_adjustments() block.

§log2_nbr_of_dct_partitions: u8

log2_nbr_of_dct_partitions (2 bits) per §9.5.

§nbr_of_dct_partitions: u8

1 << log2_nbr_of_dct_partitions — 1, 2, 4, or 8.

§quant_indices: QuantIndices

quant_indices() block.

§refresh_entropy_probs: bool

refresh_entropy_probs — true means token-probability updates in this frame persist to the next frame’s defaults.

§refresh_golden_frame: Option<bool>

refresh_golden_frame (inter only). Key frames implicitly refresh the golden buffer per §9.7, so this is None on key frames.

§refresh_alternate_frame: Option<bool>

refresh_alternate_frame (inter only). Same key-frame behaviour as refresh_golden_frame.

§copy_buffer_to_golden: Option<u8>

copy_buffer_to_golden (inter only). 0 = no copy, 1 = copy last_frame, 2 = copy alt_ref_frame. Present in the stream only when refresh_golden_frame is 0; otherwise None.

§copy_buffer_to_alternate: Option<u8>

copy_buffer_to_alternate (inter only). 0 = no copy, 1 = copy last_frame, 2 = copy golden_frame. Present in the stream only when refresh_alternate_frame is 0; otherwise None.

§sign_bias_golden: Option<bool>

sign_bias_golden (inter only). Controls MV sign for the golden reference.

§sign_bias_alternate: Option<bool>

sign_bias_alternate (inter only).

§refresh_last: Option<bool>

refresh_last (inter only). Key frames implicitly refresh the last buffer per §9.8, so this is None on key frames.

§token_prob_updates: TokenProbUpdates

token_prob_update() block (§19.2). The 4×8×3×11 entries each carry either None (the corresponding coeff_prob_update_flag was 0) or the L(8) replacement probability. The block has to be parsed in order to reach the mb_no_skip_coeff bit that follows it.

§mb_no_skip_coeff: bool

mb_no_skip_coeff — frame-level enable for per-MB mb_skip_coeff flag.

§prob_skip_false: Option<u8>

prob_skip_false — probability used to decode the per-MB mb_skip_coeff flag. None when mb_no_skip_coeff is false (in which case mb_skip_coeff is forced to 0 for all MBs per §9.10/§9.11).

§prob_intra: Option<u8>

prob_intra (inter only). L(8) — probability that a macroblock is intra-predicted vs inter-predicted (§9.10 / §16). None on key frames.

§prob_last: Option<u8>

prob_last (inter only). L(8) — for an inter-predicted macroblock, the probability of selecting last_frame over golden_frame / altref_frame (§9.10 / §16.2). None on key frames.

§prob_gf: Option<u8>

prob_gf (inter only). L(8) — for a non-last inter-predicted macroblock, the probability of selecting golden_frame over altref_frame (§9.10 / §16.2). None on key frames.

§intra_y_mode_prob_update: Option<[u8; 4]>

intra_y_mode_prob_update (inter only). The §9.10 “F” gate controls whether four replacement Y intra-mode probabilities are read. When the F is true, all four entries carry the transmitted L(8) values (in the order corresponding to the even positions of ymode_tree, §16.1). When the F is false, every entry is None and the §16.1 defaults {112, 86, 140, 37} remain in force. None-of-array on key frames.

§intra_uv_mode_prob_update: Option<[u8; 3]>

intra_uv_mode_prob_update (inter only). Same F-gate structure as intra_y_mode_prob_update, three entries instead of four (even positions of uv_mode_tree). Defaults are {162, 101, 204}. None-of-array on key frames.

§mv_prob_update: Option<MvProbUpdates>

mv_prob_update() (inter only). Two 19-position MV_CONTEXTs (row, then column) — each position is F? P(7) (§17.2). None on key frames; otherwise Some([[Option<u8>; 19]; 2]) where each Option<u8> is the reconstructed replacement probability (the §17.2 procedure: x << 1 if non-zero, else 1) when the corresponding F was true, and None when the F was false.

Implementations§

Source§

impl Vp8CodedHeader

Source

pub fn with_color_space(self, v: Option<bool>) -> Self

Set color_space.

Source

pub fn with_clamping_type(self, v: Option<bool>) -> Self

Set clamping_type.

Source

pub fn with_segmentation_enabled(self, v: bool) -> Self

Set segmentation_enabled.

Source

pub fn with_update_segmentation(self, v: Option<UpdateSegmentation>) -> Self

Set update_segmentation.

Source

pub fn with_filter_type(self, v: bool) -> Self

Set filter_type.

Source

pub fn with_loop_filter_level(self, v: u8) -> Self

Set loop_filter_level.

Source

pub fn with_sharpness_level(self, v: u8) -> Self

Set sharpness_level.

Source

pub fn with_mb_lf_adjustments(self, v: MbLfAdjustments) -> Self

Set mb_lf_adjustments.

Source

pub fn with_log2_nbr_of_dct_partitions(self, v: u8) -> Self

Set log2_nbr_of_dct_partitions.

Source

pub fn with_nbr_of_dct_partitions(self, v: u8) -> Self

Set nbr_of_dct_partitions.

Source

pub fn with_quant_indices(self, v: QuantIndices) -> Self

Set quant_indices.

Source

pub fn with_refresh_entropy_probs(self, v: bool) -> Self

Set refresh_entropy_probs.

Source

pub fn with_refresh_golden_frame(self, v: Option<bool>) -> Self

Set refresh_golden_frame.

Source

pub fn with_refresh_alternate_frame(self, v: Option<bool>) -> Self

Set refresh_alternate_frame.

Source

pub fn with_copy_buffer_to_golden(self, v: Option<u8>) -> Self

Set copy_buffer_to_golden.

Source

pub fn with_copy_buffer_to_alternate(self, v: Option<u8>) -> Self

Set copy_buffer_to_alternate.

Source

pub fn with_sign_bias_golden(self, v: Option<bool>) -> Self

Set sign_bias_golden.

Source

pub fn with_sign_bias_alternate(self, v: Option<bool>) -> Self

Set sign_bias_alternate.

Source

pub fn with_refresh_last(self, v: Option<bool>) -> Self

Set refresh_last.

Source

pub fn with_token_prob_updates(self, v: TokenProbUpdates) -> Self

Set token_prob_updates.

Source

pub fn with_mb_no_skip_coeff(self, v: bool) -> Self

Set mb_no_skip_coeff.

Source

pub fn with_prob_skip_false(self, v: Option<u8>) -> Self

Set prob_skip_false.

Source

pub fn with_prob_intra(self, v: Option<u8>) -> Self

Set prob_intra.

Source

pub fn with_prob_last(self, v: Option<u8>) -> Self

Set prob_last.

Source

pub fn with_prob_gf(self, v: Option<u8>) -> Self

Set prob_gf.

Source

pub fn with_intra_y_mode_prob_update(self, v: Option<[u8; 4]>) -> Self

Set intra_y_mode_prob_update.

Source

pub fn with_intra_uv_mode_prob_update(self, v: Option<[u8; 3]>) -> Self

Set intra_uv_mode_prob_update.

Source

pub fn with_mv_prob_update(self, v: Option<MvProbUpdates>) -> Self

Set mv_prob_update.

Source§

impl Vp8CodedHeader

Source

pub fn parse( partition: &[u8], key_frame: bool, ) -> Result<Self, CodedHeaderError>

Parse the boolean-coded frame header from the start of the control partition.

partition is the first_partition_size bytes the caller extracted from the input slice using Vp8FrameHeader::header_bytes_consumed and the parsed first_partition_size. key_frame is the same field off the uncompressed header.

Source

pub fn parse_with_decoder<'a>( partition: &'a [u8], key_frame: bool, ) -> Result<(Self, BoolDecoder<'a>), CodedHeaderError>

Same as parse but additionally returns the BoolDecoder positioned immediately after the §19.2 header, ready for the §11 macroblock layer to keep reading from. The decoder borrows from partition for the lifetime of the returned tuple.

Trait Implementations§

Source§

impl Clone for Vp8CodedHeader

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 Debug for Vp8CodedHeader

Source§

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

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

impl Default for Vp8CodedHeader

Source§

fn default() -> Self

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

impl Eq for Vp8CodedHeader

Source§

impl PartialEq for Vp8CodedHeader

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 Vp8CodedHeader

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.