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

Unified Diff: src/core/SkConvolver.cpp

Issue 2481733003: Make SSE2/Neon convolution functions not to read extra bytes (Closed)
Patch Set: Change macros to functions Created 4 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 | « src/core/SkConvolver.h ('k') | src/opts/SkBitmapFilter_opts_SSE2.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkConvolver.cpp
diff --git a/src/core/SkConvolver.cpp b/src/core/SkConvolver.cpp
index c662e2ddaf0db82e0e40b5dd1c5c86ed4dd39206..c32cc0347207a0bacc7a1e036f49384719e0e9dd 100644
--- a/src/core/SkConvolver.cpp
+++ b/src/core/SkConvolver.cpp
@@ -401,19 +401,6 @@ bool BGRAConvolve2D(const unsigned char* sourceData,
// We need to check which is the last line to convolve before we advance 4
// lines in one iteration.
int lastFilterOffset, lastFilterLength;
-
- // SSE2 can access up to 3 extra pixels past the end of the
- // buffer. At the bottom of the image, we have to be careful
- // not to access data past the end of the buffer. Normally
- // we fall back to the C++ implementation for the last row.
- // If the last row is less than 3 pixels wide, we may have to fall
- // back to the C++ version for more rows. Compute how many
- // rows we need to avoid the SSE implementation for here.
- filterX.FilterForValue(filterX.numValues() - 1, &lastFilterOffset,
- &lastFilterLength);
- int avoidSimdRows = 1 + convolveProcs.fExtraHorizontalReads /
- (lastFilterOffset + lastFilterLength);
-
filterY.FilterForValue(numOutputRows - 1, &lastFilterOffset,
&lastFilterLength);
@@ -424,8 +411,7 @@ bool BGRAConvolve2D(const unsigned char* sourceData,
// Generate output rows until we have enough to run the current filter.
while (nextXRow < filterOffset + filterLength) {
if (convolveProcs.fConvolve4RowsHorizontally &&
- nextXRow + 3 < lastFilterOffset + lastFilterLength -
- avoidSimdRows) {
+ nextXRow + 3 < lastFilterOffset + lastFilterLength) {
const unsigned char* src[4];
unsigned char* outRow[4];
for (int i = 0; i < 4; ++i) {
@@ -435,10 +421,7 @@ bool BGRAConvolve2D(const unsigned char* sourceData,
convolveProcs.fConvolve4RowsHorizontally(src, filterX, outRow, 4*rowBufferWidth);
nextXRow += 4;
} else {
- // Check if we need to avoid SSE2 for this row.
- if (convolveProcs.fConvolveHorizontally &&
- nextXRow < lastFilterOffset + lastFilterLength -
- avoidSimdRows) {
+ if (convolveProcs.fConvolveHorizontally) {
convolveProcs.fConvolveHorizontally(
&sourceData[(uint64_t)nextXRow * sourceByteRowStride],
filterX, rowBuffer.advanceRow(), sourceHasAlpha);
« no previous file with comments | « src/core/SkConvolver.h ('k') | src/opts/SkBitmapFilter_opts_SSE2.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698