##
Gamma

Log camera images store colors in a logarithmic scale. The blacks in these images are nearly 0 and the whites are supposed to be infinity. The graphics card and most video codecs store colors in a linear scale but CINELERRA-GG keeps log camera images in their original logarithmic scale when it renders them. This is necessary because the raw image parser can not always decode the proper gamma (γ) values for the images. It also does its processing in 16 bit integers, which takes away a lot of information.

Mathematically, the gamma function is exponential ( output = inputγ) and therefore the inverse of the logarithmic function [ γ = loginput(output)]. Actually the formula used by the CINELERRA-GG plugin is: output = input which allows for a range of values 0÷1.0. The gamma effect converts the logarithmic colors to linear colors through a gamma value and a maximum value. The gamma value determines how steep the output curve is (i.e. the value of the gamma parameter; for color space Rec709 is 2.4 ( = 0.41...), for sRGB is 2.2 ( = 0.45...), etc.). We use because with γ < 1 there is gamma compression of the curve, increasing the output values relative to the linear (see figure 10.48.). With γ > 1 we have gamma expansion, typically used to linearize a compressed gamma curve (Log). The maximum value is where 1.0 in the output corresponds to maximum brightness in the input. It serves to avoid clipped values because it allows you to set the maximum value of the output, 1.0, whenever range adjustment is done (see figure 10.47). It is important to adjust the two parameters accurately in order to avoid undesired and unexpected effects, such as excessive values, unbalanced image, incorrect linearization, etc.

Figure 10.47: settting Maximun to 0.6900

The gamma effect has two more parameters to simplify gamma correction. The automatic option causes it to calculate max from the histogram of the image. Use this when making a preview of a long list of images since it changes for every image. The use color picker option uses the value currently in the color picker to set the maximum value. Note that every time you pick a color from the compositor window, you need to click on use color picker to apply the new value.

The best use of the gamma is manually monitoring the waveform as shown in figure 10.48.

- Look at the highest peak on the waveform and measure it with the crosshair observing the numerical value at the top left.
- Set this value with the maximum slider or textbox.
- Then adjust the slider of the gamma to our liking, always checking the result on the waveform so to be sure never to exceed the values of clipping, 0÷1.0.

Figure 10.48: Setting Maximun to 0.6100 and Gamma to 0.3300

Care must be taken when using gamma correction: if the image carries a specific gamma value, or if it has already been corrected previously (for example automatically in the camera), etc.; then a second application of the gamma leads to excessive and artificial results. Gamma is keyframable.