Implement a speedup for Y-only blurs by transposing.
R=mtklein@google.com, mtklein, reed@google.com BUG= Review URL: https://codereview.chromium.org/66413007 git-svn-id: http://skia.googlecode.com/svn/trunk@12227 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
6acc8f473d
commit
05edd02a7c
@ -193,11 +193,12 @@ 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)) {
|
||||
SkBoxBlurProc boxBlurX, boxBlurY, boxBlurXY, boxBlurYX;
|
||||
if (!SkBoxBlurGetPlatformProcs(&boxBlurX, &boxBlurY, &boxBlurXY, &boxBlurYX)) {
|
||||
boxBlurX = boxBlur<kX, kX>;
|
||||
boxBlurY = boxBlur<kY, kY>;
|
||||
boxBlurXY = boxBlur<kX, kY>;
|
||||
boxBlurYX = boxBlur<kY, kX>;
|
||||
}
|
||||
|
||||
if (kernelSizeX > 0 && kernelSizeY > 0) {
|
||||
@ -221,9 +222,9 @@ bool SkBlurImageFilter::onFilterImage(Proxy* proxy,
|
||||
boxBlurX(d, w, t, kernelSizeX, highOffsetX, lowOffsetX, w, h);
|
||||
boxBlurX(t, w, d, kernelSizeX3, highOffsetX, highOffsetX, w, h);
|
||||
} else if (kernelSizeY > 0) {
|
||||
boxBlurY(s, sw, d, kernelSizeY, lowOffsetY, highOffsetY, h, w);
|
||||
boxBlurY(d, w, t, kernelSizeY, highOffsetY, lowOffsetY, h, w);
|
||||
boxBlurY(t, w, d, kernelSizeY3, highOffsetY, highOffsetY, h, w);
|
||||
boxBlurYX(s, sw, d, kernelSizeY, lowOffsetY, highOffsetY, h, w);
|
||||
boxBlurX(d, h, t, kernelSizeY, highOffsetY, lowOffsetY, h, w);
|
||||
boxBlurXY(t, h, d, kernelSizeY3, highOffsetY, highOffsetY, h, w);
|
||||
}
|
||||
offset->fX += srcBounds.fLeft;
|
||||
offset->fY += srcBounds.fTop;
|
||||
|
@ -15,5 +15,6 @@ typedef void (*SkBoxBlurProc)(const SkPMColor* src, int srcStride, SkPMColor* ds
|
||||
|
||||
bool SkBoxBlurGetPlatformProcs(SkBoxBlurProc* boxBlurX,
|
||||
SkBoxBlurProc* boxBlurY,
|
||||
SkBoxBlurProc* boxBlurXY);
|
||||
SkBoxBlurProc* boxBlurXY,
|
||||
SkBoxBlurProc* boxBlurYX);
|
||||
#endif
|
||||
|
@ -107,9 +107,11 @@ void SkBoxBlur_SSE2(const SkPMColor* src, int srcStride, SkPMColor* dst, int ker
|
||||
|
||||
bool SkBoxBlurGetPlatformProcs_SSE2(SkBoxBlurProc* boxBlurX,
|
||||
SkBoxBlurProc* boxBlurY,
|
||||
SkBoxBlurProc* boxBlurXY) {
|
||||
SkBoxBlurProc* boxBlurXY,
|
||||
SkBoxBlurProc* boxBlurYX) {
|
||||
*boxBlurX = SkBoxBlur_SSE2<kX, kX>;
|
||||
*boxBlurY = SkBoxBlur_SSE2<kY, kY>;
|
||||
*boxBlurXY = SkBoxBlur_SSE2<kX, kY>;
|
||||
*boxBlurYX = SkBoxBlur_SSE2<kY, kX>;
|
||||
return true;
|
||||
}
|
||||
|
@ -9,4 +9,5 @@
|
||||
|
||||
bool SkBoxBlurGetPlatformProcs_SSE2(SkBoxBlurProc* boxBlurX,
|
||||
SkBoxBlurProc* boxBlurY,
|
||||
SkBoxBlurProc* boxBlurXY);
|
||||
SkBoxBlurProc* boxBlurXY,
|
||||
SkBoxBlurProc* boxBlurYX);
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
bool SkBoxBlurGetPlatformProcs(SkBoxBlurProc* boxBlurX,
|
||||
SkBoxBlurProc* boxBlurY,
|
||||
SkBoxBlurProc* boxBlurXY) {
|
||||
SkBoxBlurProc* boxBlurXY,
|
||||
SkBoxBlurProc* boxBlurYX) {
|
||||
return false;
|
||||
}
|
||||
|
@ -271,14 +271,15 @@ SkMorphologyProc SkMorphologyGetPlatformProc(SkMorphologyProcType type) {
|
||||
|
||||
bool SkBoxBlurGetPlatformProcs(SkBoxBlurProc* boxBlurX,
|
||||
SkBoxBlurProc* boxBlurY,
|
||||
SkBoxBlurProc* boxBlurXY) {
|
||||
SkBoxBlurProc* boxBlurXY,
|
||||
SkBoxBlurProc* boxBlurYX) {
|
||||
#ifdef SK_DISABLE_BLUR_DIVISION_OPTIMIZATION
|
||||
return false;
|
||||
#else
|
||||
if (!cachedHasSSE2()) {
|
||||
return false;
|
||||
}
|
||||
return SkBoxBlurGetPlatformProcs_SSE2(boxBlurX, boxBlurY, boxBlurXY);
|
||||
return SkBoxBlurGetPlatformProcs_SSE2(boxBlurX, boxBlurY, boxBlurXY, boxBlurYX);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user