renderer: implement wp-color-management-v1 transfer functions#11084
Conversation
|
@UjinT34 for hdr, if you could take a look |
|
|
They all map to their equivalent now-supported color-management-v1 transfer functions.
|
Done! I also flagged all xx-color-manager-v4 tfs as supported while I was at it. Looks like they are all already mapped to the respectively equivalent color-management-v1 tfs. Should I also have a look at frog tfs? Their mapping to color-management-v1 seems a bit less trivial than the xx- protocol, so I held off on that for now. |
|
xx and frog are for removal, shouldn't be used by any recent client. lgtm |
|
Please wait with merging. I just noticed that Hyprland's existing implementation of the HLG transfer function is incorrect -- inverse and forward appear to be mistakenly swapped. Going to push a fix in a moment. |
Previous implementation had forward and inverse swapped + used unnecessarily expensive math (pow(x, 2) instead of x*x, pow(M_E, x) instead of exp(x), and pow(x, 0.5) instead of sqrt(x)).
|
Should be all good now. Sorry for not catching this earlier. |
sqrt(3) * pow(1/12, 0.5) is just a complicated way to express 0.5
Describe your PR, what does it fix/add?
Implements all remaining transfer functions from wp-color-management-v1 and their inverses.
(Also cleans up trailing whitespaces, mixed tabs and spaces, and a redundant alpha mult+div in
CM.glsl.)Is there anything you want to mention? (unchecked code, possible bugs, found problems, breaking compatibility, etc.)
The implementation is based on the primary source (the ITU H.273 standard) as well as my own mathematical derivations of some of the constants and inverses which the standard does not provide.
I'm the author of an image viewer that encounters most of these transfer functions in the wild on a daily basis, so I'm reasonably confident in the correctness.
I also wrote a debug shader (not included in this PR) that verified that the GLSL implementation has correct rountrip behavior (i.e.
fromLinear(toLinear(c)) == c) for all transfer functions.Is it ready for merging, or does it need work?
Ready for merging.