1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
//! HDR metadata types for high-dynamic-range video.
//!
//! This module provides [`Hdr10Metadata`] and [`MasteringDisplay`] for HDR10
//! static metadata embedding.
/// HDR10 static metadata (`MaxCLL` + `MaxFALL` + mastering display).
///
/// Pass to `VideoEncoderBuilder::hdr10_metadata` (in `ff-encode`) to embed
/// HDR10 static metadata in the encoded output using
/// `AV_PKT_DATA_CONTENT_LIGHT_LEVEL` and
/// `AV_PKT_DATA_MASTERING_DISPLAY_METADATA` packet side data.
///
/// Setting this automatically configures the codec context with:
/// - `color_primaries = BT.2020`
/// - `color_trc = SMPTE ST 2084 (PQ)`
/// - `colorspace = BT.2020 NCL`
/// Mastering display colour volume (SMPTE ST 2086).
///
/// Chromaticity coordinates use a denominator of 50000 (each value represents
/// `n / 50000` in CIE 1931 xy). Luminance values use a denominator of 10000
/// (each value represents `n / 10000` nits).
///
/// # Examples
///
/// BT.2020 D65 primaries / 1000 nit peak / 0.005 nit black:
///
/// ```
/// use ff_format::hdr::MasteringDisplay;
///
/// let md = MasteringDisplay {
/// red_x: 17000, red_y: 8500,
/// green_x: 13250, green_y: 34500,
/// blue_x: 7500, blue_y: 3000,
/// white_x: 15635, white_y: 16450,
/// min_luminance: 50, // 0.005 nits
/// max_luminance: 10_000_000, // 1000 nits
/// };
/// ```