Skip to main content

Preset

Enum Preset 

Source
pub enum Preset {
    Fast,
    Balanced,
    Quality,
}
Expand description

Speed/quality trade-off, in the spirit of x264’s -preset. The bitstream is valid (and decodes bit-exactly) either way; only the encoder’s effort differs.

Variants§

§

Fast

Fast — built to mirror x264’s fastest presets: mode decision by cheap SAD estimation (no rate-distortion trial-encoding; SAD auto-vectorizes to psadbw), P_16x16-only inter, I_16x16-only intra, and integer-pel motion (no sub-pel mc_luma interpolation — profiling showed it was ~55% of the encode). Much faster; larger files, and a little quality lost on sub-pixel motion (none on integer/screen content).

§

Balanced

BalancedFast’s decision path plus sub-pel motion refinement, which Fast omits.

Integer-pel motion cannot track sub-pixel displacement, so on slow pans and dollies the residual stays large, the intra cost wins, and macroblocks fall back to intra — which is very expensive. Measured over 4 QPs on four clips, adding sub-pel to Fast is −42% to −50% BD-rate (PSNR and SSIM agree) for ~2.3–3.1× the time. On fine-detail content it beats [Quality] on BOTH size and speed (in_to_tree 26.6 vs 27.3 Mb/s at 7.2× the throughput), because sub-pel — not the sub-partitions or the RD search — is what that content needs.

This is the default. Sub-pel costs ~2–3× the time, but a step on x264’s own preset ladder buys ~2–3% BD-rate for ~1.5× — so at −42..−50% this is dramatically underpriced by comparison. Fast remains available for throughput-critical use.

§

Quality

Quality — full rate-distortion mode decision (every candidate trial-encoded for real J = SSD + λ·bits), 16x8/8x16 sub-partitions, and the full I_4x4 intra search. Smaller files; much slower.

Trait Implementations§

Source§

impl Clone for Preset

Source§

fn clone(&self) -> Preset

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 Preset

Source§

impl Debug for Preset

Source§

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

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

impl Default for Preset

Source§

fn default() -> Preset

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

impl Eq for Preset

Source§

impl PartialEq for Preset

Source§

fn eq(&self, other: &Preset) -> 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 Preset

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 = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.