[Pixman] [cairo] RFC: More accurate color conversion

James Cloos cloos at jhcloos.com
Thu Oct 10 15:30:54 PDT 2013


>>>>> "SS" == Søren Sandmann <sandmann at cs.au.dk> writes:

SS> There are two functions being talked about here:

Of course.

SS>       f: uint16_t -> double
SS> and
SS>       g: double -> uint16_t

SS> When you say "multiply (with saturation) by IMAX+1 and divide by IMAX"
SS> I assume you mean

SS>        f(i) = i / 65535.0
SS> and 
SS>        g(x) = MAX (x * 65536, 65535.0)

The latter of course should be MAX(0.,MAX(x*65536.,65535.)).

Saturation works both ways. ;^)

SS> which is indeed what cairo does now.

As I write.

SS> I think everyone agrees that
SS>       f(i) = i / 65535.0
SS> is the right choice for f,

At the time there were some who did not.  I'm glad that is in the past.

SS> but for g, I am proposing a different formula.

I noticed.

SS> that as argued elsewhere has less error.

I didn't add an argument for the status quo because my post in this
thread was more of a devil's advocate and I wanted to think about it
some more.

Equal-size-intervals is of course why I concluded as I did back then.

Your argument is interesting.  

-JimC
-- 
James Cloos <cloos at jhcloos.com>         OpenPGP: 1024D/ED7DAEA6


More information about the Pixman mailing list