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: u32Resolution reduction (2^reduce); 0 = full resolution.
layers: u32Only decode the first layers quality layers; 0 = all.
strict: boolReject malformed codestreams instead of tolerating them.
decode_area: Option<DecodeArea>Restrict the decoded area (whole image when None).
ignore_pclr_cmap_cdef: boolIgnore the JP2 palette/channel-definition boxes.
threads: usizePer-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: DecodeLimitsOptional 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
impl DecodeParameters
Sourcepub fn new() -> DecodeParameters
pub fn new() -> DecodeParameters
Default parameters: lenient, full image, automatic threading.
Sourcepub fn reduce(self, reduce: u32) -> DecodeParameters
pub fn reduce(self, reduce: u32) -> DecodeParameters
Reduce the decoded image by a factor of 2^reduce.
Sourcepub fn layers(self, layers: u32) -> DecodeParameters
pub fn layers(self, layers: u32) -> DecodeParameters
Decode only the first layers quality layers (0 = all).
Sourcepub fn strict(self, strict: bool) -> DecodeParameters
pub fn strict(self, strict: bool) -> DecodeParameters
Reject malformed codestreams instead of tolerating them.
Sourcepub fn limits(self, limits: DecodeLimits) -> DecodeParameters
pub fn limits(self, limits: DecodeLimits) -> DecodeParameters
Apply resource limits to the decode (see DecodeLimits).
Sourcepub fn decode_area(self, area: Option<DecodeArea>) -> DecodeParameters
pub fn decode_area(self, area: Option<DecodeArea>) -> DecodeParameters
Restrict the decoded area (whole image when None).
Sourcepub fn threads(self, n: usize) -> DecodeParameters
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).
Sourcepub fn ignore_pclr_cmap_cdef(self) -> DecodeParameters
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
impl Clone for DecodeParameters
Source§fn clone(&self) -> DecodeParameters
fn clone(&self) -> DecodeParameters
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DecodeParameters
impl Debug for DecodeParameters
Source§impl Default for DecodeParameters
impl Default for DecodeParameters
Source§fn default() -> DecodeParameters
fn default() -> DecodeParameters
Auto Trait Implementations§
impl Forget for DecodeParameters
impl Freeze for DecodeParameters
impl Move for DecodeParameters
impl RefUnwindSafe for DecodeParameters
impl Send for DecodeParameters
impl Sync for DecodeParameters
impl Unpin for DecodeParameters
impl UnsafeUnpin for DecodeParameters
impl UnwindSafe for DecodeParameters
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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