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).truereplaces the GOLDEN slot with the current reconstruction;falseleaves it in place (or defers tocopy_buffer_to_golden).refresh_alternate_frame—L(1).truereplaces the ALTREF slot with the current reconstruction;falsedefers tocopy_buffer_to_alternate.copy_buffer_to_golden—L(2), only read whenrefresh_golden_frame == 0.0no copy;1copies LAST into GOLDEN;2copies ALTREF into GOLDEN.copy_buffer_to_alternate—L(2), only read whenrefresh_alternate_frame == 0.0no copy;1copies LAST into ALTREF;2copies GOLDEN into ALTREF.refresh_last—L(1).truereplaces the LAST slot with the current reconstruction (the conventional inter pattern);falseleaves 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
impl RefreshControls
Sourcepub fn validate(&self) -> Result<(), EncodeError>
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
impl Clone for RefreshControls
impl Copy for RefreshControls
Source§impl Debug for RefreshControls
impl Debug for RefreshControls
Source§impl Default for RefreshControls
impl Default for RefreshControls
Source§fn default() -> Self
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.