TrellisConfig

Struct TrellisConfig 

Source
pub struct TrellisConfig {
    pub enabled: bool,
    pub dc_enabled: bool,
    pub eob_opt: bool,
    pub use_lambda_weight_tbl: bool,
    pub use_scans_in_trellis: bool,
    pub q_opt: bool,
    pub lambda_log_scale1: f32,
    pub lambda_log_scale2: f32,
    pub freq_split: i32,
    pub num_loops: i32,
    pub delta_dc_weight: f32,
}
Expand description

Configuration for trellis quantization.

Fields§

§enabled: bool

Enable trellis quantization for AC coefficients

§dc_enabled: bool

Enable trellis quantization for DC coefficients

§eob_opt: bool

Optimize for sequences of EOB

§use_lambda_weight_tbl: bool

Use perceptual lambda weighting table

§use_scans_in_trellis: bool

Consider scan order in trellis optimization

§q_opt: bool

Optimize quantization table in trellis loop

§lambda_log_scale1: f32

Lambda log scale parameter 1

§lambda_log_scale2: f32

Lambda log scale parameter 2

§freq_split: i32

Frequency split point for spectral selection

§num_loops: i32

Number of trellis optimization loops

§delta_dc_weight: f32

DC delta weight for vertical gradient consideration

Implementations§

Source§

impl TrellisConfig

Source

pub const fn disabled() -> TrellisConfig

Configuration with trellis disabled (fastest mode).

Source

pub fn favor_size() -> TrellisConfig

Preset that favors smaller file sizes over quality.

Uses lower lambda values which makes the trellis algorithm more aggressive about zeroing coefficients, resulting in smaller files at the cost of some quality loss.

Lambda = 2^scale1 / (2^scale2 + norm). Lower lambda = more aggressive zeroing.

Source

pub fn favor_quality() -> TrellisConfig

Preset that favors quality over file size.

Uses higher lambda values which makes the trellis algorithm more conservative, preserving more coefficients for better quality at the cost of larger files.

Lambda = 2^scale1 / (2^scale2 + norm). Higher lambda = more conservative.

Source

pub fn lambda_scales(self, scale1: f32, scale2: f32) -> TrellisConfig

Set the lambda log scale parameters directly.

These control the rate-distortion tradeoff in trellis quantization:

  • scale1: Controls rate penalty (higher = smaller files, default 14.75)
  • scale2: Controls distortion sensitivity (higher = better quality, default 16.5)

The effective lambda is: 2^scale1 / (2^scale2 + block_norm)

Source

pub fn rd_factor(self, factor: f32) -> TrellisConfig

Adjust rate-distortion balance with a simple factor.

  • factor > 1.0: Favor quality (higher lambda, more conservative)
  • factor < 1.0: Favor smaller files (lower lambda, more aggressive)
  • factor = 1.0: Default behavior

The factor multiplies the effective lambda value logarithmically.

Source

pub fn ac_trellis(self, enabled: bool) -> TrellisConfig

Enable or disable AC coefficient trellis optimization.

Source

pub fn dc_trellis(self, enabled: bool) -> TrellisConfig

Enable or disable DC coefficient trellis optimization.

Source

pub fn eob_optimization(self, enabled: bool) -> TrellisConfig

Enable or disable EOB run optimization.

Trait Implementations§

Source§

impl Clone for TrellisConfig

Source§

fn clone(&self) -> TrellisConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TrellisConfig

Source§

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

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

impl Default for TrellisConfig

Source§

fn default() -> TrellisConfig

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

impl PartialEq for TrellisConfig

Source§

fn eq(&self, other: &TrellisConfig) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for TrellisConfig

Source§

impl StructuralPartialEq for TrellisConfig

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.