What is Display Gamma
Ever had to bend your back to get in through a short door? What you did was display gamma correction.
The eye does not respond linearly to light. It behaves differently when it’s bright or dark. Its dynamic range varies depending on external and internal conditions.
Cinema has set a benchmark on how images should look. Black and white film had a superior dynamic range that looked great in a darkened theater.
How could television hope to compare? Television was not film, and still isn’t. Early television systems where nowhere close to the dynamic range of film. They had to find a way to ‘map’ the effect of a high dynamic range scene to a lower dynamic range display – somewhat like HDR images, except they didn’t have the technology we have today.
Take a look at this image:
The line in the middle represents linear light, where the limits are 0 (black) and 1 (white).
A scene with great dynamic range should not clip 0 or 1 and will ideally show many values between 0 and 1.
A straight line is the shortest distance between two points. Any curve that can connect from 0 to 1 will have a length larger than the line – which means you can cram more grey values on this curve than what the straight line can hold.
You might be wondering: But aren’t there infinite possible curves connecting 0 and 1?
Yes, there are. The curves are theoretically infinite, and in practice, are chosen based on the systems used and how they relate to the human eye. The shape of the curve is chosen such that the shadows and highlights approximate the human eye’s response to shadows and highlights.
It’s a highly subjective thing, gamma – we all see and respond differently to different luminances. Today, we can easily manipulate to our heart’s content the shape of the curve using the ‘Curves’ tool, but back in the early days of television, they had to find one standard and stick to it. Television was supposed to be a mass-produced display device (like monitors and flat screens are today). Once a gamma was set, it couldn’t be changed.
The curves they chose are the bright pink lines in the above image. They are expressed mathematically like this:
Vout = AVin?
Vout is Video Output
A is a Constant, usually A=1
Vin is Video Input
? is Gamma
Wait, those of you are familiar with mathematics know that any expression of the form y=Ax is basically a logarithmic (log) equation. In mathematics, this differentiates it from a linear equation, e.g. y=Ax+C.
A straight line is linear, a curved line is not. It is non-linear (of which log is one type). Display Gamma is the non-linear operation performed on linear data. In the case of video, it is performed on luminance, to make it correspond to how our eyes work.
Gamma is always non-linear (an operation with Gamma = 1 is like multiplying a number by 1), and doesn’t have to be constant for a curve. Different points on a curve can have different gamma values, don’t forget that.
When RGB is normalized (a mathematical process for bringing something down to our level) using a gamma operation, the new values are labeled R’G’B’ to distinguish it from the linear RGB values.
Whenever a gamma operation has been applied, the new term is represented with a apostrophe next to it. You might have seen the more famous example: Y’CbCr, where Y, the luminance component, is in fact Y’ – the ‘gammafied’ hulk. It’s always gammafied – it’s always angry. But that’s how we like it!
Encoding Gamma and Gamma Correction
The process of applying gamma to a linear curve (a line) is called Gamma Compression – we are compressing a curve to hold more data. This gamma is called the Encoding Gamma.
In the above image, 1/2.2 (or 0.45) is the encoding gamma that is applied to a linear curve before transmission (shoving through the door).
The corresponding point for the 50% mark on the line is 0.218, as you can see. It is the half-way point of 0.45, the encoding gamma.
After the signal has been transmitted and received by the television set, it is decoded by reversing the compression. This process is called Gamma Expansion – just like an expanding back straightening into normal position. This gamma is called Decoding Gamma.
In the above image, 2.2 is the decoding gamma. Every signal is decoded with a gamma of 2.2 before display. This was true of CRT television sets, and it is true of most monitors today. The same practice was carried on so that older videos could be displayed.
There are exceptions of course, like the Apple displays prior to 2009, which had a decoding gamma of 1.8.
If you have to remember only one gamma number, remember 2.2.
What about gamma correction and monitor gamma calibration?
The image shows what happens when you increase or decrease gamma. Notice how the absolute white and black points don’t change if you don’t go overboard. When you increase gamma (pull the curve down) you are mapping more values into the dark regions, and the image goes darker.
When you reduce gamma (pushing the curve up) you are mapping more values into the lighter regions, and the image looks lighter. Whether or not the image will have anything to display depends on its dynamic range and ‘strength of data’. You can’t go overboard with this.
By the way, the computer algorithm making the gamma corrections does all this in the background. However, because we take this for granted, when problems appear, we have no clue what to look for. You know now.
When working with different color spaces, you will be confronted sometimes with handling gamma directly. A good monitor allows you to finely tune gamma to match the color space you are working in. This is called monitor gamma calibration. When doing the same thing in software, for whatever reason, the same is called gamma correction – even though ‘correction’ isn’t what you’re doing most of the time.
Which gamma to apply on an image depends on its context – what stage are you in with respect to your workflow? You can appreciate how misunderstanding or disregarding gamma can wreck havoc on your color workflow.