Phase in NTSC and TMS9918

ntscvideo

In the YIQ space (I am referring to this wikipedia's article) colors with phases near 0 are close to red.

In the TMS9918 datasheet's table, however, in the expression of colors as A' and phase, blue colors have phase 354. (notice that the two greens have a reasonable phase).

enter image description here

I wondered whether Wikipedia's colors are off with the YIQ space, but they seem to be correct.

In fact let us take the following RGB to YIQ matrix (I found it in this article):

$$
\left[ {\begin{array}{c} Y\\ I\\ Q\\ \end{array} } \right] =
\left[ {\begin{array}{ccc}
0.299 & 0.587 & 0.114 \\
0.596 & -0.275 & -0.321 \\
0.212 & -0.523 & 0.311 \\
\end{array} } \right]
\left[ {\begin{array}{c} R\\ G\\ B\\ \end{array} } \right]
$$

Its inverse is:

$$
\left[ {\begin{array}{c} R\\ G\\ B\\ \end{array} } \right] =
\left[ {\begin{array}{ccc}
1.0000 & 0.9557 & 0.6199 \\
1.0000 & -0.2716 & -0.6469 \\
1.0000 & -1.1082 & 1.7051 \\
\end{array} } \right]
\left[ {\begin{array}{c} Y\\ I\\ Q\\ \end{array} } \right]
$$

and by plugging in the colors for Y

$$I=A'cos(phase)$$
$$Q=A'sin(phase)$$

that correspond to the datasheet's table dark blue we get the RGB color:

$$\left[ {\begin{array}{ccc} 0.6657 & 0.3393 & 0.0159 \end{array} } \right]$$

or, in 0-255 range:

$$\left[ {\begin{array}{ccc} 170 & 87 & 4 \end{array} } \right]$$

which is a brownish red, and not blue:

Sample of the resulting color

(Color rendered with the RGB Color Wheel).

Best Answer

The table you provided in the question shows the phase angle with respect to Q axis. You are calculating with respect to I axis. Hence the difference.

So changing the equations to \$Q=A'cos(phase)\$ and \$ I=A'sin(phase)\$ will produce dark blue, the correct color.