pub struct J2kDecoder<'a> { /* private fields */ }Expand description
JPEG 2000 decoder that can return host or Metal-resident surfaces.
Implementations§
Source§impl<'a> J2kDecoder<'a>
impl<'a> J2kDecoder<'a>
Sourcepub fn new(input: &'a [u8]) -> Result<Self, Error>
pub fn new(input: &'a [u8]) -> Result<Self, Error>
Parse a J2K or HTJ2K codestream into a decoder.
Sourcepub fn from_view(view: J2kView<'a>) -> Result<Self, Error>
pub fn from_view(view: J2kView<'a>) -> Result<Self, Error>
Create a decoder from an already parsed J2K view.
Sourcepub fn inner(&self) -> &CpuDecoder<'a>
pub fn inner(&self) -> &CpuDecoder<'a>
Borrow the underlying CPU J2K decoder.
Sourcepub fn decode_to_device_with_session(
&mut self,
fmt: PixelFormat,
session: &MetalBackendSession,
) -> Result<Surface, Error>
pub fn decode_to_device_with_session( &mut self, fmt: PixelFormat, session: &MetalBackendSession, ) -> Result<Surface, Error>
Decode a full image into a Metal-resident device surface.
Sourcepub fn decode_to_host_surface(
&mut self,
fmt: PixelFormat,
) -> Result<Surface, Error>
pub fn decode_to_host_surface( &mut self, fmt: PixelFormat, ) -> Result<Surface, Error>
Decode a full image into a host-backed surface.
Sourcepub fn decode_region_to_host_surface(
&mut self,
fmt: PixelFormat,
roi: Rect,
) -> Result<Surface, Error>
pub fn decode_region_to_host_surface( &mut self, fmt: PixelFormat, roi: Rect, ) -> Result<Surface, Error>
Decode a source region into a host-backed surface.
Sourcepub fn decode_scaled_to_host_surface(
&mut self,
fmt: PixelFormat,
scale: Downscale,
) -> Result<Surface, Error>
pub fn decode_scaled_to_host_surface( &mut self, fmt: PixelFormat, scale: Downscale, ) -> Result<Surface, Error>
Decode a full image at reduced resolution into a host-backed surface.
Sourcepub fn decode_region_scaled_to_host_surface(
&mut self,
fmt: PixelFormat,
roi: Rect,
scale: Downscale,
) -> Result<Surface, Error>
pub fn decode_region_scaled_to_host_surface( &mut self, fmt: PixelFormat, roi: Rect, scale: Downscale, ) -> Result<Surface, Error>
Decode a source region at reduced resolution into a host-backed surface.
Sourcepub fn decode_to_cpu_staged_metal_surface_with_session(
&mut self,
fmt: PixelFormat,
session: &MetalBackendSession,
) -> Result<Surface, Error>
pub fn decode_to_cpu_staged_metal_surface_with_session( &mut self, fmt: PixelFormat, session: &MetalBackendSession, ) -> Result<Surface, Error>
Decode a full image on CPU and upload the result into a Metal surface.
Sourcepub fn decode_region_to_cpu_staged_metal_surface_with_session(
&mut self,
fmt: PixelFormat,
roi: Rect,
session: &MetalBackendSession,
) -> Result<Surface, Error>
pub fn decode_region_to_cpu_staged_metal_surface_with_session( &mut self, fmt: PixelFormat, roi: Rect, session: &MetalBackendSession, ) -> Result<Surface, Error>
Decode a source region on CPU and upload the result into a Metal surface.
Sourcepub fn decode_scaled_to_cpu_staged_metal_surface_with_session(
&mut self,
fmt: PixelFormat,
scale: Downscale,
session: &MetalBackendSession,
) -> Result<Surface, Error>
pub fn decode_scaled_to_cpu_staged_metal_surface_with_session( &mut self, fmt: PixelFormat, scale: Downscale, session: &MetalBackendSession, ) -> Result<Surface, Error>
Decode a full image at reduced resolution on CPU and upload it into Metal.
Sourcepub fn decode_region_scaled_to_cpu_staged_metal_surface_with_session(
&mut self,
fmt: PixelFormat,
roi: Rect,
scale: Downscale,
session: &MetalBackendSession,
) -> Result<Surface, Error>
pub fn decode_region_scaled_to_cpu_staged_metal_surface_with_session( &mut self, fmt: PixelFormat, roi: Rect, scale: Downscale, session: &MetalBackendSession, ) -> Result<Surface, Error>
Decode a scaled source region on CPU and upload it into a Metal surface.
Sourcepub fn decode_region_to_device_with_session(
&mut self,
fmt: PixelFormat,
roi: Rect,
session: &MetalBackendSession,
) -> Result<Surface, Error>
pub fn decode_region_to_device_with_session( &mut self, fmt: PixelFormat, roi: Rect, session: &MetalBackendSession, ) -> Result<Surface, Error>
Decode a source region into a Metal-resident device surface.
Sourcepub fn decode_scaled_to_device_with_session(
&mut self,
fmt: PixelFormat,
scale: Downscale,
session: &MetalBackendSession,
) -> Result<Surface, Error>
pub fn decode_scaled_to_device_with_session( &mut self, fmt: PixelFormat, scale: Downscale, session: &MetalBackendSession, ) -> Result<Surface, Error>
Decode a full image at reduced resolution into a Metal-resident surface.
Sourcepub fn decode_region_scaled_to_device_with_session(
&mut self,
fmt: PixelFormat,
roi: Rect,
scale: Downscale,
session: &MetalBackendSession,
) -> Result<Surface, Error>
pub fn decode_region_scaled_to_device_with_session( &mut self, fmt: PixelFormat, roi: Rect, scale: Downscale, session: &MetalBackendSession, ) -> Result<Surface, Error>
Decode a scaled source region into a Metal-resident device surface.
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> ImageDecodeDevice<'a> for J2kDecoder<'a>
impl<'a> ImageDecodeDevice<'a> for J2kDecoder<'a>
Source§type DeviceSurface = Surface
type DeviceSurface = Surface
Source§fn decode_to_device(
&mut self,
fmt: PixelFormat,
backend: BackendRequest,
) -> Result<Self::DeviceSurface, Self::Error>where
Self: ImageDecodeSubmit<'a, DeviceSurface = Self::DeviceSurface>,
fn decode_to_device(
&mut self,
fmt: PixelFormat,
backend: BackendRequest,
) -> Result<Self::DeviceSurface, Self::Error>where
Self: ImageDecodeSubmit<'a, DeviceSurface = Self::DeviceSurface>,
Source§fn decode_region_to_device(
&mut self,
fmt: PixelFormat,
roi: Rect,
backend: BackendRequest,
) -> Result<Self::DeviceSurface, Self::Error>where
Self: ImageDecodeSubmit<'a, DeviceSurface = Self::DeviceSurface>,
fn decode_region_to_device(
&mut self,
fmt: PixelFormat,
roi: Rect,
backend: BackendRequest,
) -> Result<Self::DeviceSurface, Self::Error>where
Self: ImageDecodeSubmit<'a, DeviceSurface = Self::DeviceSurface>,
Source§fn decode_scaled_to_device(
&mut self,
fmt: PixelFormat,
scale: Downscale,
backend: BackendRequest,
) -> Result<Self::DeviceSurface, Self::Error>where
Self: ImageDecodeSubmit<'a, DeviceSurface = Self::DeviceSurface>,
fn decode_scaled_to_device(
&mut self,
fmt: PixelFormat,
scale: Downscale,
backend: BackendRequest,
) -> Result<Self::DeviceSurface, Self::Error>where
Self: ImageDecodeSubmit<'a, DeviceSurface = Self::DeviceSurface>,
Source§fn decode_region_scaled_to_device(
&mut self,
fmt: PixelFormat,
roi: Rect,
scale: Downscale,
backend: BackendRequest,
) -> Result<Self::DeviceSurface, Self::Error>where
Self: ImageDecodeSubmit<'a, DeviceSurface = Self::DeviceSurface>,
fn decode_region_scaled_to_device(
&mut self,
fmt: PixelFormat,
roi: Rect,
scale: Downscale,
backend: BackendRequest,
) -> Result<Self::DeviceSurface, Self::Error>where
Self: ImageDecodeSubmit<'a, DeviceSurface = Self::DeviceSurface>,
Source§impl<'a> ImageDecodeSubmit<'a> for J2kDecoder<'a>
impl<'a> ImageDecodeSubmit<'a> for J2kDecoder<'a>
Source§type Session = MetalSession
type Session = MetalSession
Source§type DeviceSurface = Surface
type DeviceSurface = Surface
Source§type SubmittedSurface = ReadySubmission<Surface, Error>
type SubmittedSurface = ReadySubmission<Surface, Error>
Source§fn submit_to_device(
&mut self,
session: &mut Self::Session,
fmt: PixelFormat,
backend: BackendRequest,
) -> Result<Self::SubmittedSurface, Self::Error>
fn submit_to_device( &mut self, session: &mut Self::Session, fmt: PixelFormat, backend: BackendRequest, ) -> Result<Self::SubmittedSurface, Self::Error>
Source§fn submit_region_to_device(
&mut self,
session: &mut Self::Session,
fmt: PixelFormat,
roi: Rect,
backend: BackendRequest,
) -> Result<Self::SubmittedSurface, Self::Error>
fn submit_region_to_device( &mut self, session: &mut Self::Session, fmt: PixelFormat, roi: Rect, backend: BackendRequest, ) -> Result<Self::SubmittedSurface, Self::Error>
Source§fn submit_scaled_to_device(
&mut self,
session: &mut Self::Session,
fmt: PixelFormat,
scale: Downscale,
backend: BackendRequest,
) -> Result<Self::SubmittedSurface, Self::Error>
fn submit_scaled_to_device( &mut self, session: &mut Self::Session, fmt: PixelFormat, scale: Downscale, backend: BackendRequest, ) -> Result<Self::SubmittedSurface, Self::Error>
Source§fn submit_region_scaled_to_device(
&mut self,
session: &mut Self::Session,
fmt: PixelFormat,
roi: Rect,
scale: Downscale,
backend: BackendRequest,
) -> Result<Self::SubmittedSurface, Self::Error>
fn submit_region_scaled_to_device( &mut self, session: &mut Self::Session, fmt: PixelFormat, roi: Rect, scale: Downscale, backend: BackendRequest, ) -> Result<Self::SubmittedSurface, Self::Error>
Source§fn submit_request_to_device(
&mut self,
session: &mut Self::Session,
fmt: PixelFormat,
backend: BackendRequest,
request: DecodeRequest,
) -> Result<Self::SubmittedSurface, Self::Error>
fn submit_request_to_device( &mut self, session: &mut Self::Session, fmt: PixelFormat, backend: BackendRequest, request: DecodeRequest, ) -> Result<Self::SubmittedSurface, Self::Error>
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