BT656 - Color Conversion

Frozen Content

The color space used for the digital video data is YCbCr (4:2:2 sampling). As part of the reformatting of the BT.656 stream into the simple memory image, this color space must be converted into RGB or Grey-scale.

When the active video data from the stream is read in, each consecutive Cb-Y-Cr-Y grouping of data bytes is stored in a 32-bit buffer register – CbYCrY_BUF. Table 1 illustrates where within this register each byte in the grouping is stored, for pixels 0-1 (i.e. Cb 0 Y 0 Cr 0 Y 1).

Table 1. The CbYCrY_BUF register.
MSB                                                                                                                                                                                                                LSB
31                                             24 23                                             16 15                                             8 7                                             0
Y1
Cr0
Y0
Cb0

From the value in this buffer two YCbCr values are derived, dependant on the value of the internal flag pxl_sel, which is used to distinguish between the odd and even pixels:

  • pxl_sel = 0 for even pixels
  • pxl_sel = 1 for odd pixels.

Using the example entry in Table 1 above, calculation of the RGB/Grey value for the even pixel – pixel 0 – requires Y 0, Cb 0 and Cr 0. In this case pxl_sel is cleared to '0' and the required Y 0 Cb 0 Cr 0 value is stored in another buffer register – YCbCr_BUF (Table 2).

Table 2. The YCbCr_BUF register holding the YCbCr value for pixel 0 (pxl_sel = 0).
MSB                                                                                                                                                                                                                LSB
23                                                                 16 15                                                                 8 7                                                                 0
Y0
Cb0
Cr0

Calculation of the RGB/Grey value for the odd pixel – pixel 1 – requires Y 1, Cb 0 and Cr 0. In this case pxl_sel is set to '1' and the required Y 1 Cb 0 Cr 0 value stored in YCbCr_BUF (Table 3).

Table 3. The YCbCr_BUF register holding the YCbCr value for pixel 1 (pxl_sel = 1).
MSB                                                                                                                                                                                                                LSB
23                                                                 16 15                                                                 8 7                                                                 0
Y1
Cb0
Cr0

Conversion to Grey

The 8-bit Grey value of a given YCbCr value – sourced from the YCbCr_BUF register – is obtained by taking the most significant byte of that YCbCr value. The value is stored in the 8-bit register GREY:

GREY = YCbCr_BUF(23..16)
 

By design, the value for the luminance (Y) defines the grey value, with the color information in Cb and Cr ignored.

Conversion to RGB

The Red, Green and Blue values (each 8 bits) of a given YCbCr value – again sourced from the YCbCr_BUF register – are obtained using the following equations:

R = Y + 1.402Cr

G = Y - 0.344Cb - 0.714Cr

B = Y + 1.772Cb

The resulting RGB value is stored in the 24-bit RGB register as shown in Table 4.

Table 4. The RGB register.
MSB                                                                                                                                                                                                                LSB
23                                                                 16 15                                                                 8 7                                                                 0
R
G
B
You are reporting an issue with the following selected text and/or image within the active document: