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

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: Add requested comments and asserts Created 7 years, 1 month 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
« no previous file with comments | « src/opts/SkBlitRow_opts_arm_neon.cpp ('k') | src/opts/SkXfermode_opts_arm_neon.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..f81239712ab5bba90fb21b6896f7edbb4e658044 100644
--- a/src/opts/SkColor_opts_neon.h
+++ b/src/opts/SkColor_opts_neon.h
@@ -29,4 +29,40 @@ static inline uint8x8x4_t SkAlphaMulQ_neon8(uint8x8x4_t color, uint16x8_t scale)
return ret;
}
+/* This function expands 8 pixels from RGB565 (R, G, B from high to low) to
+ * SkPMColor (all possible configurations supported) in the exact same way as
+ * SkPixel16ToPixel32.
+ */
+static inline uint8x8x4_t SkPixel16ToPixel32_neon8(uint16x8_t vsrc) {
+
+ 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;
+}
+
+/* This function packs 8 pixels from SkPMColor (all possible configurations
+ * supported) to RGB565 (R, G, B from high to low) in the exact same way as
+ * SkPixel32ToPixel16.
+ */
+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 */
« no previous file with comments | « src/opts/SkBlitRow_opts_arm_neon.cpp ('k') | src/opts/SkXfermode_opts_arm_neon.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698