[Pixman] [PATCH 0/3] Some rounding related patches

Søren Sandmann sandmann at cs.au.dk
Wed Nov 21 22:57:44 PST 2012

The following patches fixed-point arithmetic to round instead of
truncate. That is, instead of this:

	(a * b) >> 16

the patches now do this instead:

    	(a * b + 0x8000) >> 16

which I believe produces more accurate results. The second patch does
the same thing for the color calculations in the convolution filter,
where currently if the user isn't careful to normalize the convolution
matrix, we can end up with opaque images becoming slightly translucent
or the like.

Finally, the third patch adds a file "rounding.txt" that describes in
detail how the filtering code gets from a source image location to a
pixel value.

The fixed-point rounding does cause some changes to transformed
output, so the test suite has gotten new checksums. I'd appreciate
testing on architectures other than x86 to ensure the various
transformed fast paths didn't break.

Siarhei pointed out here:


that the current bilinear filters also have an issue where the weights
are computed based on truncated rather than rounded locations. In
addition to that they also have the same issue as the convolution
filter in that the *color* computation should in principle also be
rounded rather than truncated from 16 to 8 bits as it is now.

It would be worthwhile to fix these bugs, but the patches here don't
attempt to.


More information about the Pixman mailing list