pub struct CoeffContext {
pub tx_size: TxSize,
pub tx_type: TxType,
pub plane: u8,
pub scan_pos: u16,
pub eob: u16,
pub levels: Vec<i32>,
pub signs: Vec<bool>,
pub left_ctx: Vec<u8>,
pub above_ctx: Vec<u8>,
pub block_width: u8,
pub block_height: u8,
}Expand description
Context for coefficient parsing state.
Fields§
§tx_size: TxSizeTransform size.
tx_type: TxTypeTransform type.
plane: u8Plane index (0=Y, 1=U, 2=V).
scan_pos: u16Current scan position.
eob: u16End of block position.
levels: Vec<i32>Coefficient levels (dequantized).
signs: Vec<bool>Sign bits.
left_ctx: Vec<u8>Accumulated left context.
above_ctx: Vec<u8>Accumulated above context.
block_width: u8Block width in 4x4 units.
block_height: u8Block height in 4x4 units.
Implementations§
Source§impl CoeffContext
impl CoeffContext
Sourcepub fn new(tx_size: TxSize, tx_type: TxType, plane: u8) -> Self
pub fn new(tx_size: TxSize, tx_type: TxType, plane: u8) -> Self
Create a new coefficient context.
Sourcepub fn get_scan_position(&self, idx: usize) -> (u32, u32)
pub fn get_scan_position(&self, idx: usize) -> (u32, u32)
Get scan position for a coefficient index.
Sourcepub fn get_coeff_index(&self, row: u32, col: u32) -> usize
pub fn get_coeff_index(&self, row: u32, col: u32) -> usize
Get coefficient index from row and column.
Sourcepub fn compute_level_context(&self, pos: usize) -> LevelContext
pub fn compute_level_context(&self, pos: usize) -> LevelContext
Compute level context for a position.
Sourcepub fn dc_sign_context(&self) -> u8
pub fn dc_sign_context(&self) -> u8
Get DC sign context.
Sourcepub fn set_coeff(&mut self, pos: usize, level: i32, sign: bool)
pub fn set_coeff(&mut self, pos: usize, level: i32, sign: bool)
Set coefficient value at position.
Sourcepub fn has_nonzero(&self) -> bool
pub fn has_nonzero(&self) -> bool
Check if block has any non-zero coefficients.
Sourcepub fn count_nonzero(&self) -> u16
pub fn count_nonzero(&self) -> u16
Get the number of non-zero coefficients.
Trait Implementations§
Source§impl Clone for CoeffContext
impl Clone for CoeffContext
Source§fn clone(&self) -> CoeffContext
fn clone(&self) -> CoeffContext
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CoeffContext
impl Debug for CoeffContext
Auto Trait Implementations§
impl Freeze for CoeffContext
impl RefUnwindSafe for CoeffContext
impl Send for CoeffContext
impl Sync for CoeffContext
impl Unpin for CoeffContext
impl UnsafeUnpin for CoeffContext
impl UnwindSafe for CoeffContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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