pub struct JpegCoefficients {
pub components: Vec<ComponentCoefficients>,
}Expand description
Quantized DCT coefficients for all components in a JPEG image.
Returned by read_coefficients and accepted by write_coefficients.
Fields§
§components: Vec<ComponentCoefficients>One entry per component, in the order they appear in the JPEG SOF marker (typically Y, Cb, Cr for colour images).
Implementations§
Source§impl JpegCoefficients
impl JpegCoefficients
Sourcepub fn eligible_ac_count(&self) -> usize
pub fn eligible_ac_count(&self) -> usize
Count the number of AC coefficients with |v| >= 2 across all
components.
Modifying only these coefficients preserves the zero-run structure of the entropy stream, keeping the output a valid JPEG that is perceptually indistinguishable from the original.
§Example
use dct_io::read_coefficients;
let jpeg = std::fs::read("photo.jpg").unwrap();
let coeffs = read_coefficients(&jpeg).unwrap();
println!("Eligible AC positions: {}", coeffs.eligible_ac_count());Trait Implementations§
Source§impl Clone for JpegCoefficients
impl Clone for JpegCoefficients
Source§fn clone(&self) -> JpegCoefficients
fn clone(&self) -> JpegCoefficients
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 moreAuto Trait Implementations§
impl Freeze for JpegCoefficients
impl RefUnwindSafe for JpegCoefficients
impl Send for JpegCoefficients
impl Sync for JpegCoefficients
impl Unpin for JpegCoefficients
impl UnsafeUnpin for JpegCoefficients
impl UnwindSafe for JpegCoefficients
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