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
impl ParamSiz
Sourcepub fn set_image_extent(&mut self, extent: Point)
pub fn set_image_extent(&mut self, extent: Point)
Sets the image reference grid extent (Xsiz, Ysiz).
Sourcepub fn get_image_extent(&self) -> Point
pub fn get_image_extent(&self) -> Point
Returns the image reference grid extent.
Sourcepub fn set_tile_size(&mut self, s: Size)
pub fn set_tile_size(&mut self, s: Size)
Sets the tile size (XTsiz, YTsiz).
Sourcepub fn get_tile_size(&self) -> Size
pub fn get_tile_size(&self) -> Size
Returns the tile size.
Sourcepub fn set_image_offset(&mut self, offset: Point)
pub fn set_image_offset(&mut self, offset: Point)
Sets the image origin offset (XOsiz, YOsiz).
Sourcepub fn get_image_offset(&self) -> Point
pub fn get_image_offset(&self) -> Point
Returns the image origin offset.
Sourcepub fn set_tile_offset(&mut self, offset: Point)
pub fn set_tile_offset(&mut self, offset: Point)
Sets the tile grid origin offset (XTOsiz, YTOsiz).
Sourcepub fn get_tile_offset(&self) -> Point
pub fn get_tile_offset(&self) -> Point
Returns the tile grid origin offset.
Sourcepub fn set_num_components(&mut self, num_comps: u32)
pub fn set_num_components(&mut self, num_comps: u32)
Sets the number of image components (Csiz) and allocates storage.
Sourcepub fn get_num_components(&self) -> u16
pub fn get_num_components(&self) -> u16
Returns the number of image components.
Sourcepub fn set_comp_info(
&mut self,
comp_num: u32,
downsampling: Point,
bit_depth: u32,
is_signed: bool,
)
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.
Sourcepub fn get_bit_depth(&self, comp_num: u32) -> u32
pub fn get_bit_depth(&self, comp_num: u32) -> u32
Returns the bit depth (1–38) for the specified component.
Sourcepub fn is_signed(&self, comp_num: u32) -> bool
pub fn is_signed(&self, comp_num: u32) -> bool
Returns true if the specified component uses signed samples.
Sourcepub fn get_downsampling(&self, comp_num: u32) -> Point
pub fn get_downsampling(&self, comp_num: u32) -> Point
Returns the subsampling factors (XRsiz, YRsiz) for the specified component.
Sourcepub fn get_width(&self, comp_num: u32) -> u32
pub fn get_width(&self, comp_num: u32) -> u32
Returns the width (in samples) of the specified component on the reference grid.
Sourcepub fn get_height(&self, comp_num: u32) -> u32
pub fn get_height(&self, comp_num: u32) -> u32
Returns the height (in samples) of the specified component on the reference grid.
Sourcepub fn get_recon_width(&self, comp_num: u32) -> u32
pub fn get_recon_width(&self, comp_num: u32) -> u32
Returns the reconstructed width accounting for skipped resolutions.
Sourcepub fn get_recon_height(&self, comp_num: u32) -> u32
pub fn get_recon_height(&self, comp_num: u32) -> u32
Returns the reconstructed height accounting for skipped resolutions.
Sourcepub fn get_recon_downsampling(&self, comp_num: u32) -> Point
pub fn get_recon_downsampling(&self, comp_num: u32) -> Point
Returns the effective downsampling factor for reconstruction, combining component subsampling with skipped resolutions.
Sourcepub fn set_rsiz_flag(&mut self, flag: u16)
pub fn set_rsiz_flag(&mut self, flag: u16)
Sets a flag bit in the Rsiz field.
Sourcepub fn reset_rsiz_flag(&mut self, flag: u16)
pub fn reset_rsiz_flag(&mut self, flag: u16)
Clears a flag bit in the Rsiz field.
Sourcepub fn set_skipped_resolutions(&mut self, sr: u32)
pub fn set_skipped_resolutions(&mut self, sr: u32)
Sets the number of resolution levels to skip during decoding.
Sourcepub fn check_validity(&self) -> Result<()>
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.).