From 8c196f4d4ce0fc806f0c3543212a50c04d0296b2 Mon Sep 17 00:00:00 2001 From: Frank Barchard Date: Tue, 19 Jan 2016 16:16:39 -0800 Subject: [PATCH] Fix testi420 unittest for odd height When the image height for unittests was set to an odd height, the TestI420 unittest would not fill the complete source buffer. This change handles the odd height test case. No change to library code. TBR=harryjin@google.com BUG=libyuv:549 Review URL: https://codereview.chromium.org/1609103002 . --- README.chromium | 2 +- include/libyuv/version.h | 2 +- unit_test/color_test.cc | 14 +++++++++++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/README.chromium b/README.chromium index 88cf8a4c5..ef7e16311 100644 --- a/README.chromium +++ b/README.chromium @@ -1,6 +1,6 @@ Name: libyuv URL: http://code.google.com/p/libyuv/ -Version: 1567 +Version: 1568 License: BSD License File: LICENSE diff --git a/include/libyuv/version.h b/include/libyuv/version.h index 39ba1d06f..45950d447 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 1567 +#define LIBYUV_VERSION 1568 #endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT diff --git a/unit_test/color_test.cc b/unit_test/color_test.cc index 8bc324dcd..555413f79 100644 --- a/unit_test/color_test.cc +++ b/unit_test/color_test.cc @@ -81,7 +81,19 @@ namespace libyuv { } \ p += HN; \ } \ - \ + if ((benchmark_height_ & 1) && HS == 2) { \ + for (int x = 0; x < benchmark_width_ - 1; x += 2) { \ + uint8 r = static_cast(fastrand()); \ + p[0] = r; \ + p[1] = r; \ + p += 2; \ + } \ + if (benchmark_width_ & 1) { \ + uint8 r = static_cast(fastrand()); \ + p[0] = r; \ + p += 1; \ + } \ + } \ /* Start with YUV converted to ARGB. */ \ YUVTOARGB(orig_y, benchmark_width_, \ orig_u, (benchmark_width_ + 1) / 2, \