• Niklas Haas's avatar
    gamut_mapping: add new gamut mapping API · 64099247
    Niklas Haas authored
    So, this is a big mathdump with little in the way of history, but I
    arrived at these algorithms after extensive testing, feedback and
    The basic approach is to construct a 3DLUT in IPTQc4 space. Inside the
    3DLUT, we use a simplified, peak-dependent power-law relationship
    between intensity and chromaticity in order to clip into the gamut hull,
    with a brute force (bisection method) search.
    Every attempt was made to provide approximately analogous equivalents to
    the old PL_GAMUT_* modes, though the nature of this new infrastructure
    means all results will be subtly different from before. In particular,
    most of the colorimetric clipping modes (except "desaturate") will
    prefer to slightly darken/brighten colors rather than desaturating them
    towards white.
    I could go on in more depth describing the new algorithms, but the code
    should hopefully somewhat speak for itself.