SYCC

☆ Save On Wikipedia ↗
sYCC
IEC 61966-2-1 Default YCC encoding transformation for a standard luma-chroma-chroma colour space
AbbreviationsRGB
StatusPublished
Year started1996
First publishedOctober 18, 1999 (1999-10-18)[1]
Latest version61966-2–1 Amend. 1
2003
OrganizationIEC[1]
CommitteeTC/SC: TC 100/TA 2[1]
Base standardsIEC 61966 Colour Measurement and Management in Multimedia Systems and Equipment
DomainColor space, color model
Websitewebstore.iec.ch/publication/6169

sYCC is a standard numerical encoding of colors, similar to the CIE YCbCr encoding,[2] It uses three coordinates: a luma value Y {\displaystyle Y} {\displaystyle Y}, that is roughly proportional to perceived brightness of the color, and two chroma values C b {\displaystyle C_{b}} {\displaystyle C_{b}} and C r {\displaystyle C_{r}} {\displaystyle C_{r}}, which are roughly the "blueness" and "redness" of the hue. Each coordinate is represented by an integer with some number N {\displaystyle N} {\displaystyle N} of bits, which is interpreted as either unsigned (for Y {\displaystyle Y} {\displaystyle Y}) or signed (for C b {\displaystyle C_{b}} {\displaystyle C_{b}} and C r {\displaystyle C_{r}} {\displaystyle C_{r}}).

The space is defined by Annex F of the International Electrotechnical Commission (IEC) standard 61966-2-1 Amendment 1 (2003), as a linear transformation of the non-linear sRGB color space defined by the same document.

The official conversion from sYCC to sRGB will often result in negative R, G, or B values or values greater than 1 but unlike in normal YCbCr those values are not clamped. The same for when XYZ is converted into sYCC values, at the sRGB stage negative and greater than 1 values are preserved. The sRGB transfer function is thus modified to accept negative RGB values.

sYCC definition

The three unsigned integers Y , C b , C r {\displaystyle Y,C_{b},C_{r}} {\displaystyle Y,C_{b},C_{r}} of an sYCC encoded color represent fractional coordinates Y ′ , C b ′ , C r ′ {\displaystyle Y',C_{b}',C_{r}'} {\displaystyle Y',C_{b}',C_{r}'} according to the formulas[2]

Y ′ = Y / M {\displaystyle Y'=Y/M} {\displaystyle Y'=Y/M}
C b ′ = ( C b − Z ) / M {\displaystyle C_{b}'=(C_{b}-Z)/M} {\displaystyle C_{b}'=(C_{b}-Z)/M}
C r ′ = ( C b − Z ) / M {\displaystyle C'_{r}=(C_{b}-Z)/M} {\displaystyle C'_{r}=(C_{b}-Z)/M}

