[Pixman] [Patch 0/4] Pixel checker object

Søren Sandmann sandmann at cs.au.dk
Tue Jan 10 14:29:19 PST 2012


The following patches add a new "pixel_checker_t" object to the
test/utils.[ch] and port the composite test over to use it.

The pixel_checker_t object is initialized with a format and can then
be used to check that pixels in this format are within an acceptable
deviation relative to a "perfect" pixel given in double precision
floating point.

The existing code in the composite tests is flawed because it computes
the acceptable deviation in "format" coordinates. That is, given a
pixel in some format, it will add/subtract 3, and then compare the
resulting values to the double precision pixel. This means way too
much deviation is considered acceptable for formats like r5g6b5. For
formats like a2r2g2b2 *any* value whatsoever is considered acceptable,
which is clearly absurd.

The pixelchecker object fixes this, by adding/subtracting the
deviation to the double precision pixel, and then converting those two
to the target format to get an acceptable range. 

The current deviation is set to 0.004, which is the lowest value that
allows the current code to pass. This value is unfortunate because for
the a8r8g8b8 format it allows 0xfe to be considered good enough when
the correct pixel is 1.0, and 0x01 to be good enough for 0.0, which
seems unfortunate.

A deviation of 0.003 would fix this problem, but the current 8 bit
code can't satisfy that requirement for operators that involve
division, because even a slight error in the denominator of a fraction
can have a huge impact on the overall result especially when the
denominator is small. The solution here is probably to eventually move
to floating point for those operators.


More information about the Pixman mailing list