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

Unified Diff: src/opts/SkMath_opts_SSE2.h

Issue 224823004: Xfermode: SSE2 implementation of colordodge&colorburn modes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase and fix review's comments Created 6 years, 8 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
« no previous file with comments | « no previous file | src/opts/SkXfermode_opts_SSE2.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/opts/SkMath_opts_SSE2.h
diff --git a/src/opts/SkMath_opts_SSE2.h b/src/opts/SkMath_opts_SSE2.h
index d8aeac9b7503b6b958f43633f42cdcc339b877e1..2cc21afa0df4ad5d54d4ff997836053c1a68314a 100644
--- a/src/opts/SkMath_opts_SSE2.h
+++ b/src/opts/SkMath_opts_SSE2.h
@@ -10,6 +10,14 @@
#include <emmintrin.h>
+// Because no _mm_div_epi32() in SSE2, we use float division to emulate.
+// When using this function, make sure a and b don't exceed float's precision.
+static inline __m128i shim_mm_div_epi32(const __m128i& a, const __m128i& b) {
+ __m128 x = _mm_cvtepi32_ps(a);
+ __m128 y = _mm_cvtepi32_ps(b);
+ return _mm_cvttps_epi32(_mm_div_ps(x, y));
+}
+
// Portable version of SkSqrtBits is in SkMath.cpp.
static inline __m128i SkSqrtBits_SSE2(const __m128i& x, int count) {
__m128i root = _mm_setzero_si128();
« no previous file with comments | « no previous file | src/opts/SkXfermode_opts_SSE2.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698