Skip to content

Commit 184bfad

Browse files
author
reimar
committed
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. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@38253 b3059339-0415-0410-9bf9-f77b7e298cf2
1 parent a7aec95 commit 184bfad

10 files changed

+98
-7
lines changed

libmpcodecs/vf_filmdint.c

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "mp_msg.h"
2525
#include "cpudetect.h"
2626
#include "osdep/timer.h"
27+
#include "mpmem.h"
2728

2829
#include "img_format.h"
2930
#include "mp_image.h"

libmpcodecs/vf_fspp.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050

5151
#include "libavutil/internal.h"
5252
#include "libavutil/intreadwrite.h"
53-
#include "libavutil/mem.h"
53+
#include "mpmem.h"
5454
#include "mpx86asm.h"
5555
#include "libavcodec/avcodec.h"
5656

libmpcodecs/vf_gradfun.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
#include "libvo/fastmemcpy.h"
4141
#include "libavutil/avutil.h"
4242
#include "libavutil/common.h"
43-
#include "libavutil/mem.h"
43+
#include "mpmem.h"
4444
#include "mpx86asm.h"
4545

4646
struct vf_priv_s {

libmpcodecs/vf_ow.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
#include <inttypes.h>
3333
#include <math.h>
3434

35-
#include "libavutil/mem_internal.h"
35+
#include "mpmem.h"
3636
#include "mp_msg.h"
3737
#include "img_format.h"
3838
#include "mp_image.h"

libmpcodecs/vf_pp7.c

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#endif
3636

3737
#include "libavutil/mem.h"
38+
#include "mpmem.h"
3839

3940
#include "img_format.h"
4041
#include "mp_image.h"

libmpcodecs/vf_spp.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@
3434

3535
#include "config.h"
3636

37+
#include "mpmem.h"
3738
#include "mp_msg.h"
3839
#include "cpudetect.h"
3940

4041
#include "libavutil/common.h"
4142
#include "libavutil/internal.h"
42-
#include "libavutil/mem_internal.h"
4343
#include "libavutil/intreadwrite.h"
4444
#include "libavcodec/avcodec.h"
4545
#include "libavcodec/pixblockdsp.h"

libmpcodecs/vf_uspp.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
#include "mp_msg.h"
3131
#include "cpudetect.h"
3232

33-
#include "libavutil/mem.h"
33+
#include "mpmem.h"
3434
#include "libavcodec/avcodec.h"
3535

3636
#include "img_format.h"

m_config.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#ifndef MPLAYER_M_CONFIG_H
2020
#define MPLAYER_M_CONFIG_H
2121

22-
#include "libavutil/mem_internal.h"
22+
#include "mpmem.h"
2323

2424
/// \defgroup Config Config manager
2525
///

mpmem.h

+89
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
/*
2+
* This file is part of MPlayer.
3+
*
4+
* MPlayer is free software; you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation; either version 2 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* MPlayer is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License along
15+
* with MPlayer; if not, write to the Free Software Foundation, Inc.,
16+
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17+
*/
18+
19+
#ifndef MPLAYER_MPMEM_H
20+
#define MPLAYER_MPMEM_H
21+
22+
// copy of libavutil/mem_internal.h code for the
23+
// benefit of compiling against shared FFmpeg libs
24+
25+
#include "config.h"
26+
27+
#ifndef DECLARE_ALIGNED
28+
#if defined(__INTEL_COMPILER) && __INTEL_COMPILER < 1110 || defined(__SUNPRO_C)
29+
#define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v
30+
#define DECLARE_ASM_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v
31+
#define DECLARE_ASM_CONST(n,t,v) const t __attribute__ ((aligned (n))) v
32+
#elif defined(__DJGPP__)
33+
#define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (FFMIN(n, 16)))) v
34+
#define DECLARE_ASM_ALIGNED(n,t,v) t av_used __attribute__ ((aligned (FFMIN(n, 16)))) v
35+
#define DECLARE_ASM_CONST(n,t,v) static const t av_used __attribute__ ((aligned (FFMIN(n, 16)))) v
36+
#elif defined(__GNUC__) || defined(__clang__)
37+
#define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v
38+
#define DECLARE_ASM_ALIGNED(n,t,v) t av_used __attribute__ ((aligned (n))) v
39+
#define DECLARE_ASM_CONST(n,t,v) static const t av_used __attribute__ ((aligned (n))) v
40+
#elif defined(_MSC_VER)
41+
#define DECLARE_ALIGNED(n,t,v) __declspec(align(n)) t v
42+
#define DECLARE_ASM_ALIGNED(n,t,v) __declspec(align(n)) t v
43+
#define DECLARE_ASM_CONST(n,t,v) __declspec(align(n)) static const t v
44+
#else
45+
#define DECLARE_ALIGNED(n,t,v) t v
46+
#define DECLARE_ASM_ALIGNED(n,t,v) t v
47+
#define DECLARE_ASM_CONST(n,t,v) static const t v
48+
#endif
49+
#endif
50+
51+
// Some broken preprocessors need a second expansion
52+
// to be forced to tokenize __VA_ARGS__
53+
#define E1(x) x
54+
55+
#define LOCAL_ALIGNED_A(a, t, v, s, o, ...) \
56+
uint8_t la_##v[sizeof(t s o) + (a)]; \
57+
t (*v) o = (void *)FFALIGN((uintptr_t)la_##v, a)
58+
59+
#define LOCAL_ALIGNED_D(a, t, v, s, o, ...) \
60+
DECLARE_ALIGNED(a, t, la_##v) s o; \
61+
t (*v) o = la_##v
62+
63+
#define LOCAL_ALIGNED(a, t, v, ...) LOCAL_ALIGNED_##a(t, v, __VA_ARGS__)
64+
65+
#if HAVE_LOCAL_ALIGNED
66+
# define LOCAL_ALIGNED_4(t, v, ...) E1(LOCAL_ALIGNED_D(4, t, v, __VA_ARGS__,,))
67+
#else
68+
# define LOCAL_ALIGNED_4(t, v, ...) E1(LOCAL_ALIGNED_A(4, t, v, __VA_ARGS__,,))
69+
#endif
70+
71+
#if HAVE_LOCAL_ALIGNED
72+
# define LOCAL_ALIGNED_8(t, v, ...) E1(LOCAL_ALIGNED_D(8, t, v, __VA_ARGS__,,))
73+
#else
74+
# define LOCAL_ALIGNED_8(t, v, ...) E1(LOCAL_ALIGNED_A(8, t, v, __VA_ARGS__,,))
75+
#endif
76+
77+
#if HAVE_LOCAL_ALIGNED
78+
# define LOCAL_ALIGNED_16(t, v, ...) E1(LOCAL_ALIGNED_D(16, t, v, __VA_ARGS__,,))
79+
#else
80+
# define LOCAL_ALIGNED_16(t, v, ...) E1(LOCAL_ALIGNED_A(16, t, v, __VA_ARGS__,,))
81+
#endif
82+
83+
#if HAVE_LOCAL_ALIGNED
84+
# define LOCAL_ALIGNED_32(t, v, ...) E1(LOCAL_ALIGNED_D(32, t, v, __VA_ARGS__,,))
85+
#else
86+
# define LOCAL_ALIGNED_32(t, v, ...) E1(LOCAL_ALIGNED_A(32, t, v, __VA_ARGS__,,))
87+
#endif
88+
89+
#endif /* MPLAYER_MPMEM_H */

sub/osd.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#include "mp_msg.h"
2929
#include <inttypes.h>
3030
#include <stdlib.h>
31-
#include "libavutil/mem_internal.h"
31+
#include "mpmem.h"
3232
#include "libmpcodecs/img_format.h"
3333
#include "cpudetect.h"
3434

0 commit comments

Comments
 (0)