From 5f8858665b5d6e58c3d15d875001a3c2ad1e7b61 Mon Sep 17 00:00:00 2001 From: "fbarchard@google.com" Date: Tue, 12 Feb 2013 19:05:40 +0000 Subject: [PATCH] Box filter start from 0,0. Fixes crash that overreads horizontally. BUG=185 TEST=scale_test Review URL: https://webrtc-codereview.appspot.com/1094009 git-svn-id: http://libyuv.googlecode.com/svn/trunk@571 16f28f9a-4ce2-e073-06de-1de4eb20be90 --- README.chromium | 2 +- include/libyuv/row.h | 2 +- include/libyuv/version.h | 2 +- source/scale.cc | 6 ++++-- unit_test/scale_test.cc | 5 ++--- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/README.chromium b/README.chromium index 15f119fa9..d08c3f14a 100644 --- a/README.chromium +++ b/README.chromium @@ -1,6 +1,6 @@ Name: libyuv URL: http://code.google.com/p/libyuv/ -Version: 570 +Version: 571 License: BSD License File: LICENSE diff --git a/include/libyuv/row.h b/include/libyuv/row.h index 64589a72a..bd49d9323 100644 --- a/include/libyuv/row.h +++ b/include/libyuv/row.h @@ -245,7 +245,7 @@ extern "C" { #define HAS_ARGBCOLORMATRIXROW_NEON #define HAS_ARGBGRAYROW_NEON #define HAS_ARGBINTERPOLATEROW_NEON -//#define HAS_ARGBMULTIPLYROW_NEON +// #define HAS_ARGBMULTIPLYROW_NEON #define HAS_ARGBQUANTIZEROW_NEON #define HAS_ARGBSEPIAROW_NEON #define HAS_ARGBSHADEROW_NEON diff --git a/include/libyuv/version.h b/include/libyuv/version.h index 5a0f69d96..85d5c1667 100644 --- a/include/libyuv/version.h +++ b/include/libyuv/version.h @@ -11,6 +11,6 @@ #ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT #define INCLUDE_LIBYUV_VERSION_H_ -#define LIBYUV_VERSION 570 +#define LIBYUV_VERSION 571 #endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT diff --git a/source/scale.cc b/source/scale.cc index ebe3d95a8..b893b2409 100644 --- a/source/scale.cc +++ b/source/scale.cc @@ -3008,8 +3008,10 @@ static void ScalePlaneBox(int src_width, int src_height, assert(dst_height > 0); int dx = (src_width << 16) / dst_width; int dy = (src_height << 16) / dst_height; - int x = (dx >= 65536) ? ((dx >> 1) - 32768) : (dx >> 1); - int y = (dy >= 65536) ? ((dy >> 1) - 32768) : (dy >> 1); +// int x = (dx >= 65536) ? ((dx >> 1) - 32768) : (dx >> 1); +// int y = (dy >= 65536) ? ((dy >> 1) - 32768) : (dy >> 1); + int x = 0; + int y = 0; int maxy = (src_height << 16); if (!IS_ALIGNED(src_width, 16) || (src_width > kMaxInputWidth) || dst_height * 2 > src_height) { diff --git a/unit_test/scale_test.cc b/unit_test/scale_test.cc index 43588229c..a8c66826a 100644 --- a/unit_test/scale_test.cc +++ b/unit_test/scale_test.cc @@ -304,8 +304,7 @@ TEST_F(libyuvTest, ScaleDownBy8_Bilinear) { EXPECT_LE(max_diff, 1); } -// TODO(fbarchard): Fix bug. Re-enable. -TEST_F(libyuvTest, DISABLED_ScaleDownBy8_Box) { +TEST_F(libyuvTest, ScaleDownBy8_Box) { const int src_width = benchmark_width_; const int src_height = benchmark_height_; const int dst_width = src_width / 8; @@ -344,7 +343,7 @@ TEST_F(libyuvTest, ScaleDownBy16_Bilinear) { EXPECT_LE(max_diff, 1); } -TEST_F(libyuvTest, DISABLED_ScaleDownBy16_Box) { +TEST_F(libyuvTest, ScaleDownBy16_Box) { const int src_width = benchmark_width_; const int src_height = benchmark_height_; const int dst_width = src_width / 16;