[MPlayer-cvslog] r38235 - in trunk: libmpcodecs/vf_filmdint.c libmpcodecs/vf_gradfun.c libmpcodecs/vf_ow.c libmpcodecs/vf_spp.c m_config.h sub/osd.c

reimar subversion at mplayerhq.hu
Sat Jan 23 20:22:15 EET 2021


Author: reimar
Date: Sat Jan 23 20:22:15 2021
New Revision: 38235

Log:
Switch to using DECLARE_ALIGNED for better portability.

Modified:
   trunk/libmpcodecs/vf_filmdint.c
   trunk/libmpcodecs/vf_gradfun.c
   trunk/libmpcodecs/vf_ow.c
   trunk/libmpcodecs/vf_spp.c
   trunk/m_config.h
   trunk/sub/osd.c

Modified: trunk/libmpcodecs/vf_filmdint.c
==============================================================================
--- trunk/libmpcodecs/vf_filmdint.c	Sat Jan 23 20:22:13 2021	(r38234)
+++ trunk/libmpcodecs/vf_filmdint.c	Sat Jan 23 20:22:15 2021	(r38235)
@@ -44,13 +44,13 @@ enum pu_field_type_t {
     PU_INTERLACED
 };
 
-struct metrics {
+DECLARE_ALIGNED(8, , struct metrics) {
     /* This struct maps to a packed word 64-bit MMX register */
     unsigned short int even;
     unsigned short int odd;
     unsigned short int noise;
     unsigned short int temp;
-} __attribute__ ((aligned (8)));
+};
 
 struct frame_stats {
     struct metrics tiny, low, high, bigger, twox, max;

Modified: trunk/libmpcodecs/vf_gradfun.c
==============================================================================
--- trunk/libmpcodecs/vf_gradfun.c	Sat Jan 23 20:22:13 2021	(r38234)
+++ trunk/libmpcodecs/vf_gradfun.c	Sat Jan 23 20:22:15 2021	(r38235)
@@ -53,9 +53,9 @@ struct vf_priv_s {
                       uint8_t *src, int sstride, int width);
 };
 
