Skip to main content

KeyframeEncodeOptions

Struct KeyframeEncodeOptions 

Source
#[non_exhaustive]
pub struct KeyframeEncodeOptions { pub effort: EncodeEffort, pub threads: usize, pub auto_loop_filter: bool, pub fitted_token_prob_updates: bool, pub token_prob_fit: bool, pub search_token_probs: Option<TokenProbUpdates>, pub sampled_loop_filter: bool, }
Expand description

Controls for one key-frame encode — the options the encode_keyframe_with_options family takes next to KeyframeParams.

Default is the recommended still-picture encode: the default EncodeEffort, serial, the loop filter of the KeyframeParams, and the §13.4 token probabilities fitted to the picture within the one search (token_prob_fit). KeyframeEncodeOptions::exhaustive is the option-less encode_keyframe, byte for byte.

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.
§effort: EncodeEffort

Mode-search effort.

§threads: usize

Thread budget for the encode. 0 and 1 both mean serial (the default); with n > 1 the macroblock analysis runs as a macroblock-row wavefront on up to n threads (scoped std::threads that end with the call). The output bytes are the same for every budget.

§auto_loop_filter: bool

Measure every §9.4 loop-filter level / sharpness candidate on the reconstruction and keep the best (ignoring KeyframeParams::loop_filter_level), as encode_keyframe_auto_loop_filter does.

§fitted_token_prob_updates: bool

Run the mode search a second time against the token probabilities fitted to the first search, and keep the smaller stream (roughly doubles the encode time for a further few tenths of a percent; encode_keyframe_with_fitted_token_prob_updates is this with the exhaustive search).

§token_prob_fit: bool

Fit the §13.4 token-probability updates to the token statistics of the search itself and code the tokens against the fitted table (on by default). The search records its token decisions instead of bits, so this costs one walk over the recorded decisions — no second search — and never enlarges the stream: an update ships only where it saves more bits than it costs.

§search_token_probs: Option<TokenProbUpdates>

§13.4 updates the mode search prices tokens against instead of the §13.5 defaults — typically the KeyframeEncoded::token_prob_updates a similar picture (the previous frame, a neighbouring tile, a first quick encode) came out with. With token_prob_fit they only steer the search and the stream carries this picture’s own fit; without it they are shipped as given.

§sampled_loop_filter: bool

Choose the §9.4 loop-filter level and sharpness on a sample of the picture (three to six bands of macroblock rows spread over its height, searched coarse to fine), ignoring KeyframeParams::loop_filter_level — most of the gain of auto_loop_filter for a small fraction of its time. auto_loop_filter takes precedence when both are set.

Implementations§

Source§

impl KeyframeEncodeOptions

Source

pub fn new() -> Self

The defaults: the default EncodeEffort, serial, token probabilities fitted in the one search.

Source

pub fn exhaustive() -> Self

The exhaustive encode of the option-less entry points: EncodeEffort::Thorough, serial, the §13.5 default token probabilities — the bytes of encode_keyframe.

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

Set token_prob_fit.

Source

pub fn with_search_token_probs(self, v: Option<TokenProbUpdates>) -> Self

Set search_token_probs.

Source

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

Set sampled_loop_filter.

Trait Implementations§

Source§

impl Clone for KeyframeEncodeOptions

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 KeyframeEncodeOptions

Source§

impl Debug for KeyframeEncodeOptions

Source§

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

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

impl Default for KeyframeEncodeOptions

Source§

fn default() -> Self

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

impl Eq for KeyframeEncodeOptions

Source§

impl PartialEq for KeyframeEncodeOptions

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 KeyframeEncodeOptions

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.