Skip to main content

RefreshControls

Struct RefreshControls 

Source
pub struct RefreshControls {
    pub refresh_golden_frame: bool,
    pub refresh_alternate_frame: bool,
    pub copy_buffer_to_golden: u8,
    pub copy_buffer_to_alternate: u8,
    pub refresh_last: bool,
}
Expand description

Caller-driven §9.7 / §9.8 reference-slot refresh pattern for a single P-frame.

The five fields map one-for-one to the §9.7 / §9.8 bits the inter frame header carries (RFC 6386 §9.7 page 38, §9.8 page 39):

  • refresh_golden_frame — L(1). true replaces the GOLDEN slot with the current reconstruction; false leaves it in place (or defers to copy_buffer_to_golden).
  • refresh_alternate_frame — L(1). true replaces the ALTREF slot with the current reconstruction; false defers to copy_buffer_to_alternate.
  • copy_buffer_to_golden — L(2), only read when refresh_golden_frame == 0. 0 no copy; 1 copies LAST into GOLDEN; 2 copies ALTREF into GOLDEN.
  • copy_buffer_to_alternate — L(2), only read when refresh_alternate_frame == 0. 0 no copy; 1 copies LAST into ALTREF; 2 copies GOLDEN into ALTREF.
  • refresh_last — L(1). true replaces the LAST slot with the current reconstruction (the conventional inter pattern); false leaves LAST in place so the next P-frame predicts off the already-held picture.

The decoder’s §9.7 / §9.8 walk (page 147 of RFC 6386: copy_arf → copy_gf → refresh_gf → refresh_arf → refresh_last) is implemented verbatim in crate::state::Vp8DecoderState, so any pattern this struct can express is decodable by the in-tree decoder — Vp8InterStreamEncoder mirrors the same walk on its own slot trio to keep encoder and decoder lockstep.

Default reproduces the round-149 pattern (encode_p_frame_multi_ref’s hardwired ladder): refresh_last = true, everything else 0 / false. With those defaults the new public encode_p_frame_multi_ref_with_refresh emits a wire that is byte-identical to encode_p_frame_multi_ref.

Fields§

§refresh_golden_frame: bool

§9.7 refresh_golden_frame (L1). true replaces GOLDEN with the current reconstruction.

§refresh_alternate_frame: bool

§9.7 refresh_alternate_frame (L1). true replaces ALTREF with the current reconstruction.

§copy_buffer_to_golden: u8

§9.7 copy_buffer_to_golden (L2, gated on refresh_golden_frame == 0). 0 = none, 1 = LAST → GOLDEN, 2 = ALTREF → GOLDEN. Values > 2 are rejected with EncodeError::InvalidCopyBufferSelector.

§copy_buffer_to_alternate: u8

§9.7 copy_buffer_to_alternate (L2, gated on refresh_alternate_frame == 0). 0 = none, 1 = LAST → ALTREF, 2 = GOLDEN → ALTREF. Values > 2 are rejected with EncodeError::InvalidCopyBufferSelector.

§refresh_last: bool

§9.8 refresh_last (L1). true replaces LAST with the current reconstruction (the conventional inter behaviour); false keeps the previous LAST picture so the next P-frame predicts off it.

Implementations§

Source§

impl RefreshControls

Source

pub fn validate(&self) -> Result<(), EncodeError>

Validate the per-field constraints. copy_buffer_to_* selectors outside 0..=2 are rejected with EncodeError::InvalidCopyBufferSelector.

The §19.2 page-122 listing gates the L(2) copy_buffer_to_* emission on if (!refresh_*_frame): the encoder does not transmit the selector when the matching refresh bit is 1, so a caller that sets both refresh_golden_frame = true AND copy_buffer_to_golden != 0 would silently lose the copy intent (the slot is overwritten by the current reconstruction regardless). To make that misuse impossible we reject it here.

Trait Implementations§

Source§

impl Clone for RefreshControls

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 Copy for RefreshControls

Source§

impl Debug for RefreshControls

Source§

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

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

impl Default for RefreshControls

Source§

fn default() -> Self

Round-149 default: refresh_last = true, every other field at zero. Reproduces the wire and slot semantics of encode_p_frame_multi_ref.

Source§

impl Eq for RefreshControls

Source§

impl PartialEq for RefreshControls

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 RefreshControls

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.