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

Unified Diff: src/opts/SkNx_neon.h

Issue 2134753006: Add Sk4f_RoundToInt (Closed) Base URL: https://skia.googlesource.com/skia.git@xformrefactor
Patch Set: Compile fixes Created 4 years, 5 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/SkNx_neon.h
diff --git a/src/opts/SkNx_neon.h b/src/opts/SkNx_neon.h
index bb81cded187ff9c1995d6230d43b000d8ca733ae..701b7326ee16d600fa71da5cee3faeca421bf824 100644
--- a/src/opts/SkNx_neon.h
+++ b/src/opts/SkNx_neon.h
@@ -450,4 +450,13 @@ template<> inline Sk4b SkNx_cast<uint8_t, uint16_t>(const Sk4h& src) {
return vmovn_u16(vcombine_u16(src.fVec, src.fVec));
}
+static inline Sk4i Sk4f_RoundToInt(const Sk4f& x) {
+ return vcvtq_s32_f32((x + 0.5f).fVec);
+}
+
+static inline uint32_t Sk4f_RoundToByte(const Sk4f& x) {
+ uint16x4_t x16 = vqmovun_s32(Sk4f_RoundToInt(x.fVec).fVec);
+ return vget_lane_u32(vreinterpret_u32_u8(vqmovn_u16(vcombine_u16(x16, x16))), 0);
+}
+
#endif//SkNx_neon_DEFINED
« src/core/SkNx.h ('K') | « src/opts/SkColorXform_opts.h ('k') | src/opts/SkNx_sse.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698