Bug 221193

Summary: Avoid unnecessary chromatic adaptation when converting between colors with the same white point
Product: WebKit Reporter: Sam Weinig <sam>
Component: PlatformAssignee: Sam Weinig <sam>
Status: RESOLVED FIXED    
Severity: Normal CC: darin, simon.fraser, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 221190    
Attachments:
Description Flags
Patch
none
Patch none

Description Sam Weinig 2021-01-31 17:20:00 PST
We currently always use the XYZ space with the D65 white point as our universal conversion space (the space we require each type to be able to convert to and from), but this is not ideal when converting between colors like ProPhotoRGB and Lab, which both use the D50 white point, since it requires an extra two matrix multiplications for the chromatic adaptations to and from D65.

Additionally, to support color(xyz ...), which also use D50, we will need an explicit XYZ color with a D50 white point. 

We can solve both of these problems by further generalizing XYZA<T> to support a white point parameter, XYZA<T, WhitePoint>, and annotate all the colors with which whitepoint they are defined in (or what XYZA color is their reference). Then, we can use that information to lazily (though at compile time) determine whether chromatic adaptation is needed in the generic conversion functions.
Comment 1 Sam Weinig 2021-01-31 17:29:49 PST Comment hidden (obsolete)
Comment 2 Sam Weinig 2021-01-31 17:34:45 PST
Created attachment 418836 [details]
Patch
Comment 3 EWS 2021-02-01 09:50:12 PST
Committed r272146: <https://trac.webkit.org/changeset/272146>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 418836 [details].
Comment 4 Radar WebKit Bug Importer 2021-02-01 09:51:15 PST
<rdar://problem/73833214>