Doug Kerr
Well-known member
Today's gratuitous leacture is on the sYCC color space.
It is widely assumed that in a JPEG image file, an sRGB representation of the image is compressed (in the "data compression" sense) with the JPEG compression algorithm, suitably formatted, and written to the file.
But in fact the digital representation of the image that is compressed is in the sYCC color space/coordinate system. And in fact, in Canon EOS cameras (at least when they are set to use the sRGB color space in their JPEG output - maybe always), the "working" color space is sYCC.
sYCC is a specific form of the YCbCr color space (and in fact its name by rights should be sYCbCr - sYCC is just handier). It has a direct transformation to and from the sRGB space. (The "s" is a reminder of this.)
In a YCbCr color space, the color of each pixel is represented by three coordinates, Y, Cb, and Cr (in what follows, R, G, and B are scaled to a range of 0-1):
Y - this is a pseudo-luminance, derived as a weighted sum of R, G, and B, where those are the nonlinear representations ("gamma-precompensated"). Y is not luminance nor is it a nonlinear (gamma-precompensated) representation of luminance. Its range is 0-1.
Cb, Cr - These are "color difference" coordinates, defined thus:
Cb=j(B-Y)
Cr=k(R-y)
where j and k are scaling constants. The ranges of Cb and Cr are -0.5 to +0.5.
The weighting and scaling constants are such that any valid RGB triplet will have a valid YCbCr triplet.
In the sYCC color space, Y, Cb, and Cr are represented in 8 bits each. Their permitted range is just what is dictated by their bit size (Cb and Cr are treated as signed, on an "offset" basis, not using the "signed integer" convention widely used in computer work).
But not every valid sYCC triplet will convert to to a valid RGB triplet. Thus the gamut delineated by the limits of the ranges of these coordinates is larger than the gamut of sRGB. That means that sYCC can represent colors that cannot be represented in sRGB, and in fact there are sYCC triplets that imply "impossible colors" (with no physical existence).
I do not know whether, when a Canon EOS camera, with the sRGB color space in effect for JPEG output, encounters an sYCC triplet in a developed image that falls outside the sRGB gamut:
• it maps it to some possible sRGB color (and if so, using what "rendering intent"?), or
• it lets it fly as is, and leaves it up to the destination JPEG decoder to map it to some possible sRGB color (and if so, using what "rendering intent"?).
[Perhaps some expert here will know about this.]
Of course this opens the tantalizing possibility of actually exploiting the wide gamut of the sYCC color space as it exists in a JPEG file, and I understand there are several color space definitions that have been introduced to this end. I am not up-to-date on the details of any of these.
Well, my soup is up to eating temperature, so I guess I'm done here.
You can read more about this in my article, "The SYCC Color Space", available here:
http://doug.kerr.home.att.net/pumpkin/#sYCC
It is widely assumed that in a JPEG image file, an sRGB representation of the image is compressed (in the "data compression" sense) with the JPEG compression algorithm, suitably formatted, and written to the file.
But in fact the digital representation of the image that is compressed is in the sYCC color space/coordinate system. And in fact, in Canon EOS cameras (at least when they are set to use the sRGB color space in their JPEG output - maybe always), the "working" color space is sYCC.
sYCC is a specific form of the YCbCr color space (and in fact its name by rights should be sYCbCr - sYCC is just handier). It has a direct transformation to and from the sRGB space. (The "s" is a reminder of this.)
In a YCbCr color space, the color of each pixel is represented by three coordinates, Y, Cb, and Cr (in what follows, R, G, and B are scaled to a range of 0-1):
Y - this is a pseudo-luminance, derived as a weighted sum of R, G, and B, where those are the nonlinear representations ("gamma-precompensated"). Y is not luminance nor is it a nonlinear (gamma-precompensated) representation of luminance. Its range is 0-1.
Cb, Cr - These are "color difference" coordinates, defined thus:
Cb=j(B-Y)
Cr=k(R-y)
where j and k are scaling constants. The ranges of Cb and Cr are -0.5 to +0.5.
The weighting and scaling constants are such that any valid RGB triplet will have a valid YCbCr triplet.
In the sYCC color space, Y, Cb, and Cr are represented in 8 bits each. Their permitted range is just what is dictated by their bit size (Cb and Cr are treated as signed, on an "offset" basis, not using the "signed integer" convention widely used in computer work).
But not every valid sYCC triplet will convert to to a valid RGB triplet. Thus the gamut delineated by the limits of the ranges of these coordinates is larger than the gamut of sRGB. That means that sYCC can represent colors that cannot be represented in sRGB, and in fact there are sYCC triplets that imply "impossible colors" (with no physical existence).
I do not know whether, when a Canon EOS camera, with the sRGB color space in effect for JPEG output, encounters an sYCC triplet in a developed image that falls outside the sRGB gamut:
• it maps it to some possible sRGB color (and if so, using what "rendering intent"?), or
• it lets it fly as is, and leaves it up to the destination JPEG decoder to map it to some possible sRGB color (and if so, using what "rendering intent"?).
[Perhaps some expert here will know about this.]
Of course this opens the tantalizing possibility of actually exploiting the wide gamut of the sYCC color space as it exists in a JPEG file, and I understand there are several color space definitions that have been introduced to this end. I am not up-to-date on the details of any of these.
Well, my soup is up to eating temperature, so I guess I'm done here.
You can read more about this in my article, "The SYCC Color Space", available here:
http://doug.kerr.home.att.net/pumpkin/#sYCC