YCoCg

The YCoCg color model is the color space formed from a simple transformation of an associated RGB color space into a luma value (denoted as Y) and two chroma values called chrominance green (Cg) and chrominance orange (Co). It is supported in video and image compression designs such as H.264/MPEG-4 AVC, HEVC, JPEG XR, and Dirac,[1] since it is simple to compute, has good transform coding gain, and can be losslessly converted to and from RGB with fewer bits than are needed with other color models.

Original image above and representation of the individual components Y, chrominance green Cg and chrominance orange Co.

Properties

Advantages the YCoCg color model has over the YCbCr color model are simpler and faster computation, better decorrelation of the color planes to improve compression performance, and exactly lossless invertibility.[2][3]

Conversion with the RGB color model

The three values of the YCoCg color model are calculated as follows from the three color values of the RGB color model:

${\displaystyle {\begin{bmatrix}Y\\Co\\Cg\end{bmatrix}}={\begin{bmatrix}{\frac {1}{4}}&{\frac {1}{2}}&{\frac {1}{4}}\\{\frac {1}{2}}&0&-{\frac {1}{2}}\\-{\frac {1}{4}}&{\frac {1}{2}}&-{\frac {1}{4}}\end{bmatrix}}\cdot {\begin{bmatrix}R\\G\\B\end{bmatrix}}}$

The values of Y are in the range from 0 to 1, while Co and Cg are in the range of −0.5 to 0.5, as is typical with "YCC" color models such as YCbCr. For example, pure red is expressed in the RGB system as (1, 0, 0) and in the YCoCg system as (1/4, 1/2, −1/4).[2][3] However, since the coefficients of the transformation matrix are simple binary fractions, it is easier to compute than other YCC transformations. For RGB signals with bit depth n, either the resulting signals would then be rounded to n bits or would ordinarily be n+2 bits when processing data in this form (although n+1 bits would be sufficient for Co).

The inverse matrix converts from the YCoCg color model back to the RGB color model:

${\displaystyle {\begin{bmatrix}R\\G\\B\end{bmatrix}}={\begin{bmatrix}1&1&-1\\1&0&1\\1&-1&-1\end{bmatrix}}\cdot {\begin{bmatrix}Y\\Co\\Cg\end{bmatrix}}}$

To perform the inverse conversion, only two additions and two subtractions are necessary, without real-valued coefficients, by implementing it as:

tmp = Y   - Cg;
R   = tmp + Co;
G   = Y   + Cg;
B   = tmp - Co;


The lifting-based YCoCg-R variation

A scaled version of the transformation, sometimes called YCoCg-R (where the "-R" refers to reversibility), can be implemented efficiently with a reduced bit depth. The scaled version uses a lifting scheme to make it exactly invertible while minimizing the bit depth of the three color components. For RGB signals with bit depth n, the bit depth of the Y signal when using YCoCg-R will be n and the bit depth of Co and Cg will be n+1, as contrasted with ordinary YCoCg which would need n+2 bits for Y and Cg and n+1 bits for Co.

Here, possible values for Y are still in [0, 1], while possible values for Co and Cg are now in [-1, 1].

The conversion from RGB to YCoCg-R is:

Co  = R - B;
tmp = B + Co/2;
Cg  = G - tmp;
Y   = tmp + Cg/2;


The conversion from YCoCg-R to RGB is then:

tmp = Y - Cg/2;
G   = Cg + tmp;
B   = tmp - Co/2;
R   = B + Co;


Efficiency gains

The use of YCoCg color space to encode RGB video in HEVC screen content coding found large coding gains for lossy video, but minimal gains when using YCoCg-R to losslessly encode video.[4]

Literature

• Henrique Malvar and Gary Sullivan, "YCoCg-R: A color space with RGB reversibility and low dynamic range". Moving Picture Experts Group and Video Coding Experts Group document JVT-I014, JVT PExt Ad Hoc Group Meeting: Trondheim, Norway, July 2003.
• Shijun Sun, "Residual Color Transform Using YCoCg-R". ISO/IEC JTC1/SC29/WG11 and ITU-T Q6/SG16 document JVT-L014, 12th JVT meeting: Redmond, Washington, United States, July 2004.
• Woo-Shik Kim, Dmitry Birinov, and Dae-Sung Cho, Hyun Mun Kim (Multimedia Lab, Samsung AIT), "Enhancements to RGB coding in H.264/MPEG-4 AVC FRExt". ITU-T SG16 Q.6 document VCEG-Z16, 26th VCEG meeting: Busan, Korea, April 2005.
• H. S. Malvar, G. J. Sullivan, and S. Srinivasan, "Lifting-based Reversible Color Transformations for Image Compression", SPIE Applications of Digital Image Processing XXXI, Proc. SPIE, San Diego, California, Vol. 7073, paper 7073-07, August 2008.
• P. Agawane and K. R. Rao (Multimedia Processing Lab, University of Arlington), "Implementation and evaluation of residual color transform for 4:4:4 lossless RGB coding". International Conference on Recent Advances in Communication Engineering, Hyderabad, India, December, 2008.
• T. Strutz, "Multiplierless Reversible Colour Transforms and their Automatic Selection for Image Data Compression." IEEE Transactions on Circuits and Systems for Video Technology, Vol. 23, No. 7, 1249-1259,pp.  July 2013,
• T. Strutz and A. Leipnitz, "Reversible Colour Spaces without Increased Bit Depth and Their Adaptive Selection." IEEE Signal Processing Letters, Vol. 22, No. 9, pp. 1269-1273, September 2015.

References

1. ^ "Dirac Specification" (PDF). BBC. p. 136. Archived from the original (pdf) on 2015-05-03. Retrieved 2010-05-04.
2. ^ a b "YCoCg: A Color Space with RGB Reversibility" (ppt). University of Texas at Arlington. Retrieved 2010-05-02.
3. ^ a b Yair Moshe. "H.264 Amendment: Fidelity Range Extensions" (pdf). Signal and Image processing Lab (SIPL), Technion Israel Institute of Technology. p. 15. Retrieved 2010-05-02.
4. ^ Shan Liu; Xiaozhong Xu; Shawmin Lei; Kevin Jou (September 2015). "Overview of HEVC extensions on screen content coding". p. 8.