#[non_exhaustive]pub struct Cicp {
pub color_primaries: u8,
pub transfer_characteristics: u8,
pub matrix_coefficients: u8,
pub full_range: bool,
}Expand description
4-byte ITU-T H.273 color description (CP, TC, MC, full_range).
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.color_primaries: u8ColourPrimaries (1 = BT.709/sRGB, 4 = BT.470M, 5 = BT.470BG, 6 = BT.601,
7 = SMPTE 240M, 8 = Generic Film, 9 = BT.2020, 10 = XYZ, 11 = DCI-P3,
12 = Display P3, 22 = EBU Tech 3213).
transfer_characteristics: u8TransferCharacteristics (1 = BT.709, 4 = Gamma 2.2, 5 = Gamma 2.8, 6 = BT.601,
7 = SMPTE 240M, 8 = Linear, 9 = Log100, 10 = Log100Sqrt10, 11 = IEC 61966-2-4,
12 = BT.1361, 13 = sRGB, 14 = BT.2020 10-bit, 15 = BT.2020 12-bit, 16 = PQ,
17 = SMPTE ST 428-1, 18 = HLG).
matrix_coefficients: u8MatrixCoefficients (0 = Identity/RGB, 1 = BT.709, 4 = FCC, 5 = BT.470BG,
6 = BT.601, 7 = SMPTE 240M, 8 = YCgCo, 9 = BT.2020 NCL, 12 = Chroma-derived NCL).
full_range: booltrue = full range, false = narrow/studio swing.
Implementations§
Source§impl Cicp
impl Cicp
Sourcepub const DCI_P3_SRGB: Cicp
pub const DCI_P3_SRGB: Cicp
DCI-P3 primaries (SMPTE RP 431-2 theater white) with sRGB transfer (11, 13, 0, true).
Sourcepub const DCI_P3_CINEMA: Cicp
pub const DCI_P3_CINEMA: Cicp
DCI-P3 digital cinema (SMPTE RP 431-2 primaries + SMPTE ST 428-1 2.6 transfer) (11, 17, 0, true).
Sourcepub const DISPLAY_P3: Cicp
pub const DISPLAY_P3: Cicp
Display P3 (D65 white, sRGB transfer) RGB (12, 13, 0, true).
Sourcepub const LINEAR_SRGB: Cicp
pub const LINEAR_SRGB: Cicp
Linear sRGB RGB (1, 8, 0, true).
Sourcepub const BT2100_PQ_RGB: Cicp
pub const BT2100_PQ_RGB: Cicp
BT.2100 PQ RGB full range (9, 16, 0, true).
Sourcepub const BT2100_PQ_YCBCR_FULL: Cicp
pub const BT2100_PQ_YCBCR_FULL: Cicp
BT.2100 PQ YCbCr full range (9, 16, 9, true).
Sourcepub const BT2100_PQ_YCBCR_LIMITED: Cicp
pub const BT2100_PQ_YCBCR_LIMITED: Cicp
BT.2100 PQ YCbCr limited/narrow broadcast range (9, 16, 9, false).
Sourcepub const BT2100_HLG_RGB: Cicp
pub const BT2100_HLG_RGB: Cicp
BT.2100 HLG RGB full range (9, 18, 0, true).
Sourcepub const BT2100_HLG_YCBCR_FULL: Cicp
pub const BT2100_HLG_YCBCR_FULL: Cicp
BT.2100 HLG YCbCr full range (9, 18, 9, true).
Sourcepub const BT2100_HLG_YCBCR_LIMITED: Cicp
pub const BT2100_HLG_YCBCR_LIMITED: Cicp
BT.2100 HLG YCbCr limited/narrow broadcast range (9, 18, 9, false).
Sourcepub const fn new(
color_primaries: u8,
transfer_characteristics: u8,
matrix_coefficients: u8,
full_range: bool,
) -> Cicp
pub const fn new( color_primaries: u8, transfer_characteristics: u8, matrix_coefficients: u8, full_range: bool, ) -> Cicp
Construct a CICP tuple from raw H.273 codes.
Sourcepub fn try_from_bytes(bytes: [u8; 4]) -> Result<Cicp, At<CicpError>>
pub fn try_from_bytes(bytes: [u8; 4]) -> Result<Cicp, At<CicpError>>
Strictly decode a 4-byte wire payload [CP, TC, MC, full_range_u8], rejecting
invalid video_full_range_flag values (> 1) per ITU-T H.273 §8.3 / PNG 3.
Sourcepub const fn from_bytes_lenient(bytes: [u8; 4]) -> Cicp
pub const fn from_bytes_lenient(bytes: [u8; 4]) -> Cicp
Permissively decode from a 4-byte wire payload [CP, TC, MC, full_range_u8]
(treating any non-zero 4th byte as full range). For strict wire validation,
use try_from_bytes.
Sourcepub const fn primaries_name(self) -> Option<&'static str>
pub const fn primaries_name(self) -> Option<&'static str>
Human-readable ITU-T H.273 name for self.color_primaries, if known.
Sourcepub const fn transfer_name(self) -> Option<&'static str>
pub const fn transfer_name(self) -> Option<&'static str>
Human-readable ITU-T H.273 name for self.transfer_characteristics, if known.
Sourcepub const fn matrix(self) -> MatrixCoefficients
pub const fn matrix(self) -> MatrixCoefficients
Typed MatrixCoefficients wrapper for self.matrix_coefficients.
Sourcepub const fn matrix_name(self) -> Option<&'static str>
pub const fn matrix_name(self) -> Option<&'static str>
Human-readable ITU-T H.273 name for self.matrix_coefficients, if known.
Sourcepub fn to_color_space(
self,
alpha: AlphaMode,
) -> Result<ColorSpace, At<CicpError>>
pub fn to_color_space( self, alpha: AlphaMode, ) -> Result<ColorSpace, At<CicpError>>
Project an Identity-matrix (MC == 0) CICP tuple into an algebraic ColorSpace::Rgb.