Skip to main content

AdaptiveQuantConfig

Struct AdaptiveQuantConfig 

Source
#[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
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.
§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

Source

pub fn with_base_y_ac_qi(self, v: u8) -> Self

Set base_y_ac_qi.

Source

pub fn with_variance_boundaries(self, v: [u32; 3]) -> Self

Set variance_boundaries.

Source

pub fn with_quant_delta(self, v: [i8; 4]) -> Self

Set quant_delta.

Source

pub fn with_loop_filter_level(self, v: u8) -> Self

Set loop_filter_level.

Source

pub fn with_sharpness_level(self, v: u8) -> Self

Set sharpness_level.

Source

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

Set filter_type.

Trait Implementations§

Source§

impl Clone for AdaptiveQuantConfig

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 AdaptiveQuantConfig

Source§

impl Debug for AdaptiveQuantConfig

Source§

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

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

impl Default for AdaptiveQuantConfig

Source§

fn default() -> Self

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

impl Eq for AdaptiveQuantConfig

Source§

impl PartialEq for AdaptiveQuantConfig

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 AdaptiveQuantConfig

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.