[cairo] downscaling capabilities

Owen Taylor otaylor at redhat.com
Sat Apr 19 11:23:21 PDT 2008

On Sat, 2008-04-19 at 13:23 -0400, Frédéric Plourde wrote:
> By the way,
> Does anybody know what was the first intented uses for filtering modes 
> down to pixman, all three are considered equal to the same bilinear 
> sampling technique, so we're not making any smart use of them.
> I would suggest, since we're turning ourselves toward sampling issues, 
> that we make use of these "GOOD" and "BEST" modes in a more clever way.
> For example :
>     CAIRO_FILTER_BILINEAR : our current bilinear filter
>     CAIRO_FILTER_GOOD :       true downscaling to nearest mipmap level + 
> bilinear filtering
>     CAIRO_FILTER_BEST :         trilinear filtering.

My general feeling is it should be, in GL terms:

   trilinear filtering, if we can get decent performance and it looks
   significantly better) If a backend *can* do this, then it must do
   this. If it can't without a software fallback, then it can use the
   nearest approximation available.
 GOOD: Similar in appearance to BILINEAR, but if the backend can get
   uniformly better appearance at a good speed, it can use that.
   For an interactive backend, GOOD is fast enough for real-time

 BEST: A filter that produces significantly better appearance than
   GOOD but might be much slower. BEST does not need to be fast enough
   for real-time use, but shouldn't take hours or centuries.

   The literature on better filters is extensive. 

   We don't need to implement a BEST filter in pixman right now. 
   If we did implement one, it would make sense to add a named
   constant for it - CAIRO_FILTER_LANCZOS or whatever - and do software 
   fallbacks if that constant is specified and not supported by the

What we shouldn't do is define BILINEAR to be something that people
would want to avoid (minify-with-ugliness). 

(One nice thing about NEAREST_MIPMAP_LINEAR is that in the range where
simple bilinear filtering is OK, it is simple bilinear filtering, and
you only get mipmap generation kicking in when you get to the range 
where bilinear filtering for downscaling is really bad.)

- Owen

More information about the cairo mailing list