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

Unified Diff: src/opts/SkColor_opts_neon.h

Issue 26627004: ARM Skia NEON patches - 30 - Xfermode: NEON modeprocs (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Add a workaround for gcc4.6 Created 7 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: src/opts/SkColor_opts_neon.h
diff --git a/src/opts/SkColor_opts_neon.h b/src/opts/SkColor_opts_neon.h
index 7e3057d14c80ed33567fd5ec09e6402123abcb77..cd9e8133e20658a7698d3c471f2689691e6a30e0 100644
--- a/src/opts/SkColor_opts_neon.h
+++ b/src/opts/SkColor_opts_neon.h
@@ -3,9 +3,30 @@
#include "SkTypes.h"
+#include <arm_neon.h>
+
#define NEON_A (SK_A32_SHIFT / 8)
#define NEON_R (SK_R32_SHIFT / 8)
#define NEON_G (SK_G32_SHIFT / 8)
#define NEON_B (SK_B32_SHIFT / 8)
+static inline uint16x8_t SkAlpha255To256_neon8(uint8x8_t alpha) {
+ return vaddw_u8(vdupq_n_u16(1), alpha);
+}
+
+static inline uint8x8_t SkAlphaMul_neon8(uint8x8_t color, uint16x8_t scale) {
+ return vshrn_n_u16(vmovl_u8(color) * scale, 8);
+}
+
+static inline uint8x8x4_t SkAlphaMulQ_neon8(uint8x8x4_t color, uint16x8_t scale) {
+ uint8x8x4_t ret;
+
+ ret.val[NEON_A] = SkAlphaMul_neon8(color.val[NEON_A], scale);
+ ret.val[NEON_R] = SkAlphaMul_neon8(color.val[NEON_R], scale);
+ ret.val[NEON_G] = SkAlphaMul_neon8(color.val[NEON_G], scale);
+ ret.val[NEON_B] = SkAlphaMul_neon8(color.val[NEON_B], scale);
+
+ return ret;
+}
+
#endif /* #ifndef SkColor_opts_neon_DEFINED */

Powered by Google App Engine
This is Rietveld 408576698