Skip to main content

Decoder

Struct Decoder 

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

JPEG decoder that can return host or CUDA-resident surfaces.

Implementations§

Source§

impl<'a> Decoder<'a>

Source

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

Parse a JPEG byte slice into a CUDA-capable decoder wrapper.

Trait Implementations§

Source§

impl ImageCodec for Decoder<'_>

Source§

type Error = Error

Codec-specific error type.
Source§

type Warning = Warning

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

type Pool = ScratchPool

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

impl<'a> ImageDecode<'a> for Decoder<'a>

Source§

type View = JpegView<'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 Decoder<'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 Decoder<'a>

Source§

type Session = CudaSession

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 Decoder<'a>

§

impl<'a> RefUnwindSafe for Decoder<'a>

§

impl<'a> Send for Decoder<'a>

§

impl<'a> Sync for Decoder<'a>

§

impl<'a> Unpin for Decoder<'a>

§

impl<'a> UnsafeUnpin for Decoder<'a>

§

impl<'a> UnwindSafe for Decoder<'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, 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.