Looking Deeper into Log Gamma
A camera’s gamma setting greatly affects the “look” of the resulting video. Understanding how gamma affects the image is the key to unlocking a wealth of new creative options.
In February, I published Part 1 of my two-part Field Report on the JVC 4K GY-LS300 camcorder. Part 2 of my Field Report on the JVC GY-LS300 will focus on using J-log1 gamma rather than REC.709 gamma correction. However, before publishing Part 2, I’ve been asked by some LS300 owners to explain more about log gamma.
Before addressing these questions, it’s necessary to understand REC.709 gamma correction and why until recently all cameras used it or a camera specific version sometimes called “STANDARD GAMMA” or “NORMAL GAMMA.”
Our understanding of gamma begins in 1860 when Gustav Fechner proposed that the perceived (S) magnitude of a stimulus in relation to physical intensity (I) follows a logarithmic relationship: S = 2.3kLOG10I. In the 1960's S. Stevens introduced his “Power Law” which is more general: S = kIa where for brightness, a = .33. (k is a constant.)
Because our eyes work in this manner, all displays must produce images who’s brightness obeys the Power Law.
A Century ago when television was being invented, one of the critical concepts involved in picture presentation was “gamma.” Figure 2 presents a plot (Black line) of measured Cathode Ray Tube (CRT) light intensity as input voltage is increased in a linear manner. This curve is called gamma. (LCD’s and plasma monitors emulate a CRT’s gamma.)
Figure 2 also includes a Power function trend-line (Blue line). To generate it I used Excel’s POWER (input-signal, 2.2) function where 2.2 is the historical CRT gamma value and input-signal was a linear sweep from 0.0 to 1.0. Excel also computed the function’s slope to be 0.45, which is correct.
A CRT’s “Power” response curve is the inverse of our visual system’s response curve. Figure 3 shows this relation by flipping the “brightness” shown in Figure 1.
An analog-to-digital converter (A/D) for video cameras typically has 10 to 16 output bits. Thus, they can output binary values from zero to 1023 to 16,384.
From no light, each stop of additional light results in a sensor voltage output two times larger. After the voltage is converted to binary by an A/D, the result is a twice as large binary value. For example, with a 3-bit converter, the binary output value sequence is as follows: 000 (0 from no light), 001 (+1 stop), 010 (+2 stops), 011 (+3 stops), 100 (+4 stops), 101 (+5 stops), 110 (+6 stops), and 111 (+7 stops).
An increase from “1” (001) to “2” (010) or “2” (010) to “4” (100) requires an additional A/D bit. Thus, the A/D pin/bit count specifies the maximum number of stops.
Assume we are working with a 12-bit A/D that has a 12-stop dynamic range. With 12-bit data, 4096 unique “binary codes” represent the full range between black (zero) and white (clipping). At the clipping point, the sensor outputs a binary code of 4095. When light is lowered by one f-stop, the binary output code decreases from 4095 to 2047.
Using 2048 codes for one-stop is inefficient because for all remaining stops, only 2048 codes are available. Code shortage forces the difference between, for example, stop -4 (a “256” code) and stop -5 (a “128” code) to be 128-steps while the difference between stop -9 (a “8” code) and stop -10 (a “4” code) is only 4-steps.
This scheme is called “linear-light.” When plotted, the signal creates a straight-line as shown by Figure 4. The Red lines indicate stops. You can see the uppermost stop requires half the X-axis (light input) range.
Camera designers always want the best possible specifications. To achieve this goal, compression can be applied to the signal. When the video signal reaches about 80-percent of its clipping value, compression is applied. This inflection point is called the camera’s “Knee Point.” When the Knee circuit is enabled, as the video signal increases above the Knee point it disproportionately increases as determined by the Knee Slope. The Knee circuit thereby prevents bright details from blowing out. (Figure 5).
A Knee can provide 2- to 3-stops of additional dynamic range increasing REC.709’s 6-stop dynamic range to 8- or 9-stops. The additional stops cause a linear-light function to slightly flatten at the Knee Point do to signal compression (Knee Slope).
The disadvantage of enabling a Knee is that its Knee Slope compression can create an odd look to highlights as well as unwanted color shifts. When log gamma is engaged the Knee circuit is disengaged.
REC709 Gamma Correction
Cameras prepare for CRT gamma by applying a gamma correction function before recording. Knowing CRT gamma is a Power function, I had Excel compute: POWER (input-signal, 0.45). The 0.45 value is computed from 1.0 ÷ 2.2, where 2.2 is CRT gamma, while input-signal is a linear sweep from 0.0 to 1.0. Excel’s plot is shown as a Blue line in Figure 6. (The Black line is from an independent source.)
The Blue line in Figure 7 represents the linear-light signal (with Knee disengaged) from the camera’s image processing section. (Figure 4). Each of the five Purple dots marks a stop. Figure 7 presents these five stops: 100% White, -1 stop, -2 stops, -3 stops, and -4 stops.
Figure 7: The arithmetic product of the gamma corrected signal (Green curve) and the gamma function (Purple curve) results a linear-light signal (Blue line).
The Figure 7’s Green curve is the result of a REC.709 gamma correction function applied to the linear-light signal. Applying the curvilinear function to the linear signal pre-corrects it for viewing on a display. The function also redistributes the levels within each stop making sensor data storage less inefficient. Looking at the left side of Figure 7, you can see the increment steps along the Y-axis are more equal in size than are the increment steps along the X-axis.
When the recorded (Green) signal shown in Figure 7 is sent to a display, it is converted to light in the manner described by the Gamma function shown in Figure 2.
The arithmetic product of the gamma corrected signal and the gamma function results in a linear-light signal, shown as the blue line in Figure 7. The unity transfer of information from sensor to display shows that light from a display is proportionally equal to the light falling on a camera sensor at a shoot.
Shooting with a REC.709 Gamma Correction
Of these levels, the most often monitored is middle-gray. On a waveform monitor this would logically be 50% (357mV) of "100% White" (714mV). However, REC.709 gamma correction is applied before the signal is output. Therefore, the 18% gray card’s signal (0.18) when raised to the power of 0.45 (the REC.709 gamma correction value) will lie at 46.2% (a 330mV reading) on a waveform monitor.
Before log gamma was introduced, cameras were equipped with other non-REC.709 gammas. These include cine-gammas and hyper-gammas. (Both are gamma corrections as is REC.709.) The latter replace Knee roll-off with a more gentle roll-off that begins lower at 65-percent. (Figure 9).
When you switch from REC.709 gamma correction or Cine/Hyper-gamma correction to log gamma, the switch has two consequences. First, unlike REC.709, log is not a “correction” that pre-corrects video to work with display gamma (Figure 2). Second, at some point in post-production, REC.709 gamma correction must be applied to log video.
Figure 10 presents a log function plotted by Excel. Rather than computing a Power function as was done for Figure 6, a log function was used: LOG10 (input-signal). Input-signal is a linear sweep from 0.0 to 1.0.
Sony’s S-log gammas enable a sensor with a large dynamic range to squeeze its signal into the standard 0- to 109-percent output range. Figure 11 shows how S-log1 enables a 1000-percent increase in dynamic range while S-Log2 enables a 1300-percent increase.
Shooting with a Log Gamma
Your camera’s documentation should include a chart like that presented by Figure 12. Compare Figure 13 values for 18% (middle-gray) and 90% White with REC.709 values where middle-gray is 46% while 90% White is right where it should be at 90%.
When shooting log the level for 90% White falls to approximately 62% while middle-gray falls to approximately 36%. With a scene exposed so middle-gray is about 36%, the sensor’s dynamic range should be centered at this level. There should be an equal number stops above and an equal number stops below middle-gray.
You’ll want to program your camera Zebra(s) appropriately. (Part 2 of the JVC GY-LS300 Field Report will cover this topic.) When you employ a middle-gray card and/or a 90% White card, set exposure so the cards are exposed at the recommended values for log gamma.
When you view log footage from most cameras on a REC.709 monitor with 2.2 gamma (normally lit room) or 2.4 gamma (darker room), you’ll see your footage looks like that shown in Figure 13. Image contrast is low—the image looks flat. Chroma saturation is also weak.
Log Gamma in Post
In post, you can treat log footage in multiple ways. To accomplish a super-fast workflow using FCP X, I simply drop an appropriate LUT on the footage. LUTs perform a purely mathematical correction to log gamma footage to force it to comply with REC.709. (Figure 14).
Of course, I can create a far better looking video by using a LUT and then using the FCP X Color Board to fine-tune each scene. (Figure 15).
Or, I can add a “look” LUT after the conversion to REC709. These LUTs are a fast, and in my opinion, “cheesy” way to set a scene’s mood. For example, the interior of a police station will have a greenish cast one assumes because it is lit by florescent lights. LUTs that emulate film stock are popular with those that want a “film look.”
Another post alternative is to log, trim, and assemble a Timeline that has had a LUT applied to all shots. Once the Timeline is ready to be graded, the LUT is disabled. The Timeline is XML exported and then imported into DaVinci Resolve where grading will be performed.
Grading accomplishes two tasks. The obvious task is to create a look you want. In addition, because you are grading on a REC.709 display your eyes are conforming log footage to REC.709 gamma corrected footage. As you make each shot look good on a monitor, you are redistributing the 256 (8-bit data) or 1024 (10-bit data) source material levels to 256 levels. For example, you can choose to crush the blacks to reduce log video’s wider dynamic range to REC.709’s more narrow dynamic range.
I suspect many shoot log so they can capture video with a wider dynamic range than they could by shooting REC.709. Unfortunately, if a LUT is employed to squeeze the dynamic range, it’s not clear the result will be different that simply shooting REC.709. To obtain value from log gamma media, you need to grade in an application like Blackmagic’s DaVinci Resolve.
See my articles on Blackmagic Design Resolve: Round-tripping FCP X and DaVinci Resolve, Using Resolve as an NLE, Color Grading With DaVinci Resolve – Part 3, and Color Grading With DaVinci Resolve – Part 4.
You might also like...
The Back Of The Brain May Soon Rule The Roost
If industry reports are to be believed, Apple is poised to release a mixed-reality headset at some point in 2023. Of course, it’s anyone’s guess when Apple’s Reality Pro will actually see the holographic light of day, but one t…
Learning From The Experts At The BEITC Sessions at 2023 NAB Show
Many NAB Shows visitors don’t realize that some of the most valuable technical information released at NAB Shows emanates from BEITC sessions. The job titles of all but one speaker in the conference are all related to engineering, technology, d…
Interlace: Part 3 - Deinterlacing
Now that interlace is obsolete, we are left only with the problem of dealing with archive material that exists in the interlaced format. The overwhelming majority of video tapes, whether component or composite, analog or digital, would be interlaced.
Compression: Part 6 - Inter Coding
The greatest amount of compression comes from the use of inter coding, which consists of finding redundancy between a series of pictures.
Magicbox Puts Virtual Production Inside An LED Volume On Wheels
Virtual production studios are popping up across the globe as the latest solution for safe and cost/time-effective TV and movie production. This method replaces on location shooting and, by utilizing all-encompassing LED walls (often called “volumes”), is fundamentally changing the…