[Pixman] [cairo] Supersampling - 2nd attempt

Bill Spitzak spitzak at gmail.com
Mon Aug 16 14:17:25 PDT 2010


Soeren Sandmann wrote:

>         - interpolate to define the image on a continuous domain
> 
>         - transform
> 
>         - resample

The problem I am having is that this does not match how filtering of 
transforms is done in any image processing software I am familiar with.

This is how all software I am familiar with works, this replaces the 
three steps you show above:

	- Figure out the INVERSE transform

	- For each output pixel, the x, y, and inverse transform figures out a 
weighing factor for every pixel in the input image. These are weights 
for input PIXELS, not weights for input "points".

	- Multiply input pixels by these weights and sum to get output pixel.

For a more concrete example, our image transforms consist of translating 
the output x/y into an input axis-aligned rectangle that is as close as 
possible to the area of the output pixel inverse-transformed to the 
input. This rectangle dimensions are then used to scale 2 1-D filters to 
the right size (they are truncated sync or similar functions and the 
non-zero area is about twice the size of the rectangle). These two 
filters are used in a 2-pass algorithm to weigh and sum all the pixels 
in the rectangle and around it to produce the output pixel.

I suspect you think you are describing mip-mapping, but a "sample" in a 
mipmap is not just an X/Y position, but also a "which scaled image" 
number. Mipmap is instead a compression scheme for weighted pixel 
samples, where the same weight for a square of 4 sample pixels can 
instead be specified as 4x weight of a single pixel in the 1/2 sized 
image. (In addition I do not think mipmapping is correct for Cairo: the 
filtering is very poor for non-square transforms, and the overhead is 
high if the samples all come from only one or two of the scaled images.)

You cannot describe the input image as a "continuous domain" and get any 
kind of sampling that is any better than putting the same number of 
samples right in the middle of the pixels. In addition a number of the 
filtering operations demanded by users (sharp edges on transformed 
images, and sharp square pixels when zoomed in) are impossible unless 
the "continuous domain" is defined as constant squares of color and thus 
equivalent to rounding any "point" to the nearest pixel center.



More information about the Pixman mailing list