Commit c2ae6811 authored by Frank Barchard's avatar Frank Barchard

Fix for AVX2 crash in I420ToRGB24

I422ToRGB24 is implemented as a C wrapper for Intel, calling
I422ToARGB and ARGBToRGB24.  The ARGBToRGB24 for AVX2 requires 32
pixels.
This CL increases the width alignment required to use I422ToRGB24_AVX2

TBR=rrwinterton0gmail.com

Bug: libyuv:822, b:118386049
Change-Id: I4454f4eece33fbd5f593655f577c9ef5c00d1f63
Tested: locally tested with app that crashed using this function.
Reviewed-on: https://chromium-review.googlesource.com/c/1299931Reviewed-by: 's avatarFrank Barchard <fbarchard@chromium.org>
Commit-Queue: Frank Barchard <fbarchard@chromium.org>
parent 97ea700d
...@@ -284,9 +284,8 @@ extern "C" { ...@@ -284,9 +284,8 @@ extern "C" {
(defined(CLANG_HAS_AVX2) || defined(GCC_HAS_AVX2)) (defined(CLANG_HAS_AVX2) || defined(GCC_HAS_AVX2))
#define HAS_ABGRTOAR30ROW_AVX2 #define HAS_ABGRTOAR30ROW_AVX2
#define HAS_ARGBTOAR30ROW_AVX2 #define HAS_ARGBTOAR30ROW_AVX2
// Fix AVX2 b:118386049 segfault #define HAS_ARGBTORAWROW_AVX2
//#define HAS_ARGBTORAWROW_AVX2 #define HAS_ARGBTORGB24ROW_AVX2
//#define HAS_ARGBTORGB24ROW_AVX2
#define HAS_CONVERT16TO8ROW_AVX2 #define HAS_CONVERT16TO8ROW_AVX2
#define HAS_CONVERT8TO16ROW_AVX2 #define HAS_CONVERT8TO16ROW_AVX2
#define HAS_I210TOAR30ROW_AVX2 #define HAS_I210TOAR30ROW_AVX2
...@@ -304,8 +303,7 @@ extern "C" { ...@@ -304,8 +303,7 @@ extern "C" {
#if !defined(LIBYUV_DISABLE_X86) && \ #if !defined(LIBYUV_DISABLE_X86) && \
(defined(__x86_64__) || (defined(__i386__) && !defined(_MSC_VER))) && \ (defined(__x86_64__) || (defined(__i386__) && !defined(_MSC_VER))) && \
(defined(CLANG_HAS_AVX512)) (defined(CLANG_HAS_AVX512))
// Fix AVX2 b:118386049 segfault #define HAS_ARGBTORGB24ROW_AVX512VBMI
//#define HAS_ARGBTORGB24ROW_AVX512VBMI
#endif #endif
// The following are available on Neon platforms: // The following are available on Neon platforms:
......
...@@ -11,6 +11,6 @@ ...@@ -11,6 +11,6 @@
#ifndef INCLUDE_LIBYUV_VERSION_H_ #ifndef INCLUDE_LIBYUV_VERSION_H_
#define INCLUDE_LIBYUV_VERSION_H_ #define INCLUDE_LIBYUV_VERSION_H_
#define LIBYUV_VERSION 1722 #define LIBYUV_VERSION 1723
#endif // INCLUDE_LIBYUV_VERSION_H_ #endif // INCLUDE_LIBYUV_VERSION_H_
...@@ -670,7 +670,7 @@ static int I420ToRGB24Matrix(const uint8_t* src_y, ...@@ -670,7 +670,7 @@ static int I420ToRGB24Matrix(const uint8_t* src_y,
#if defined(HAS_I422TORGB24ROW_SSSE3) #if defined(HAS_I422TORGB24ROW_SSSE3)
if (TestCpuFlag(kCpuHasSSSE3)) { if (TestCpuFlag(kCpuHasSSSE3)) {
I422ToRGB24Row = I422ToRGB24Row_Any_SSSE3; I422ToRGB24Row = I422ToRGB24Row_Any_SSSE3;
if (IS_ALIGNED(width, 8)) { if (IS_ALIGNED(width, 16)) {
I422ToRGB24Row = I422ToRGB24Row_SSSE3; I422ToRGB24Row = I422ToRGB24Row_SSSE3;
} }
} }
...@@ -678,7 +678,7 @@ static int I420ToRGB24Matrix(const uint8_t* src_y, ...@@ -678,7 +678,7 @@ static int I420ToRGB24Matrix(const uint8_t* src_y,
#if defined(HAS_I422TORGB24ROW_AVX2) #if defined(HAS_I422TORGB24ROW_AVX2)
if (TestCpuFlag(kCpuHasAVX2)) { if (TestCpuFlag(kCpuHasAVX2)) {
I422ToRGB24Row = I422ToRGB24Row_Any_AVX2; I422ToRGB24Row = I422ToRGB24Row_Any_AVX2;
if (IS_ALIGNED(width, 16)) { if (IS_ALIGNED(width, 32)) {
I422ToRGB24Row = I422ToRGB24Row_AVX2; I422ToRGB24Row = I422ToRGB24Row_AVX2;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment