[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cairo
Subject:    Re: [cairo] pixman: New ARM NEON optimizations
From:       Soeren Sandmann <sandmann () cs ! au ! dk>
Date:       2011-02-22 12:31:07
Message-ID: ye8y658p7xw.fsf () camel25 ! daimi ! au ! dk
[Download RAW message or body]

Siarhei Siamashka <siarhei.siamashka@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
--
cairo mailing list
cairo@cairographics.org
http://lists.cairographics.org/mailman/listinfo/cairo
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic