YUV color space (from Baidu Encyclopedia)

Outline

  The YUV (also known as a YCrCb) is used in a color television system in Europe coding method (of PAL). In modern color television system, usually three color camera or a color CCD camera for taking images, and then obtaining a color separation image signal, to obtain corrected RGB amplify, and then through the matrix circuit to obtain a luminance signal Y and two color difference signal R-Y (i.e., U), B-Y (i.e. V), and finally transmitting end three luminance and color difference signals are encoded, transmitted using the same channel. This color representation of the so-called YUV color space representation. The importance of using a YUV color space is the luminance signal Y and its chrominance signals U, V is isolated. If not only the Y signal components U, V signal components, so that the image is represented by a black and white gray scale image. YUV color space is TV with Y to solve the compatibility problems of black and white TV and color television luminance signal to the color black and white TV can receive television signals.

Role advantage

  YUV is mainly used to optimize the transmission of color video signals, so backward compatibility with old black and white television. RGB video signal transmission as compared with its greatest advantage is that occupies only very little bandwidth (RGB requires three separate video signals simultaneously transmitted). Wherein "Y" represents brightness (Luminance or Luma), i.e. grayscale value; and "U" and "V" is represented by chromaticity (Chrominance or by Chroma), is to describe the image color and saturation for the Specifies the color of the pixel. "Brightness" is established through the RGB input signal, the particular portion is superimposed with the RGB signal. "Chroma" defines the ─ both color hue and saturation, respectively denoted Cr and CB. Wherein, Cr GB reflects the difference between the input signal luminance value of the red portion of the signal RGB. CB and reflects the blue part of the same luminance signal difference values ​​of the RGB input RGB signal.

  The importance of using a YUV color space is the luminance signal Y and its chrominance signals U, V is isolated. If not only the Y signal components U, V component, then this image is represented in black and white gray scale image. TV with YUV color space precisely in order to solve the Y color television with black and white TV compatibility issues with the luminance signal, the color black and white TV sets can receive television signals.

  YUV to RGB conversion formula is as follows (RGB ranges are 0-255) ︰
  the Y = 0.299R + 0.587G + 0.114B
  the U--0.147R = - 0.289 g + 0.436B
  V = 0.615R - 0.515 g - 0.100 B
  R & lt 1.14V = the Y +
  G = the Y - 0.39U - 0.58V
  B = the Y + 2.03U

  In DirectShow, the common RGB format RGB1, RGB4, RGB8, RGB565, RGB555, RGB24, RGB32, ARGB32 the like; common YUV format YUY2, YUYV, YVYU, UYVY, AYUV, Y41P, Y411, Y211, IF09, IYUV , YV12, YVU9, YUV411, YUV420 and so on.
  

