Gamma correct blending with sRGB
This MR depends on !582 (merged) and !592 (merged).
This MR introduces the color transformation type 3x1D, per-channel one-dimensional look-up tables. It is implemented in GL-renderer. As a prerequisite, undoing pre-multiplied alpha is also added, adding the "straight alpha" path in the fragment shader. Straight alpha is the path that will be used by all color managed pipelines.
As GL-renderer starts supporting color transformations, the places in GL-renderer that used to assert that no color transformation is present are changed to load the respective color transformations. This takes the weston_output
members from_sRGB_to_blend
, from_sRGB_to_output
and from_blend_to_output
into use.
Color-lcms module is changed to install the sRGB EOTF curves in such way that it will lead to "gamma correct" blending. That is, blending will happen in optical (light linear) domain, not in electrical (non-linear) domain. This is the user visible effect of this MR if color-lcms module is active.
Finally, the alpha-blending test is augmented. A manual reference blending implementation is added, which ensures that Weston's blending result does not just match the reference image but also matches the reference mathematics. It can be hard to see from an image if the pixel values are actually correct or just "looking fairly reasonable". A new fixture case is added which enables color-lcms module and checks that the blending happens correctly in optical domain. This new test case is an integration test of the whole color managed pipeline up to this point, and pretty powerful in detecting problems.
This MR contains code from @vitalyp for the LittleCMS parts, and very likely contains inspiration from @swick's Weston work on color management.