[cairo] pixman box filtering code prototype

Jeff Muizelaar jeff at infidigm.net
Wed Oct 15 11:34:17 PDT 2008


On Wed, Oct 15, 2008 at 01:17:38PM -0400, Aron Rubin wrote:
> Frédéric Plourde wrote:
> >> 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.
> >>   
> > Am I wrong or the current upscaling quality with bilinear isn't that bad 
> > ?  It was really the downscaling case that was hurting bad so far... and 
> > one approach could be to use Jeff's box filtering for dowscaling cases 
> > (I mean as soon as scaleX OR scaleY is below 1.0) and, SWITCH to former 
> > bilinear algorithm for upscaling cases... It's seems acceptable in my 
> > mind, but maybe it's not in phase with cairo's philosophy ?
> > 
> > So briefly, our GOOD scenario would be :
> > 
> >    box filtering for downscaling
> >    bilinear for pure upscaling (both dimensions)
> 
> To be clear or at least consistent with OpenGL lingo and mipmapping, I
> would say box filtering for minification and bilinear for magnification.

Yep.

> I do have some concern with the distortion displayed at similar
> resolution by the box filtering example. 

What kind of distortion do you mean?

> Also how does this interact with rotation and compositing in terms of
> number of copies accesses and cache misses?

Depends on the implementation. 

Doing a rotation of a downscaled image in the scheme I outlined below
would involve a making a downscaled copy of the image that would only
exist for the lifetime of operation. The downscaled image would then be
sampled by projecting, in order, each destination pixel to the
downscaled copy, which isn't particularly cache friendly but hard to
avoid as far as I know.

-Jeff


More information about the cairo mailing list