Skip to content

gamut_mapping: refactor perceptual gamut mapping

Niklas Haas requested to merge haasn/libplacebo:tonal_perceptual 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 smoothstep to protect the in-gamut region from being warped, alongside a final RGB softclip pass to combat clipping as a result of differences in the hue leaf shape, resulting in a nice, smooth colorimetric mapping.

Overall represents a major improvement (YMMV).

Supersedes: !497 (closed)

Merge request reports

Loading