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

Unified Diff: src/opts/SkNx_sse.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
« src/core/SkNx.h ('K') | « src/opts/SkNx_neon.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/opts/SkNx_sse.h
diff --git a/src/opts/SkNx_sse.h b/src/opts/SkNx_sse.h
index 9751c4db9141246681d8905bbaf2f5220fb293c2..346064283bbf6aa7b3f28f96d7aa85b0d0b507c0 100644
--- a/src/opts/SkNx_sse.h
+++ b/src/opts/SkNx_sse.h
@@ -377,4 +377,13 @@ template<> /*static*/ inline Sk4b SkNx_cast<uint8_t, uint16_t>(const Sk4h& src)
return _mm_packus_epi16(src.fVec, src.fVec);
}
+static inline Sk4i Sk4f_RoundToInt(const Sk4f& x) {
+ return _mm_cvtps_epi32(x.fVec);
+}
+
+static inline uint32_t Sk4f_RoundToByte(const Sk4f& x) {
+ __m128i x32 = _mm_cvtps_epi32(x.fVec);
+ return Sk4i(_mm_packus_epi16(_mm_packus_epi16(x32, x32), x32))[0];
+}
+
#endif//SkNx_sse_DEFINED
« src/core/SkNx.h ('K') | « src/opts/SkNx_neon.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698