external libs, libwebp: apply two build fixes to source from mainstream
authorOzkan Sezer
Sun, 08 Dec 2019 22:10:50 +0300
changeset 7480f9c3eeabc11
parent 746 4d91bbdfbce2
child 749 ec1f8032810e
external libs, libwebp: apply two build fixes to source from mainstream

- prebuilt binaries not affected
external/libwebp-1.0.3/0002-libwebp.git-cf0e903c.patch
external/libwebp-1.0.3/0003-libwebp.git-b0e09e34.patch
external/libwebp-1.0.3/src/dsp/dec_neon.c
external/libwebp-1.0.3/src/dsp/lossless.c
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/external/libwebp-1.0.3/0002-libwebp.git-cf0e903c.patch	Sun Dec 08 22:10:50 2019 +0300
     1.3 @@ -0,0 +1,29 @@
     1.4 +From cf0e903c898b378365439b410c50dcde74573713 Mon Sep 17 00:00:00 2001
     1.5 +From: Oliver Wolff <oliver.wolff@qt.io>
     1.6 +Date: Wed, 27 Nov 2019 15:03:57 +0100
     1.7 +Subject: [PATCH] dsp/lossless: Fix non gcc ARM builds
     1.8 +
     1.9 +The workaround for GCC ARM must not be applied when another toolchain
    1.10 +(like MSVC) is used for the build.
    1.11 +
    1.12 +Change-Id: I11ec4558902063ccb085d3f435e24b3a60739dd5
    1.13 +---
    1.14 + src/dsp/lossless.c |    2 +-
    1.15 + 1 files changed, 1 insertions(+), 1 deletions(-)
    1.16 +
    1.17 +diff --git a/src/dsp/lossless.c b/src/dsp/lossless.c
    1.18 +index b2fbf17..aad5f43 100644
    1.19 +--- a/src/dsp/lossless.c
    1.20 ++++ b/src/dsp/lossless.c
    1.21 +@@ -81,7 +81,7 @@ static WEBP_INLINE uint32_t ClampedAddSubtractHalf(uint32_t c0, uint32_t c1,
    1.22 + 
    1.23 + // gcc <= 4.9 on ARM generates incorrect code in Select() when Sub3() is
    1.24 + // inlined.
    1.25 +-#if defined(__arm__) && LOCAL_GCC_VERSION <= 0x409
    1.26 ++#if defined(__arm__) && defined(__GNUC__) && LOCAL_GCC_VERSION <= 0x409
    1.27 + # define LOCAL_INLINE __attribute__ ((noinline))
    1.28 + #else
    1.29 + # define LOCAL_INLINE WEBP_INLINE
    1.30 +-- 
    1.31 +1.7.1
    1.32 +
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/external/libwebp-1.0.3/0003-libwebp.git-b0e09e34.patch	Sun Dec 08 22:10:50 2019 +0300
     2.3 @@ -0,0 +1,34 @@
     2.4 +From b0e09e346fd7b0befec5cd77b7ca3ae518447f1b Mon Sep 17 00:00:00 2001
     2.5 +From: Cheng Yi <cyi@google.com>
     2.6 +Date: Fri, 6 Dec 2019 01:08:21 +0000
     2.7 +Subject: [PATCH] dec_neon: Fix build failure under some toolchains
     2.8 +
     2.9 +some toolchains may implement vcreate_u64 as an assignment to a vector
    2.10 +causing a type mismatch:
    2.11 + invalid conversion between vector type 'uint64x1_t' (vector of 1
    2.12 +'uint64_t' value) and integer type 'unsigned int' of different size
    2.13 +  const uint64x1_t LKJI____ = vcreate_u64(L | (K << 8) | (J << 16) | (I << 24));
    2.14 +                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    2.15 +
    2.16 +Change-Id: I5c7b0076ad66d4b3fcdcb7ee9f59bbaa6f19b783
    2.17 +---
    2.18 + src/dsp/dec_neon.c |    3 ++-
    2.19 + 1 files changed, 2 insertions(+), 1 deletions(-)
    2.20 +
    2.21 +diff --git a/src/dsp/dec_neon.c b/src/dsp/dec_neon.c
    2.22 +index ffa697f..7d132af 100644
    2.23 +--- a/src/dsp/dec_neon.c
    2.24 ++++ b/src/dsp/dec_neon.c
    2.25 +@@ -1361,7 +1361,8 @@ static void RD4_NEON(uint8_t* dst) {   // Down-right
    2.26 +   const uint32_t J = dst[-1 + 1 * BPS];
    2.27 +   const uint32_t K = dst[-1 + 2 * BPS];
    2.28 +   const uint32_t L = dst[-1 + 3 * BPS];
    2.29 +-  const uint64x1_t LKJI____ = vcreate_u64(L | (K << 8) | (J << 16) | (I << 24));
    2.30 ++  const uint64x1_t LKJI____ =
    2.31 ++      vcreate_u64((uint64_t)L | (K << 8) | (J << 16) | (I << 24));
    2.32 +   const uint64x1_t LKJIXABC = vorr_u64(LKJI____, ____XABC);
    2.33 +   const uint8x8_t KJIXABC_ = vreinterpret_u8_u64(vshr_n_u64(LKJIXABC, 8));
    2.34 +   const uint8x8_t JIXABC__ = vreinterpret_u8_u64(vshr_n_u64(LKJIXABC, 16));
    2.35 +-- 
    2.36 +1.7.1
    2.37 +
     3.1 --- a/external/libwebp-1.0.3/src/dsp/dec_neon.c	Sun Dec 08 12:41:56 2019 +0300
     3.2 +++ b/external/libwebp-1.0.3/src/dsp/dec_neon.c	Sun Dec 08 22:10:50 2019 +0300
     3.3 @@ -1361,7 +1361,8 @@
     3.4    const uint32_t J = dst[-1 + 1 * BPS];
     3.5    const uint32_t K = dst[-1 + 2 * BPS];
     3.6    const uint32_t L = dst[-1 + 3 * BPS];
     3.7 -  const uint64x1_t LKJI____ = vcreate_u64(L | (K << 8) | (J << 16) | (I << 24));
     3.8 +  const uint64x1_t LKJI____ =
     3.9 +      vcreate_u64((uint64_t)L | (K << 8) | (J << 16) | (I << 24));
    3.10    const uint64x1_t LKJIXABC = vorr_u64(LKJI____, ____XABC);
    3.11    const uint8x8_t KJIXABC_ = vreinterpret_u8_u64(vshr_n_u64(LKJIXABC, 8));
    3.12    const uint8x8_t JIXABC__ = vreinterpret_u8_u64(vshr_n_u64(LKJIXABC, 16));
     4.1 --- a/external/libwebp-1.0.3/src/dsp/lossless.c	Sun Dec 08 12:41:56 2019 +0300
     4.2 +++ b/external/libwebp-1.0.3/src/dsp/lossless.c	Sun Dec 08 22:10:50 2019 +0300
     4.3 @@ -81,7 +81,7 @@
     4.4  
     4.5  // gcc <= 4.9 on ARM generates incorrect code in Select() when Sub3() is
     4.6  // inlined.
     4.7 -#if defined(__arm__) && LOCAL_GCC_VERSION <= 0x409
     4.8 +#if defined(__arm__) && defined(__GNUC__) && LOCAL_GCC_VERSION <= 0x409
     4.9  # define LOCAL_INLINE __attribute__ ((noinline))
    4.10  #else
    4.11  # define LOCAL_INLINE WEBP_INLINE