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: boolEnable trellis quantization for AC coefficients
dc_enabled: boolEnable trellis quantization for DC coefficients
eob_opt: boolOptimize for sequences of EOB
use_lambda_weight_tbl: boolUse perceptual lambda weighting table
use_scans_in_trellis: boolConsider scan order in trellis optimization
q_opt: boolOptimize quantization table in trellis loop
lambda_log_scale1: f32Lambda log scale parameter 1
lambda_log_scale2: f32Lambda log scale parameter 2
freq_split: i32Frequency split point for spectral selection
num_loops: i32Number of trellis optimization loops
delta_dc_weight: f32DC delta weight for vertical gradient consideration
Implementations§
Source§impl TrellisConfig
impl TrellisConfig
Sourcepub const fn disabled() -> TrellisConfig
pub const fn disabled() -> TrellisConfig
Configuration with trellis disabled (fastest mode).
Sourcepub fn favor_size() -> TrellisConfig
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.
Sourcepub fn favor_quality() -> TrellisConfig
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.
Sourcepub fn lambda_scales(self, scale1: f32, scale2: f32) -> TrellisConfig
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)
Sourcepub fn rd_factor(self, factor: f32) -> TrellisConfig
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.
Sourcepub fn ac_trellis(self, enabled: bool) -> TrellisConfig
pub fn ac_trellis(self, enabled: bool) -> TrellisConfig
Enable or disable AC coefficient trellis optimization.
Sourcepub fn dc_trellis(self, enabled: bool) -> TrellisConfig
pub fn dc_trellis(self, enabled: bool) -> TrellisConfig
Enable or disable DC coefficient trellis optimization.
Sourcepub fn eob_optimization(self, enabled: bool) -> TrellisConfig
pub fn eob_optimization(self, enabled: bool) -> TrellisConfig
Enable or disable EOB run optimization.
Trait Implementations§
Source§impl Clone for TrellisConfig
impl Clone for TrellisConfig
Source§fn clone(&self) -> TrellisConfig
fn clone(&self) -> TrellisConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more