mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
Rearrange AV_[RW][BL]*() macros
Originally committed as revision 14265 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
7c5ea40ca4
commit
fbbea48eb3
@ -63,12 +63,36 @@ struct unaligned_16 { uint16_t l; } __attribute__((packed));
|
||||
|
||||
# define AV_RL16(x) bswap_16(AV_RN16(x))
|
||||
# define AV_WL16(p, d) AV_WN16(p, bswap_16(d))
|
||||
|
||||
# define AV_RB32(x) AV_RN32(x)
|
||||
# define AV_WB32(p, d) AV_WN32(p, d)
|
||||
|
||||
# define AV_RL32(x) bswap_32(AV_RN32(x))
|
||||
# define AV_WL32(p, d) AV_WN32(p, bswap_32(d))
|
||||
|
||||
# define AV_RB64(x) AV_RN64(x)
|
||||
# define AV_WB64(p, d) AV_WN64(p, d)
|
||||
|
||||
# define AV_RL64(x) bswap_64(AV_RN64(x))
|
||||
# define AV_WL64(p, d) AV_WN64(p, bswap_64(d))
|
||||
# else /* WORDS_BIGENDIAN */
|
||||
# define AV_RB16(x) bswap_16(AV_RN16(x))
|
||||
# define AV_WB16(p, d) AV_WN16(p, bswap_16(d))
|
||||
|
||||
# define AV_RL16(x) AV_RN16(x)
|
||||
# define AV_WL16(p, d) AV_WN16(p, d)
|
||||
|
||||
# define AV_RB32(x) bswap_32(AV_RN32(x))
|
||||
# define AV_WB32(p, d) AV_WN32(p, bswap_32(d))
|
||||
|
||||
# define AV_RL32(x) AV_RN32(x)
|
||||
# define AV_WL32(p, d) AV_WN32(p, d)
|
||||
|
||||
# define AV_RB64(x) bswap_64(AV_RN64(x))
|
||||
# define AV_WB64(p, d) AV_WN64(p, bswap_64(d))
|
||||
|
||||
# define AV_RL64(x) AV_RN64(x)
|
||||
# define AV_WL64(p, d) AV_WN64(p, d)
|
||||
# endif
|
||||
#else /* HAVE_FAST_UNALIGNED */
|
||||
#define AV_RB16(x) ((((const uint8_t*)(x))[0] << 8) | ((const uint8_t*)(x))[1])
|
||||
@ -81,39 +105,7 @@ struct unaligned_16 { uint16_t l; } __attribute__((packed));
|
||||
#define AV_WL16(p, d) do { \
|
||||
((uint8_t*)(p))[0] = (d); \
|
||||
((uint8_t*)(p))[1] = (d)>>8; } while(0)
|
||||
#endif
|
||||
|
||||
#define AV_RB24(x) ((((const uint8_t*)(x))[0] << 16) | \
|
||||
(((const uint8_t*)(x))[1] << 8) | \
|
||||
((const uint8_t*)(x))[2])
|
||||
#define AV_WB24(p, d) do { \
|
||||
((uint8_t*)(p))[2] = (d); \
|
||||
((uint8_t*)(p))[1] = (d)>>8; \
|
||||
((uint8_t*)(p))[0] = (d)>>16; } while(0)
|
||||
|
||||
#define AV_RL24(x) ((((const uint8_t*)(x))[2] << 16) | \
|
||||
(((const uint8_t*)(x))[1] << 8) | \
|
||||
((const uint8_t*)(x))[0])
|
||||
#define AV_WL24(p, d) do { \
|
||||
((uint8_t*)(p))[0] = (d); \
|
||||
((uint8_t*)(p))[1] = (d)>>8; \
|
||||
((uint8_t*)(p))[2] = (d)>>16; } while(0)
|
||||
|
||||
#ifdef HAVE_FAST_UNALIGNED
|
||||
# ifdef WORDS_BIGENDIAN
|
||||
# define AV_RB32(x) AV_RN32(x)
|
||||
# define AV_WB32(p, d) AV_WN32(p, d)
|
||||
|
||||
# define AV_RL32(x) bswap_32(AV_RN32(x))
|
||||
# define AV_WL32(p, d) AV_WN32(p, bswap_32(d))
|
||||
# else /* WORDS_BIGENDIAN */
|
||||
# define AV_RB32(x) bswap_32(AV_RN32(x))
|
||||
# define AV_WB32(p, d) AV_WN32(p, bswap_32(d))
|
||||
|
||||
# define AV_RL32(x) AV_RN32(x)
|
||||
# define AV_WL32(p, d) AV_WN32(p, d)
|
||||
# endif
|
||||
#else /* HAVE_FAST_UNALIGNED */
|
||||
#define AV_RB32(x) ((((const uint8_t*)(x))[0] << 24) | \
|
||||
(((const uint8_t*)(x))[1] << 16) | \
|
||||
(((const uint8_t*)(x))[2] << 8) | \
|
||||
@ -133,23 +125,7 @@ struct unaligned_16 { uint16_t l; } __attribute__((packed));
|
||||
((uint8_t*)(p))[1] = (d)>>8; \
|
||||
((uint8_t*)(p))[2] = (d)>>16; \
|
||||
((uint8_t*)(p))[3] = (d)>>24; } while(0)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_FAST_UNALIGNED
|
||||
# ifdef WORDS_BIGENDIAN
|
||||
# define AV_RB64(x) AV_RN64(x)
|
||||
# define AV_WB64(p, d) AV_WN64(p, d)
|
||||
|
||||
# define AV_RL64(x) bswap_64(AV_RN64(x))
|
||||
# define AV_WL64(p, d) AV_WN64(p, bswap_64(d))
|
||||
# else /* WORDS_BIGENDIAN */
|
||||
# define AV_RB64(x) bswap_64(AV_RN64(x))
|
||||
# define AV_WB64(p, d) AV_WN64(p, bswap_64(d))
|
||||
|
||||
# define AV_RL64(x) AV_RN64(x)
|
||||
# define AV_WL64(p, d) AV_WN64(p, d)
|
||||
# endif
|
||||
#else /* HAVE_FAST_UNALIGNED */
|
||||
#define AV_RB64(x) (((uint64_t)((const uint8_t*)(x))[0] << 56) | \
|
||||
((uint64_t)((const uint8_t*)(x))[1] << 48) | \
|
||||
((uint64_t)((const uint8_t*)(x))[2] << 40) | \
|
||||
@ -185,6 +161,22 @@ struct unaligned_16 { uint16_t l; } __attribute__((packed));
|
||||
((uint8_t*)(p))[5] = (d)>>40; \
|
||||
((uint8_t*)(p))[6] = (d)>>48; \
|
||||
((uint8_t*)(p))[7] = (d)>>56; } while(0)
|
||||
#endif
|
||||
#endif /* HAVE_FAST_UNALIGNED */
|
||||
|
||||
#define AV_RB24(x) ((((const uint8_t*)(x))[0] << 16) | \
|
||||
(((const uint8_t*)(x))[1] << 8) | \
|
||||
((const uint8_t*)(x))[2])
|
||||
#define AV_WB24(p, d) do { \
|
||||
((uint8_t*)(p))[2] = (d); \
|
||||
((uint8_t*)(p))[1] = (d)>>8; \
|
||||
((uint8_t*)(p))[0] = (d)>>16; } while(0)
|
||||
|
||||
#define AV_RL24(x) ((((const uint8_t*)(x))[2] << 16) | \
|
||||
(((const uint8_t*)(x))[1] << 8) | \
|
||||
((const uint8_t*)(x))[0])
|
||||
#define AV_WL24(p, d) do { \
|
||||
((uint8_t*)(p))[0] = (d); \
|
||||
((uint8_t*)(p))[1] = (d)>>8; \
|
||||
((uint8_t*)(p))[2] = (d)>>16; } while(0)
|
||||
|
||||
#endif /* FFMPEG_INTREADWRITE_H */
|
||||
|
Loading…
Reference in New Issue
Block a user