# Phase in NTSC and TMS9918

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).

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:

(Color rendered with the RGB Color Wheel).

• Dear Fabio, I've edited your question as best as I could, but please review it as I may have added an error or two. In particular, I didn't understand the part in which the multiplication by Y occur. How should the equations for I and Q be? Thanks! – Ricardo Jul 13 '14 at 17:22
• thank you very much for your wonderful editing. I modified the sentence – Fabio Dalla Libera Jul 13 '14 at 18:02

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