14

I have for example 4*4 image. I want to extract the Y,U and V components separately. How to do it if the image is YUV 422 ,YUV 420 and YUV444. I am interested in knowing the structure of array how Y,U and V are stored in 422,420 and 444, so that it can be accessed.

Aizen
  • 561
  • 1
  • 9
  • 19

2 Answers2

20

This site gives you a pretty good overview over the different YUV formats. There's also a pixel-structure given.

For clarification: These numbers are for determination of color component subsampling. For instance YUV 444 = 4:4:4 subsampling, meaning that every of the three components (Y, U and V) has the same sample rate. Whereas 4:2:2 states that U and V are only sampled with half the rate of Y. Or, in other words, 2 Bytes for Y and for U and V 1 Byte respectively, if the depth is 1 Byte. This implies that Y can have a higher dynamic range.

It is worth noting that JPEG standard defines horizontal and vertical sampling factors for each color component. The human visual system has a 20:1 ratio of the luma sensors (rods) to chroma sensors (cones). For this reason, typically luminosity component is not subsampled, but the JPEG standard does allow such content to be encoded.

Community
  • 1
  • 1
Sebastian
  • 8,046
  • 2
  • 34
  • 58
  • So you use 2 Bytes for Y and 1 for U and V for pixel or you use 1 Byte of Y per pixel and shared U and V between 2 Bytes horizontally? It is not clear to me yet. – J Agustin Barrachina Dec 02 '19 at 12:53
  • 4:4:4 would relate to 2 Bytes for each, Y, U and V. 4:2:2 would be 2 Bytes for Y, 1 Byte for U and 1 Byte for V. – Sebastian Dec 08 '19 at 16:12
  • The first site referred is down, here's a web archive version: https://web.archive.org/web/20160303191501/https://fourcc.org/yuv.php – nkukhar Jul 24 '23 at 23:12
3

it's a pretty old question, however I've just finish some work about decoding YUV and I would like to share some infos. There are 3 main aspects of the YUV schema:

  1. If the source YUV buffer is a packed or planar buffer. Packed means that the YUV bits are grouped togheter, planar means the Y, U and V buffers are separated in 3 differents memory area.

  2. YUV channel size; the single Y,U,V channel could be of 8-bit, 10-bit, 12-bit, etc

  3. the sampling ratio; A:B:C. 4:2:2 means that you horizontally have 1 Y value for each pixels and one only U and V value shared between two neightboard pixels.

I've just worked on YUV 4:2:2 v210 decoding, following this link there is the GLSL source code to decode and the resources I referred to. Any advice is welcome, it's my first decoder.

fivef
  • 2,397
  • 21
  • 21
Mouze
  • 706
  • 5
  • 10