diff options
author | Søren Sandmann Pedersen <ssp@redhat.com> | 2013-09-30 19:22:20 -0400 |
---|---|---|
committer | Søren Sandmann <ssp@redhat.com> | 2014-01-04 16:13:27 -0500 |
commit | 94244b0c401f797835567a8bd165beef8f0dd820 (patch) | |
tree | 7a2fc496dd64c65af60675ceabcf50524c88e228 /pixman | |
parent | 15aa37adeca79a22b393ff451e6d29f484c3b0ef (diff) | |
download | pixman-94244b0c401f797835567a8bd165beef8f0dd820.tar.gz |
utils.c: Set DEVIATION to 0.0128
Consider a HARD_LIGHT operation with the following pixels:
- source: 15 (6 bits)
- source alpha: 255 (8 bits)
- mask alpha: 223 (8 bits)
- dest 255 (8 bits)
- dest alpha: 0 (8 bits)
Since 2 times the source is less than source alpha, the first branch
of the hard light blend mode is taken:
(1 - sa) * d + (1 - da) * s + 2 * s * d
Since da is 0 and d is 1, this degenerates to:
(1 - sa) + 3 * s
Taking (src IN mask) into account along with the fact that sa is 1,
this becomes:
(1 - ma) + 3 * s * ma
= (1 - 223/255.0) + 3 * (15/63.0) * (223/255.0)
= 0.7501400560224089
When computed with the source converted by bit replication to eight
bits, and additionally with the (src IN mask) part rounded to eight
bits, we get:
ma = 223/255.0
s * ma = (60 / 255.0) * (223/255.0) which rounds to 52 / 255
and the result is
(1 - ma) + 3 * s * ma
= (1 - 223/255.0) + 3 * 52/255.0
= 0.7372549019607844
so now we have an error of 0.012885.
Without making changes to the way pixman does integer
rounding/arithmetic, this error must then be considered
acceptable. Due to conservative computations in the test suite we can
however get away with 0.0128 as the acceptable deviation.
This fixes the remaining failures in pixel-test.
Diffstat (limited to 'pixman')
0 files changed, 0 insertions, 0 deletions