In a recent troubleshooting process, color space and color space conversion also have a lot of technical details, and clearing these details can help us to more accurately locate video problems.
1.
Color Space
Color space is derived from the word "color spaces" in English, in color science, people have established a variety of color models, one-dimensional, two-dimensional, three-dimensional or even four dimensional space coordinates to represent a certain color, this use coordinate system to define the color range is the color space.
For example, when a color is displayed on a computer monitor, the RGB (red, green, blue) color space is usually defined, and red, green, and blue are used as X, Y, and Z axes. Another way to generate the same color is to use hue (X-axis), saturation (Y-axis), and lightness (Z-axis), which is called the HSB color space. There are also many other color spaces that can be represented in three-dimensional spaces (X, Y, Z) in this way.
We often use the color space mainly RGB, YUV, CMYK, HSB, HSL and so on, including YUV and RGB is the field of video communications with more than two color space.
1.1.1
RGB
At present, most of the display devices are RGB color space, RGB is from the principle of color design, and its color mixing method such as red, green, blue three lights, when their light overlapping, color mixed, brightness equals the sum of the brightness of the two, that is, the addition of mixed.
The different colors on the screen are made up of three basic shades of red, green and blue, which are mixed in different proportions (weights). A group of Red Green Blue is a minimal display unit. Any color on the screen can be recorded and expressed by a set of RGB values. So this red Green blue is also called the RGB Light, in English is R (Red), G (green), B (blue). RGB's so-called "how much" refers to the brightness, and the use of integers to represent. When using 8-bit representations, RGB has 256 levels of brightness, which is represented by digital quantization from 0, 1, 2 ... until 255. Note that although the number is up to 255, 0 is also one of the values, thus a total of 256 levels.
such as an image that represents the RGB color space seen from three dimensions of r,g,b.
1.1.2
YUV
The importance of YUV color space is that its luminance signal y and chroma signal u, v are separated. If only the Y signal component does not have a U, v component, then the image represented here is a black-and-white grayscale image. Color TV using YUV space is precisely to use brightness signal y to solve the compatibility problem between color TV and black and white TV, so that black and white machine can also receive color TV signal .
The Y luminance and chroma signal of YUV color space you and V are separated and one advantage is that the human eye is sensitive to brightness and insensitive to chroma. Reduce the amount of data in some Uvs, but the human eye is not aware of it.
such as the image that represents the YUV color space seen from the y,u,v three dimensions.
1.1.3
YCbCr
YCbCr is a color space defined by the ITU in standard ITU-R bt.601 (SD), ITU-R bt.709 (HD), ITU-R bt.2020 (Ultra HD), for use in Digital TV systems . YCbCr is not an absolute color space, is a coding for the RGB, is the YUV compression and offset version, where Y is consistent with the meaning of the y in YUV, CB,CR also refers to the color, but in the expression methodis different, CB,CR is the difference .
The "YUV" image in video communication system (especially video codec) is YCbCr. In the ordinary work exchange, the said YUV is also ycbcr.
Y = K ry · R + Kgy· G + Kby• B(R,G,B stands for RGB color space of red, green, blue)
C b = B–y (CB is the difference)
C R = R–y(CR is the difference)
K ry + K Gy + K by = 1(K is the ratio or weigh weight, bt.601, the weights in bt.709,bt.2020 are different.) )
In the formula above
K ru =-K ry ; K gu =-K Gy ; K BU = 1-k by ; K RV = 1–k ry ; K GV = k Gy ; K BV = k by
1.1.4
YPbPr
YPbPr and YCbCr are similar, y means brightness, cb,cr refers to color, the difference is that YPBPR is only used for analog signals. YPbPr interface, YPBPR is also called chromatic aberration component interface, using the American Electronics Industry Association EIA-770.2A Standard. YPbPr interface can use coaxial cable, can use BNC Head, can also use ordinary Lotus head as interface standard.
component interfaces, especially analog component interfaces, do not have an internationally harmonized standard, and the most common are Japan's D terminals, European SCART terminals and US three-wire terminals. China is currently using the United States, a three-wire terminal, this terminal is the United States EIA (Electronic Industry Association) standard EIA-770.2A provisions. According to this standard, down to 480i to 720p signal is the use of this terminal transmission, and there is no interlaced, progressive difference. Japan's D-terminal and European SCART terminals are also different from the D1-to-D5 logo of the D-terminal, which only tells the user that the machine can only output (input) a signal below a certain format (such as D4 support 720p and the following format). So YPBPR represents only analog video component interfaces, and is only American standards (including other countries that use American standards).
As shown, the component terminals on almost all DVD players (or terminals) that have a component output are identified as YCBCR/YPBPR, and we know from the previous study that marking YCbCr is wrong or called identity confusion.
There are now three ways to say it on the market:
1, the interlaced component terminal and progressive component terminals are set separately. In this case, according to the specification, the YCBCR is used to represent the interlaced component terminals, and the YPBPR is used to represent the progressive component terminals.
2, the interlaced component terminal and progressive component terminals are common, the terminal is identified as YPBPR/YCBCR, according to the instructions, regardless of the interlaced component signal or progressive component signal is from this port (input).
3, the interlaced component terminal and progressive component terminals are common, the terminal is identified as YPBPR. According to the specification, the output (input) is from this port regardless of the interlaced component or the progressive component.
Of the 3 statements above, only the 3rd case is correct, and 1 and 2 are all wrong. But why would a manufacturer make such a mistake and continue? Personally, it is for the past wrong habits and understanding of the convenience.
2.
ITU Standards
ITU-R BT. ITU = International Telecommunication Union (UN) International Telecommunication Union, R = radiocommunication Sector Radio Department, BT = Broadcasting Service (Telev ision) broadcast Service (TV).
2.1.5
ITU-R recommendation Bt.601
1982 CCIR (International Radio Consultative Committee International Radio Advisory Committee) developed a color video digitization standard, called the CCIR 601 Standard, is now replaced by the ITU-R bt.601 Standard (601-4 : 1994.7./601-5:1995.10). This standard specifies the sampling frequency used when converting color video into digital images, and the conversion relationship between RGB and ycbcr two color spaces.
In order to facilitate the exchange of international programmes, to eliminate the standard differences between digital devices and the compatibility between 625-line television systems and 525-line television systems, the harmonization and standardization of digital television Broadcasting System parameters was adopted at the 15th plenary meeting of the International Radio Advisory Committee (CCIR) in February 1982. Recommendation No. No. 601, which is based on component coding, that is to encode the luminance component Y, and two chromatic aberration components r-y, b-y, as the international standard for digital coding of TV Studios, recommendation NO. 601 separately stipulates the coding standard of TV studio.
2.1.6
ITU-R recommendation BT.
709
BT.709 is the ITU standard for high-definition digital TVs. In 1990, the ITU 11A Working Group re-opened the conference on HDTV, and the 1080P/50 and 1080P/60 two progressive scanning systems became the basis for discussion. However, the European representative once again encountered doubts as to whether the HDTV should include interlaced scanning. In accordance with the ITU definition, HDTV must provide a higher performance than the SDTV, and SDTV's field frequency is already at a Hz and Hz, so the use of this field-frequency HDTV does not provide better quality than the SDTV, and is not a true HDTV. However, in view of the reality of the interlaced system, the ITU conference finally agreed to accept the two HZ/60 Hz field frequency and frame rate, an image format (1920x1080) and a data ratio, NHK has submitted a new draft of ITU-R BT.709 recommendations. 2 years later, with the addition of the 24/25 Hz format, HDTV began to emerge in the film industry. As a global cooperative project, the birth process of the 709 proposal is the crystallization of wisdom and the product of compromise.
2.1.7
ITU-R recommendation BT.
2020
In the second half of 2012, the International Telecommunication Union radiocommunication Sector (ITU-R) issued a new generation of Ultra HD UHD (ultra-high definition) Video production and display System bt.2020 standard, redefining the TV broadcast and consumer electronics in the field of ultra-high-definition video display parameters, to promote 4K ultra-high-definition home display equipment to further standardize. The most critical of these is that the BT.2020 standard indicates that the UHD Ultra HD video display system includes 4K and 8K two stages, of which 4 K has a physical resolution of 3840x2160 and 8K is 7680x4320. The Super HD video display system will have two stages, in fact, because of the high-definition video display system differences in various regions of the world, such as in the field of television broadcasting technology leader in Japan's direct development of 8K television broadcasting technology, to avoid the transition from 4K to 8 k possible technical barriers. In other parts of the world, the majority still use 4K technology as the next generation of television broadcasting development standard.
The importance of the bt.2020 standard is undeniable, just as bt.709 for high-definition video transmission and high-definition display equipment manufacturing has played a guiding role, bt.2020 standards also profoundly affect the consumption of ultra-high-definition display equipment design and manufacturing, especially in the 4K flat screen TV more prominent. For example, most of the 4K flat-panel TVs currently have physical resolution of 3840x2160, rather than the 4096x2160 of the DCI Digital Cinema Standard, using the BT.2020 standard. However, the bt.2020 standard is not only improved in terms of resolution, but also in terms of color and refresh frequency and signal format and analysis of the relevant provisions.
4K TV display standard bt.2020 in color improvement: bt.2020 standard relative to bt.709 standard, greatly improved the performance specification of video signal. For example, color depth, from the bt.709 standard 8bit to 10bit or 12bit, which 10bit for the 4K system, 12bit for the 8K system. This promotion plays a key role in the enhancement of the color level and transition of the entire image. And the gamut area is far larger than the bt.709 standard, can display more rich color, but relatively, the wider the color gamut for the performance requirements of the display equipment, according to the current situation of 4 K ultra-high-definition projector, often need to adopt a new generation of laser or LED solid-state light source models can be achieved.
BT.2020 standard ultra-high definition Ultra HD Image display resolution is 3840x2160 and 7680x4320, the screen display ratio is 16:9, the supported refresh rate includes 120p, 60p, 59.94p, 50p, 30p, 29.97p, 25p, 24p, 23.976p. Importantly, the bt.2020 standard cancels the interlaced scan , all ultra-high-definition images are based on progressive scanning , is undoubtedly a historic breakthrough, further enhance the ultra-high-definition image of the smoothness and smoothness.
Although the BT2020 TV is not yet fully implemented, the standard is standard and will soon begin to spread. For companies that usually face a later color palette, be prepared, if you take a film that will be placed on a 4k TV, you will have to care about that TV set is 709, or 2020.
3.
Color Space Conversion
Because video capture and playback is more use of RGB color space, and video codec is used in YCRCB color space, it is necessary to convert RGB and YCRCB format to each other.
3.1.8
YUV
–
RGB cross-turn
YUV is an analog signal, and the value range of y is 0 to 1 volts.
3.1.9
ycbcr-rgb Mutual transfer
by ITU-R BT.601 Standard. ( This formula is the most widely used ), by the following formula, we use YCBCR to represent an all-black picture,y value 16,cbcr valueof x. Because the RGB color space, the value of r,g,b 0 is black, all 255 is white.
By ITU-R BT.709 Standard, HD
Full range value format by JPEG
Note that the YCBCR here is the value from 0 to 255. However, at present, the formula is rarely used alone, basically replaced by the 601 formula, because the ITU standard is more widely used. The author also noticed such a small difference after 10 years of video work.
1) Formula fixed
The above formulas are floating point, for the convenience of computer operations and optimization, the actual work of image processing is fixed-point. Take the following formula as an example, according to 2 of the 8-time point (of course, you can also press 2 of the 6-point).
The following is a fixed-point formula that is implemented in our code.
Y = ((129 * R + * G + + * B + x) >> 8) + 16
Cb = (( -38 * R-74 * G + * * B + +) >> 8) + 128
Cr = ((R-94 * G-18 * B + $) >> 8) + 128
4.
Reference
Http://en.wikipedia.org/wiki/YUV
Http://en.wikipedia.org/wiki/YCbCr
Http://en.wikipedia.org/wiki/YPbPr
http://www.itu.int/rec/R-REC-BT.709/en
Https://msdn.microsoft.com/en-us/library/ms893078.aspx
RGB, YUV and related standards