Popular Science-What is YUV

Source: Internet
Author: User

From: http://baike.baidu.com/view/189685.htm

YUV is mainly used to optimize the transmission of color video signals, so that it is backward compatible with vintage black and white TVs. Compared with RGB video signal transmission, RGB requires three independent video signals to be transmitted at the same time ). "Y" indicates the brightness (luminance or Luma), that is, the gray scale value, while "u" and "V" indicate the color (chrominance or chroma ), it describes the image color and saturation, and is used to specify the color of a pixel. The "brightness" is established through the RGB input signal by overlapping specific parts of the RGB signal. "Color" defines two aspects of color-tone and saturation, expressed by Cr and CB respectively. Cr reflects the difference between the red part of the RGB input signal and the brightness value of the RGB signal. CB reflects the difference between the blue part of the RGB input signal and the brightness value of the RGB signal.

The importance of using YUV color space is that its brightness signal y is separated from the color signal u and v. If only the Y Signal component is used, but not the U or V component, the black and white gray images are displayed. The color TV uses the YUV space to solve the compatibility problem between the color TV and the black and white TV with the Brightness Signal y, so that the black and white TV can also receive the color TV signal. The main sampling formats are YCbCr, and YCbCr. YCbCr is commonly used. It means that each vertex stores an 8-bit brightness value (that is, the Y value), and each 2x2 points stores a Cr and CB value, the image does not feel much changed to the naked eye. Therefore, the original RGB (R, G, and B are all 8bit unsigned) models, where 8x3 = 24 bits (such as the first graph) is required for a single vertex (after full sampling, YUV still accounts for 8 bits ). After sampling at, the current average only needs 8 + (8/4) + (8/4) = 12 bits (4 points, 8*4 (y) + 8 (u) + 8 (v) = 48 bits), with an average of 12 bits for each vertex (such as the second figure ). In this way, the image data is halved.

 

The above only provides a theoretical example, which may be different in actual data storage. Below are several specific storage formats:

 

(1) YUV 4: 4

 

The sampling rate of the three channels of YUV is the same. Therefore, in the generated image, the information of the three components of each pixel is complete (each component is usually 8 bits). After 8 bits quantization, each uncompressed pixel occupies 3 bytes.

 

The following four pixels are: [y0 U0 V0] [Y1 U1 V1] [Y2 U2 V2] [Y3 U3 V3]

 

The stored code stream is y0 U0 V0 Y1 U1 V1 Y2 U2 V2 Y3 U3 v3

 

(2) YUV

 

The sampling rate of each chromatic aberration channel is half of the brightness channel, so the color sampling rate in the horizontal direction is only half. For non-compressed 8-bit quantization images, each macro pixel consisting of two adjacent horizontal pixels occupies 4 bytes of memory.

 

The following four pixels are: [y0 U0 V0] [Y1 U1 V1] [Y2 U2 V2] [Y3 U3 V3]

 

The stored code stream is y0 U0 Y1 V1 Y2 U2 Y3 v3

 

The mapped pixel is: [y0 U0 V1] [Y1 U0 V1] [Y2 U2 V3] [Y3 U2 V3]

 

(3) YUV

 

The color sampling at is a sample of the color in the horizontal direction. This is acceptable for low-end users and consumer products. For non-compressed 8-bit quantization videos, each macro pixel consisting of four adjacent horizontal pixels occupies 6 bytes of memory.

 

The following four pixels are: [y0 U0 V0] [Y1 U1 V1] [Y2 U2 V2] [Y3 U3 V3]

 

The stored code stream is y0 U0 Y1 Y2 V2 Y3.

 

The mapped pixel is: [y0 U0 V2] [Y1 U0 V2] [Y2 U0 V2] [Y3 U0 V2]

 

(4) yuv4: 2: 0

 

