wgpu_external_frame/ycbcr.rs
1//! How YCbCr samples map to R'G'B', shared by every import that hands out
2//! YCbCr planes.
3
4/// How a YCbCr frame's samples map to non-linear R'G'B': the matrix and the
5/// code range a consumer needs to convert them.
6#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
7pub struct YcbcrEncoding {
8 /// The YCbCr to R'G'B' matrix.
9 pub matrix: YcbcrMatrix,
10 /// The code range the samples span.
11 pub range: YcbcrRange,
12}
13
14/// YCbCr to R'G'B' matrix coefficients.
15#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
16pub enum YcbcrMatrix {
17 /// ITU-R BT.601.
18 Bt601,
19 /// ITU-R BT.709.
20 Bt709,
21 /// ITU-R BT.2020, non-constant luminance.
22 Bt2020,
23}
24
25/// The code range YCbCr samples span.
26#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
27pub enum YcbcrRange {
28 /// Video ("studio") range: luma spans 16–235 and chroma 16–240, at 8 bits.
29 Video,
30 /// Full range: luma and chroma span every code value.
31 Full,
32}