#[non_exhaustive]pub struct Component {
pub width: u32,
pub height: u32,
pub bit_depth: u8,
pub signed: bool,
pub x_sampling: u8,
pub y_sampling: u8,
pub samples: Vec<i32>,
}Expand description
One decoded component: its own sample grid, its declared depth and sign, and the sub-sampling that maps it onto the image’s reference grid.
samples is row-major, width * height entries, each already
DC-level-shifted and clamped to the declared depth.
A channel made by a JP2 palette (pclr) is different: its depth and sign
come from the palette’s Bi (for a direct channel i, from column i),
and its samples are the palette entries as stored (for a direct channel,
the component’s samples). Its samples can fall outside the range that depth
and sign declare, as in OpenJPEG.
#[non_exhaustive], like Image; build one by hand with
Component::new.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.width: u32Component width in samples.
height: u32Component height in samples.
bit_depth: u8Bits per sample as declared in SIZ Ssiz, or by the palette for a
palette channel: 1 to 31 for unsigned samples, 1 to 32 for signed ones
(the i32 container holds both).
Except in a palette channel (see Component), unsigned samples run
from 0 to 2^bit_depth - 1; signed samples from
-2^(bit_depth - 1) to 2^(bit_depth - 1) - 1. To map a signed
sample to an unsigned one, add 2^(bit_depth - 1) (do it in i64,
since the sum overflows i32 at 32 bits).
signed: boolWhether samples are signed (SIZ component sign bit, or the palette’s).
x_sampling: u8Horizontal sub-sampling factor (SIZ XRsiz); 1 means no
sub-sampling.
y_sampling: u8Vertical sub-sampling factor (SIZ YRsiz); 1 means no
sub-sampling.
samples: Vec<i32>width * height samples, row-major.