Color Space
Color space Color space is the organization of colors. With the help of color space and testing against physical devices, fixed analog and digital representations of color can be obtained. Color space can be defined by just picking a few colors at random. For example, the Pantone system takes a specific set of colors as samples and gives each color a name and a code. It can also be based on a rigorous mathematical definition, such as Adobe RGB, sRGB.
Color model
RBG is a color model (or rather, a color coding method) that describes colors through a set of numbers. It is an additive color model, itself can not represent the absolute color space. But by combining Adobe RGB and sRGB with standard color space descriptions, you can determine the color of a pixel. Through this process, colors in images and documents can be determined. (Therefore, combined with the description of different color Spaces, different effects can be seen on the monitor).
YUV is a color coding method (belonging to PAL) adopted by European TELEVISION system. It is the color space adopted by PAL and SECAM analog color TV system.
YUV is typically used in color space for color image/video processing. It encodes color images/videos while taking into account the properties of the human eye, which allow for a reduction in the bandwidth of chroma components without perceived distortion. Using YUV color space helps with image/video compression. It was originally used for analog television broadcasting. Color space YUV, YIQ, YCbCr and YPbPr all belong to the YUV family. Y ‘uv, YUV, YCbCr, YPbPr and so on can all be called YUV, overlapping each other. Y refers to Luminance and Luma, U and V to Chrominance and Chroma.
Why YUV
Y’UV was invented because of the transition between color and black and white television. Black and white video only has Y (Luma, Luminance) video, which is gray scale. And color TV specifications are customized according to YUV/YIQ to process color TV signals. Think of UV as representing chroma. The remaining Y signal is the same as that of a black-and-white TV, which solves the compatibility problem. At the same time, the biggest advantage of Y’UV is that it takes up very little bandwidth.
From the evolution of history, YUV and Y’UV are usually used to encode TV analog signals, while YCbCr is used to describe digital image signals, suitable for film and picture compression and transmission, such as MPEG, JPEG.
YUV sampling
YUV 4:4:4 sampling, each Y corresponds to a set of UV components, a YUV accounting for 8+8+8 = 24bits 3 bytes.
YUV 4:2:2 sampling, every two Y share a set of UV components, one YUV accounted for 8+4+4 = 16bits 2 bytes.
YUV 4:2:0 sampling, every four Y share a set of UV components, a YUV accounting for 8+2+2 = 12bits 1.5 bytes.
YUV format
YUV format is divided into two formats: Packed Format: Y, U and V values are stored in Macro Pixels array, which is similar to RGB. Planar format: place Y, U and V segments separately in different matrices.
For planar YUV format, store Y for all pixels consecutively, then U for all pixels, then V for all pixels. For Packed YUV format, Y,U and V of each pixel point are stored continuously and cross.
YUV420 type
1.YUV420p and YUV420sp are different
Because YUV420 is more commonly used, YUV420 is mainly introduced here. YUV420 comes in two types: YUV420p and YUV420sp. Let’s start with a brain map, just to get a sense of what these types are.
YUV420P
YUV420SP
2. Specific classification and details of YUV420p and YUV420sp
-
YUV420p: also called planer mode, Y, U and V are in different planes respectively, that is, there are three planes.
I420: also called YU12, Android mode. The storage sequence is Y first, then U, and finally V. YYYYUUUVVV
YV12: Store Y first, then V, and finally U. YYYVVVUUUCopy the code
-
UV420sp: also called bi-planer or two-planer, Y is a plane, and UV is stored in the same plane.
NV12: This is the only IOS mode. The storage sequence is Y first, and then UV alternate storage. YYYYUVUVUV
NV21: Android mode. The storage sequence is Y first, then U, and then VU alternately. YYYYVUVUVUCopy the code
Conversion between RGB and YUV
HDTV (BT.601) conversion between RGB and YUV.
HDTV (BT.709) conversion between RGB and YUV.
YIQ is the color space used by NTSC color television
YDbDr is the color space used in SECAM
YCbCr is a scaled and offset version of YUV color space. The 8 bits of Y range from 16 bits to 235. Cb and Cr range from 16 to 240. YCbCr is used for JPEG compression.
If RGB data has a range of 0-255 (black and white), as is common in PCS, the following equation should be used to maintain the correct black and white level:
Standard Setting Body — Radiocommunication Sector of the International Telecommunication Union (ITU-R)
Itu-r, formerly CCIR, developed the STANDARD BT.601 (also known as REC.601) in 1982.
The standard recognizes a color coding system known as YCbCr 4:2:2 for the digital encoding of interlaced digital video analog signals.
Bt.709 was subsequently approved by the CCIR in 1990.
Rec.709 defines R ‘g ‘b ‘and Y ‘CBCR codes with 8 or 10 bits per sample in each color channel.
This specification HDTV image coding and signal characteristics.
The latest version is BT.709-6, released in 2015.
The first version of REC.2020 was released in August 2012. The standard defines aspects of ultra High definition television (UHDTV) with standard dynamic range (SDR) and wide color gamut (WCG).
Rec.2100 was released in July 2016. Introduction of high dynamic range TELEVISION (HDR-TV) by recommending the use of a perceptual quantizer (PQ) or mixed logarithmic gamma (HLG) transfer function
The resources
Zh.wikipedia.org/wiki/YUV#Y ‘…
zh.wikipedia.org/wiki/BT.601
www.vocal.com/video/rgb-a…
www.jianshu.com/p/e67f79f10…
Blog.csdn.net/byhook/arti…