Is Gamma Still Needed?: Part 1 - The Origins & Principles Of Gamma
Gamma is a topic that pervades almost all forms of image portrayal, including film, television and computers. Gamma has become a tradition, which means that its origins are not understood, and it is not questioned. Perhaps it is time that it was.
One thing that needs to be made clear from the outset is that the use of gamma is a classic case of swings and roundabouts. Certainly, it offers some advantages and it solves some problems, but it does so by introducing other problems that have to be accepted as part of the compromise. If we look back to the development of black and white television, just prior to WW II, it is possible to see compelling technical reasons why the compromise should have been accepted back then.
As will be seen, the black-and-white cathode ray tube and gamma went together like peaches and cream for final delivery to the viewer. It's just that when other applications, like color TV, computer rendering, production processes like chroma key and compression techniques such as MPEG came along, the cream curdled.
Gamma was adopted, rightly at the time, but the people who decided to adopt it are no longer with us, and their reasoning seems to have died with them, so that gamma seems to be something that we continue to do today because we have always done it. Compromises should be re-examined periodically to see if the balance between the swings and the roundabouts still holds or if instead we have created a sacred cow.
Perhaps new conditions justify the continuation of the compromise; perhaps they render it obsolete, as eventually happened with interlace. The original reasons to adopt interlace were valid, but when HDTV was being considered, enough was known about the drawbacks of interlace for it to be ruled out on technical grounds. As is well known, technical grounds are never enough to compete with inertia, politics and vested interests.
In the eight or so decades since practical television emerged, technology has advanced more than somewhat. Both film and the cathode ray tube essentially vanished from the mainstream meaning that gamma is no longer inherent in the physics of image sensors or displays. Information technology has become dominant and complex digital manipulations have become inexpensive, offering alternative solutions to the use of gamma.
Perhaps when color television was being considered, the appropriateness of gamma to the calculations needed to create color difference signals should have been questioned. Digital techniques allow practically any desired dynamic range to be conveyed, and when they were adopted for television production, the use of gamma correction in video signals should have been questioned, but it seems that it wasn't.
Perhaps when efficient compression algorithms such as JPEG and MPEG were under development the effect of concatenating these codecs with gamma, which is another compression codec, should have been questioned, but again it seems that it wasn't. The problems of gamma in color television were known to be worst on saturated colors, so when proposals were made further to increase the color gamut perhaps the continued use of gamma should have been questioned then.
Finally, we had the development of high dynamic range television and a fight broke out between various different kinds of gamma. Frankly it is irrelevant which of these is preferable if there is another solution that is better still, but that question has not been asked and that solution has not been sought. One of the goals of this series is to do just that.
Fig.1 - The subjects that need to be considered to understand gamma form a long list. See text for details.
In order to be scientific, it is important to retain a modicum of doubt regarding our understanding. In the absence of such doubt, there will be no need for debate and no need for experiment to back up or destroy our theories, so there can be no progress. All that is necessary for mediocrity to prevail is for good men to ask no questions.
There has to be an impartial assessment of what gamma actually is and what it does well along with what it doesn't do well, so that there is some basis for comparison with other solutions. The extent of the pervasion of gamma is such that it is difficult to know where to start, except by looking at the areas where gamma plays a part. Fig.1 shows what they are.
Given that imaging technologies are usually directed at a human viewer, the use of gamma cannot be understood without considering the relevant aspects of the Human Visual System (HVS).
The first imaging technology was, of course, photography and it was in connection with film that non-linearities were studied, and it was from photography that the term gamma itself originated before there was television.
The cathode ray tube was at one time practically the only television display device and its peculiar characteristics have to be explored to see how it influenced the direction analog television would take. Film, the CRT and the black and white TV are obsolete today, but they form part of the history of gamma. It is almost superfluous to say that had history been different we might not be where we are today.
To a mathematician, gamma refers only to a power function, whereas in video gamma is a broad-brush term for any old non-linear functions, be that a power function, a logarithmic function or some combination of both. No treatment of gamma can be complete without looking at the mathematics of non-linearity and the consequences it predicts.
As it capitalizes on the characteristics of the HVS to reduce the dynamic range of the transmitted signal, gamma has to be classified as a perceptual compression system, which also has interesting consequences.
Gamma also has some of the attributes of a modulation scheme and actually broadens the spectrum of any signal subjected to it. It's a bit like FM radio, in that by broadening the spectrum the effects of noise in the channel can be reduced on demodulation. The effect of gamma on the spectrum has been blissfully neglected for many decades now and that neglect will be put right in due course.
When we calculate area by taking the square of the length, we are raising the length to the power of two, and, unsurprisingly the units are square feet. When we extract a square root of some number, we are raising it to the power of one half.
If we square any number and then take the square root, we get right back again. What we have done is to use two complementary processes, in which the gamma of the first one, 2, is the reciprocal of the gamma in the second one, namely one half. So for any power of gamma applied to a number, such as a sample of a video waveform, there is a reciprocal value that undoes it again.
Actually, that is not absolutely true, and as will be seen, there are cases in television where the non-linearity is not properly reversed.
No one would confuse a foot with a square foot, yet for years we clung to the misguided view that gamma corrected luminance was somehow still luminance when actually it wasn't. Charles Poynton rightly argued that the signal used in television should be known as luma in order to distinguish it from true luminance and that terminology should be followed, but frequently isn't.
Television also adopted the symbol Y from the CIE documents to represent what should now be called luma. This is also incorrect and luma should use the symbol Y' to signify that it is something that was once Y but no longer is. Again the prime is frequently omitted.
But the problem is not that we used the wrong name for non-linear signals, as the signals don't know what we call them. The real problem is that we treated such signals as if they were linear.
Fig.2a) shows a graph of a power function in which gamma is 2.2. It will be seen that the slope of the graph increases with the input, so that the output rises disproportionately. Integer values of gamma such as two or three are easy to deal with as they correspond to squaring or cubing, but how do we compute a gamma of 2.2? One solution is to use logarithms. In Fig.2a) the inverse function is also shown, which requires gamma to be 0.45, approximately the reciprocal of 2.2.
Fig.2 - A power function in which gamma has a value of 2.2 is shown at a) to have a steadily increasing slope. The reciprocal of 2.2 is about 0.45, and a curve with gamma of 0.45 is also shown. These two transfer functions in series cancel one another out to give y = x. An exponent function is shown in b). This too is non-linear and can be reversed by a logarithmic function as shown.
A power function is of the form Xγ, which means X raised to the power of gamma. X is the variable, such as a luminance sample, that is raised to a fixed power. This should not be confused with the exponent function such as 10X, in which 10 (decimal) is a constant that is raised to the power of X. Fig.2b) shows an exponential function base 2. Note that the function always passes through one on the y axis because any number raised to the power zero is one. This function can also be reversed using a logarithmic function to the same base. The logarithmic function base 2 is also shown in Fig.2b). This function passes through one on the x axis.
No mathematician would confuse a power function with a logarithmic function, but now we see non-linear transfer functions used in video that really are logarithmic, but still described as gamma. Gamma is in danger of progressing from having meaning to very few to having no meaning at all.
You might also like...
NDI For Broadcast: Part 2 – The NDI Tool Kit
This second part of our mini-series exploring NDI and its place in broadcast infrastructure moves on to exploring the NDI Tools and what they now offer broadcasters.
HDR & WCG For Broadcast: Part 2 - The Production Challenges Of HDR & WCG
Welcome to Part 2 of ‘HDR & WCG For Broadcast’ - a major 10 article exploration of the science and practical applications of all aspects of High Dynamic Range and Wide Color Gamut for broadcast production. Part 2 discusses expanding display capabilities and…
Great Things Happen When We Learn To Work Together
Why doesn’t everything “just work together”? And how much better would it be if it did? This is an in-depth look at the issues around why production and broadcast systems typically don’t work together and how we can change …
Microphones: Part 1 - Basic Principles
This 11 part series by John Watkinson looks at the scientific theory of microphone design and use, to create a technical reference resource for professional broadcast audio engineers. It begins with the basic principles of what a microphone is and does.
Designing An LED Wall Display For Virtual Production - Part 1
The LED wall is far more than just a backdrop for the actors on a virtual production stage - it must be calibrated to work in harmony with camera, tracking and lighting systems in an interdependent array of technology.