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.)

Figure 1: Power Law for various types of stimuli.

Figure 1: Power Law for various types of stimuli.

Because our eyes work in this manner, all displays must produce images who’s brightness obeys the Power Law.

CRT Gamma

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: CRT gamma curve.

Figure 2: CRT gamma curve.

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.

Figure 3: CRT gamma curve from flipped Power Law.

Figure 3: CRT gamma curve from flipped Power Law.

Dynamic Range

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.

Linear-light

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.

Figure 4: Linear-light response.

Figure 4: Linear-light response.

Camera Knee

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).

Figure 5: A low-knee setting can increase dynamic range.

Figure 5: A low-knee setting can increase dynamic range.

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.)

Figure 6: REC.709 gamma correction with a slope of 0.33.

Figure 6: REC.709 gamma correction with a slope of 0.33.

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).

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.

Figure 8: REC.709 signal levels.

Figure 8: REC.709 signal levels.

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).

Figure 9: Three gamma functions.

Figure 9: Three gamma functions.

Log Gamma

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.

Figure 10: Simulated log gamma.

Figure 10: Simulated log gamma.

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.

Figure 11: Sony S-Log1 and S-Log2 curves.

Figure 11: Sony S-Log1 and S-Log2 curves.

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%.

Figure 12: Signal levels for various recording log gammas.

Figure 12: Signal levels for various recording log gammas.

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.

Figure 13: Log gamma image—not from the JVC LS300 camera.

Figure 13: Log gamma image—not from the JVC LS300 camera.

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).

Figure 14: Log-to-REC.709 LUT.

Figure 14: Log-to-REC.709 LUT.

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).

Figure 15: Fine-tuned (FCP X Color Board) Log-to-REC.709 LUT.

Figure 15: Fine-tuned (FCP X Color Board) Log-to-REC.709 LUT.

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...

Designing IP Broadcast Systems - The Book

Designing IP Broadcast Systems is another massive body of research driven work - with over 27,000 words in 18 articles, in a free 84 page eBook. It provides extensive insight into the technology and engineering methodology required to create practical IP based broadcast…

Demands On Production With HDR & WCG

The adoption of HDR requires adjustments in workflow that place different requirements on both people and technology, especially when multiple formats are required simultaneously.

NDI For Broadcast: Part 3 – Bridging The Gap

This third and for now, final part of our mini-series exploring NDI and its place in broadcast infrastructure moves on to a trio of tools released with NDI 5.0 which are all aimed at facilitating remote and collaborative workflows; NDI Audio,…

Designing An LED Wall Display For Virtual Production - Part 2

We conclude our discussion of how 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…

Microphones: Part 2 - Design Principles

Successful microphones have been built working on a number of different principles. Those ideas will be looked at here.