WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
140603
SVG lighting filter calculation is optimized to be executed in a loop
https://bugs.webkit.org/show_bug.cgi?id=140603
Summary
SVG lighting filter calculation is optimized to be executed in a loop
Said Abou-Hallawa
Reported
2015-01-18 20:20:19 PST
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 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.
Attachments
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2015-01-19 12:03:15 PST
<
rdar://problem/19521229
>
Simon Fraser (smfr)
Comment 2
2018-01-03 16:08:06 PST
(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.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug