mirror of
https://github.com/webmproject/libwebp.git
synced 2024-11-20 04:18:26 +01:00
enable NEON intrinsics in aarch64 builds
avoids functions that use vtbl? as in iOS builds these are marked unavailable Change-Id: I17aedc3c7dc8f1d5be0941205de0b22c3772ef1b
This commit is contained in:
parent
b9d2bb67d6
commit
1ba61b09f9
@ -44,8 +44,7 @@ extern "C" {
|
|||||||
#define WEBP_ANDROID_NEON // Android targets that might support NEON
|
#define WEBP_ANDROID_NEON // Android targets that might support NEON
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (defined(__ARM_NEON__) && !defined(__aarch64__)) || \
|
#if defined(__ARM_NEON__) || defined(WEBP_ANDROID_NEON)
|
||||||
defined(WEBP_ANDROID_NEON)
|
|
||||||
#define WEBP_USE_NEON
|
#define WEBP_USE_NEON
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -967,7 +967,9 @@ static int SSE4x4(const uint8_t* a, const uint8_t* b) {
|
|||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
#if !defined(WORK_AROUND_GCC)
|
// Compilation with gcc-4.6.x is problematic for now and vtbl? are unavailable
|
||||||
|
// in iOS/arm64 builds. Disable this function in those cases.
|
||||||
|
#if !(defined(WORK_AROUND_GCC) || defined(__aarch64__))
|
||||||
|
|
||||||
static int16x8_t Quantize(int16_t* const in,
|
static int16x8_t Quantize(int16_t* const in,
|
||||||
const VP8Matrix* const mtx, int offset) {
|
const VP8Matrix* const mtx, int offset) {
|
||||||
@ -1025,7 +1027,7 @@ static int QuantizeBlock(int16_t in[16], int16_t out[16],
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // !WORK_AROUND_GCC
|
#endif // !WORK_AROUND_GCC && !__aarch64__
|
||||||
|
|
||||||
#endif // WEBP_USE_NEON
|
#endif // WEBP_USE_NEON
|
||||||
|
|
||||||
@ -1048,7 +1050,7 @@ void VP8EncDspInitNEON(void) {
|
|||||||
VP8SSE16x8 = SSE16x8;
|
VP8SSE16x8 = SSE16x8;
|
||||||
VP8SSE8x8 = SSE8x8;
|
VP8SSE8x8 = SSE8x8;
|
||||||
VP8SSE4x4 = SSE4x4;
|
VP8SSE4x4 = SSE4x4;
|
||||||
#if !defined(WORK_AROUND_GCC)
|
#if !(defined(WORK_AROUND_GCC) || defined(__aarch64__))
|
||||||
VP8EncQuantizeBlock = QuantizeBlock;
|
VP8EncQuantizeBlock = QuantizeBlock;
|
||||||
#endif
|
#endif
|
||||||
#endif // WEBP_USE_NEON
|
#endif // WEBP_USE_NEON
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// Colorspace conversion functions
|
// Colorspace conversion functions
|
||||||
|
|
||||||
#if LOCAL_GCC_PREREQ(4,8)
|
#if !defined(WORK_AROUND_GCC)
|
||||||
// gcc 4.6.0 had some trouble (NDK-r9) with this code. We only use it for
|
// gcc 4.6.0 had some trouble (NDK-r9) with this code. We only use it for
|
||||||
// gcc-4.8.x at least.
|
// gcc-4.8.x at least.
|
||||||
static void ConvertBGRAToRGBA(const uint32_t* src,
|
static void ConvertBGRAToRGBA(const uint32_t* src,
|
||||||
@ -65,7 +65,7 @@ static void ConvertBGRAToRGB(const uint32_t* src,
|
|||||||
VP8LConvertBGRAToRGB_C(src, num_pixels & 15, dst); // left-overs
|
VP8LConvertBGRAToRGB_C(src, num_pixels & 15, dst); // left-overs
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else // WORK_AROUND_GCC
|
||||||
|
|
||||||
// gcc-4.6.0 fallback
|
// gcc-4.6.0 fallback
|
||||||
|
|
||||||
@ -135,7 +135,7 @@ static void ConvertBGRAToRGB(const uint32_t* src,
|
|||||||
VP8LConvertBGRAToRGB_C(src, num_pixels & 7, dst); // left-overs
|
VP8LConvertBGRAToRGB_C(src, num_pixels & 7, dst); // left-overs
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // gcc-4.8
|
#endif // !WORK_AROUND_GCC
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -263,6 +263,9 @@ static uint32_t Predictor13(uint32_t left, const uint32_t* const top) {
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// Subtract-Green Transform
|
// Subtract-Green Transform
|
||||||
|
|
||||||
|
// vtbl? are unavailable in iOS/arm64 builds.
|
||||||
|
#if !defined(__aarch64__)
|
||||||
|
|
||||||
// 255 = byte will be zero'd
|
// 255 = byte will be zero'd
|
||||||
static const uint8_t kGreenShuffle[8] = { 1, 255, 1, 255, 5, 255, 5, 255 };
|
static const uint8_t kGreenShuffle[8] = { 1, 255, 1, 255, 5, 255, 5, 255 };
|
||||||
|
|
||||||
@ -294,6 +297,8 @@ static void AddGreenToBlueAndRed(uint32_t* argb_data, int num_pixels) {
|
|||||||
VP8LAddGreenToBlueAndRed_C(argb_data, num_pixels & 3);
|
VP8LAddGreenToBlueAndRed_C(argb_data, num_pixels & 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // !__aarch64__
|
||||||
|
|
||||||
#endif // USE_INTRINSICS
|
#endif // USE_INTRINSICS
|
||||||
|
|
||||||
#endif // WEBP_USE_NEON
|
#endif // WEBP_USE_NEON
|
||||||
@ -319,9 +324,11 @@ void VP8LDspInitNEON(void) {
|
|||||||
VP8LPredictors[12] = Predictor12;
|
VP8LPredictors[12] = Predictor12;
|
||||||
VP8LPredictors[13] = Predictor13;
|
VP8LPredictors[13] = Predictor13;
|
||||||
|
|
||||||
|
#if !defined(__aarch64__)
|
||||||
VP8LSubtractGreenFromBlueAndRed = SubtractGreenFromBlueAndRed;
|
VP8LSubtractGreenFromBlueAndRed = SubtractGreenFromBlueAndRed;
|
||||||
VP8LAddGreenToBlueAndRed = AddGreenToBlueAndRed;
|
VP8LAddGreenToBlueAndRed = AddGreenToBlueAndRed;
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // WEBP_USE_NEON
|
#endif // WEBP_USE_NEON
|
||||||
}
|
}
|
||||||
|
@ -16,12 +16,16 @@
|
|||||||
|
|
||||||
#include "./dsp.h"
|
#include "./dsp.h"
|
||||||
|
|
||||||
// #define USE_INTRINSICS // use intrinsics when possible
|
// Right now, some intrinsics functions seem slower, so we disable them
|
||||||
|
// everywhere except aarch64 where the inline assembly is incompatible.
|
||||||
|
#if defined(__aarch64__)
|
||||||
|
#define USE_INTRINSICS // use intrinsics when possible
|
||||||
|
#endif
|
||||||
|
|
||||||
// if using intrinsics, this flag avoids some functions that make gcc-4.6.3
|
// if using intrinsics, this flag avoids some functions that make gcc-4.6.3
|
||||||
// crash ("internal compiler error: in immed_double_const, at emit-rtl.").
|
// crash ("internal compiler error: in immed_double_const, at emit-rtl.").
|
||||||
// (probably similar to gcc.gnu.org/bugzilla/show_bug.cgi?id=48183)
|
// (probably similar to gcc.gnu.org/bugzilla/show_bug.cgi?id=48183)
|
||||||
#if !LOCAL_GCC_PREREQ(4,8)
|
#if !(LOCAL_GCC_PREREQ(4,8) || defined(__aarch64__))
|
||||||
#define WORK_AROUND_GCC
|
#define WORK_AROUND_GCC
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user