[cairo] pixman: New ARM NEON optimizations
Soeren Sandmann
sandmann at cs.au.dk
Tue Feb 22 04:31:07 PST 2011
Siarhei Siamashka <siarhei.siamashka at gmail.com> writes:
> 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().
Yeah, this is useful, and it wouldn't directly be possible to do if
the equation were changed to (s OP d) LERP_m d. However, a pretty
simple way to fix it would be to just add an unpremultiplied
format. Benjamin's video patches had this I believe.
Using such a format as a destination can be slow because it requires
divisions, but Joonas has a number of optimized implementations here:
http://cgit.freedesktop.org/~joonas/unpremultiply/tree/
> So I find it convenient that we are also allowed to work with
> masks which are basically interpreted as having a8x24 format.
Right, having an a8x24 format would be another way to solve the
problem.
Soren
More information about the cairo
mailing list