Category Archives: color_format

YUV422 format & byte order

YUV422: 16 bits/pixel packed YUV format. Y is sampled at every pixel, U and V are sampled at every second pixel horizontally.
1. Three main formats (the illustration uses little endian?)
  • UYVY (Y422, UYNV, HDYC)
    • The difference between HDYC and others (UYVY, Y422, UYNV) is: the RGB space of HDYC is defined in BT.709, rather than BT470 series (the latest one: BT470.7)
    • Different RGB color spaces is distinguished by defining different values for three primary colors and a white point.
    • NTSC, PAL, SECAM follows BT470. HDTV follows BT.709.
  • YUY2
  • YVYU
    • just different byte ordering.
2. bits per channel: 8 bit, 16 bit or 10 bit
 10/16 bit YUV formats use a fixed-point representation for both the luma channel and the chroma channels. Sample values are scaled 8-bit values, using a scaling factor of 2^(n-8), when n = 10 or 16.
10-bit formats also use 16 bits for each channel, with the lowest 6 bits set to zero ((little endian in the graph below)
Diagram showing 10-bit representation
The precision conversions can be performed using simple bit shifts. E.g. If 8-bit value is 235, the corresponding 10-bit format is 235×4=940
3. Byte order/endianness
BT656 transmit order: U–Y–V–Y.
If the receiving hardware (especially DMA) is configured to use little endian, U/Cb will be written to the lowest byte, followed by Y, then V, then Y at the upper most byte.
If the receiving hardware only supports big endian, U will be written to the upper most byte, …with Y at the lowest byte.

color parameters

Brightness  -128 ~ 127, usually set in the register as (8-bit) 2’s complement form.  1(1), 0x7F(127) is the brightest. 0x80(-128) is the darkest, 0xFF (-1).
Contrast (luminance contrast gain)  -128 ~ 127, 100(64h) means a gain of 1. Increase of contrast by “1” means adjustment of gain by %1.
Saturation(chroma gain, for U and V)  -128 ~ 127
Hue  +36 to –36. Only effective on NTSC system. The positive value gives greenish tone and negative value gives purplish tone.
Sharpness (for luma)  0 ~ 15. 15 provide the strongest sharpness.