Skip to main content

AltrefStreamConfig

Struct AltrefStreamConfig 

Source
#[non_exhaustive]
pub struct AltrefStreamConfig {
Show 15 fields pub params: KeyframeParams, pub keyframe_interval: u64, pub altref_window: usize, pub arnr: ArnrConfig, pub golden_promotion: bool, pub scene_cut_mad_threshold: f64, pub auto_loop_filter: bool, pub fitted_token_prob_updates: bool, pub intra_pick: bool, pub segmentation: Option<InterSegmentationConfig>, pub effort: EncodeEffort, pub threads: usize, pub inter_effort: EncodeEffort, pub target_bitrate_bps: u32, pub frame_rate: f64,
}
Expand description

Configuration for Vp8AltrefStreamEncoder.

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.
§params: KeyframeParams

Per-frame encode parameters (§9.6 quantiser, §9.4 loop filter, §13 trellis strength, …) applied to every emitted frame.

§keyframe_interval: u64

Key-frame cadence in source frames: frame 0 and every keyframe_interval-th source frame is coded as a key frame. 0 keys only the first frame.

§altref_window: usize

Lookahead group size in source frames (≥ 1). Each full group is encoded together: one invisible ARNR altref anchor (built from the whole group, aligned to its last frame) followed by the group’s visible frames. 1 degenerates to plain streaming (no anchors — a single-frame group has nothing to look ahead at).

§arnr: ArnrConfig

Temporal-filter dial for the anchor synthesis (see crate::arnr::ArnrConfig). strength = 0 anchors on the raw last frame of each group.

§golden_promotion: bool

§9.7 copy-ladder GOLDEN promotion. When true (the default), the last P-frame of every anchored group carries copy_buffer_to_golden = 2 (ALTREF → GOLDEN — two header bits, no pixel data travels), so the next group’s P-frames see a bracketing reference pair: GOLDEN holds the previous group’s anchor while the fresh invisible update re-points ALTREF at the next one. false leaves GOLDEN pinned at the most recent key frame.

§scene_cut_mad_threshold: f64

Scene-cut detector threshold, in mean-absolute-luma-difference per pixel against the previously pushed frame (0.0..=255.0). When a pushed frame’s MAD against its predecessor exceeds the threshold, the in-progress group is closed before the frame enters the buffer and the frame is coded as a key frame: an anchor must not blend across a cut (per-block SAD rejection already keeps foreign content out of the blend, but a cross-scene group would still waste an anchor and chain P-frames off dead references). 0.0 disables detection (the pure count-based grouping). Default 40.0 — far above photo noise / motion MAD, comfortably below a full scene change.

§auto_loop_filter: bool

§9.4 RD loop-filter auto-selection for every emitted frame (key frames, invisible anchors, and P-frames): when true, params.loop_filter_level / sharpness_level are ignored and each frame’s level / sharpness pair is chosen to minimise the post-§15 visible-window SSD of the frame’s own reconstruction against its source (see crate::encoder::KeyframeCodingOptions::auto_loop_filter). Default false (the fixed-level round-384 behaviour).

§fitted_token_prob_updates: bool

§13.4 in-header token_prob_update() emission, fitted per frame to the observed §13.3 branch counts by the two-pass crate::encoder::fit_token_prob_updates fitter, on every emitted frame. The fitted pass only ships when it shrinks the wire (never-grow guard), at the cost of a second encode pass per frame. Default false.

§intra_pick: bool

§11 intra-within-inter picker on the visible P-frames: every MB additionally scores the 16 whole-block (y_mode, uv_mode) intra candidates against the best inter pick — insurance for occluded / uncovered content the reference set cannot predict. The invisible anchor always encodes with the picker on (it is the round-383 encode_invisible_altref_update behaviour); this knob extends it to the P-frames. Default false.

§segmentation: Option<InterSegmentationConfig>

§9.3 / §10 segment-based adaptive quantisation on every inter frame the driver emits (invisible anchors and visible P-frames): per-MB variance classification, per-segment quantisers driving the RD walk, and the full update_segmentation() header block (see crate::encoder::InterSegmentationConfig). Key frames keep the frame-wide quantiser (the keyframe AQ path is a separate front door). Default None.

§effort: EncodeEffort

Mode-search effort of the stream’s key frames (see EncodeEffort). The inter frames follow inter_effort. Default Thorough (the historical key-frame bytes).

§threads: usize

Thread budget for each frame’s macroblock-row wavefront, key and inter frames alike (0 / 1 = serial, the default). Does not change the bytes.

§inter_effort: EncodeEffort

Mode-search effort of the stream’s inter frames (the invisible anchors and the visible P-frames). Defaults to EncodeEffort::Balanced.

§target_bitrate_bps: u32

One-pass rate control target in bits per second; 0 (the default) codes every frame at params.y_ac_qi. With a target the stream starts at params.y_ac_qi and then moves the quantiser frame by frame so that the stream’s average rate approaches the target (see [RateControl]); no frame is ever dropped, so a target below what the coarsest quantiser produces is overshot.

§frame_rate: f64

Frames per second the rate target is spread over (default 30).

Implementations§

Source§

impl AltrefStreamConfig

Source

pub fn with_target_bitrate_bps(self, v: u32) -> Self

Set target_bitrate_bps.

Source

pub fn with_frame_rate(self, v: f64) -> Self

Set frame_rate.

Source

pub fn with_inter_effort(self, v: EncodeEffort) -> Self

Set inter_effort.

Source

pub fn with_effort(self, v: EncodeEffort) -> Self

Set effort.

Source

pub fn with_threads(self, v: usize) -> Self

Set threads.

Source

pub fn with_params(self, v: KeyframeParams) -> Self

Set params.

Source

pub fn with_keyframe_interval(self, v: u64) -> Self

Set keyframe_interval.

Source

pub fn with_altref_window(self, v: usize) -> Self

Set altref_window.

Source

pub fn with_arnr(self, v: ArnrConfig) -> Self

Set arnr.

Source

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

Set golden_promotion.

Source

pub fn with_scene_cut_mad_threshold(self, v: f64) -> Self

Set scene_cut_mad_threshold.

Source

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

Set auto_loop_filter.

Source

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

Set fitted_token_prob_updates.

Source

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

Set intra_pick.

Source

pub fn with_segmentation(self, v: Option<InterSegmentationConfig>) -> Self

Set segmentation.

Trait Implementations§

Source§

impl Clone for AltrefStreamConfig

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 AltrefStreamConfig

Source§

impl Debug for AltrefStreamConfig

Source§

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

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

impl Default for AltrefStreamConfig

Source§

fn default() -> Self

Key the first frame only, 8-frame lookahead groups, default ARNR strength, GOLDEN promotion on, scene-cut keying at MAD 40.

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.