Skip to content

gamut_mapping: add tonal gamut-mapping function

Niklas Haas requested to merge haasn/libplacebo:tonal_shift into master

Based on a radically new approach of transforming hue leaves into a new bespoke colorspace called "tone saturation hue", which is designed to represent colors in a hue-leaf-relative representation.

Every color with a tone (T) parameter above 0.0 is subjectively brighter than the maximally saturated color of this hue, while every color with a tone below 0.0 is subjectively darker. This means that all colors crossing the T=0.0 plane are basically on the same intensity as the maximally saturated color for that hue.

Similarly, the saturation (S) parameter has been normalized so that S=1.0 always corresponds to the maximally saturated color of that hue leaf. So all of the vertices of the RGB cube have S=1 T=0, with differing values of hue.

This is combined with a simple quadratic rolloff to protect the in-gamut region from being warped, resulting in a nice, smooth colorimetric mapping.

Provided in both a hue-preserving and hue-shifting variant. Usefulness TBD.

Merge request reports