[MPlayer-cvslog] r38253 - in trunk: libmpcodecs/vf_filmdint.c libmpcodecs/vf_fspp.c libmpcodecs/vf_gradfun.c libmpcodecs/vf_ow.c libmpcodecs/vf_pp7.c libmpcodecs/vf_spp.c libmpcodecs/vf_uspp.c m_config.h mpmem.h su...

reimar subversion at mplayerhq.hu
Sat Feb 13 20:35:31 EET 2021


Author: reimar
Date: Sat Feb 13 20:35:30 2021
New Revision: 38253

Log:
Fix dependencies on libavutil/mem_internal.h

Especially relevant once DECLARE_ALIGNED will be removed
from mem.h.
While keeping our own copy is a bit ugly and wasteful, it
seems like the best option overall, even if I'd prefer
that mem_internal functionality was instead available
to users of FFmpeg.

Added:
   trunk/mpmem.h
Modified:
   trunk/libmpcodecs/vf_filmdint.c
   trunk/libmpcodecs/vf_fspp.c
   trunk/libmpcodecs/vf_gradfun.c
   trunk/libmpcodecs/vf_ow.c
   trunk/libmpcodecs/vf_pp7.c
   trunk/libmpcodecs/vf_spp.c
   trunk/libmpcodecs/vf_uspp.c
   trunk/m_config.h
   trunk/sub/osd.c

Modified: trunk/libmpcodecs/vf_filmdint.c
==============================================================================
--- trunk/libmpcodecs/vf_filmdint.c	Fri Feb 12 01:49:14 2021	(r38252)
+++ trunk/libmpcodecs/vf_filmdint.c	Sat Feb 13 20:35:30 2021	(r38253)
@@ -24,6 +24,7 @@
 #include "mp_msg.h"
 #include "cpudetect.h"
 #include "osdep/timer.h"
+#include "mpmem.h"
 
 #include "img_format.h"
 #include "mp_image.h"

Modified: trunk/libmpcodecs/vf_fspp.c
==============================================================================
--- trunk/libmpcodecs/vf_fspp.c	Fri Feb 12 01:49:14 2021	(r38252)
+++ trunk/libmpcodecs/vf_fspp.c	Sat Feb 13 20:35:30 2021	(r38253)
@@ -50,7 +50,7 @@
 
 #include "libavutil/internal.h"
 #include "libavutil/intreadwrite.h"
-#include "libavutil/mem.h"
+#include "mpmem.h"
 #include "mpx86asm.h"
 #include "libavcodec/avcodec.h"
 

Modified: trunk/libmpcodecs/vf_gradfun.c
==============================================================================
--- trunk/libmpcodecs/vf_gradfun.c	Fri Feb 12 01:49:14 2021	(r38252)
+++ trunk/libmpcodecs/vf_gradfun.c	Sat Feb 13 20:35:30 2021	(r38253)
@@ -40,7 +40,7 @@
 #include "libvo/fastmemcpy.h"
 #include "libavutil/avutil.h"
 #include "libavutil/common.h"
