Index: skia/ext/convolver.h |
diff --git a/skia/ext/convolver.h b/skia/ext/convolver.h |
index 04d6fe5c52db2e05218b8973c5e90b944e0b5d8f..fdc53eb4c1f8d2f0aed9e166cbd62f57174243cb 100644 |
--- a/skia/ext/convolver.h |
+++ b/skia/ext/convolver.h |
@@ -10,6 +10,7 @@ |
#include <vector> |
#include "base/basictypes.h" |
+#include "base/cpu.h" |
// avoid confusion with Mac OS X's math library (Carbon) |
#if defined(__APPLE__) |
@@ -98,6 +99,17 @@ class ConvolutionFilter1D { |
return &filter_values_[filter.data_location]; |
} |
+ |
+ inline void PaddingForSIMD(int padding_count) { |
+ // Padding |padding_count| of more dummy coefficients after the coefficients |
+ // of last filter to prevent SIMD instructions which load 8 or 16 bytes |
+ // together to access invalid memory areas. We are not trying to align the |
+ // coefficients right now due to the opaqueness of <vector> implementation. |
+ // This has to be done after all |AddFilter| calls. |
brettw
2011/02/25 06:43:02
I get this now, thanks! I presume that in the futu
jiesun
2011/03/07 18:57:15
correct. it is not done in this patch, because I a
|
+ for (int i = 0; i < padding_count; ++i) |
+ filter_values_.push_back(static_cast<Fixed>(0)); |
+ } |
+ |
private: |
struct FilterInstance { |
// Offset within filter_values for this instance of the filter. |
@@ -148,6 +160,23 @@ void BGRAConvolve2D(const unsigned char* source_data, |
int output_byte_row_stride, |
unsigned char* output); |
+// Note: You should never use these functions externally; these functions are |
+// exposed only for testing purpose. |
+void BGRAConvolve2D_C(const unsigned char* source_data, |
+ int source_byte_row_stride, |
+ bool source_has_alpha, |
+ const ConvolutionFilter1D& filter_x, |
+ const ConvolutionFilter1D& filter_y, |
+ int output_byte_row_stride, |
+ unsigned char* output); |
+ |
+void BGRAConvolve2D_SSE2(const unsigned char* source_data, |
+ int source_byte_row_stride, |
+ bool source_has_alpha, |
+ const ConvolutionFilter1D& filter_x, |
+ const ConvolutionFilter1D& filter_y, |
+ int output_byte_row_stride, |
+ unsigned char* output); |
} // namespace skia |
#endif // SKIA_EXT_CONVOLVER_H_ |