From d53f1beecdd8d959f7a3f2e19bd0bd7e7227a233 Mon Sep 17 00:00:00 2001 From: Frank Barchard Date: Thu, 4 Aug 2022 14:38:13 -0700 Subject: [PATCH] RAWToJ400 require multiple of 16 pixels for NEON - fix crash when width is not a multiple of 16 - apply clang format - bump version Bug: libyuv:940, b/240094327 Change-Id: Ic18e5b7b64f78f26e8b7d8440bf490a679bda200 Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/3812594 Reviewed-by: Wan-Teh Chang --- README.chromium | 2 +- include/libyuv/scale_row.h | 8 ++++---- include/libyuv/version.h | 2 +- source/convert.cc | 6 ++++-- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/README.chromium b/README.chromium index d60ff00bd..3f68e21e3 100644 --- a/README.chromium +++ b/README.chromium @@ -1,6 +1,6 @@ Name: libyuv URL: http://code.google.com/p/libyuv/ -Version: 1834 +Version: 1837 License: BSD License File: LICENSE diff --git a/include/libyuv/scale_row.h b/include/libyuv/scale_row.h index 6be212985..6cb5e1284 100644 --- a/include/libyuv/scale_row.h +++ b/include/libyuv/scale_row.h @@ -693,10 +693,10 @@ void ScaleRowUp2_Linear_16_Any_SSE2(const uint16_t* src_ptr, uint16_t* dst_ptr, int dst_width); void ScaleRowUp2_Bilinear_16_Any_SSE2(const uint16_t* src_ptr, - ptrdiff_t src_stride, - uint16_t* dst_ptr, - ptrdiff_t dst_stride, - int dst_width); + ptrdiff_t src_stride, + uint16_t* dst_ptr, + ptrdiff_t dst_stride, + int dst_width); void ScaleRowUp2_Linear_Any_SSSE3(const uint8_t* src_ptr, uint8_t* dst_ptr, int dst_width); diff --git a/include/libyuv/version.h b/include/libyuv/version.h index eda5078bc..a85be0483 100644 --- a/include/libyuv/version.h +++ b/include/libyuv/version.h @@ -11,6 +11,6 @@ #ifndef INCLUDE_LIBYUV_VERSION_H_ #define INCLUDE_LIBYUV_VERSION_H_ -#define LIBYUV_VERSION 1834 +#define LIBYUV_VERSION 1837 #endif // INCLUDE_LIBYUV_VERSION_H_ diff --git a/source/convert.cc b/source/convert.cc index 162546e5b..7178580f3 100644 --- a/source/convert.cc +++ b/source/convert.cc @@ -1641,7 +1641,7 @@ int BGRAToI420(const uint8_t* src_bgra, #if defined(HAS_BGRATOYROW_NEON) if (TestCpuFlag(kCpuHasNEON)) { BGRAToYRow = BGRAToYRow_Any_NEON; - if (IS_ALIGNED(width, 8)) { + if (IS_ALIGNED(width, 16)) { BGRAToYRow = BGRAToYRow_NEON; } } @@ -3190,6 +3190,7 @@ int RAWToJ400(const uint8_t* src_raw, if (!src_raw || !dst_yj || width <= 0 || height == 0) { return -1; } + if (height < 0) { height = -height; src_raw = src_raw + (height - 1) * src_stride_raw; @@ -3201,6 +3202,7 @@ int RAWToJ400(const uint8_t* src_raw, height = 1; src_stride_raw = dst_stride_yj = 0; } + #if defined(HAS_RAWTOYJROW_SSSE3) if (TestCpuFlag(kCpuHasSSSE3)) { RAWToYJRow = RAWToYJRow_Any_SSSE3; @@ -3220,7 +3222,7 @@ int RAWToJ400(const uint8_t* src_raw, #if defined(HAS_RAWTOYJROW_NEON) if (TestCpuFlag(kCpuHasNEON)) { RAWToYJRow = RAWToYJRow_Any_NEON; - if (IS_ALIGNED(width, 8)) { + if (IS_ALIGNED(width, 16)) { RAWToYJRow = RAWToYJRow_NEON; } }