#[non_exhaustive]pub struct AdaptiveQuantConfig {
pub base_y_ac_qi: u8,
pub variance_boundaries: [u32; 3],
pub quant_delta: [i8; 4],
pub loop_filter_level: u8,
pub sharpness_level: u8,
pub filter_type: bool,
}Expand description
Configuration for the §9.3 / §10 segment-based adaptive-quant key-frame
encoder (encode_keyframe_adaptive_quant).
The encoder sorts each macroblock into one of four segments by its
luma activity (variance), then applies a per-segment quantizer feature
so detailed macroblocks can be coded at a finer quantizer than flat
ones (or vice-versa). All segmentation machinery — the §9.3
update_segmentation() block, the per-MB §10 segment_id, the
per-segment §14.1 dequant factors — is driven from this config. The
segmentation is delta-mode (segment_feature_mode = 0): each
segment’s quant_delta is added to the §9.6 base_y_ac_qi.
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.base_y_ac_qi: u8§9.6 baseline y_ac_qi (0..=127). Each segment’s effective qindex
is clamp(base_y_ac_qi + quant_delta[seg], 0, 127).
variance_boundaries: [u32; 3]Three ascending luma-variance boundaries splitting macroblocks into
the four segments: segment s is the count of boundaries the MB’s
variance meets-or-exceeds (so a flat MB → segment 0, the busiest →
segment 3). Values need not be sorted by the caller; the classifier
uses them as independent “≥” tests, but ascending order gives the
intended monotone mapping.
quant_delta: [i8; 4]Per-segment §10 quantizer_update_value deltas (signed, magnitude
≤ 127), added to base_y_ac_qi in delta mode. The natural AQ
choice raises the quantizer on flat segments (+) and lowers it on
detailed segments (-); the default does exactly that.
loop_filter_level: u8§9.4 baseline loop-filter level (0..=63); 0 skips the §15 filter.
sharpness_level: u8§9.4 sharpness (0..=7).
filter_type: bool§9.4 filter_type: false = §15.3 normal, true = §15.2 simple.
Implementations§
Source§impl AdaptiveQuantConfig
impl AdaptiveQuantConfig
Sourcepub fn with_base_y_ac_qi(self, v: u8) -> Self
pub fn with_base_y_ac_qi(self, v: u8) -> Self
Set base_y_ac_qi.
Sourcepub fn with_variance_boundaries(self, v: [u32; 3]) -> Self
pub fn with_variance_boundaries(self, v: [u32; 3]) -> Self
Set variance_boundaries.
Sourcepub fn with_quant_delta(self, v: [i8; 4]) -> Self
pub fn with_quant_delta(self, v: [i8; 4]) -> Self
Set quant_delta.
Sourcepub fn with_loop_filter_level(self, v: u8) -> Self
pub fn with_loop_filter_level(self, v: u8) -> Self
Set loop_filter_level.
Sourcepub fn with_sharpness_level(self, v: u8) -> Self
pub fn with_sharpness_level(self, v: u8) -> Self
Set sharpness_level.
Sourcepub fn with_filter_type(self, v: bool) -> Self
pub fn with_filter_type(self, v: bool) -> Self
Set filter_type.