[Webkit-unassigned] [Bug 57499] Speed up alpha-blending in ImageDecoder.h by avoiding floating-point

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Mar 30 13:27:50 PDT 2011


https://bugs.webkit.org/show_bug.cgi?id=57499


Pascal Massimino <pascal.massimino at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pascal.massimino at gmail.com




--- Comment #1 from Pascal Massimino <pascal.massimino at gmail.com>  2011-03-30 13:27:50 PST ---
(In reply to comment #0)
> ImageFrame::setRGBA() uses floating-point ops to do alpha premultiplication.  There are two methods we can try to make this faster:
> 
> * For Skia, use SkPreMultiplyARGB()
> * For others, use "x = (x * a * 32897) >> 23", which produces the same output for all x and a from 0 - 255.
> 
> Pascal Massimino did a quick test of method 2 on a Chromium build and got a noticeable speedup (about 5 ms savings out of an original 75 ms of total paint time for his testcase).

tried with SkPreMultiplyARGB(), and it seems a tad slower, but not much (maybe 1ms at max).
Note: SkPreMultiplyARGB() is using what would read as:
  x = (x * (a + (a>>7))) >> 8
which is off by one in 12.5% of the cases, compared to the (a / 255.f) float version.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list