YUV pixel format

Source: Internet
Author: User

1 Overview

YUV is a color encoding method. It is developed to be compatible with black and white TVs. In Modern Color TV systems, three-channel color cameras or color CCD cameras are usually used to retrieve images, and then the acquired color image signals are divided by color, respectively amplified and corrected to obtain RGB, then, the Brightness Signal y and two color difference signal R-Y (U) and B-Y (v) are obtained through Matrix Transform circuit, and the three signals are encoded respectively. Y is the so-called luminance, which indicates the concentration of light and is non-linear. It is encoded using Gamma Correction, CB and Cr represent the concentration offset of blue and red.

 

2 YUV sampling format

(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.

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]

3 YUV Storage Format

The YUV format is divided into the packed format and the planar format. The packed format puts the YUV data into the array in order, and planar divides the YUV data into three parts into the array, that is, put the data in part y first, then u, and then v.

3.1 packed YUV formats

Label

Bits per pixel

Description

Ayuv

32

Combined YUV and Alpha

Cljr

8

Cirrus Logic format with 4 pixels packed into a u_int32. A form of YUV wiht less than 8 bits per y, U and V sample.

Cyuv

16

The sense of the height is reversed-the image is upside down with respect to the uyvy version.

Grey

8

Apparently a duplicate of y800 (and also, presumably, "Y8 ")

Iraw

?

Intel uncompressed YUV. I have no information on this format-can you help?

Iuyv

16

Interlaced version of uyvy (line order 0, 2, 4,..., 1, 3, 5...) registered by Silviu brinzei of lead technologies.

Iy41

12

Interlaced version of y41p (line order 0, 2, 4,..., 1, 3, 5...) registered by Silviu brinzei of lead technologies.

Iyu1

12

12 bit format used in Mode 2 of the IEEE 1394 digital camera 1.04 spec. This is equivalent to y411

Iyu2

24

24 bit format used in Mode 0 of the IEEE 1394 digital camera 1.04 spec

Hdyc

16

YUV (Y sample at every pixel, U and V sampled at every second pixel horizontally on each line ). A macropixel contains 2 pixels in 1 u_int32. this is a suplicate of uyvy kernel t that the color components use the bt709 color space (as used in HD video ).

Uynv

16

A direct copy of uyvy registered by NVIDIA to work around problems in some old codecs which did not like hardware which offered more than 2 uyvy surfaces.

Uyvp

24?

YCbCr extended precision 10-bits per component in u0y0v0y1 order. registered by rich Ehlers of Evans & Sutherland. (awaiting confirmation of component packing structure)

Uyvy

16

YUV (Y sample at every pixel, U and V sampled at every second pixel horizontally on each line). A macropixel contains 2 pixels in 1 u_int32.

V210

32

10-bit ycrcb equivalent to the QuickTime format of the same name.

V422

16

I am told that this is an upside down version of uyvy.

V655

16?

16 bit YUV format registered by vitec multimedia. I have no information on the component ordering or packing.

Vyuy

?

ATI packed YUV data (format unknown but you can get hold of a codec supporting ithere)

Y422

16

Direct Copy of uyvy as used by ADS technologies pyro webcam FireWire camera.

Yuy2

16

YUV as for uyvy but with different component ordering within the u_int32 macropixel.

Yuyv

16

Duplicate of yuy2

Yunv

16

A direct copy of yuy2 registered by NVIDIA to work around problems in some old codecs which did not like hardware which offered more than 2 yuy2 surfaces.

Yvyu

16

YUV as for uyvy but with different component ordering within the u_int32 macropixel.

Y41p

12

YUV (Y sample at every pixel, U and V sampled at every fourth pixel horizontally on each line). A macropixel contains 8 pixels in 3 u_int32s.

Y411

12

YUV with a packed, 6 byte/4 pixel macroblock structure.

Y211

8

Packed YUV format with y sampled at every second pixel limit SS each line and u and v sampled at every fourth pixel.

Y41t

12

Format as for y41p but the LSB of each Y component is used to signal pixel transparency.

Y42t

16

Format as for uyvy but the LSB of each Y component is used to signal pixel transparency.

Yuvp

24?

YCbCr extended precision 10-bits per component in y0u0y1v0 order. registered by rich Ehlers of Evans & Sutherland.

Y800

8

Simple, single Y plane for monochrome images.

Y8

8

Duplicate of y800 as far as I can see.

Y16

16

16-bit uncompressed greyscale image.

Uyvy Storage Structure

Uyvy is the most commonly used YUV format. Its data is arranged as follows:

3.2 planar YUV formats

Label

Bits per pixel

Description

Yvu9

9

8 bit Y plane followed by 8 bit 4x4 subsampled V and U planes. registered by Intel.

Yuv9

9?

Registered by Intel., This is the format used internally by Indeo video code

If09

9.5

As yvu9 but an additional 4x4 subsampled plane is appended containing Delta information relative to the last frame. (BPP is reported as 9)

Yv16

16

8 bit Y plane followed by 8 bit 2x1 subsampled V and U planes.

Yv12

12

8 bit Y plane followed by 8 bit 2x2 subsampled V and U planes.

I420

12

8 bit Y plane followed by 8 bit 2x2 subsampled u and v planes.

Iyuv

12

Duplicate fourcc, identical to i420.

Nv12

12

8-bit Y plane followed by an interleaved U/V plane with 2x2 subsampling

Nv21

12

As nv12 with u and v reversed in the interleaved plane

Imc1

12

As yv12 stride t the u and v planes each have the same stride as the Y plane

Imc2

12

Similar to imc1 blocks t that the U and V Lines are interleaved at half stride boundaries

Imc3

12

As imc1 blocks t that U and V are swapped

Imc4

12

As imc2 blocks t that U and V are swapped

Clpl

12

Format similar to yv12 but including a level of indirection.

Y41b

12?

Weitek format listed as "YUV planar". I have no other information on this format.

Y42b

16?

Weitek format listed as "YUV 4: 2 planar". I have no other information on this format.

Y800

8

Simple, single Y plane for monochrome images.

Y8

8

Duplicate of y800 as far as I can see.

Cxy1

12

Awaiting clarification of format.

Cxy2

16

Awaiting clarification of format.

Y42b Storage Structure

YCbCr Storage

4 Conversion Relationship Between YUV and RGB

Yuv422 planar to rgb565
Conversion formula:
R = Y + 1.4075 * (V-128)
G = Y-0.3455 * (U-128)-0.7169 * (V-128)
B = Y + 1.779 * (U-128)
To speed up the computation, the following formula is used:
U = yuvdata [upos]-128;
V = yuvdata [VPOs]-128;

Rdif = V + (V * 103)> 8 );
Invgdif = (u * 88)> 8) + (V * 183)> 8 );
Bdif = u + (u * 198)> 8 );

R = yuvdata [ypos] + rdif;
G = yuvdata [ypos]-invgdif;
B = yuvdata [ypos] + bdif;
R = r> 255? : 255 :( r <0 :? 0: R );
G = G & gt; 255? : 255 :( G <0 :? 0: G );
B = B> 255? : 255 :( B <0 :? 0: B );
The above figure shows the data of rgb888, and then converts rgb888 to rgb555.
Rgbdata [1] = (R & 0xf8) | (G> 5 ));
Rgbdata [0] = (G & 0x1c) <3) | (B> 3 ));
Yuv422 planar format size:
Size = width * height * 2;
Ysize = size/2;
Usize = size/4;
Vsize = size/4;
Ypos = 0;
Upos = ypos + size/2;
VPOs = upos + size/4;

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.