changeset 993:f8db9a2bae05 libavutil

Add av_ prefix to bswap macros
author mru
date Sat, 10 Jul 2010 22:12:30 +0000
parents a13125b5be3a
children 41878f66798f
files arm/bswap.h avr32/bswap.h avr32/intreadwrite.h bfin/bswap.h bswap.h crc.c des.c intreadwrite.h md5.c sh4/bswap.h sha.c x86/bswap.h
diffstat 12 files changed, 63 insertions(+), 63 deletions(-) [+]
line wrap: on
line diff
--- a/arm/bswap.h	Sat Jul 10 22:09:01 2010 +0000
+++ b/arm/bswap.h	Sat Jul 10 22:12:30 2010 +0000
@@ -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 @@
 #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));
--- a/avr32/bswap.h	Sat Jul 10 22:09:01 2010 +0000
+++ b/avr32/bswap.h	Sat Jul 10 22:12:30 2010 +0000
@@ -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;
--- a/avr32/intreadwrite.h	Sat Jul 10 22:09:01 2010 +0000
+++ b/avr32/intreadwrite.h	Sat Jul 10 22:12:30 2010 +0000
@@ -106,8 +106,8 @@
 }
 
 /* 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)
--- a/bfin/bswap.h	Sat Jul 10 22:09:01 2010 +0000
+++ b/bfin/bswap.h	Sat Jul 10 22:12:30 2010 +0000
@@ -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"
--- a/bswap.h	Sat Jul 10 22:09:01 2010 +0000
+++ b/bswap.h	Sat Jul 10 22:12:30 2010 +0000
@@ -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 @@
 }
 #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 @@
         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 @@
 // 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
--- a/crc.c	Sat Jul 10 22:09:01 2010 +0000
+++ b/crc.c	Sat Jul 10 22:12:30 2010 +0000
@@ -49,7 +49,7 @@
  *           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 @@
         } 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 @@
             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)]
--- a/des.c	Sat Jul 10 22:09:01 2010 +0000
+++ b/des.c	Sat Jul 10 22:12:30 2010 +0000
@@ -297,10 +297,10 @@
 }
 
 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 @@
             }
             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
--- a/intreadwrite.h	Sat Jul 10 22:09:01 2010 +0000
+++ b/intreadwrite.h	Sat Jul 10 22:12:30 2010 +0000
@@ -339,11 +339,11 @@
 #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
--- a/md5.c	Sat Jul 10 22:09:01 2010 +0000
+++ b/md5.c	Sat Jul 10 22:12:30 2010 +0000
@@ -95,7 +95,7 @@
 
 #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_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 @@
     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){
--- a/sh4/bswap.h	Sat Jul 10 22:09:01 2010 +0000
+++ b/sh4/bswap.h	Sat Jul 10 22:12:30 2010 +0000
@@ -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"
--- a/sha.c	Sat Jul 10 22:09:01 2010 +0000
+++ b/sha.c	Sat Jul 10 22:12:30 2010 +0000
@@ -43,7 +43,7 @@
 #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 @@
     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_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)
--- a/x86/bswap.h	Sat Jul 10 22:09:01 2010 +0000
+++ b/x86/bswap.h	Sat Jul 10 22:12:30 2010 +0000
@@ -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 @@
 }
 
 #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;