Curves, Gamma and Log difference in relation to Contrast and Saturation

Recently, I stumbled upon this french video asking why there seems to be a so bizarre relation between the way curves act when you separate Luminance and Chrominance in relation to saturation.

presentation.jpg (the original video that asked the question)

As shown above, the way saturation act seems kind of strange. In both example, lowering the chrominance value displayed two different result, one over-saturating the picture and the other displaying an opposite behavior. It seems curves escape mathematical law or do they?

I’ll try to address this issue but first, we must rewind a bit and take it slow. One curve may express different mathematical functions that react in opposite way.

Let’s start by adding a smooth Greyscale in a 10 bit environment with 1024 values

As you can see, the gradient represented in the waveform (bottom right) does match our curve (bottom center). The left Bottom represent the black point value and the top right represent the white point value. Let’s now increase the gamma and see what happens

As you can see, boosting the gamma did not change white or black point but the curve took the abnormal shape of a logarithm function (ever wanted to know where “log” comes from in video?)

What you can notice though is how much of the gradient has been “compressed”. That being said, the values are still all contains within the 0-1023 range, they’ve just been re-mapped. Let’s now try to move the gain

As you can see, unlike the gamma, the resulting curve is “Linear” opposed to “Logarithmic” displaying a constant drop on every luminance value whereas the gamma did remap non-homogeneously every luminance value compressing and stretching parts of the images.

Same thing applies to the lift which react linearly unlike the gamma. You can see that everything on the left side of the picture has become pure black but the gradient on the right has been compressed in a different way where all values are re-mapped uniformly: they are being averaged equally. On the other hand, boosting the gamma re-mapped the lower values less than the higher values which seems to have compressed them more in the higher end of the spectrum.

So what does it has to do with our problem?

Take a picture for example, here’s one from a CGI I’ve made of space nebula

You can notice we have both a white point and a black point here. Note that most of my values are under 512, this is important to see the effect because if I try to raise the saturation in the high, you’ll likely not notice anything in particular.

Let’s now try to move down the signal linearly. I’ll boost the offset value to remap all values within the scope so we can better see the effect an extreme curve produce.

The scope shows that the lower end of the signal has been stretch or deployed. There are more contrast values in the lower end of the signal than there was with the original picture. By doing so, I have also stretch each RGB values one from another. Saturation is a result of having three distinct values for Red, Green and Blue, the further they are away, the more saturated an image will look. On the opposite, the closer they are, the more neutral (Grey) the picture will appear.

Let’s now try to move down the signal using curves to replicate a logarithm function like the gamma

The scope clearly shows that the signal has been compressed towards the lower end, reducing the separation values there was between the Red, Green and Blue channel. As a consequence, if you only move the Chrominance but don’t touch the gamma, the image will appear Less saturated because the colors have been compressed.

Let’s apply this now to saturation where we only move the chrominance values but we do not touch the gamma curves. Above is an exponential/log function that has compressed the signal resulting in a de-saturated image look. Below is the contrary where a linear function was applied to the chrominance only showing that the signal has been stretch exponentially in the lower end of the spectrum giving an increase in saturation.

You do know now how to replicate a custom saturation tool. What’s great about this is once you’ve mastered the Log function, you can use it to remap some specific saturation in the luma range much like the “luma vs sat” tool of Resolve.