pub struct ProgressiveDecoder { /* private fields */ }Expand description
Decoder that supports scan-by-scan progressive output.
Progressive JPEGs encode image data in multiple scans, each refining the image quality. This decoder lets you consume scans one at a time and output the best available reconstruction at any point.
Implementations§
Source§impl ProgressiveDecoder
impl ProgressiveDecoder
Sourcepub fn new(data: &[u8]) -> Result<Self>
pub fn new(data: &[u8]) -> Result<Self>
Create from JPEG data. Returns error if not a progressive JPEG.
Applies crate::common::types::DecodeLimits::default; use
Self::with_limits to tighten (e.g. a max_memory ceiling for
the coefficient buffers this decoder holds across scans).
Sourcepub fn with_limits(data: &[u8], limits: DecodeLimits) -> Result<Self>
pub fn with_limits(data: &[u8], limits: DecodeLimits) -> Result<Self>
Like Self::new with caller-chosen resource limits, applied
from marker parsing onward (issue #355).
Sourcepub fn has_multiple_scans(&self) -> bool
pub fn has_multiple_scans(&self) -> bool
Check if the JPEG has multiple scans (i.e., is progressive).
Sourcepub fn consume_input(&mut self) -> Result<bool>
pub fn consume_input(&mut self) -> Result<bool>
Consume the next scan from input. Returns true if a scan was consumed, false if all scans are done.
Sourcepub fn input_complete(&self) -> bool
pub fn input_complete(&self) -> bool
Check if all input scans have been consumed.
Sourcepub fn scans_consumed(&self) -> usize
pub fn scans_consumed(&self) -> usize
Get the number of scans consumed so far.