#[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’skey_frameflag and the slice&bytes[header_bytes_consumed..][..first_partition_size]. - The bool decoder cursor inside
parseis advanced past every field listed at the module level (including thetoken_prob_update()sweep); subsequent rounds wiring upprob_intra,prob_last,prob_gfandmv_prob_update()re-initthe 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
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: boolsegmentation_enabled — frame-level segmentation toggle.
update_segmentation: Option<UpdateSegmentation>update_segmentation() block. None when
segmentation_enabled is false.
filter_type: boolfilter_type — false = normal, true = simple loop filter.
loop_filter_level: u8loop_filter_level (6 bits, 0..=63).
sharpness_level: u8sharpness_level (3 bits, 0..=7).
mb_lf_adjustments: MbLfAdjustmentsmb_lf_adjustments() block.
log2_nbr_of_dct_partitions: u8log2_nbr_of_dct_partitions (2 bits) per §9.5.
nbr_of_dct_partitions: u81 << log2_nbr_of_dct_partitions — 1, 2, 4, or 8.
quant_indices: QuantIndicesquant_indices() block.
refresh_entropy_probs: boolrefresh_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: TokenProbUpdatestoken_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: boolmb_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
impl Vp8CodedHeader
Sourcepub fn with_color_space(self, v: Option<bool>) -> Self
pub fn with_color_space(self, v: Option<bool>) -> Self
Set color_space.
Sourcepub fn with_clamping_type(self, v: Option<bool>) -> Self
pub fn with_clamping_type(self, v: Option<bool>) -> Self
Set clamping_type.
Sourcepub fn with_segmentation_enabled(self, v: bool) -> Self
pub fn with_segmentation_enabled(self, v: bool) -> Self
Set segmentation_enabled.
Sourcepub fn with_update_segmentation(self, v: Option<UpdateSegmentation>) -> Self
pub fn with_update_segmentation(self, v: Option<UpdateSegmentation>) -> Self
Set update_segmentation.
Sourcepub fn with_filter_type(self, v: bool) -> Self
pub fn with_filter_type(self, v: bool) -> Self
Set filter_type.
Sourcepub fn with_loop_filter_level(self, v: u8) -> Self
pub fn with_loop_filter_level(self, v: u8) -> Self
Set loop_filter_level.
Sourcepub fn with_sharpness_level(self, v: u8) -> Self
pub fn with_sharpness_level(self, v: u8) -> Self
Set sharpness_level.
Sourcepub fn with_mb_lf_adjustments(self, v: MbLfAdjustments) -> Self
pub fn with_mb_lf_adjustments(self, v: MbLfAdjustments) -> Self
Set mb_lf_adjustments.
Sourcepub fn with_log2_nbr_of_dct_partitions(self, v: u8) -> Self
pub fn with_log2_nbr_of_dct_partitions(self, v: u8) -> Self
Set log2_nbr_of_dct_partitions.
Sourcepub fn with_nbr_of_dct_partitions(self, v: u8) -> Self
pub fn with_nbr_of_dct_partitions(self, v: u8) -> Self
Set nbr_of_dct_partitions.
Sourcepub fn with_quant_indices(self, v: QuantIndices) -> Self
pub fn with_quant_indices(self, v: QuantIndices) -> Self
Set quant_indices.
Sourcepub fn with_refresh_entropy_probs(self, v: bool) -> Self
pub fn with_refresh_entropy_probs(self, v: bool) -> Self
Set refresh_entropy_probs.
Sourcepub fn with_refresh_golden_frame(self, v: Option<bool>) -> Self
pub fn with_refresh_golden_frame(self, v: Option<bool>) -> Self
Set refresh_golden_frame.
Sourcepub fn with_refresh_alternate_frame(self, v: Option<bool>) -> Self
pub fn with_refresh_alternate_frame(self, v: Option<bool>) -> Self
Set refresh_alternate_frame.
Sourcepub fn with_copy_buffer_to_golden(self, v: Option<u8>) -> Self
pub fn with_copy_buffer_to_golden(self, v: Option<u8>) -> Self
Set copy_buffer_to_golden.
Sourcepub fn with_copy_buffer_to_alternate(self, v: Option<u8>) -> Self
pub fn with_copy_buffer_to_alternate(self, v: Option<u8>) -> Self
Set copy_buffer_to_alternate.
Sourcepub fn with_sign_bias_golden(self, v: Option<bool>) -> Self
pub fn with_sign_bias_golden(self, v: Option<bool>) -> Self
Set sign_bias_golden.
Sourcepub fn with_sign_bias_alternate(self, v: Option<bool>) -> Self
pub fn with_sign_bias_alternate(self, v: Option<bool>) -> Self
Set sign_bias_alternate.
Sourcepub fn with_refresh_last(self, v: Option<bool>) -> Self
pub fn with_refresh_last(self, v: Option<bool>) -> Self
Set refresh_last.
Sourcepub fn with_token_prob_updates(self, v: TokenProbUpdates) -> Self
pub fn with_token_prob_updates(self, v: TokenProbUpdates) -> Self
Set token_prob_updates.
Sourcepub fn with_mb_no_skip_coeff(self, v: bool) -> Self
pub fn with_mb_no_skip_coeff(self, v: bool) -> Self
Set mb_no_skip_coeff.
Sourcepub fn with_prob_skip_false(self, v: Option<u8>) -> Self
pub fn with_prob_skip_false(self, v: Option<u8>) -> Self
Set prob_skip_false.
Sourcepub fn with_prob_intra(self, v: Option<u8>) -> Self
pub fn with_prob_intra(self, v: Option<u8>) -> Self
Set prob_intra.
Sourcepub fn with_prob_last(self, v: Option<u8>) -> Self
pub fn with_prob_last(self, v: Option<u8>) -> Self
Set prob_last.
Sourcepub fn with_prob_gf(self, v: Option<u8>) -> Self
pub fn with_prob_gf(self, v: Option<u8>) -> Self
Set prob_gf.
Sourcepub fn with_intra_y_mode_prob_update(self, v: Option<[u8; 4]>) -> Self
pub fn with_intra_y_mode_prob_update(self, v: Option<[u8; 4]>) -> Self
Set intra_y_mode_prob_update.
Sourcepub fn with_intra_uv_mode_prob_update(self, v: Option<[u8; 3]>) -> Self
pub fn with_intra_uv_mode_prob_update(self, v: Option<[u8; 3]>) -> Self
Set intra_uv_mode_prob_update.
Sourcepub fn with_mv_prob_update(self, v: Option<MvProbUpdates>) -> Self
pub fn with_mv_prob_update(self, v: Option<MvProbUpdates>) -> Self
Set mv_prob_update.
Source§impl Vp8CodedHeader
impl Vp8CodedHeader
Sourcepub fn parse(
partition: &[u8],
key_frame: bool,
) -> Result<Self, CodedHeaderError>
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.
Sourcepub fn parse_with_decoder<'a>(
partition: &'a [u8],
key_frame: bool,
) -> Result<(Self, BoolDecoder<'a>), CodedHeaderError>
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.