[Webkit-unassigned] [Bug 140603] SVG lighting filter calculation is optimized to be executed in a loop

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Jan 3 16:08:06 PST 2018


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

--- Comment #2 from Simon Fraser (smfr) <simon.fraser at apple.com> ---
(In reply to Said Abou-Hallawa from comment #0)
> The function FELighting::inlineSetPixel() is called to apply the lighting on
> a single pixel one at a time. Things to be noticed here about this function
> 
> -- The same calculation is carried out for the same values when calling this
> function from a loop. As an example consider these lines from
> FELighting::inlineSetPixel():
> 
>         normalVector.setX(factorX * static_cast<float>(normal2DVector.x()) *
> data.surfaceScale);
>         normalVector.setY(factorY * static_cast<float>(normal2DVector.y()) *
> data.surfaceScale);
> 
> and consider the case when it is called from any loop in
> FELighting::drawLighting(). All loops call FELighting::inlineSetPixel() with
> the same values for factorX, factorY, normal2DVector and data.surfaceScale.
> So the above multiplications should be carried out only once for every loop
> and reused for all pixels processed in this loop.

The normal vector is not constant here; it's the surface normal, computed by the Sobel filter that compares the alpha values of neighboring pixels.

> -- The calculation of FELighting::inlineSetPixel() is not reused for
> adjacent pixels if they should be the same. Caching the resulting color or
> the light strength of the last pixel should accelerate the lighting
> calculation for adjacent pixels.

That's possibly true.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20180104/5a1ffe72/attachment.html>


More information about the webkit-unassigned mailing list