dsp/lossless: workaround gcc-4.9 bug on arm

force Sub3() to not be inlined, otherwise the code in Select() will be
incorrect.
https://android-review.googlesource.com/#/c/102511

(cherry picked from commit 637b388809)

Change-Id: I90ae58bf3e6cc92ca9897f69974733d562e29aaf
This commit is contained in:
James Zern 2014-07-17 17:48:42 -07:00
parent 5af7719047
commit 23d4fb3362

View File

@ -450,12 +450,21 @@ static WEBP_INLINE uint32_t ClampedAddSubtractHalf(uint32_t c0, uint32_t c1,
return ((uint32_t)a << 24) | (r << 16) | (g << 8) | b; return ((uint32_t)a << 24) | (r << 16) | (g << 8) | b;
} }
static WEBP_INLINE int Sub3(int a, int b, int c) { // gcc-4.9 on ARM generates incorrect code in Select() when Sub3() is inlined.
#if defined(__arm__) && LOCAL_GCC_VERSION == 0x409
# define LOCAL_INLINE __attribute__ ((noinline))
#else
# define LOCAL_INLINE WEBP_INLINE
#endif
static LOCAL_INLINE int Sub3(int a, int b, int c) {
const int pb = b - c; const int pb = b - c;
const int pa = a - c; const int pa = a - c;
return abs(pb) - abs(pa); return abs(pb) - abs(pa);
} }
#undef LOCAL_INLINE
static WEBP_INLINE uint32_t Select(uint32_t a, uint32_t b, uint32_t c) { static WEBP_INLINE uint32_t Select(uint32_t a, uint32_t b, uint32_t c) {
const int pa_minus_pb = const int pa_minus_pb =
Sub3((a >> 24) , (b >> 24) , (c >> 24) ) + Sub3((a >> 24) , (b >> 24) , (c >> 24) ) +