Skip to main content

ParamCod

Struct ParamCod 

Source
pub struct ParamCod { /* private fields */ }
Expand description

COD/COC marker segment — coding style parameters.

Holds default coding parameters (COD) and optionally per-component overrides (COC). Controls the wavelet transform, block coder settings, precinct sizes, and progression order.

Implementations§

Source§

impl ParamCod

Source

pub fn new_coc(comp_idx: u16) -> Self

Creates a new COC (coding style component) instance for the given component index.

Source

pub fn set_reversible(&mut self, reversible: bool)

Sets whether the wavelet transform is reversible (lossless 5/3) or irreversible (lossy 9/7).

Source

pub fn set_color_transform(&mut self, ct: bool)

Enables or disables the multi-component (color) transform.

When enabled with a reversible transform, RCT is used; with irreversible, ICT is used. Requires ≥ 3 components.

Source

pub fn set_num_decomposition(&mut self, num: u32)

Sets the number of DWT decomposition levels (0–32).

Source

pub fn set_block_dims(&mut self, width: u32, height: u32)

Sets the code block dimensions. Both width and height must be powers of two in the range 4–1024 and their product ≤ 4096.

Source

pub fn set_precinct_size(&mut self, num_levels: i32, sizes: &[Size])

Sets custom precinct sizes per resolution level.

Source

pub fn set_progression_order(&mut self, name: &str) -> Result<()>

Sets the progression order by name (e.g. "LRCP", "RPCL").

§Errors

Returns OjphError::InvalidParam if name is not a recognised progression order string.

Source

pub fn get_num_decompositions(&self) -> u8

Returns the number of DWT decomposition levels.

Source

pub fn get_block_dims(&self) -> Size

Returns the code block dimensions.

Source

pub fn get_log_block_dims(&self) -> Size

Returns the log₂ code block dimensions.

Source

pub fn get_wavelet_kern(&self) -> u8

Returns the wavelet kernel type (0 = irreversible 9/7, 1 = reversible 5/3).

Source

pub fn is_reversible(&self) -> bool

Returns true if using the reversible (lossless) 5/3 wavelet.

Source

pub fn is_employing_color_transform(&self) -> bool

Returns true if the multi-component color transform is enabled.

Source

pub fn get_precinct_size(&self, res_num: u32) -> Size

Returns the precinct size at the given resolution level.

Source

pub fn get_log_precinct_size(&self, res_num: u32) -> Size

Returns the log₂ precinct size at the given resolution level.

Source

pub fn packets_may_use_sop(&self) -> bool

Returns true if SOP markers may be used in packets.

Source

pub fn packets_use_eph(&self) -> bool

Returns true if EPH markers are used in packets.

Source

pub fn get_block_vertical_causality(&self) -> bool

Returns true if vertical causal context is enabled.

Source

pub fn get_progression_order(&self) -> i32

Returns the progression order as an integer.

Source

pub fn get_progression_order_as_string(&self) -> &'static str

Returns the progression order as a four-character string.

Source

pub fn get_num_layers(&self) -> i32

Returns the number of quality layers.

Source

pub fn is_dfs_defined(&self) -> bool

Returns true if a DFS marker is referenced.

Source

pub fn get_dfs_index(&self) -> u16

Returns the DFS marker index.

Source

pub fn get_comp_idx(&self) -> u16

Returns the component index this COC applies to.

Source

pub fn get_coc(&self, comp_idx: u32) -> &ParamCod

Returns the COC for a specific component, falling back to the COD defaults if no per-component override exists.

Source

pub fn get_coc_mut(&mut self, comp_idx: u32) -> &mut ParamCod

Returns a mutable reference to the COC for a specific component.

Source

pub fn add_coc(&mut self, comp_idx: u32) -> &mut ParamCod

Adds a new COC override for the specified component.

Source

pub fn check_validity(&self, siz: &ParamSiz) -> Result<()>

Source

pub fn write(&mut self, file: &mut dyn OutfileBase) -> Result<bool>

Source

pub fn write_coc( &self, file: &mut dyn OutfileBase, num_comps: u32, ) -> Result<bool>

Source

pub fn read(&mut self, file: &mut dyn InfileBase) -> Result<()>

Source

pub fn read_coc( &mut self, file: &mut dyn InfileBase, num_comps: u32, ) -> Result<()>

Trait Implementations§

Source§

impl Clone for ParamCod

Source§

fn clone(&self) -> ParamCod

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for ParamCod

Source§

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

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

impl Default for ParamCod

Source§

fn default() -> Self

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> 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 = 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.