Skip to main content

Colour

Struct Colour 

Source
pub struct Colour {
Show 16 fields pub crc32: Option<Crc32>, pub void: Option<Void>, pub matrix_coefficients: MatrixCoefficients, pub bits_per_channel: BitsPerChannel, pub chroma_subsampling_horz: Option<ChromaSubsamplingHorz>, pub chroma_subsampling_vert: Option<ChromaSubsamplingVert>, pub cb_subsampling_horz: Option<CbSubsamplingHorz>, pub cb_subsampling_vert: Option<CbSubsamplingVert>, pub chroma_siting_horz: ChromaSitingHorz, pub chroma_siting_vert: ChromaSitingVert, pub range: Range, pub transfer_characteristics: TransferCharacteristics, pub primaries: Primaries, pub max_cll: Option<MaxCll>, pub max_fall: Option<MaxFall>, pub mastering_metadata: Option<MasteringMetadata>,
}
Expand description

Settings describing the colour format.

Fields§

§crc32: Option<Crc32>

Optional CRC-32 element for integrity checking.

§void: Option<Void>

void element, useful for reserving space during writing.

§matrix_coefficients: MatrixCoefficients

The Matrix Coefficients of the video used to derive luma and chroma values from red, green, and blue color primaries. For clarity, the value and meanings for MatrixCoefficients are adopted from Table 4 of ISO/IEC 23001-8:2016 or ITU-T H.273.

  • 0 - Identity,
  • 1 - ITU-R BT.709,
  • 2 - unspecified,
  • 3 - reserved,
  • 4 - US FCC 73.682,
  • 5 - ITU-R BT.470BG,
  • 6 - SMPTE 170M,
  • 7 - SMPTE 240M,
  • 8 - YCoCg,
  • 9 - BT2020 Non-constant Luminance,
  • 10 - BT2020 Constant Luminance,
  • 11 - SMPTE ST 2085,
  • 12 - Chroma-derived Non-constant Luminance,
  • 13 - Chroma-derived Constant Luminance,
  • 14 - ITU-R BT.2100-0
§bits_per_channel: BitsPerChannel

Number of decoded bits per channel. A value of 0 indicates that the BitsPerChannel is unspecified.

§chroma_subsampling_horz: Option<ChromaSubsamplingHorz>

The amount of pixels to remove in the Cr and Cb channels for every pixel not removed horizontally. Example: For video with 4:2:0 chroma subsampling, the ChromaSubsamplingHorz SHOULD be set to 1.

§chroma_subsampling_vert: Option<ChromaSubsamplingVert>

The amount of pixels to remove in the Cr and Cb channels for every pixel not removed vertically. Example: For video with 4:2:0 chroma subsampling, the ChromaSubsamplingVert SHOULD be set to 1.

§cb_subsampling_horz: Option<CbSubsamplingHorz>

The amount of pixels to remove in the Cb channel for every pixel not removed horizontally. This is additive with ChromaSubsamplingHorz. Example: For video with 4:2:1 chroma subsampling, the ChromaSubsamplingHorz SHOULD be set to 1 and CbSubsamplingHorz SHOULD be set to 1.

§cb_subsampling_vert: Option<CbSubsamplingVert>

The amount of pixels to remove in the Cb channel for every pixel not removed vertically. This is additive with ChromaSubsamplingVert.

§chroma_siting_horz: ChromaSitingHorz

How chroma is subsampled horizontally.

  • 0 - unspecified,
  • 1 - left collocated,
  • 2 - half
§chroma_siting_vert: ChromaSitingVert

How chroma is subsampled vertically.

  • 0 - unspecified,
  • 1 - top collocated,
  • 2 - half
§range: Range

Clipping of the color ranges.

  • 0 - unspecified,
  • 1 - broadcast range,
  • 2 - full range (no clipping),
  • 3 - defined by MatrixCoefficients / TransferCharacteristics
§transfer_characteristics: TransferCharacteristics

The transfer characteristics of the video. For clarity, the value and meanings for TransferCharacteristics are adopted from Table 3 of ISO/IEC 23091-4 or ITU-T H.273.

  • 0 - reserved,
  • 1 - ITU-R BT.709,
  • 2 - unspecified,
  • 3 - reserved2,
  • 4 - Gamma 2.2 curve - BT.470M,
  • 5 - Gamma 2.8 curve - BT.470BG,
  • 6 - SMPTE 170M,
  • 7 - SMPTE 240M,
  • 8 - Linear,
  • 9 - Log,
  • 10 - Log Sqrt,
  • 11 - IEC 61966-2-4,
  • 12 - ITU-R BT.1361 Extended Colour Gamut,
  • 13 - IEC 61966-2-1,
  • 14 - ITU-R BT.2020 10 bit,
  • 15 - ITU-R BT.2020 12 bit,
  • 16 - ITU-R BT.2100 Perceptual Quantization,
  • 17 - SMPTE ST 428-1,
  • 18 - ARIB STD-B67 (HLG)
