#[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
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.params: KeyframeParamsPer-frame encode parameters (§9.6 quantiser, §9.4 loop filter, §13 trellis strength, …) applied to every emitted frame.
keyframe_interval: u64Key-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: usizeLookahead 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: ArnrConfigTemporal-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: f64Scene-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: EncodeEffortMode-search effort of the stream’s key frames (see
EncodeEffort). The inter frames
follow inter_effort. Default Thorough
(the historical key-frame bytes).
threads: usizeThread 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: EncodeEffortMode-search effort of the stream’s inter frames (the
invisible anchors and the visible P-frames). Defaults to
EncodeEffort::Balanced.
target_bitrate_bps: u32One-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: f64Frames per second the rate target is spread over (default 30).
Implementations§
Source§impl AltrefStreamConfig
impl AltrefStreamConfig
Sourcepub fn with_target_bitrate_bps(self, v: u32) -> Self
pub fn with_target_bitrate_bps(self, v: u32) -> Self
Set target_bitrate_bps.
Sourcepub fn with_frame_rate(self, v: f64) -> Self
pub fn with_frame_rate(self, v: f64) -> Self
Set frame_rate.
Sourcepub fn with_inter_effort(self, v: EncodeEffort) -> Self
pub fn with_inter_effort(self, v: EncodeEffort) -> Self
Set inter_effort.
Sourcepub fn with_effort(self, v: EncodeEffort) -> Self
pub fn with_effort(self, v: EncodeEffort) -> Self
Set effort.
Sourcepub fn with_threads(self, v: usize) -> Self
pub fn with_threads(self, v: usize) -> Self
Set threads.
Sourcepub fn with_params(self, v: KeyframeParams) -> Self
pub fn with_params(self, v: KeyframeParams) -> Self
Set params.
Sourcepub fn with_keyframe_interval(self, v: u64) -> Self
pub fn with_keyframe_interval(self, v: u64) -> Self
Set keyframe_interval.
Sourcepub fn with_altref_window(self, v: usize) -> Self
pub fn with_altref_window(self, v: usize) -> Self
Set altref_window.
Sourcepub fn with_arnr(self, v: ArnrConfig) -> Self
pub fn with_arnr(self, v: ArnrConfig) -> Self
Set arnr.
Sourcepub fn with_golden_promotion(self, v: bool) -> Self
pub fn with_golden_promotion(self, v: bool) -> Self
Set golden_promotion.
Sourcepub fn with_scene_cut_mad_threshold(self, v: f64) -> Self
pub fn with_scene_cut_mad_threshold(self, v: f64) -> Self
Set scene_cut_mad_threshold.
Sourcepub fn with_auto_loop_filter(self, v: bool) -> Self
pub fn with_auto_loop_filter(self, v: bool) -> Self
Set auto_loop_filter.
Sourcepub fn with_fitted_token_prob_updates(self, v: bool) -> Self
pub fn with_fitted_token_prob_updates(self, v: bool) -> Self
Set fitted_token_prob_updates.
Sourcepub fn with_intra_pick(self, v: bool) -> Self
pub fn with_intra_pick(self, v: bool) -> Self
Set intra_pick.
Sourcepub fn with_segmentation(self, v: Option<InterSegmentationConfig>) -> Self
pub fn with_segmentation(self, v: Option<InterSegmentationConfig>) -> Self
Set segmentation.