Title: [117058] trunk/Source
Revision
117058
Author
[email protected]
Date
2012-05-15 06:18:14 -0700 (Tue, 15 May 2012)

Log Message

NEONizing forceValidPreMultipliedPixels
https://bugs.webkit.org/show_bug.cgi?id=86468

Reviewed by Nikolas Zimmermann.

Source/WebCore: 

Optimize forceValidPreMultipliedPixels with ARM-NEON intrinsics.

Existing tests cover this feature.

* platform/graphics/filters/FilterEffect.cpp:
(WebCore::FilterEffect::forceValidPreMultipliedPixels):

Source/WTF: 

Allow to disable all intrinsics with a single macro.

* wtf/Platform.h:

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (117057 => 117058)


--- trunk/Source/WTF/ChangeLog	2012-05-15 13:08:28 UTC (rev 117057)
+++ trunk/Source/WTF/ChangeLog	2012-05-15 13:18:14 UTC (rev 117058)
@@ -1,3 +1,14 @@
+2012-05-15  Zoltan Herczeg  <[email protected]>
+
+        NEONizing forceValidPreMultipliedPixels
+        https://bugs.webkit.org/show_bug.cgi?id=86468
+
+        Reviewed by Nikolas Zimmermann.
+
+        Allow to disable all intrinsics with a single macro.
+
+        * wtf/Platform.h:
+
 2012-05-14  Andy Estes  <[email protected]>
 
         Add WTF_USE_APPKIT to differentiate platforms that use AppKit.framework from other Darwin platforms

Modified: trunk/Source/WTF/wtf/Platform.h (117057 => 117058)


--- trunk/Source/WTF/wtf/Platform.h	2012-05-15 13:08:28 UTC (rev 117057)
+++ trunk/Source/WTF/wtf/Platform.h	2012-05-15 13:18:14 UTC (rev 117058)
@@ -293,6 +293,11 @@
 #define WTF_CPU_ARM_NEON 1
 #endif
 
+#if CPU(ARM_NEON) && (!COMPILER(GCC) || GCC_VERSION_AT_LEAST(4, 7, 0))
+// All NEON intrinsics usage can be disabled by this macro.
+#define HAVE_ARM_NEON_INTRINSICS 1
+#endif
+
 #endif /* ARM */
 
 #if CPU(ARM) || CPU(MIPS) || CPU(SH4) || CPU(SPARC)

Modified: trunk/Source/WebCore/ChangeLog (117057 => 117058)


--- trunk/Source/WebCore/ChangeLog	2012-05-15 13:08:28 UTC (rev 117057)
+++ trunk/Source/WebCore/ChangeLog	2012-05-15 13:18:14 UTC (rev 117058)
@@ -1,3 +1,17 @@
+2012-05-15  Zoltan Herczeg  <[email protected]>
+
+        NEONizing forceValidPreMultipliedPixels
+        https://bugs.webkit.org/show_bug.cgi?id=86468
+
+        Reviewed by Nikolas Zimmermann.
+
+        Optimize forceValidPreMultipliedPixels with ARM-NEON intrinsics.
+
+        Existing tests cover this feature.
+
+        * platform/graphics/filters/FilterEffect.cpp:
+        (WebCore::FilterEffect::forceValidPreMultipliedPixels):
+
 2012-05-15  Yury Semikhatsky  <[email protected]>
 
         Web Inspector: remove unnecessary setTimeout in HeapSnapshotGridNodes.js

Modified: trunk/Source/WebCore/platform/graphics/filters/FilterEffect.cpp (117057 => 117058)


--- trunk/Source/WebCore/platform/graphics/filters/FilterEffect.cpp	2012-05-15 13:08:28 UTC (rev 117057)
+++ trunk/Source/WebCore/platform/graphics/filters/FilterEffect.cpp	2012-05-15 13:18:14 UTC (rev 117058)
@@ -29,6 +29,10 @@
 #include "TextStream.h"
 #include <wtf/Uint8ClampedArray.h>
 
+#if HAVE(ARM_NEON_INTRINSICS)
+#include <arm_neon.h>
+#endif
+
 namespace WebCore {
 
 FilterEffect::FilterEffect(Filter* filter)
@@ -131,6 +135,26 @@
 
     // We must have four bytes per pixel, and complete pixels
     ASSERT(!(pixelArrayLength % 4));
+
+#if HAVE(ARM_NEON_INTRINSICS)
+    if (pixelArrayLength >= 64) {
+        unsigned char* lastPixel = pixelData + (pixelArrayLength & ~0x3f);
+        do {
+            // Increments pixelData by 64.
+            uint8x16x4_t sixteenPixels = vld4q_u8(pixelData);
+            sixteenPixels.val[0] = vminq_u8(sixteenPixels.val[0], sixteenPixels.val[3]);
+            sixteenPixels.val[1] = vminq_u8(sixteenPixels.val[1], sixteenPixels.val[3]);
+            sixteenPixels.val[2] = vminq_u8(sixteenPixels.val[2], sixteenPixels.val[3]);
+            vst4q_u8(pixelData, sixteenPixels);
+            pixelData += 64;
+        } while (pixelData < lastPixel);
+
+        pixelArrayLength &= 0x3f;
+        if (!pixelArrayLength)
+            return;
+    }
+#endif
+
     int numPixels = pixelArrayLength / 4;
 
     // Iterate over each pixel, checking alpha and adjusting color components if necessary
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to