-static const uint16_t __attribute__((aligned(16))) pw_7f[8] = {127,127,127,127,127,127,127,127};
-static const uint16_t __attribute__((aligned(16))) pw_ff[8] = {255,255,255,255,255,255,255,255};
-static const uint16_t __attribute__((aligned(16))) dither[8][8] = {
+DECLARE_ALIGNED(16, static const uint16_t, pw_7f)[8] = {127,127,127,127,127,127,127,127};
+DECLARE_ALIGNED(16, static const uint16_t, pw_ff)[8] = {255,255,255,255,255,255,255,255};
+DECLARE_ALIGNED(16, static const uint16_t, dither)[8][8] = {
     {  0, 96, 24,120,  6,102, 30,126 },
     { 64, 32, 88, 56, 70, 38, 94, 62 },
     { 16,112,  8,104, 22,118, 14,110 },

Modified: trunk/libmpcodecs/vf_ow.c
==============================================================================
--- trunk/libmpcodecs/vf_ow.c	Sat Jan 23 20:22:13 2021	(r38234)
+++ trunk/libmpcodecs/vf_ow.c	Sat Jan 23 20:22:15 2021	(r38235)
@@ -32,13 +32,14 @@
 #include <inttypes.h>
 #include <math.h>
 
+#include "libavutil/mem_internal.h"
 #include "mp_msg.h"
 #include "img_format.h"
 #include "mp_image.h"
 #include "vf.h"
 
 //===========================================================================//
-static const uint8_t  __attribute__((aligned(8))) dither[8][8]={
+DECLARE_ALIGNED(8, static const uint8_t, dither)[8][8]={
 {  0,  48,  12,  60,   3,  51,  15,  63, },
 { 32,  16,  44,  28,  35,  19,  47,  31, },
 {  8,  56,   4,  52,  11,  59,   7,  55, },

Modified: trunk/libmpcodecs/vf_spp.c
==============================================================================
--- trunk/libmpcodecs/vf_spp.c	Sat Jan 23 20:22:13 2021	(r38234)
+++ trunk/libmpcodecs/vf_spp.c	Sat Jan 23 20:22:15 2021	(r38235)
@@ -58,7 +58,7 @@
 #define XMIN(a,b) ((a) < (b) ? (a) : (b))
 
 //===========================================================================//
-static const uint8_t  __attribute__((aligned(8))) dither[8][8]={
+DECLARE_ALIGNED(8, static const uint8_t, dither)[8][8]={
 {  0,  48,  12,  60,   3,  51,  15,  63, },
 { 32,  16,  44,  28,  35,  19,  47,  31, },
 {  8,  56,   4,  52,  11,  59,   7,  55, },
@@ -383,7 +383,7 @@ static void filter(struct vf_priv_s *p,
         int x, y, i;
         const int count= 1<<p->log2_count;
         const int stride= is_luma ? p->temp_stride : ((width+16+15)&(~15));
-        uint64_t __attribute__((aligned(16))) block_align[32];
+        LOCAL_ALIGNED_16(uint64_t, block_align, [32]);
         int16_t *block = (int16_t *)block_align;
         int16_t *block2= (int16_t *)(block_align+16);
 

Modified: trunk/m_config.h
==============================================================================
--- trunk/m_config.h	Sat Jan 23 20:22:13 2021	(r38234)
+++ trunk/m_config.h	Sat Jan 23 20:22:15 2021	(r38235)
@@ -19,6 +19,8 @@
 #ifndef MPLAYER_M_CONFIG_H
 #define MPLAYER_M_CONFIG_H
 
+#include "libavutil/mem_internal.h"
+
 /// \defgroup Config Config manager
 ///
 /// m_config provides an API to manipulate the config variables in MPlayer.
@@ -43,7 +45,7 @@ struct m_config_save_slot {
   int lvl;
   // We have to store other datatypes in this as well,
   // so make sure we get properly aligned addresses.
-  unsigned char data[0] __attribute__ ((aligned (8)));
+  DECLARE_ALIGNED(8, unsigned char, data)[0];
 };
 
 /// Config option

Modified: trunk/sub/osd.c
==============================================================================
--- trunk/sub/osd.c	Sat Jan 23 20:22:13 2021	(r38234)
+++ trunk/sub/osd.c	Sat Jan 23 20:22:15 2021	(r38235)
@@ -28,13 +28,14 @@
 #include "mp_msg.h"
 #include <inttypes.h>
 #include <stdlib.h>
+#include "libavutil/mem_internal.h"
 #include "libmpcodecs/img_format.h"
 #include "cpudetect.h"
 
 #if ARCH_X86 && (!HAVE_SSE2 || CONFIG_RUNTIME_CPUDETECT)
-static const uint64_t bFF __attribute__((aligned(8))) = 0xFFFFFFFFFFFFFFFFULL;
-static const unsigned long long mask24lh  __attribute__((aligned(8))) = 0xFFFF000000000000ULL;
-static const unsigned long long mask24hl  __attribute__((aligned(8))) = 0x0000FFFFFFFFFFFFULL;
+DECLARE_ALIGNED(8, static const uint64_t, bFF) = 0xFFFFFFFFFFFFFFFFULL;
+DECLARE_ALIGNED(8, static const unsigned long long, mask24lh) = 0xFFFF000000000000ULL;
+DECLARE_ALIGNED(8, static const unsigned long long, mask24hl) = 0x0000FFFFFFFFFFFFULL;
 #endif
 
 //Note: we have C, X86-nommx, MMX, MMX2, 3DNOW version therse no 3DNOW+MMX2 one


More information about the MPlayer-cvslog mailing list