#[non_exhaustive]pub struct FrameFilterConfig {Show 16 fields
pub simple: bool,
pub key_frame: bool,
pub loop_filter_level: u8,
pub sharpness_level: u8,
pub segmentation_enabled: bool,
pub segment_abs: bool,
pub segment_lf_level: [i16; 4],
pub delta_enabled: bool,
pub ref_delta_current: i16,
pub bpred_mode_delta: i16,
pub ref_delta_last: i16,
pub ref_delta_golden: i16,
pub ref_delta_altref: i16,
pub zero_mv_mode_delta: i16,
pub other_mv_mode_delta: i16,
pub split_mv_mode_delta: i16,
}Expand description
Frame-constant configuration controlling the §15 loop-filter pass.
Holds the resolved (post-header) state the §20.6
calculate_filter_parameters body reads: the base
loop_filter_level and sharpness_level, the §10 per-segment level
override config, and the §9.4 reference / mode delta config. Build it
with FrameFilterConfig::keyframe from a parsed
crate::Vp8CodedHeader, or construct directly for unit testing.
On a key frame every macroblock predicts from the current frame, so
of the four §9.4 mode deltas only mode_delta[0] (the B_PRED
delta) ever applies, and the reference delta is always the
current-frame slot. The geometry pass below therefore models exactly
those two contributions; the remaining inter-frame mode/reference
deltas are reserved for the §16 inter-prediction round.
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.simple: boolfilter_type — false selects the §15.3 normal filter, true
the §15.2 simple filter.
key_frame: boolWhether the current frame is a key frame (selects the §15.4
key-frame hev_threshold ladder).
loop_filter_level: u8Base frame loop_filter_level (0..=63, RFC 6386 §9.4).
sharpness_level: u8Frame sharpness_level (0..=7, RFC 6386 §9.4).
segmentation_enabled: boolsegmentation_enabled (RFC 6386 §9.3) — gates the §10
per-segment loop-filter override.
segment_abs: boolsegment_feature_mode (RFC 6386 §9.3 4.a): true = absolute
(the per-segment value replaces the base level), false =
delta (it is added to the base level). Only consulted when
segmentation_enabled.
segment_lf_level: [i16; 4]The four §10 per-segment loop-filter levels (absolute values or
signed deltas per segment_abs). Only consulted when
segmentation_enabled.
delta_enabled: boolloop_filter_adj_enable (RFC 6386 §9.4) — gates the per-MB
reference / mode delta adjustment.
ref_delta_current: i16The reference-frame delta applied for the current (intra) frame —
ref_delta[CURRENT_FRAME] in §20.6. Only consulted when
delta_enabled.
bpred_mode_delta: i16The B_PRED mode delta — mode_delta[0] in §20.6. Only
consulted when delta_enabled and the macroblock is B_PRED.
ref_delta_last: i16The reference-frame delta applied to inter MBs predicting from
LAST — ref_delta[LAST_FRAME] in §20.6. Only consulted by
the interframe loop-filter path (filter_inter_frame).
ref_delta_golden: i16The reference-frame delta applied to inter MBs predicting from
GOLDEN — ref_delta[GOLDEN_FRAME] in §20.6. Only consulted by
the interframe loop-filter path.
ref_delta_altref: i16The reference-frame delta applied to inter MBs predicting from
ALTREF — ref_delta[ALTREF_FRAME] in §20.6.
zero_mv_mode_delta: i16The mode delta applied to inter MBs whose y_mode is ZEROMV —
mode_delta[1] in §20.6.
other_mv_mode_delta: i16The mode delta applied to inter MBs whose y_mode is NEARESTMV,
NEARMV, or NEWMV — mode_delta[2] in §20.6.
split_mv_mode_delta: i16The mode delta applied to inter MBs whose y_mode is SPLITMV —
mode_delta[3] in §20.6.
Implementations§
Source§impl FrameFilterConfig
impl FrameFilterConfig
Sourcepub fn with_simple(self, v: bool) -> Self
pub fn with_simple(self, v: bool) -> Self
Set simple.
Sourcepub fn with_key_frame(self, v: bool) -> Self
pub fn with_key_frame(self, v: bool) -> Self
Set key_frame.
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_segmentation_enabled(self, v: bool) -> Self
pub fn with_segmentation_enabled(self, v: bool) -> Self
Set segmentation_enabled.
Sourcepub fn with_segment_abs(self, v: bool) -> Self
pub fn with_segment_abs(self, v: bool) -> Self
Set segment_abs.
Sourcepub fn with_segment_lf_level(self, v: [i16; 4]) -> Self
pub fn with_segment_lf_level(self, v: [i16; 4]) -> Self
Set segment_lf_level.
Sourcepub fn with_delta_enabled(self, v: bool) -> Self
pub fn with_delta_enabled(self, v: bool) -> Self
Set delta_enabled.
Sourcepub fn with_ref_delta_current(self, v: i16) -> Self
pub fn with_ref_delta_current(self, v: i16) -> Self
Set ref_delta_current.
Sourcepub fn with_bpred_mode_delta(self, v: i16) -> Self
pub fn with_bpred_mode_delta(self, v: i16) -> Self
Set bpred_mode_delta.
Sourcepub fn with_ref_delta_last(self, v: i16) -> Self
pub fn with_ref_delta_last(self, v: i16) -> Self
Set ref_delta_last.
Sourcepub fn with_ref_delta_golden(self, v: i16) -> Self
pub fn with_ref_delta_golden(self, v: i16) -> Self
Set ref_delta_golden.
Sourcepub fn with_ref_delta_altref(self, v: i16) -> Self
pub fn with_ref_delta_altref(self, v: i16) -> Self
Set ref_delta_altref.
Sourcepub fn with_zero_mv_mode_delta(self, v: i16) -> Self
pub fn with_zero_mv_mode_delta(self, v: i16) -> Self
Set zero_mv_mode_delta.
Sourcepub fn with_other_mv_mode_delta(self, v: i16) -> Self
pub fn with_other_mv_mode_delta(self, v: i16) -> Self
Set other_mv_mode_delta.
Sourcepub fn with_split_mv_mode_delta(self, v: i16) -> Self
pub fn with_split_mv_mode_delta(self, v: i16) -> Self
Set split_mv_mode_delta.
Source§impl FrameFilterConfig
impl FrameFilterConfig
Sourcepub fn keyframe(header: &Vp8CodedHeader) -> Self
pub fn keyframe(header: &Vp8CodedHeader) -> Self
Build the key-frame configuration from a parsed boolean-coded frame header.
Resolves the §10 per-segment loop-filter levels from the header’s
update_segmentation.loop_filter_update (a None entry means the
segment carries level 0 — the §9.3 “value is 0” path) and the
§9.4 reference / mode deltas from mb_lf_adjustments. Because a
key frame has no prior persisted delta state (the §9.4 deltas are
“updated for the current frame” and key frames begin a fresh
sequence), a None update entry resolves to 0.
The reference delta used is the current-frame slot
(ref_frame_delta_update[0], the CURRENT_FRAME reference per
§20.6’s ref_delta[CURRENT_FRAME]) and the only mode delta that
applies on a key frame is the B_PRED slot
(mb_mode_delta_update[0], mode_delta[0] in §20.6).
Sourcepub fn interframe(
header: &Vp8CodedHeader,
carried_ref_deltas: [i16; 4],
carried_mode_deltas: [i16; 4],
) -> Self
pub fn interframe( header: &Vp8CodedHeader, carried_ref_deltas: [i16; 4], carried_mode_deltas: [i16; 4], ) -> Self
Build the interframe configuration from a parsed boolean-coded frame header and the carried (across-frame) reference / mode delta state.
Unlike FrameFilterConfig::keyframe, the §9.4 deltas persist
across frames per RFC 6386 §9.4: “the values from the previous
frame are used, unless they are updated in the current header.”
The caller carries carried_ref_deltas[4] and carried_mode_deltas[4]
across frames and asks this constructor to overlay the current
frame’s mb_lf_adjustments updates on top. The four ref indices
are {CURRENT=0, LAST=1, GOLDEN=2, ALTREF=3} and the four mode
indices are {B_PRED=0, ZERO_MV=1, NEAREST/NEAR/NEW_MV=2, SPLIT_MV=3}.
Sourcepub fn ref_deltas(&self) -> [i16; 4]
pub fn ref_deltas(&self) -> [i16; 4]
Extract the four [CURRENT, LAST, GOLDEN, ALTREF] reference deltas
from a resolved config, in the order the §20.6 ref_delta[] array
uses. Used by the across-frame state to carry the deltas to the next
frame’s FrameFilterConfig::interframe call.
Sourcepub fn mode_deltas(&self) -> [i16; 4]
pub fn mode_deltas(&self) -> [i16; 4]
Extract the four [B_PRED, ZERO_MV, OTHER_MV, SPLIT_MV] mode deltas.