W3C home > Mailing lists > Public > www-svg@w3.org > September 2011

Re: luminanceToAlpha values in FEColorMatrix

From: Chris Lilley <chris@w3.org>
Date: Mon, 5 Sep 2011 22:41:09 +0200
Message-ID: <998481620.20110905224109@w3.org>
To: Dean Jackson <dino@apple.com>
CC: public-fx@w3.org, www-svg <www-svg@w3.org>
On Friday, September 2, 2011, 3:10:53 AM, Dean wrote:

DJ> Get your acronym hats on.

DJ> A colleague has questioned the values used for luminanceToAlpha
DJ> in FEColorMatrix. The specification (since SVG 1.0) has used:

DJ>   0.2125 red, 0.7154 green, 0.0721 blue

DJ> But where do these numbers come from? 

They are derived from the chromaticity values of the primaries, and correspond to the coefficients for Y in the (linear)RGB to CIE XYZ conversion matrix.

And, as your colleague correctly points out, the ones listed in the SVG spec are slightly wrong. :(

As to where these specific wrong values came from, my suspicion is that they were copied from the first draft of the sRGB position paper, submitted by HP and Microsoft to the W3C workshop on printing [1], in April 1996. However, the original papers don't seem to be in CVS any more, and the link to the paper redirects to a later, November 1996, version 1.10 of that proposal [2]. I recall that some errors were fixed, although I thought those related to transfer curve discontinuities.

At any rate, the values in the 1.10 version are the same as the ones your colleague cites below, and the same as the final sRGB standard, and the same as Rec.709, and PAL, and SECAM.

DJ> It turns out there are a
DJ> few different specifications for this. The closest to what is
DJ> specified is in Rec. ITU-R BT.709-5 [1], but it is slightly different:

DJ>   0.2126 red, 0.7152 green, 0.0722 blue

Those are the correct values (to 4 figures). For higher precision, the values are 0.212656 0.715158 0.072186 	[3]

The values should certainly be errate'ed. This probably won't make a difference in 8 bit per component workflows (so its a safe change) but will make a (small) difference in 16 bit per component workflows.

DJ> Yes, a minor difference, but it would be nice to reference an
DJ> external specification. 

DJ> sRGB is based on Rec 709, so I guess this
DJ> might be the definitive source. According to [2], sRGB uses the latter values.

Those coefficients are listed in the IEC sRGB standard[4], which we do already cite[5]. Since sRGB already cites Rec.709 I don't see the value in adding that citation to the SVG spec as well. Besides, 709 copied the values from PAL. 

DJ> Even then, I'm told that it is more common to use other luminance
DJ> to alpha values.

For other colour spaces, yes.

DJ>  For example, ITU-R BT.601 (YIQ? NTSC? JPEG?) [3] uses:

DJ>   0.299 red, 0.587 green, 0.114 blue

Yes, those are the values for the NTSC colour space. 

They were also often to be found in the 1980s and early 1990s, cited as "the" values for converting RGB to Y. This was before the concepts of calibrated colour spaces and so on had percolated into the general computer graphics mainstream.

See footnote 1 in [3].

DJ> And Flash + OpenGL use:

DJ>   0.3086 red, 0.6094 green, 0.0820 blue

Those don't correspond to any RGB space that I am aware of, and the value for red is higher (and green lower) than for any RGB colour space I have seen. 

DJ> Since sRGB is used throughout the SVG specification, and sRGB
DJ> takes its values from Rec 709, and Rec 709 seems modern (it's
DJ> designed for HDTV), and the values are really close to what is
DJ> already specified, I suggest we formally link to Rec 709 and use
DJ> its values (a very slight change to current implementations).

I suggest instead that we (continue to) formally link to the sRGB standard, but yes, use the correct values in the SVG spec.

DJ> Note that these values are also used in other parts of
DJ> FEColorMatrix, as well as other parts of the SVG specification
DJ> (although it seems the spec doesn't always reference explicitly). 

Filters use linear sRGB, but the default in other areas is (gamma corrected) sRGB so if those areas sue this equation they shouldbe clarified to say that the sRGB values need to be converted to linear space before the equation is applied.

DJ> For example:

DJ> - FEColorMatrix type="saturate" and type="huerotate"
DJ> - 'mask' property

DJ> Dean

DJ> [1]
DJ> http://www.itu.int/dms_pubrec/itu-r/rec/bt/R-REC-BT.709-5-200204-I!!PDF-E.pdf
DJ> [2] http://en.wikipedia.org/wiki/SRGB
DJ> [3] http://en.wikipedia.org/wiki/YCbCr#ITU-R_BT.601_conversion

[1] W3C Workshop on High Quality
Printing from the Web, 
April 25th '96
http://www.w3.org/Printing/Workshop_960425.html

[2] Michael Stokes (Hewlett-Packard), Matthew Anderson (Microsoft),
Srinivasan Chandrasekar (Microsoft), Ricardo Motta (Hewlett-Packard)
Version 1.10, November 5, 1996 
"A Standard Default Color Space for the Internet - sRGB"
http://www.w3.org/Graphics/Color/sRGB.html

[3] Lindbloom, Bruce. "RGB Working Space Information".
http://brucelindbloom.com/index.html?WorkingSpaceInfo.html

[4] IEC 61966-2-1/Amd 1:2003 : Multimedia systems and equipment — Colour measurement and management — Part 2-1: Colour management — Default RGB colour space — sRGB, International Electrotechnical Commission, 2003. 

[5] http://www.w3.org/TR/SVG/refs.html#ref-SRGB


-- 
 Chris Lilley   Technical Director, Interaction Domain                 
 W3C Graphics Activity Lead, Fonts Activity Lead
 Co-Chair, W3C Hypertext CG
 Member, CSS, WebFonts, SVG Working Groups
Received on Monday, 5 September 2011 20:41:38 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:49 GMT