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

Unified Diff: src/opts/SkColor_opts_neon.h

Issue 33063002: ARM Skia NEON patches - 31 - Xfermode: xfer16 (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: 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 cd9e8133e20658a7698d3c471f2689691e6a30e0..82ca0072c86596d9ab2a7b9ab8c58f6b1c4a5600 100644
--- a/src/opts/SkColor_opts_neon.h
+++ b/src/opts/SkColor_opts_neon.h
@@ -29,4 +29,32 @@ static inline uint8x8x4_t SkAlphaMulQ_neon8(uint8x8x4_t color, uint16x8_t scale)
return ret;
}
+static inline uint8x8x4_t SkPixel16ToPixel32_neon8(uint16x8_t vsrc) {
reed1 2013/11/06 15:35:38 ca we add a brief comment above each of these? e.
kevin.petit.not.used.account 2013/11/06 16:50:05 If you want. Before I submit another patch I'd lik
+
+ uint8x8x4_t ret;
+ uint8x8_t vr, vg, vb;
+
+ vr = vmovn_u16(vshrq_n_u16(vsrc, SK_R16_SHIFT));
+ vg = vmovn_u16(vshrq_n_u16(vshlq_n_u16(vsrc, SK_R16_BITS), SK_R16_BITS + SK_B16_BITS));
+ vb = vmovn_u16(vsrc & vdupq_n_u16(SK_B16_MASK));
+
+ ret.val[NEON_A] = vdup_n_u8(0xFF);
+ ret.val[NEON_R] = vshl_n_u8(vr, 8 - SK_R16_BITS) | vshr_n_u8(vr, 2 * SK_R16_BITS - 8);
+ ret.val[NEON_G] = vshl_n_u8(vg, 8 - SK_G16_BITS) | vshr_n_u8(vg, 2 * SK_G16_BITS - 8);
+ ret.val[NEON_B] = vshl_n_u8(vb, 8 - SK_B16_BITS) | vshr_n_u8(vb, 2 * SK_B16_BITS - 8);
+
+ return ret;
+}
+
+static inline uint16x8_t SkPixel32ToPixel16_neon8(uint8x8x4_t vsrc) {
+
+ uint16x8_t ret;
+
+ ret = vshll_n_u8(vsrc.val[NEON_R], 8);
+ ret = vsriq_n_u16(ret, vshll_n_u8(vsrc.val[NEON_G], 8), SK_R16_BITS);
+ ret = vsriq_n_u16(ret, vshll_n_u8(vsrc.val[NEON_B], 8), SK_R16_BITS + SK_G16_BITS);
+
+ return ret;
+}
+
#endif /* #ifndef SkColor_opts_neon_DEFINED */

Powered by Google App Engine
This is Rietveld 408576698