[cairo] [Pixman] Image downscaling
Jonathan Morton
jonathan.morton at movial.com
Fri Jul 22 05:44:21 PDT 2011
On Fri, 2011-07-22 at 04:51 +0200, Krzysztof Kosiński wrote:
> I would like to know what algorithm I should use.
There are several good-quality algorithms which are commonly used in
different applications.
1) Trilinear or tricubic filtering on a mipmapped image. The mipmaps
are generated by box-filtering 2x2 pixels at a time, which is trivial to
compute. This is fast and general enough to be used universally for
realtime 3D graphics, but requires extra memory to store the mipmaps,
which also need to be updated with the base image.
2) Straight box filtering based on pixel coverage. This can be faster
and cheaper than method 1, but usually only if the images are
axis-aligned.
3) Sinc filtering. This is a common technique for high-quality audio
sample rate conversion, which is quite easy to apply to 2D images,
especially as it is not necessary to limit the filter support to achieve
reasonable performance. Just resize each row, then each column of the
result. Again, this only really works for axis-aligned resizing.
--
------
From: Jonathan Morton
jonathan.morton at movial.com
More information about the cairo
mailing list