mirror of
https://github.com/webmproject/libwebp.git
synced 2024-11-20 04:18:26 +01:00
webp/lossless: fix big endian BGRA output
Change-Id: I3d4b3d21f561cb526dbe7697a31ea847d3e8b2c1
(cherry picked from commit 2ca83968ae
)
This commit is contained in:
parent
f036d4bfa6
commit
7bb28d2a55
@ -1279,11 +1279,12 @@ static void CopyOrSwap(const uint32_t* src, int num_pixels, uint8_t* dst,
|
|||||||
while (src < src_end) {
|
while (src < src_end) {
|
||||||
uint32_t argb = *src++;
|
uint32_t argb = *src++;
|
||||||
|
|
||||||
|
#if !defined(__BIG_ENDIAN__)
|
||||||
#if !defined(WEBP_REFERENCE_IMPLEMENTATION)
|
#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));
|
__asm__ volatile("bswap %0" : "=r"(argb) : "0"(argb));
|
||||||
*(uint32_t*)dst = argb;
|
*(uint32_t*)dst = argb;
|
||||||
#elif !defined(__BIG_ENDIAN__) && defined(_MSC_VER)
|
#elif defined(_MSC_VER)
|
||||||
argb = _byteswap_ulong(argb);
|
argb = _byteswap_ulong(argb);
|
||||||
*(uint32_t*)dst = argb;
|
*(uint32_t*)dst = argb;
|
||||||
#else
|
#else
|
||||||
@ -1292,11 +1293,17 @@ static void CopyOrSwap(const uint32_t* src, int num_pixels, uint8_t* dst,
|
|||||||
dst[2] = (argb >> 8) & 0xff;
|
dst[2] = (argb >> 8) & 0xff;
|
||||||
dst[3] = (argb >> 0) & 0xff;
|
dst[3] = (argb >> 0) & 0xff;
|
||||||
#endif
|
#endif
|
||||||
#else // WEBP_REFERENCE_IMPLEMENTATION
|
#else // WEBP_REFERENCE_IMPLEMENTATION
|
||||||
dst[0] = (argb >> 24) & 0xff;
|
dst[0] = (argb >> 24) & 0xff;
|
||||||
dst[1] = (argb >> 16) & 0xff;
|
dst[1] = (argb >> 16) & 0xff;
|
||||||
dst[2] = (argb >> 8) & 0xff;
|
dst[2] = (argb >> 8) & 0xff;
|
||||||
dst[3] = (argb >> 0) & 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
|
#endif
|
||||||
dst += sizeof(argb);
|
dst += sizeof(argb);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user