annotate internal.h @ 107:c04f921c5976 libavutil

Remove unused defines, patch by takis P issaris A uhasselt P be Original thread: Re: [Ffmpeg-devel] [PATCH] Remove unused internal macros Sep 7 2006, 14:05
author gpoirier
date Thu, 07 Sep 2006 13:42:36 +0000
parents e5409bf748df
children 11be8e0d1344
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
1 /**
80
624fc3ad183a Split common.h in two parts, purely internal stuff (internal.h) and things
reimar
parents: 75
diff changeset
2 * @file internal.h
0
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
3 * common internal api header.
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
4 */
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
5
80
624fc3ad183a Split common.h in two parts, purely internal stuff (internal.h) and things
reimar
parents: 75
diff changeset
6 #ifndef INTERNAL_H
624fc3ad183a Split common.h in two parts, purely internal stuff (internal.h) and things
reimar
parents: 75
diff changeset
7 #define INTERNAL_H
0
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
8
57
4d00c7c7d07d Make ffmpeg better support pic - from Diego Petten <flameeyes@gentoo.org>
lu_zero
parents: 55
diff changeset
9 #if ( defined(__PIC__) || defined(__pic__) ) && ! defined(PIC)
4d00c7c7d07d Make ffmpeg better support pic - from Diego Petten <flameeyes@gentoo.org>
lu_zero
parents: 55
diff changeset
10 # define PIC
4d00c7c7d07d Make ffmpeg better support pic - from Diego Petten <flameeyes@gentoo.org>
lu_zero
parents: 55
diff changeset
11 #endif
4d00c7c7d07d Make ffmpeg better support pic - from Diego Petten <flameeyes@gentoo.org>
lu_zero
parents: 55
diff changeset
12
0
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
13 # ifndef ENODATA
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
14 # define ENODATA 61
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
15 # endif
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
16
89
59433f391f2d do not include bswap.h in common.h for external programs, since the former
reimar
parents: 80
diff changeset
17 #include "bswap.h"
59433f391f2d do not include bswap.h in common.h for external programs, since the former
reimar
parents: 80
diff changeset
18
0
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
19 #include <stddef.h>
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
20 #ifndef offsetof
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
21 # define offsetof(T,F) ((unsigned int)((char *)&((T *)0)->F))
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
22 #endif
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
23
74
a298a8eae4f2 simplify
mru
parents: 73
diff changeset
24 #ifdef __MINGW32__
75
mru
parents: 74
diff changeset
25 # ifdef _DEBUG
mru
parents: 74
diff changeset
26 # define DEBUG
mru
parents: 74
diff changeset
27 # endif
0
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
28
75
mru
parents: 74
diff changeset
29 # define snprintf _snprintf
mru
parents: 74
diff changeset
30 # define vsnprintf _vsnprintf
19
2a55eb7ca57b WinCE cross-compilation support
diego
parents: 13
diff changeset
31
75
mru
parents: 74
diff changeset
32 # ifdef CONFIG_WINCE
mru
parents: 74
diff changeset
33 # define perror(a)
mru
parents: 74
diff changeset
34 # endif
19
2a55eb7ca57b WinCE cross-compilation support
diego
parents: 13
diff changeset
35
66
c619660c74ab CONFIG_WIN32 implies MinGW and Cygwin and possibly more, so use just
diego
parents: 65
diff changeset
36 /* __MINGW32__ end */
0
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
37 #elif defined (CONFIG_OS2)
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
38 /* OS/2 EMX */
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
39
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
40 #include <float.h>
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
41
73
9718c0d015cc simplify
mru
parents: 72
diff changeset
42 #endif /* !__MINGW32__ && CONFIG_OS2 */
0
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
43
73
9718c0d015cc simplify
mru
parents: 72
diff changeset
44 # ifdef USE_FASTMEMCPY
98
e5409bf748df Explicitly include fastmemcpy.h from libvo/.
diego
parents: 89
diff changeset
45 # include "libvo/fastmemcpy.h"
73
9718c0d015cc simplify
mru
parents: 72
diff changeset
46 # endif
0
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
47
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
48 // Use rip-relative addressing if compiling PIC code on x86-64.
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
49 # if defined(__MINGW32__) || defined(__CYGWIN__) || \
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
50 defined(__OS2__) || (defined (__OpenBSD__) && !defined(__ELF__))
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
51 # if defined(ARCH_X86_64) && defined(PIC)
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
52 # define MANGLE(a) "_" #a"(%%rip)"
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
53 # else
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
54 # define MANGLE(a) "_" #a
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
55 # endif
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
56 # else
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
57 # if defined(ARCH_X86_64) && defined(PIC)
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
58 # define MANGLE(a) #a"(%%rip)"
31
7b1170d0da89 Proper mangling information for symbols in OS X Mach-O shared objects.
diego
parents: 22
diff changeset
59 # elif defined(CONFIG_DARWIN)
7b1170d0da89 Proper mangling information for symbols in OS X Mach-O shared objects.
diego
parents: 22
diff changeset
60 # define MANGLE(a) "_" #a
0
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
61 # else
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
62 # define MANGLE(a) #a
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
63 # endif
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
64 # endif
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
65
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
66 /* debug stuff */
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
67
44
96a4efa91a4d make sure NDEBUG is not defined already before defining it
gpoirier
parents: 39
diff changeset
68 # if !defined(DEBUG) && !defined(NDEBUG)
0
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
69 # define NDEBUG
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
70 # endif
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
71 # include <assert.h>
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
72
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
73 /* dprintf macros */
65
2840042b3f5d cosmetics: Fix indentation after last commit.
diego
parents: 64
diff changeset
74 # ifdef DEBUG
2840042b3f5d cosmetics: Fix indentation after last commit.
diego
parents: 64
diff changeset
75 # define dprintf(fmt,...) av_log(NULL, AV_LOG_DEBUG, fmt, __VA_ARGS__)
2840042b3f5d cosmetics: Fix indentation after last commit.
diego
parents: 64
diff changeset
76 # else
2840042b3f5d cosmetics: Fix indentation after last commit.
diego
parents: 64
diff changeset
77 # define dprintf(fmt,...)
2840042b3f5d cosmetics: Fix indentation after last commit.
diego
parents: 64
diff changeset
78 # endif
0
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
79
19
2a55eb7ca57b WinCE cross-compilation support
diego
parents: 13
diff changeset
80 # ifdef CONFIG_WINCE
2a55eb7ca57b WinCE cross-compilation support
diego
parents: 13
diff changeset
81 # define abort()
2a55eb7ca57b WinCE cross-compilation support
diego
parents: 13
diff changeset
82 # endif
0
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
83
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
84 # define av_abort() do { av_log(NULL, AV_LOG_ERROR, "Abort at %s:%d\n", __FILE__, __LINE__); abort(); } while (0)
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
85
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
86 extern const uint32_t inverse[256];
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
87
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
88 #if defined(ARCH_X86) || defined(ARCH_X86_64)
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
89 # define FASTDIV(a,b) \
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
90 ({\
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
91 int ret,dmy;\
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
92 asm volatile(\
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
93 "mull %3"\
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
94 :"=d"(ret),"=a"(dmy)\
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
95 :"1"(a),"g"(inverse[b])\
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
96 );\
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
97 ret;\
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
98 })
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
99 #elif defined(CONFIG_FASTDIV)
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
100 # define FASTDIV(a,b) ((uint32_t)((((uint64_t)a)*inverse[b])>>32))
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
101 #else
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
102 # define FASTDIV(a,b) ((a)/(b))
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
103 #endif
12
ce8f9f4390c3 COSMETICS: Remove all trailing whitespace.
diego
parents: 11
diff changeset
104
0
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
105 /* math */
22
3b56407b3f96 On MinGW it is not possible to build shared and static libraries at once.
diego
parents: 19
diff changeset
106 extern FF_IMPORT_ATTR const uint8_t ff_sqrt_tab[128];
0
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
107
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
108 static inline int ff_sqrt(int a)
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
109 {
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
110 int ret=0;
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
111 int s;
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
112 int ret_sq=0;
12
ce8f9f4390c3 COSMETICS: Remove all trailing whitespace.
diego
parents: 11
diff changeset
113
0
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
114 if(a<128) return ff_sqrt_tab[a];
12
ce8f9f4390c3 COSMETICS: Remove all trailing whitespace.
diego
parents: 11
diff changeset
115
0
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
116 for(s=15; s>=0; s--){
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
117 int b= ret_sq + (1<<(s*2)) + (ret<<s)*2;
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
118 if(b<=a){
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
119 ret_sq=b;
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
120 ret+= 1<<s;
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
121 }
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
122 }
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
123 return ret;
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
124 }
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
125
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
126 #if defined(ARCH_X86) || defined(ARCH_X86_64)
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
127 #define MASK_ABS(mask, level)\
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
128 asm volatile(\
13
aedb6bd881b9 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 12
diff changeset
129 "cdq \n\t"\
aedb6bd881b9 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 12
diff changeset
130 "xorl %1, %0 \n\t"\
aedb6bd881b9 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 12
diff changeset
131 "subl %1, %0 \n\t"\
aedb6bd881b9 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 12
diff changeset
132 : "+a" (level), "=&d" (mask)\
aedb6bd881b9 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 12
diff changeset
133 );
0
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
134 #else
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
135 #define MASK_ABS(mask, level)\
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
136 mask= level>>31;\
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
137 level= (level^mask)-mask;
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
138 #endif
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
139
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
140 #if __CPU__ >= 686 && !defined(RUNTIME_CPUDETECT)
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
141 #define COPY3_IF_LT(x,y,a,b,c,d)\
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
142 asm volatile (\
13
aedb6bd881b9 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 12
diff changeset
143 "cmpl %0, %3 \n\t"\
aedb6bd881b9 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 12
diff changeset
144 "cmovl %3, %0 \n\t"\
aedb6bd881b9 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 12
diff changeset
145 "cmovl %4, %1 \n\t"\
aedb6bd881b9 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 12
diff changeset
146 "cmovl %5, %2 \n\t"\
0
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
147 : "+r" (x), "+r" (a), "+r" (c)\
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
148 : "r" (y), "r" (b), "r" (d)\
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
149 );
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
150 #else
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
151 #define COPY3_IF_LT(x,y,a,b,c,d)\
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
152 if((y)<(x)){\
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
153 (x)=(y);\
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
154 (a)=(b);\
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
155 (c)=(d);\
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
156 }
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
157 #endif
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
158
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
159 /* avoid usage of various functions */
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
160 #define malloc please_use_av_malloc
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
161 #define free please_use_av_free
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
162 #define realloc please_use_av_realloc
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
163 #define time time_is_forbidden_due_to_security_issues
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
164 #define rand rand_is_forbidden_due_to_state_trashing
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
165 #define srand srand_is_forbidden_due_to_state_trashing
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
166 #define sprintf sprintf_is_forbidden_due_to_security_issues_use_snprintf
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
167 #define strcat strcat_is_forbidden_due_to_security_issues_use_pstrcat
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
168 #if !(defined(LIBAVFORMAT_BUILD) || defined(_FRAMEHOOK_H))
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
169 #define printf please_use_av_log
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
170 #define fprintf please_use_av_log
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
171 #endif
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
172
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
173 #define CHECKED_ALLOCZ(p, size)\
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
174 {\
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
175 p= av_mallocz(size);\
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
176 if(p==NULL && (size)!=0){\
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
177 perror("malloc");\
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
178 goto fail;\
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
179 }\
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
180 }
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
181
4
26a00aee5eac Move lrintf implementation from libavcodec/dsputil.h to libavutil/common.h
diego
parents: 3
diff changeset
182 #ifndef HAVE_LRINTF
26a00aee5eac Move lrintf implementation from libavcodec/dsputil.h to libavutil/common.h
diego
parents: 3
diff changeset
183 /* XXX: add ISOC specific test to avoid specific BSD testing. */
26a00aee5eac Move lrintf implementation from libavcodec/dsputil.h to libavutil/common.h
diego
parents: 3
diff changeset
184 /* better than nothing implementation. */
26a00aee5eac Move lrintf implementation from libavcodec/dsputil.h to libavutil/common.h
diego
parents: 3
diff changeset
185 /* btw, rintf() is existing on fbsd too -- alex */
26a00aee5eac Move lrintf implementation from libavcodec/dsputil.h to libavutil/common.h
diego
parents: 3
diff changeset
186 static always_inline long int lrintf(float x)
26a00aee5eac Move lrintf implementation from libavcodec/dsputil.h to libavutil/common.h
diego
parents: 3
diff changeset
187 {
66
c619660c74ab CONFIG_WIN32 implies MinGW and Cygwin and possibly more, so use just
diego
parents: 65
diff changeset
188 #ifdef __MINGW32__
4
26a00aee5eac Move lrintf implementation from libavcodec/dsputil.h to libavutil/common.h
diego
parents: 3
diff changeset
189 # ifdef ARCH_X86
26a00aee5eac Move lrintf implementation from libavcodec/dsputil.h to libavutil/common.h
diego
parents: 3
diff changeset
190 int32_t i;
26a00aee5eac Move lrintf implementation from libavcodec/dsputil.h to libavutil/common.h
diego
parents: 3
diff changeset
191 asm volatile(
26a00aee5eac Move lrintf implementation from libavcodec/dsputil.h to libavutil/common.h
diego
parents: 3
diff changeset
192 "fistpl %0\n\t"
26a00aee5eac Move lrintf implementation from libavcodec/dsputil.h to libavutil/common.h
diego
parents: 3
diff changeset
193 : "=m" (i) : "t" (x) : "st"
26a00aee5eac Move lrintf implementation from libavcodec/dsputil.h to libavutil/common.h
diego
parents: 3
diff changeset
194 );
26a00aee5eac Move lrintf implementation from libavcodec/dsputil.h to libavutil/common.h
diego
parents: 3
diff changeset
195 return i;
26a00aee5eac Move lrintf implementation from libavcodec/dsputil.h to libavutil/common.h
diego
parents: 3
diff changeset
196 # else
26a00aee5eac Move lrintf implementation from libavcodec/dsputil.h to libavutil/common.h
diego
parents: 3
diff changeset
197 /* XXX: incorrect, but make it compile */
26a00aee5eac Move lrintf implementation from libavcodec/dsputil.h to libavutil/common.h
diego
parents: 3
diff changeset
198 return (int)(x + (x < 0 ? -0.5 : 0.5));
26a00aee5eac Move lrintf implementation from libavcodec/dsputil.h to libavutil/common.h
diego
parents: 3
diff changeset
199 # endif /* ARCH_X86 */
26a00aee5eac Move lrintf implementation from libavcodec/dsputil.h to libavutil/common.h
diego
parents: 3
diff changeset
200 #else
26a00aee5eac Move lrintf implementation from libavcodec/dsputil.h to libavutil/common.h
diego
parents: 3
diff changeset
201 return (int)(rint(x));
66
c619660c74ab CONFIG_WIN32 implies MinGW and Cygwin and possibly more, so use just
diego
parents: 65
diff changeset
202 #endif /* __MINGW32__ */
4
26a00aee5eac Move lrintf implementation from libavcodec/dsputil.h to libavutil/common.h
diego
parents: 3
diff changeset
203 }
26a00aee5eac Move lrintf implementation from libavcodec/dsputil.h to libavutil/common.h
diego
parents: 3
diff changeset
204 #endif /* HAVE_LRINTF */
26a00aee5eac Move lrintf implementation from libavcodec/dsputil.h to libavutil/common.h
diego
parents: 3
diff changeset
205
80
624fc3ad183a Split common.h in two parts, purely internal stuff (internal.h) and things
reimar
parents: 75
diff changeset
206 #endif /* INTERNAL_H */