#[non_exhaustive]pub enum YcbcrMatrix {
Identity,
Bt709,
Fcc,
Bt470Bg,
Bt601,
Smpte240M,
YCgCo,
Bt2020,
ChromaDerivedNcl,
}Expand description
YCbCr / GBR / YCgCo luma-chroma matrix standard (ITU-T H.273 Table 4).
Every distinct H.273 Table 4 non-constant-luminance code has its own variant so
from_cicp_code ↔ to_cicp_code is
100% lossless (e.g. 5 = Bt470Bg and 6 = Bt601
stay distinct on the wire while sharing coefficients via
same_coefficients).
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Identity
Identity / GBR (MC = 0: Y = G, Cb = B, Cr = R, lossless RGB in planar form).
Bt709
ITU-R BT.709 (MC = 1: Kr = 0.2126, Kb = 0.0722).
Fcc
FCC Title 47 CFR 73.682 (MC = 4: Kr = 0.30, Kb = 0.11).
Bt470Bg
ITU-R BT.470-6 System B, G (MC = 5: Kr = 0.299, Kb = 0.114).
Bt601
SMPTE 170M / ITU-R BT.601 (MC = 6: Kr = 0.299, Kb = 0.114).
Smpte240M
SMPTE 240M (MC = 7: Kr = 0.212, Kb = 0.087).
YCgCo
YCgCo (MC = 8: R = Y - Cg + Co, G = Y + Cg, B = Y - Cg - Co).
Bt2020
ITU-R BT.2020 NCL (MC = 9: Kr = 0.2627, Kb = 0.0593).
ChromaDerivedNcl
Chromaticity-derived non-constant luminance (MC = 12: Kr, Kb derived from primaries).
Implementations§
Source§impl YcbcrMatrix
impl YcbcrMatrix
Sourcepub const fn from_cicp_code(code: u8) -> Option<Self>
pub const fn from_cicp_code(code: u8) -> Option<Self>
Losslessly map an ITU-T H.273 Table 4 matrix_coefficients code to a YcbcrMatrix.
Recognizes 0 (Identity / GBR), 1 (Bt709), 4 (Fcc), 5 (Bt470Bg),
6 (Bt601), 7 (Smpte240M), 8 (YCgCo), 9 (Bt2020), and 12
(ChromaDerivedNcl). Returns None for unspecified (2), reserved (3), or
non-NCL matrix codes.
Sourcepub const fn from_matrix_coefficients(mc: MatrixCoefficients) -> Option<Self>
pub const fn from_matrix_coefficients(mc: MatrixCoefficients) -> Option<Self>
Losslessly map a typed MatrixCoefficients wrapper to a YcbcrMatrix.
Returns None for unspecified (2), reserved (3), or non-NCL matrix codes
(such as BT2020_CL or ICTCP).
Sourcepub const fn to_matrix_coefficients(self) -> MatrixCoefficients
pub const fn to_matrix_coefficients(self) -> MatrixCoefficients
Exact typed MatrixCoefficients for this matrix.
Sourcepub const fn to_cicp_code(self) -> u8
pub const fn to_cicp_code(self) -> u8
Exact ITU-T H.273 Table 4 matrix_coefficients code for this matrix.
Sourcepub const fn same_coefficients(self, other: Self) -> bool
pub const fn same_coefficients(self, other: Self) -> bool
Whether self and other define identical luma-chroma reconstruction coefficients
(e.g. Bt470Bg (MC = 5) and Bt601 (MC = 6) share Kr = 0.299, Kb = 0.114).
Trait Implementations§
Source§impl Clone for YcbcrMatrix
impl Clone for YcbcrMatrix
Source§fn clone(&self) -> YcbcrMatrix
fn clone(&self) -> YcbcrMatrix
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more