I’ve written before on this subject here: Demystifying color bit depth, dynamic range and linear/logarithmic scales but here’s a few more notes on light, and log vs linear gamma curves, as it is one of the most important things you can understand in digital cinema acquisition and post, and it can be confusing for the uninitiated.
Why Light is Linear
Basically if you double the energy emitted from a light source, and the distance from that light source stays constant, the light intensity at that point will also double. Easy right?
Why Light is Not Linear – The Inverse Square Rule
Imagine a single light source in a massive dark room. Standing right next to the light, you’ll experience the highest light intensity possible. Moving to the far end of the room, you’ll experience the least intensity in the room, because the light intensity diminishes over distance.
However, it doesn’t diminish linearly as distance increases. If you stand half way between the light source and the far end of the room, the light won’t be half as bright; it will actually be approximately a quarter as intense. The light intensity is inversely proportional to the square of the distance from the light source.
In photography and cinematography brightness or light intensity is often measured in f-stops as it relates to exposure. F-stops are a unit used to quantify ratios of light, or exposure. Each added stop represents an increase in light intensity by a factor of two, each increased stop is a doubling of light intensity, or exposure. A decrease of one stop is a halving of light intensity or exposure.
The f-stop scale is an approximately geometric sequence of numbers that corresponds to the sequence of the powers of the square root of 2: f/1, f/1.4, f/2, f/2.8, f/4, f/5.6, f/8, f/11, f/16, f/22, f/32, f/45, f/64, f/90, f/128, etc.
You don’t need to understand the math, just what it means. So f/2 represents double the light intensity of f/2.8 but half the the light intensity of f/1.4.
Human Perception is Not Linear
This is the real world physics of light. However, our perception of luminance is quite different and that is important when it comes to how we map real world linear luminance values to perceived brightness. We are more sensitive to small changes in luminance at the low end of the scale than the high end.
The Gamma Curve – Linear vs Log
I found the below descriptions from RyanJuckett.com very useful, he’s speaking in the context of color science as it relates to computer graphics and coding for games but it is a good explanation of the gamma curve nonetheless:
The gamma correction curve is used to convert pixel luminance from a linear scale to an exponential scale. When encoding the final pixel value, the curve is used to gamma compress linear luminance to a gamma corrected value. When decoding a pixel value, the inverse curve is used to gamma expand the value back to linear units.
We don’t perceive the luminance of a color on a linear scale, so this gamma compression actually helps us store more useful information in a limited number of bits per pixel. This nonlinear relationship between linear luminance and the perceived brightness of a color (also known as lightness) is shown below.
If we were to store image values on a linear scale, single steps in value would correspond to large steps in lightness on the lower end of the scale and minor steps in lightness at the higher end of the scale. As a result, we would lose a lot of lightness fidelity in dark colors.
Now let’s look at luminance using the sRGB gamma corrected curve.
We now get consistent steps of lightness across all values letting us encode lightness with more fidelity across the entire scale. While this image does show linear lightness (human perception), it should be stressed that we are no longer working with linear luminance (physics).
To go through this one more time, lets use 10 bit values as an example; you have 1024 possible values (including 0) to map input luminosity levels to output values from black to white. So your output range is between 0 (black) and 1023 (white).
A normal idealized gamma curve is actually almost a straight line, and this linear mapping will divide values perfectly evenly between 0 and 1023 across the scale of linear luminance, so the mid point of 512 will be exactly half way between black and white, which is 50% grey right?
Wrong. A value of 512 will actually be about 75% grey. There will be far fewer values mapped to the dark end of the scale than the bright end with linear mapped values.
If you have 1023 possible values to map to luminosity levels, it is a waste of valuable data to spread them perfectly evenly because our perception is not linear, we are more sensitive to changes in the shadows and mid-tones than in highlights.
A logarithmic gamma curve also serves to better assign data to expanded highlight information from high dynamic range imaging sensors.
This is why a log image viewed without gamma correction will look very flat and washed out.
In the context of the Blackmagic cameras “Film” and “Video” modes, simply put, “Video” mode applies a more linear gamma curve to the image and “Film” mode applies a logarithmic gamma curve preserving the shadows and midtones and expanding the highlights.
Above, a more linear gamma curve. Video mode.
Above, a log gamma curve (without gamma correction). Film mode.
I highly recommend reading Understanding Gamma, CineGamma, HyperGamma and S-Log by Alistair Chapman on dvinfo.net