where the scale factor M = 2 N − 1 {\displaystyle M=2^{N}-1} {\displaystyle M=2^{N}-1} is the maximum unsigned N {\displaystyle N} {\displaystyle N}-bit integer, and the offset Z {\displaystyle Z} {\displaystyle Z} is 2 N − 1 {\displaystyle 2^{N-1}} {\displaystyle 2^{N-1}} (as in the usual two's complement representation of signed integers). Conversely, the encoded integer values are given by

Y = round ( M Y ′ ) {\displaystyle Y={\mbox{round}}(MY')} {\displaystyle Y={\mbox{round}}(MY')}
C b = round ( Z + M C b ′ ) {\displaystyle C_{b}={\mbox{round}}(Z+MC_{b}')} {\displaystyle C_{b}={\mbox{round}}(Z+MC_{b}')}
C r = round ( Z + M C r ′ ) {\displaystyle C_{r}={\mbox{round}}(Z+MC_{r}')} {\displaystyle C_{r}={\mbox{round}}(Z+MC_{r}')}

with the resulting values clipped to the range 0.. M {\displaystyle 0..M} {\displaystyle 0..M}.

In particular, for N = 8 {\displaystyle N=8} {\displaystyle N=8} (which is the normal bit size), one gets M = 255 {\displaystyle M=255} {\displaystyle M=255} and Z = 128 {\displaystyle Z=128} {\displaystyle Z=128}. Thus the fractional luma Y ′ {\displaystyle Y'} {\displaystyle Y'} ranges from 0 to 1, while the fractional chroma coordinates range from − 128 / 255 ≈ − 0.50196... {\displaystyle -128/255\approx -0.50196...} {\displaystyle -128/255\approx -0.50196...} to + 127 / 255 ≈ + 0.498039... {\displaystyle +127/255\approx +0.498039...} {\displaystyle +127/255\approx +0.498039...}.

The standard specifies that these fractional values Y ′ , C b ′ , C r ′ {\displaystyle Y',C_{b}',C_{r}'} {\displaystyle Y',C_{b}',C_{r}'} are related to the non-linear fractional sRGB coordinates R ′ , G ′ , B ′ {\displaystyle R',G',B'} {\displaystyle R',G',B'} by a linear transformation, described by the matrix product

[ Y ′ C b ′ C r ′ ] = [ + 0.2990 + 0.5870 + 0.1140 − 0.1687 − 0.3313 + 0.5000 + 0.5000 − 0.4187 − 0.0813 ] [ R ′ G ′ B ′ ] {\displaystyle {\begin{bmatrix}Y'\\C_{b}'\\C_{r}'\end{bmatrix}}={\begin{bmatrix}+0.2990&+0.5870&+0.1140\\-0.1687&-0.3313&+0.5000\\+0.5000&-0.4187&-0.0813\end{bmatrix}}{\begin{bmatrix}R'\\G'\\B'\end{bmatrix}}} {\displaystyle {\begin{bmatrix}Y'\\C_{b}'\\C_{r}'\end{bmatrix}}={\begin{bmatrix}+0.2990&+0.5870&+0.1140\\-0.1687&-0.3313&+0.5000\\+0.5000&-0.4187&-0.0813\end{bmatrix}}{\begin{bmatrix}R'\\G'\\B'\end{bmatrix}}}

This correspondence is the same as the RGB to YCC mapping specified by the old TV standard ITU-R BT.601-5, note that the coefficients of Y ′ {\displaystyle Y'} {\displaystyle Y'} here are defined still with 3 decimal places, because 4 decimal places would change legacy encoding of images (first row: Kr = 0.299 and Kg = 0.587).[2]

The non-linear fractional sRGB coordinates R ′ , G ′ , B ′ {\displaystyle R',G',B'} {\displaystyle R',G',B'} can be computed from the fractional sYCC coordinates Y ′ , C b ′ , C r ′ {\displaystyle Y',C_{b}',C_{r}'} {\displaystyle Y',C_{b}',C_{r}'} by inverting the above matrix. The standard gives the approximation

[ R ′ G ′ B ′ ] = [ + 1.0000 0.0000 + 1.4020 + 1.0000 − 0.3441 − 0.7141 + 1.0000 + 1.7720 0.0000 ] [ Y ′ C b ′ C r ′ ] {\displaystyle {\begin{bmatrix}R'\\G'\\B'\end{bmatrix}}={\begin{bmatrix}+1.0000&0.0000&+1.4020\\+1.0000&-0.3441&-0.7141\\+1.0000&+1.7720&0.0000\end{bmatrix}}{\begin{bmatrix}Y'\\C_{b}'\\C_{r}'\end{bmatrix}}} {\displaystyle {\begin{bmatrix}R'\\G'\\B'\end{bmatrix}}={\begin{bmatrix}+1.0000&0.0000&+1.4020\\+1.0000&-0.3441&-0.7141\\+1.0000&+1.7720&0.0000\end{bmatrix}}{\begin{bmatrix}Y'\\C_{b}'\\C_{r}'\end{bmatrix}}}

which is expected to be accurate enough for N = 8 {\displaystyle N=8} {\displaystyle N=8} bits per component. For bit sizes greater than 8, the standard recommends using a more accurate inverse. It states that the following matrix with 6 decimal digits is accurate enough for N = 16 {\displaystyle N=16} {\displaystyle N=16}:

[ R ′ G ′ B ′ ] = [ + 1.000000 + 0.000037 + 1.401988 + 1.000000 − 0.344113 − 0.714104 + 1.000000 + 1.771978 + 0.000135 ] [ Y ′ C b ′ C r ′ ] {\displaystyle {\begin{bmatrix}R'\\G'\\B'\end{bmatrix}}={\begin{bmatrix}+1.000000&+0.000037&+1.401988\\+1.000000&-0.344113&-0.714104\\+1.000000&+1.771978&+0.000135\end{bmatrix}}{\begin{bmatrix}Y'\\C_{b}'\\C_{r}'\end{bmatrix}}} {\displaystyle {\begin{bmatrix}R'\\G'\\B'\end{bmatrix}}={\begin{bmatrix}+1.000000&+0.000037&+1.401988\\+1.000000&-0.344113&-0.714104\\+1.000000&+1.771978&+0.000135\end{bmatrix}}{\begin{bmatrix}Y'\\C_{b}'\\C_{r}'\end{bmatrix}}}

The same standard specifies the relation between the non-linear fractional coordinates R ′ , G ′ , B ′ {\displaystyle R',G',B'} {\displaystyle R',G',B'} and the CIE 1931 XYZ coordinates. The connection entails the transfer function ("gamma correction") that maps R ′ , G ′ , B ′ {\displaystyle R',G',B'} {\displaystyle R',G',B'} to the linear R, G, B coordinates, and then a 3D linear transformation that relates these to the CIE X , Y , Z {\displaystyle X,Y,Z} {\displaystyle X,Y,Z}.

Since the linear transformation from sRGB to sYCC is defined in terms of non-linear (gamma-encoded) values ( R ′ , G ′ , B ′ {\displaystyle R',G',B'} {\displaystyle R',G',B'}), rather than the linear ones ( R , G , B {\displaystyle R,G,B} {\displaystyle R,G,B}), the Y ′ {\displaystyle Y'} {\displaystyle Y'} component of sYCC is not the CIE Y coordinate, not even a function of it alone. That is, two colors with the same CIE Y value may have different sYCC Y ′ {\displaystyle Y'} {\displaystyle Y'} values, and vice-versa.

Particular values

The integer encoded sYCC triplet ( 0 , 0 , 0 ) {\displaystyle (0,0,0)} {\displaystyle (0,0,0)} represents the color black whereas ( 255 , 0 , 0 ) {\displaystyle (255,0,0)} {\displaystyle (255,0,0)} is white (more precisely, the CIE illuminant D65). More generally, triplets ( Y , 0 , 0 ) {\displaystyle (Y,0,0)} {\displaystyle (Y,0,0)}, for Y {\displaystyle Y} {\displaystyle Y} in 0..255, represent shades of gray.

Note that the 8-bit integer sYCC triplet ( Y , C b , C r ) = ( 0 , 255 , 255 ) {\displaystyle (Y,Cb,Cr)=(0,255,255)} {\displaystyle (Y,Cb,Cr)=(0,255,255)} has fractional coordinates ( Y ′ , C b ′ , C r ′ ) ≈ ( 0.0 , 0.5 , 0.5 ) {\displaystyle (Y',Cb',Cr')\approx (0.0,0.5,0.5)} {\displaystyle (Y',Cb',Cr')\approx (0.0,0.5,0.5)}, which, according to these matrices, has fractional non-linear sRGB coordinate G ′ ≈ − 0.5 × ( 0.3341 + 0.7141 ) ≈ − 0.528 {\displaystyle G'\approx -0.5\times (0.3341+0.7141)\approx -0.528} {\displaystyle G'\approx -0.5\times (0.3341+0.7141)\approx -0.528}, and therefore has to be converted to XYZ to be realizable or perceivable. Similarly, the sYCC triplet ( 0 , 0 , 0 ) {\displaystyle (0,0,0)} {\displaystyle (0,0,0)} has R ′ ≈ − 0.701 {\displaystyle R'\approx -0.701} {\displaystyle R'\approx -0.701} and B ′ ≈ − 0.886 {\displaystyle B'\approx -0.886} {\displaystyle B'\approx -0.886}.

References

  1. "IEC 61966-2-1:1999". IEC Webstore. International Electrotechnical Commission. Retrieved 3 March 2017.. The first official specification of sRGB.
  2. "IEC 61966-2-1:1999 Multimedia systems and equipment – Colour measurement and management – Part 2-1: Colour management – Default RGB colour space – sRGB: Amendment 1". International Electrotechnical Commission. 2003. Replaces the version IEC 61966-2-1:1999, introducing the sYCC encoding for YCbCr color spaces, an extended-gamut RGB encoding bg-sRGB, and a CIELAB transformation.