Skip to content

Commit db63885

Browse files
committed
[css-color-hdr] Added ΔEITP color difference metric from BT.2124
1 parent 95438c3 commit db63885

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

css-color-hdr-1/Overview.bs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@ WPT Display: open
5858
"publisher": "ITU",
5959
"rawDate": "2018-07-00"
6060
},
61+
"Rec_BT.2124": {
62+
"title": "ITU-R BT.2124-0 Objective metric for the assessment of the potential visibility of colour differences in television",
63+
"href": "https://www.itu.int/dms_pubrec/itu-r/rec/bt/R-REC-BT.2124-0-201901-I!!PDF-E.pdf",
64+
"publisher": "ITU",
65+
"rawDate": "2019-01"
66+
},
6167
"Rec_BT.2390": {
6268
"href": "https://www.itu.int/dms_pub/itu-r/opb/rep/R-REP-BT.2390-8-2020-PDF-E.pdf",
6369
"title": "ITU-R BT.2390-8 High dynamic range television for production and international programme exchange",
@@ -1023,6 +1029,38 @@ Serializing values of the ''color()'' function</h3>
10231029
Values must be <a href="https://drafts.csswg.org/css-values-4/#combine-integers">rounded towards +∞</a>, not truncated.
10241030

10251031

1032+
<!--
1033+
████████ ████████ ██ ████████ ███ ████████
1034+
██ ██ ██ ██ ██ ██ ██ ██
1035+
██ ██ ██ ██ ██ ██ ██ ██
1036+
██ ██ ██████ ██ ██ ██ ██ ██████
1037+
██ ██ ██ ██ ██ █████████ ██
1038+
██ ██ ██ ██ ██ ██ ██ ██
1039+
████████ ████████ ████████ ██ ██ ██ ████████
1040+
-->
1041+
1042+
<h2 id="deltaE">
1043+
Sample code for ΔEITP Color Differences
1044+
</h2>
1045+
1046+
<em>This section is not normative.</em>
1047+
<wpt title="This section is not normative, it does not need tests."></wpt>
1048+
1049+
The ΔEITP [[Rec_BT.2124]] color difference metric
1050+
may be used to measure the perceptual color difference between
1051+
two display-referred colors
1052+
in an HDR or mixed SDR/HDR context,
1053+
for example in display calibration
1054+
or gamut and tone mapping.
1055+
1056+
It is a Euclideam distance in ''ICtCp'' color space,
1057+
scaled such that a ΔEITP of 1.0
1058+
represents one just-noticeable difference.
1059+
1060+
<pre class="include-code lang-javascript">
1061+
path: deltaEITP.js
1062+
highlight: js
1063+
</pre>
10261064

10271065
<!-- Sample section {#sample-topic}
10281066
==============================

css-color-hdr-1/deltaEITP.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Calculate deltaE ITP
2+
// scaled root sum of squares
3+
// ITU-R BT.2124-0 Annex 1
4+
/**
5+
* @param {number[]} reference - Array of ICtCp: I as 0..1, Ct and Cp as -1..1
6+
* @param {number[]} sample - Array of ICtCp: I as 0..1, Ct and Cp as -1..1
7+
* @return {number} How different a color sample is from reference
8+
*/
9+
function deltaEITP (reference, sample) {
10+
let [I1, Ct1, Cp1] = reference;
11+
let [I2, Ct2, Cp2] = sample;
12+
let ΔI = I1 - I2;
13+
let ΔT = 0.5 * (Ct1 - Ct2);
14+
let ΔP = Cp1 - Cp2;
15+
return Math.sqrt(ΔI ** 2 + ΔT ** 2 + ΔP ** 2);
16+
}

0 commit comments

Comments
 (0)