| 1 |
/// `Bt709` works for sRGB images. |
| 2 |
#[derive(Debug, Copy, Clone, PartialEq, Eq)] |
| 3 |
#[non_exhaustive] |
| 4 |
pub enum ColorPrimaries { |
| 5 |
/// Rec.709 and sRGB |
| 6 |
Bt709 = 1, |
| 7 |
Unspecified = 2, |
| 8 |
/// ITU-R BT601-6 525 |
| 9 |
Bt601 = 6, |
| 10 |
/// ITU-R BT2020 |
| 11 |
Bt2020 = 9, |
| 12 |
/// SMPTE ST 431-2. NB: "P3" images use DisplayP3 instead. |
| 13 |
DciP3 = 11, |
| 14 |
/// SMPTE ST 432-1 |
| 15 |
DisplayP3 = 12, |
| 16 |
} |
| 17 |
|
| 18 |
/// This controls how color data is interpreted (gamma). |
| 19 |
/// |
| 20 |
/// If you don't know what to do with these, pick `Srgb`. |
| 21 |
/// |
| 22 |
/// Reasonable options include `Bt709` (HDTV), `Bt2020_10` (Wide Gamut), `Smpte2084`, `Hlg` (HDR). |
| 23 |
#[derive(Debug, Copy, Clone, PartialEq, Eq)] |
| 24 |
#[non_exhaustive] |
| 25 |
pub enum TransferCharacteristics { |
| 26 |
/// Rec.709. May be appropriate for conversions from video. |
| 27 |
Bt709 = 1, |
| 28 |
/// Don't use this for color channels. |
| 29 |
Unspecified = 2, |
| 30 |
/// Don't use this. Analog NTSC TV. BT.470 System M (historical) |
| 31 |
#[deprecated(note = "This is obsolete. Please don't proliferate legacy baggage.")] |
| 32 |
#[doc(hidden)] |
| 33 |
Bt470M = 4, |
| 34 |
/// Don't use this. Analog PAL TV. BT.470 System B, G (historical) |
| 35 |
#[deprecated(note = "This is obsolete. Please don't proliferate legacy baggage.")] |
| 36 |
#[doc(hidden)] |
| 37 |
Bt470BG = 5, |
| 38 |
/// ITU-R BT601-6 525. Not recommended, unless you're converting from unlabelled low-res video clips. |
| 39 |
/// See `Bt709` and `Srgb`. |
| 40 |
Bt601 = 6, |
| 41 |
/// Don't use this. SMPTE 240 M. It's just a worse Rec.709. |
| 42 |
Smpte240 = 7, |
| 43 |
/// "Linear transfer characteristics" |
| 44 |
Linear = 8, |
| 45 |
/// "Logarithmic transfer characteristic (100:1 range)" |
| 46 |
Log = 9, |
| 47 |
/// "Logarithmic transfer characteristic (100 * Sqrt(10) : 1 range)" |
| 48 |
LogSqrt = 10, |
| 49 |
/// IEC 61966-2-4 |
| 50 |
Iec61966 = 11, |
| 51 |
/// Don't use this. Obsoleted BT.1361 extended color gamut system (historical) |
| 52 |
#[deprecated(note = "This is obsolete. Please don't proliferate legacy baggage.")] |
| 53 |
#[doc(hidden)] |
| 54 |
Bt1361 = 12, |
| 55 |
/// sRGB. This is the safe choice for encoding "standard" RGB images, especially 8-bit inputs. |
| 56 |
Srgb = 13, |
| 57 |
/// ITU-R BT2020 for 10-bit system. Reasonable for encoding wide gamut. |
| 58 |
Bt2020_10 = 14, |
| 59 |
/// ITU-R BT2020 for 12-bit system |
| 60 |
Bt2020_12 = 15, |
| 61 |
/// SMPTE ST 2084, ITU BT.2100 PQ |
| 62 |
Smpte2084 = 16, |
| 63 |
/// SMPTE ST 428. Not recommended. Overkill for images. Use `Bt2020_10` instead. |
| 64 |
Smpte428 = 17, |
| 65 |
/// BT.2100 HLG (Hybrid Log Gamma), ARIB STD-B67 |
| 66 |
Hlg = 18, |
| 67 |
} |
| 68 |
|
| 69 |
/// This is the format of color channels. |
| 70 |
#[derive(Debug, Copy, Clone, PartialEq, Eq)] |
| 71 |
#[non_exhaustive] |
| 72 |
pub enum MatrixCoefficients { |
| 73 |
/// GBR (sRGB). This isn't actually good for most RGB images. Use `Bt709` for lossy and `Ycgco` for lossless. |
| 74 |
Rgb = 0, |
| 75 |
/// ITU-R BT1361 |
| 76 |
Bt709 = 1, |
| 77 |
Unspecified = 2, |
| 78 |
/// ITU-R BT601-6 525. This matches luma in JPEG's YCbCr when used with sRGB transfer characteristics, but is a bit off for chroma. |
| 79 |
Bt601 = 6, |
| 80 |
Ycgco = 8, |
| 81 |
/// ITU-R BT2020 non-constant luminance system |
| 82 |
Bt2020Ncl = 9, |
| 83 |
/// ITU-R BT2020 constant luminance system |
| 84 |
Bt2020Cl = 10, |
| 85 |
} |