YCbCr and YUV

Source: Internet
Author: User

 

Definition

Just as the coordinate space is used to describe the coordinate set in ry, the color space is used to describe the color set in mathematics. The common three basic color models are RGB, CMYK, and YUV. YCbCr is part of the ITU-r bt1601 recommendation during the development of the world's digital organization video standards. It is actually a version of YUV through scaling and offset. Among them, Y has the same meaning as Y in YUV. CB and Cr both refer to colors, but they only differ in the representation methods. In the YUV family, YCbCr is the most widely used member in computer systems. It is widely used in many fields and adopts JPEG and MPEG formats. Generally, YUV refers to YCbCr. YCbCr has many sampling formats, such as 4: 4: 4, 4: 2: 2, 4: 1: 1 and 4: 2: 0.

YUV

Video encoders and decoders require video input in yuv4: 2: 0 format. Therefore, video input preprocessing may be performed based on application requirements, that is, for yuv4: 2: 2. The line-through scan (for example, from the camera) to the YUV non-line scan conversion. Only the UV score is extracted but not filtered. For video decoder, post-processing is also required to convert the decoded YUV data to RGB for display, including: YUV to RGB conversion; 16-bit or 12-bit RGB display format; rotate between 0 and 90 degrees for horizontal or vertical display. In addition, video codecs usually require the following functions and features: Support for MPEG-4 simple Class 0, 1 and 2; compatible with H.263 and MPEG-4 codec standard; MPEG-4 Video Decoder supports the following options: AC/DC prediction, Reversible variable length encoding (RVLC), re-synchronization mark (RM), data split (DP), patented error hiding technology, support each Macro Block 4 motion vector (4mv), Free Motion Compensation, decoding vos layer; MPEG-4 Video Encoder options include: RVLC, RM, DP, supports four motion vectors (4mv) for each Macro Block) header extended code, support for bitrate Change During encoding, support for changing Encoding Frame Rate During encoding, insert or not insert the sequence start code of the visual object; Support for inserting I frames in the sequence during encoding; encoder auto-refresh in-frame (air); support for multiple codecs, the same availableCodeRun multiple decoder instances.

YCbCr

In consumer video products such as DVDs, cameras, and digital TVs, the commonly used color encoding scheme is YCbCr, where Y refers to the brightness component and CB refers to the blue color component, CR indicates the red color. The human eye is more sensitive to the Y component of the video. Therefore, after subsampling the color component to reduce the color component, the human eye will detect invisible changes in the image quality. The main subsampling formats are YCbCr, YCbCr, and YCbCr. Represents 4 brightness components per 4 pixels, 2 color components (yyyycbcr), sampling only odd scanning lines, portable video devices (MPEG-4) and video conferencing (H.263) the most common format is. It indicates that each 4 pixels has four brightness components and four color components (yyyycbcrcbcr ), it is the most common format for DVD, digital TV, HDTV, and other consumer video devices. represents a full pixel dot matrix (yyyycbcrcbcrcbcrcbcr) for high-quality video applications, studios, and professional video products.

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, 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], where the stored code streams are: 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], where the stored code streams are: y0 U0 Y1 V1 Y2 U2 Y3 V3 ing pixel: [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 pixels in the horizontal direction occupies four pixels in 6 bytes of memory: [y0 U0 V0] [Y1 U1 V1] [Y2 U2 V2] [Y3 U3 V3] The stored bitstream is: y0 U0 Y1 Y2 V2 Y3 ing the 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] Storage the code stream is: y0 U0 Y1 Y2 U2 Y3 Y5 V5 y6 y7 V7 Y8 maps the following pixels: [y0 U0 V5] [Y1 U0 V5] [Y2 U2 V7] [Y3 U2 V7] [Y5 U0 V5] [y6 U0 V5] [y7u2 V7] [Y8 U2 V7]Mutual conversion between YCbCr and RGBY = 0.299r + 0.587G + 0.114b cb = 0.564 (B-Y) Cr = 0.713 (R-Y) r = Y + 1.402cr G = Y-0.344Cb-0.714Cr B = Y + 1.772cb

YCbCr simulation component ypbpr

YCbCr is sometimes called ycc. Y' cbcr, which is also known as ypbpr in Analog Component Video. 'Cbcr signal (prior to scaling and offsets to place the signals into digital form) is called ypbpr, in addition, the gamma-adjusted RGB source must conform to the following two constants: kb and kr: ypbpr (analog version of y'cbcr) from R 'G' B 'ypbpr (analog version of y' cbcr) from R 'G' B '====================================== ========================================================== ============================== y '= Kr * R' + (1-Kr-KB) * G' + kb * B 'y' Pb = 0.5 * (B'-y')/(1-KB) Pb = 0.5 * (B '-y ') /(1-KB) Pr = 0.5 * (R'-y')/(1-KR) Pr = 0.5 * (R'-y ') /(1-KR ).................................. ........................................ .............................. r', G', B 'in [0; 1] R', G', B' in [0; 1] y' in [0; 1] y' in [0; 1] Pb in [-0.5; 0.5] Pb in [-0.5; 0.5] PR in [-0.5; 0.5] PR in [-0.5; 0.5]

 

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.