However, typically 4:2:2 is ordered u1y1v1y2u3y3v3y4u5y5v5y6 ...Note that the wikipedia has this wrong. The way the wikipedia describes it here, it would appear as if the U & V samples align with different luma samples. That is generally NOT the case.

4:2:0 is usually represented in memory in a planar format, one buffer of Y, one of U, one of V, with the U & V buffers being 1/4 the size of the Y buffer.

These formats also don't specify the number of bits per sample. Typically the sampling is 8-bit for each component, but there may be times when more bits are used to avoid banding, or loss during processing.

4:4:4 would be the YUV equivalent of RGB, One byte for each component per pixel.

4:2:2 has one sample of Y per pixel, and U & V are sampled at half the horizontal bandwidth, so there are half the samples.

4:1:1 is like 4:2:2, but the U & V are sampled at one quarter of the horizontal bandwidth.

4:2:0 has the same amount of samples as 4:1:1, but the U & V are samples at half the bandwidth in both the horizontal and vertical directions, resulting in the same total of 1/4 the numebr of samples as the luma.

There was a really nice diagram on the net that showed all of this, I thought it was in the wikipedia, but I can't find it now.

4:2:0 is usually represented in memory in a planar format, one buffer of Y, one of U, one of V, with the U & V buffers being 1/4 the size of the Y buffer.

These formats also don't specify the number of bits per sample. Typically the sampling is 8-bit for each component, but there may be times when more bits are used to avoid banding, or loss during processing.

Thanks for replying. I understand what each of the formats are and how to implement them, however my progblem what exactly is the stream format.

e.g. as said in wikipedia it could be u1y1v1y2u3y3v3y4u5y5v5y6 or it may be y1y2y3y4u1u2v1v2

or any other combination... i wish to know what the standard is... if there is one.

How can programs understand the different YUV streams unless they are told how to interpret them?

There is no standard Or rather there is more than one "standard" for the exact same sampling, so it's just as good as having no standard.

The way programs know what to do is that they have implemented proprietary file formats or written codecs that read someone else's proprietary format.

With AVI files for instance you would look to the FOURCC code and it is enough to know the exact byte order.

Google for FOURCC codes and you can get a table of known codes and what the data format is .. e.g. there are FourCC codes like YUYV, UYVY, YUY2... the description of the code will tell you the byte order.

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org