当前位置:网站首页>Audio and video engineer YUV and RGB detailed explanation

Audio and video engineer YUV and RGB detailed explanation

2022-07-06 02:05:00 Siege lion hundred miles

Color space Color Space

Color space color space is the organization of color . With the help of color space and testing for physical devices , You can get a fixed analog and digital representation of color . Color space can be defined only by arbitrarily selecting some colors , For example, a color system is just a set of color samples , Then define a name and code for each color ; It can also be based on rigorous mathematical definitions , such as Adobe RGBsRGB.

Color model

 Insert picture description here
RGB It's a kind of Color model ( In fact, it can also be called color coding method ), Describe colors by a set of numbers . It is a additive model , Itself cannot represent absolute color space . But through the description of standard color space Adobe RGB and sRGB The combination of , You can determine the color of a pixel . Through this process , Colors in images and documents , It can be determined .( Therefore, it is combined with the description of different color spaces , You can see different effects on the monitor ).
 Insert picture description here
YUV It is adopted by European television system Color coding method ( Belong to PAL), yes PAL and SECAM Simulate the color space of color TV system .

YUV Usually used for color images / Color space of video processing . It encodes color images / video , At the same time, considering the properties of human eyes , These properties allow the bandwidth of chrominance components to be reduced without perceptual distortion . Use YUV Color space helps images / video compression . It was originally used for analog television broadcasting . Color space YUV、YIQ、YCbCr and YPbPr All belong to YUV family .Y’UV, YUV, YCbCr,YPbPr And other proper nouns can be called YUV, There's overlap .「Y」 Indicates brightness (Luminance、Luma),「U」 and 「V」 It's chromaticity 、 concentration (Chrominance、Chroma).

Why is there YUV

Y’UV The invention of color TV is due to the transition period between color TV and black-and-white TV . Black and white video only Y(Luma,Luminance) video , That's the gray scale value . The customization of color TV specifications is based on YUV/YIQ To process color TV signals . hold UV See it as a symbol of chromaticity . be left over Y The signal is the same as that of black-and-white TV , This can solve the compatibility problem . meanwhile Y’UV The biggest advantage is that it only needs to occupy very little bandwidth .

In terms of historical evolution , among YUV and Y’UV Usually used to encode analog signals of TV , and YCbCr It is used to describe digital image signals , Suitable for film and picture compression and transmission , for example MPEG,JPEG.

YUV sampling

YUV 4:4:4 sampling , every last Y Corresponding to a group of UV component , One YUV Occupy 8+8+8 = 24bits 3 Bytes .

YUV 4:2:2 sampling , Every two Y Share a group UV component , One YUV Occupy 8+4+4 = 16bits 2 Bytes .

YUV 4:2:0 sampling , Every four Y Share a group UV component , One YUV Occupy 8+2+2 = 12bits 1.5 Bytes .

 Insert picture description here

YUV Format

YUV The format is divided into two formats : Compact format (packed format): take Y,U,V The value is stored as Macro Pixels array , and RGB Is stored in a similar manner . Flat format (planar format): take Y,U,V The three fragments of are placed in different matrices .

Start talking is : about planar Of YUV Format , First, store all pixels in a row Y, And then it stores all the pixels U, And then all the pixels V. about packed Of YUV Format , Every pixel point Y,U,V Is a continuous cross storage .

YUV420 type

 Insert picture description here

1.YUV420p and YUV420sp difference

because YUV420 More commonly used , Here we will focus on YUV420.YUV420 Divided into two :YUV420p and YUV420sp. Let's first look at a brain map , Just have an impression of these types .

YUV420P
 Insert picture description here
YUV420SP
 Insert picture description here

2.YUV420p and YUV420sp Specific classification and details

YUV420p: Also called planer Flat pattern ,Y ,U,V And then different planes , That is, there are three planes .

I420: Also called YU12, Android mode . The storage order is save first Y, Save again U, Last deposit V.YYYYUUUVVV Insert picture description here
YV12: The storage order is save first Y, Save again V, Last deposit U.YYYVVVUUU
 Insert picture description here
UV420sp: Also called bi-planer or two-planer Biplane ,Y A plane ,UV Cross store on the same plane .

NV12:IOS There is only one mode . The storage order is save first Y, Again UV Alternate storage .YYYYUVUVUV

 Insert picture description here
NV21: Android mode . The storage order is save first Y, Save again U, Again VU Alternate storage .YYYYVUVUVU
 Insert picture description here

RGB and YUV Transformation between

HDTV(BT.601) Of RGB and YUV Conversion between .
 Insert picture description here
HDTV(BT.709) Of RGB and YUV Conversion between .
 Insert picture description here
YIQ yes NTSC Color space used by color TV
 Insert picture description here
YDbDr, yes SÉCAM Color space used in
 Insert picture description here
YCbCr yes YUV Scale and offset versions of the color space .Y Of 8 Bit range from 16 A to 235.Cb and Cr For the range of 16-240.YCbCr be used for JPEG Compress . Insert picture description here
If RGB The range of data is 0-255( Black and white ), It's like PC As is common in , Then the following equation should be used to maintain the correct black and white level :
 Insert picture description here

Standard setting body – International Telecommunication Union radio communication department (ITU-R)

ITU-R primary CCIR, stay 1982 Formulated in BT.601 standard ( It's also called Rec.601).

The color coding system confirmed by this standard is called YCbCr 4:2:2, It is used to digitally encode the interlaced digital video analog signal .

FFmpeg/WebRTC/RTMP/NDK/Android Advanced development of audio and video streaming media Interview questions 、 Learning materials 、 Teaching videos and learning roadmap can be added if necessary Learning exchange group perhaps Data acquisition

 Insert picture description here

原网站

版权声明
本文为[Siege lion hundred miles]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202140042015712.html