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

Unified Diff: src/opts/SkColor_opts_SSE2.h

Issue 138163013: SSE2 implementation of S32A_D565_Opaque (Closed) Base URL: https://skia.googlesource.com/skia.git@SkSrcOver32To16SSE
Patch Set: fix nits Created 6 years, 10 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 | « src/opts/SkBlitRow_opts_SSE2.cpp ('k') | src/opts/opts_check_SSE2.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/opts/SkColor_opts_SSE2.h
diff --git a/src/opts/SkColor_opts_SSE2.h b/src/opts/SkColor_opts_SSE2.h
new file mode 100644
index 0000000000000000000000000000000000000000..13a5be5655631d1c1dcd365f72435c1df97b8c68
--- /dev/null
+++ b/src/opts/SkColor_opts_SSE2.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2014 The Android Open Source Project
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkColor_opts_SSE2_DEFINED
+#define SkColor_opts_SSE2_DEFINED
+
+#include <emmintrin.h>
+
+static inline __m128i SkMul16ShiftRound_SSE(__m128i a, __m128i b, int shift) {
+ __m128i prod = _mm_mullo_epi16(a, b);
+ prod = _mm_add_epi16(prod, _mm_set1_epi16(1 << (shift - 1)));
+ prod = _mm_add_epi16(prod, _mm_srli_epi16(prod, shift));
+ prod = _mm_srli_epi16(prod, shift);
+
+ return prod;
+}
+
+static inline __m128i SkPackRGB16_SSE(__m128i r, __m128i g, __m128i b) {
+ r = _mm_slli_epi16(r, SK_R16_SHIFT);
+ g = _mm_slli_epi16(g, SK_G16_SHIFT);
+ b = _mm_slli_epi16(b, SK_B16_SHIFT);
+
+ __m128i c = _mm_or_si128(r, g);
+ return _mm_or_si128(c, b);
+}
+
+#endif//SkColor_opts_SSE2_DEFINED
« no previous file with comments | « src/opts/SkBlitRow_opts_SSE2.cpp ('k') | src/opts/opts_check_SSE2.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698