pub struct CudaLosslessEncoder { /* private fields */ }Expand description
Reusable CUDA-aware lossless JPEG 2000 encoder.
Self::encode honors each job’s EncodeBackendPreference:
CpuOnlydoes not initialize or submit CUDA work.Automay use CUDA stages and returns a CPU result when CUDA is unavailable or the device route does not cover every required stage.RequireDevicereturns an error unless CUDA satisfies every required stage.
Auto does not retry on the CPU after a CUDA execution error. Such errors
can indicate uncertain device state and are returned to the caller. The
encoder discards its cached accelerator state after any error, so a later
job can safely retry initialization or select CpuOnly.
The encoder is Send but intentionally not Sync; encoding requires
exclusive &mut self access. Move one encoder to each worker, or put it
behind a mutex when jobs must share it.
fn require_sync<T: Sync>() {}
require_sync::<j2k_cuda::CudaLosslessEncoder>();Implementations§
Source§impl CudaLosslessEncoder
impl CudaLosslessEncoder
Sourcepub fn encode(
&mut self,
samples: J2kLosslessSamples<'_>,
options: &J2kLosslessEncodeOptions,
) -> Result<CudaLosslessEncodeResult, Error>
pub fn encode( &mut self, samples: J2kLosslessSamples<'_>, options: &J2kLosslessEncodeOptions, ) -> Result<CudaLosslessEncodeResult, Error>
Encode one job according to its backend preference.
Device unavailability and incomplete device-stage coverage are recoverable
only for Auto. Input, allocation, validation, and CUDA execution errors
are returned without a second CPU encode attempt.
Sourcepub fn encode_strict_cuda(
&mut self,
samples: J2kLosslessSamples<'_>,
options: &J2kLosslessEncodeOptions,
) -> Result<CudaLosslessEncodeResult, Error>
pub fn encode_strict_cuda( &mut self, samples: J2kLosslessSamples<'_>, options: &J2kLosslessEncodeOptions, ) -> Result<CudaLosslessEncodeResult, Error>
Encode one job with a strict CUDA contract.
This method ignores the job’s stored backend preference and behaves as
EncodeBackendPreference::RequireDevice. It exists alongside
Self::encode so CUDA-specific callers can opt into fail-closed routing
without changing reusable per-job option templates.
Trait Implementations§
Source§impl Debug for CudaLosslessEncoder
impl Debug for CudaLosslessEncoder
Auto Trait Implementations§
impl !RefUnwindSafe for CudaLosslessEncoder
impl !Sync for CudaLosslessEncoder
impl Freeze for CudaLosslessEncoder
impl Send for CudaLosslessEncoder
impl Unpin for CudaLosslessEncoder
impl UnsafeUnpin for CudaLosslessEncoder
impl UnwindSafe for CudaLosslessEncoder
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