[Ffmpeg-cvslog] CVS: ffmpeg/libavcodec bswap.h,1.8,1.9
Michael Niedermayer CVS
michael
Tue May 10 21:54:40 CEST 2005
- Previous message: [Ffmpeg-cvslog] CVS: ffmpeg/libavcodec bswap.h,1.7,1.8
- Next message: [Ffmpeg-cvslog] CVS: ffmpeg/libavcodec dv.c, 1.60, 1.61 mpegaudio.c, 1.22, 1.23 png.c, 1.11, 1.12 pnm.c, 1.10, 1.11 raw.c, 1.12, 1.13
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/ffmpeg/ffmpeg/libavcodec
In directory mail:/var2/tmp/cvs-serv24897
Modified Files:
bswap.h
Log Message:
optimization
Index: bswap.h
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/bswap.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- bswap.h 10 May 2005 10:05:44 -0000 1.8
+++ bswap.h 10 May 2005 19:54:38 -0000 1.9
@@ -19,7 +19,7 @@
#if defined(ARCH_X86) || defined(ARCH_X86_64)
static always_inline uint16_t bswap_16(uint16_t x)
{
- __asm("xchgb %b0,%h0" :
+ __asm("rorw $8, %0" :
LEGACY_REGS (x) :
"0" (x));
return x;
@@ -48,12 +48,15 @@
"0" (x));
return x;
#else
- register union { __extension__ uint64_t __ll;
- uint32_t __l[2]; } __x;
- asm("xchgl %0,%1":
- "=r"(__x.__l[0]),"=r"(__x.__l[1]):
- "0"(bswap_32((uint32_t)x)),"1"(bswap_32((uint32_t)(x>>32))));
- return __x.__ll;
+ union {
+ uint64_t ll;
+ struct {
+ uint32_t l,h;
+ } l;
+ } r;
+ r.l.l = bswap_32 (x);
+ r.l.h = bswap_32 (x>>32);
+ return r.ll;
#endif
}
@@ -92,11 +95,17 @@
}
static always_inline uint32_t bswap_32(uint32_t x){
- return (x >> 24) | ((x & 0x00ff0000) >> 8) | ((x & 0x0000ff00) << 8) | (x << 24);
+ x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF);
+ return (x>>16) | (x<<16);
}
static inline uint64_t bswap_64(uint64_t x)
{
+#if 0
+ x= ((x<< 8)&0xFF00FF00FF00FF00ULL) | ((x>> 8)&0x00FF00FF00FF00FFULL);
+ x= ((x<<16)&0xFFFF0000FFFF0000ULL) | ((x>>16)&0x0000FFFF0000FFFFULL);
+ return (x>>32) | (x<<32);
+#else
union {
uint64_t ll;
uint32_t l[2];
@@ -105,6 +114,7 @@
r.l[0] = bswap_32 (w.l[1]);
r.l[1] = bswap_32 (w.l[0]);
return r.ll;
+#endif
}
#endif /* !ARCH_X86 */
- Previous message: [Ffmpeg-cvslog] CVS: ffmpeg/libavcodec bswap.h,1.7,1.8
- Next message: [Ffmpeg-cvslog] CVS: ffmpeg/libavcodec dv.c, 1.60, 1.61 mpegaudio.c, 1.22, 1.23 png.c, 1.11, 1.12 pnm.c, 1.10, 1.11 raw.c, 1.12, 1.13
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the ffmpeg-cvslog
mailing list