Skip to content

Commit

Permalink
Add complaints
Browse files Browse the repository at this point in the history
  • Loading branch information
waacton committed May 9, 2024
1 parent 63f1fb6 commit 91f3ab8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
5 changes: 5 additions & 0 deletions Unicolour/Oklab.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ internal Oklab(double l, double a, double b, ColourHeritage heritage) : base(l,
* LMS = M1 * RgbToXyz * Rgb
* RgbToOklab = M1 * RgbToXyz
* M1 = RgbToOklab * RgbToXyz^-1
* --------------------
* 💩💩💩 the "proper" way to define M1 is hidden in some random GitHub thread, instead of in any Oklab documentation
* https://github.com/w3c/csswg-drafts/issues/6642#issuecomment-945714988
* modern colour spaces seem to make it hard to implement things accurately (see also: XYB)
* will consider reworking M1 calculation if there's ever any complaints to my reverse engineering
*/

private static readonly WhitePoint OklabWhitePoint = Illuminant.D65.GetWhitePoint(Observer.Degree2);
Expand Down
9 changes: 7 additions & 2 deletions Unicolour/Xyb.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ internal Xyb(double x, double y, double b, ColourHeritage heritage) : base(x, y,
public override string ToString() => base.ToString();

/*
* XYB is a transform of RGB
* XYB is a transform of RGB Linear
* Forward: https://ds.jpeg.org/whitepapers/jpeg-xl-whitepaper.pdf
* Reverse: n/a - not provided, using own implementation
*
Expand All @@ -32,7 +32,12 @@ internal Xyb(double x, double y, double b, ColourHeritage heritage) : base(x, y,
/*
* NOTE: the final step of B -= Y is not documented in the JPEG XL white paper
* but apparently the intention is that B = sGamma should be B = sGamma - Y 🤷
* (at least it makes the colour greyscale when X == 0 and B == 0, in the same way as LAB)
* (at least it makes the colour greyscale when X == 0 and B == 0, in the same way as LAB-like spaces)
* --------------------
* 💩💩💩 the only mention of this "subtract Y from B" is just some random Twitter post and a 10 second YouTube video
* so it's not particularly convincing that this extra step, which is left out of the white paper, should be performed
* https://github.com/Evercoder/culori/issues/200 · https://twitter.com/jonsneyers/status/1605321352143331328 · https://www.youtube.com/watch?v=rvhf6feXw7w
* modern colour spaces seem to make it hard to implement things accurately (see also: Oklab)
*/

private const double Bias = 0.00379307325527544933;
Expand Down

0 comments on commit 91f3ab8

Please sign in to comment.