Merge "webp/lossless: fix big endian BGRA output"

This commit is contained in:
pascal massimino 2013-05-17 00:36:15 -07:00 committed by Gerrit Code Review
commit 2d6ac422cf

View File

@ -1279,11 +1279,12 @@ static void CopyOrSwap(const uint32_t* src, int num_pixels, uint8_t* dst,
while (src < src_end) {
uint32_t argb = *src++;
#if !defined(__BIG_ENDIAN__)
#if !defined(WEBP_REFERENCE_IMPLEMENTATION)
#if !defined(__BIG_ENDIAN__) && (defined(__i386__) || defined(__x86_64__))
#if defined(__i386__) || defined(__x86_64__)
__asm__ volatile("bswap %0" : "=r"(argb) : "0"(argb));
*(uint32_t*)dst = argb;
#elif !defined(__BIG_ENDIAN__) && defined(_MSC_VER)
#elif defined(_MSC_VER)
argb = _byteswap_ulong(argb);
*(uint32_t*)dst = argb;
#else
@ -1292,11 +1293,17 @@ static void CopyOrSwap(const uint32_t* src, int num_pixels, uint8_t* dst,
dst[2] = (argb >> 8) & 0xff;
dst[3] = (argb >> 0) & 0xff;
#endif
#else // WEBP_REFERENCE_IMPLEMENTATION
#else // WEBP_REFERENCE_IMPLEMENTATION
dst[0] = (argb >> 24) & 0xff;
dst[1] = (argb >> 16) & 0xff;
dst[2] = (argb >> 8) & 0xff;
dst[3] = (argb >> 0) & 0xff;
#endif
#else // __BIG_ENDIAN__
dst[0] = (argb >> 0) & 0xff;
dst[1] = (argb >> 8) & 0xff;
dst[2] = (argb >> 16) & 0xff;
dst[3] = (argb >> 24) & 0xff;
#endif
dst += sizeof(argb);
}