Closed GoogleCodeExporter closed 9 years ago
And further more, I found something like this:
DXPMSAMPLE — A structure with red, green, blue, and alpha components, each
having 8 bits. The color channels are premultiplied by the alpha component for
this type.
http://msdn.microsoft.com/en-us/library/aa753543%28v=vs.85%29.aspx
Does it help for using pre-multiplied alpha on GPU?
Original comment by YuZhuoHu...@gmail.com
on 29 Nov 2011 at 1:27
I fixed my code, its only one division (per pixel), and not one per iteration,
however for precision it should be calculated in floating point or at least
16-bit integer, and not in 8-bit integer, of course.
RGBbig = Abig = 0
foreach(subpic)
RGBbig = (RGBbig * (1-Asub) + RGBsub * Asub)
Abig = (1 - ((1-Abig) * (1-Asub))
end
RGBbig = RGBbig / Abig
> I do no serious test, but I am quite positive that do A1*B1+A2 using MMX/SSE2
would be faster than A1*B1+A2*B2.
A1*B1+A2*B2 is one SSE2 instruction, and processes up to 4 16-bit pixels at the
same time. Implementing A1*B1+A2 would probably end up being A1*B1+A2*1, just
so that the same instruction could be used.
I'm not sure why you insist on pre-multiplied alpha, i'm still not convinced of
any advantages, if anything i see a complexity there which could just be
avoided. Handing around normal ARGB32 bitmaps is easier to understand and
handle. I still have my use-case of blending it onto a YUV video, where i would
have to un-multiply the alpha before conversion, or it might end up being
rather weird.
> So the reason why using a maxNumBitmaps option not combineBitmaps, is we
won't lose anything by using maxNumBitmaps.
We also don't gain anything. Why would a renderer support rendering 100 small
bitmaps, but not 101? I just don't see the advantage. Either you can process
multiple small bitmaps, or you cannot. If you want to make the Alpha topic
easier, just remove the ability for the sub-renderer to merge the images
completely, and always let the consumer do that - that way there are no
misunderstandings.
Original comment by h.lepp...@gmail.com
on 29 Nov 2011 at 1:39
Original issue reported on code.google.com by
yakits...@gmail.com
on 30 Oct 2011 at 6:08