Basic LCD knowledge 1

Source: Internet
Author: User
Overview

YUV (also known as YCrCb) is a color encoding method used by European television systems (which belongs to PAL) and is the color space used by PAL and SECAM analog color TV systems. Y, U, and V are not English words. Y represents brightness, uv represents chromatic aberration, and u and v constitute two components of color. 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, after the matrix conversion circuit, the Brightness Signal Y and two color difference signal R-Y (U) and B-Y (V) are obtained. Finally, the sending end encodes the brightness and color difference Signals respectively, send data over the same channel. The representation of this color is the so-called YUV color space representation. The importance of using YUV color space is that its brightness signal Y is separated from the color signal U and V. If only Y signal components are used, but U and V signal components are not used, 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. Benefits

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 GB input signal and the brightness value of the RGB signal. CB reflects the differences 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 conversion formula between YUV and RGB is as follows (the RGB value ranges from 0 to 255 )︰
Y = 0.299R + 0.587G + 0.114B
U =-0.147R-0.289G + 0.436B
V = 0.615R-0.515G-0.100B
R = Y + 1.14 V
G = Y-0.39u- 0.58 V
B = Y + 2.03U

In DirectShow, common RGB formats include RGB1, RGB4, RGB8, RGB565, RGB555, RGB24, RGB32, and ARGB32; common YUV formats include YUY2, YUYV, YVYU, UYVY, AYUV, Y41P, Y411, Y211, IF09, IYUV, YV12, YVU9, YUV411, and YUV420.
Main YUV sampling formats

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, B are all 8bit unsigned) models, 4 points need 8x3 = 24 bites. Currently, only 8 + (8/4) + (8/4) = 12 bites are required, and each point occupies 12 bites on average. 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]
  

Various YUV formats (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. (Means that a macro pixel contains four Y components, two U components, and two V components .) 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.

 

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.