High Speed Dubb
13th January 2003, 07:58
In another thread (the one about blivit’s YATS), scmccarthy asked
What do you mean by 'gamma correction'. It is a very technical term and an important term and one where a lot of confusion exists.
...so here is a shot at an answer.
As it turns out, TVs aren’t linear. That is, if you double the strength of the (for example) Red signal, you won’t see a color which seems to have twice as much red.
The relationship between signal strength and observed CRT color turns out to roughly follow a power law. That is,
(1) observed_red = red_signal^k
The k is a constant which varies from picture tube to picture tube, and even depends on hard to handle stuff like the brightness of the room. As a very rough figure, k tends to be around about 1.0/2.4.
Back when the PAL and NTSC specs were designed, the engineers were aware of this nonlinearity. Since running a nonlinear transform on the data inside the TV set wasn’t a realistic possibility, they decided to specify that the signal should automatically compensate for the picture tube. In other words,
(2) R' = R^(1/k)
where R' = signal_red and R = true_red_color
By specification, k for NTSC is 1.0/2.2, and 1.0/2.8 for PAL. 1/k (so 2.2 for NTSC, 2.8 for PAL) is usually known as “gamma.”
This has a bunch of implications.
- LCDs don’t have the same properties as a CRT. So if you want to show NTSC or PAL video on an LCD, you need to transform ("gamma correct") to a linear range. For that matter, CRTs don’t exactly follow the standard, either, so it makes sense to transform for them, too.
- Note that this is a nonlinear transform in RGB space. Because it’s nonlinear, you can’t just run the same kind of function in YUV colorspace.
- Because of equation (2), we aren't really looking at the RGB or YUV colorspace — Really we have Y'U'V' or R'G'B' data. [The apostrophes indicate that the components have been (RGB) transformed.] Usually we skip this distinction in discussions, but it does sometimes matter.
- Because we’re working in Y'U'V', distances and averages between pixels are perceptually very approximate. But if the colors are similar, it’s a passable approximation. (And for that matter, distances and averages in YUV and RGB are approximate, too.)
- Noise tends to be normally distributed in Y'. Because of equation (2), this results in greater perceived noise in darker areas of the picture.
If you do any Google searches on this, be careful of a couple terminology gotchas. The “gamma function” and “gamma distribution” are completely unrelated to video gamma.
What do you mean by 'gamma correction'. It is a very technical term and an important term and one where a lot of confusion exists.
...so here is a shot at an answer.
As it turns out, TVs aren’t linear. That is, if you double the strength of the (for example) Red signal, you won’t see a color which seems to have twice as much red.
The relationship between signal strength and observed CRT color turns out to roughly follow a power law. That is,
(1) observed_red = red_signal^k
The k is a constant which varies from picture tube to picture tube, and even depends on hard to handle stuff like the brightness of the room. As a very rough figure, k tends to be around about 1.0/2.4.
Back when the PAL and NTSC specs were designed, the engineers were aware of this nonlinearity. Since running a nonlinear transform on the data inside the TV set wasn’t a realistic possibility, they decided to specify that the signal should automatically compensate for the picture tube. In other words,
(2) R' = R^(1/k)
where R' = signal_red and R = true_red_color
By specification, k for NTSC is 1.0/2.2, and 1.0/2.8 for PAL. 1/k (so 2.2 for NTSC, 2.8 for PAL) is usually known as “gamma.”
This has a bunch of implications.
- LCDs don’t have the same properties as a CRT. So if you want to show NTSC or PAL video on an LCD, you need to transform ("gamma correct") to a linear range. For that matter, CRTs don’t exactly follow the standard, either, so it makes sense to transform for them, too.
- Note that this is a nonlinear transform in RGB space. Because it’s nonlinear, you can’t just run the same kind of function in YUV colorspace.
- Because of equation (2), we aren't really looking at the RGB or YUV colorspace — Really we have Y'U'V' or R'G'B' data. [The apostrophes indicate that the components have been (RGB) transformed.] Usually we skip this distinction in discussions, but it does sometimes matter.
- Because we’re working in Y'U'V', distances and averages between pixels are perceptually very approximate. But if the colors are similar, it’s a passable approximation. (And for that matter, distances and averages in YUV and RGB are approximate, too.)
- Noise tends to be normally distributed in Y'. Because of equation (2), this results in greater perceived noise in darker areas of the picture.
If you do any Google searches on this, be careful of a couple terminology gotchas. The “gamma function” and “gamma distribution” are completely unrelated to video gamma.