Skip to main content

Cicp

Struct Cicp 

Source
#[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
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§color_primaries: u8

ColourPrimaries (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: u8

TransferCharacteristics (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: u8

MatrixCoefficients (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: bool

true = full range, false = narrow/studio swing.

Implementations§

Source§

impl Cicp

Source

pub const SRGB: Cicp

sRGB RGB (1, 13, 0, true).

Source

pub const DCI_P3_SRGB: Cicp

DCI-P3 primaries (SMPTE RP 431-2 theater white) with sRGB transfer (11, 13, 0, true).

Source

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).

Source

pub const DISPLAY_P3: Cicp

Display P3 (D65 white, sRGB transfer) RGB (12, 13, 0, true).

Source

pub const LINEAR_SRGB: Cicp

Linear sRGB RGB (1, 8, 0, true).

Source

pub const BT709_RGB: Cicp

BT.709 RGB (1, 1, 0, true).

Source

pub const BT2100_PQ_RGB: Cicp

BT.2100 PQ RGB full range (9, 16, 0, true).

Source

pub const BT2100_PQ_YCBCR_FULL: Cicp

BT.2100 PQ YCbCr full range (9, 16, 9, true).

Source

pub const BT2100_PQ_YCBCR_LIMITED: Cicp

BT.2100 PQ YCbCr limited/narrow broadcast range (9, 16, 9, false).

Source

pub const BT2100_HLG_RGB: Cicp

BT.2100 HLG RGB full range (9, 18, 0, true).

Source

pub const BT2100_HLG_YCBCR_FULL: Cicp

BT.2100 HLG YCbCr full range (9, 18, 9, true).

Source

pub const BT2100_HLG_YCBCR_LIMITED: Cicp

BT.2100 HLG YCbCr limited/narrow broadcast range (9, 18, 9, false).

Source

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.

Source

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.

Source

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.

Source

pub const fn to_bytes(self) -> [u8; 4]

Encode to PNG cICP 4-byte wire payload.

Source

pub const fn primaries_name(self) -> Option<&'static str>

Human-readable ITU-T H.273 name for self.color_primaries, if known.

Source

pub const fn transfer_name(self) -> Option<&'static str>

Human-readable ITU-T H.273 name for self.transfer_characteristics, if known.

Source

pub const fn matrix(self) -> MatrixCoefficients

Typed MatrixCoefficients wrapper for self.matrix_coefficients.

Source

pub const fn matrix_name(self) -> Option<&'static str>

Human-readable ITU-T H.273 name for self.matrix_coefficients, if known.

Source

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.

Source§

impl Cicp

Source

pub fn from_icc(icc_bytes: &[u8]) -> Option<Cicp>

Read the cicp tag of an ICC profile (ICC v4.4+), or None when absent.

Trait Implementations§

Source§

impl Clone for Cicp

Source§

fn clone(&self) -> Cicp

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Cicp

Source§

impl Debug for Cicp

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Display for Cicp

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Eq for Cicp

Source§

impl From<Cicp> for CicpTag

Source§

fn from(cicp: Cicp) -> CicpTag

Converts to this type from the input type.
Source§

impl From<Cicp> for Cicp

Available on crate feature image only.
Source§

fn from(c: Cicp) -> Cicp

Converts to this type from the input type.
Source§

impl Hash for Cicp

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Cicp

Source§

fn eq(&self, other: &Cicp) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Cicp

Auto Trait Implementations§

§

impl Freeze for Cicp

§

impl RefUnwindSafe for Cicp

§

impl Send for Cicp

§

impl Sync for Cicp

§

impl Unpin for Cicp

§

impl UnsafeUnpin for Cicp

§

impl UnwindSafe for Cicp

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.