]> git.sesse.net Git - x264/commitdiff
Add SSE support to rectangle.h for 16-byte stores
authorFiona Glaser <fiona@x264.com>
Tue, 29 Mar 2011 12:33:44 +0000 (05:33 -0700)
committerFiona Glaser <fiona@x264.com>
Wed, 13 Apr 2011 01:20:21 +0000 (18:20 -0700)
Uses GCC vector intrinsics; may be suboptimal on particularly old GCC versions.

common/common.h
common/rectangle.h
common/x86/util.h
configure

index fcf02500fc424d2192ca18bd55e5c9a8327b3d6d..496542e2055090b09b0e8d6e7792951d17ab56d0 100644 (file)
@@ -851,11 +851,12 @@ struct x264_t
 
 // included at the end because it needs x264_t
 #include "macroblock.h"
-#include "rectangle.h"
 
 #if HAVE_MMX
 #include "x86/util.h"
 #endif
 
+#include "rectangle.h"
+
 #endif
 
index d12e97163f26057b71bde3fbcd8978c6c734a968..5db91e8cac2a1dc5d5e28b36882a44fdddc4e1a4 100644 (file)
@@ -80,6 +80,15 @@ static ALWAYS_INLINE void x264_macroblock_cache_rect( void *dst, int w, int h, i
     {
         /* height 1, width 16 doesn't occur */
         assert( h != 1 );
+#if HAVE_VECTOREXT && defined(__SSE__)
+        v4si v16 = {v,v,v,v};
+
+        M128( d+s*0+0 ) = (__m128)v16;
+        M128( d+s*1+0 ) = (__m128)v16;
+        if( h == 2 ) return;
+        M128( d+s*2+0 ) = (__m128)v16;
+        M128( d+s*3+0 ) = (__m128)v16;
+#else
         if( WORD_SIZE == 8 )
         {
             do
@@ -103,6 +112,7 @@ static ALWAYS_INLINE void x264_macroblock_cache_rect( void *dst, int w, int h, i
                 d += s;
             } while( --h );
         }
+#endif
     }
     else
         assert(0);
index 445248a5b466fd42800d344f704c3949e65e5961..e89d8384a0d92736188806803d2c4e65a222f40b 100644 (file)
@@ -154,6 +154,9 @@ static void ALWAYS_INLINE x264_predictor_roundclip_mmxext( int16_t (*dst)[2], in
 #define M128_ZERO ((__m128){0,0,0,0})
 #define x264_union128_t x264_union128_sse_t
 typedef union { __m128 i; uint64_t a[2]; uint32_t b[4]; uint16_t c[8]; uint8_t d[16]; } MAY_ALIAS x264_union128_sse_t;
+#if HAVE_VECTOREXT
+typedef uint32_t v4si __attribute__((vector_size (16)));
+#endif
 #endif
 
 #endif
index 29977a27151d3fed0cad181ef141a78bc25aebde..1a7cb3307ad3e2bccd6ab8a4d96e8cad8276c247 100755 (executable)
--- a/configure
+++ b/configure
@@ -223,7 +223,7 @@ cross_prefix=""
 EXE=""
 
 # list of all preprocessor HAVE values we can define
-CONFIG_HAVE="MALLOC_H ALTIVEC ALTIVEC_H MMX ARMV6 ARMV6T2 NEON BEOSTHREAD POSIXTHREAD WIN32THREAD THREAD LOG2F VISUALIZE SWSCALE LAVF FFMS GPAC GF_MALLOC AVS GPL"
+CONFIG_HAVE="MALLOC_H ALTIVEC ALTIVEC_H MMX ARMV6 ARMV6T2 NEON BEOSTHREAD POSIXTHREAD WIN32THREAD THREAD LOG2F VISUALIZE SWSCALE LAVF FFMS GPAC GF_MALLOC AVS GPL VECTOREXT"
 
 # parse options
 
@@ -812,6 +812,8 @@ if [ "$avs" = "auto" ] ; then
     fi
 fi
 
+cc_check "stdint.h" "" "uint32_t test_vec __attribute__ ((vector_size (16))) = {0,1,2,3};" && define HAVE_VECTOREXT
+
 if [ "$pic" = "yes" ] ; then
     CFLAGS="$CFLAGS -fPIC"
     ASFLAGS="$ASFLAGS -DPIC"