YUV major sample formats


  The main sampling format YCbCr 4: 2: 0, YCbCr 4: 2: 2, YCbCr 4: 1: 1 and YCbCr 4: 4: 4. Wherein YCbCr 4: 1: 1 commonly used, which means: the luminance value of each point stored (i.e., Y value) of a 8bit every point save a 2x2 Cr and Cb values, the image is not visually feel from change too much. Therefore, the original RGB (R, G, B are 8bit unsigned) model, four points need 8x3 = 24 bites (FIG first below). Now only necessary 8+ (8/4) + (8/4) = 12bites, each point representing the average 12bites (second FIG below). This put the image data compression half.

  Upper gives only exemplary theoretical, actual data store is likely to be different, given below of several particular forms of storage:

  (1)    YUV 4:4:4

  YUV three same channel sampling rate, and therefore the generated image, the three components of each pixel of information is complete (usually 8 bits per component), then through the 8-bit quantization, for each pixel of the uncompressed occupancy 3 bytes.

  The following four pixels: [Y0 U0 V0] [Y1 U1 V1] [Y2 U2 V2] [Y3 U3 V3]

  Stream is stored: Y0 U0 V0 Y1 U1 V1 Y2 U2 V2 Y3 U3 V3

  (2)   YUV 4:2:2

  Each color channel sample rate is half of the luminance channel, chroma sampling rate in the horizontal direction so that only 4: 4: 4 in half. 8 bits of the quantized non-compressed image, the pixels of each macro by two adjacent pixels in the horizontal direction take 4 bytes of memory.

  The following four pixels: [Y0 U0 V0] [Y1 U1 V1] [Y2 U2 V2] [Y3 U3 V3]

  Stream is stored: Y0 U0 Y1 V1 Y2 U2 Y3 V3

  Mapping the pixel as: [Y0 U0 V1] [Y1 U0 V1] [Y2 U2 V3] [Y3 U2 V3]

  (3)   YUV 4:1:1

  4: 1: 1 sampled chroma, chroma is 4 in the horizontal direction: 1 sampling. For low-end users and consumer product which is still acceptable. Uncompressed 8-bit quantization of the video, the pixels of each macroblock consists of four adjacent pixels in the horizontal direction take up 6 bytes of memory.

  The following four pixels: [Y0 U0 V0] [Y1 U1 V1] [Y2 U2 V2] [Y3 U3 V3]

  Stream is stored: Y0 U0 Y1 Y2 V2 Y3

  Mapping the pixel as: [Y0 U0 V2] [Y1 U0 V2] [Y2 U0 V2] [Y3 U0 V2]

  (4)YUV4:2:0

  4: 2: 0 does not mean only the Y, Cb and Cr components without. It refers to the scan lines for each row, only one chrominance component of 2: 1 sampling rate of storage. Different adjacent scanning line storage chrominance components, that is, if a line is 4: 2: 0, then the next line is the 4: 0: 2, and then the next line is 4: 2: 0 and so on ... . For each chrominance component, the horizontal and vertical sampling rate is 2: 1, it can be said chroma sampling rate is 4: 1. Uncompressed 8-bit quantization of the video, the pixels of each macro two 2x2 2 rows and two columns of pixels adjacent to the need to occupy 6 bytes of memory.

  The following eight pixels: [Y0 U0 V0] [Y1 U1 V1] [Y2 U2 V2] [Y3 U3 V3]

  [Y5 U5 V5] [Y6 U6 V6] [Y7U7 V7] [Y8 U8 V8]

  Stream is stored: Y0 U0 Y1 Y2 U2 Y3

  Y5 V5 Y6 Y7 V7 Y8

  Pixel map as shown: [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 format (FIG)

  YUV format is generally two categories: packing (packed The) and a planar format (Planar) format. The former YUV components stored in the same array, typically several adjacent pixels a pixel macro (macro-pixel); the latter three arrays using YUV three components kept separately, as is the same as a three-dimensional plane. Table 2.3 in YUY2 to Y211 are packed format, and IF09 are to YVU9 plane format. (Note: When introducing various specific formats, each of YUV components are subscripted, such as Y0, U0, V0 represents the YUV components of a pixel, Y1, U1, V1 represents the second pixel YUV components to forth.)

  ¨ YUY2 (and YUYV) format for each pixel to retain the Y component, while the UV-component sampled every two pixels in the horizontal direction once. A macro pixel is 4 bytes, actually represents two pixels. (4: 2: 2 for the meaning of a macro pixel has four Y component, the U component and two component V 2.) The image data YUV components in the order as follows:
  Y0 U0 V0 Y2 U2 Y3 V2 Yl ...

  ¨ YVYU similar format with YUY2, and differ only in the order of image data in the YUV components:
  Y0 U0 V0 Yl Y2 U2 Y3 V2 ...

  ¨ UYVY format with similar YUY2, and differ only in the order of image data in the YUV components:
  U0 Y0 Yl V0 Y2 U2 Y3 V2 ...

  ¨ AYUV a format with Alpha channel, and YUV components are extracted for each pixel, the image data format is as follows:
  A0 A1 Y0 U0 V0 Yl Ul Vl ...

  ¨ Y41P (and Y411) format for each pixel to retain the Y component, while the UV-component sampled every four pixels in the horizontal direction. A macro pixel is 12 bytes, actually represents 8 pixels. Image data YUV components in the order as follows:
  U0 V0 Y0 U4 Yl Y2 Y3 Y4 Y5 Y6 Y8 V4 ...

  ¨ Y211 Y format in the horizontal direction component pixel samples once every two, four and UV components of each pixel are sampled once. A macro pixel is 4 bytes, actually represents four pixels. Image data YUV components in the order as follows:
  Y0 U0 V0 Y2 Y6 U4 Y4 V4 ...

  ¨ YVU9 format for each pixel to extract a Y component, while the UV component in the extraction, the first image into a plurality of macro blocks of 4 x 4, then each macro block extracting a U component and a V component. When the image data is stored, the Y component is the first image of the entire array, then an array along the U component, and the V component array. IF09 format YVU9 similar.

  ¨ IYUV format for each pixel to extract a Y component, while the UV component in the extraction, the first image into a plurality of macro blocks of 2 x 2, then each macro block extracting a U component and a V component. YV12 format IYUV similar.

  ¨ YUV411, YUV420 format DV data in common, the former for the NTSC system, PAL system which is used. YUV411 are extracted for each pixel Y component, while the UV component pixel every 4 samples in the horizontal direction once. YUV420 is not 0 V component samples, but compared with the YUV411, doubling the sampling frequency of the color difference in the horizontal direction, the vertical direction in a manner U / V chrominance sampling interval is reduced by half, as shown in FIG.

Reproduced in: https: //www.cnblogs.com/shelvenn/archive/2008/01/25/1053407.html

Guess you like

Origin blog.csdn.net/weixin_34075268/article/details/93272926