-#include "libavutil/mem.h"
+#include "mpmem.h"
 #include "mpx86asm.h"
 
 struct vf_priv_s {

Modified: trunk/libmpcodecs/vf_ow.c
==============================================================================
--- trunk/libmpcodecs/vf_ow.c	Fri Feb 12 01:49:14 2021	(r38252)
+++ trunk/libmpcodecs/vf_ow.c	Sat Feb 13 20:35:30 2021	(r38253)
@@ -32,7 +32,7 @@
 #include <inttypes.h>
 #include <math.h>
 
-#include "libavutil/mem_internal.h"
+#include "mpmem.h"
 #include "mp_msg.h"
 #include "img_format.h"
 #include "mp_image.h"

Modified: trunk/libmpcodecs/vf_pp7.c
==============================================================================
--- trunk/libmpcodecs/vf_pp7.c	Fri Feb 12 01:49:14 2021	(r38252)
+++ trunk/libmpcodecs/vf_pp7.c	Sat Feb 13 20:35:30 2021	(r38253)
@@ -35,6 +35,7 @@
 #endif
 
 #include "libavutil/mem.h"
+#include "mpmem.h"
 
 #include "img_format.h"
 #include "mp_image.h"

Modified: trunk/libmpcodecs/vf_spp.c
==============================================================================
--- trunk/libmpcodecs/vf_spp.c	Fri Feb 12 01:49:14 2021	(r38252)
+++ trunk/libmpcodecs/vf_spp.c	Sat Feb 13 20:35:30 2021	(r38253)
@@ -34,12 +34,12 @@
 
 #include "config.h"
 
+#include "mpmem.h"
 #include "mp_msg.h"
 #include "cpudetect.h"
 
 #include "libavutil/common.h"
 #include "libavutil/internal.h"
-#include "libavutil/mem_internal.h"
 #include "libavutil/intreadwrite.h"
 #include "libavcodec/avcodec.h"
 #include "libavcodec/pixblockdsp.h"

Modified: trunk/libmpcodecs/vf_uspp.c
==============================================================================
--- trunk/libmpcodecs/vf_uspp.c	Fri Feb 12 01:49:14 2021	(r38252)
+++ trunk/libmpcodecs/vf_uspp.c	Sat Feb 13 20:35:30 2021	(r38253)
@@ -30,7 +30,7 @@
 #include "mp_msg.h"
 #include "cpudetect.h"
 
-#include "libavutil/mem.h"
+#include "mpmem.h"
 #include "libavcodec/avcodec.h"
 
 #include "img_format.h"

Modified: trunk/m_config.h
==============================================================================
--- trunk/m_config.h	Fri Feb 12 01:49:14 2021	(r38252)
+++ trunk/m_config.h	Sat Feb 13 20:35:30 2021	(r38253)
@@ -19,7 +19,7 @@
 #ifndef MPLAYER_M_CONFIG_H
 #define MPLAYER_M_CONFIG_H
 
-#include "libavutil/mem_internal.h"
+#include "mpmem.h"
 
 /// \defgroup Config Config manager
 ///

Added: trunk/mpmem.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/mpmem.h	Sat Feb 13 20:35:30 2021	(r38253)
@@ -0,0 +1,89 @@
+/*
+ * This file is part of MPlayer.
+ *
+ * MPlayer is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * MPlayer is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with MPlayer; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef MPLAYER_MPMEM_H
+#define MPLAYER_MPMEM_H
+
+// copy of libavutil/mem_internal.h code for the
+// benefit of compiling against shared FFmpeg libs
+
+#include "config.h"
+
+#ifndef DECLARE_ALIGNED
+#if defined(__INTEL_COMPILER) && __INTEL_COMPILER < 1110 || defined(__SUNPRO_C)
+    #define DECLARE_ALIGNED(n,t,v)      t __attribute__ ((aligned (n))) v
+    #define DECLARE_ASM_ALIGNED(n,t,v)  t __attribute__ ((aligned (n))) v
+    #define DECLARE_ASM_CONST(n,t,v)    const t __attribute__ ((aligned (n))) v
+#elif defined(__DJGPP__)
+    #define DECLARE_ALIGNED(n,t,v)      t __attribute__ ((aligned (FFMIN(n, 16)))) v
+    #define DECLARE_ASM_ALIGNED(n,t,v)  t av_used __attribute__ ((aligned (FFMIN(n, 16)))) v
+    #define DECLARE_ASM_CONST(n,t,v)    static const t av_used __attribute__ ((aligned (FFMIN(n, 16)))) v
+#elif defined(__GNUC__) || defined(__clang__)
+    #define DECLARE_ALIGNED(n,t,v)      t __attribute__ ((aligned (n))) v
+    #define DECLARE_ASM_ALIGNED(n,t,v)  t av_used __attribute__ ((aligned (n))) v
+    #define DECLARE_ASM_CONST(n,t,v)    static const t av_used __attribute__ ((aligned (n))) v
+#elif defined(_MSC_VER)
+    #define DECLARE_ALIGNED(n,t,v)      __declspec(align(n)) t v
+    #define DECLARE_ASM_ALIGNED(n,t,v)  __declspec(align(n)) t v
+    #define DECLARE_ASM_CONST(n,t,v)    __declspec(align(n)) static const t v
+#else
+    #define DECLARE_ALIGNED(n,t,v)      t v
+    #define DECLARE_ASM_ALIGNED(n,t,v)  t v
+    #define DECLARE_ASM_CONST(n,t,v)    static const t v
+#endif
+#endif
+
+// Some broken preprocessors need a second expansion
+// to be forced to tokenize __VA_ARGS__
+#define E1(x) x
+
+#define LOCAL_ALIGNED_A(a, t, v, s, o, ...)             \
+    uint8_t la_##v[sizeof(t s o) + (a)];                \
+    t (*v) o = (void *)FFALIGN((uintptr_t)la_##v, a)
+
+#define LOCAL_ALIGNED_D(a, t, v, s, o, ...)             \
+    DECLARE_ALIGNED(a, t, la_##v) s o;                  \
+    t (*v) o = la_##v
+
+#define LOCAL_ALIGNED(a, t, v, ...) LOCAL_ALIGNED_##a(t, v, __VA_ARGS__)
+
+#if HAVE_LOCAL_ALIGNED
+#   define LOCAL_ALIGNED_4(t, v, ...) E1(LOCAL_ALIGNED_D(4, t, v, __VA_ARGS__,,))
+#else
+#   define LOCAL_ALIGNED_4(t, v, ...) E1(LOCAL_ALIGNED_A(4, t, v, __VA_ARGS__,,))
+#endif
+
+#if HAVE_LOCAL_ALIGNED
+#   define LOCAL_ALIGNED_8(t, v, ...) E1(LOCAL_ALIGNED_D(8, t, v, __VA_ARGS__,,))
+#else
+#   define LOCAL_ALIGNED_8(t, v, ...) E1(LOCAL_ALIGNED_A(8, t, v, __VA_ARGS__,,))
+#endif
+
+#if HAVE_LOCAL_ALIGNED
+#   define LOCAL_ALIGNED_16(t, v, ...) E1(LOCAL_ALIGNED_D(16, t, v, __VA_ARGS__,,))
+#else
+#   define LOCAL_ALIGNED_16(t, v, ...) E1(LOCAL_ALIGNED_A(16, t, v, __VA_ARGS__,,))
+#endif
+
+#if HAVE_LOCAL_ALIGNED
+#   define LOCAL_ALIGNED_32(t, v, ...) E1(LOCAL_ALIGNED_D(32, t, v, __VA_ARGS__,,))
+#else
+#   define LOCAL_ALIGNED_32(t, v, ...) E1(LOCAL_ALIGNED_A(32, t, v, __VA_ARGS__,,))
+#endif
+
+#endif /* MPLAYER_MPMEM_H */

Modified: trunk/sub/osd.c
==============================================================================
--- trunk/sub/osd.c	Fri Feb 12 01:49:14 2021	(r38252)
+++ trunk/sub/osd.c	Sat Feb 13 20:35:30 2021	(r38253)
@@ -28,7 +28,7 @@
 #include "mp_msg.h"
 #include <inttypes.h>
 #include <stdlib.h>
-#include "libavutil/mem_internal.h"
+#include "mpmem.h"
 #include "libmpcodecs/img_format.h"
 #include "cpudetect.h"
 


More information about the MPlayer-cvslog mailing list