diff options
author | 2013-11-08 20:49:04 +0000 | |
---|---|---|
committer | 2013-11-08 20:49:04 +0000 | |
commit | 27eec46d6925afc76c2241c6b3182ce9b3284c9e (patch) | |
tree | 76647398093e404ffeaf962a275b4a1f1d01d889 /src/effects | |
parent | 11e5b972a984c7b4e09ba4dfeacc7bd805107c5a (diff) |
SSE2 implementation of RGBA box blurs. This yields ~2X perf improvement on Xeon ES-2690.
R=mtklein@google.com
Review URL: https://codereview.chromium.org/61643011
git-svn-id: http://skia.googlecode.com/svn/trunk@12204 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/effects')
-rw-r--r-- | src/effects/SkBlurImageFilter.cpp | 28 |
1 files changed, 8 insertions, 20 deletions
diff --git a/src/effects/SkBlurImageFilter.cpp b/src/effects/SkBlurImageFilter.cpp index c04c258829..852c0afad3 100644 --- a/src/effects/SkBlurImageFilter.cpp +++ b/src/effects/SkBlurImageFilter.cpp @@ -10,6 +10,7 @@ #include "SkColorPriv.h" #include "SkFlattenableBuffers.h" #include "SkGpuBlurUtils.h" +#include "SkBlurImage_opts.h" #if SK_SUPPORT_GPU #include "GrContext.h" #include "SkImageFilterUtils.h" @@ -125,26 +126,6 @@ static void boxBlur(const SkPMColor* src, int srcStride, SkPMColor* dst, int ker } } -static void boxBlurX(const SkPMColor* src, int srcStride, SkPMColor* dst, int kernelSize, - int leftOffset, int rightOffset, int width, int height) -{ - boxBlur<kX, kX>(src, srcStride, dst, kernelSize, leftOffset, rightOffset, width, height); -} - -#ifndef SK_DISABLE_BLUR_DIVISION_OPTIMIZATION -static void boxBlurXY(const SkPMColor* src, int srcStride, SkPMColor* dst, int kernelSize, - int leftOffset, int rightOffset, int width, int height) -{ - boxBlur<kX, kY>(src, srcStride, dst, kernelSize, leftOffset, rightOffset, width, height); -} -#endif - -static void boxBlurY(const SkPMColor* src, int srcStride, SkPMColor* dst, int kernelSize, - int topOffset, int bottomOffset, int width, int height) -{ - boxBlur<kY, kY>(src, srcStride, dst, kernelSize, topOffset, bottomOffset, width, height); -} - static void getBox3Params(SkScalar s, int *kernelSize, int* kernelSize3, int *lowOffset, int *highOffset) { @@ -212,6 +193,13 @@ bool SkBlurImageFilter::onFilterImage(Proxy* proxy, SkPMColor* d = dst->getAddr32(0, 0); int w = dstBounds.width(), h = dstBounds.height(); int sw = src.rowBytesAsPixels(); + SkBoxBlurProc boxBlurX, boxBlurY, boxBlurXY; + if (!SkBoxBlurGetPlatformProcs(&boxBlurX, &boxBlurY, &boxBlurXY)) { + boxBlurX = boxBlur<kX, kX>; + boxBlurY = boxBlur<kY, kY>; + boxBlurXY = boxBlur<kX, kY>; + } + if (kernelSizeX > 0 && kernelSizeY > 0) { #ifndef SK_DISABLE_BLUR_DIVISION_OPTIMIZATION boxBlurX(s, sw, t, kernelSizeX, lowOffsetX, highOffsetX, w, h); |