[cairo] MIPMAPPING cairo.

Bill Spitzak spitzak at thefoundry.co.uk
Wed Oct 15 13:13:50 PDT 2008


Frédéric Plourde wrote:
> 
>> Are you sure this bilinear sample is correct? It looks far worse than 
>> anything I have seen. Looks more like the image was scaled to 50% and 
>> the binlinearly scaled up. The current algorithim only fails if the 
>> scale is less than 60% or so.
> Mhh.. yep, pretty sure. What's happening maybe is that the source image 
> "http://img58.imageshack.us/img58/8669/src1231x1504np1.png" gets 
> automatically resized in FF3 (and other browsers ?), but is really 
> bigger than it seems. So, we're really talking about downscaling with a 
> large factor.... which kills text image as you've seen.

The image is named 1231x1504to840x1026 which implies to me the 
horizontal scale is 840/1231 = .68237... and the vertical scale is 
1026/1504 = .68218...

It certainly looks to me like this image is a much smaller one that has 
then been blown up larger:

http://img388.imageshack.us/img388/6500/dest1231x1504to840x1026cw3.png

> We already have those specific filters in Cairo, that you're talking 
> about... those are FAST, GOOD and BEST. right now, we're defaulting to 
> GOOD (which leads to plain bilinear downscaling), but if you're playing 
> with the little cairo_downscale.c program attached to last email, you'll 
> see that I'm targetting filter BEST for that.

Thanks. Carl corrected me as well. I was confused because your code had 
an enumeration list at the start which did not include FAST/GOOD/BEST. I 
did not realize it was just for the test program.

> Anyway,  mipmapping is good, as we all know, for animation-like series 
> of redrawings. That's where it wins... if not, the pyramid-building step 
> overhead is so large that we certainly DON'T want to use mipmapping for 
> one-shot scalings !  That's why a simple yet very nice box filtering 
> algorithm (written by jeff muizelaar) is on its way to be reviewed here 
> within the next few days.

The other one I would like to try is integer-sized box filtering 
followed by the bilinear filter. The idea is to reuse the XRender code, 
but get better down-scaling. And there would be a slight amount of 
caching for similar scales.

-- 
Bill Spitzak, Senior Software Engineer
The Foundry, 618 Hampton Drive, Venice, CA, 90291, USA
Tel: +1 310 399-4555 * Fax: +1 310 450-4516 * Web: www.thefoundry.co.uk
The Foundry Visionmongers Ltd * Registered in England and Wales No: 4642027


More information about the cairo mailing list