Skip to content

Commit 82570ab

Browse files
committed
Update comments
1 parent 3cbcc79 commit 82570ab

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

coloraide/spaces/ipt.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,12 @@
1111
from ..cat import WHITES
1212
from ..types import Vector
1313

14-
# IPT matrices for LMS conversion with better accuracy for 64 bit doubles,
15-
# but also adapted for our specific D65 white point.
14+
# IPT matrices are only provided with around 16 bit accuracy.
15+
# We've provided matrices for cleaner conversions for 64 bit doubles
16+
# that maintain the accuracy within the first 16 bits.
17+
# Additionally, we've adapted the matrices to accommodate our D65 white point
18+
# which is slightly different than the one used in the IPT paper with comparable
19+
# 16 bit results.
1620
XYZ_TO_LMS = [
1721
[0.40021437220265654, 0.7075074077935767, -0.0807060322407405],
1822
[-0.22798649207313385, 1.1500016565804587, 0.061235922568512555],

tools/calc_ipt_matrices.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,14 @@
3838
[0.8056, 0.3572, -1.1628]
3939
]
4040

41-
# IPT was originally created using the white point `[0.9504, 1.0, 1.0889]`,
42-
# but we don't use that white point. While we could use specifically for IPT,
43-
# we can adapt the matrix for our specific white point as shown below.
44-
41+
# IPT XYZ <-> LMS transform was originally created and optimized for the
42+
# white point `[0.9504, 1.0, 1.0889]`, but our library uses `color(xyz-d65 0.95046 1 1.0891 / 1)`,
43+
# but without rounding. While we could use the IPT white point, chromatically adapting ours
44+
# to theirs, we've decided to just adapt the XYZ <-> LMS matrix. This could be done in two ways,
45+
# combine the XYZ <-> LMS matrix with a Bradford adaptation matrix, or just adapt the matrix
46+
# to yield an LMS of [1, 1, 1] when given our white point. Since the IPT matrices are
47+
# only accurate up to 16 bit anyway and the white points are so close, the end result is
48+
# comparable either way, both yielding the same IPT values up to 16 bit.
4549
lms = alg.solve(m1, white_d65)
4650
lms2xyz = alg.multiply(m1, lms)
4751
xyz2lms = alg.inv(lms2xyz)

0 commit comments

Comments
 (0)