Skip to main content

ScanlineDecoder

Struct ScanlineDecoder 

Source
pub struct ScanlineDecoder<'a> { /* private fields */ }
Expand description

Row-by-row JPEG decoder.

Implementations§

Source§

impl<'a> ScanlineDecoder<'a>

Source

pub fn new(data: &'a [u8]) -> Result<Self>

Create a new scanline decoder from raw JPEG data.

Source

pub fn header(&self) -> &FrameHeader

Returns the JPEG frame header.

Source

pub fn output_scanline(&self) -> usize

Returns the number of scanlines read so far.

Source

pub fn set_output_format(&mut self, format: PixelFormat)

Set the output pixel format before starting decode.

Source

pub fn set_fast_upsample(&mut self, fast: bool)

Enable or disable fast (nearest-neighbor) upsampling.

Source

pub fn set_fast_dct(&mut self, fast: bool)

Enable or disable fast DCT for decoding.

Source

pub fn set_dct_method(&mut self, method: DctMethod)

Set the DCT/IDCT method for decoding.

Source

pub fn set_block_smoothing(&mut self, smooth: bool)

Enable or disable inter-block smoothing.

Source

pub fn set_output_colorspace(&mut self, cs: ColorSpace)

Override the output color space.

Source

pub fn set_merged_upsample(&mut self, enabled: bool)

Enable merged upsampling optimization (combines upsample + color convert).

When enabled and subsampling is 4:2:0 or 4:2:2, uses a merged path that avoids intermediate chroma buffers. Faster but uses box-filter replication instead of fancy triangle-filter upsampling.

Source

pub fn set_crop_x(&mut self, x: usize, width: usize)

Set horizontal crop region for scanline-level decoding.

Source

pub fn set_bottom_up(&mut self, bottom_up: bool)

Enable or disable bottom-up row order.

When true, the output rows are reversed after decompression so that row 0 of the output corresponds to the last row of the image. Matches libjpeg-turbo’s TJPARAM_BOTTOMUP on the decode side.

Source

pub fn read_scanline(&mut self, buf: &mut [u8]) -> Result<()>

Decode and copy one scanline into buf.

Source

pub fn skip_scanlines(&mut self, count: usize) -> Result<usize>

Skip scanlines without copying data.

Source

pub fn finish(self) -> Result<Image>

Finalize and return the complete decoded Image.

Auto Trait Implementations§

§

impl<'a> !Freeze for ScanlineDecoder<'a>

§

impl<'a> !RefUnwindSafe for ScanlineDecoder<'a>

§

impl<'a> !Sync for ScanlineDecoder<'a>

§

impl<'a> !UnwindSafe for ScanlineDecoder<'a>

§

impl<'a> Send for ScanlineDecoder<'a>

§

impl<'a> Unpin for ScanlineDecoder<'a>

§

impl<'a> UnsafeUnpin for ScanlineDecoder<'a>

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> 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, 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.