[Pixman] [cairo] Supersampling - 2nd attempt

Soeren Sandmann sandmann at daimi.au.dk
Tue Aug 17 01:01:42 PDT 2010


Bill Spitzak <spitzak at gmail.com> writes:

>  > I'm not sure what's
>  > the difference in quality between those approaches. I could try
>  > prototyping both of them.
> 
> I suspect there is going to be a phasing problem with your approach if
> the scale is slightly different that 1/integer. At some places the
> kernel samples line up with the pixel centers and at others it is
> between them and thus blurring or lowering the contrast. This will
> probably look like moire patterns.

This is why we need both interpolation and low-pass filtering. When
the kernel samples don't line up with the pixel centers, then we apply
the interpolation filter. For example the bilinear filter. For
example:


        X               X               X



             o  o  o  o  o  o  o  o  o  o  o

             o  o  o  o  o  o  o  o  o  o  o

        X    o  o  o  o Xo  o  o  o  o  X  o

             o  o  o  o  o  o  o  o  o  o  o


Here, the o's represent transformed destination subpixels and the X's
represent source pixels. If the image has a

        pixman_image_set_filter()

of PIXMAN_FILTER_BILINEAR, then for each of the o's a bilinear
interpolation will take place, and then all those interpolation
results will be averaged together (or combined in a higher-quality way
if we add other resampling filters than box).

Another, faster, but lower-quality, type of interpolation is NEAREST,
in which case each o will just take the value of the closest
X. Depending on the sample rate, this could indeed produce more
aliasing artifacts.


Soren


More information about the Pixman mailing list