YUV422 Data format and storage

Source: Internet
Author: User

To understand YUV422, first look at YUV444

YUV 4:4:4
YUV Three channel sampling rate is the same, so in the generated image, the three component information of each pixel is complete, that is, each pixel is represented by three elements (each component is usually 8 bits), after 8 bit quantization, uncompressed each pixel occupies 3 bytes.
The following four pixels are: [Y0 U0 V0] [Y1 U1 V1] [Y2 U2 V2] [Y3 U3 V3] A total of 12 bytes, representing only 4 pixel points. Only the first line is counted.
The stored stream is: Y0 U0 V0 Y1 U1 V1 Y2 U2 V2 Y3 U3 V3 (12 bytes/4 pixels) The stored stream should be the data that decodes the chip into the processor. such as SAA7113 decoding after entering the data stream is CB y CR y CB y CR.
The pixel points are mapped as: [Y0 U0 V0] [Y1 U0 V1] [Y2 U2 V2] [Y3 U2 V3]. (What does the pixel point here mean?)



(2) YUV 4:2:2
The sampling rate for the horizontal direction of each chromatic channel U and V is half of the luminance channel Y, so the chromaticity sampling rate in the horizontal direction is only half the 4:4:4. For uncompressed 8-bit quantization images, a macro pixel consisting of two pixels adjacent to each other horizontally takes up 4 bytes of memory.
The following four pixels are: [Y0 U0 V0] [Y1 U1 V1] [Y2 U2 V2] [Y3 U3 V3]
The stored stream is: Y0 U0 Y1 V1 Y2 U2 Y3 V3 (8 bytes/4 pixels)
Mapped pixel points: [Y0 U0 V1] [Y1 U0 V1] [Y2 U2 V3] [Y3 U2 V3]




First, you should understand the following concepts in order to understand what follows:

• Surface origin. For the YUV format described in this article, the origin (0,0) is always located in the upper-left corner of the surface.

• Stride distance. The span of a surface, sometimes referred to as spacing, refers to the width of the surface, expressed in bytes. The span is always positive for a surface where the origin of the surface is in the upper-left corner.

• Align. The alignment of the surface is determined by the different graphics display drivers. The surface should always be DWORD aligned, that is, each row in the surface must begin with a 32-bit (DWORD) boundary. The alignment can be greater than 32 bits, but depends on the hardware requirements. • Package format and flat format. YUV format can be divided into packaging format and flat format. In the packaging format, the Y, U, and V components are stored in an array. The pixels are organized into some mega-pixel groups, and the layout of the mega-pixel groups depends on the format. In the flat format, the Y, U, and V components are stored as three separate planes.

4:2:2 format, 16 bits per pixel

Support two 4:2:2 format, FOURCC code as follows:

YUY2

Uyvy Two is a packaged format, where each mega pixel is two pixels encoded as four consecutive bytes. This causes the chroma level to be sampled multiplied by the factor 2.

YUY2 in the YUY2 format, the data can be treated as an array of unsigned char values, where the first byte contains the first Y sample, the second byte contains the first U (CB) sample, the third byte contains a second Y sample, and the fourth byte contains the first V (CR) sample.


If the image is considered to be an array of two Little-endian word values, the first word contains Y0 in the least significant bit (LSB), which contains U in the most significant bit (MSB). The second WORD contains Y1 in the LSB, which contains V in the MSB. YUY2 is the preferred 4:2:2 pixel format for Microsoft directx®video acceleration (DirectX VA). It is expected to be an interim requirement for DirectX VA accelerators that support 4:2:2 video.


UYVY This format is the same as YUY2, except that the byte order is reversed-that is, the chroma byte and the light byte are flipped (Figure 7). If the image is treated as an array of two Little-endian word values, the first word contains U in the LSB, contains Y0 in the MSB, the second word contains V in the LSB, and Y1 is included in the MSB.



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.