Title: [154042] trunk/Source/WebCore
Revision
154042
Author
[email protected]
Date
2013-08-14 00:49:22 -0700 (Wed, 14 Aug 2013)

Log Message

FEComponentTransfer could be faster.
https://bugs.webkit.org/show_bug.cgi?id=119671

Patch by Jinwoo Jeong <[email protected]> on 2013-08-14
Reviewed by Christophe Dumez.

Use direct writing to target data instead of calling Uint8ClampedArray::set() function.
This change reduces at least 80% time in the loop of that function.

The Uint8ClampedArray::set() function has index checking code, value checking code and value casting code.
But the index is managed by for loop condition, the value is generated by transferFunction.
And the value is already defined as unsigned char.
Thus all works in Uint8ClampedArray::set() function is redundant.
Removing the call to Uint8ClampedArray::set() function does not reduce stability but improves performance.

* platform/graphics/filters/FEComponentTransfer.cpp:
(WebCore::FEComponentTransfer::platformApplySoftware):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (154041 => 154042)


--- trunk/Source/WebCore/ChangeLog	2013-08-14 06:36:20 UTC (rev 154041)
+++ trunk/Source/WebCore/ChangeLog	2013-08-14 07:49:22 UTC (rev 154042)
@@ -1,3 +1,22 @@
+2013-08-14  Jinwoo Jeong  <[email protected]>
+
+        FEComponentTransfer could be faster.
+        https://bugs.webkit.org/show_bug.cgi?id=119671
+
+        Reviewed by Christophe Dumez.
+
+        Use direct writing to target data instead of calling Uint8ClampedArray::set() function.
+        This change reduces at least 80% time in the loop of that function.
+
+        The Uint8ClampedArray::set() function has index checking code, value checking code and value casting code.
+        But the index is managed by for loop condition, the value is generated by transferFunction.
+        And the value is already defined as unsigned char.
+        Thus all works in Uint8ClampedArray::set() function is redundant.
+        Removing the call to Uint8ClampedArray::set() function does not reduce stability but improves performance.
+
+        * platform/graphics/filters/FEComponentTransfer.cpp:
+        (WebCore::FEComponentTransfer::platformApplySoftware):
+
 2013-08-13  Gyuyoung Kim  <[email protected]>
 
         The length of scheme is at least five characters even when the scheme has 'web+' prefix

Modified: trunk/Source/WebCore/platform/graphics/filters/FEComponentTransfer.cpp (154041 => 154042)


--- trunk/Source/WebCore/platform/graphics/filters/FEComponentTransfer.cpp	2013-08-14 06:36:20 UTC (rev 154041)
+++ trunk/Source/WebCore/platform/graphics/filters/FEComponentTransfer.cpp	2013-08-14 07:49:22 UTC (rev 154042)
@@ -166,10 +166,11 @@
     in->copyUnmultipliedImage(pixelArray, drawingRect);
 
     unsigned pixelArrayLength = pixelArray->length();
+    unsigned char* data = ""
     for (unsigned pixelOffset = 0; pixelOffset < pixelArrayLength; pixelOffset += 4) {
         for (unsigned channel = 0; channel < 4; ++channel) {
-            unsigned char c = pixelArray->item(pixelOffset + channel);
-            pixelArray->set(pixelOffset + channel, tables[channel][c]);
+            unsigned char c = data[pixelOffset + channel];
+            data[pixelOffset + channel] = tables[channel][c];
         }
     }
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to