pub struct J2kDecoder<'a> { /* private fields */ }Expand description
JPEG 2000 / HTJ2K decoder with WSI-shaped full-frame, ROI, and scaled output methods.
The decoder borrows compressed tile bytes and owns reusable native decode context so repeated operations can avoid reparsing backend state.
Implementations§
Source§impl<'a> J2kDecoder<'a>
impl<'a> J2kDecoder<'a>
Sourcepub fn cpu_decode_parallelism(&self) -> CpuDecodeParallelism
pub fn cpu_decode_parallelism(&self) -> CpuDecodeParallelism
Return the CPU decode parallelism policy for this decoder.
Sourcepub fn set_cpu_decode_parallelism(&mut self, parallelism: CpuDecodeParallelism)
pub fn set_cpu_decode_parallelism(&mut self, parallelism: CpuDecodeParallelism)
Set the CPU decode parallelism policy for this decoder.
Sourcepub fn passthrough_candidate(&self) -> Option<PassthroughCandidate<'a>>
pub fn passthrough_candidate(&self) -> Option<PassthroughCandidate<'a>>
Return a byte-preserving passthrough candidate when the native parser classified the compressed syntax and payload shape.
Sourcepub fn decode_into(
&mut self,
out: &mut [u8],
stride: usize,
fmt: PixelFormat,
) -> Result<DecodeOutcome<Infallible>, J2kError>
pub fn decode_into( &mut self, out: &mut [u8], stride: usize, fmt: PixelFormat, ) -> Result<DecodeOutcome<Infallible>, J2kError>
Sourcepub fn decode_into_with_scratch(
&mut self,
_pool: &mut J2kScratchPool,
out: &mut [u8],
stride: usize,
fmt: PixelFormat,
) -> Result<DecodeOutcome<Infallible>, J2kError>
pub fn decode_into_with_scratch( &mut self, _pool: &mut J2kScratchPool, out: &mut [u8], stride: usize, fmt: PixelFormat, ) -> Result<DecodeOutcome<Infallible>, J2kError>
Decode the full image with caller-owned scratch.
The current native full-frame path writes directly into the caller’s output buffer; the pool is accepted to satisfy the shared codec trait and is used by reduced-resolution and row-bounded paths.
§Errors
Same as Self::decode_into.
Sourcepub fn decode_region_into(
&mut self,
_pool: &mut J2kScratchPool,
out: &mut [u8],
stride: usize,
fmt: PixelFormat,
roi: Rect,
) -> Result<DecodeOutcome<Infallible>, J2kError>
pub fn decode_region_into( &mut self, _pool: &mut J2kScratchPool, out: &mut [u8], stride: usize, fmt: PixelFormat, roi: Rect, ) -> Result<DecodeOutcome<Infallible>, J2kError>
Decode a source-coordinate region into out.
roi is expressed in full-resolution source pixels. The output buffer
must hold roi.w * roi.h * fmt.bytes_per_pixel() bytes with the
provided row stride.
§Errors
Returns J2kError when the region is out of bounds, the output buffer
is too small, the format is unsupported, or decode fails.
Sourcepub fn decode_scaled_into(
&mut self,
pool: &mut J2kScratchPool,
out: &mut [u8],
stride: usize,
fmt: PixelFormat,
scale: Downscale,
) -> Result<DecodeOutcome<Infallible>, J2kError>
pub fn decode_scaled_into( &mut self, pool: &mut J2kScratchPool, out: &mut [u8], stride: usize, fmt: PixelFormat, scale: Downscale, ) -> Result<DecodeOutcome<Infallible>, J2kError>
Sourcepub fn decode_region_scaled_into(
&mut self,
pool: &mut J2kScratchPool,
out: &mut [u8],
stride: usize,
fmt: PixelFormat,
roi: Rect,
scale: Downscale,
) -> Result<DecodeOutcome<Infallible>, J2kError>
pub fn decode_region_scaled_into( &mut self, pool: &mut J2kScratchPool, out: &mut [u8], stride: usize, fmt: PixelFormat, roi: Rect, scale: Downscale, ) -> Result<DecodeOutcome<Infallible>, J2kError>
Decode a source-coordinate region at a reduced resolution.
roi is expressed in full-resolution source pixels. The decoded output
covers roi.scaled_covering(scale) in reduced-resolution coordinates.
§Errors
Returns J2kError when the region is out of bounds, the scale or
pixel format is unsupported, the output buffer is too small, or decode
fails.
Sourcepub fn decode_rows_u8_bounded<R: RowSink<u8>>(
&mut self,
sink: &mut R,
options: J2kRowDecodeOptions,
) -> Result<DecodeOutcome<Infallible>, DecodeRowsError<J2kError, R::Error>>
pub fn decode_rows_u8_bounded<R: RowSink<u8>>( &mut self, sink: &mut R, options: J2kRowDecodeOptions, ) -> Result<DecodeOutcome<Infallible>, DecodeRowsError<J2kError, R::Error>>
Decode rows into a u8 row sink while bounding host output scratch to
at most options.max_rows_per_stripe() rows.
§Errors
Returns a decode error for unsupported formats or malformed input, and forwards sink errors without converting them to successful decodes.
Sourcepub fn decode_rows_u16_bounded<R: RowSink<u16>>(
&mut self,
sink: &mut R,
options: J2kRowDecodeOptions,
) -> Result<DecodeOutcome<Infallible>, DecodeRowsError<J2kError, R::Error>>
pub fn decode_rows_u16_bounded<R: RowSink<u16>>( &mut self, sink: &mut R, options: J2kRowDecodeOptions, ) -> Result<DecodeOutcome<Infallible>, DecodeRowsError<J2kError, R::Error>>
Decode rows into a u16 row sink while bounding host output scratch to
at most options.max_rows_per_stripe() rows.
§Errors
Returns a decode error for unsupported formats or malformed input, and forwards sink errors without converting them to successful decodes.
Trait Implementations§
Source§impl ImageCodec for J2kDecoder<'_>
impl ImageCodec for J2kDecoder<'_>
Source§impl<'a> ImageDecode<'a> for J2kDecoder<'a>
impl<'a> ImageDecode<'a> for J2kDecoder<'a>
Source§fn inspect(input: &'a [u8]) -> Result<Info, Self::Error>
fn inspect(input: &'a [u8]) -> Result<Info, Self::Error>
Source§fn parse(input: &'a [u8]) -> Result<Self::View, Self::Error>
fn parse(input: &'a [u8]) -> Result<Self::View, Self::Error>
Source§fn from_view(view: Self::View) -> Result<Self, Self::Error>
fn from_view(view: Self::View) -> Result<Self, Self::Error>
Source§fn decode_into(
&mut self,
out: &mut [u8],
stride: usize,
fmt: PixelFormat,
) -> Result<DecodeOutcome<Self::Warning>, Self::Error>
fn decode_into( &mut self, out: &mut [u8], stride: usize, fmt: PixelFormat, ) -> Result<DecodeOutcome<Self::Warning>, Self::Error>
Source§fn decode_into_with_scratch(
&mut self,
pool: &mut Self::Pool,
out: &mut [u8],
stride: usize,
fmt: PixelFormat,
) -> Result<DecodeOutcome<Self::Warning>, Self::Error>
fn decode_into_with_scratch( &mut self, pool: &mut Self::Pool, out: &mut [u8], stride: usize, fmt: PixelFormat, ) -> Result<DecodeOutcome<Self::Warning>, Self::Error>
Source§fn decode_region_into(
&mut self,
pool: &mut Self::Pool,
out: &mut [u8],
stride: usize,
fmt: PixelFormat,
roi: Rect,
) -> Result<DecodeOutcome<Self::Warning>, Self::Error>
fn decode_region_into( &mut self, pool: &mut Self::Pool, out: &mut [u8], stride: usize, fmt: PixelFormat, roi: Rect, ) -> Result<DecodeOutcome<Self::Warning>, Self::Error>
Source§fn decode_scaled_into(
&mut self,
pool: &mut Self::Pool,
out: &mut [u8],
stride: usize,
fmt: PixelFormat,
scale: Downscale,
) -> Result<DecodeOutcome<Self::Warning>, Self::Error>
fn decode_scaled_into( &mut self, pool: &mut Self::Pool, out: &mut [u8], stride: usize, fmt: PixelFormat, scale: Downscale, ) -> Result<DecodeOutcome<Self::Warning>, Self::Error>
Source§fn decode_region_scaled_into(
&mut self,
pool: &mut Self::Pool,
out: &mut [u8],
stride: usize,
fmt: PixelFormat,
roi: Rect,
scale: Downscale,
) -> Result<DecodeOutcome<Self::Warning>, Self::Error>
fn decode_region_scaled_into( &mut self, pool: &mut Self::Pool, out: &mut [u8], stride: usize, fmt: PixelFormat, roi: Rect, scale: Downscale, ) -> Result<DecodeOutcome<Self::Warning>, Self::Error>
Source§fn decode_request_into(
&mut self,
pool: &mut Self::Pool,
out: &mut [u8],
stride: usize,
fmt: PixelFormat,
request: DecodeRequest,
) -> Result<DecodeOutcome<Self::Warning>, Self::Error>
fn decode_request_into( &mut self, pool: &mut Self::Pool, out: &mut [u8], stride: usize, fmt: PixelFormat, request: DecodeRequest, ) -> Result<DecodeOutcome<Self::Warning>, Self::Error>
Source§impl<'a> ImageDecodeRows<'a, u8> for J2kDecoder<'a>
impl<'a> ImageDecodeRows<'a, u8> for J2kDecoder<'a>
Source§fn decode_rows<R: RowSink<u8>>(
&mut self,
sink: &mut R,
) -> Result<DecodeOutcome<Self::Warning>, DecodeRowsError<Self::Error, R::Error>>
fn decode_rows<R: RowSink<u8>>( &mut self, sink: &mut R, ) -> Result<DecodeOutcome<Self::Warning>, DecodeRowsError<Self::Error, R::Error>>
sink without requiring one contiguous output buffer.Source§impl<'a> ImageDecodeRows<'a, u16> for J2kDecoder<'a>
impl<'a> ImageDecodeRows<'a, u16> for J2kDecoder<'a>
Source§fn decode_rows<R: RowSink<u16>>(
&mut self,
sink: &mut R,
) -> Result<DecodeOutcome<Self::Warning>, DecodeRowsError<Self::Error, R::Error>>
fn decode_rows<R: RowSink<u16>>( &mut self, sink: &mut R, ) -> Result<DecodeOutcome<Self::Warning>, DecodeRowsError<Self::Error, R::Error>>
sink without requiring one contiguous output buffer.Auto Trait Implementations§
impl<'a> Freeze for J2kDecoder<'a>
impl<'a> RefUnwindSafe for J2kDecoder<'a>
impl<'a> Send for J2kDecoder<'a>
impl<'a> Sync for J2kDecoder<'a>
impl<'a> Unpin for J2kDecoder<'a>
impl<'a> UnsafeUnpin for J2kDecoder<'a>
impl<'a> UnwindSafe for J2kDecoder<'a>
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
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>
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>
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