Linear light processing for saturation
Typical saturation algorithms do not perform any operations in the linear light domain. To do so, gamma correction must be removed from the incoming signal, the calculations performed, and then the gamma correction added back in. In the case of saturation, not doing this will result in shifts in luminance.
For sRGB devices, gamma correction is achieved by applying the sRGB transfer function to the image:
To calculate luminance correctly, the values must be converted to the linear light domain by removing gamma correction (i.e. apply the opposite of the sRGB stransfer function). Linear light values, as the name suggests, have a linear relationship to light. Doubling the photons of light will double the linear light value. Gamma-corrected values do not have this property.
The formula for calculating luminance (assuming sRGB primaries) is:
Colormancer will apply its saturation algorithm and then multiply the resulting values by a correction factor to compensate for any shift in luminance. Many common saturation algorithms do not do this and are not designed to maintain constant luminance.
Algorithms such as Photoshop's Hue/Saturation adjustment (in 8-bit RGB mode) are based on HSV color space. In HSV space, the counterpart to luminance (V) is defined as
where Max is the greatest of gamma-corrected red, green, and blue. One of the flaws with this color space is that it ignores each color's contribution to luminance. Color science dictates that green contributes mostly strongly to luminance. HSV color space, by definition, will not account for two of the colors and will not weight the colors differently.
A second flaw with the HSV color model is that it usually does not account for gamma correction. As a result, HSV-based algorithms can cause unintended shifts in luminance. This can increase the visibility of noise and cause some colors to appear neon, as shown in the comparison below.
Return to white papers.