Skip to main content

FrameFilterConfig

Struct FrameFilterConfig 

Source
#[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
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.
§simple: bool

filter_type — false selects the §15.3 normal filter, true the §15.2 simple filter.

§key_frame: bool

Whether the current frame is a key frame (selects the §15.4 key-frame hev_threshold ladder).

§loop_filter_level: u8

Base frame loop_filter_level (0..=63, RFC 6386 §9.4).

§sharpness_level: u8

Frame sharpness_level (0..=7, RFC 6386 §9.4).

§segmentation_enabled: bool

segmentation_enabled (RFC 6386 §9.3) — gates the §10 per-segment loop-filter override.

§segment_abs: bool

segment_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: bool

loop_filter_adj_enable (RFC 6386 §9.4) — gates the per-MB reference / mode delta adjustment.

§ref_delta_current: i16

The reference-frame delta applied for the current (intra) frame — ref_delta[CURRENT_FRAME] in §20.6. Only consulted when delta_enabled.

§bpred_mode_delta: i16

The B_PRED mode delta — mode_delta[0] in §20.6. Only consulted when delta_enabled and the macroblock is B_PRED.

§ref_delta_last: i16

The 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: i16

The 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: i16

The reference-frame delta applied to inter MBs predicting from ALTREF — ref_delta[ALTREF_FRAME] in §20.6.

§zero_mv_mode_delta: i16

The mode delta applied to inter MBs whose y_mode is ZEROMV — mode_delta[1] in §20.6.

§other_mv_mode_delta: i16

The mode delta applied to inter MBs whose y_mode is NEARESTMV, NEARMV, or NEWMV — mode_delta[2] in §20.6.

§split_mv_mode_delta: i16

The mode delta applied to inter MBs whose y_mode is SPLITMV — mode_delta[3] in §20.6.

Implementations§

Source§

impl FrameFilterConfig

Source

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

Set simple.

Source

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

Set key_frame.

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_segmentation_enabled(self, v: bool) -> Self

Set segmentation_enabled.

Source

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

Set segment_abs.

Source

pub fn with_segment_lf_level(self, v: [i16; 4]) -> Self

Set segment_lf_level.

Source

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

Set delta_enabled.

Source

pub fn with_ref_delta_current(self, v: i16) -> Self

Set ref_delta_current.

Source

pub fn with_bpred_mode_delta(self, v: i16) -> Self

Set bpred_mode_delta.

Source

pub fn with_ref_delta_last(self, v: i16) -> Self

Set ref_delta_last.

Source

pub fn with_ref_delta_golden(self, v: i16) -> Self

Set ref_delta_golden.

Source

pub fn with_ref_delta_altref(self, v: i16) -> Self

Set ref_delta_altref.

Source

pub fn with_zero_mv_mode_delta(self, v: i16) -> Self

Set zero_mv_mode_delta.

Source

pub fn with_other_mv_mode_delta(self, v: i16) -> Self

Set other_mv_mode_delta.

Source

pub fn with_split_mv_mode_delta(self, v: i16) -> Self

Set split_mv_mode_delta.

Source§

impl FrameFilterConfig

Source

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).

Source

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}.

Source

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.

Source

pub fn mode_deltas(&self) -> [i16; 4]

Extract the four [B_PRED, ZERO_MV, OTHER_MV, SPLIT_MV] mode deltas.

Trait Implementations§

Source§

impl Clone for FrameFilterConfig

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 FrameFilterConfig

Source§

impl Debug for FrameFilterConfig

Source§

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

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

impl Default for FrameFilterConfig

Source§

fn default() -> Self

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

impl Eq for FrameFilterConfig

Source§

impl PartialEq for FrameFilterConfig

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 FrameFilterConfig

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.