pub struct ColorMatrix {
pub coeffs: [[f32; 3]; 3],
pub offsets: [f32; 3],
pub clamp: bool,
}Expand description
3×3 colour-conversion matrix with per-row offsets, programmed into
the DCMIPP Pipe1 ISP via Pipe1::set_color_matrix.
Hardware applies out = M · in + offset, optionally clamped to
8-bit unsigned. Coefficients are encoded as 11-bit signed Q2.8
(effective range -4.0 ..= +3.996, identity coefficient 1.0);
offsets are 10-bit signed integers (range -512 ..= 511) added to
the matrix product before the optional clamp.
Typical use: write a colour-correction matrix derived from sensor
characterisation against a Macbeth chart, plus zero offsets, plus
clamp = true for 8-bit display output. For pass-through use
ColorMatrix::IDENTITY.
Fields§
§coeffs: [[f32; 3]; 3]Row-major 3×3 coefficients. Element [i][j] multiplies input
channel j to contribute to output channel i, with rows in
R/G/B order.
offsets: [f32; 3]Per-row offsets in 8-bit-output units, i.e. an offset of +16.0
shifts the corresponding output channel up by 16/255.
clamp: boolClamp the output to [0, 255]. Recommended true for 8-bit
display / capture pipelines. Applies to the hardware’s unsigned
8-bit output mode (P1CCCR.TYPE = 0); the signed-output mode is
not exposed by this struct.
Implementations§
Source§impl ColorMatrix
impl ColorMatrix
Sourcepub const IDENTITY: Self
pub const IDENTITY: Self
Identity matrix with zero offsets and clamping enabled. Passing
this to Pipe1::set_color_matrix should produce a frame
pixel-identical to “no CCM applied” — a useful sanity check
that the encoding into the hardware Q-format is correct.
Trait Implementations§
Source§impl Clone for ColorMatrix
impl Clone for ColorMatrix
Source§fn clone(&self) -> ColorMatrix
fn clone(&self) -> ColorMatrix
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more