#[non_exhaustive]pub enum Color {
Bt601Limited,
Bt601Full,
Bt709Limited,
Bt709Full,
}Expand description
Which YUV color space a frame’s samples are in.
Video carries luma and chroma, not RGB, and the matrix that converts between them differs by generation (BT.601 for standard definition, BT.709 for high definition) as does the numeric range (limited/studio swing pins luma to 16..235, full/full swing uses 0..255). Pairing samples with the wrong matrix is the classic tinted-video bug: it leaves grays untouched and skews saturated colors, so it survives a casual look at the picture.
Surface::color reports it where the crate knows:
when the crate did the conversion itself, or when the surface carries the
answer (a macOS pixel buffer names its matrix, which VideoToolbox copies out
of the stream’s VUI). It is None for pixels that merely passed through with
nothing naming their space, a camera’s raw YUYV among them.
Color::infer is the fallback then.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Bt601Limited
BT.601 (standard definition), limited range.
Bt601Full
BT.601 (standard definition), full range.
Bt709Limited
BT.709 (high definition), limited range.
Bt709Full
BT.709 (high definition), full range.
Implementations§
Source§impl Color
impl Color
Sourcepub fn infer(size: Size) -> Self
pub fn infer(size: Size) -> Self
The conventional guess for a frame of this size: BT.601 up to standard definition (576 lines), BT.709 above it, both limited range.
What a player does when the bitstream carries no VUI color description,
which is most of the time. A guess, so prefer a known Color whenever
one is available.
Trait Implementations§
impl Copy for Color
impl Eq for Color
impl StructuralPartialEq for Color
Auto Trait Implementations§
impl Freeze for Color
impl RefUnwindSafe for Color
impl Send for Color
impl Sync for Color
impl Unpin for Color
impl UnsafeUnpin for Color
impl UnwindSafe for Color
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.