Always keep the video data YUV, because different type definitions are derived from different companies based on the organization of their products, and derive a number of different YUV formulas.
Broadly, YUV from the pixel organization in the form of dots, there are two: 1.planer states. 2.packet status.
Planar Mode example: Y0y1 .... Yn u0u1 ... Um V0V1: VM,YUV three channels of continuous storage;
Example of packet mode: Y0u0v0 + y1u1v1 + ... + YNUNVN,YUV three channels mixed storage.
The planar mode facilitates the input and output of the codec, and the packet mode facilitates the input and display output of the video data collection.
Because the human eye is insensitive to chroma, it can reduce chroma sampling. This reduces the amount of data being processed. Storage space is also reduced.
According to the different UV samples, YUV format can be divided into 400. 420,422,444 and other formats.
400 grayscale data, no chroma data;
420 chroma in both horizontal and vertical two directions, the sample rate is halved. In this way each adjacent 4 y common one u,v data. The amount of data for u,v is 1/4 of Y. (420 the name is very bad, it is misleading, but the conventional one continues.)
)
422 chroma in the horizontal direction of the sample rate halved. In this way, each row adjacent to the 2 y common one u,v data, u,v the amount of data is Y of 1/2.
444 Chroma is the same as the sample rate and brightness. Each y has its own u,v data, and the amount of data u,v is the same as Y.
There is also a 411 format. Don't use it very often, don't pay attention to it.
Typically 400 uses 8bit to characterize a pixel point. 420 is 12 bits, 422 is 16 bits, and 444 is 24 bits.
The total amount of data/pixels is the number of bits. For example, the total amount of data in 420 format is (w*h + W*H/4 + w*h/4) *8 bit = 12*w*h bit.
YUV often uses formats
|
Format |
Mode |
Channel |
Bit |
Demo sample |
|
GRAY |
Planar |
1 |
8 |
Y0y1 ... Y15 |
|
I420 |
Planar |
3 |
12 |
420. Y0y1. Y15 U0U1U2U3 V0v1v2v3 * Often used to understand as YU12 |
|
iYUV |
Planar |
3 |
12 |
With I420 |
|
yuv420p |
Planar |
3 |
12 |
With I420 |
|
yuvj420p |
Planar |
3 |
12 |
With I420, the difference is the color conversion formula, YUVJ uses the JPEG formula, the output data range [0..255], the I420 range is [16-240] |
|
YV12 |
Planar |
3 |
12 |
420. Y0y1. Y15 v0v1v2v3 U0U1U2U3 * Often use very many codecs to input and output in this format |
|
yvu420p |
Planar |
3 |
12 |
With YV12 |
|
NV12 |
Planar |
2 |
12 |
420. Y0y1. Y15 u0v0u1v1 ..... U3v3 * Frequently used |
|
NV21 |
Planar |
2 |
12 |
420. Y0y1. Y15 v0u0v1u1 ..... V3u3 |
|
YV16 |
Planar |
3 |
16 |
422. Y0y1. Y15 v0v1. V7 u0u1. U7 |
|
yuv422p |
Planar |
3 |
16 |
With YV16 |
|
I422 |
Planar |
3 |
16 |
With YV16 |
|
UYVY |
Packed |
1 |
16 |
422. u0y0v0y1| U1y2v1y3| ... |
|
Y422 |
Packed |
1 |
16 |
With Uyvy |
|
YUY2 |
Packed |
1 |
16 |
422. y0u0y1v0| y2u1y3v1|. * Very many camera output formats |
|
YUV422 |
Packed |
1 |
16 |
With YUY2 |
|
Yuyv |
Packed |
1 |
16 |
With YUY2 |
|
Yvyu |
Packed |
1 |
16 |
422. y0v0y1u0| Y2v1y3u1| ... |
|
YU16 |
Planar |
3 |
16 |
422. Y0y1. Y15 u0u1. U7 v0v1. V7 |
|
NV16 |
Planar |
2 |
16 |
422. Y0y1. Y15 u0v0u1v1. U7v7 |
|
YV24 |
Planar |
3 |
24 |
444. Y0y1. Y15 v0v1. V15 u0u1. U15 |
|
I444 |
Planar |
3 |
24 |
With YV24 |
|
IYU2 |
Packed |
1 |
24 |
444. u0y0v0| U1y1v1| ... |
References:
http://www.fourcc.org/yuv.php
Http://www.cnblogs.com/azraelly/archive/2013/01/01/2841269.html
Copyright notice: This article Bo Master original articles, blogs, without consent may not be reproduced.
YUV Digest Format