diff options
author | 2014-07-06 18:51:29 -0700 | |
---|---|---|
committer | 2014-07-06 18:51:29 -0700 | |
commit | 82cb86f613300aa26f858e8f46454b1a8a5e2314 (patch) | |
tree | c59a70914f0aa5d799ffd41ef996b72fb7196869 /src/opts/SkBlurImage_opts_SSE4.cpp | |
parent | d930511ee73bf0ddc8bdf570ec23a17dd3e19709 (diff) |
Revert of Add SSE4 version of BlurImage optimizations. (https://codereview.chromium.org/366593004/)
Reason for revert:
breaks linker on chrome
[04:36:09.966000] [503/5965] LIB obj\chrome\installer_util.lib
[04:36:10.466000] FAILED: C:\Users\chrome-bot\buildbot\third_party\depot_tools\python276_bin\python.exe gyp-win-tool link-with-manifests environment.x86 True skia.dll "C:\Users\chrome-bot\buildbot\third_party\depot_tools\python276_bin\python.exe gyp-win-tool link-wrapper environment.x86 False link.exe /nologo /IMPLIB:skia.dll.lib /DLL /OUT:skia.dll @skia.dll.rsp" 2 mt.exe rc.exe "obj\skia\skia.skia.dll.intermediate.manifest" obj\skia\skia.skia.dll.generated.manifest
[04:36:10.466000] skia.opts_check_x86.obj : error LNK2019: unresolved external symbol "bool __cdecl SkBoxBlurGetPlatformProcs_SSE4(void (__cdecl**)(unsigned int const *,int,unsigned int *,int,int,int,int,int),void (__cdecl**)(unsigned int const *,int,unsigned int *,int,int,int,int,int),void (__cdecl**)(unsigned int const *,int,unsigned int *,int,int,int,int,int),void (__cdecl**)(unsigned int const *,int,unsigned int *,int,int,int,int,int))" (?SkBoxBlurGetPlatformProcs_SSE4@@YA_NPAP6AXPBIHPAIHHHHH@Z222@Z) referenced in function "bool __cdecl SkBoxBlurGetPlatformProcs(void (__cdecl**)(unsigned int const *,int,unsigned int *,int,int,int,int,int),void (__cdecl**)(unsigned int const *,int,unsigned int *,int,int,int,int,int),void (__cdecl**)(unsigned int const *,int,unsigned int *,int,int,int,int,int),void (__cdecl**)(unsigned int const *,int,unsigned int *,int,int,int,int,int))" (?SkBoxBlurGetPlatformProcs@@YA_NPAP6AXPBIHPAIHHHHH@Z222@Z)
[04:36:10.466000]
[04:36:10.466000] skia.dll : fatal error LNK1120: 1 unresolved externals
Original issue's description:
> Add SSE4 version of BlurImage optimizations.
>
> Adds an SSE4.1 version of the existing BlurImage optimizations.
> Performance of blur_image_filter_* benchmarks show a 10-50%
> improvement on Linux/Ubuntu Core i7.
>
> Signed-off-by: Henrik Smiding <henrik.smiding@intel.com>
>
> Committed: https://skia.googlesource.com/skia/+/2830632ce93c97ed7647b13348365ea92e4ea665
R=mtklein@google.com, henrik.smiding@intel.com
TBR=henrik.smiding@intel.com, mtklein@google.com
NOTREECHECKS=true
NOTRY=true
Author: reed@chromium.org
Review URL: https://codereview.chromium.org/375503003
Diffstat (limited to 'src/opts/SkBlurImage_opts_SSE4.cpp')
-rw-r--r-- | src/opts/SkBlurImage_opts_SSE4.cpp | 123 |
1 files changed, 0 insertions, 123 deletions
diff --git a/src/opts/SkBlurImage_opts_SSE4.cpp b/src/opts/SkBlurImage_opts_SSE4.cpp deleted file mode 100644 index fb17aaca4d..0000000000 --- a/src/opts/SkBlurImage_opts_SSE4.cpp +++ /dev/null @@ -1,123 +0,0 @@ -/* - * 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. - */ - -#include "SkBitmap.h" -#include "SkBlurImage_opts_SSE4.h" -#include "SkColorPriv.h" -#include "SkRect.h" - -/* With the exception of the Android framework we always build the SSE4 functions - * and enable the caller to determine SSE4 support. However, for the Android framework, - * if the device does not support SSE4x then the compiler will not supply the required - * -msse4* option needed to build this file, so instead we provide a stub implementation. - */ -#if !defined(SK_BUILD_FOR_ANDROID_FRAMEWORK) || SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE41 - -#include <smmintrin.h> - -namespace { -enum BlurDirection { - kX, kY -}; - -/* Helper function to spread the components of a 32-bit integer into the - * lower 8 bits of each 32-bit element of an SSE register. - */ -inline __m128i expand(int a) { - const __m128i zero = _mm_setzero_si128(); - - // 0 0 0 0 0 0 0 0 0 0 0 0 A R G B - __m128i result = _mm_cvtsi32_si128(a); - - // 0 0 0 0 0 0 0 0 0 A 0 R 0 G 0 B - result = _mm_unpacklo_epi8(result, zero); - - // 0 0 0 A 0 0 0 R 0 0 0 G 0 0 0 B - return _mm_unpacklo_epi16(result, zero); -} - -template<BlurDirection srcDirection, BlurDirection dstDirection> -void SkBoxBlur_SSE4(const SkPMColor* src, int srcStride, SkPMColor* dst, int kernelSize, - int leftOffset, int rightOffset, int width, int height) -{ - const int rightBorder = SkMin32(rightOffset + 1, width); - const int srcStrideX = srcDirection == kX ? 1 : srcStride; - const int dstStrideX = dstDirection == kX ? 1 : height; - const int srcStrideY = srcDirection == kX ? srcStride : 1; - const int dstStrideY = dstDirection == kX ? width : 1; - const __m128i scale = _mm_set1_epi32((1 << 24) / kernelSize); - const __m128i half = _mm_set1_epi32(1 << 23); - const __m128i zero = _mm_setzero_si128(); - for (int y = 0; y < height; ++y) { - __m128i sum = zero; - const SkPMColor* p = src; - for (int i = 0; i < rightBorder; ++i) { - sum = _mm_add_epi32(sum, expand(*p)); - p += srcStrideX; - } - - const SkPMColor* sptr = src; - SkColor* dptr = dst; - for (int x = 0; x < width; ++x) { - __m128i result = _mm_mullo_epi32(sum, scale); - - // sumA*scale+.5 sumB*scale+.5 sumG*scale+.5 sumB*scale+.5 - result = _mm_add_epi32(result, half); - - // 0 0 0 A 0 0 0 R 0 0 0 G 0 0 0 B - result = _mm_srli_epi32(result, 24); - - // 0 0 0 0 0 0 0 0 0 A 0 R 0 G 0 B - result = _mm_packs_epi32(result, zero); - - // 0 0 0 0 0 0 0 0 0 0 0 0 A R G B - result = _mm_packus_epi16(result, zero); - *dptr = _mm_cvtsi128_si32(result); - if (x >= leftOffset) { - SkColor l = *(sptr - leftOffset * srcStrideX); - sum = _mm_sub_epi32(sum, expand(l)); - } - if (x + rightOffset + 1 < width) { - SkColor r = *(sptr + (rightOffset + 1) * srcStrideX); - sum = _mm_add_epi32(sum, expand(r)); - } - sptr += srcStrideX; - if (srcDirection == kY) { - _mm_prefetch(reinterpret_cast<const char*>(sptr + (rightOffset + 1) * srcStrideX), - _MM_HINT_T0); - } - dptr += dstStrideX; - } - src += srcStrideY; - dst += dstStrideY; - } -} - -} // namespace - -bool SkBoxBlurGetPlatformProcs_SSE4(SkBoxBlurProc* boxBlurX, - SkBoxBlurProc* boxBlurY, - SkBoxBlurProc* boxBlurXY, - SkBoxBlurProc* boxBlurYX) { - *boxBlurX = SkBoxBlur_SSE4<kX, kX>; - *boxBlurY = SkBoxBlur_SSE4<kY, kY>; - *boxBlurXY = SkBoxBlur_SSE4<kX, kY>; - *boxBlurYX = SkBoxBlur_SSE4<kY, kX>; - return true; -} - -#else // !defined(SK_BUILD_FOR_ANDROID_FRAMEWORK) || SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE41 - -bool SkBoxBlurGetPlatformProcs_SSE4(SkBoxBlurProc* boxBlurX, - SkBoxBlurProc* boxBlurY, - SkBoxBlurProc* boxBlurXY, - SkBoxBlurProc* boxBlurYX) { - sk_throw(); -} - - -#endif |