Skip to main content

DecodeParameters

Struct DecodeParameters 

Source
pub struct DecodeParameters {
    pub reduce: u32,
    pub layers: u32,
    pub strict: bool,
    pub decode_area: Option<DecodeArea>,
    pub ignore_pclr_cmap_cdef: bool,
    pub threads: usize,
    pub limits: DecodeLimits,
}
Expand description

Decoder settings, built with the fluent builder pattern.

Defaults: full quality (reduce 0, all layers), whole image, and LENIENT decoding (strict == false), like the C tools’ -allow- partial: partial or slightly malformed codestreams decode as far as they can instead of being rejected. (The C ABI and the CLI tools keep the C library’s strict-by-default behaviour.)

Fields§

§reduce: u32

Resolution reduction (2^reduce); 0 = full resolution.

§layers: u32

Only decode the first layers quality layers; 0 = all.

§strict: bool

Reject malformed codestreams instead of tolerating them.

§decode_area: Option<DecodeArea>

Restrict the decoded area (whole image when None).

§ignore_pclr_cmap_cdef: bool

Ignore the JP2 palette/channel-definition boxes.

§threads: usize

Per-decode thread limit: 0 = automatic (the process-wide rayon pool), n > 0 = a local n-thread pool built for this decode. The default (0) preserves the current process-wide behaviour; without the rayon feature the value is inert.

§limits: DecodeLimits

Optional resource limits (see DecodeLimits). All-zero except max_mem_alloc = unlimited; max_mem_alloc == 0 selects the built-in 1 GiB ceiling (DEFAULT_DECODE_MEM_LIMIT).

Implementations§

Source§

impl DecodeParameters

Source

pub fn new() -> DecodeParameters

Default parameters: lenient, full image, automatic threading.

Source

pub fn reduce(self, reduce: u32) -> DecodeParameters

Reduce the decoded image by a factor of 2^reduce.

Source

pub fn layers(self, layers: u32) -> DecodeParameters

Decode only the first layers quality layers (0 = all).

Source

pub fn strict(self, strict: bool) -> DecodeParameters

Reject malformed codestreams instead of tolerating them.

Source

pub fn limits(self, limits: DecodeLimits) -> DecodeParameters

Apply resource limits to the decode (see DecodeLimits).

Source

pub fn decode_area(self, area: Option<DecodeArea>) -> DecodeParameters

Restrict the decoded area (whole image when None).

Source

pub fn threads(self, n: usize) -> DecodeParameters

Limit the number of worker threads used for this decode (0 = the process-wide rayon pool, the default; n > 0 = a local n-thread pool for this decode only). The result is byte-identical either way. With the one-shot API the pool lives for this decode only; the low-level Decoder keeps it for the codec’s lifetime. If the pool cannot be built, the ambient pool is used (a warning is logged).

Source

pub fn ignore_pclr_cmap_cdef(self) -> DecodeParameters

Ignore the palette/channel-definition boxes during JP2 colour application.

Trait Implementations§

Source§

impl Clone for DecodeParameters

Source§

fn clone(&self) -> DecodeParameters

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DecodeParameters

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for DecodeParameters

Source§

fn default() -> DecodeParameters

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.