Skip to main content

ParamSiz

Struct ParamSiz 

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

SIZ marker segment — image and tile size parameters.

Contains the fundamental geometry of the image: reference grid size, tile partitioning, image and tile offsets, and per-component subsampling and bit-depth information.

§Examples

use openjph_core::codestream::Codestream;
use openjph_core::types::{Point, Size};

let mut cs = Codestream::new();
let siz = cs.access_siz_mut();
siz.set_image_extent(Point::new(1920, 1080));
siz.set_tile_size(Size::new(1920, 1080));
siz.set_num_components(3);
for c in 0..3 {
    siz.set_comp_info(c, Point::new(1, 1), 8, false);
}
assert_eq!(siz.get_num_components(), 3);

Implementations§

Source§

impl ParamSiz

Source

pub fn set_image_extent(&mut self, extent: Point)

Sets the image reference grid extent (Xsiz, Ysiz).

Source

pub fn get_image_extent(&self) -> Point

Returns the image reference grid extent.

Source

pub fn set_tile_size(&mut self, s: Size)

Sets the tile size (XTsiz, YTsiz).

Source

pub fn get_tile_size(&self) -> Size

Returns the tile size.

Source

pub fn set_image_offset(&mut self, offset: Point)

Sets the image origin offset (XOsiz, YOsiz).

Source

pub fn get_image_offset(&self) -> Point

Returns the image origin offset.

Source

pub fn set_tile_offset(&mut self, offset: Point)

Sets the tile grid origin offset (XTOsiz, YTOsiz).

Source

pub fn get_tile_offset(&self) -> Point

Returns the tile grid origin offset.

Source

pub fn set_num_components(&mut self, num_comps: u32)

Sets the number of image components (Csiz) and allocates storage.

Source

pub fn get_num_components(&self) -> u16

Returns the number of image components.

Source

pub fn set_comp_info( &mut self, comp_num: u32, downsampling: Point, bit_depth: u32, is_signed: bool, )

Sets per-component information: subsampling factors, bit depth, and signedness.

§Panics

Debug-panics if comp_num >= num_components or if either downsampling factor is zero.

Source

pub fn get_bit_depth(&self, comp_num: u32) -> u32

Returns the bit depth (1–38) for the specified component.

Source

pub fn is_signed(&self, comp_num: u32) -> bool

Returns true if the specified component uses signed samples.

Source

pub fn get_downsampling(&self, comp_num: u32) -> Point

Returns the subsampling factors (XRsiz, YRsiz) for the specified component.

Source

pub fn get_width(&self, comp_num: u32) -> u32

Returns the width (in samples) of the specified component on the reference grid.

Source

pub fn get_height(&self, comp_num: u32) -> u32

Returns the height (in samples) of the specified component on the reference grid.

Source

pub fn get_recon_width(&self, comp_num: u32) -> u32

Returns the reconstructed width accounting for skipped resolutions.

Source

pub fn get_recon_height(&self, comp_num: u32) -> u32

Returns the reconstructed height accounting for skipped resolutions.

Source

pub fn get_recon_downsampling(&self, comp_num: u32) -> Point

Returns the effective downsampling factor for reconstruction, combining component subsampling with skipped resolutions.

Source

pub fn set_rsiz_flag(&mut self, flag: u16)

Sets a flag bit in the Rsiz field.

Source

pub fn reset_rsiz_flag(&mut self, flag: u16)

Clears a flag bit in the Rsiz field.

Source

pub fn set_skipped_resolutions(&mut self, sr: u32)

Sets the number of resolution levels to skip during decoding.

Source

pub fn check_validity(&self) -> Result<()>

Validates the SIZ parameters.

§Errors

Returns OjphError::Codec if the image extent, tile size, or offsets are invalid (zero extent, bad offsets, etc.).

Source

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

Source

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

Trait Implementations§

Source§

impl Debug for ParamSiz

Source§

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

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

impl Default for ParamSiz

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