Coverage for colour/models/rgb/transfer_functions/itur_bt_1886.py: 100%
30 statements
« prev ^ index » next coverage.py v7.11.0, created at 2025-11-15 19:01 +1300
« prev ^ index » next coverage.py v7.11.0, created at 2025-11-15 19:01 +1300
1"""
2Recommendation ITU-R BT.1886
3============================
5Define the *Recommendation ITU-R BT.1886* electro-optical transfer function
6(EOTF) and its inverse.
8- :func:`colour.models.eotf_inverse_BT1886`
9- :func:`colour.models.eotf_BT1886`
11References
12----------
13- :cite:`InternationalTelecommunicationUnion2011h` : International
14 Telecommunication Union. (2011). Recommendation ITU-R BT.1886 - Reference
15 electro-optical transfer function for flat panel displays used in HDTV
16 studio production BT Series Broadcasting service.
17 https://www.itu.int/dms_pubrec/itu-r/rec/bt/\
18R-REC-BT.1886-0-201103-I!!PDF-E.pdf
19"""
21from __future__ import annotations
23import numpy as np
25from colour.algebra import spow
26from colour.hints import ( # noqa: TC001
27 Domain1,
28 Range1,
29)
30from colour.utilities import as_float, from_range_1, to_domain_1
32__author__ = "Colour Developers"
33__copyright__ = "Copyright 2013 Colour Developers"
34__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause"
35__maintainer__ = "Colour Developers"
36__email__ = "colour-developers@colour-science.org"
37__status__ = "Production"
39__all__ = [
40 "eotf_inverse_BT1886",
41 "eotf_BT1886",
42]
45def eotf_inverse_BT1886(L: Domain1, L_B: float = 0, L_W: float = 1) -> Range1:
46 """
47 Apply the *Recommendation ITU-R BT.1886* inverse electro-optical
48 transfer function (EOTF) for flat panel displays.
50 Parameters
51 ----------
52 L
53 Screen luminance in :math:`cd/m^2`.
54 L_B
55 Screen luminance for black in :math:`cd/m^2`.
56 L_W
57 Screen luminance for white in :math:`cd/m^2`.
59 Returns
60 -------
61 :class:`numpy.ndarray`
62 Input video signal level (normalised, with black at :math:`V = 0`
63 and white at :math:`V = 1`). For content mastered per
64 *Recommendation ITU-R BT.709*, 10-bit digital code values
65 :math:`D` map into values of :math:`V` per the following equation:
66 :math:`V = (D-64)/876`
68 Notes
69 -----
70 +------------+-----------------------+---------------+
71 | **Domain** | **Scale - Reference** | **Scale - 1** |
72 +============+=======================+===============+
73 | ``L`` | 1 | 1 |
74 +------------+-----------------------+---------------+
76 +------------+-----------------------+---------------+
77 | **Range** | **Scale - Reference** | **Scale - 1** |
78 +============+=======================+===============+
79 | ``V`` | 1 | 1 |
80 +------------+-----------------------+---------------+
82 References
83 ----------
84 :cite:`InternationalTelecommunicationUnion2011h`
86 Examples
87 --------
88 >>> eotf_inverse_BT1886(0.11699185725296059) # doctest: +ELLIPSIS
89 0.4090077...
90 """
92 L = to_domain_1(L)
94 gamma = 2.40
95 gamma_d = 1 / gamma
97 n = L_W**gamma_d - L_B**gamma_d
98 a = n**gamma
99 b = L_B**gamma_d / n
101 V = spow(L / a, gamma_d) - b
103 return as_float(from_range_1(V))
106def eotf_BT1886(V: Domain1, L_B: float = 0, L_W: float = 1) -> Range1:
107 """
108 Apply the *Recommendation ITU-R BT.1886* electro-optical transfer
109 function (EOTF) for flat panel displays.
111 Parameters
112 ----------
113 V
114 Input video signal level (normalised, with black at :math:`V = 0`
115 and white at :math:`V = 1`). For content mastered per
116 *Recommendation ITU-R BT.709*, 10-bit digital code values
117 :math:`D` map into values of :math:`V` per the following equation:
118 :math:`V = (D-64)/876`
119 L_B
120 Screen luminance for black in :math:`cd/m^2`.
121 L_W
122 Screen luminance for white in :math:`cd/m^2`.
124 Returns
125 -------
126 :class:`numpy.ndarray`
127 Screen luminance in :math:`cd/m^2`.
129 Notes
130 -----
131 +------------+-----------------------+---------------+
132 | **Domain** | **Scale - Reference** | **Scale - 1** |
133 +============+=======================+===============+
134 | ``V`` | 1 | 1 |
135 +------------+-----------------------+---------------+
137 +------------+-----------------------+---------------+
138 | **Range** | **Scale - Reference** | **Scale - 1** |
139 +============+=======================+===============+
140 | ``L`` | 1 | 1 |
141 +------------+-----------------------+---------------+
143 References
144 ----------
145 :cite:`InternationalTelecommunicationUnion2011h`
147 Examples
148 --------
149 >>> eotf_BT1886(0.409007728864150) # doctest: +ELLIPSIS
150 0.1169918...
151 """
153 V = to_domain_1(V)
155 gamma = 2.40
156 gamma_d = 1 / gamma
158 n = L_W**gamma_d - L_B**gamma_d
159 a = n**gamma
160 b = L_B**gamma_d / n
161 L = a * spow(np.maximum(V + b, 0), gamma)
163 return as_float(from_range_1(L))