summaryrefslogtreecommitdiffstats
path: root/skia/ext/convolver_unittest.cc
diff options
context:
space:
mode:
authorpfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-14 04:17:50 +0000
committerpfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-14 04:17:50 +0000
commit491e151b35ecd1e75a0027acac50f01978de89c7 (patch)
tree4695b5ac648e0f19bfa0f1b8ba45e5e0e841f422 /skia/ext/convolver_unittest.cc
parent089102b95ffdb3bb6f43c6983d9e948230e1320e (diff)
downloadchromium_src-491e151b35ecd1e75a0027acac50f01978de89c7.zip
chromium_src-491e151b35ecd1e75a0027acac50f01978de89c7.tar.gz
chromium_src-491e151b35ecd1e75a0027acac50f01978de89c7.tar.bz2
Revert r187988 "Fix buffer overrun preventing SSE2 from being turned on for skia convolution." for breaking ASAN bots.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@188000 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'skia/ext/convolver_unittest.cc')
-rw-r--r--skia/ext/convolver_unittest.cc29
1 files changed, 10 insertions, 19 deletions
diff --git a/skia/ext/convolver_unittest.cc b/skia/ext/convolver_unittest.cc
index eca2bb0..f61b685 100644
--- a/skia/ext/convolver_unittest.cc
+++ b/skia/ext/convolver_unittest.cc
@@ -215,15 +215,7 @@ TEST(Convolver, SIMDVerification) {
base::CPU cpu;
if (!cpu.has_sse2()) return;
- int source_sizes[][2] = {
- {1,1}, {1,2}, {1,3}, {1,4},
- {2,1}, {2,2}, {2,3}, {2,4},
- {3,1}, {3,2}, {3,3}, {3,4},
- {4,1}, {4,2}, {4,3}, {4,4},
- {1920, 1080},
- {720, 480},
- {1377, 523},
- {325, 241} };
+ int source_sizes[][2] = { {1920, 1080}, {720, 480}, {1377, 523}, {325, 241} };
int dest_sizes[][2] = { {1280, 1024}, {480, 270}, {177, 123} };
float filter[] = { 0.05f, -0.15f, 0.6f, 0.6f, -0.15f, 0.05f };
@@ -234,23 +226,22 @@ TEST(Convolver, SIMDVerification) {
unsigned int source_width = source_sizes[i][0];
unsigned int source_height = source_sizes[i][1];
for (unsigned int j = 0; j < arraysize(dest_sizes); ++j) {
- unsigned int dest_width = dest_sizes[j][0];
- unsigned int dest_height = dest_sizes[j][1];
+ unsigned int dest_width = source_sizes[j][0];
+ unsigned int dest_height = source_sizes[j][1];
// Preparing convolve coefficients.
ConvolutionFilter1D x_filter, y_filter;
for (unsigned int p = 0; p < dest_width; ++p) {
unsigned int offset = source_width * p / dest_width;
- EXPECT_LT(offset, source_width);
- x_filter.AddFilter(offset, filter,
- std::min<int>(arraysize(filter),
- source_width - offset));
+ if (offset > source_width - arraysize(filter))
+ offset = source_width - arraysize(filter);
+ x_filter.AddFilter(offset, filter, arraysize(filter));
}
for (unsigned int p = 0; p < dest_height; ++p) {
unsigned int offset = source_height * p / dest_height;
- y_filter.AddFilter(offset, filter,
- std::min<int>(arraysize(filter),
- source_height - offset));
+ if (offset > source_height - arraysize(filter))
+ offset = source_height - arraysize(filter);
+ y_filter.AddFilter(offset, filter, arraysize(filter));
}
// Allocate input and output skia bitmap.
@@ -268,7 +259,7 @@ TEST(Convolver, SIMDVerification) {
// Randomize source bitmap for testing.
unsigned char* src_ptr = static_cast<unsigned char*>(source.getPixels());
for (int y = 0; y < source.height(); y++) {
- for (unsigned int x = 0; x < source.rowBytes(); x++)
+ for (int x = 0; x < source.rowBytes(); x++)
src_ptr[x] = rand() % 255;
src_ptr += source.rowBytes();
}