Skip to content

shaders/colorspace: implement full black point adaptation

Niklas Haas requested to merge sig_floor into master

This is a massive change, and a big departure from the current way of handling colorspaces / black points (which was passing it off to the ICC backend or else just defaulting to gamma 2.2).

We now fully track black points, giving rise to effective contrast information, in particular for absolute luminance EOTFs (PQ, HLG, BT.1886). The tone mapping shaders have been adapted to adjust the black point as required.

As a special case, PL_COLOR_TRC_LINEAR also gets treated as a color space that may be absolute luminance (but doesn't default to such), if specified by the user. This is because of its lack of clear semantics, and its frequent use as an intermediate color space for both SDR and HDR signals.

This also means that we now effectively correctly handle BT.1886 emulation even on displays without ICC profiles. This would ordinarily severely alter the default presentation, so we also change the default transfer of pl_color_space_monitor from gamma 2.2 to UNKNOWN, which allows the color mapping to avoid adapting typical SDR signals for unknown displays. (Something that should have been done a while ago, to be honest)

Requires an unfortunate API break for pl_shader_(de)linearize, but as far as I can tell, these APIs are very un-used, so I'm not too worried.

Closes #151 (closed)

TODO:

  • implement edge cases regarding black point adaptation?
  • double check black clipping for BT.1886
Edited by Niklas Haas

Merge request reports