Doesn't mean only y, CB, and no Cr component. It means that for each scanned line, only one color component is stored at a sampling rate of 2 to 1. The adjacent scan lines store different color components. That is to say, if the line is, the next line is, And the next line is... and so on. For each color component, the sampling rate in both the horizontal and vertical directions is, so the color sampling rate is. For non-compressed 8-bit quantization videos, each macro pixel consisting of 2x2, 2 rows, and 2 columns of adjacent pixels occupies 6 bytes of memory.

 

The following eight pixels are: [y0 U0 V0] [Y1 U1 V1] [Y2 U2 V2] [Y3 U3 V3]

 

[Y5 U5 V5] [y6 U6 V6] [y7u7 V7] [Y8 u8 V8]

 

The stored code stream is y0 U0 Y1 Y2 U2 Y3.

 

Y5 V5 y6 y7 V7 Y8

 

The mapped pixel is: [y0 U0 V5] [Y1 U0 V5] [Y2 U2 V7] [Y3 U2 V7]

 

[Y5 U0 V5] [y6 U0 V5] [y7u2 V7] [Y8 U2 V7]

Edit the YUV format of this section (figure)

The YUV format generally has two categories: packed format and planar format. The former stores the YUV component in the same array, usually several adjacent pixels constitute a macro pixel (macro-pixel), while the latter uses three arrays to separate the three components of YUV, it is like a three-dimensional plane. In table 2.3, yuy2 to y211 are both in the packaging format, while if09 to yvu9 are in the flat format. (Note: When introducing various formats, each YUV component carries a subscript. For example, y0, U0, and V0 indicate the yuv component of the first pixel, y1, u1, and V1 indicate the YUV component of the second pixel, and so on .)

 

The yuy2 (and yuyv) format retains the Y component for each pixel, while the UV component samples every two pixels horizontally. A macro pixel is 4 bytes, which actually represents 2 pixels. (Actually means that a macro pixel has two Y components, one u component, and one V component .) The YUV component order in the image data is as follows:

 

Y0 U0 Y1 V0 Y2 U2 Y3 V2...

 

The yvyu format is similar to yuy2, except that the order of YUV components in the image data is different:

 

Y0 V0 Y1 U0 Y2 V2 Y3 U2...

 

The format of uyvy is similar to that of yuy2, but the order of YUV components in image data is different:

 

U0 y0 V0 Y1 U2 Y2 V2 Y3...

 

The ayuv format has an alpha channel and extracts YUV components for each pixel. The image data format is as follows:

 

A0 y0 U0 V0 A1 Y1 U1 V1...

 

The y41p (and y411) format retains the Y component for each pixel, while the UV component samples every 4 pixels horizontally. A macro pixel is 12 bytes, which actually represents 8 pixels. The YUV component order in the image data is as follows:

 

U0 y0 V0 Y1 U4 Y2 V4 Y3 Y4 Y5 y6 Y8...

 

In the y211 format, the Y component is sampled every two pixels in the horizontal direction, while the UV component is sampled every four pixels. A macro pixel is 4 bytes, which actually represents 4 pixels. The YUV component order in the image data is as follows:

 

Y0 U0 Y2 V0 Y4 U4 y6 V4...

 

The yvu9 format extracts the Y component for each pixel. When the UV component is extracted, the image is first divided into several 4x4 macro blocks, then, each Macro Block extracts one u component and one V component. When storing image data, the first is the array of Y components of the entire image, followed by the U Component Array and the V Component Array. The if09 format is similar to yvu9.

 

The iyuv format extracts the Y component for each pixel. When the UV component is extracted, the image is first divided into several 2x2 macro blocks, then, each Macro Block extracts one u component and one V component. The yv12 format is similar to that of iyuv.

 

The yuv411 and yuv420 formats are mostly used in DV data. The former is used in NTSC and the latter is used in palth. Yuv411 extracts the Y component for each pixel, while the UV component samples every four pixels horizontally. Yuv420 does not mean that the V component sampling is 0. Compared with yuv411, it increases the color difference sampling frequency by one time in the horizontal direction, and reduces the color difference sampling by half at the U/V interval in the vertical direction, as shown in.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.