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

Unified Diff: src/core/SkConvolver.cpp

Issue 352883002: Narrow disabled vectorization further to just ConvolveHorizontally. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 6 months 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 | « no previous file | no next file » | 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 08d9f454968c4763bcb571236e4729835282f277..0ef683c5f73f871cf6cae823108a6ef0296d28f4 100644
--- a/src/core/SkConvolver.cpp
+++ b/src/core/SkConvolver.cpp
@@ -158,6 +158,31 @@ template<bool hasAlpha>
}
}
+ // There's a bug somewhere here with GCC autovectorization (-ftree-vectorize) on 32 bit builds.
+ // Dropping to -O2 disables -ftree-vectorize. http://skbug.com/2575
+ #if defined(__i386) && SK_HAS_ATTRIBUTE(optimize) && defined(SK_RELEASE)
+ #define SK_MAYBE_DISABLE_VECTORIZATION __attribute__((optimize("O2")))
+ #else
+ #define SK_MAYBE_DISABLE_VECTORIZATION
+ #endif
+
+ SK_MAYBE_DISABLE_VECTORIZATION
+ static void ConvolveHorizontallyAlpha(const unsigned char* srcData,
+ const SkConvolutionFilter1D& filter,
+ unsigned char* outRow) {
+ return ConvolveHorizontally<true>(srcData, filter, outRow);
+ }
+
+ SK_MAYBE_DISABLE_VECTORIZATION
+ static void ConvolveHorizontallyNoAlpha(const unsigned char* srcData,
+ const SkConvolutionFilter1D& filter,
+ unsigned char* outRow) {
+ return ConvolveHorizontally<false>(srcData, filter, outRow);
+ }
+
+ #undef SK_MAYBE_DISABLE_VECTORIZATION
+
+
// Does vertical convolution to produce one output row. The filter values and
// length are given in the first two parameters. These are applied to each
// of the rows pointed to in the |sourceDataRows| array, with each row
@@ -330,11 +355,6 @@ const SkConvolutionFilter1D::ConvolutionFixed* SkConvolutionFilter1D::GetSingleF
return &fFilterValues[filter.fDataLocation];
}
-// There's a bug somewhere in here with GCC autovectorization (-ftree-vectorize) on 32 bit builds.
-// Dropping to -O2 disables -ftree-vectorize. http://skbug.com/2575
-#if defined(__i386) && SK_HAS_ATTRIBUTE(optimize) && defined(SK_RELEASE)
- __attribute__((optimize("O2")))
-#endif
void BGRAConvolve2D(const unsigned char* sourceData,
int sourceByteRowStride,
bool sourceHasAlpha,
@@ -425,11 +445,11 @@ void BGRAConvolve2D(const unsigned char* sourceData,
filterX, rowBuffer.advanceRow(), sourceHasAlpha);
} else {
if (sourceHasAlpha) {
- ConvolveHorizontally<true>(
+ ConvolveHorizontallyAlpha(
&sourceData[(uint64_t)nextXRow * sourceByteRowStride],
filterX, rowBuffer.advanceRow());
} else {
- ConvolveHorizontally<false>(
+ ConvolveHorizontallyNoAlpha(
&sourceData[(uint64_t)nextXRow * sourceByteRowStride],
filterX, rowBuffer.advanceRow());
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698