diff options
Diffstat (limited to 'apps/codecs/libwmapro/libavutil')
-rw-r--r-- | apps/codecs/libwmapro/libavutil/attributes.h | 113 | ||||
-rw-r--r-- | apps/codecs/libwmapro/libavutil/avutil.h | 89 | ||||
-rw-r--r-- | apps/codecs/libwmapro/libavutil/bswap.h | 7 | ||||
-rw-r--r-- | apps/codecs/libwmapro/libavutil/common.h | 298 | ||||
-rw-r--r-- | apps/codecs/libwmapro/libavutil/internal.h | 210 | ||||
-rw-r--r-- | apps/codecs/libwmapro/libavutil/intreadwrite.h | 23 | ||||
-rw-r--r-- | apps/codecs/libwmapro/libavutil/log.c | 95 | ||||
-rw-r--r-- | apps/codecs/libwmapro/libavutil/log.h | 115 | ||||
-rw-r--r-- | apps/codecs/libwmapro/libavutil/mathematics.c | 174 | ||||
-rw-r--r-- | apps/codecs/libwmapro/libavutil/mathematics.h | 98 | ||||
-rw-r--r-- | apps/codecs/libwmapro/libavutil/mem.c | 176 | ||||
-rw-r--r-- | apps/codecs/libwmapro/libavutil/mem.h | 125 |
12 files changed, 4 insertions, 1519 deletions
diff --git a/apps/codecs/libwmapro/libavutil/attributes.h b/apps/codecs/libwmapro/libavutil/attributes.h deleted file mode 100644 index 1208bc0c72..0000000000 --- a/apps/codecs/libwmapro/libavutil/attributes.h +++ /dev/null | |||
@@ -1,113 +0,0 @@ | |||
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 libavutil/attributes.h | ||
23 | * Macro definitions for various function/variable attributes | ||
24 | */ | ||
25 | |||
26 | #ifndef AVUTIL_ATTRIBUTES_H | ||
27 | #define AVUTIL_ATTRIBUTES_H | ||
28 | |||
29 | #ifdef __GNUC__ | ||
30 | # define AV_GCC_VERSION_AT_LEAST(x,y) (__GNUC__ > x || __GNUC__ == x && __GNUC_MINOR__ >= y) | ||
31 | #else | ||
32 | # define AV_GCC_VERSION_AT_LEAST(x,y) 0 | ||
33 | #endif | ||
34 | |||
35 | #ifndef av_always_inline | ||
36 | #if AV_GCC_VERSION_AT_LEAST(3,1) | ||
37 | # define av_always_inline __attribute__((always_inline)) inline | ||
38 | #else | ||
39 | # define av_always_inline inline | ||
40 | #endif | ||
41 | #endif | ||
42 | |||
43 | #ifndef av_noinline | ||
44 | #if AV_GCC_VERSION_AT_LEAST(3,1) | ||
45 | # define av_noinline __attribute__((noinline)) | ||
46 | #else | ||
47 | # define av_noinline | ||
48 | #endif | ||
49 | #endif | ||
50 | |||
51 | #ifndef av_pure | ||
52 | #if AV_GCC_VERSION_AT_LEAST(3,1) | ||
53 | # define av_pure __attribute__((pure)) | ||
54 | #else | ||
55 | # define av_pure | ||
56 | #endif | ||
57 | #endif | ||
58 | |||
59 | #ifndef av_const | ||
60 | #if AV_GCC_VERSION_AT_LEAST(2,6) | ||
61 | # define av_const __attribute__((const)) | ||
62 | #else | ||
63 | # define av_const | ||
64 | #endif | ||
65 | #endif | ||
66 | |||
67 | #ifndef av_cold | ||
68 | #if (!defined(__ICC) || __ICC > 1110) && AV_GCC_VERSION_AT_LEAST(4,3) | ||
69 | # define av_cold __attribute__((cold)) | ||
70 | #else | ||
71 | # define av_cold | ||
72 | #endif | ||
73 | #endif | ||
74 | |||
75 | #ifndef av_flatten | ||
76 | #if (!defined(__ICC) || __ICC > 1110) && AV_GCC_VERSION_AT_LEAST(4,1) | ||
77 | # define av_flatten __attribute__((flatten)) | ||
78 | #else | ||
79 | # define av_flatten | ||
80 | #endif | ||
81 | #endif | ||
82 | |||
83 | #ifndef attribute_deprecated | ||
84 | #if AV_GCC_VERSION_AT_LEAST(3,1) | ||
85 | # define attribute_deprecated __attribute__((deprecated)) | ||
86 | #else | ||
87 | # define attribute_deprecated | ||
88 | #endif | ||
89 | #endif | ||
90 | |||
91 | #ifndef av_unused | ||
92 | #if defined(__GNUC__) | ||
93 | # define av_unused __attribute__((unused)) | ||
94 | #else | ||
95 | # define av_unused | ||
96 | #endif | ||
97 | #endif | ||
98 | |||
99 | #ifndef av_uninit | ||
100 | #if defined(__GNUC__) && !defined(__ICC) | ||
101 | # define av_uninit(x) x=x | ||
102 | #else | ||
103 | # define av_uninit(x) x | ||
104 | #endif | ||
105 | #endif | ||
106 | |||
107 | #ifdef __GNUC__ | ||
108 | # define av_builtin_constant_p __builtin_constant_p | ||
109 | #else | ||
110 | # define av_builtin_constant_p(x) 0 | ||
111 | #endif | ||
112 | |||
113 | #endif /* AVUTIL_ATTRIBUTES_H */ | ||
diff --git a/apps/codecs/libwmapro/libavutil/avutil.h b/apps/codecs/libwmapro/libavutil/avutil.h deleted file mode 100644 index fd6e313b59..0000000000 --- a/apps/codecs/libwmapro/libavutil/avutil.h +++ /dev/null | |||
@@ -1,89 +0,0 @@ | |||
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 | #ifndef AVUTIL_AVUTIL_H | ||
22 | #define AVUTIL_AVUTIL_H | ||
23 | |||
24 | /** | ||
25 | * @file libavutil/avutil.h | ||
26 | * external API header | ||
27 | */ | ||
28 | |||
29 | |||
30 | #define AV_STRINGIFY(s) AV_TOSTRING(s) | ||
31 | #define AV_TOSTRING(s) #s | ||
32 | |||
33 | #define AV_GLUE(a, b) a ## b | ||
34 | #define AV_JOIN(a, b) AV_GLUE(a, b) | ||
35 | |||
36 | #define AV_PRAGMA(s) _Pragma(#s) | ||
37 | |||
38 | #define AV_VERSION_INT(a, b, c) (a<<16 | b<<8 | c) | ||
39 | #define AV_VERSION_DOT(a, b, c) a ##.## b ##.## c | ||
40 | #define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c) | ||
41 | |||
42 | #define LIBAVUTIL_VERSION_MAJOR 50 | ||
43 | #define LIBAVUTIL_VERSION_MINOR 14 | ||
44 | #define LIBAVUTIL_VERSION_MICRO 0 | ||
45 | |||
46 | #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ | ||
47 | LIBAVUTIL_VERSION_MINOR, \ | ||
48 | LIBAVUTIL_VERSION_MICRO) | ||
49 | #define LIBAVUTIL_VERSION AV_VERSION(LIBAVUTIL_VERSION_MAJOR, \ | ||
50 | LIBAVUTIL_VERSION_MINOR, \ | ||
51 | LIBAVUTIL_VERSION_MICRO) | ||
52 | #define LIBAVUTIL_BUILD LIBAVUTIL_VERSION_INT | ||
53 | |||
54 | #define LIBAVUTIL_IDENT "Lavu" AV_STRINGIFY(LIBAVUTIL_VERSION) | ||
55 | |||
56 | /** | ||
57 | * Returns the LIBAVUTIL_VERSION_INT constant. | ||
58 | */ | ||
59 | unsigned avutil_version(void); | ||
60 | |||
61 | /** | ||
62 | * Returns the libavutil build-time configuration. | ||
63 | */ | ||
64 | const char *avutil_configuration(void); | ||
65 | |||
66 | /** | ||
67 | * Returns the libavutil license. | ||
68 | */ | ||
69 | const char *avutil_license(void); | ||
70 | |||
71 | enum AVMediaType { | ||
72 | AVMEDIA_TYPE_UNKNOWN = -1, | ||
73 | AVMEDIA_TYPE_VIDEO, | ||
74 | AVMEDIA_TYPE_AUDIO, | ||
75 | AVMEDIA_TYPE_DATA, | ||
76 | AVMEDIA_TYPE_SUBTITLE, | ||
77 | AVMEDIA_TYPE_ATTACHMENT, | ||
78 | AVMEDIA_TYPE_NB | ||
79 | }; | ||
80 | |||
81 | #include "common.h" | ||
82 | //#include "error.h" | ||
83 | #include "mathematics.h" | ||
84 | //#include "rational.h" | ||
85 | //#include "intfloat_readwrite.h" | ||
86 | #include "log.h" | ||
87 | //#include "pixfmt.h" | ||
88 | |||
89 | #endif /* AVUTIL_AVUTIL_H */ | ||
diff --git a/apps/codecs/libwmapro/libavutil/bswap.h b/apps/codecs/libwmapro/libavutil/bswap.h index e15501778b..82ed2271ac 100644 --- a/apps/codecs/libwmapro/libavutil/bswap.h +++ b/apps/codecs/libwmapro/libavutil/bswap.h | |||
@@ -28,10 +28,9 @@ | |||
28 | 28 | ||
29 | #include <stdint.h> | 29 | #include <stdint.h> |
30 | //#include "config.h" | 30 | //#include "config.h" |
31 | #include "attributes.h" | ||
32 | 31 | ||
33 | #ifndef bswap_16 | 32 | #ifndef bswap_16 |
34 | static av_always_inline av_const uint16_t bswap_16(uint16_t x) | 33 | static inline uint16_t bswap_16(uint16_t x) |
35 | { | 34 | { |
36 | x= (x>>8) | (x<<8); | 35 | x= (x>>8) | (x<<8); |
37 | return x; | 36 | return x; |
@@ -39,7 +38,7 @@ static av_always_inline av_const uint16_t bswap_16(uint16_t x) | |||
39 | #endif | 38 | #endif |
40 | 39 | ||
41 | #ifndef bswap_32 | 40 | #ifndef bswap_32 |
42 | static av_always_inline av_const uint32_t bswap_32(uint32_t x) | 41 | static inline uint32_t bswap_32(uint32_t x) |
43 | { | 42 | { |
44 | x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF); | 43 | x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF); |
45 | x= (x>>16) | (x<<16); | 44 | x= (x>>16) | (x<<16); |
@@ -48,7 +47,7 @@ static av_always_inline av_const uint32_t bswap_32(uint32_t x) | |||
48 | #endif | 47 | #endif |
49 | 48 | ||
50 | #ifndef bswap_64 | 49 | #ifndef bswap_64 |
51 | static inline uint64_t av_const bswap_64(uint64_t x) | 50 | static inline uint64_t bswap_64(uint64_t x) |
52 | { | 51 | { |
53 | #if 0 | 52 | #if 0 |
54 | x= ((x<< 8)&0xFF00FF00FF00FF00ULL) | ((x>> 8)&0x00FF00FF00FF00FFULL); | 53 | x= ((x<< 8)&0xFF00FF00FF00FF00ULL) | ((x>> 8)&0x00FF00FF00FF00FFULL); |
diff --git a/apps/codecs/libwmapro/libavutil/common.h b/apps/codecs/libwmapro/libavutil/common.h deleted file mode 100644 index 48732a29dd..0000000000 --- a/apps/codecs/libwmapro/libavutil/common.h +++ /dev/null | |||
@@ -1,298 +0,0 @@ | |||
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 libavutil/common.h | ||
23 | * common internal and external API header | ||
24 | */ | ||
25 | |||
26 | #ifndef AVUTIL_COMMON_H | ||
27 | #define AVUTIL_COMMON_H | ||
28 | |||
29 | #include <ctype.h> | ||
30 | #include <errno.h> | ||
31 | #include <inttypes.h> | ||
32 | #include <limits.h> | ||
33 | #include <math.h> | ||
34 | #include <stdio.h> | ||
35 | #include <stdlib.h> | ||
36 | #include <string.h> | ||
37 | #include "attributes.h" | ||
38 | |||
39 | //rounded division & shift | ||
40 | #define RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b)) | ||
41 | /* assume b>0 */ | ||
42 | #define ROUNDED_DIV(a,b) (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b)) | ||
43 | #define FFABS(a) ((a) >= 0 ? (a) : (-(a))) | ||
44 | #define FFSIGN(a) ((a) > 0 ? 1 : -1) | ||
45 | |||
46 | #define FFMAX(a,b) ((a) > (b) ? (a) : (b)) | ||
47 | #define FFMAX3(a,b,c) FFMAX(FFMAX(a,b),c) | ||
48 | #define FFMIN(a,b) ((a) > (b) ? (b) : (a)) | ||
49 | #define FFMIN3(a,b,c) FFMIN(FFMIN(a,b),c) | ||
50 | |||
51 | #define FFSWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0) | ||
52 | #define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0])) | ||
53 | #define FFALIGN(x, a) (((x)+(a)-1)&~((a)-1)) | ||
54 | |||
55 | /* misc math functions */ | ||
56 | extern const uint8_t ff_log2_tab[256]; | ||
57 | |||
58 | extern const uint8_t av_reverse[256]; | ||
59 | |||
60 | static inline av_const int av_log2_c(unsigned int v) | ||
61 | { | ||
62 | int n = 0; | ||
63 | if (v & 0xffff0000) { | ||
64 | v >>= 16; | ||
65 | n += 16; | ||
66 | } | ||
67 | if (v & 0xff00) { | ||
68 | v >>= 8; | ||
69 | n += 8; | ||
70 | } | ||
71 | n += ff_log2_tab[v]; | ||
72 | |||
73 | return n; | ||
74 | } | ||
75 | |||
76 | static inline av_const int av_log2_16bit_c(unsigned int v) | ||
77 | { | ||
78 | int n = 0; | ||
79 | if (v & 0xff00) { | ||
80 | v >>= 8; | ||
81 | n += 8; | ||
82 | } | ||
83 | n += ff_log2_tab[v]; | ||
84 | |||
85 | return n; | ||
86 | } | ||
87 | |||
88 | #ifdef HAVE_AV_CONFIG_H | ||
89 | # include "config.h" | ||
90 | # include "intmath.h" | ||
91 | #endif | ||
92 | |||
93 | #ifndef av_log2 | ||
94 | # define av_log2 av_log2_c | ||
95 | #endif | ||
96 | #ifndef av_log2_16bit | ||
97 | # define av_log2_16bit av_log2_16bit_c | ||
98 | #endif | ||
99 | |||
100 | /** | ||
101 | * Clips a signed integer value into the amin-amax range. | ||
102 | * @param a value to clip | ||
103 | * @param amin minimum value of the clip range | ||
104 | * @param amax maximum value of the clip range | ||
105 | * @return clipped value | ||
106 | */ | ||
107 | static inline av_const int av_clip(int a, int amin, int amax) | ||
108 | { | ||
109 | if (a < amin) return amin; | ||
110 | else if (a > amax) return amax; | ||
111 | else return a; | ||
112 | } | ||
113 | |||
114 | /** | ||
115 | * Clips a signed integer value into the 0-255 range. | ||
116 | * @param a value to clip | ||
117 | * @return clipped value | ||
118 | */ | ||
119 | static inline av_const uint8_t av_clip_uint8(int a) | ||
120 | { | ||
121 | if (a&(~255)) return (-a)>>31; | ||
122 | else return a; | ||
123 | } | ||
124 | |||
125 | /** | ||
126 | * Clips a signed integer value into the 0-65535 range. | ||
127 | * @param a value to clip | ||
128 | * @return clipped value | ||
129 | */ | ||
130 | static inline av_const uint16_t av_clip_uint16(int a) | ||
131 | { | ||
132 | if (a&(~65535)) return (-a)>>31; | ||
133 | else return a; | ||
134 | } | ||
135 | |||
136 | /** | ||
137 | * Clips a signed integer value into the -32768,32767 range. | ||
138 | * @param a value to clip | ||
139 | * @return clipped value | ||
140 | */ | ||
141 | static inline av_const int16_t av_clip_int16(int a) | ||
142 | { | ||
143 | if ((a+32768) & ~65535) return (a>>31) ^ 32767; | ||
144 | else return a; | ||
145 | } | ||
146 | |||
147 | /** | ||
148 | * Clips a float value into the amin-amax range. | ||
149 | * @param a value to clip | ||
150 | * @param amin minimum value of the clip range | ||
151 | * @param amax maximum value of the clip range | ||
152 | * @return clipped value | ||
153 | */ | ||
154 | static inline av_const float av_clipf(float a, float amin, float amax) | ||
155 | { | ||
156 | if (a < amin) return amin; | ||
157 | else if (a > amax) return amax; | ||
158 | else return a; | ||
159 | } | ||
160 | |||
161 | /** Computes ceil(log2(x)). | ||
162 | * @param x value used to compute ceil(log2(x)) | ||
163 | * @return computed ceiling of log2(x) | ||
164 | */ | ||
165 | static inline av_const int av_ceil_log2(int x) | ||
166 | { | ||
167 | return av_log2((x - 1) << 1); | ||
168 | } | ||
169 | |||
170 | #define MKTAG(a,b,c,d) (a | (b << 8) | (c << 16) | (d << 24)) | ||
171 | #define MKBETAG(a,b,c,d) (d | (c << 8) | (b << 16) | (a << 24)) | ||
172 | |||
173 | /*! | ||
174 | * \def GET_UTF8(val, GET_BYTE, ERROR) | ||
175 | * Converts a UTF-8 character (up to 4 bytes long) to its 32-bit UCS-4 encoded form | ||
176 | * \param val is the output and should be of type uint32_t. It holds the converted | ||
177 | * UCS-4 character and should be a left value. | ||
178 | * \param GET_BYTE gets UTF-8 encoded bytes from any proper source. It can be | ||
179 | * a function or a statement whose return value or evaluated value is of type | ||
180 | * uint8_t. It will be executed up to 4 times for values in the valid UTF-8 range, | ||
181 | * and up to 7 times in the general case. | ||
182 | * \param ERROR action that should be taken when an invalid UTF-8 byte is returned | ||
183 | * from GET_BYTE. It should be a statement that jumps out of the macro, | ||
184 | * like exit(), goto, return, break, or continue. | ||
185 | */ | ||
186 | #define GET_UTF8(val, GET_BYTE, ERROR)\ | ||
187 | val= GET_BYTE;\ | ||
188 | {\ | ||
189 | int ones= 7 - av_log2(val ^ 255);\ | ||
190 | if(ones==1)\ | ||
191 | ERROR\ | ||
192 | val&= 127>>ones;\ | ||
193 | while(--ones > 0){\ | ||
194 | int tmp= GET_BYTE - 128;\ | ||
195 | if(tmp>>6)\ | ||
196 | ERROR\ | ||
197 | val= (val<<6) + tmp;\ | ||
198 | }\ | ||
199 | } | ||
200 | |||
201 | /*! | ||
202 | * \def GET_UTF16(val, GET_16BIT, ERROR) | ||
203 | * Converts a UTF-16 character (2 or 4 bytes) to its 32-bit UCS-4 encoded form | ||
204 | * \param val is the output and should be of type uint32_t. It holds the converted | ||
205 | * UCS-4 character and should be a left value. | ||
206 | * \param GET_16BIT gets two bytes of UTF-16 encoded data converted to native endianness. | ||
207 | * It can be a function or a statement whose return value or evaluated value is of type | ||
208 | * uint16_t. It will be executed up to 2 times. | ||
209 | * \param ERROR action that should be taken when an invalid UTF-16 surrogate is | ||
210 | * returned from GET_BYTE. It should be a statement that jumps out of the macro, | ||
211 | * like exit(), goto, return, break, or continue. | ||
212 | */ | ||
213 | #define GET_UTF16(val, GET_16BIT, ERROR)\ | ||
214 | val = GET_16BIT;\ | ||
215 | {\ | ||
216 | unsigned int hi = val - 0xD800;\ | ||
217 | if (hi < 0x800) {\ | ||
218 | val = GET_16BIT - 0xDC00;\ | ||
219 | if (val > 0x3FFU || hi > 0x3FFU)\ | ||
220 | ERROR\ | ||
221 | val += (hi<<10) + 0x10000;\ | ||
222 | }\ | ||
223 | }\ | ||
224 | |||
225 | /*! | ||
226 | * \def PUT_UTF8(val, tmp, PUT_BYTE) | ||
227 | * Converts a 32-bit Unicode character to its UTF-8 encoded form (up to 4 bytes long). | ||
228 | * \param val is an input-only argument and should be of type uint32_t. It holds | ||
229 | * a UCS-4 encoded Unicode character that is to be converted to UTF-8. If | ||
230 | * val is given as a function it is executed only once. | ||
231 | * \param tmp is a temporary variable and should be of type uint8_t. It | ||
232 | * represents an intermediate value during conversion that is to be | ||
233 | * output by PUT_BYTE. | ||
234 | * \param PUT_BYTE writes the converted UTF-8 bytes to any proper destination. | ||
235 | * It could be a function or a statement, and uses tmp as the input byte. | ||
236 | * For example, PUT_BYTE could be "*output++ = tmp;" PUT_BYTE will be | ||
237 | * executed up to 4 times for values in the valid UTF-8 range and up to | ||
238 | * 7 times in the general case, depending on the length of the converted | ||
239 | * Unicode character. | ||
240 | */ | ||
241 | #define PUT_UTF8(val, tmp, PUT_BYTE)\ | ||
242 | {\ | ||
243 | int bytes, shift;\ | ||
244 | uint32_t in = val;\ | ||
245 | if (in < 0x80) {\ | ||
246 | tmp = in;\ | ||
247 | PUT_BYTE\ | ||
248 | } else {\ | ||
249 | bytes = (av_log2(in) + 4) / 5;\ | ||
250 | shift = (bytes - 1) * 6;\ | ||
251 | tmp = (256 - (256 >> bytes)) | (in >> shift);\ | ||
252 | PUT_BYTE\ | ||
253 | while (shift >= 6) {\ | ||
254 | shift -= 6;\ | ||
255 | tmp = 0x80 | ((in >> shift) & 0x3f);\ | ||
256 | PUT_BYTE\ | ||
257 | }\ | ||
258 | }\ | ||
259 | } | ||
260 | |||
261 | /*! | ||
262 | * \def PUT_UTF16(val, tmp, PUT_16BIT) | ||
263 | * Converts a 32-bit Unicode character to its UTF-16 encoded form (2 or 4 bytes). | ||
264 | * \param val is an input-only argument and should be of type uint32_t. It holds | ||
265 | * a UCS-4 encoded Unicode character that is to be converted to UTF-16. If | ||
266 | * val is given as a function it is executed only once. | ||
267 | * \param tmp is a temporary variable and should be of type uint16_t. It | ||
268 | * represents an intermediate value during conversion that is to be | ||
269 | * output by PUT_16BIT. | ||
270 | * \param PUT_16BIT writes the converted UTF-16 data to any proper destination | ||
271 | * in desired endianness. It could be a function or a statement, and uses tmp | ||
272 | * as the input byte. For example, PUT_BYTE could be "*output++ = tmp;" | ||
273 | * PUT_BYTE will be executed 1 or 2 times depending on input character. | ||
274 | */ | ||
275 | #define PUT_UTF16(val, tmp, PUT_16BIT)\ | ||
276 | {\ | ||
277 | uint32_t in = val;\ | ||
278 | if (in < 0x10000) {\ | ||
279 | tmp = in;\ | ||
280 | PUT_16BIT\ | ||
281 | } else {\ | ||
282 | tmp = 0xD800 | ((in - 0x10000) >> 10);\ | ||
283 | PUT_16BIT\ | ||
284 | tmp = 0xDC00 | ((in - 0x10000) & 0x3FF);\ | ||
285 | PUT_16BIT\ | ||
286 | }\ | ||
287 | }\ | ||
288 | |||
289 | |||
290 | |||
291 | #include "mem.h" | ||
292 | |||
293 | //#ifdef HAVE_AV_CONFIG_H | ||
294 | #if 1 | ||
295 | # include "internal.h" | ||
296 | #endif /* HAVE_AV_CONFIG_H */ | ||
297 | |||
298 | #endif /* AVUTIL_COMMON_H */ | ||
diff --git a/apps/codecs/libwmapro/libavutil/internal.h b/apps/codecs/libwmapro/libavutil/internal.h deleted file mode 100644 index 87a4d3ec10..0000000000 --- a/apps/codecs/libwmapro/libavutil/internal.h +++ /dev/null | |||
@@ -1,210 +0,0 @@ | |||
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 libavutil/internal.h | ||
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 (!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 | #ifndef attribute_used | ||
50 | #if AV_GCC_VERSION_AT_LEAST(3,1) | ||
51 | # define attribute_used __attribute__((used)) | ||
52 | #else | ||
53 | # define attribute_used | ||
54 | #endif | ||
55 | #endif | ||
56 | |||
57 | #ifndef av_alias | ||
58 | //#if HAVE_ATTRIBUTE_MAY_ALIAS && (!defined(__ICC) || __ICC > 1110) && AV_GCC_VERSION_AT_LEAST(3,3) | ||
59 | #if 0 | ||
60 | # define av_alias __attribute__((may_alias)) | ||
61 | #else | ||
62 | # define av_alias | ||
63 | #endif | ||
64 | #endif | ||
65 | |||
66 | #ifndef INT16_MIN | ||
67 | #define INT16_MIN (-0x7fff - 1) | ||
68 | #endif | ||
69 | |||
70 | #ifndef INT16_MAX | ||
71 | #define INT16_MAX 0x7fff | ||
72 | #endif | ||
73 | |||
74 | #ifndef INT32_MIN | ||
75 | #define INT32_MIN (-0x7fffffff - 1) | ||
76 | #endif | ||
77 | |||
78 | #ifndef INT32_MAX | ||
79 | #define INT32_MAX 0x7fffffff | ||
80 | #endif | ||
81 | |||
82 | #ifndef UINT32_MAX | ||
83 | #define UINT32_MAX 0xffffffff | ||
84 | #endif | ||
85 | |||
86 | #ifndef INT64_MIN | ||
87 | #define INT64_MIN (-0x7fffffffffffffffLL - 1) | ||
88 | #endif | ||
89 | |||
90 | #ifndef INT64_MAX | ||
91 | #define INT64_MAX INT64_C(9223372036854775807) | ||
92 | #endif | ||
93 | |||
94 | #ifndef UINT64_MAX | ||
95 | #define UINT64_MAX UINT64_C(0xFFFFFFFFFFFFFFFF) | ||
96 | #endif | ||
97 | |||
98 | #ifndef INT_BIT | ||
99 | # define INT_BIT (CHAR_BIT * sizeof(int)) | ||
100 | #endif | ||
101 | |||
102 | #ifndef offsetof | ||
103 | # define offsetof(T, F) ((unsigned int)((char *)&((T *)0)->F)) | ||
104 | #endif | ||
105 | |||
106 | /* Use to export labels from asm. */ | ||
107 | #define LABEL_MANGLE(a) EXTERN_PREFIX #a | ||
108 | |||
109 | // Use rip-relative addressing if compiling PIC code on x86-64. | ||
110 | //#if ARCH_X86_64 && defined(PIC) | ||
111 | #if 0 | ||
112 | # define LOCAL_MANGLE(a) #a "(%%rip)" | ||
113 | #else | ||
114 | # define LOCAL_MANGLE(a) #a | ||
115 | #endif | ||
116 | |||
117 | #define MANGLE(a) EXTERN_PREFIX LOCAL_MANGLE(a) | ||
118 | |||
119 | /* debug stuff */ | ||
120 | |||
121 | /* dprintf macros */ | ||
122 | #ifdef DEBUG | ||
123 | # define dprintf(pctx, ...) av_log(pctx, AV_LOG_DEBUG, __VA_ARGS__) | ||
124 | #else | ||
125 | # define dprintf(pctx, ...) | ||
126 | #endif | ||
127 | |||
128 | #define av_abort() do { av_log(NULL, AV_LOG_ERROR, "Abort at %s:%d\n", __FILE__, __LINE__); abort(); } while (0) | ||
129 | |||
130 | /* math */ | ||
131 | |||
132 | //#if ARCH_X86 | ||
133 | #if 0 | ||
134 | #define MASK_ABS(mask, level)\ | ||
135 | __asm__ volatile(\ | ||
136 | "cltd \n\t"\ | ||
137 | "xorl %1, %0 \n\t"\ | ||
138 | "subl %1, %0 \n\t"\ | ||
139 | : "+a" (level), "=&d" (mask)\ | ||
140 | ); | ||
141 | #else | ||
142 | #define MASK_ABS(mask, level)\ | ||
143 | mask = level >> 31;\ | ||
144 | level = (level ^ mask) - mask; | ||
145 | #endif | ||
146 | |||
147 | /* avoid usage of dangerous/inappropriate system functions */ | ||
148 | //#undef malloc | ||
149 | //#define malloc please_use_av_malloc | ||
150 | #undef free | ||
151 | #define free please_use_av_free | ||
152 | #undef realloc | ||
153 | #define realloc please_use_av_realloc | ||
154 | #undef time | ||
155 | #define time time_is_forbidden_due_to_security_issues | ||
156 | #undef rand | ||
157 | #define rand rand_is_forbidden_due_to_state_trashing_use_av_lfg_get | ||
158 | #undef srand | ||
159 | #define srand srand_is_forbidden_due_to_state_trashing_use_av_lfg_init | ||
160 | #undef random | ||
161 | #define random random_is_forbidden_due_to_state_trashing_use_av_lfg_get | ||
162 | #undef sprintf | ||
163 | #define sprintf sprintf_is_forbidden_due_to_security_issues_use_snprintf | ||
164 | #undef strcat | ||
165 | #define strcat strcat_is_forbidden_due_to_security_issues_use_av_strlcat | ||
166 | #undef exit | ||
167 | #define exit exit_is_forbidden | ||
168 | #ifndef LIBAVFORMAT_BUILD | ||
169 | //#undef printf | ||
170 | //#define printf please_use_av_log_instead_of_printf | ||
171 | #undef fprintf | ||
172 | #define fprintf please_use_av_log_instead_of_fprintf | ||
173 | #undef puts | ||
174 | #define puts please_use_av_log_instead_of_puts | ||
175 | #undef perror | ||
176 | #define perror please_use_av_log_instead_of_perror | ||
177 | #endif | ||
178 | |||
179 | #define FF_ALLOC_OR_GOTO(ctx, p, size, label)\ | ||
180 | {\ | ||
181 | p = av_malloc(size);\ | ||
182 | if (p == NULL && (size) != 0) {\ | ||
183 | av_log(ctx, AV_LOG_ERROR, "Cannot allocate memory.\n");\ | ||
184 | goto label;\ | ||
185 | }\ | ||
186 | } | ||
187 | |||
188 | #define FF_ALLOCZ_OR_GOTO(ctx, p, size, label)\ | ||
189 | {\ | ||
190 | p = av_mallocz(size);\ | ||
191 | if (p == NULL && (size) != 0) {\ | ||
192 | av_log(ctx, AV_LOG_ERROR, "Cannot allocate memory.\n");\ | ||
193 | goto label;\ | ||
194 | }\ | ||
195 | } | ||
196 | |||
197 | //#include "libm.h" | ||
198 | |||
199 | /** | ||
200 | * Returns NULL if CONFIG_SMALL is true, otherwise the argument | ||
201 | * without modification. Used to disable the definition of strings | ||
202 | * (for example AVCodec long_names). | ||
203 | */ | ||
204 | //#if CONFIG_SMALL | ||
205 | //# define NULL_IF_CONFIG_SMALL(x) NULL | ||
206 | //#else | ||
207 | //# define NULL_IF_CONFIG_SMALL(x) x | ||
208 | //#endif | ||
209 | |||
210 | #endif /* AVUTIL_INTERNAL_H */ | ||
diff --git a/apps/codecs/libwmapro/libavutil/intreadwrite.h b/apps/codecs/libwmapro/libavutil/intreadwrite.h index a88ffa80f6..32dfcf2cad 100644 --- a/apps/codecs/libwmapro/libavutil/intreadwrite.h +++ b/apps/codecs/libwmapro/libavutil/intreadwrite.h | |||
@@ -22,28 +22,7 @@ | |||
22 | #include <stdint.h> | 22 | #include <stdint.h> |
23 | //#include "config.h" | 23 | //#include "config.h" |
24 | #include "bswap.h" | 24 | #include "bswap.h" |
25 | #include "common.h" | 25 | //#include "common.h" |
26 | |||
27 | typedef union { | ||
28 | uint64_t u64; | ||
29 | uint32_t u32[2]; | ||
30 | uint16_t u16[4]; | ||
31 | uint8_t u8 [8]; | ||
32 | double f64; | ||
33 | float f32[2]; | ||
34 | } av_alias av_alias64; | ||
35 | |||
36 | typedef union { | ||
37 | uint32_t u32; | ||
38 | uint16_t u16[2]; | ||
39 | uint8_t u8 [4]; | ||
40 | float f32; | ||
41 | } av_alias av_alias32; | ||
42 | |||
43 | typedef union { | ||
44 | uint16_t u16; | ||
45 | uint8_t u8 [2]; | ||
46 | } av_alias av_alias16; | ||
47 | 26 | ||
48 | /* | 27 | /* |
49 | * Arch-specific headers can provide any combination of | 28 | * Arch-specific headers can provide any combination of |
diff --git a/apps/codecs/libwmapro/libavutil/log.c b/apps/codecs/libwmapro/libavutil/log.c deleted file mode 100644 index f93a0d6677..0000000000 --- a/apps/codecs/libwmapro/libavutil/log.c +++ /dev/null | |||
@@ -1,95 +0,0 @@ | |||
1 | /* | ||
2 | * log functions | ||
3 | * Copyright (c) 2003 Michel Bardiaux | ||
4 | * | ||
5 | * This file is part of FFmpeg. | ||
6 | * | ||
7 | * FFmpeg is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU Lesser General Public | ||
9 | * License as published by the Free Software Foundation; either | ||
10 | * version 2.1 of the License, or (at your option) any later version. | ||
11 | * | ||
12 | * FFmpeg is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
15 | * Lesser General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU Lesser General Public | ||
18 | * License along with FFmpeg; if not, write to the Free Software | ||
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
20 | */ | ||
21 | |||
22 | /** | ||
23 | * @file libavutil/log.c | ||
24 | * logging functions | ||
25 | */ | ||
26 | |||
27 | #include "avutil.h" | ||
28 | #include "log.h" | ||
29 | /* disable sprintf functions */ | ||
30 | #define snprintf(...) | ||
31 | #define vsnprintf snprintf | ||
32 | |||
33 | #if LIBAVUTIL_VERSION_MAJOR > 50 | ||
34 | static | ||
35 | #endif | ||
36 | int av_log_level = AV_LOG_INFO; | ||
37 | |||
38 | void av_log_default_callback(void* ptr, int level) | ||
39 | { | ||
40 | static int print_prefix=1; | ||
41 | static int count; | ||
42 | static char line[1024], prev[1024]; | ||
43 | AVClass* avc= ptr ? *(AVClass**)ptr : NULL; | ||
44 | if(level>av_log_level) | ||
45 | return; | ||
46 | #undef fprintf | ||
47 | if(print_prefix && avc) { | ||
48 | snprintf(line, sizeof(line), "[%s @ %p]", avc->item_name(ptr), ptr); | ||
49 | }else | ||
50 | line[0]=0; | ||
51 | |||
52 | vsnprintf(line + strlen(line), sizeof(line) - strlen(line), fmt, vl); | ||
53 | |||
54 | print_prefix= line[strlen(line)-1] == '\n'; | ||
55 | if(print_prefix && !strcmp(line, prev)){ | ||
56 | count++; | ||
57 | return; | ||
58 | } | ||
59 | if(count>0){ | ||
60 | //fprintf(stderr, " Last message repeated %d times\n", count); | ||
61 | count=0; | ||
62 | } | ||
63 | //fputs(line, stderr); | ||
64 | strcpy(prev, line); | ||
65 | } | ||
66 | |||
67 | static void (*av_log_callback)(void*, int = av_log_default_callback; | ||
68 | |||
69 | void av_log(void* avcl, int level) | ||
70 | { | ||
71 | va_list vl; | ||
72 | va_start(vl, fmt); | ||
73 | av_vlog(avcl, level, fmt, vl); | ||
74 | va_end(vl); | ||
75 | } | ||
76 | |||
77 | void av_vlog(void* avcl, int level, const char *fmt, va_list vl) | ||
78 | { | ||
79 | av_log_callback(avcl, level, fmt, vl); | ||
80 | } | ||
81 | |||
82 | int av_log_get_level(void) | ||
83 | { | ||
84 | return av_log_level; | ||
85 | } | ||
86 | |||
87 | void av_log_set_level(int level) | ||
88 | { | ||
89 | av_log_level = level; | ||
90 | } | ||
91 | |||
92 | void av_log_set_callback(void (*callback)(void*, int, const char*, va_list)) | ||
93 | { | ||
94 | av_log_callback = callback; | ||
95 | } | ||
diff --git a/apps/codecs/libwmapro/libavutil/log.h b/apps/codecs/libwmapro/libavutil/log.h deleted file mode 100644 index 43228e4985..0000000000 --- a/apps/codecs/libwmapro/libavutil/log.h +++ /dev/null | |||
@@ -1,115 +0,0 @@ | |||
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 | #ifndef AVUTIL_LOG_H | ||
22 | #define AVUTIL_LOG_H | ||
23 | |||
24 | #include <stdarg.h> | ||
25 | #include "avutil.h" | ||
26 | |||
27 | /** | ||
28 | * Describes the class of an AVClass context structure. That is an | ||
29 | * arbitrary struct of which the first field is a pointer to an | ||
30 | * AVClass struct (e.g. AVCodecContext, AVFormatContext etc.). | ||
31 | */ | ||
32 | typedef struct { | ||
33 | /** | ||
34 | * The name of the class; usually it is the same name as the | ||
35 | * context structure type to which the AVClass is associated. | ||
36 | */ | ||
37 | const char* class_name; | ||
38 | |||
39 | /** | ||
40 | * A pointer to a function which returns the name of a context | ||
41 | * instance ctx associated with the class. | ||
42 | */ | ||
43 | const char* (*item_name)(void* ctx); | ||
44 | |||
45 | /** | ||
46 | * a pointer to the first option specified in the class if any or NULL | ||
47 | * | ||
48 | * @see av_set_default_options() | ||
49 | */ | ||
50 | const struct AVOption *option; | ||
51 | } AVClass; | ||
52 | |||
53 | /* av_log API */ | ||
54 | |||
55 | #define AV_LOG_QUIET -8 | ||
56 | |||
57 | /** | ||
58 | * Something went really wrong and we will crash now. | ||
59 | */ | ||
60 | #define AV_LOG_PANIC 0 | ||
61 | |||
62 | /** | ||
63 | * Something went wrong and recovery is not possible. | ||
64 | * For example, no header was found for a format which depends | ||
65 | * on headers or an illegal combination of parameters is used. | ||
66 | */ | ||
67 | #define AV_LOG_FATAL 8 | ||
68 | |||
69 | /** | ||
70 | * Something went wrong and cannot losslessly be recovered. | ||
71 | * However, not all future data is affected. | ||
72 | */ | ||
73 | #define AV_LOG_ERROR 16 | ||
74 | |||
75 | /** | ||
76 | * Something somehow does not look correct. This may or may not | ||
77 | * lead to problems. An example would be the use of '-vstrict -2'. | ||
78 | */ | ||
79 | #define AV_LOG_WARNING 24 | ||
80 | |||
81 | #define AV_LOG_INFO 32 | ||
82 | #define AV_LOG_VERBOSE 40 | ||
83 | |||
84 | /** | ||
85 | * Stuff which is only useful for libav* developers. | ||
86 | */ | ||
87 | #define AV_LOG_DEBUG 48 | ||
88 | |||
89 | /** | ||
90 | * Sends the specified message to the log if the level is less than or equal | ||
91 | * to the current av_log_level. By default, all logging messages are sent to | ||
92 | * stderr. This behavior can be altered by setting a different av_vlog callback | ||
93 | * function. | ||
94 | * | ||
95 | * @param avcl A pointer to an arbitrary struct of which the first field is a | ||
96 | * pointer to an AVClass struct. | ||
97 | * @param level The importance level of the message, lower values signifying | ||
98 | * higher importance. | ||
99 | * @param fmt The format string (printf-compatible) that specifies how | ||
100 | * subsequent arguments are converted to output. | ||
101 | * @see av_vlog | ||
102 | */ | ||
103 | #ifdef __GNUC__ | ||
104 | void av_log(void*, int level, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 3, 4))); | ||
105 | #else | ||
106 | void av_log(void*, int level, const char *fmt, ...); | ||
107 | #endif | ||
108 | |||
109 | void av_vlog(void*, int level, const char *fmt, va_list); | ||
110 | int av_log_get_level(void); | ||
111 | void av_log_set_level(int); | ||
112 | void av_log_set_callback(void (*)(void*, int, const char*, va_list)); | ||
113 | void av_log_default_callback(void* ptr, int level); | ||
114 | |||
115 | #endif /* AVUTIL_LOG_H */ | ||
diff --git a/apps/codecs/libwmapro/libavutil/mathematics.c b/apps/codecs/libwmapro/libavutil/mathematics.c deleted file mode 100644 index f607d68b6e..0000000000 --- a/apps/codecs/libwmapro/libavutil/mathematics.c +++ /dev/null | |||
@@ -1,174 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2005 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 libavutil/mathematics.c | ||
23 | * miscellaneous math routines and tables | ||
24 | */ | ||
25 | |||
26 | //#include <assert.h> | ||
27 | #include <stdint.h> | ||
28 | #include <limits.h> | ||
29 | #include "mathematics.h" | ||
30 | |||
31 | const uint8_t ff_sqrt_tab[256]={ | ||
32 | 0, 16, 23, 28, 32, 36, 40, 43, 46, 48, 51, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 77, 79, 80, 82, 84, 85, 87, 88, 90, | ||
33 | 91, 92, 94, 95, 96, 98, 99,100,102,103,104,105,107,108,109,110,111,112,114,115,116,117,118,119,120,121,122,123,124,125,126,127, | ||
34 | 128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,144,145,146,147,148,149,150,151,151,152,153,154,155,156,156, | ||
35 | 157,158,159,160,160,161,162,163,164,164,165,166,167,168,168,169,170,171,171,172,173,174,174,175,176,176,177,178,179,179,180,181, | ||
36 | 182,182,183,184,184,185,186,186,187,188,188,189,190,190,191,192,192,193,194,194,195,196,196,197,198,198,199,200,200,201,202,202, | ||
37 | 203,204,204,205,205,206,207,207,208,208,209,210,210,211,212,212,213,213,214,215,215,216,216,217,218,218,219,219,220,220,221,222, | ||
38 | 222,223,223,224,224,225,226,226,227,227,228,228,229,230,230,231,231,232,232,233,233,234,235,235,236,236,237,237,238,238,239,239, | ||
39 | 240,240,241,242,242,243,243,244,244,245,245,246,246,247,247,248,248,249,249,250,250,251,251,252,252,253,253,254,254,255,255,255 | ||
40 | }; | ||
41 | |||
42 | const uint8_t ff_log2_tab[256]={ | ||
43 | 0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, | ||
44 | 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, | ||
45 | 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, | ||
46 | 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, | ||
47 | 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, | ||
48 | 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, | ||
49 | 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, | ||
50 | 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7 | ||
51 | }; | ||
52 | |||
53 | const uint8_t av_reverse[256]={ | ||
54 | 0x00,0x80,0x40,0xC0,0x20,0xA0,0x60,0xE0,0x10,0x90,0x50,0xD0,0x30,0xB0,0x70,0xF0, | ||
55 | 0x08,0x88,0x48,0xC8,0x28,0xA8,0x68,0xE8,0x18,0x98,0x58,0xD8,0x38,0xB8,0x78,0xF8, | ||
56 | 0x04,0x84,0x44,0xC4,0x24,0xA4,0x64,0xE4,0x14,0x94,0x54,0xD4,0x34,0xB4,0x74,0xF4, | ||
57 | 0x0C,0x8C,0x4C,0xCC,0x2C,0xAC,0x6C,0xEC,0x1C,0x9C,0x5C,0xDC,0x3C,0xBC,0x7C,0xFC, | ||
58 | 0x02,0x82,0x42,0xC2,0x22,0xA2,0x62,0xE2,0x12,0x92,0x52,0xD2,0x32,0xB2,0x72,0xF2, | ||
59 | 0x0A,0x8A,0x4A,0xCA,0x2A,0xAA,0x6A,0xEA,0x1A,0x9A,0x5A,0xDA,0x3A,0xBA,0x7A,0xFA, | ||
60 | 0x06,0x86,0x46,0xC6,0x26,0xA6,0x66,0xE6,0x16,0x96,0x56,0xD6,0x36,0xB6,0x76,0xF6, | ||
61 | 0x0E,0x8E,0x4E,0xCE,0x2E,0xAE,0x6E,0xEE,0x1E,0x9E,0x5E,0xDE,0x3E,0xBE,0x7E,0xFE, | ||
62 | 0x01,0x81,0x41,0xC1,0x21,0xA1,0x61,0xE1,0x11,0x91,0x51,0xD1,0x31,0xB1,0x71,0xF1, | ||
63 | 0x09,0x89,0x49,0xC9,0x29,0xA9,0x69,0xE9,0x19,0x99,0x59,0xD9,0x39,0xB9,0x79,0xF9, | ||
64 | 0x05,0x85,0x45,0xC5,0x25,0xA5,0x65,0xE5,0x15,0x95,0x55,0xD5,0x35,0xB5,0x75,0xF5, | ||
65 | 0x0D,0x8D,0x4D,0xCD,0x2D,0xAD,0x6D,0xED,0x1D,0x9D,0x5D,0xDD,0x3D,0xBD,0x7D,0xFD, | ||
66 | 0x03,0x83,0x43,0xC3,0x23,0xA3,0x63,0xE3,0x13,0x93,0x53,0xD3,0x33,0xB3,0x73,0xF3, | ||
67 | 0x0B,0x8B,0x4B,0xCB,0x2B,0xAB,0x6B,0xEB,0x1B,0x9B,0x5B,0xDB,0x3B,0xBB,0x7B,0xFB, | ||
68 | 0x07,0x87,0x47,0xC7,0x27,0xA7,0x67,0xE7,0x17,0x97,0x57,0xD7,0x37,0xB7,0x77,0xF7, | ||
69 | 0x0F,0x8F,0x4F,0xCF,0x2F,0xAF,0x6F,0xEF,0x1F,0x9F,0x5F,0xDF,0x3F,0xBF,0x7F,0xFF, | ||
70 | }; | ||
71 | |||
72 | int64_t av_gcd(int64_t a, int64_t b){ | ||
73 | if(b) return av_gcd(b, a%b); | ||
74 | else return a; | ||
75 | } | ||
76 | |||
77 | int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding rnd){ | ||
78 | int64_t r=0; | ||
79 | //assert(c > 0); | ||
80 | //assert(b >=0); | ||
81 | //assert(rnd >=0 && rnd<=5 && rnd!=4); | ||
82 | |||
83 | if(a<0 && a != INT64_MIN) return -av_rescale_rnd(-a, b, c, rnd ^ ((rnd>>1)&1)); | ||
84 | |||
85 | if(rnd==AV_ROUND_NEAR_INF) r= c/2; | ||
86 | else if(rnd&1) r= c-1; | ||
87 | |||
88 | if(b<=INT_MAX && c<=INT_MAX){ | ||
89 | if(a<=INT_MAX) | ||
90 | return (a * b + r)/c; | ||
91 | else | ||
92 | return a/c*b + (a%c*b + r)/c; | ||
93 | }else{ | ||
94 | #if 1 | ||
95 | uint64_t a0= a&0xFFFFFFFF; | ||
96 | uint64_t a1= a>>32; | ||
97 | uint64_t b0= b&0xFFFFFFFF; | ||
98 | uint64_t b1= b>>32; | ||
99 | uint64_t t1= a0*b1 + a1*b0; | ||
100 | uint64_t t1a= t1<<32; | ||
101 | int i; | ||
102 | |||
103 | a0 = a0*b0 + t1a; | ||
104 | a1 = a1*b1 + (t1>>32) + (a0<t1a); | ||
105 | a0 += r; | ||
106 | a1 += a0<(unsigned)r; | ||
107 | |||
108 | for(i=63; i>=0; i--){ | ||
109 | // int o= a1 & 0x8000000000000000ULL; | ||
110 | a1+= a1 + ((a0>>i)&1); | ||
111 | t1+=t1; | ||
112 | if(/*o || */(unsigned)c <= a1){ | ||
113 | a1 -= c; | ||
114 | t1++; | ||
115 | } | ||
116 | } | ||
117 | return t1; | ||
118 | } | ||
119 | #else | ||
120 | AVInteger ai; | ||
121 | ai= av_mul_i(av_int2i(a), av_int2i(b)); | ||
122 | ai= av_add_i(ai, av_int2i(r)); | ||
123 | |||
124 | return av_i2int(av_div_i(ai, av_int2i(c))); | ||
125 | } | ||
126 | #endif | ||
127 | } | ||
128 | |||
129 | int64_t av_rescale(int64_t a, int64_t b, int64_t c){ | ||
130 | return av_rescale_rnd(a, b, c, AV_ROUND_NEAR_INF); | ||
131 | } | ||
132 | #if 0 | ||
133 | int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq){ | ||
134 | int64_t b= bq.num * (int64_t)cq.den; | ||
135 | int64_t c= cq.num * (int64_t)bq.den; | ||
136 | return av_rescale_rnd(a, b, c, AV_ROUND_NEAR_INF); | ||
137 | } | ||
138 | |||
139 | int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b){ | ||
140 | int64_t a= tb_a.num * (int64_t)tb_b.den; | ||
141 | int64_t b= tb_b.num * (int64_t)tb_a.den; | ||
142 | if (av_rescale_rnd(ts_a, a, b, AV_ROUND_DOWN) < ts_b) return -1; | ||
143 | if (av_rescale_rnd(ts_b, b, a, AV_ROUND_DOWN) < ts_a) return 1; | ||
144 | return 0; | ||
145 | } | ||
146 | #endif | ||
147 | #ifdef TEST | ||
148 | #include "integer.h" | ||
149 | #undef printf | ||
150 | int main(void){ | ||
151 | int64_t a,b,c,d,e; | ||
152 | |||
153 | for(a=7; a<(1LL<<62); a+=a/3+1){ | ||
154 | for(b=3; b<(1LL<<62); b+=b/4+1){ | ||
155 | for(c=9; c<(1LL<<62); c+=(c*2)/5+3){ | ||
156 | int64_t r= c/2; | ||
157 | AVInteger ai; | ||
158 | ai= av_mul_i(av_int2i(a), av_int2i(b)); | ||
159 | ai= av_add_i(ai, av_int2i(r)); | ||
160 | |||
161 | d= av_i2int(av_div_i(ai, av_int2i(c))); | ||
162 | |||
163 | e= av_rescale(a,b,c); | ||
164 | |||
165 | if((double)a * (double)b / (double)c > (1LL<<63)) | ||
166 | continue; | ||
167 | |||
168 | if(d!=e) printf("%"PRId64"*%"PRId64"/%"PRId64"= %"PRId64"=%"PRId64"\n", a, b, c, d, e); | ||
169 | } | ||
170 | } | ||
171 | } | ||
172 | return 0; | ||
173 | } | ||
174 | #endif | ||
diff --git a/apps/codecs/libwmapro/libavutil/mathematics.h b/apps/codecs/libwmapro/libavutil/mathematics.h deleted file mode 100644 index a09d3e9ad8..0000000000 --- a/apps/codecs/libwmapro/libavutil/mathematics.h +++ /dev/null | |||
@@ -1,98 +0,0 @@ | |||
1 | /* | ||
2 | * copyright (c) 2005 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 | #ifndef AVUTIL_MATHEMATICS_H | ||
22 | #define AVUTIL_MATHEMATICS_H | ||
23 | |||
24 | #include <stdint.h> | ||
25 | #include <math.h> | ||
26 | #include "attributes.h" | ||
27 | //#include "rational.h" | ||
28 | |||
29 | #ifndef M_E | ||
30 | #define M_E 2.7182818284590452354 /* e */ | ||
31 | #endif | ||
32 | #ifndef M_LN2 | ||
33 | #define M_LN2 0.69314718055994530942 /* log_e 2 */ | ||
34 | #endif | ||
35 | #ifndef M_LN10 | ||
36 | #define M_LN10 2.30258509299404568402 /* log_e 10 */ | ||
37 | #endif | ||
38 | #ifndef M_LOG2_10 | ||
39 | #define M_LOG2_10 3.32192809488736234787 /* log_2 10 */ | ||
40 | #endif | ||
41 | #ifndef M_PI | ||
42 | #define M_PI 3.14159265358979323846 /* pi */ | ||
43 | #endif | ||
44 | #ifndef M_SQRT1_2 | ||
45 | #define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */ | ||
46 | #endif | ||
47 | #ifndef M_SQRT2 | ||
48 | #define M_SQRT2 1.41421356237309504880 /* sqrt(2) */ | ||
49 | #endif | ||
50 | #ifndef NAN | ||
51 | #define NAN (0.0/0.0) | ||
52 | #endif | ||
53 | #ifndef INFINITY | ||
54 | #define INFINITY (1.0/0.0) | ||
55 | #endif | ||
56 | |||
57 | enum AVRounding { | ||
58 | AV_ROUND_ZERO = 0, ///< Round toward zero. | ||
59 | AV_ROUND_INF = 1, ///< Round away from zero. | ||
60 | AV_ROUND_DOWN = 2, ///< Round toward -infinity. | ||
61 | AV_ROUND_UP = 3, ///< Round toward +infinity. | ||
62 | AV_ROUND_NEAR_INF = 5, ///< Round to nearest and halfway cases away from zero. | ||
63 | }; | ||
64 | |||
65 | /** | ||
66 | * Returns the greatest common divisor of a and b. | ||
67 | * If both a and b are 0 or either or both are <0 then behavior is | ||
68 | * undefined. | ||
69 | */ | ||
70 | int64_t av_const av_gcd(int64_t a, int64_t b); | ||
71 | |||
72 | /** | ||
73 | * Rescales a 64-bit integer with rounding to nearest. | ||
74 | * A simple a*b/c isn't possible as it can overflow. | ||
75 | */ | ||
76 | int64_t av_rescale(int64_t a, int64_t b, int64_t c) av_const; | ||
77 | |||
78 | /** | ||
79 | * Rescales a 64-bit integer with specified rounding. | ||
80 | * A simple a*b/c isn't possible as it can overflow. | ||
81 | */ | ||
82 | int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding) av_const; | ||
83 | |||
84 | /** | ||
85 | * Rescales a 64-bit integer by 2 rational numbers. | ||
86 | */ | ||
87 | //int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq) av_const; | ||
88 | |||
89 | /** | ||
90 | * Compares 2 timestamps each in its own timebases. | ||
91 | * The result of the function is undefined if one of the timestamps | ||
92 | * is outside the int64_t range when represented in the others timebase. | ||
93 | * @return -1 if ts_a is before ts_b, 1 if ts_a is after ts_b or 0 if they represent the same position | ||
94 | */ | ||
95 | //int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b); | ||
96 | |||
97 | |||
98 | #endif /* AVUTIL_MATHEMATICS_H */ | ||
diff --git a/apps/codecs/libwmapro/libavutil/mem.c b/apps/codecs/libwmapro/libavutil/mem.c deleted file mode 100644 index 7c37e9be9f..0000000000 --- a/apps/codecs/libwmapro/libavutil/mem.c +++ /dev/null | |||
@@ -1,176 +0,0 @@ | |||
1 | /* | ||
2 | * default memory allocator for libavutil | ||
3 | * Copyright (c) 2002 Fabrice Bellard | ||
4 | * | ||
5 | * This file is part of FFmpeg. | ||
6 | * | ||
7 | * FFmpeg is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU Lesser General Public | ||
9 | * License as published by the Free Software Foundation; either | ||
10 | * version 2.1 of the License, or (at your option) any later version. | ||
11 | * | ||
12 | * FFmpeg is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
15 | * Lesser General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU Lesser General Public | ||
18 | * License along with FFmpeg; if not, write to the Free Software | ||
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
20 | */ | ||
21 | |||
22 | /** | ||
23 | * @file libavutil/mem.c | ||
24 | * default memory allocator for libavutil | ||
25 | */ | ||
26 | |||
27 | //#include "config.h" | ||
28 | |||
29 | #include <limits.h> | ||
30 | #include <stdlib.h> | ||
31 | #include <string.h> | ||
32 | #if HAVE_MALLOC_H | ||
33 | #include <malloc.h> | ||
34 | #endif | ||
35 | |||
36 | #include "avutil.h" | ||
37 | #include "mem.h" | ||
38 | |||
39 | /* here we can use OS-dependent allocation functions */ | ||
40 | #undef free | ||
41 | #undef malloc | ||
42 | #undef realloc | ||
43 | |||
44 | #ifdef MALLOC_PREFIX | ||
45 | |||
46 | #define malloc AV_JOIN(MALLOC_PREFIX, malloc) | ||
47 | #define memalign AV_JOIN(MALLOC_PREFIX, memalign) | ||
48 | #define posix_memalign AV_JOIN(MALLOC_PREFIX, posix_memalign) | ||
49 | #define realloc AV_JOIN(MALLOC_PREFIX, realloc) | ||
50 | #define free AV_JOIN(MALLOC_PREFIX, free) | ||
51 | |||
52 | void *malloc(size_t size); | ||
53 | void *memalign(size_t align, size_t size); | ||
54 | int posix_memalign(void **ptr, size_t align, size_t size); | ||
55 | void *realloc(void *ptr, size_t size); | ||
56 | void free(void *ptr); | ||
57 | |||
58 | #endif /* MALLOC_PREFIX */ | ||
59 | |||
60 | /* You can redefine av_malloc and av_free in your project to use your | ||
61 | memory allocator. You do not need to suppress this file because the | ||
62 | linker will do it automatically. */ | ||
63 | |||
64 | void *av_malloc(unsigned int size) | ||
65 | { | ||
66 | void *ptr = NULL; | ||
67 | #if CONFIG_MEMALIGN_HACK | ||
68 | long diff; | ||
69 | #endif | ||
70 | |||
71 | /* let's disallow possible ambiguous cases */ | ||
72 | if(size > (INT_MAX-16) ) | ||
73 | return NULL; | ||
74 | |||
75 | #if CONFIG_MEMALIGN_HACK | ||
76 | ptr = malloc(size+16); | ||
77 | if(!ptr) | ||
78 | return ptr; | ||
79 | diff= ((-(long)ptr - 1)&15) + 1; | ||
80 | ptr = (char*)ptr + diff; | ||
81 | ((char*)ptr)[-1]= diff; | ||
82 | #elif HAVE_POSIX_MEMALIGN | ||
83 | if (posix_memalign(&ptr,16,size)) | ||
84 | ptr = NULL; | ||
85 | #elif HAVE_MEMALIGN | ||
86 | ptr = memalign(16,size); | ||
87 | /* Why 64? | ||
88 | Indeed, we should align it: | ||
89 | on 4 for 386 | ||
90 | on 16 for 486 | ||
91 | on 32 for 586, PPro - K6-III | ||
92 | on 64 for K7 (maybe for P3 too). | ||
93 | Because L1 and L2 caches are aligned on those values. | ||
94 | But I don't want to code such logic here! | ||
95 | */ | ||
96 | /* Why 16? | ||
97 | Because some CPUs need alignment, for example SSE2 on P4, & most RISC CPUs | ||
98 | it will just trigger an exception and the unaligned load will be done in the | ||
99 | exception handler or it will just segfault (SSE2 on P4). | ||
100 | Why not larger? Because I did not see a difference in benchmarks ... | ||
101 | */ | ||
102 | /* benchmarks with P3 | ||
103 | memalign(64)+1 3071,3051,3032 | ||
104 | memalign(64)+2 3051,3032,3041 | ||
105 | memalign(64)+4 2911,2896,2915 | ||
106 | memalign(64)+8 2545,2554,2550 | ||
107 | memalign(64)+16 2543,2572,2563 | ||
108 | memalign(64)+32 2546,2545,2571 | ||
109 | memalign(64)+64 2570,2533,2558 | ||
110 | |||
111 | BTW, malloc seems to do 8-byte alignment by default here. | ||
112 | */ | ||
113 | #else | ||
114 | ptr = malloc(size); | ||
115 | #endif | ||
116 | return ptr; | ||
117 | } | ||
118 | |||
119 | void *av_realloc(void *ptr, unsigned int size) | ||
120 | { | ||
121 | #if CONFIG_MEMALIGN_HACK | ||
122 | int diff; | ||
123 | #endif | ||
124 | |||
125 | /* let's disallow possible ambiguous cases */ | ||
126 | if(size > (INT_MAX-16) ) | ||
127 | return NULL; | ||
128 | |||
129 | #if CONFIG_MEMALIGN_HACK | ||
130 | //FIXME this isn't aligned correctly, though it probably isn't needed | ||
131 | if(!ptr) return av_malloc(size); | ||
132 | diff= ((char*)ptr)[-1]; | ||
133 | return (char*)realloc((char*)ptr - diff, size + diff) + diff; | ||
134 | #else | ||
135 | return realloc(ptr, size); | ||
136 | #endif | ||
137 | } | ||
138 | |||
139 | void av_free(void *ptr) | ||
140 | { | ||
141 | /* XXX: this test should not be needed on most libcs */ | ||
142 | if (ptr) | ||
143 | #if CONFIG_MEMALIGN_HACK | ||
144 | free((char*)ptr - ((char*)ptr)[-1]); | ||
145 | #else | ||
146 | free(ptr); | ||
147 | #endif | ||
148 | } | ||
149 | |||
150 | void av_freep(void *arg) | ||
151 | { | ||
152 | void **ptr= (void**)arg; | ||
153 | av_free(*ptr); | ||
154 | *ptr = NULL; | ||
155 | } | ||
156 | |||
157 | void *av_mallocz(unsigned int size) | ||
158 | { | ||
159 | void *ptr = av_malloc(size); | ||
160 | if (ptr) | ||
161 | memset(ptr, 0, size); | ||
162 | return ptr; | ||
163 | } | ||
164 | |||
165 | char *av_strdup(const char *s) | ||
166 | { | ||
167 | char *ptr= NULL; | ||
168 | if(s){ | ||
169 | int len = strlen(s) + 1; | ||
170 | ptr = av_malloc(len); | ||
171 | if (ptr) | ||
172 | memcpy(ptr, s, len); | ||
173 | } | ||
174 | return ptr; | ||
175 | } | ||
176 | |||
diff --git a/apps/codecs/libwmapro/libavutil/mem.h b/apps/codecs/libwmapro/libavutil/mem.h deleted file mode 100644 index fffbb872ae..0000000000 --- a/apps/codecs/libwmapro/libavutil/mem.h +++ /dev/null | |||
@@ -1,125 +0,0 @@ | |||
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 libavutil/mem.h | ||
23 | * memory handling functions | ||
24 | */ | ||
25 | |||
26 | #ifndef AVUTIL_MEM_H | ||
27 | #define AVUTIL_MEM_H | ||
28 | |||
29 | #include "attributes.h" | ||
30 | |||
31 | #if defined(__ICC) || defined(__SUNPRO_C) | ||
32 | #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v | ||
33 | #define DECLARE_ASM_CONST(n,t,v) const t __attribute__ ((aligned (n))) v | ||
34 | #elif defined(__TI_COMPILER_VERSION__) | ||
35 | #define DECLARE_ALIGNED(n,t,v) \ | ||
36 | AV_PRAGMA(DATA_ALIGN(v,n)) \ | ||
37 | t __attribute__((aligned(n))) v | ||
38 | #define DECLARE_ASM_CONST(n,t,v) \ | ||
39 | AV_PRAGMA(DATA_ALIGN(v,n)) \ | ||
40 | static const t __attribute__((aligned(n))) v | ||
41 | #elif defined(__GNUC__) | ||
42 | #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v | ||
43 | #define DECLARE_ASM_CONST(n,t,v) static const t attribute_used __attribute__ ((aligned (n))) v | ||
44 | #elif defined(_MSC_VER) | ||
45 | #define DECLARE_ALIGNED(n,t,v) __declspec(align(n)) t v | ||
46 | #define DECLARE_ASM_CONST(n,t,v) __declspec(align(n)) static const t v | ||
47 | #else | ||
48 | #define DECLARE_ALIGNED(n,t,v) t v | ||
49 | #define DECLARE_ASM_CONST(n,t,v) static const t v | ||
50 | #endif | ||
51 | |||
52 | #if AV_GCC_VERSION_AT_LEAST(3,1) | ||
53 | #define av_malloc_attrib __attribute__((__malloc__)) | ||
54 | #else | ||
55 | #define av_malloc_attrib | ||
56 | #endif | ||
57 | |||
58 | #if (!defined(__ICC) || __ICC > 1110) && AV_GCC_VERSION_AT_LEAST(4,3) | ||
59 | #define av_alloc_size(n) __attribute__((alloc_size(n))) | ||
60 | #else | ||
61 | #define av_alloc_size(n) | ||
62 | #endif | ||
63 | |||
64 | /** | ||
65 | * Allocates a block of size bytes with alignment suitable for all | ||
66 | * memory accesses (including vectors if available on the CPU). | ||
67 | * @param size Size in bytes for the memory block to be allocated. | ||
68 | * @return Pointer to the allocated block, NULL if the block cannot | ||
69 | * be allocated. | ||
70 | * @see av_mallocz() | ||
71 | */ | ||
72 | void *av_malloc(unsigned int size) av_malloc_attrib av_alloc_size(1); | ||
73 | |||
74 | /** | ||
75 | * Allocates or reallocates a block of memory. | ||
76 | * If ptr is NULL and size > 0, allocates a new block. If | ||
77 | * size is zero, frees the memory block pointed to by ptr. | ||
78 | * @param size Size in bytes for the memory block to be allocated or | ||
79 | * reallocated. | ||
80 | * @param ptr Pointer to a memory block already allocated with | ||
81 | * av_malloc(z)() or av_realloc() or NULL. | ||
82 | * @return Pointer to a newly reallocated block or NULL if the block | ||
83 | * cannot be reallocated or the function is used to free the memory block. | ||
84 | * @see av_fast_realloc() | ||
85 | */ | ||
86 | void *av_realloc(void *ptr, unsigned int size) av_alloc_size(2); | ||
87 | |||
88 | /** | ||
89 | * Frees a memory block which has been allocated with av_malloc(z)() or | ||
90 | * av_realloc(). | ||
91 | * @param ptr Pointer to the memory block which should be freed. | ||
92 | * @note ptr = NULL is explicitly allowed. | ||
93 | * @note It is recommended that you use av_freep() instead. | ||
94 | * @see av_freep() | ||
95 | */ | ||
96 | void av_free(void *ptr); | ||
97 | |||
98 | /** | ||
99 | * Allocates a block of size bytes with alignment suitable for all | ||
100 | * memory accesses (including vectors if available on the CPU) and | ||
101 | * zeroes all the bytes of the block. | ||
102 | * @param size Size in bytes for the memory block to be allocated. | ||
103 | * @return Pointer to the allocated block, NULL if it cannot be allocated. | ||
104 | * @see av_malloc() | ||
105 | */ | ||
106 | void *av_mallocz(unsigned int size) av_malloc_attrib av_alloc_size(1); | ||
107 | |||
108 | /** | ||
109 | * Duplicates the string s. | ||
110 | * @param s string to be duplicated | ||
111 | * @return Pointer to a newly allocated string containing a | ||
112 | * copy of s or NULL if the string cannot be allocated. | ||
113 | */ | ||
114 | char *av_strdup(const char *s) av_malloc_attrib; | ||
115 | |||
116 | /** | ||
117 | * Frees a memory block which has been allocated with av_malloc(z)() or | ||
118 | * av_realloc() and set the pointer pointing to it to NULL. | ||
119 | * @param ptr Pointer to the pointer to the memory block which should | ||
120 | * be freed. | ||
121 | * @see av_free() | ||
122 | */ | ||
123 | void av_freep(void *ptr); | ||
124 | |||
125 | #endif /* AVUTIL_MEM_H */ | ||