mirror of
https://github.com/webmproject/libwebp.git
synced 2025-07-13 14:34:33 +02:00
configure.ac: add AC_C_BIGENDIAN
this defines WORDS_BIGENDIAN, replacing uses of __BIG_ENDIAN__/__BYTE_ORDER__ with it + fixes lossless BGRA output with big-endian toolchains that do not define __BIG_ENDIAN__ (codesourcery mips gcc) Change-Id: Ieaccd623292d235343b5e34b7a720fc251c432d7
This commit is contained in:
@ -1360,7 +1360,7 @@ static void CopyOrSwap(const uint32_t* src, int num_pixels, uint8_t* dst,
|
||||
while (src < src_end) {
|
||||
const uint32_t argb = *src++;
|
||||
|
||||
#if !defined(__BIG_ENDIAN__)
|
||||
#if !defined(WORDS_BIGENDIAN)
|
||||
#if !defined(WEBP_REFERENCE_IMPLEMENTATION)
|
||||
*(uint32_t*)dst = BSwap32(argb);
|
||||
#else // WEBP_REFERENCE_IMPLEMENTATION
|
||||
@ -1369,7 +1369,7 @@ 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 // __BIG_ENDIAN__
|
||||
#else // WORDS_BIGENDIAN
|
||||
dst[0] = (argb >> 0) & 0xff;
|
||||
dst[1] = (argb >> 8) & 0xff;
|
||||
dst[2] = (argb >> 16) & 0xff;
|
||||
|
@ -70,7 +70,7 @@ static WEBP_INLINE void VP8LoadNewBytes(VP8BitReader* const br) {
|
||||
const lbit_t in_bits = *(const lbit_t*)br->buf_;
|
||||
#endif
|
||||
br->buf_ += BITS >> 3;
|
||||
#if !defined(__BIG_ENDIAN__)
|
||||
#if !defined(WORDS_BIGENDIAN)
|
||||
#if (BITS > 32)
|
||||
bits = BSwap64(in_bits);
|
||||
bits >>= 64 - BITS;
|
||||
@ -83,7 +83,7 @@ static WEBP_INLINE void VP8LoadNewBytes(VP8BitReader* const br) {
|
||||
#else // BITS == 8
|
||||
bits = (bit_t)in_bits;
|
||||
#endif // BITS > 32
|
||||
#else // BIG_ENDIAN
|
||||
#else // WORDS_BIGENDIAN
|
||||
bits = (bit_t)in_bits;
|
||||
if (BITS != 8 * sizeof(bit_t)) bits >>= (8 * sizeof(bit_t) - BITS);
|
||||
#endif
|
||||
|
@ -12,12 +12,17 @@
|
||||
#ifndef WEBP_UTILS_ENDIAN_INL_H_
|
||||
#define WEBP_UTILS_ENDIAN_INL_H_
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "../webp/config.h"
|
||||
#endif
|
||||
|
||||
#include "../webp/types.h"
|
||||
|
||||
// some endian fix (e.g.: mips-gcc doesn't define __BIG_ENDIAN__)
|
||||
#if !defined(__BIG_ENDIAN__) && defined(__BYTE_ORDER__) && \
|
||||
(__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
|
||||
#define __BIG_ENDIAN__
|
||||
#if !defined(WORDS_BIGENDIAN) && \
|
||||
(defined(__BIG_ENDIAN__) || \
|
||||
(defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)))
|
||||
#define WORDS_BIGENDIAN
|
||||
#endif
|
||||
|
||||
// endian-specific htoleXX() definition
|
||||
|
Reference in New Issue
Block a user