From cae07fb0e03b4419f7768dab9a191f1499bdaa6e Mon Sep 17 00:00:00 2001 From: Frank Barchard Date: Fri, 12 Jun 2015 15:25:03 -0700 Subject: [PATCH] bump subsampling up BUG=455 TESTED=libyuvTest.ARGBToYUY2_Random R=harryjin@google.com Review URL: https://webrtc-codereview.appspot.com/58419004. --- README.chromium | 2 +- include/libyuv/version.h | 2 +- source/row_any.cc | 9 ++++++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/README.chromium b/README.chromium index 7efba60eb..a3d5e4167 100644 --- a/README.chromium +++ b/README.chromium @@ -1,6 +1,6 @@ Name: libyuv URL: http://code.google.com/p/libyuv/ -Version: 1420 +Version: 1433 License: BSD License File: LICENSE diff --git a/include/libyuv/version.h b/include/libyuv/version.h index 9b4357258..623ba2a64 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 1420 +#define LIBYUV_VERSION 1433 #endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT diff --git a/source/row_any.cc b/source/row_any.cc index d4af1fc96..1946e8ca8 100644 --- a/source/row_any.cc +++ b/source/row_any.cc @@ -20,6 +20,9 @@ namespace libyuv { extern "C" { #endif +// Subsampling source needs to be increase by 1 of not even. +#define SS(width, shift) ((width) + (1 << shift) - 1) >> shift + // YUV to RGB does multiple of 8 with SIMD and remainder with C. #define YANY(NAMEANY, I420TORGB_SIMD, UVSHIFT, BPP, MASK) \ void NAMEANY(const uint8* y_buf, const uint8* u_buf, const uint8* v_buf, \ @@ -30,10 +33,10 @@ extern "C" { } \ if (width & MASK) { \ SIMD_ALIGNED(uint8 temp[64 * 4]); \ - memset(temp, 0, 64 * 4); \ + memset(temp, 0, 64 * 4); /* for valgrind */ \ memcpy(temp, y_buf + n, width & MASK); \ - memcpy(temp + 64, u_buf + (n >> UVSHIFT), (width & MASK) >> UVSHIFT); \ - memcpy(temp + 128, v_buf + (n >> UVSHIFT), (width & MASK) >> UVSHIFT); \ + memcpy(temp + 64, u_buf + (n >> UVSHIFT), SS(width & MASK, UVSHIFT)); \ + memcpy(temp + 128, v_buf + (n >> UVSHIFT), SS(width & MASK, UVSHIFT)); \ I420TORGB_SIMD(temp, temp + 64, temp + 128, temp + 192, MASK + 1); \ memcpy(rgb_buf + n * BPP, temp + 192, (width & MASK) * BPP); \ } \