Mercurial > libavutil.hg
annotate common.h @ 131:e10026931162 libavutil
Fix wrong params name in PUT_UTF8 doxy comments
author | gpoirier |
---|---|
date | Mon, 06 Nov 2006 10:39:07 +0000 |
parents | dc1ff57e1b08 |
children | 589af48c86f4 |
rev | line source |
---|---|
108
11be8e0d1344
Add official LGPL license headers to the files that were missing them.
diego
parents:
104
diff
changeset
|
1 /* |
11be8e0d1344
Add official LGPL license headers to the files that were missing them.
diego
parents:
104
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:
104
diff
changeset
|
3 * |
116
d76a36742464
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
113
diff
changeset
|
4 * This file is part of FFmpeg. |
d76a36742464
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
113
diff
changeset
|
5 * |
d76a36742464
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
113
diff
changeset
|
6 * FFmpeg is free software; you can redistribute it and/or |
108
11be8e0d1344
Add official LGPL license headers to the files that were missing them.
diego
parents:
104
diff
changeset
|
7 * 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:
104
diff
changeset
|
8 * License as published by the Free Software Foundation; either |
116
d76a36742464
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
113
diff
changeset
|
9 * version 2.1 of the License, or (at your option) any later version. |
108
11be8e0d1344
Add official LGPL license headers to the files that were missing them.
diego
parents:
104
diff
changeset
|
10 * |
116
d76a36742464
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
113
diff
changeset
|
11 * FFmpeg is distributed in the hope that it will be useful, |
108
11be8e0d1344
Add official LGPL license headers to the files that were missing them.
diego
parents:
104
diff
changeset
|
12 * 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:
104
diff
changeset
|
13 * 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:
104
diff
changeset
|
14 * Lesser General Public License for more details. |
11be8e0d1344
Add official LGPL license headers to the files that were missing them.
diego
parents:
104
diff
changeset
|
15 * |
11be8e0d1344
Add official LGPL license headers to the files that were missing them.
diego
parents:
104
diff
changeset
|
16 * You should have received a copy of the GNU Lesser General Public |
116
d76a36742464
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
113
diff
changeset
|
17 * License along with FFmpeg; if not, write to the Free Software |
108
11be8e0d1344
Add official LGPL license headers to the files that were missing them.
diego
parents:
104
diff
changeset
|
18 * 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:
104
diff
changeset
|
19 */ |
11be8e0d1344
Add official LGPL license headers to the files that were missing them.
diego
parents:
104
diff
changeset
|
20 |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
21 /** |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
22 * @file common.h |
80
624fc3ad183a
Split common.h in two parts, purely internal stuff (internal.h) and things
reimar
parents:
75
diff
changeset
|
23 * common internal and external api header. |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
24 */ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
25 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
26 #ifndef COMMON_H |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
27 #define COMMON_H |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
28 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
29 #ifndef M_PI |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
30 #define M_PI 3.14159265358979323846 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
31 #endif |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
32 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
33 #ifdef HAVE_AV_CONFIG_H |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
34 /* only include the following when compiling package */ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
35 # include "config.h" |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
36 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
37 # include <stdlib.h> |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
38 # include <stdio.h> |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
39 # include <string.h> |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
40 # include <ctype.h> |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
41 # include <limits.h> |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
42 # ifndef __BEOS__ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
43 # include <errno.h> |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
44 # else |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
45 # include "berrno.h" |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
46 # endif |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
47 # include <math.h> |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
48 #endif /* HAVE_AV_CONFIG_H */ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
49 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
50 /* Suppress restrict if it was not defined in config.h. */ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
51 #ifndef restrict |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
52 # define restrict |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
53 #endif |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
54 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
55 #ifndef always_inline |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
56 #if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ > 0) |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
57 # define always_inline __attribute__((always_inline)) inline |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
58 #else |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
59 # define always_inline inline |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
60 #endif |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
61 #endif |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
62 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
63 #ifndef attribute_used |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
64 #if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ > 0) |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
65 # define attribute_used __attribute__((used)) |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
66 #else |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
67 # define attribute_used |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
68 #endif |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
69 #endif |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
70 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
71 #ifndef attribute_unused |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
72 #if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ > 0) |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
73 # define attribute_unused __attribute__((unused)) |
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 # define attribute_unused |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
76 #endif |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
77 #endif |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
78 |
100 | 79 #ifndef attribute_deprecated |
80 #if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ > 0) | |
81 # define attribute_deprecated __attribute__((deprecated)) | |
82 #else | |
83 # define attribute_deprecated | |
84 #endif | |
85 #endif | |
86 | |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
87 #ifndef EMULATE_INTTYPES |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
88 # include <inttypes.h> |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
89 #else |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
90 typedef signed char int8_t; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
91 typedef signed short int16_t; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
92 typedef signed int int32_t; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
93 typedef unsigned char uint8_t; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
94 typedef unsigned short uint16_t; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
95 typedef unsigned int uint32_t; |
71 | 96 typedef signed long long int64_t; |
97 typedef unsigned long long uint64_t; | |
3 | 98 #endif /* EMULATE_INTTYPES */ |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
99 |
11
b5bd7d00de0f
Add some more PRIfooNN crap so it builds again here. Why can't ppl add defaults when they use such things ?
mmu_man
parents:
10
diff
changeset
|
100 #ifndef PRId64 |
b5bd7d00de0f
Add some more PRIfooNN crap so it builds again here. Why can't ppl add defaults when they use such things ?
mmu_man
parents:
10
diff
changeset
|
101 #define PRId64 "lld" |
b5bd7d00de0f
Add some more PRIfooNN crap so it builds again here. Why can't ppl add defaults when they use such things ?
mmu_man
parents:
10
diff
changeset
|
102 #endif |
b5bd7d00de0f
Add some more PRIfooNN crap so it builds again here. Why can't ppl add defaults when they use such things ?
mmu_man
parents:
10
diff
changeset
|
103 |
8
2dd915c714fa
fix for systems not defining PRIu64, not everyone knows C99.
mmu_man
parents:
7
diff
changeset
|
104 #ifndef PRIu64 |
11
b5bd7d00de0f
Add some more PRIfooNN crap so it builds again here. Why can't ppl add defaults when they use such things ?
mmu_man
parents:
10
diff
changeset
|
105 #define PRIu64 "llu" |
b5bd7d00de0f
Add some more PRIfooNN crap so it builds again here. Why can't ppl add defaults when they use such things ?
mmu_man
parents:
10
diff
changeset
|
106 #endif |
b5bd7d00de0f
Add some more PRIfooNN crap so it builds again here. Why can't ppl add defaults when they use such things ?
mmu_man
parents:
10
diff
changeset
|
107 |
b5bd7d00de0f
Add some more PRIfooNN crap so it builds again here. Why can't ppl add defaults when they use such things ?
mmu_man
parents:
10
diff
changeset
|
108 #ifndef PRIx64 |
b5bd7d00de0f
Add some more PRIfooNN crap so it builds again here. Why can't ppl add defaults when they use such things ?
mmu_man
parents:
10
diff
changeset
|
109 #define PRIx64 "llx" |
b5bd7d00de0f
Add some more PRIfooNN crap so it builds again here. Why can't ppl add defaults when they use such things ?
mmu_man
parents:
10
diff
changeset
|
110 #endif |
b5bd7d00de0f
Add some more PRIfooNN crap so it builds again here. Why can't ppl add defaults when they use such things ?
mmu_man
parents:
10
diff
changeset
|
111 |
127
c1916b2259c5
Define fallback for PRIX64, taken from a patch by Steve L'Homme.
diego
parents:
126
diff
changeset
|
112 #ifndef PRIX64 |
c1916b2259c5
Define fallback for PRIX64, taken from a patch by Steve L'Homme.
diego
parents:
126
diff
changeset
|
113 #define PRIX64 "llX" |
c1916b2259c5
Define fallback for PRIX64, taken from a patch by Steve L'Homme.
diego
parents:
126
diff
changeset
|
114 #endif |
c1916b2259c5
Define fallback for PRIX64, taken from a patch by Steve L'Homme.
diego
parents:
126
diff
changeset
|
115 |
11
b5bd7d00de0f
Add some more PRIfooNN crap so it builds again here. Why can't ppl add defaults when they use such things ?
mmu_man
parents:
10
diff
changeset
|
116 #ifndef PRId32 |
b5bd7d00de0f
Add some more PRIfooNN crap so it builds again here. Why can't ppl add defaults when they use such things ?
mmu_man
parents:
10
diff
changeset
|
117 #define PRId32 "d" |
b5bd7d00de0f
Add some more PRIfooNN crap so it builds again here. Why can't ppl add defaults when they use such things ?
mmu_man
parents:
10
diff
changeset
|
118 #endif |
b5bd7d00de0f
Add some more PRIfooNN crap so it builds again here. Why can't ppl add defaults when they use such things ?
mmu_man
parents:
10
diff
changeset
|
119 |
b5bd7d00de0f
Add some more PRIfooNN crap so it builds again here. Why can't ppl add defaults when they use such things ?
mmu_man
parents:
10
diff
changeset
|
120 #ifndef PRIdFAST16 |
b5bd7d00de0f
Add some more PRIfooNN crap so it builds again here. Why can't ppl add defaults when they use such things ?
mmu_man
parents:
10
diff
changeset
|
121 #define PRIdFAST16 PRId32 |
b5bd7d00de0f
Add some more PRIfooNN crap so it builds again here. Why can't ppl add defaults when they use such things ?
mmu_man
parents:
10
diff
changeset
|
122 #endif |
b5bd7d00de0f
Add some more PRIfooNN crap so it builds again here. Why can't ppl add defaults when they use such things ?
mmu_man
parents:
10
diff
changeset
|
123 |
b5bd7d00de0f
Add some more PRIfooNN crap so it builds again here. Why can't ppl add defaults when they use such things ?
mmu_man
parents:
10
diff
changeset
|
124 #ifndef PRIdFAST32 |
b5bd7d00de0f
Add some more PRIfooNN crap so it builds again here. Why can't ppl add defaults when they use such things ?
mmu_man
parents:
10
diff
changeset
|
125 #define PRIdFAST32 PRId32 |
8
2dd915c714fa
fix for systems not defining PRIu64, not everyone knows C99.
mmu_man
parents:
7
diff
changeset
|
126 #endif |
2dd915c714fa
fix for systems not defining PRIu64, not everyone knows C99.
mmu_man
parents:
7
diff
changeset
|
127 |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
128 #ifndef INT16_MIN |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
129 #define INT16_MIN (-0x7fff-1) |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
130 #endif |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
131 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
132 #ifndef INT16_MAX |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
133 #define INT16_MAX 0x7fff |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
134 #endif |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
135 |
33 | 136 #ifndef INT32_MIN |
137 #define INT32_MIN (-0x7fffffff-1) | |
138 #endif | |
139 | |
140 #ifndef INT32_MAX | |
141 #define INT32_MAX 0x7fffffff | |
142 #endif | |
143 | |
144 #ifndef UINT32_MAX | |
145 #define UINT32_MAX 0xffffffff | |
146 #endif | |
147 | |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
148 #ifndef INT64_MIN |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
149 #define INT64_MIN (-0x7fffffffffffffffLL-1) |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
150 #endif |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
151 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
152 #ifndef INT64_MAX |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
153 #define INT64_MAX int64_t_C(9223372036854775807) |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
154 #endif |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
155 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
156 #ifndef UINT64_MAX |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
157 #define UINT64_MAX uint64_t_C(0xFFFFFFFFFFFFFFFF) |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
158 #endif |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
159 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
160 #ifdef EMULATE_FAST_INT |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
161 typedef signed char int_fast8_t; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
162 typedef signed int int_fast16_t; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
163 typedef signed int int_fast32_t; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
164 typedef unsigned char uint_fast8_t; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
165 typedef unsigned int uint_fast16_t; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
166 typedef unsigned int uint_fast32_t; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
167 typedef uint64_t uint_fast64_t; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
168 #endif |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
169 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
170 #ifndef INT_BIT |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
171 # if INT_MAX != 2147483647 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
172 # define INT_BIT 64 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
173 # else |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
174 # define INT_BIT 32 |
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 #endif |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
177 |
74 | 178 #ifndef int64_t_C |
179 #define int64_t_C(c) (c ## LL) | |
180 #define uint64_t_C(c) (c ## ULL) | |
181 #endif | |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
182 |
22
3b56407b3f96
On MinGW it is not possible to build shared and static libraries at once.
diego
parents:
19
diff
changeset
|
183 #if defined(__MINGW32__) && !defined(BUILD_AVUTIL) && defined(BUILD_SHARED_AV) |
3b56407b3f96
On MinGW it is not possible to build shared and static libraries at once.
diego
parents:
19
diff
changeset
|
184 # define FF_IMPORT_ATTR __declspec(dllimport) |
3b56407b3f96
On MinGW it is not possible to build shared and static libraries at once.
diego
parents:
19
diff
changeset
|
185 #else |
3b56407b3f96
On MinGW it is not possible to build shared and static libraries at once.
diego
parents:
19
diff
changeset
|
186 # define FF_IMPORT_ATTR |
3b56407b3f96
On MinGW it is not possible to build shared and static libraries at once.
diego
parents:
19
diff
changeset
|
187 #endif |
3b56407b3f96
On MinGW it is not possible to build shared and static libraries at once.
diego
parents:
19
diff
changeset
|
188 |
3b56407b3f96
On MinGW it is not possible to build shared and static libraries at once.
diego
parents:
19
diff
changeset
|
189 |
80
624fc3ad183a
Split common.h in two parts, purely internal stuff (internal.h) and things
reimar
parents:
75
diff
changeset
|
190 #ifdef HAVE_AV_CONFIG_H |
624fc3ad183a
Split common.h in two parts, purely internal stuff (internal.h) and things
reimar
parents:
75
diff
changeset
|
191 /* only include the following when compiling package */ |
624fc3ad183a
Split common.h in two parts, purely internal stuff (internal.h) and things
reimar
parents:
75
diff
changeset
|
192 # include "internal.h" |
624fc3ad183a
Split common.h in two parts, purely internal stuff (internal.h) and things
reimar
parents:
75
diff
changeset
|
193 #endif |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
194 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
195 //rounded divison & shift |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
196 #define RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b)) |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
197 /* assume b>0 */ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
198 #define ROUNDED_DIV(a,b) (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b)) |
120 | 199 #define FFABS(a) ((a) >= 0 ? (a) : (-(a))) |
119
7d5463d9530a
Rename SIGN macro to FFSIGN to avoid clashes with system headers.
diego
parents:
117
diff
changeset
|
200 #define FFSIGN(a) ((a) > 0 ? 1 : -1) |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
201 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
202 #define FFMAX(a,b) ((a) > (b) ? (a) : (b)) |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
203 #define FFMIN(a,b) ((a) > (b) ? (b) : (a)) |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
204 |
126 | 205 #define FFSWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0) |
99 | 206 |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
207 /* misc math functions */ |
22
3b56407b3f96
On MinGW it is not possible to build shared and static libraries at once.
diego
parents:
19
diff
changeset
|
208 extern FF_IMPORT_ATTR const uint8_t ff_log2_tab[256]; |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
209 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
210 static inline int av_log2(unsigned int v) |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
211 { |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
212 int n; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
213 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
214 n = 0; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
215 if (v & 0xffff0000) { |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
216 v >>= 16; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
217 n += 16; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
218 } |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
219 if (v & 0xff00) { |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
220 v >>= 8; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
221 n += 8; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
222 } |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
223 n += ff_log2_tab[v]; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
224 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
225 return n; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
226 } |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
227 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
228 static inline int av_log2_16bit(unsigned int v) |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
229 { |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
230 int n; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
231 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
232 n = 0; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
233 if (v & 0xff00) { |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
234 v >>= 8; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
235 n += 8; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
236 } |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
237 n += ff_log2_tab[v]; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
238 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
239 return n; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
240 } |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
241 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
242 /* median of 3 */ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
243 static inline int mid_pred(int a, int b, int c) |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
244 { |
121
69714d5e1561
Protect code that uses CMOV instructions with HAVE_CMOV,
gpoirier
parents:
120
diff
changeset
|
245 #if HAVE_CMOV |
111 | 246 int i=b; |
109 | 247 asm volatile( |
111 | 248 "cmp %2, %1 \n\t" |
249 "cmovg %1, %0 \n\t" | |
250 "cmovg %2, %1 \n\t" | |
251 "cmp %3, %1 \n\t" | |
109 | 252 "cmovl %3, %1 \n\t" |
111 | 253 "cmp %1, %0 \n\t" |
254 "cmovg %1, %0 \n\t" | |
255 :"+&r"(i), "+&r"(a) | |
256 :"r"(b), "r"(c) | |
109 | 257 ); |
258 return i; | |
259 #elif 0 | |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
260 int t= (a-b)&((a-b)>>31); |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
261 a-=t; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
262 b+=t; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
263 b-= (b-c)&((b-c)>>31); |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
264 b+= (a-b)&((a-b)>>31); |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
265 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
266 return b; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
267 #else |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
268 if(a>b){ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
269 if(c>b){ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
270 if(c>a) b=a; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
271 else b=c; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
272 } |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
273 }else{ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
274 if(b>c){ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
275 if(c>a) b=c; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
276 else b=a; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
277 } |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
278 } |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
279 return b; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
280 #endif |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
281 } |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
282 |
39 | 283 /** |
284 * clip a signed integer value into the amin-amax range | |
285 * @param a value to clip | |
286 * @param amin minimum value of the clip range | |
287 * @param amax maximum value of the clip range | |
288 * @return cliped value | |
289 */ | |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
290 static inline int clip(int a, int amin, int amax) |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
291 { |
63 | 292 if (a < amin) return amin; |
293 else if (a > amax) return amax; | |
294 else return a; | |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
295 } |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
296 |
39 | 297 /** |
298 * clip a signed integer value into the 0-255 range | |
299 * @param a value to clip | |
300 * @return cliped value | |
301 */ | |
38
e7df68ba31a2
clip_uint8 should return an uint8_t instead of an int (patch by Panagiotis Issaris < takis.issaris _at_ uhasselt.be >)
aurel
parents:
33
diff
changeset
|
302 static inline uint8_t clip_uint8(int a) |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
303 { |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
304 if (a&(~255)) return (-a)>>31; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
305 else return a; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
306 } |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
307 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
308 /* math */ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
309 int64_t ff_gcd(int64_t a, int64_t b); |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
310 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
311 /** |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
312 * converts fourcc string to int |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
313 */ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
314 static inline int ff_get_fourcc(const char *s){ |
80
624fc3ad183a
Split common.h in two parts, purely internal stuff (internal.h) and things
reimar
parents:
75
diff
changeset
|
315 #ifdef HAVE_AV_CONFIG_H |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
316 assert( strlen(s)==4 ); |
80
624fc3ad183a
Split common.h in two parts, purely internal stuff (internal.h) and things
reimar
parents:
75
diff
changeset
|
317 #endif |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
318 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
319 return (s[0]) + (s[1]<<8) + (s[2]<<16) + (s[3]<<24); |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
320 } |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
321 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
322 #define MKTAG(a,b,c,d) (a | (b << 8) | (c << 16) | (d << 24)) |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
323 #define MKBETAG(a,b,c,d) (d | (c << 8) | (b << 16) | (a << 24)) |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
324 |
130 | 325 #define GET_UTF8(val, GET_BYTE, ERROR)\ |
326 val= GET_BYTE;\ | |
327 {\ | |
328 int ones= 7 - av_log2(val ^ 255);\ | |
329 if(ones==1)\ | |
330 ERROR\ | |
331 val&= 127>>ones;\ | |
332 while(--ones > 0){\ | |
333 int tmp= GET_BYTE - 128;\ | |
334 if(tmp>>6)\ | |
335 ERROR\ | |
336 val= (val<<6) + tmp;\ | |
337 }\ | |
338 } | |
339 | |
129
ccae53673692
Fix ASF format parser's broken UTF-16 string handling
gpoirier
parents:
127
diff
changeset
|
340 /*! |
131 | 341 * \def PUT_UTF8(val, tmp, PUT_BYTE) |
129
ccae53673692
Fix ASF format parser's broken UTF-16 string handling
gpoirier
parents:
127
diff
changeset
|
342 * converts a 32-bit unicode character to its utf-8 encoded form (up to 6 bytes long). |
ccae53673692
Fix ASF format parser's broken UTF-16 string handling
gpoirier
parents:
127
diff
changeset
|
343 * \param val is an input only argument and should be of type uint32_t. It holds |
ccae53673692
Fix ASF format parser's broken UTF-16 string handling
gpoirier
parents:
127
diff
changeset
|
344 * a ucs4 encoded unicode character that is to be converted to utf-8. If |
ccae53673692
Fix ASF format parser's broken UTF-16 string handling
gpoirier
parents:
127
diff
changeset
|
345 * val is given as a function it's executed only once. |
ccae53673692
Fix ASF format parser's broken UTF-16 string handling
gpoirier
parents:
127
diff
changeset
|
346 * \param tmp is a temporary variable and should be of type uint8_t. It |
ccae53673692
Fix ASF format parser's broken UTF-16 string handling
gpoirier
parents:
127
diff
changeset
|
347 * represents an intermediate value during conversion that is to be |
ccae53673692
Fix ASF format parser's broken UTF-16 string handling
gpoirier
parents:
127
diff
changeset
|
348 * outputted by PUT_BYTE. |
ccae53673692
Fix ASF format parser's broken UTF-16 string handling
gpoirier
parents:
127
diff
changeset
|
349 * \param PUT_BYTE writes the converted utf-8 bytes to any proper destination. |
ccae53673692
Fix ASF format parser's broken UTF-16 string handling
gpoirier
parents:
127
diff
changeset
|
350 * It could be a function or a statement, and uses tmp as the input byte. |
ccae53673692
Fix ASF format parser's broken UTF-16 string handling
gpoirier
parents:
127
diff
changeset
|
351 * For example, PUT_BYTE could be "*output++ = tmp;" PUT_BYTE will be |
ccae53673692
Fix ASF format parser's broken UTF-16 string handling
gpoirier
parents:
127
diff
changeset
|
352 * executed up to 6 times, depending on the length of the converted |
ccae53673692
Fix ASF format parser's broken UTF-16 string handling
gpoirier
parents:
127
diff
changeset
|
353 * unicode character. |
ccae53673692
Fix ASF format parser's broken UTF-16 string handling
gpoirier
parents:
127
diff
changeset
|
354 */ |
ccae53673692
Fix ASF format parser's broken UTF-16 string handling
gpoirier
parents:
127
diff
changeset
|
355 #define PUT_UTF8(val, tmp, PUT_BYTE)\ |
ccae53673692
Fix ASF format parser's broken UTF-16 string handling
gpoirier
parents:
127
diff
changeset
|
356 {\ |
ccae53673692
Fix ASF format parser's broken UTF-16 string handling
gpoirier
parents:
127
diff
changeset
|
357 int bytes, shift;\ |
ccae53673692
Fix ASF format parser's broken UTF-16 string handling
gpoirier
parents:
127
diff
changeset
|
358 uint32_t in = val;\ |
ccae53673692
Fix ASF format parser's broken UTF-16 string handling
gpoirier
parents:
127
diff
changeset
|
359 if (in < 0x80) {\ |
ccae53673692
Fix ASF format parser's broken UTF-16 string handling
gpoirier
parents:
127
diff
changeset
|
360 tmp = in;\ |
ccae53673692
Fix ASF format parser's broken UTF-16 string handling
gpoirier
parents:
127
diff
changeset
|
361 PUT_BYTE\ |
ccae53673692
Fix ASF format parser's broken UTF-16 string handling
gpoirier
parents:
127
diff
changeset
|
362 } else {\ |
ccae53673692
Fix ASF format parser's broken UTF-16 string handling
gpoirier
parents:
127
diff
changeset
|
363 bytes = (av_log2(in) + 4) / 5;\ |
ccae53673692
Fix ASF format parser's broken UTF-16 string handling
gpoirier
parents:
127
diff
changeset
|
364 shift = (bytes - 1) * 6;\ |
ccae53673692
Fix ASF format parser's broken UTF-16 string handling
gpoirier
parents:
127
diff
changeset
|
365 tmp = (256 - (256 >> bytes)) | (in >> shift);\ |
ccae53673692
Fix ASF format parser's broken UTF-16 string handling
gpoirier
parents:
127
diff
changeset
|
366 PUT_BYTE\ |
ccae53673692
Fix ASF format parser's broken UTF-16 string handling
gpoirier
parents:
127
diff
changeset
|
367 while (shift >= 6) {\ |
ccae53673692
Fix ASF format parser's broken UTF-16 string handling
gpoirier
parents:
127
diff
changeset
|
368 shift -= 6;\ |
ccae53673692
Fix ASF format parser's broken UTF-16 string handling
gpoirier
parents:
127
diff
changeset
|
369 tmp = 0x80 | ((in >> shift) & 0x3f);\ |
ccae53673692
Fix ASF format parser's broken UTF-16 string handling
gpoirier
parents:
127
diff
changeset
|
370 PUT_BYTE\ |
ccae53673692
Fix ASF format parser's broken UTF-16 string handling
gpoirier
parents:
127
diff
changeset
|
371 }\ |
ccae53673692
Fix ASF format parser's broken UTF-16 string handling
gpoirier
parents:
127
diff
changeset
|
372 }\ |
ccae53673692
Fix ASF format parser's broken UTF-16 string handling
gpoirier
parents:
127
diff
changeset
|
373 } |
ccae53673692
Fix ASF format parser's broken UTF-16 string handling
gpoirier
parents:
127
diff
changeset
|
374 |
125 | 375 #if defined(ARCH_X86) || defined(ARCH_POWERPC) |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
376 #if defined(ARCH_X86_64) |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
377 static inline uint64_t read_time(void) |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
378 { |
13 | 379 uint64_t a, d; |
380 asm volatile( "rdtsc\n\t" | |
381 : "=a" (a), "=d" (d) | |
382 ); | |
383 return (d << 32) | (a & 0xffffffff); | |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
384 } |
124
bd1ecfd747bc
Add ARCH_X86_32 as a new define for 32 bit x86 architectures and change
diego
parents:
121
diff
changeset
|
385 #elif defined(ARCH_X86_32) |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
386 static inline long long read_time(void) |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
387 { |
13 | 388 long long l; |
389 asm volatile( "rdtsc\n\t" | |
390 : "=A" (l) | |
391 ); | |
392 return l; | |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
393 } |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
394 #else //FIXME check ppc64 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
395 static inline uint64_t read_time(void) |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
396 { |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
397 uint32_t tbu, tbl, temp; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
398 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
399 /* from section 2.2.1 of the 32-bit PowerPC PEM */ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
400 __asm__ __volatile__( |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
401 "1:\n" |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
402 "mftbu %2\n" |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
403 "mftb %0\n" |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
404 "mftbu %1\n" |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
405 "cmpw %2,%1\n" |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
406 "bne 1b\n" |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
407 : "=r"(tbl), "=r"(tbu), "=r"(temp) |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
408 : |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
409 : "cc"); |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
410 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
411 return (((uint64_t)tbu)<<32) | (uint64_t)tbl; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
412 } |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
413 #endif |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
414 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
415 #define START_TIMER \ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
416 uint64_t tend;\ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
417 uint64_t tstart= read_time();\ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
418 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
419 #define STOP_TIMER(id) \ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
420 tend= read_time();\ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
421 {\ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
422 static uint64_t tsum=0;\ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
423 static int tcount=0;\ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
424 static int tskip_count=0;\ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
425 if(tcount<2 || tend - tstart < 8*tsum/tcount){\ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
426 tsum+= tend - tstart;\ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
427 tcount++;\ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
428 }else\ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
429 tskip_count++;\ |
112 | 430 if(((tcount+tskip_count)&(tcount+tskip_count-1))==0){\ |
7 | 431 av_log(NULL, AV_LOG_DEBUG, "%"PRIu64" dezicycles in %s, %d runs, %d skips\n", tsum*10/tcount, id, tcount, tskip_count);\ |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
432 }\ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
433 } |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
434 #else |
12 | 435 #define START_TIMER |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
436 #define STOP_TIMER(id) {} |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
437 #endif |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
438 |
82
8fb151c4d4c7
Move av_malloc(), av_realloc(), and av_free() from libavcodec to libavutil
lucabe
parents:
80
diff
changeset
|
439 /* memory */ |
104
5111e87117b7
Align the input buffer in ffplay, introduce a public macro for aligned declarations
lu_zero
parents:
100
diff
changeset
|
440 |
5111e87117b7
Align the input buffer in ffplay, introduce a public macro for aligned declarations
lu_zero
parents:
100
diff
changeset
|
441 #ifdef __GNUC__ |
5111e87117b7
Align the input buffer in ffplay, introduce a public macro for aligned declarations
lu_zero
parents:
100
diff
changeset
|
442 #define DECLARE_ALIGNED(n,t,v) t v __attribute__ ((aligned (n))) |
5111e87117b7
Align the input buffer in ffplay, introduce a public macro for aligned declarations
lu_zero
parents:
100
diff
changeset
|
443 #else |
5111e87117b7
Align the input buffer in ffplay, introduce a public macro for aligned declarations
lu_zero
parents:
100
diff
changeset
|
444 #define DECLARE_ALIGNED(n,t,v) __declspec(align(n)) t v |
5111e87117b7
Align the input buffer in ffplay, introduce a public macro for aligned declarations
lu_zero
parents:
100
diff
changeset
|
445 #endif |
5111e87117b7
Align the input buffer in ffplay, introduce a public macro for aligned declarations
lu_zero
parents:
100
diff
changeset
|
446 |
113 | 447 /* memory */ |
82
8fb151c4d4c7
Move av_malloc(), av_realloc(), and av_free() from libavcodec to libavutil
lucabe
parents:
80
diff
changeset
|
448 void *av_malloc(unsigned int size); |
8fb151c4d4c7
Move av_malloc(), av_realloc(), and av_free() from libavcodec to libavutil
lucabe
parents:
80
diff
changeset
|
449 void *av_realloc(void *ptr, unsigned int size); |
8fb151c4d4c7
Move av_malloc(), av_realloc(), and av_free() from libavcodec to libavutil
lucabe
parents:
80
diff
changeset
|
450 void av_free(void *ptr); |
8fb151c4d4c7
Move av_malloc(), av_realloc(), and av_free() from libavcodec to libavutil
lucabe
parents:
80
diff
changeset
|
451 |
113 | 452 void *av_mallocz(unsigned int size); |
453 char *av_strdup(const char *s); | |
454 void av_freep(void *ptr); | |
455 | |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
456 #endif /* COMMON_H */ |