The ultimate goal for video delivery (From camera to TV) is to reproduce the scene luminance so that the viewer in front of TV set can feel as if he were at the scene. This requirement (Luminance never changes) is called constant luminance.
Unfortunately, the true reproduction of luminance is rarely, if ever, accomplished. TV set is usually put in a room where illuminance is much darker than outside. The reproduced luminance from TV is, therefore, can be much darker than the original luminance. So, when I say constant luminance in video system, I’m actually referring to "constant relative luminance".
In relative luminance, the chromaticity of white is adjusted to the viewer’s environment. It’s called reference white. The reference white is set to the color the viewer feels "white" in the environment.
Of course, not all TV sets automatically adjust reference white based on the environment – such mechanics is too expensive. So, SMPTE specifies the absolute luminance for the reference white for TV monitor in SMPTE RP 71 – 103 cd/m^2. According to Wikipedia, a typical computer display emit between 50 to 300 cd/m^2. The sun luminance is about 1.6 * 10^9 cd/m^2.
Luminance from RGB
Physically, a camera captures the scene with three photon receptors which response to certain light wave length – red, green, and blue. In other words, a camera records the optical power for each wave length. To calculate relative luminance from these three values, the following matrix can be used. The value of Y is the relative luminance.
Let’s call this matrix P. So, the block diagram from camera to TV is here.
Luminance and transfer function
The value of luminance (=Y) is an optical power. Experiments shows that it’s inconvenient to use the optical power as it is. This section explains why it’s inconvenient and how to solve it.
The experiment shows these facts.
- The ratio of relative luminance between white and black should be more than 30:1 for good image.
- If two areas have relative luminance difference of 1%, viewer can observe the difference easily.
Let’s say you use 0 – 255 (= 8 bits) to carry the luminance. Most video includes gradation and we want to avoid band effect. For example, the following picture has clear band effect.
This one doesn’t.
Based on the fact 2, if the area is filled with the value of 255 and 254, the viewer doesn’t observe band effect because (255 – 254) / 255 < 1%. However, if the values are 101 and 100, the viewer starts to observe the difference because (101 – 100) / 100 = 1%. If the values are 31 and 30, it’s more than 3% and it definitely cause band effect.
So, essentially, we should not use code value from 0 to 100 to avoid band effect. However, it conflicts with the fact that white/black ratio should be 30:1. If white is 255 and black is 100, then the ratio is just 2.5 – far from the ideal contrast ratio.
To solve the problem, we would need the code value ranging from 0 to 4095 (12 bits). Even if we don’t use code value 0 to 100, the white and black ratio is 4095 / 100 = 40.95:1, which is sufficiently large compared to 30:1.
However, 12bits is much larger than 8 bits and too expensive to process. The other way is to use non-linear coding. The graph below shows the non-linear coding. For each code value, the luminance is increased by 1%. With the non-linear coding, viewer cannot observe band effect while keeping good white/black contrast ratio.
Such non-linear conversion is performed so called "transfer function". There are some different transfer functions defined in the international/industry standards. Generally speaking, they are similar to the power function. To convert luminance to code value, use 0.4 power function:
To convert back from code value to luminance, use 2.5-power function.
So, with the help of transfer function, the diagram can be written to use just 8 bits.
CRT display non-linearity
Due to the physical characteristics, CRT monitor doesn’t reproduce luminance proportional to the input voltage. The CRT display’s non-linearity is about 2.5-power. To keep the constant luminance, the RGB voltages have to be modified by 1/2.5 power function.
Now, it’s time to play with this block diagram. Mathematically, these two block diagrams should result in the same process because two red boxes are canceled each other, and two blue boxes are canceled as well.
Therefore, it’s safe to rewrite the block diagram above to this.
Now, the second transfer function and CRT Monitor compensation happen to be canceled each other! Therefore, the diagram can be rewritten to:
These transformations are performed to reduce the complexity of the system, i.e. to reduce the price of the system. The last block diagram shows the first transfer function is applied for each R, G, B components before anything – even before entering to the video system. The system (Between two RGB to XYZ conversion) sees only non-linear code values.
There is no transfer function in the system. The non-linear code values are directly fed to the CRT monitor to keep the constant luminance. In other words, unless you have very special configuration, there is no transfer function required.
If you have video files (MPEG, H.264, …) in the storage, therefore, they are likely coded non-linearly. Compression and Decompression are performed inside the system and the video data in the system has gone through the transfer function before entering the system.
DIGITAL VIDEO AND HDTV Algorithms and Interfaces, Charles Poynton, 2003