Skip to main content

QuantizationParams

Struct QuantizationParams 

Source
pub struct QuantizationParams {
    pub base_q_idx: u8,
    pub delta_q_y_dc: i8,
    pub delta_q_u_dc: i8,
    pub delta_q_u_ac: i8,
    pub delta_q_v_dc: i8,
    pub delta_q_v_ac: i8,
    pub using_qmatrix: bool,
    pub qm_y: u8,
    pub qm_u: u8,
    pub qm_v: u8,
    pub delta_q_present: bool,
    pub delta_q_res: u8,
}
Expand description

Quantization parameters as parsed from the frame header.

Fields§

§base_q_idx: u8

Base quantizer index (0-255).

§delta_q_y_dc: i8

Delta Q for Y DC coefficients.

§delta_q_u_dc: i8

Delta Q for U DC coefficients.

§delta_q_u_ac: i8

Delta Q for U AC coefficients.

§delta_q_v_dc: i8

Delta Q for V DC coefficients.

§delta_q_v_ac: i8

Delta Q for V AC coefficients.

§using_qmatrix: bool

Use quantization matrices.

§qm_y: u8

QM level for Y plane.

§qm_u: u8

QM level for U plane.

§qm_v: u8

QM level for V plane.

§delta_q_present: bool

Delta Q present in block level.

§delta_q_res: u8

Delta Q resolution (log2).

Implementations§

Source§

impl QuantizationParams

Source

pub fn new() -> Self

Create new quantization parameters with default values.

Source

pub fn parse( reader: &mut BitReader<'_>, seq: &SequenceHeader, ) -> CodecResult<Self>

Parse quantization parameters from the bitstream.

§Errors

Returns error if the bitstream is malformed.

Source

pub fn y_dc_qindex(&self) -> u8

Get the effective Q index for Y DC.

Source

pub const fn y_ac_qindex(&self) -> u8

Get the effective Q index for Y AC (same as base).

Source

pub fn u_dc_qindex(&self) -> u8

Get the effective Q index for U DC.

Source

pub fn u_ac_qindex(&self) -> u8

Get the effective Q index for U AC.

Source

pub fn v_dc_qindex(&self) -> u8

Get the effective Q index for V DC.

Source

pub fn v_ac_qindex(&self) -> u8

Get the effective Q index for V AC.

Source

pub fn get_y_dc_dequant(&self, bit_depth: u8) -> i16

Get the DC dequantizer for Y plane.

Source

pub fn get_y_ac_dequant(&self, bit_depth: u8) -> i16

Get the AC dequantizer for Y plane.

Source

pub fn get_u_dc_dequant(&self, bit_depth: u8) -> i16

Get the DC dequantizer for U plane.

Source

pub fn get_u_ac_dequant(&self, bit_depth: u8) -> i16

Get the AC dequantizer for U plane.

Source

pub fn get_v_dc_dequant(&self, bit_depth: u8) -> i16

Get the DC dequantizer for V plane.

Source

pub fn get_v_ac_dequant(&self, bit_depth: u8) -> i16

Get the AC dequantizer for V plane.

Source

pub fn is_lossless(&self) -> bool

Check if lossless mode is enabled.

Source

pub fn has_uv_delta(&self) -> bool

Check if any UV delta is non-zero.

Source

pub const fn get_qm_level(&self, plane: usize) -> u8

Get the QM level for a plane.

Source

pub fn get_dc_quant(&self, plane: usize, bit_depth: u8) -> i16

Get DC quantizer for a plane (generic method).

Source

pub fn get_ac_quant(&self, plane: usize, bit_depth: u8) -> i16

Get AC quantizer for a plane (generic method).

Trait Implementations§

Source§

impl Clone for QuantizationParams

Source§

fn clone(&self) -> QuantizationParams

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 QuantizationParams

Source§

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

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

impl Default for QuantizationParams

Source§

fn default() -> QuantizationParams

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

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.