[vlc-commits] mmxext: use standard syntax for mmx_t alignment

Rémi Denis-Courmont git at videolan.org
Sun Feb 26 21:00:25 CET 2017


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Feb 26 21:56:06 2017 +0200| [5f47b75d32ac803c5cbeb919e3d3b97772ab2cb0] | committer: Rémi Denis-Courmont

mmxext: use standard syntax for mmx_t alignment

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5f47b75d32ac803c5cbeb919e3d3b97772ab2cb0
---

 modules/video_filter/deinterlace/algo_phosphor.c |  6 +++++-
 modules/video_filter/deinterlace/helpers.c       | 12 ++++++++----
 modules/video_filter/deinterlace/mmx.h           |  2 +-
 3 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/modules/video_filter/deinterlace/algo_phosphor.c b/modules/video_filter/deinterlace/algo_phosphor.c
index 2f4d091..0240e0b 100644
--- a/modules/video_filter/deinterlace/algo_phosphor.c
+++ b/modules/video_filter/deinterlace/algo_phosphor.c
@@ -27,6 +27,7 @@
 
 #ifdef CAN_COMPILE_MMXEXT
 #   include "mmx.h"
+#   include <stdalign.h>
 #endif
 
 #include <stdint.h>
@@ -228,7 +229,10 @@ static void DarkenFieldMMX( picture_t *p_dst,
                 int x = 0;
 
                 /* See also easy-to-read C version below. */
-                static const mmx_t b128 = { .uq = 0x8080808080808080ULL };
+                static alignas (8) const mmx_t b128 = {
+                    .uq = 0x8080808080808080ULL
+                };
+
                 movq_m2r( b128, mm5 );
                 movq_m2r( i_strength_u64,  mm6 );
                 movq_m2r( remove_high_u64, mm7 );
diff --git a/modules/video_filter/deinterlace/helpers.c b/modules/video_filter/deinterlace/helpers.c
index 3d6e97e..f13e8af 100644
--- a/modules/video_filter/deinterlace/helpers.c
+++ b/modules/video_filter/deinterlace/helpers.c
@@ -27,6 +27,7 @@
 
 #ifdef CAN_COMPILE_MMXEXT
 #   include "mmx.h"
+#   include <stdalign.h>
 #endif
 
 #include <stdint.h>
@@ -183,7 +184,7 @@ static int TestForMotionInBlockMMX( uint8_t *p_pix_p, uint8_t *p_pix_c,
     int32_t i_top_motion = 0;
     int32_t i_bot_motion = 0;
 
-    static const mmx_t bT   = { .ub = { T, T, T, T, T, T, T, T } };
+    static alignas (8) const mmx_t bT   = { .ub = { T, T, T, T, T, T, T, T } };
     pxor_r2r( mm6, mm6 ); /* zero, used in psadbw */
     movq_m2r( bT,  mm5 );
 
@@ -500,9 +501,12 @@ static int CalculateInterlaceScoreMMX( const picture_t* p_pic_top,
                             # of pixels < (2^32)/255
                Note: calculates score * 255
             */
-            static const mmx_t b0   = { .uq = 0x0000000000000000ULL };
-            static const mmx_t b128 = { .uq = 0x8080808080808080ULL };
-            static const mmx_t bT   = { .ub = { T, T, T, T, T, T, T, T } };
+            static alignas (8) const mmx_t b0 = {
+                .uq = 0x0000000000000000ULL };
+            static alignas (8) const mmx_t b128 = {
+                .uq = 0x8080808080808080ULL };
+            static alignas (8) const mmx_t bT = {
+                .ub = { T, T, T, T, T, T, T, T } };
 
             for( ; x < w8; x += 8 )
             {
diff --git a/modules/video_filter/deinterlace/mmx.h b/modules/video_filter/deinterlace/mmx.h
index 6f64a75..072efe5 100644
--- a/modules/video_filter/deinterlace/mmx.h
+++ b/modules/video_filter/deinterlace/mmx.h
@@ -37,7 +37,7 @@ typedef    union {
     int8_t           b[8]; /* 8 Byte (8-bit) values */
     uint8_t         ub[8]; /* 8 Unsigned Byte */
     float            s[2]; /* Single-precision (32-bit) value */
-} ATTR_ALIGN(8) mmx_t;     /* On an 8-byte (64-bit) boundary */
+} mmx_t; /* NOTE: must be on an 8-byte (64-bit) boundary */
 
 
 #define    mmx_i2r(op,imm,reg) \



More information about the vlc-commits mailing list