changeset 327:e9ee070db39b libavutil

Faster 32 bit byteswaping code for Blackfin. 200% faster on BF537 compiled with gcc 4.1. patch by Marc Hoffman, mmh pleasantst com
author diego
date Tue, 24 Apr 2007 23:21:29 +0000
parents 46b4da5bf9ed
children cfaf9feae0f9
files bswap.h
diffstat 1 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/bswap.h	Tue Apr 24 07:16:47 2007 +0000
+++ b/bswap.h	Tue Apr 24 23:21:29 2007 +0000
@@ -125,6 +125,18 @@
       : "+r"(x), "+r"(t));
     return x;
 }
+
+#elif defined(ARCH_BFIN)
+static av_always_inline uint32_t bswap_32(uint32_t x){
+    unsigned tmp;
+    asm("%1 = %0 >> 8 (V);\n\t"
+        "%0 = %0 << 8 (V);\n\t"
+        "%0 = %0 | %1;\n\t"
+        "%0 = PACK(%0.L, %0.H);\n\t"
+        : "+d"(x), "=&d"(tmp));
+    return x;
+}
+
 #else
 static av_always_inline uint32_t bswap_32(uint32_t x){
     x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF);