The color encoding matrix and its inverse
III.6 TELEVISION COLOR ENCODING AND “HOT” BROADCAST COLORS
( I 2 + Q 2 ) > limit – Y
I2 + Q2 > (limit – Y)2
The simple computations just described can be done entirely in scaled integers, eliminating floating point entirely. Since the values of Y, I, and Q always are within the range [–1, 1], we can choose a scale factor that gives plenty of fractional bits without risk of overflow, even on a 16-bit machine. We do have to convert to 32 bits to handle the squares, though. There are only three integer multiplications plus seven additions, one subtraction, and two comparisons necessary in the per-pixel loop. (One squaring operation is done on a constant.) This is reasonably cheap. Once you have found a hot pixel, you may wish to flag it in a distinctive manner so the user can see where it is. If your frame buffer does not have overlay bits, just setting the pixel to a distinctive color will do.
Altering color saturation while leaving hue and luminance alone is only a bit more difficult. In concept, we want to scale I and Q equally by some scale factor s, while leaving Y unaltered. If E is the color encoding matrix and E–1 is its inverse, we wish to evaluate:
|
R | ′ | –1 |
|
|
0 | 0 | ∗ |
|
R |
|
||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| G | ′ | s | 0 | G | |||||||||||||
| B′ | 0 | s | B | ||||||||||||||
| or |
|
|---|
In other words, perform a linear interpolation between the original pixel value and a monochrome pixel of the same luminance. In practice, this method looks awful when applied to full-intensity color bars, since their saturation must be decreased so much. However, it might be acceptable when applied to real images, and it has the advantage that it preserves the black-and-white component of the image.


