summaryrefslogtreecommitdiff
path: root/libavutil
diff options
context:
space:
mode:
authorMåns Rullgård <mans@mansr.com>2010-07-10 22:12:30 +0000
committerMåns Rullgård <mans@mansr.com>2010-07-10 22:12:30 +0000
commit8fc0162ac44f3e60798552ca6d19387be95cae4c (patch)
tree443f7c684a3a8be0e9b70d67a91b8572bfa1ddd2 /libavutil
parente6b22522c94cfccda97018e52ab65da8c69d8a56 (diff)
Add av_ prefix to bswap macros
Originally committed as revision 24170 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavutil')
-rw-r--r--libavutil/arm/bswap.h16
-rw-r--r--libavutil/avr32/bswap.h8
-rw-r--r--libavutil/avr32/intreadwrite.h4
-rw-r--r--libavutil/bfin/bswap.h4
-rw-r--r--libavutil/bswap.h40
-rw-r--r--libavutil/crc.c6
-rw-r--r--libavutil/des.c8
-rw-r--r--libavutil/intreadwrite.h8
-rw-r--r--libavutil/md5.c6
-rw-r--r--libavutil/sh4/bswap.h8
-rw-r--r--libavutil/sha.c6
-rw-r--r--libavutil/x86/bswap.h12
12 files changed, 63 insertions, 63 deletions
diff --git a/libavutil/arm/bswap.h b/libavutil/arm/bswap.h
index 9126350716..c5e74cc6d5 100644
--- a/libavutil/arm/bswap.h
+++ b/libavutil/arm/bswap.h
@@ -26,15 +26,15 @@
#ifdef __ARMCC_VERSION
#if HAVE_ARMV6
-#define bswap_16 bswap_16
-static av_always_inline av_const unsigned bswap_16(unsigned x)
+#define av_bswap16 av_bswap16
+static av_always_inline av_const unsigned av_bswap16(unsigned x)
{
__asm { rev16 x, x }
return x;
}
-#define bswap_32 bswap_32
-static av_always_inline av_const uint32_t bswap_32(uint32_t x)
+#define av_bswap32 av_bswap32
+static av_always_inline av_const uint32_t av_bswap32(uint32_t x)
{
return __rev(x);
}
@@ -43,16 +43,16 @@ static av_always_inline av_const uint32_t bswap_32(uint32_t x)
#elif HAVE_INLINE_ASM
#if HAVE_ARMV6
-#define bswap_16 bswap_16
-static av_always_inline av_const unsigned bswap_16(unsigned x)
+#define av_bswap16 av_bswap16
+static av_always_inline av_const unsigned av_bswap16(unsigned x)
{
__asm__("rev16 %0, %0" : "+r"(x));
return x;
}
#endif
-#define bswap_32 bswap_32
-static av_always_inline av_const uint32_t bswap_32(uint32_t x)
+#define av_bswap32 av_bswap32
+static av_always_inline av_const uint32_t av_bswap32(uint32_t x)
{
#if HAVE_ARMV6
__asm__("rev %0, %0" : "+r"(x));
diff --git a/libavutil/avr32/bswap.h b/libavutil/avr32/bswap.h
index e8c8ddc4ef..e79d53f369 100644
--- a/libavutil/avr32/bswap.h
+++ b/libavutil/avr32/bswap.h
@@ -25,15 +25,15 @@
#if HAVE_INLINE_ASM
-#define bswap_16 bswap_16
-static av_always_inline av_const uint16_t bswap_16(uint16_t x)
+#define av_bswap16 av_bswap16
+static av_always_inline av_const uint16_t av_bswap16(uint16_t x)
{
__asm__ ("swap.bh %0" : "+r"(x));
return x;
}
-#define bswap_32 bswap_32
-static av_always_inline av_const uint32_t bswap_32(uint32_t x)
+#define av_bswap32 av_bswap32
+static av_always_inline av_const uint32_t av_bswap32(uint32_t x)
{
__asm__ ("swap.b %0" : "+r"(x));
return x;
diff --git a/libavutil/avr32/intreadwrite.h b/libavutil/avr32/intreadwrite.h
index 3e468b4e88..c6fd3aa470 100644
--- a/libavutil/avr32/intreadwrite.h
+++ b/libavutil/avr32/intreadwrite.h
@@ -106,8 +106,8 @@ static av_always_inline void AV_WB32(void *p, uint32_t v)
}
/* These two would be defined by generic code, but we need them sooner. */
-#define AV_RL32(p) bswap_32(AV_RB32(p))
-#define AV_WL32(p, v) AV_WB32(p, bswap_32(v))
+#define AV_RL32(p) av_bswap32(AV_RB32(p))
+#define AV_WL32(p, v) AV_WB32(p, av_bswap32(v))
#define AV_WB64 AV_WB64
static av_always_inline void AV_WB64(void *p, uint64_t v)
diff --git a/libavutil/bfin/bswap.h b/libavutil/bfin/bswap.h
index ccdfeb7c8b..363ed40bc5 100644
--- a/libavutil/bfin/bswap.h
+++ b/libavutil/bfin/bswap.h
@@ -30,8 +30,8 @@
#include "config.h"
#include "libavutil/attributes.h"
-#define bswap_32 bswap_32
-static av_always_inline av_const uint32_t bswap_32(uint32_t x)
+#define av_bswap32 av_bswap32
+static av_always_inline av_const uint32_t av_bswap32(uint32_t x)
{
unsigned tmp;
__asm__("%1 = %0 >> 8 (V); \n\t"
diff --git a/libavutil/bswap.h b/libavutil/bswap.h
index aee04abd96..f8c866aaeb 100644
--- a/libavutil/bswap.h
+++ b/libavutil/bswap.h
@@ -48,16 +48,16 @@
#define AV_BSWAPC(s, x) AV_BSWAP##s##C(x)
-#ifndef bswap_16
-static av_always_inline av_const uint16_t bswap_16(uint16_t x)
+#ifndef av_bswap16
+static av_always_inline av_const uint16_t av_bswap16(uint16_t x)
{
x= (x>>8) | (x<<8);
return x;
}
#endif
-#ifndef bswap_32
-static av_always_inline av_const uint32_t bswap_32(uint32_t x)
+#ifndef av_bswap32
+static av_always_inline av_const uint32_t av_bswap32(uint32_t x)
{
x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF);
x= (x>>16) | (x<<16);
@@ -65,8 +65,8 @@ static av_always_inline av_const uint32_t bswap_32(uint32_t x)
}
#endif
-#ifndef bswap_64
-static inline uint64_t av_const bswap_64(uint64_t x)
+#ifndef av_bswap64
+static inline uint64_t av_const av_bswap64(uint64_t x)
{
#if 0
x= ((x<< 8)&0xFF00FF00FF00FF00ULL) | ((x>> 8)&0x00FF00FF00FF00FFULL);
@@ -78,8 +78,8 @@ static inline uint64_t av_const bswap_64(uint64_t x)
uint32_t l[2];
} w, r;
w.ll = x;
- r.l[0] = bswap_32 (w.l[1]);
- r.l[1] = bswap_32 (w.l[0]);
+ r.l[0] = av_bswap32 (w.l[1]);
+ r.l[1] = av_bswap32 (w.l[0]);
return r.ll;
#endif
}
@@ -89,21 +89,21 @@ static inline uint64_t av_const bswap_64(uint64_t x)
// le2ne ... little-endian to native-endian
#if HAVE_BIGENDIAN
-#define be2ne_16(x) (x)
-#define be2ne_32(x) (x)
-#define be2ne_64(x) (x)
-#define le2ne_16(x) bswap_16(x)
-#define le2ne_32(x) bswap_32(x)
-#define le2ne_64(x) bswap_64(x)
+#define av_be2ne16(x) (x)
+#define av_be2ne32(x) (x)
+#define av_be2ne64(x) (x)
+#define av_le2ne16(x) av_bswap16(x)
+#define av_le2ne32(x) av_bswap32(x)
+#define av_le2ne64(x) av_bswap64(x)
#define AV_BE2NEC(s, x) (x)
#define AV_LE2NEC(s, x) AV_BSWAPC(s, x)
#else
-#define be2ne_16(x) bswap_16(x)
-#define be2ne_32(x) bswap_32(x)
-#define be2ne_64(x) bswap_64(x)
-#define le2ne_16(x) (x)
-#define le2ne_32(x) (x)
-#define le2ne_64(x) (x)
+#define av_be2ne16(x) av_bswap16(x)
+#define av_be2ne32(x) av_bswap32(x)
+#define av_be2ne64(x) av_bswap64(x)
+#define av_le2ne16(x) (x)
+#define av_le2ne32(x) (x)
+#define av_le2ne64(x) (x)
#define AV_BE2NEC(s, x) AV_BSWAPC(s, x)
#define AV_LE2NEC(s, x) (x)
#endif
diff --git a/libavutil/crc.c b/libavutil/crc.c
index 4cad981632..c3d74a2ce9 100644
--- a/libavutil/crc.c
+++ b/libavutil/crc.c
@@ -49,7 +49,7 @@ static AVCRC av_crc_table[AV_CRC_MAX][257];
* If 0, you must swap the CRC parameter and the result of av_crc
* if you need the standard representation (can be simplified in
* most cases to e.g. bswap16):
- * bswap_32(crc << (32-bits))
+ * av_bswap32(crc << (32-bits))
* @param bits number of bits for the CRC
* @param poly generator polynomial without the x**bits coefficient, in the
* representation as specified by le
@@ -73,7 +73,7 @@ int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size){
} else {
for (c = i << 24, j = 0; j < 8; j++)
c = (c<<1) ^ ((poly<<(32-bits)) & (((int32_t)c)>>31) );
- ctx[i] = bswap_32(c);
+ ctx[i] = av_bswap32(c);
}
}
ctx[256]=1;
@@ -121,7 +121,7 @@ uint32_t av_crc(const AVCRC *ctx, uint32_t crc, const uint8_t *buffer, size_t le
crc = ctx[((uint8_t)crc) ^ *buffer++] ^ (crc >> 8);
while(buffer<end-3){
- crc ^= le2ne_32(*(const uint32_t*)buffer); buffer+=4;
+ crc ^= av_le2ne32(*(const uint32_t*)buffer); buffer+=4;
crc = ctx[3*256 + ( crc &0xFF)]
^ctx[2*256 + ((crc>>8 )&0xFF)]
^ctx[1*256 + ((crc>>16)&0xFF)]
diff --git a/libavutil/des.c b/libavutil/des.c
index 45913425f3..9c1a530666 100644
--- a/libavutil/des.c
+++ b/libavutil/des.c
@@ -297,10 +297,10 @@ int av_des_init(AVDES *d, const uint8_t *key, int key_bits, int decrypt) {
}
void av_des_crypt(AVDES *d, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt) {
- uint64_t iv_val = iv ? be2ne_64(*(uint64_t *)iv) : 0;
+ uint64_t iv_val = iv ? av_be2ne64(*(uint64_t *)iv) : 0;
while (count-- > 0) {
uint64_t dst_val;
- uint64_t src_val = src ? be2ne_64(*(const uint64_t *)src) : 0;
+ uint64_t src_val = src ? av_be2ne64(*(const uint64_t *)src) : 0;
if (decrypt) {
uint64_t tmp = src_val;
if (d->triple_des) {
@@ -317,12 +317,12 @@ void av_des_crypt(AVDES *d, uint8_t *dst, const uint8_t *src, int count, uint8_t
}
iv_val = iv ? dst_val : 0;
}
- *(uint64_t *)dst = be2ne_64(dst_val);
+ *(uint64_t *)dst = av_be2ne64(dst_val);
src += 8;
dst += 8;
}
if (iv)
- *(uint64_t *)iv = be2ne_64(iv_val);
+ *(uint64_t *)iv = av_be2ne64(iv_val);
}
#ifdef TEST
diff --git a/libavutil/intreadwrite.h b/libavutil/intreadwrite.h
index 9315cddd85..0ea30e9571 100644
--- a/libavutil/intreadwrite.h
+++ b/libavutil/intreadwrite.h
@@ -339,11 +339,11 @@ union unaligned_16 { uint16_t l; } __attribute__((packed)) av_alias;
#if HAVE_BIGENDIAN
# define AV_RB(s, p) AV_RN##s(p)
# define AV_WB(s, p, v) AV_WN##s(p, v)
-# define AV_RL(s, p) bswap_##s(AV_RN##s(p))
-# define AV_WL(s, p, v) AV_WN##s(p, bswap_##s(v))
+# define AV_RL(s, p) av_bswap##s(AV_RN##s(p))
+# define AV_WL(s, p, v) AV_WN##s(p, av_bswap##s(v))
#else
-# define AV_RB(s, p) bswap_##s(AV_RN##s(p))
-# define AV_WB(s, p, v) AV_WN##s(p, bswap_##s(v))
+# define AV_RB(s, p) av_bswap##s(AV_RN##s(p))
+# define AV_WB(s, p, v) AV_WN##s(p, av_bswap##s(v))
# define AV_RL(s, p) AV_RN##s(p)
# define AV_WL(s, p, v) AV_WN##s(p, v)
#endif
diff --git a/libavutil/md5.c b/libavutil/md5.c
index b7eee730dc..173ed0623b 100644
--- a/libavutil/md5.c
+++ b/libavutil/md5.c
@@ -95,7 +95,7 @@ static void body(uint32_t ABCD[4], uint32_t X[16]){
#if HAVE_BIGENDIAN
for(i=0; i<16; i++)
- X[i]= bswap_32(X[i]);
+ X[i]= av_bswap32(X[i]);
#endif
#if CONFIG_SMALL
@@ -141,7 +141,7 @@ void av_md5_update(AVMD5 *ctx, const uint8_t *src, const int len){
void av_md5_final(AVMD5 *ctx, uint8_t *dst){
int i;
- uint64_t finalcount= le2ne_64(ctx->len<<3);
+ uint64_t finalcount= av_le2ne64(ctx->len<<3);
av_md5_update(ctx, "\200", 1);
while((ctx->len & 63)!=56)
@@ -150,7 +150,7 @@ void av_md5_final(AVMD5 *ctx, uint8_t *dst){
av_md5_update(ctx, (uint8_t*)&finalcount, 8);
for(i=0; i<4; i++)
- ((uint32_t*)dst)[i]= le2ne_32(ctx->ABCD[3-i]);
+ ((uint32_t*)dst)[i]= av_le2ne32(ctx->ABCD[3-i]);
}
void av_md5_sum(uint8_t *dst, const uint8_t *src, const int len){
diff --git a/libavutil/sh4/bswap.h b/libavutil/sh4/bswap.h
index 6d237c5dc5..48dd27f806 100644
--- a/libavutil/sh4/bswap.h
+++ b/libavutil/sh4/bswap.h
@@ -28,15 +28,15 @@
#include "config.h"
#include "libavutil/attributes.h"
-#define bswap_16 bswap_16
-static av_always_inline av_const uint16_t bswap_16(uint16_t x)
+#define av_bswap16 av_bswap16
+static av_always_inline av_const uint16_t av_bswap16(uint16_t x)
{
__asm__("swap.b %0,%0" : "+r"(x));
return x;
}
-#define bswap_32 bswap_32
-static av_always_inline av_const uint32_t bswap_32(uint32_t x)
+#define av_bswap32 av_bswap32
+static av_always_inline av_const uint32_t av_bswap32(uint32_t x)
{
__asm__("swap.b %0,%0\n"
"swap.w %0,%0\n"
diff --git a/libavutil/sha.c b/libavutil/sha.c
index f89ea52a5f..2657f7eb90 100644
--- a/libavutil/sha.c
+++ b/libavutil/sha.c
@@ -43,7 +43,7 @@ const int av_sha_size = sizeof(AVSHA);
#define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits))))
/* (R0+R1), R2, R3, R4 are the different operations used in SHA1 */
-#define blk0(i) (block[i] = be2ne_32(((const uint32_t*)buffer)[i]))
+#define blk0(i) (block[i] = av_be2ne32(((const uint32_t*)buffer)[i]))
#define blk(i) (block[i] = rol(block[i-3] ^ block[i-8] ^ block[i-14] ^ block[i-16], 1))
#define R0(v,w,x,y,z,i) z += ((w&(x^y))^y) + blk0(i) + 0x5A827999 + rol(v, 5); w = rol(w, 30);
@@ -68,7 +68,7 @@ static void sha1_transform(uint32_t state[5], const uint8_t buffer[64])
for (i = 0; i < 80; i++) {
int t;
if (i < 16)
- t = be2ne_32(((uint32_t*)buffer)[i]);
+ t = av_be2ne32(((uint32_t*)buffer)[i]);
else
t = rol(block[i-3] ^ block[i-8] ^ block[i-14] ^ block[i-16], 1);
block[i] = t;
@@ -314,7 +314,7 @@ void av_sha_update(AVSHA* ctx, const uint8_t* data, unsigned int len)
void av_sha_final(AVSHA* ctx, uint8_t *digest)
{
int i;
- uint64_t finalcount = be2ne_64(ctx->count << 3);
+ uint64_t finalcount = av_be2ne64(ctx->count << 3);
av_sha_update(ctx, "\200", 1);
while ((ctx->count & 63) != 56)
diff --git a/libavutil/x86/bswap.h b/libavutil/x86/bswap.h
index 26dc4e2bfe..b6ceb76d32 100644
--- a/libavutil/x86/bswap.h
+++ b/libavutil/x86/bswap.h
@@ -28,15 +28,15 @@
#include "config.h"
#include "libavutil/attributes.h"
-#define bswap_16 bswap_16
-static av_always_inline av_const uint16_t bswap_16(uint16_t x)
+#define av_bswap16 av_bswap16
+static av_always_inline av_const uint16_t av_bswap16(uint16_t x)
{
__asm__("rorw $8, %0" : "+r"(x));
return x;
}
-#define bswap_32 bswap_32
-static av_always_inline av_const uint32_t bswap_32(uint32_t x)
+#define av_bswap32 av_bswap32
+static av_always_inline av_const uint32_t av_bswap32(uint32_t x)
{
#if HAVE_BSWAP
__asm__("bswap %0" : "+r" (x));
@@ -50,8 +50,8 @@ static av_always_inline av_const uint32_t bswap_32(uint32_t x)
}
#if ARCH_X86_64
-#define bswap_64 bswap_64
-static inline uint64_t av_const bswap_64(uint64_t x)
+#define av_bswap64 av_bswap64
+static inline uint64_t av_const av_bswap64(uint64_t x)
{
__asm__("bswap %0": "=r" (x) : "0" (x));
return x;