Simon Thum <[email protected]> writes:

> The issues I mean are:
> > Higher Quality Image Filtering
> > Add better filtering, especially for downscaling transformations.
> 
> > Color Management/Gamma Correction
> > Find out what color management support is needed in cairo, XRender, and 
> > pixman. 
> 
> I'd just like t point out there is a close relation often overlooked.
> 
> Basically, if you scale down using 'super sampling' (I didn't find it in
> pixman, but it's a likely choice. Also called a box filter.) quality
> suffers more the more you scale down.

Super sampling would be a likely choice, yes, but sadly pixman doesn't
even do that. The best thing it has to offer is a bilinear filter. For
downscaling with a scale factor larger than 2, that is so ugly that
it's not even funny. [1]

> However, when you implement super sampling with respect to gamma, the
> quality loss drops to nearly zero. I'd say typically you need no more
> strange "higher quality" filters when that's done.

Even a simple non-gamma-correct supersampling filter would be good
enough for many purposes. As I recall, GdkPixbuf, which has provided
acceptable quality in GNOME for many years, does essentially this.

I do think a high-quality filter such as Lanczos would be a useful
thing to have, but getting to even passable quality is more important.

> I extensively researched that during my diploma, and if you can point me
> to the right spots in pixman, I may be able to draw up a patch.

The right spot in pixman is in ACCESS(fbFetchTransformed)() in
pixman-transformed.c, where a new supersampling fetcher would be put
in.

I agree that gamma correct filtering would look even better, but
whether that's interesting on its own instead of as a side effect of a
general SRGB surface, I don't know. It seems a little iffy to me to
have a PIXMAN_BOX_FILTER_GAMMA_CORRECT, instead of a general SRGB
surface that could be filtered with a normal PIXMAN_FILTER_BOX.

> As for gamma correction in general, It's an extensive work and change.
> Basically, you need to check every single pixel-level computation
> whether it is gamma-invariant, if not, make it so. I devised a small
> calculus allowing to judge that matter. Maybe I can find it again, if
> there's interest.
> 
> That said, it would certainly be worth to do it. However I'm far from
> having the time to do so.

I did an experiment a while back - the result is in the gamma branch of
        
        git://freedesktop.org/~sandmann/pixman/

If you install it, all cairo rendering, including filtering, will be
gamma correct, and if you run a Render based compositing manager, you
will get gamma correct alpha blended windows.

I don't intend it as anything other than a demonstration, since gamma
correction should probably be considered along with color management
in general. And I did it in the dumbest way possible, so it's way too
slow to be practical.


Thanks,
Soren


[1] This is not the fully story, because pixman and Render also allow
general filter kernels to be uploaded. This is not exactly fast,
though.
_______________________________________________
xorg mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/xorg

Reply via email to