From b1fb8721cbab54aba5383823c4d932cf2978dd4d Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Sun, 8 Dec 2019 22:10:02 +0300 Subject: [PATCH] external libs, libwebp: apply two build fixes to source from mainstream - prebuilt binaries not affected --- .../0002-libwebp.git-cf0e903c.patch | 29 ++++++++++++++++ .../0003-libwebp.git-b0e09e34.patch | 34 +++++++++++++++++++ external/libwebp-1.0.3/src/dsp/dec_neon.c | 3 +- external/libwebp-1.0.3/src/dsp/lossless.c | 2 +- 4 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 external/libwebp-1.0.3/0002-libwebp.git-cf0e903c.patch create mode 100644 external/libwebp-1.0.3/0003-libwebp.git-b0e09e34.patch diff --git a/external/libwebp-1.0.3/0002-libwebp.git-cf0e903c.patch b/external/libwebp-1.0.3/0002-libwebp.git-cf0e903c.patch new file mode 100644 index 00000000..063ef56b --- /dev/null +++ b/external/libwebp-1.0.3/0002-libwebp.git-cf0e903c.patch @@ -0,0 +1,29 @@ +From cf0e903c898b378365439b410c50dcde74573713 Mon Sep 17 00:00:00 2001 +From: Oliver Wolff +Date: Wed, 27 Nov 2019 15:03:57 +0100 +Subject: [PATCH] dsp/lossless: Fix non gcc ARM builds + +The workaround for GCC ARM must not be applied when another toolchain +(like MSVC) is used for the build. + +Change-Id: I11ec4558902063ccb085d3f435e24b3a60739dd5 +--- + src/dsp/lossless.c | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/src/dsp/lossless.c b/src/dsp/lossless.c +index b2fbf17..aad5f43 100644 +--- a/src/dsp/lossless.c ++++ b/src/dsp/lossless.c +@@ -81,7 +81,7 @@ static WEBP_INLINE uint32_t ClampedAddSubtractHalf(uint32_t c0, uint32_t c1, + + // gcc <= 4.9 on ARM generates incorrect code in Select() when Sub3() is + // inlined. +-#if defined(__arm__) && LOCAL_GCC_VERSION <= 0x409 ++#if defined(__arm__) && defined(__GNUC__) && LOCAL_GCC_VERSION <= 0x409 + # define LOCAL_INLINE __attribute__ ((noinline)) + #else + # define LOCAL_INLINE WEBP_INLINE +-- +1.7.1 + diff --git a/external/libwebp-1.0.3/0003-libwebp.git-b0e09e34.patch b/external/libwebp-1.0.3/0003-libwebp.git-b0e09e34.patch new file mode 100644 index 00000000..71e42853 --- /dev/null +++ b/external/libwebp-1.0.3/0003-libwebp.git-b0e09e34.patch @@ -0,0 +1,34 @@ +From b0e09e346fd7b0befec5cd77b7ca3ae518447f1b Mon Sep 17 00:00:00 2001 +From: Cheng Yi +Date: Fri, 6 Dec 2019 01:08:21 +0000 +Subject: [PATCH] dec_neon: Fix build failure under some toolchains + +some toolchains may implement vcreate_u64 as an assignment to a vector +causing a type mismatch: + invalid conversion between vector type 'uint64x1_t' (vector of 1 +'uint64_t' value) and integer type 'unsigned int' of different size + const uint64x1_t LKJI____ = vcreate_u64(L | (K << 8) | (J << 16) | (I << 24)); + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Change-Id: I5c7b0076ad66d4b3fcdcb7ee9f59bbaa6f19b783 +--- + src/dsp/dec_neon.c | 3 ++- + 1 files changed, 2 insertions(+), 1 deletions(-) + +diff --git a/src/dsp/dec_neon.c b/src/dsp/dec_neon.c +index ffa697f..7d132af 100644 +--- a/src/dsp/dec_neon.c ++++ b/src/dsp/dec_neon.c +@@ -1361,7 +1361,8 @@ static void RD4_NEON(uint8_t* dst) { // Down-right + const uint32_t J = dst[-1 + 1 * BPS]; + const uint32_t K = dst[-1 + 2 * BPS]; + const uint32_t L = dst[-1 + 3 * BPS]; +- const uint64x1_t LKJI____ = vcreate_u64(L | (K << 8) | (J << 16) | (I << 24)); ++ const uint64x1_t LKJI____ = ++ vcreate_u64((uint64_t)L | (K << 8) | (J << 16) | (I << 24)); + const uint64x1_t LKJIXABC = vorr_u64(LKJI____, ____XABC); + const uint8x8_t KJIXABC_ = vreinterpret_u8_u64(vshr_n_u64(LKJIXABC, 8)); + const uint8x8_t JIXABC__ = vreinterpret_u8_u64(vshr_n_u64(LKJIXABC, 16)); +-- +1.7.1 + diff --git a/external/libwebp-1.0.3/src/dsp/dec_neon.c b/external/libwebp-1.0.3/src/dsp/dec_neon.c index ffa697fc..7d132afd 100644 --- a/external/libwebp-1.0.3/src/dsp/dec_neon.c +++ b/external/libwebp-1.0.3/src/dsp/dec_neon.c @@ -1361,7 +1361,8 @@ static void RD4_NEON(uint8_t* dst) { // Down-right const uint32_t J = dst[-1 + 1 * BPS]; const uint32_t K = dst[-1 + 2 * BPS]; const uint32_t L = dst[-1 + 3 * BPS]; - const uint64x1_t LKJI____ = vcreate_u64(L | (K << 8) | (J << 16) | (I << 24)); + const uint64x1_t LKJI____ = + vcreate_u64((uint64_t)L | (K << 8) | (J << 16) | (I << 24)); const uint64x1_t LKJIXABC = vorr_u64(LKJI____, ____XABC); const uint8x8_t KJIXABC_ = vreinterpret_u8_u64(vshr_n_u64(LKJIXABC, 8)); const uint8x8_t JIXABC__ = vreinterpret_u8_u64(vshr_n_u64(LKJIXABC, 16)); diff --git a/external/libwebp-1.0.3/src/dsp/lossless.c b/external/libwebp-1.0.3/src/dsp/lossless.c index d05af84e..73b357b2 100644 --- a/external/libwebp-1.0.3/src/dsp/lossless.c +++ b/external/libwebp-1.0.3/src/dsp/lossless.c @@ -81,7 +81,7 @@ static WEBP_INLINE uint32_t ClampedAddSubtractHalf(uint32_t c0, uint32_t c1, // gcc <= 4.9 on ARM generates incorrect code in Select() when Sub3() is // inlined. -#if defined(__arm__) && LOCAL_GCC_VERSION <= 0x409 +#if defined(__arm__) && defined(__GNUC__) && LOCAL_GCC_VERSION <= 0x409 # define LOCAL_INLINE __attribute__ ((noinline)) #else # define LOCAL_INLINE WEBP_INLINE