Mercurial > libavutil.hg
annotate internal.h @ 108:11be8e0d1344 libavutil
Add official LGPL license headers to the files that were missing them.
author | diego |
---|---|
date | Sun, 10 Sep 2006 14:02:42 +0000 |
parents | c04f921c5976 |
children | 37779851c665 |
rev | line source |
---|---|
108
11be8e0d1344
Add official LGPL license headers to the files that were missing them.
diego
parents:
107
diff
changeset
|
1 /* |
11be8e0d1344
Add official LGPL license headers to the files that were missing them.
diego
parents:
107
diff
changeset
|
2 * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> |
11be8e0d1344
Add official LGPL license headers to the files that were missing them.
diego
parents:
107
diff
changeset
|
3 * |
11be8e0d1344
Add official LGPL license headers to the files that were missing them.
diego
parents:
107
diff
changeset
|
4 * This library is free software; you can redistribute it and/or |
11be8e0d1344
Add official LGPL license headers to the files that were missing them.
diego
parents:
107
diff
changeset
|
5 * modify it under the terms of the GNU Lesser General Public |
11be8e0d1344
Add official LGPL license headers to the files that were missing them.
diego
parents:
107
diff
changeset
|
6 * License as published by the Free Software Foundation; either |
11be8e0d1344
Add official LGPL license headers to the files that were missing them.
diego
parents:
107
diff
changeset
|
7 * version 2 of the License, or (at your option) any later version. |
11be8e0d1344
Add official LGPL license headers to the files that were missing them.
diego
parents:
107
diff
changeset
|
8 * |
11be8e0d1344
Add official LGPL license headers to the files that were missing them.
diego
parents:
107
diff
changeset
|
9 * This library is distributed in the hope that it will be useful, |
11be8e0d1344
Add official LGPL license headers to the files that were missing them.
diego
parents:
107
diff
changeset
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11be8e0d1344
Add official LGPL license headers to the files that were missing them.
diego
parents:
107
diff
changeset
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
11be8e0d1344
Add official LGPL license headers to the files that were missing them.
diego
parents:
107
diff
changeset
|
12 * Lesser General Public License for more details. |
11be8e0d1344
Add official LGPL license headers to the files that were missing them.
diego
parents:
107
diff
changeset
|
13 * |
11be8e0d1344
Add official LGPL license headers to the files that were missing them.
diego
parents:
107
diff
changeset
|
14 * You should have received a copy of the GNU Lesser General Public |
11be8e0d1344
Add official LGPL license headers to the files that were missing them.
diego
parents:
107
diff
changeset
|
15 * License along with this library; if not, write to the Free Software |
11be8e0d1344
Add official LGPL license headers to the files that were missing them.
diego
parents:
107
diff
changeset
|
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
11be8e0d1344
Add official LGPL license headers to the files that were missing them.
diego
parents:
107
diff
changeset
|
17 */ |
11be8e0d1344
Add official LGPL license headers to the files that were missing them.
diego
parents:
107
diff
changeset
|
18 |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
19 /** |
80
624fc3ad183a
Split common.h in two parts, purely internal stuff (internal.h) and things
reimar
parents:
75
diff
changeset
|
20 * @file internal.h |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
21 * common internal api header. |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
22 */ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
23 |
80
624fc3ad183a
Split common.h in two parts, purely internal stuff (internal.h) and things
reimar
parents:
75
diff
changeset
|
24 #ifndef INTERNAL_H |
624fc3ad183a
Split common.h in two parts, purely internal stuff (internal.h) and things
reimar
parents:
75
diff
changeset
|
25 #define INTERNAL_H |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
26 |
57
4d00c7c7d07d
Make ffmpeg better support pic - from Diego Petten <flameeyes@gentoo.org>
lu_zero
parents:
55
diff
changeset
|
27 #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
|
28 # define PIC |
4d00c7c7d07d
Make ffmpeg better support pic - from Diego Petten <flameeyes@gentoo.org>
lu_zero
parents:
55
diff
changeset
|
29 #endif |
4d00c7c7d07d
Make ffmpeg better support pic - from Diego Petten <flameeyes@gentoo.org>
lu_zero
parents:
55
diff
changeset
|
30 |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
31 # ifndef ENODATA |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
32 # define ENODATA 61 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
33 # endif |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
34 |
89
59433f391f2d
do not include bswap.h in common.h for external programs, since the former
reimar
parents:
80
diff
changeset
|
35 #include "bswap.h" |
59433f391f2d
do not include bswap.h in common.h for external programs, since the former
reimar
parents:
80
diff
changeset
|
36 |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
37 #include <stddef.h> |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
38 #ifndef offsetof |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
39 # 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
|
40 #endif |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
41 |
74 | 42 #ifdef __MINGW32__ |
75 | 43 # ifdef _DEBUG |
44 # define DEBUG | |
45 # endif | |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
46 |
75 | 47 # define snprintf _snprintf |
48 # define vsnprintf _vsnprintf | |
19 | 49 |
75 | 50 # ifdef CONFIG_WINCE |
51 # define perror(a) | |
52 # endif | |
19 | 53 |
66
c619660c74ab
CONFIG_WIN32 implies MinGW and Cygwin and possibly more, so use just
diego
parents:
65
diff
changeset
|
54 /* __MINGW32__ end */ |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
55 #elif defined (CONFIG_OS2) |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
56 /* OS/2 EMX */ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
57 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
58 #include <float.h> |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
59 |
73 | 60 #endif /* !__MINGW32__ && CONFIG_OS2 */ |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
61 |
73 | 62 # ifdef USE_FASTMEMCPY |
98 | 63 # include "libvo/fastmemcpy.h" |
73 | 64 # endif |
0
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 // 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
|
67 # if defined(__MINGW32__) || defined(__CYGWIN__) || \ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
68 defined(__OS2__) || (defined (__OpenBSD__) && !defined(__ELF__)) |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
69 # if defined(ARCH_X86_64) && defined(PIC) |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
70 # define MANGLE(a) "_" #a"(%%rip)" |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
71 # else |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
72 # define MANGLE(a) "_" #a |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
73 # endif |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
74 # else |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
75 # if defined(ARCH_X86_64) && defined(PIC) |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
76 # define MANGLE(a) #a"(%%rip)" |
31
7b1170d0da89
Proper mangling information for symbols in OS X Mach-O shared objects.
diego
parents:
22
diff
changeset
|
77 # elif defined(CONFIG_DARWIN) |
7b1170d0da89
Proper mangling information for symbols in OS X Mach-O shared objects.
diego
parents:
22
diff
changeset
|
78 # define MANGLE(a) "_" #a |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
79 # else |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
80 # define MANGLE(a) #a |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
81 # endif |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
82 # endif |
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 /* debug stuff */ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
85 |
44
96a4efa91a4d
make sure NDEBUG is not defined already before defining it
gpoirier
parents:
39
diff
changeset
|
86 # if !defined(DEBUG) && !defined(NDEBUG) |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
87 # define NDEBUG |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
88 # endif |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
89 # include <assert.h> |
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 /* dprintf macros */ |
65 | 92 # ifdef DEBUG |
93 # define dprintf(fmt,...) av_log(NULL, AV_LOG_DEBUG, fmt, __VA_ARGS__) | |
94 # else | |
95 # define dprintf(fmt,...) | |
96 # endif | |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
97 |
19 | 98 # ifdef CONFIG_WINCE |
99 # define abort() | |
100 # endif | |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
101 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
102 # 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
|
103 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
104 extern const uint32_t inverse[256]; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
105 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
106 #if defined(ARCH_X86) || defined(ARCH_X86_64) |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
107 # define FASTDIV(a,b) \ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
108 ({\ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
109 int ret,dmy;\ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
110 asm volatile(\ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
111 "mull %3"\ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
112 :"=d"(ret),"=a"(dmy)\ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
113 :"1"(a),"g"(inverse[b])\ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
114 );\ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
115 ret;\ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
116 }) |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
117 #elif defined(CONFIG_FASTDIV) |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
118 # 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
|
119 #else |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
120 # define FASTDIV(a,b) ((a)/(b)) |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
121 #endif |
12 | 122 |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
123 /* math */ |
22
3b56407b3f96
On MinGW it is not possible to build shared and static libraries at once.
diego
parents:
19
diff
changeset
|
124 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
|
125 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
126 static inline int ff_sqrt(int a) |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
127 { |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
128 int ret=0; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
129 int s; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
130 int ret_sq=0; |
12 | 131 |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
132 if(a<128) return ff_sqrt_tab[a]; |
12 | 133 |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
134 for(s=15; s>=0; s--){ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
135 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
|
136 if(b<=a){ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
137 ret_sq=b; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
138 ret+= 1<<s; |
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 } |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
141 return ret; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
142 } |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
143 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
144 #if defined(ARCH_X86) || defined(ARCH_X86_64) |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
145 #define MASK_ABS(mask, level)\ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
146 asm volatile(\ |
13 | 147 "cdq \n\t"\ |
148 "xorl %1, %0 \n\t"\ | |
149 "subl %1, %0 \n\t"\ | |
150 : "+a" (level), "=&d" (mask)\ | |
151 ); | |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
152 #else |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
153 #define MASK_ABS(mask, level)\ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
154 mask= level>>31;\ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
155 level= (level^mask)-mask; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
156 #endif |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
157 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
158 #if __CPU__ >= 686 && !defined(RUNTIME_CPUDETECT) |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
159 #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
|
160 asm volatile (\ |
13 | 161 "cmpl %0, %3 \n\t"\ |
162 "cmovl %3, %0 \n\t"\ | |
163 "cmovl %4, %1 \n\t"\ | |
164 "cmovl %5, %2 \n\t"\ | |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
165 : "+r" (x), "+r" (a), "+r" (c)\ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
166 : "r" (y), "r" (b), "r" (d)\ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
167 ); |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
168 #else |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
169 #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
|
170 if((y)<(x)){\ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
171 (x)=(y);\ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
172 (a)=(b);\ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
173 (c)=(d);\ |
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 #endif |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
176 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
177 /* avoid usage of various functions */ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
178 #define malloc please_use_av_malloc |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
179 #define free please_use_av_free |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
180 #define realloc please_use_av_realloc |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
181 #define time time_is_forbidden_due_to_security_issues |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
182 #define rand rand_is_forbidden_due_to_state_trashing |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
183 #define srand srand_is_forbidden_due_to_state_trashing |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
184 #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
|
185 #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
|
186 #if !(defined(LIBAVFORMAT_BUILD) || defined(_FRAMEHOOK_H)) |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
187 #define printf please_use_av_log |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
188 #define fprintf please_use_av_log |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
189 #endif |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
190 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
191 #define CHECKED_ALLOCZ(p, size)\ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
192 {\ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
193 p= av_mallocz(size);\ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
194 if(p==NULL && (size)!=0){\ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
195 perror("malloc");\ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
196 goto fail;\ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
197 }\ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
198 } |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
199 |
4
26a00aee5eac
Move lrintf implementation from libavcodec/dsputil.h to libavutil/common.h
diego
parents:
3
diff
changeset
|
200 #ifndef HAVE_LRINTF |
26a00aee5eac
Move lrintf implementation from libavcodec/dsputil.h to libavutil/common.h
diego
parents:
3
diff
changeset
|
201 /* 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
|
202 /* better than nothing implementation. */ |
26a00aee5eac
Move lrintf implementation from libavcodec/dsputil.h to libavutil/common.h
diego
parents:
3
diff
changeset
|
203 /* 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
|
204 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
|
205 { |
66
c619660c74ab
CONFIG_WIN32 implies MinGW and Cygwin and possibly more, so use just
diego
parents:
65
diff
changeset
|
206 #ifdef __MINGW32__ |
4
26a00aee5eac
Move lrintf implementation from libavcodec/dsputil.h to libavutil/common.h
diego
parents:
3
diff
changeset
|
207 # ifdef ARCH_X86 |
26a00aee5eac
Move lrintf implementation from libavcodec/dsputil.h to libavutil/common.h
diego
parents:
3
diff
changeset
|
208 int32_t i; |
26a00aee5eac
Move lrintf implementation from libavcodec/dsputil.h to libavutil/common.h
diego
parents:
3
diff
changeset
|
209 asm volatile( |
26a00aee5eac
Move lrintf implementation from libavcodec/dsputil.h to libavutil/common.h
diego
parents:
3
diff
changeset
|
210 "fistpl %0\n\t" |
26a00aee5eac
Move lrintf implementation from libavcodec/dsputil.h to libavutil/common.h
diego
parents:
3
diff
changeset
|
211 : "=m" (i) : "t" (x) : "st" |
26a00aee5eac
Move lrintf implementation from libavcodec/dsputil.h to libavutil/common.h
diego
parents:
3
diff
changeset
|
212 ); |
26a00aee5eac
Move lrintf implementation from libavcodec/dsputil.h to libavutil/common.h
diego
parents:
3
diff
changeset
|
213 return i; |
26a00aee5eac
Move lrintf implementation from libavcodec/dsputil.h to libavutil/common.h
diego
parents:
3
diff
changeset
|
214 # else |
26a00aee5eac
Move lrintf implementation from libavcodec/dsputil.h to libavutil/common.h
diego
parents:
3
diff
changeset
|
215 /* XXX: incorrect, but make it compile */ |
26a00aee5eac
Move lrintf implementation from libavcodec/dsputil.h to libavutil/common.h
diego
parents:
3
diff
changeset
|
216 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
|
217 # endif /* ARCH_X86 */ |
26a00aee5eac
Move lrintf implementation from libavcodec/dsputil.h to libavutil/common.h
diego
parents:
3
diff
changeset
|
218 #else |
26a00aee5eac
Move lrintf implementation from libavcodec/dsputil.h to libavutil/common.h
diego
parents:
3
diff
changeset
|
219 return (int)(rint(x)); |
66
c619660c74ab
CONFIG_WIN32 implies MinGW and Cygwin and possibly more, so use just
diego
parents:
65
diff
changeset
|
220 #endif /* __MINGW32__ */ |
4
26a00aee5eac
Move lrintf implementation from libavcodec/dsputil.h to libavutil/common.h
diego
parents:
3
diff
changeset
|
221 } |
26a00aee5eac
Move lrintf implementation from libavcodec/dsputil.h to libavutil/common.h
diego
parents:
3
diff
changeset
|
222 #endif /* HAVE_LRINTF */ |
26a00aee5eac
Move lrintf implementation from libavcodec/dsputil.h to libavutil/common.h
diego
parents:
3
diff
changeset
|
223 |
80
624fc3ad183a
Split common.h in two parts, purely internal stuff (internal.h) and things
reimar
parents:
75
diff
changeset
|
224 #endif /* INTERNAL_H */ |