Learning notes in YUV format

Source: Internet
Author: User
Different from RGB, YUV uses a Brightness Signal and two chromatic aberration signals to express the image.
UV indicates cbcr. Common YUV formats include: yuv4: 2: 0, yuv4: 2: 2, yuv4: 1, yuv4: 4: 4, it represents different image compression methods.
The storage methods of YUV are divided into packed and planar. The following is from the dx9sdk manual:
YUV formats are divided Packed Formats and Planar Formats. in a packed format, the Y, U, and V components are stored in a single array. pixels are organized into groups of macropixels, whose layout depends on the format. in a planar format, the Y, U, and V components are stored separately, as three planes.

The following describes Article I can't find the source. I borrowed it to take a note. If anyone can go out, I am very grateful!

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, 4 points require 8x3 = 24 bites (such as the first figure ). now, we only need 8 + (8/4) + (8/4) = 12 bites, and each point occupies 12 bites on average (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 a non-compressed 8-bit video, 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] [y7 u7 V7] [Y8 u8 V8]
The stored code stream is:
Y0 U0 Y1 Y2 U2 Y3
Y5 V5 y6 y7 V7 Y8
The mapped pixels are:
[Y0 U0 V5] [Y1 U0 V5] [Y2 U2 V7] [Y3 U2 V7]
[Y5 U0 V5] [y6 U0 V5] [y7 U2 V7] [Y8 U2 V7]

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.