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

Unified Diff: src/effects/SkBlurImageFilter.cpp

Issue 57823003: Add SK_PREFETCH and use in SkBlurImageFilter. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 1 month 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 | « include/core/SkPostConfig.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkBlurImageFilter.cpp
diff --git a/src/effects/SkBlurImageFilter.cpp b/src/effects/SkBlurImageFilter.cpp
index a820152fb39c6a1f9ed4b31b6af8ee6669957e68..c5a76c1257d07c5a9919525abb5371e839ceaca2 100644
--- a/src/effects/SkBlurImageFilter.cpp
+++ b/src/effects/SkBlurImageFilter.cpp
@@ -101,6 +101,8 @@ static void boxBlurY(const SkBitmap& src, SkBitmap* dst, int kernelSize,
}
const SkColor* sptr = src.getAddr32(bounds.fLeft + x, bounds.fTop);
+ const SkColor* back = sptr - topOffset * srcStride;
+ const SkColor* front = sptr + (bottomOffset + 1) * srcStride;
SkColor* dptr = dst->getAddr32(x, 0);
for (int y = 0; y < height; ++y) {
*dptr = SkPackARGB32(sumA / kernelSize,
@@ -108,21 +110,23 @@ static void boxBlurY(const SkBitmap& src, SkBitmap* dst, int kernelSize,
sumG / kernelSize,
sumB / kernelSize);
if (y >= topOffset) {
- SkColor l = *(sptr - topOffset * srcStride);
+ SkColor l = *back;
sumA -= SkGetPackedA32(l);
sumR -= SkGetPackedR32(l);
sumG -= SkGetPackedG32(l);
sumB -= SkGetPackedB32(l);
}
if (y + bottomOffset + 1 < height) {
- SkColor r = *(sptr + (bottomOffset + 1) * srcStride);
+ SkColor r = *front;
sumA += SkGetPackedA32(r);
sumR += SkGetPackedR32(r);
sumG += SkGetPackedG32(r);
sumB += SkGetPackedB32(r);
}
- sptr += srcStride;
- dptr += dstStride;
+ front += srcStride;
+ SK_PREFETCH(front); // This step by srcStride seems to be hard to predict.
Stephen White 2013/11/04 16:24:17 I'm a little leery of prefetch instructions, due t
+ back += srcStride; // back will probably still be cached, so no hint needed.
+ dptr += dstStride;
}
}
}
« no previous file with comments | « include/core/SkPostConfig.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698