[Pixman] [cairo] pixman: New ARM NEON optimizations

Siarhei Siamashka siarhei.siamashka at gmail.com
Thu Feb 17 04:40:00 PST 2011


On Friday 11 February 2011 12:30:33 Soeren Sandmann wrote:
> If I had a time machine, I would go back and make - among others -
> these two changes to Render:

[...]

> (2) The RGB channels of Alpha-only images would be considered to be
>     the same as the alpha channel, and not 0 as they are now. For
>     example, a 0xb9 pixel in an a8 image would be considered
>     equivalent to 0xb9b9b9b9 and not to 0xb9000000. That is, they
>     would be considered a translucent white rather than a translucent
>     black.
> 
> These two changes together would have the effect that (a) the equation
> would be much easier to understand visually (composite src and dst,
> then clip to the mask and write back), and (b) component alpha would
> become completely regular with no need for the "component_alpha" bit
> in pictures.

Regarding the (b) part, probably as a side effect of current implementation,
right now it is possible to do some operations with images having
non-premultiplied alpha:

    src_img = pixman_image_create_bits (
        PIXMAN_x8b8g8r8, width, height, src, stride);
    msk_img = pixman_image_create_bits (
        PIXMAN_a8b8g8r8, width, height, src, stride);
    dst_img = pixman_image_create_bits (
        PIXMAN_a8r8g8b8, width, height, dst, stride);

    pixman_image_composite (PIXMAN_OP_SRC, src_img, msk_img, dst_img,
                            0, 0, 0, 0, 0, 0, width, height);

We only need to wrap the same a8r8g8b8 buffer into x8r8g8b8
and a8r8g8b8 pixman image, and use the latter as a mask for
pixman_image_composite() calls. Any operations which don't
need mask themselves can use this trick. By also specifying
negative stride, this is useful for example when dealing with
the data returned by glReadPixels().

So I find it convenient that we are also allowed to work with
masks which are basically interpreted as having a8x24 format. 

-- 
Best regards,
Siarhei Siamashka


More information about the Pixman mailing list