§primaries: Primaries

The colour primaries of the video. For clarity, the value and meanings for Primaries are adopted from Table 2 of ISO/IEC 23091-4 or ITU-T H.273.

  • 0 - reserved,
  • 1 - ITU-R BT.709,
  • 2 - unspecified,
  • 3 - reserved2,
  • 4 - ITU-R BT.470M,
  • 5 - ITU-R BT.470BG - BT.601 625,
  • 6 - ITU-R BT.601 525 - SMPTE 170M,
  • 7 - SMPTE 240M,
  • 8 - FILM,
  • 9 - ITU-R BT.2020,
  • 10 - SMPTE ST 428-1,
  • 11 - SMPTE RP 432-2,
  • 12 - SMPTE EG 432-2,
  • 22 - EBU Tech. 3213-E - JEDEC P22 phosphors
§max_cll: Option<MaxCll>

Maximum brightness of a single pixel (Maximum Content Light Level) in candelas per square meter (cd/m^2^).

§max_fall: Option<MaxFall>

Maximum brightness of a single full frame (Maximum Frame-Average Light Level) in candelas per square meter (cd/m^2^).

§mastering_metadata: Option<MasteringMetadata>

SMPTE 2086 mastering data.

Trait Implementations§

Source§

impl Clone for Colour

Source§

fn clone(&self) -> Colour

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Colour

Source§

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

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

impl Default for Colour

Source§

fn default() -> Colour

Returns the “default value” for a type. Read more
Source§

impl Element for Colour

Source§

const ID: VInt64

EBML ID of the element.
Source§

fn decode_body<B: Buf>(buf: &mut B) -> Result<Self>

Decode the body of the element from a buffer.
Source§

fn encode_body<B: BufMut>(&self, buf: &mut B) -> Result<()>

Encode the body of the element to a buffer.
Source§

const HAS_DEFAULT_VALUE: bool = false

Whether the element has a default value, as per Matroska specification. If true, and the element is missing in a master element, it should be treated as if it were present with the default value. If false, and the element is missing in a master element, it should be treated as an error.
Source§

impl PartialEq for Colour

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Colour

Auto Trait Implementations§

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> AsyncReadElement for T
where T: Element,

Source§

fn async_read_element<R: AsyncRead + Unpin + ?Sized>( header: &Header, r: &mut R, ) -> impl Future<Output = Result<Self>>

Available on crate feature tokio only.
Read an element from a reader provided the header.
Source§

impl<T> AsyncReadFrom for T
where T: Element,

Source§

async fn async_read_from<R>(r: &mut R) -> Result<T, Error>
where R: AsyncRead + Unpin + ?Sized,

Available on crate feature tokio only.
Read Self from a reader.
Source§

impl<T> AsyncWriteElement for T
where T: Element,

Source§

fn async_write_element<W: AsyncWrite + Unpin + ?Sized>( &self, header: &Header, w: &mut W, ) -> impl Future<Output = Result<()>>

Available on crate feature tokio only.
Write an element to a writer asynchronously.
Source§

impl<T> AsyncWriteTo for T
where T: Encode,

Source§

async fn async_write_to<W>(&self, w: &mut W) -> Result<(), Error>
where W: AsyncWrite + Unpin + ?Sized,

Available on crate feature tokio only.
Write to a writer asynchronously.
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> ReadElement for T
where T: Element,

Source§

fn read_element<R: Read + ?Sized>(header: &Header, r: &mut R) -> Result<Self>

Read an element from a reader provided the header.
Source§

impl<T> ReadFrom for T
where T: Element,

Source§

fn read_from<R>(r: &mut R) -> Result<T, Error>
where R: Read + ?Sized,

Read Self from a reader.
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, 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.
Source§

impl<T> WriteElement for T
where T: Element,

Source§

fn write_element<W: Write + ?Sized>( &self, header: &Header, w: &mut W, ) -> Result<()>

Write an element to a writer.
Source§

impl<T> WriteTo for T
where T: Encode,

Source§

fn write_to<W>(&self, w: &mut W) -> Result<(), Error>
where W: Write + ?Sized,

Write to a writer.