[cairo] pixman box filtering code prototype

Jeff Muizelaar jeff at infidigm.net
Tue Oct 14 12:00:21 PDT 2008


On Mon, Oct 13, 2008 at 11:14:05AM -0700, Carl Worth wrote:
> On Tue, 2008-10-07 at 18:12 -0400, Jeff Muizelaar wrote:
> > It works by projecting each pixel of the destination surface to a
> > parallelogram on the source surface.  All of the pixels in the
> > parallelogram are summed to produce the value of the destination pixel.
> ...
> > I've also attached a test program that generates the output something
> > like: http://people.freedesktop.org/~jrmuizel/box-filter.png vs.  the
> > existing bilinear code at:
> > http://people.freedesktop.org/~jrmuizel/bilinear.png
> 
> Jeff,
> 
> This looks very promising. Thanks for coding it up!
> 
> What are your thoughts about performance? Have you done any
> measurements?

I did some measurements but I don't remember the exact numbers. It was
of similar magnitude to the current bilinear filtering.
> 
> Also, what about quality and performance for the upscaling case? Do you
> think we'll want to use the new box-filter code as the default for all
> cases?

No. The upscaing quality is worse than bilinear. It is closer too
nearest neighbour. An algorithm like this is closer to what you'd want
for Postscript or PDF rendering though.

For the default case, I think a better approach is to do a rectangular
box filter down to the scaled size and then do bilinear sampling from
this downscaled version as necessary. I think this should be more
performant than my box filtering code and should give the desired
quality for any affine matrix...

-Jeff


More information about the cairo mailing list