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

Unified Diff: src/opts/SkColor_opts_neon.h

Issue 23724013: ARM Skia NEON patches - 29 - Xfermode: SkFourByteInterp (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Rebase / update Created 7 years 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 | « no previous file | src/opts/SkXfermode_opts_arm_neon.cpp » ('j') | src/opts/SkXfermode_opts_arm_neon.cpp » ('J')
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 85752f5558cd8263bdf6f4108c5c88d55e6ee9a2..16e6177b1aa1733d1383d3c0ccc36102d3f400ab 100644
--- a/src/opts/SkColor_opts_neon.h
+++ b/src/opts/SkColor_opts_neon.h
@@ -82,4 +82,31 @@ static inline uint8x8_t SkBlend32_neon8(uint8x8_t src, uint8x8_t dst, uint16x8_t
return vmovn_u16(vreinterpretq_u16_s16(dst_wide));
}
+static inline SkPMColor SkFourByteInterp256_neon(SkPMColor src, SkPMColor dst,
+ unsigned scale) {
reed1 2013/12/02 16:25:42 Can we add SkASSERT(scale <= 256); at the beginnin
kevin.petit.not.used.account 2013/12/02 16:59:45 Done.
+ int16x8_t vscale = vdupq_n_s16(scale);
+ int16x8_t vsrc_wide, vdst_wide, vdiff;
+ uint8x8_t res;
+
+ vsrc_wide = vreinterpretq_s16_u16(vmovl_u8(vreinterpret_u8_u32(vdup_n_u32(src))));
+ vdst_wide = vreinterpretq_s16_u16(vmovl_u8(vreinterpret_u8_u32(vdup_n_u32(dst))));
+
+ vdiff = vsrc_wide - vdst_wide;
+ vdiff *= vscale;
+
+ vdiff = vshrq_n_s16(vdiff, 8);
+
+ vdst_wide += vdiff;
+
+ res = vmovn_u16(vreinterpretq_u16_s16(vdst_wide));
+
+ return vget_lane_u32(vreinterpret_u32_u8(res), 0);
+}
+
+static inline SkPMColor SkFourByteInterp_neon(SkPMColor src, SkPMColor dst,
+ U8CPU srcWeight) {
reed1 2013/12/02 16:25:42 SkASSERT(srcWeight <= 255);
kevin.petit.not.used.account 2013/12/02 16:59:45 Done.
+ unsigned scale = SkAlpha255To256(srcWeight);
+ return SkFourByteInterp256_neon(src, dst, scale);
+}
+
#endif /* #ifndef SkColor_opts_neon_DEFINED */
« no previous file with comments | « no previous file | src/opts/SkXfermode_opts_arm_neon.cpp » ('j') | src/opts/SkXfermode_opts_arm_neon.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698