Skip to content

Commit

Permalink
Merge branch 'main' into formatting-v2
Browse files Browse the repository at this point in the history
* main:
  More consistent formatting across the codebase. (color-js#372)
  More accurate ICtCp matrices (color-js#365)
  Fix Jzazbz tests (color-js#366)
  • Loading branch information
jgerigmeyer committed Nov 29, 2023
2 parents aac6e62 + 742728d commit 4002a47
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 22 deletions.
18 changes: 9 additions & 9 deletions scripts/cat-mat.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@ const d50 = [0.3457 / 0.3585, 1.00000, (1.0 - 0.3457 - 0.3585) / 0.3585];
const d65 = [0.3127 / 0.3290, 1.00000, (1.0 - 0.3127 - 0.3290) / 0.3290];

const bradford = [
[0.8951000, 0.2664000, -0.1614000],
[-0.7502000, 1.7135000, 0.0367000],
[0.0389000, -0.0685000, 1.0296000]
[ 0.8951000, 0.2664000, -0.1614000 ],
[ -0.7502000, 1.7135000, 0.0367000 ],
[ 0.0389000, -0.0685000, 1.0296000 ]
];

const von_kries = [
[0.4002400, 0.7076000, -0.0808100],
[-0.2263000, 1.1653200, 0.0457000],
[0.0000000, 0.0000000, 0.9182200]
[ 0.4002400, 0.7076000, -0.0808100 ],
[ -0.2263000, 1.1653200, 0.0457000 ],
[ 0.0000000, 0.0000000, 0.9182200 ]
];

const cat02 = [
[0.7328000, 0.4296000, -0.1624000],
[-0.7036000, 1.6975000, 0.0061000],
[0.0030000, 0.0136000, 0.9834000]
[ 0.7328000, 0.4296000, -0.1624000 ],
[ -0.7036000, 1.6975000, 0.0061000 ],
[ 0.0030000, 0.0136000, 0.9834000 ]
];

const cat16 = [
Expand Down
18 changes: 9 additions & 9 deletions src/spaces/ictcp.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ const im2 = 32 / 2523;
// The matrix below includes the 4% crosstalk components
// and is from the Dolby "What is ICtCp" paper"
const XYZtoLMS_M = [
[ 0.3592, 0.6976, -0.0358],
[-0.1922, 1.1004, 0.0755],
[ 0.0070, 0.0749, 0.8434]
[ 0.3592832590121217, 0.6976051147779502, -0.0358915932320290 ],
[ -0.1920808463704993, 1.1004767970374321, 0.0753748658519118 ],
[ 0.0070797844607479, 0.0748396662186362, 0.8433265453898765 ]
];
// linear-light Rec.2020 to LMS, again with crosstalk
// rational terms from Jan Fröhlich,
Expand All @@ -40,9 +40,9 @@ const LMStoIPT_M = [

// inverted matrices, calculated from the above
const IPTtoLMS_M = [
[0.99998889656284013833, 0.00860505014728705821, 0.1110343715986164786 ],
[1.0000111034371598616, -0.00860505014728705821, -0.1110343715986164786 ],
[1.000032063391005412, 0.56004913547279000113, -0.32063391005412026469],
[ 0.9999999999999998, 0.0086090370379328, 0.1110296250030260 ],
[ 0.9999999999999998, -0.0086090370379328, -0.1110296250030259 ],
[ 0.9999999999999998, 0.5600313357106791, -0.3206271749873188 ]
];
/*
const LMStoRec2020_M = [
Expand All @@ -52,9 +52,9 @@ const LMStoRec2020_M = [
];
*/
const LMStoXYZ_M = [
[ 2.0701800566956135096, -1.3264568761030210255, 0.20661600684785517081 ],
[ 0.36498825003265747974, 0.68046736285223514102, -0.045421753075853231409],
[-0.049595542238932107896, -0.049421161186757487412, 1.1879959417328034394 ]
[ 2.0701522183894223, -1.3263473389671563, 0.2066510476294053 ],
[ 0.3647385209748072, 0.6805660249472273, -0.0453045459220347 ],
[ -0.0497472075358123, -0.0492609666966131, 1.1880659249923042 ]
];

// Only the PQ form of ICtCp is implemented here. There is also an HLG form.
Expand Down
4 changes: 2 additions & 2 deletions test/conversions.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,11 +235,11 @@ const tests = {
tests: [
{
args: ["color(jzazbz 0.5 0 0)", "xyz-d65"],
expect: [8.103011, 8.39796, 6.924744]
expect: [7.986957, 8.397692, 9.136922]
},
{
args: ["color(jzazbz 1 0 0)", "xyz-d65"],
expect: [48.887976, 50.667498, 41.779127]
expect: [48.187785, 50.665878, 55.125885]
},
{
args: ["color(jzazbz 0.1 -0.05 0.05)", "xyz-d65"],
Expand Down
4 changes: 2 additions & 2 deletions tests/conversions.html
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ <h1>Jzazbz</h1>
convertToXYZ();
</script>
</td>
<td>8.103011, 8.39796, 6.924744</td>
<td>7.986957, 8.397692, 9.136922</td>
</tr>
<tr title="Jzazbz to XYZ">
<td>color(jzazbz 1 0 0)</td>
Expand All @@ -428,7 +428,7 @@ <h1>Jzazbz</h1>
convertToXYZ();
</script>
</td>
<td>48.887976, 50.667498, 41.779127</td>
<td>48.187785, 50.665878, 55.125885</td>
</tr>
<tr title="Jzazbz to XYZ">
<td>color(jzazbz 0.1 -0.05 0.05)</td>
Expand Down

0 comments on commit 4002a47

Please sign in to comment.