pub struct DctGrid { /* private fields */ }Expand description
Grid of quantized DCT coefficients for one image component.
Coefficients are stored in block-raster order. Within each block, the 64 coefficients are in natural (row-major) order, i.e. index = row * 8 + col.
Implementations§
Source§impl DctGrid
impl DctGrid
Sourcepub fn new(blocks_wide: usize, blocks_tall: usize) -> Self
pub fn new(blocks_wide: usize, blocks_tall: usize) -> Self
Create a new grid initialized to zero.
pub fn blocks_wide(&self) -> usize
pub fn blocks_tall(&self) -> usize
Sourcepub fn get(&self, br: usize, bc: usize, i: usize, j: usize) -> i16
pub fn get(&self, br: usize, bc: usize, i: usize, j: usize) -> i16
Get a coefficient value.
br,bc: block row and column (0-based)i,j: frequency row and column within the block (0–7)
Sourcepub fn set(&mut self, br: usize, bc: usize, i: usize, j: usize, val: i16)
pub fn set(&mut self, br: usize, bc: usize, i: usize, j: usize, val: i16)
Set a coefficient value.
Sourcepub fn block_mut(&mut self, br: usize, bc: usize) -> &mut [i16]
pub fn block_mut(&mut self, br: usize, bc: usize) -> &mut [i16]
Get a mutable reference to the 64-coefficient block at (br, bc).
Sourcepub fn block(&self, br: usize, bc: usize) -> &[i16]
pub fn block(&self, br: usize, bc: usize) -> &[i16]
Get a reference to the 64-coefficient block at (br, bc).
Sourcepub fn total_blocks(&self) -> usize
pub fn total_blocks(&self) -> usize
Total number of blocks.
Sourcepub fn coeffs_mut(&mut self) -> &mut [i16]
pub fn coeffs_mut(&mut self) -> &mut [i16]
Raw mutable access to all coefficients.
Layout: blocks_tall * blocks_wide * 64 contiguous i16 values in
block-raster order. Each 64-element chunk is one 8×8 block.
Used by parallel processing (Rayon par_chunks_mut).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DctGrid
impl RefUnwindSafe for DctGrid
impl Send for DctGrid
impl Sync for DctGrid
impl Unpin for DctGrid
impl UnsafeUnpin for DctGrid
impl UnwindSafe for DctGrid
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