[PATCH] xrandr: display gamma and brightness

Éric Piel E.A.B.Piel at tudelft.nl
Wed Jan 13 02:14:35 PST 2010


Op 13-01-10 02:33, Yang Zhao schreef:
> Hi,
> 
> 2010/1/12 Éric Piel <E.A.B.Piel at tudelft.nl>:
>> Here is complete version. I've refined the math behind, and tried my
>> best to have the code understandable.[...]
> 
> Have you tried running this with calibration applied, where each
> channel has slightly different curves?  Specifically, the cases where
> a specific channel hits the ceiling much earlier than the others.  I
> haven't examined the code in detail, but my intuition says this is
> going to significantly skew the results.
Hi,
Indeed, for curves which are not respecting the power function, it'll be
slightly off. But there is nothing to be done as long as our objective
is to express everything with only 4 values.

However, when there is clamping...
> 
> 
>> +	    for (i = size - 1; i > 0; i--) {
>> +	        if ((gamma->red[i] + gamma->green[i] + gamma->blue[i]) < (255 * 256 * 3))
>> +		    break;
>> +	    }
> 
> Why (255 * 256 * 3)?  Seems like your intention is to pick the point
> where right-most point where no values are clamped, but this is going
> to give you the right-most point where any curve has not been clamped,
> with a margin of error.
> 
> It's been a while since I've looked at the gamma stuff, so feel free
> to set me right if I'm off-base.
Just looked at it, and indeed, it's not handled very well. Probably it's
possible to get better approximations by determining the brightness from
the curve which is closer to 1 at the end. This means the end of the
clamping region has to be found separately for each curve. I'll try to
improve this...

Eric


More information about the xorg-devel mailing list