bswap: use native types for av_bwap16().
authorJason Garrett-Glaser <jason@x264.com>
Fri, 22 Apr 2011 21:59:55 +0000 (17:59 -0400)
committerRonald S. Bultje <rsbultje@gmail.com>
Sat, 23 Apr 2011 00:05:48 +0000 (20:05 -0400)
This prevents a call to bytestream_get_be16() using a movzwl both before
and after the ror instruction, which is obviously inefficient. Arm uses
the same trick also.

Sintel decoding goes from (avg+SD) 9.856 +/- 0.003 to 9.797 +/- 0.003 sec.

Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
libavutil/x86/bswap.h

index 28e3fec..b60d9cc 100644 (file)
@@ -29,9 +29,9 @@
 #include "libavutil/attributes.h"
 
 #define av_bswap16 av_bswap16
-static av_always_inline av_const uint16_t av_bswap16(uint16_t x)
+static av_always_inline av_const unsigned av_bswap16(unsigned x)
 {
-    __asm__("rorw $8, %0" : "+r"(x));
+    __asm__("rorw $8, %w0" : "+r"(x));
     return x;
 }