[Webkit-unassigned] [Bug 103693] Remove conversion to/from float and float division from ImageFrame::setRGBA

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Nov 29 17:56:00 PST 2012


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





--- Comment #3 from Viatcheslav Ostapenko <ostap73 at gmail.com>  2012-11-29 17:58:17 PST ---
Benchmark was compiled like this:

gcc -O3 setRGBPerf.cpp -o setRGBPerf


Close to real life and slowest case of benchmark when tests run on pseudo random source buffer and m_premultiplyAlpha is true.
Pseudo random buffer is generated so, that approx 25% of pixels have 0 alpha, 25% have 255 alpha, other values are random.

Macbook Pro Ivy Bridge I7 2.7GHz, 256M elements
Pseudo random buffer:
1: 580000    2: 560000    3: 500000    4: 3290000

Samsung Galaxy Note II, 32M elements
Pseudo random buffer:
1: 380000    2: 360000    3: 360000    4: 1480000

1. Float conversion/division replace with simple integer division.
2. "Fast division" used instead of x/255 like x/256 + x/256^2 = (x + x / 256) / 256 . 1 is added to compensate for rounding error.
3. Fixed point pre-calculated constant is used as 1/255 multiplier.
4. Original function body.

There is simple test at the beginning of main function to make sure that all 4 methods produce identical results.

Obviously, that original function is significantly slower and fixed point multipler is the fastest, but ordinary integer division also works well.

-- 
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