[cairo] pixman box filtering code prototype

Jeff Muizelaar jeff at infidigm.net
Wed Oct 15 07:12:42 PDT 2008


On Wed, Oct 15, 2008 at 09:35:34AM -0400, 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)

Yes, this is what we want. However we should be doing bilinear even if
the the upscaling is only in one direction. 

I don't know how easy it will be to switch between box filtering and
bilinear filtering with my code. However, it should be easier with
mipmap style or something like I outlined below.

> 
> what do you think ?
> -fred-
> 
> >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