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

Side by Side Diff: src/opts/SkBlurImage_opts_SSE2.cpp

Issue 264603002: Cleanup of SSE optimization files. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Added chromium sync patch Created 6 years, 7 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 unified diff | Download patch
« no previous file with comments | « src/opts/SkBlurImage_opts_SSE2.h ('k') | src/opts/SkMorphology_opts_SSE2.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 The Android Open Source Project 2 * Copyright 2013 The Android Open Source Project
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 8 #include <emmintrin.h>
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkBlurImage_opts_SSE2.h"
10 #include "SkColorPriv.h" 11 #include "SkColorPriv.h"
11 #include "SkBlurImage_opts_SSE2.h"
12 #include "SkRect.h" 12 #include "SkRect.h"
13 13
14 #include <emmintrin.h>
15
16 namespace { 14 namespace {
17
18 enum BlurDirection { 15 enum BlurDirection {
19 kX, kY 16 kX, kY
20 }; 17 };
21 18
22 /** 19 /* Helper function to spread the components of a 32-bit integer into the
23 * Helper function to spread the components of a 32-bit integer into the
24 * lower 8 bits of each 32-bit element of an SSE register. 20 * lower 8 bits of each 32-bit element of an SSE register.
25 */ 21 */
22 inline __m128i expand(int a) {
23 const __m128i zero = _mm_setzero_si128();
26 24
27 inline __m128i expand(int a) { 25 // 0 0 0 0 0 0 0 0 0 0 0 0 A R G B
28 const __m128i zero = _mm_setzero_si128(); 26 __m128i result = _mm_cvtsi32_si128(a);
29 27
30 // 0 0 0 0 0 0 0 0 0 0 0 0 A R G B 28 // 0 0 0 0 0 0 0 0 0 A 0 R 0 G 0 B
31 __m128i result = _mm_cvtsi32_si128(a); 29 result = _mm_unpacklo_epi8(result, zero);
32 30
33 // 0 0 0 0 0 0 0 0 0 A 0 R 0 G 0 B 31 // 0 0 0 A 0 0 0 R 0 0 0 G 0 0 0 B
34 result = _mm_unpacklo_epi8(result, zero); 32 return _mm_unpacklo_epi16(result, zero);
35
36 // 0 0 0 A 0 0 0 R 0 0 0 G 0 0 0 B
37 return _mm_unpacklo_epi16(result, zero);
38 } 33 }
39 34
40 template<BlurDirection srcDirection, BlurDirection dstDirection> 35 template<BlurDirection srcDirection, BlurDirection dstDirection>
41 void SkBoxBlur_SSE2(const SkPMColor* src, int srcStride, SkPMColor* dst, int ker nelSize, 36 void SkBoxBlur_SSE2(const SkPMColor* src, int srcStride, SkPMColor* dst, int ker nelSize,
42 int leftOffset, int rightOffset, int width, int height) 37 int leftOffset, int rightOffset, int width, int height)
43 { 38 {
44 const int rightBorder = SkMin32(rightOffset + 1, width); 39 const int rightBorder = SkMin32(rightOffset + 1, width);
45 const int srcStrideX = srcDirection == kX ? 1 : srcStride; 40 const int srcStrideX = srcDirection == kX ? 1 : srcStride;
46 const int dstStrideX = dstDirection == kX ? 1 : height; 41 const int dstStrideX = dstDirection == kX ? 1 : height;
47 const int srcStrideY = srcDirection == kX ? srcStride : 1; 42 const int srcStrideY = srcDirection == kX ? srcStride : 1;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 bool SkBoxBlurGetPlatformProcs_SSE2(SkBoxBlurProc* boxBlurX, 103 bool SkBoxBlurGetPlatformProcs_SSE2(SkBoxBlurProc* boxBlurX,
109 SkBoxBlurProc* boxBlurY, 104 SkBoxBlurProc* boxBlurY,
110 SkBoxBlurProc* boxBlurXY, 105 SkBoxBlurProc* boxBlurXY,
111 SkBoxBlurProc* boxBlurYX) { 106 SkBoxBlurProc* boxBlurYX) {
112 *boxBlurX = SkBoxBlur_SSE2<kX, kX>; 107 *boxBlurX = SkBoxBlur_SSE2<kX, kX>;
113 *boxBlurY = SkBoxBlur_SSE2<kY, kY>; 108 *boxBlurY = SkBoxBlur_SSE2<kY, kY>;
114 *boxBlurXY = SkBoxBlur_SSE2<kX, kY>; 109 *boxBlurXY = SkBoxBlur_SSE2<kX, kY>;
115 *boxBlurYX = SkBoxBlur_SSE2<kY, kX>; 110 *boxBlurYX = SkBoxBlur_SSE2<kY, kX>;
116 return true; 111 return true;
117 } 112 }
OLDNEW
« no previous file with comments | « src/opts/SkBlurImage_opts_SSE2.h ('k') | src/opts/SkMorphology_opts_SSE2.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698