darktable-org/darktable — pull request #443 by upegelow (2014-01-25 16:44:36+00:00)
Title: add option to clip output of colorin to various RGB color spaces

There have been reports on color problems which occur with certain camera models especially when an image shows highly saturated light sources like in stage photography. A typical symptom are black pixels or areas in the image if modules like levels or monochrome are activated. Issue #9479 gives a good example.

The technical cause lies in the color transfer from camera RGB to Lab which under special circumstances may result in unbound values, e.g. pixels with negative L values. Most of our modules deal properly with unbound Lab but some don't have any chance to give a reasonable output - hence the black pixels.

This pull request adds an option to the colorin module which on activation confines the Lab output of that module to some user selectable gamut. One can choose "sRGB" and "linear RGB" for a more restricted color space or "Adobe RGB" and "Beta RGB" for a broader gamut. You need to test what fits best to avoid artifacts and at the same time leave colors as un-damped as possible.

It is important to mention that this gamut clipping option is not restricting modules further down the pixelpipe to produce Lab values outside of the chosen gamut. Therefore the selected color space is not to be mistaken as a "working color space".

Would be great some of the other devs could review before merging.