This is a broken-out test case which is a lot easier to debug than
having to start plymouth-x11 and diffing log files.
It extracts the pixel blending function and prints out some additional
intermediate steps and the result. They differ depending on whether or
not optimizing:
$ gcc -o /tmp/out test-685352.c && /tmp/out
input: rgba1(40 40 40 0) rgb2(40 40 40)
calculation to int: rgb(7f80 7f80 7f80)
reduction to byte: rgb(80 80 80)
blend(alpha=00) = FF808080
input: rgba1(40 40 40 80) rgb2(40 40 40)
calculation to int: rgb(5f80 5f80 5f80)
reduction to byte: rgb(60 60 60)
blend(alpha=80) =: FF606060
input: rgba1(40 40 40 ff) rgb2(40 40 40)
calculation to int: rgb(3fc0 3fc0 3fc0)
reduction to byte: rgb(40 40 40)
blend(alpha=FF) = FF404040
This is the correct one. With an alpha of 255, the second pixel value
sholdn't be taken into account at all, and the result of the last call
should be identical to the first pixel. With an alpha of 0, the result
should be a pure addition (first case). With an alpha of 128 (50%), it
should be half of the value of the first pixel, plus the second.
But with -O2 it's all messed up:
$ gcc -o /tmp/out -O2 test-685352.c && /tmp/out
input: rgba1(40 40 40 0) rgb2(40 40 40)
calculation to int: rgb(3f80 3f80 3f80)
reduction to byte: rgb(40 40 40)
blend(alpha=00) = FF404040
input: rgba1(40 40 40 80) rgb2(40 40 40)
calculation to int: rgb(1f80 1f80 1f80)
reduction to byte: rgb(20 20 20)
blend(alpha=80) =: FF202020
input: rgba1(40 40 40 ff) rgb2(40 40 40)
calculation to int: rgb(ffc0 ffc0 ffc0)
reduction to byte: rgb(1 1 1)
blend(alpha=FF) = FF010101
So we can state that there is definitively a difference of the
arithmethics here when building with -O2 vs. -O1. It might be because
the code is doing some undefined or underdefined operations?
The reduction of bytes looks ok, so it looks like the problem is in
here:
red = red_1 * 255 + red_2 * (255 - alpha_1);
green = green_1 * 255 + green_2 * (255 - alpha_1);
blue = blue_1 * 255 + blue_2 * (255 - alpha_1);
results are uint_least16_t, inputs are all uint8_t.
** Attachment added: "first separate test case"
https://bugs.launchpad.net/ubuntu/+source/plymouth/+bug/685352/+attachment/1793910/+files/test-685352.c
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/685352
Title:
libplymouth2_0.8.2-2ubuntu6 and later give ragged splash and text
rendering
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs