Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1441)

Unified Diff: Source/platform/graphics/cpu/arm/filters/FilterEffectNEON.h

Issue 604373003: [WIP] Supporting arm_neon_optional flag for blink platform. Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/platform/graphics/cpu/arm/filters/FilterEffectNEON.h
diff --git a/Source/platform/graphics/cpu/arm/filters/FilterEffectNEON.h b/Source/platform/graphics/cpu/arm/filters/FilterEffectNEON.h
new file mode 100644
index 0000000000000000000000000000000000000000..36700bc3d08524cfb82705e145d4ff0f6ac2009a
--- /dev/null
+++ b/Source/platform/graphics/cpu/arm/filters/FilterEffectNEON.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2008 Alex Mathews <possessedpenguinbob@gmail.com>
+ * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef FilterEffectNEON_h
+#define FilterEffectNEON_h
+
+#if HAVE(ARM_NEON_INTRINSICS)
+
+#include "platform/graphics/filters/FilterEffect.h"
+#include <arm_neon.h>
+
+namespace blink {
+
+inline int FilterEffect::validPreMultipliedPixels64NEON(int pixelArrayLength, unsigned char* pixelData)
+{
+ 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 pixelArrayLength;
+ }
+
+ return pixelArrayLength;
+}
+
+} // namespace blink
+
+#endif
+
+#endif // FilterEffectNEON_h

Powered by Google App Engine
This is Rietveld 408576698