Skip to main content

J2kDecoder

Struct J2kDecoder 

Source
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>

Source

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

Parse a J2K or HTJ2K codestream into a decoder.

Source

pub fn from_view(view: J2kView<'a>) -> Result<Self, Error>

Create a decoder from an already parsed J2K view.

Source

pub fn inner(&self) -> &CpuDecoder<'a>

Borrow the underlying CPU J2K decoder.

Source

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.

Source

pub fn decode_to_host_surface( &mut self, fmt: PixelFormat, ) -> Result<Surface, Error>

Decode a full image into a host-backed surface.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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<'_>

Source§

type Error = Error

Codec-specific error type.
Source§

type Warning = Infallible

Non-fatal warning type returned in successful decode outcomes.
Source§

type Pool = J2kScratchPool

Caller-owned scratch pool type used to reuse allocations.
Source§

impl<'a> ImageDecode<'a> for J2kDecoder<'a>

Source§

type View = J2kView<'a>

Borrowed parse product that can later construct a decoder.
Source§

fn inspect(input: &'a [u8]) -> Result<Info, Self::Error>

Inspect metadata without decoding pixels.
Source§

fn parse(input: &'a [u8]) -> Result<Self::View, Self::Error>

Parse compressed bytes into a borrowed view.
Source§

fn from_view(view: Self::View) -> Result<Self, Self::Error>

Build a decoder from a parsed view.
Source§

fn decode_into( &mut self, out: &mut [u8], stride: usize, fmt: PixelFormat, ) -> Result<DecodeOutcome<Self::Warning>, Self::Error>

Decode the full image into caller-owned output.
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>

Decode the full image into caller-owned output with reusable scratch.
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>

Decode a source-coordinate region into caller-owned output.
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>

Decode the full image at reduced resolution into caller-owned output.
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>

Decode a source-coordinate region at reduced resolution into caller-owned output.
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>

Decode a normalized full/ROI/scaled request into caller-owned output.
Source§

impl<'a> ImageDecodeDevice<'a> for J2kDecoder<'a>

Source§

type DeviceSurface = Surface

Device surface returned by decode calls.
Source§

fn decode_to_device( &mut self, fmt: PixelFormat, backend: BackendRequest, ) -> Result<Self::DeviceSurface, Self::Error>
where Self: ImageDecodeSubmit<'a, DeviceSurface = Self::DeviceSurface>,

Decode the full image to the requested backend.
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>,

Decode a source-coordinate region to the requested backend.
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>,

Decode the full image at reduced resolution to the requested backend.
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>,

Decode a source-coordinate region at reduced resolution to the requested backend.
Source§

impl<'a> ImageDecodeSubmit<'a> for J2kDecoder<'a>

Source§

type Session = MetalSession

Mutable session state shared across submissions.
Source§

type DeviceSurface = Surface

Device surface returned by completed submissions.
Source§

type SubmittedSurface = ReadySubmission<Surface, Error>

Submission handle type.
Source§

fn submit_to_device( &mut self, session: &mut Self::Session, fmt: PixelFormat, backend: BackendRequest, ) -> Result<Self::SubmittedSurface, Self::Error>

Submit full-image decode to the requested backend.
Source§

fn submit_region_to_device( &mut self, session: &mut Self::Session, fmt: PixelFormat, roi: Rect, backend: BackendRequest, ) -> Result<Self::SubmittedSurface, Self::Error>

Submit region decode to the requested backend.
Source§

fn submit_scaled_to_device( &mut self, session: &mut Self::Session, fmt: PixelFormat, scale: Downscale, backend: BackendRequest, ) -> Result<Self::SubmittedSurface, Self::Error>

Submit reduced-resolution decode to the requested backend.
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>

Submit region decode at reduced resolution to the requested backend.
Source§

fn submit_request_to_device( &mut self, session: &mut Self::Session, fmt: PixelFormat, backend: BackendRequest, request: DecodeRequest, ) -> Result<Self::SubmittedSurface, Self::Error>

Submit a normalized full/ROI/scaled decode request to a device backend.

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> 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(_simd: S, value: T) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

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.