diff options
Diffstat (limited to 'lib/rbcodec/codecs/libwmavoice/libavutil/internal.h')
-rw-r--r-- | lib/rbcodec/codecs/libwmavoice/libavutil/internal.h | 234 |
1 files changed, 234 insertions, 0 deletions
diff --git a/lib/rbcodec/codecs/libwmavoice/libavutil/internal.h b/lib/rbcodec/codecs/libwmavoice/libavutil/internal.h new file mode 100644 index 0000000000..53d2b94c50 --- /dev/null +++ b/lib/rbcodec/codecs/libwmavoice/libavutil/internal.h | |||
@@ -0,0 +1,234 @@ | |||
1 | /* | ||
2 | * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> | ||
3 | * | ||
4 | * This file is part of FFmpeg. | ||
5 | * | ||
6 | * FFmpeg is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU Lesser General Public | ||
8 | * License as published by the Free Software Foundation; either | ||
9 | * version 2.1 of the License, or (at your option) any later version. | ||
10 | * | ||
11 | * FFmpeg is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
14 | * Lesser General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU Lesser General Public | ||
17 | * License along with FFmpeg; if not, write to the Free Software | ||
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file | ||
23 | * common internal API header | ||
24 | */ | ||
25 | |||
26 | #ifndef AVUTIL_INTERNAL_H | ||
27 | #define AVUTIL_INTERNAL_H | ||
28 | |||
29 | #if !defined(DEBUG) && !defined(NDEBUG) | ||
30 | # define NDEBUG | ||
31 | #endif | ||
32 | |||
33 | #include <limits.h> | ||
34 | #include <stdint.h> | ||
35 | #include <stddef.h> | ||
36 | #include <assert.h> | ||
37 | #include "config.h" | ||
38 | #include "attributes.h" | ||
39 | #include "timer.h" | ||
40 | |||
41 | #ifndef attribute_align_arg | ||
42 | #if ARCH_X86_32 && (!defined(__ICC) || __ICC > 1110) && AV_GCC_VERSION_AT_LEAST(4,2) | ||
43 | # define attribute_align_arg __attribute__((force_align_arg_pointer)) | ||
44 | #else | ||
45 | # define attribute_align_arg | ||
46 | #endif | ||
47 | #endif | ||
48 | |||
49 | |||
50 | /** | ||
51 | * Mark a variable as used and prevent the compiler from optimizing it away. | ||
52 | * This is useful for asm that accesses varibles in ways that the compiler does not | ||
53 | * understand | ||
54 | */ | ||
55 | #ifndef attribute_used | ||
56 | #if AV_GCC_VERSION_AT_LEAST(3,1) | ||
57 | # define attribute_used __attribute__((used)) | ||
58 | #else | ||
59 | # define attribute_used | ||
60 | #endif | ||
61 | #endif | ||
62 | |||
63 | #ifndef INT16_MIN | ||
64 | #define INT16_MIN (-0x7fff - 1) | ||
65 | #endif | ||
66 | |||
67 | #ifndef INT16_MAX | ||
68 | #define INT16_MAX 0x7fff | ||
69 | #endif | ||
70 | |||
71 | #ifndef INT32_MIN | ||
72 | #define INT32_MIN (-0x7fffffff - 1) | ||
73 | #endif | ||
74 | |||
75 | #ifndef INT32_MAX | ||
76 | #define INT32_MAX 0x7fffffff | ||
77 | #endif | ||
78 | |||
79 | #ifndef UINT32_MAX | ||
80 | #define UINT32_MAX 0xffffffff | ||
81 | #endif | ||
82 | |||
83 | #ifndef INT64_MIN | ||
84 | #define INT64_MIN (-0x7fffffffffffffffLL - 1) | ||
85 | #endif | ||
86 | |||
87 | #ifndef INT64_MAX | ||
88 | #define INT64_MAX INT64_C(9223372036854775807) | ||
89 | #endif | ||
90 | |||
91 | #ifndef UINT64_MAX | ||
92 | #define UINT64_MAX UINT64_C(0xFFFFFFFFFFFFFFFF) | ||
93 | #endif | ||
94 | |||
95 | #ifndef INT_BIT | ||
96 | # define INT_BIT (CHAR_BIT * sizeof(int)) | ||
97 | #endif | ||
98 | |||
99 | #ifndef offsetof | ||
100 | # define offsetof(T, F) ((unsigned int)((char *)&((T *)0)->F)) | ||
101 | #endif | ||
102 | |||
103 | /* Use to export labels from asm. */ | ||
104 | #define LABEL_MANGLE(a) EXTERN_PREFIX #a | ||
105 | |||
106 | // Use rip-relative addressing if compiling PIC code on x86-64. | ||
107 | #if ARCH_X86_64 && defined(PIC) | ||
108 | # define LOCAL_MANGLE(a) #a "(%%rip)" | ||
109 | #else | ||
110 | # define LOCAL_MANGLE(a) #a | ||
111 | #endif | ||
112 | |||
113 | #define MANGLE(a) EXTERN_PREFIX LOCAL_MANGLE(a) | ||
114 | |||
115 | /* debug stuff */ | ||
116 | |||
117 | /* dprintf macros */ | ||
118 | #ifdef DEBUG | ||
119 | # define dprintf(pctx, ...) av_log(pctx, AV_LOG_DEBUG, __VA_ARGS__) | ||
120 | #else | ||
121 | # define dprintf(pctx, ...) | ||
122 | #endif | ||
123 | |||
124 | #define av_abort() do { av_log(NULL, AV_LOG_ERROR, "Abort at %s:%d\n", __FILE__, __LINE__); abort(); } while (0) | ||
125 | |||
126 | /* math */ | ||
127 | |||
128 | #if ARCH_X86 | ||
129 | #define MASK_ABS(mask, level)\ | ||
130 | __asm__ volatile(\ | ||
131 | "cltd \n\t"\ | ||
132 | "xorl %1, %0 \n\t"\ | ||
133 | "subl %1, %0 \n\t"\ | ||
134 | : "+a" (level), "=&d" (mask)\ | ||
135 | ); | ||
136 | #else | ||
137 | #define MASK_ABS(mask, level)\ | ||
138 | mask = level >> 31;\ | ||
139 | level = (level ^ mask) - mask; | ||
140 | #endif | ||
141 | |||
142 | /* avoid usage of dangerous/inappropriate system functions */ | ||
143 | #undef malloc | ||
144 | #define malloc please_use_av_malloc | ||
145 | #undef free | ||
146 | #define free please_use_av_free | ||
147 | #undef realloc | ||
148 | #define realloc please_use_av_realloc | ||
149 | #undef time | ||
150 | #define time time_is_forbidden_due_to_security_issues | ||
151 | #undef rand | ||
152 | #define rand rand_is_forbidden_due_to_state_trashing_use_av_lfg_get | ||
153 | #undef srand | ||
154 | #define srand srand_is_forbidden_due_to_state_trashing_use_av_lfg_init | ||
155 | #undef random | ||
156 | #define random random_is_forbidden_due_to_state_trashing_use_av_lfg_get | ||
157 | #undef sprintf | ||
158 | #define sprintf sprintf_is_forbidden_due_to_security_issues_use_snprintf | ||
159 | #undef strcat | ||
160 | #define strcat strcat_is_forbidden_due_to_security_issues_use_av_strlcat | ||
161 | #undef exit | ||
162 | #define exit exit_is_forbidden | ||
163 | #ifndef LIBAVFORMAT_BUILD | ||
164 | #undef printf | ||
165 | #define printf please_use_av_log_instead_of_printf | ||
166 | #undef fprintf | ||
167 | #define fprintf please_use_av_log_instead_of_fprintf | ||
168 | #undef puts | ||
169 | #define puts please_use_av_log_instead_of_puts | ||
170 | #undef perror | ||
171 | #define perror please_use_av_log_instead_of_perror | ||
172 | #endif | ||
173 | |||
174 | #define FF_ALLOC_OR_GOTO(ctx, p, size, label)\ | ||
175 | {\ | ||
176 | p = av_malloc(size);\ | ||
177 | if (p == NULL && (size) != 0) {\ | ||
178 | av_log(ctx, AV_LOG_ERROR, "Cannot allocate memory.\n");\ | ||
179 | goto label;\ | ||
180 | }\ | ||
181 | } | ||
182 | |||
183 | #define FF_ALLOCZ_OR_GOTO(ctx, p, size, label)\ | ||
184 | {\ | ||
185 | p = av_mallocz(size);\ | ||
186 | if (p == NULL && (size) != 0) {\ | ||
187 | av_log(ctx, AV_LOG_ERROR, "Cannot allocate memory.\n");\ | ||
188 | goto label;\ | ||
189 | }\ | ||
190 | } | ||
191 | |||
192 | #include "libm.h" | ||
193 | |||
194 | /** | ||
195 | * Return NULL if CONFIG_SMALL is true, otherwise the argument | ||
196 | * without modification. Used to disable the definition of strings | ||
197 | * (for example AVCodec long_names). | ||
198 | */ | ||
199 | #if CONFIG_SMALL | ||
200 | # define NULL_IF_CONFIG_SMALL(x) NULL | ||
201 | #else | ||
202 | # define NULL_IF_CONFIG_SMALL(x) x | ||
203 | #endif | ||
204 | |||
205 | |||
206 | /** | ||
207 | * Define a function with only the non-default version specified. | ||
208 | * | ||
209 | * On systems with ELF shared libraries, all symbols exported from | ||
210 | * FFmpeg libraries are tagged with the name and major version of the | ||
211 | * library to which they belong. If a function is moved from one | ||
212 | * library to another, a wrapper must be retained in the original | ||
213 | * location to preserve binary compatibility. | ||
214 | * | ||
215 | * Functions defined with this macro will never be used to resolve | ||
216 | * symbols by the build-time linker. | ||
217 | * | ||
218 | * @param type return type of function | ||
219 | * @param name name of function | ||
220 | * @param args argument list of function | ||
221 | * @param ver version tag to assign function | ||
222 | */ | ||
223 | #if HAVE_SYMVER_ASM_LABEL | ||
224 | # define FF_SYMVER(type, name, args, ver) \ | ||
225 | type ff_##name args __asm__ (EXTERN_PREFIX #name "@" ver); \ | ||
226 | type ff_##name args | ||
227 | #elif HAVE_SYMVER_GNU_ASM | ||
228 | # define FF_SYMVER(type, name, args, ver) \ | ||
229 | __asm__ (".symver ff_" #name "," EXTERN_PREFIX #name "@" ver); \ | ||
230 | type ff_##name args; \ | ||
231 | type ff_##name args | ||
232 | #endif | ||
233 | |||
234 | #endif /* AVUTIL_INTERNAL_H */ | ||