Mercurial > libavutil.hg
annotate common.h @ 121:69714d5e1561 libavutil
Protect code that uses CMOV instructions with HAVE_CMOV,
Make configure set CMOV_IS_FAST on arches on which cmov has a low latency
(typically non-Netburst based processor)
author | gpoirier |
---|---|
date | Fri, 20 Oct 2006 17:53:19 +0000 |
parents | f42a6347df1d |
children | bd1ecfd747bc |
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 |
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
|
112 #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
|
113 #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
|
114 #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
|
115 |
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 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
|
117 #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
|
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 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
|
121 #define PRIdFAST32 PRId32 |
8
2dd915c714fa
fix for systems not defining PRIu64, not everyone knows C99.
mmu_man
parents:
7
diff
changeset
|
122 #endif |
2dd915c714fa
fix for systems not defining PRIu64, not everyone knows C99.
mmu_man
parents:
7
diff
changeset
|
123 |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
124 #ifndef INT16_MIN |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
125 #define INT16_MIN (-0x7fff-1) |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
126 #endif |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
127 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
128 #ifndef INT16_MAX |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
129 #define INT16_MAX 0x7fff |
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 |
33 | 132 #ifndef INT32_MIN |
133 #define INT32_MIN (-0x7fffffff-1) | |
134 #endif | |
135 | |
136 #ifndef INT32_MAX | |
137 #define INT32_MAX 0x7fffffff | |
138 #endif | |
139 | |
140 #ifndef UINT32_MAX | |
141 #define UINT32_MAX 0xffffffff | |
142 #endif | |
143 | |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
144 #ifndef INT64_MIN |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
145 #define INT64_MIN (-0x7fffffffffffffffLL-1) |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
146 #endif |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
147 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
148 #ifndef INT64_MAX |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
149 #define INT64_MAX int64_t_C(9223372036854775807) |
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 UINT64_MAX |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
153 #define UINT64_MAX uint64_t_C(0xFFFFFFFFFFFFFFFF) |
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 #ifdef EMULATE_FAST_INT |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
157 typedef signed char int_fast8_t; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
158 typedef signed int int_fast16_t; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
159 typedef signed int int_fast32_t; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
160 typedef unsigned char uint_fast8_t; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
161 typedef unsigned int uint_fast16_t; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
162 typedef unsigned int uint_fast32_t; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
163 typedef uint64_t uint_fast64_t; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
164 #endif |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
165 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
166 #ifndef INT_BIT |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
167 # if INT_MAX != 2147483647 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
168 # define INT_BIT 64 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
169 # else |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
170 # define INT_BIT 32 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
171 # endif |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
172 #endif |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
173 |
74 | 174 #ifndef int64_t_C |
175 #define int64_t_C(c) (c ## LL) | |
176 #define uint64_t_C(c) (c ## ULL) | |
177 #endif | |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
178 |
22
3b56407b3f96
On MinGW it is not possible to build shared and static libraries at once.
diego
parents:
19
diff
changeset
|
179 #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
|
180 # 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
|
181 #else |
3b56407b3f96
On MinGW it is not possible to build shared and static libraries at once.
diego
parents:
19
diff
changeset
|
182 # define FF_IMPORT_ATTR |
3b56407b3f96
On MinGW it is not possible to build shared and static libraries at once.
diego
parents:
19
diff
changeset
|
183 #endif |
3b56407b3f96
On MinGW it is not possible to build shared and static libraries at once.
diego
parents:
19
diff
changeset
|
184 |
3b56407b3f96
On MinGW it is not possible to build shared and static libraries at once.
diego
parents:
19
diff
changeset
|
185 |
80
624fc3ad183a
Split common.h in two parts, purely internal stuff (internal.h) and things
reimar
parents:
75
diff
changeset
|
186 #ifdef HAVE_AV_CONFIG_H |
624fc3ad183a
Split common.h in two parts, purely internal stuff (internal.h) and things
reimar
parents:
75
diff
changeset
|
187 /* 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
|
188 # include "internal.h" |
624fc3ad183a
Split common.h in two parts, purely internal stuff (internal.h) and things
reimar
parents:
75
diff
changeset
|
189 #endif |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
190 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
191 //rounded divison & shift |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
192 #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
|
193 /* assume b>0 */ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
194 #define ROUNDED_DIV(a,b) (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b)) |
120 | 195 #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
|
196 #define FFSIGN(a) ((a) > 0 ? 1 : -1) |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
197 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
198 #define FFMAX(a,b) ((a) > (b) ? (a) : (b)) |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
199 #define FFMIN(a,b) ((a) > (b) ? (b) : (a)) |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
200 |
99 | 201 #define SWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0) |
202 | |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
203 /* misc math functions */ |
22
3b56407b3f96
On MinGW it is not possible to build shared and static libraries at once.
diego
parents:
19
diff
changeset
|
204 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
|
205 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
206 static inline int av_log2(unsigned int v) |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
207 { |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
208 int n; |
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 n = 0; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
211 if (v & 0xffff0000) { |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
212 v >>= 16; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
213 n += 16; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
214 } |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
215 if (v & 0xff00) { |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
216 v >>= 8; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
217 n += 8; |
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 n += ff_log2_tab[v]; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
220 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
221 return n; |
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 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
224 static inline int av_log2_16bit(unsigned int v) |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
225 { |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
226 int n; |
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 n = 0; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
229 if (v & 0xff00) { |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
230 v >>= 8; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
231 n += 8; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
232 } |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
233 n += ff_log2_tab[v]; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
234 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
235 return n; |
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 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
238 /* median of 3 */ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
239 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
|
240 { |
121
69714d5e1561
Protect code that uses CMOV instructions with HAVE_CMOV,
gpoirier
parents:
120
diff
changeset
|
241 #if HAVE_CMOV |
111 | 242 int i=b; |
109 | 243 asm volatile( |
111 | 244 "cmp %2, %1 \n\t" |
245 "cmovg %1, %0 \n\t" | |
246 "cmovg %2, %1 \n\t" | |
247 "cmp %3, %1 \n\t" | |
109 | 248 "cmovl %3, %1 \n\t" |
111 | 249 "cmp %1, %0 \n\t" |
250 "cmovg %1, %0 \n\t" | |
251 :"+&r"(i), "+&r"(a) | |
252 :"r"(b), "r"(c) | |
109 | 253 ); |
254 return i; | |
255 #elif 0 | |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
256 int t= (a-b)&((a-b)>>31); |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
257 a-=t; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
258 b+=t; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
259 b-= (b-c)&((b-c)>>31); |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
260 b+= (a-b)&((a-b)>>31); |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
261 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
262 return b; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
263 #else |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
264 if(a>b){ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
265 if(c>b){ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
266 if(c>a) b=a; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
267 else b=c; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
268 } |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
269 }else{ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
270 if(b>c){ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
271 if(c>a) b=c; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
272 else b=a; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
273 } |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
274 } |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
275 return b; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
276 #endif |
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 |
39 | 279 /** |
280 * clip a signed integer value into the amin-amax range | |
281 * @param a value to clip | |
282 * @param amin minimum value of the clip range | |
283 * @param amax maximum value of the clip range | |
284 * @return cliped value | |
285 */ | |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
286 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
|
287 { |
63 | 288 if (a < amin) return amin; |
289 else if (a > amax) return amax; | |
290 else return a; | |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
291 } |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
292 |
39 | 293 /** |
294 * clip a signed integer value into the 0-255 range | |
295 * @param a value to clip | |
296 * @return cliped value | |
297 */ | |
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
|
298 static inline uint8_t clip_uint8(int a) |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
299 { |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
300 if (a&(~255)) return (-a)>>31; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
301 else return a; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
302 } |
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 /* math */ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
305 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
|
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 * converts fourcc string to int |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
309 */ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
310 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
|
311 #ifdef HAVE_AV_CONFIG_H |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
312 assert( strlen(s)==4 ); |
80
624fc3ad183a
Split common.h in two parts, purely internal stuff (internal.h) and things
reimar
parents:
75
diff
changeset
|
313 #endif |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
314 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
315 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
|
316 } |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
317 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
318 #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
|
319 #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
|
320 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
321 |
60 | 322 #define GET_UTF8(val, GET_BYTE, ERROR)\ |
323 val= GET_BYTE;\ | |
324 {\ | |
325 int ones= 7 - av_log2(val ^ 255);\ | |
326 if(ones==1)\ | |
327 ERROR\ | |
328 val&= 127>>ones;\ | |
329 while(--ones > 0){\ | |
330 int tmp= GET_BYTE - 128;\ | |
331 if(tmp>>6)\ | |
332 ERROR\ | |
333 val= (val<<6) + tmp;\ | |
334 }\ | |
335 } | |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
336 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
337 #if defined(ARCH_X86) || defined(ARCH_X86_64) || defined(ARCH_POWERPC) |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
338 #if defined(ARCH_X86_64) |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
339 static inline uint64_t read_time(void) |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
340 { |
13 | 341 uint64_t a, d; |
342 asm volatile( "rdtsc\n\t" | |
343 : "=a" (a), "=d" (d) | |
344 ); | |
345 return (d << 32) | (a & 0xffffffff); | |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
346 } |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
347 #elif defined(ARCH_X86) |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
348 static inline long long read_time(void) |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
349 { |
13 | 350 long long l; |
351 asm volatile( "rdtsc\n\t" | |
352 : "=A" (l) | |
353 ); | |
354 return l; | |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
355 } |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
356 #else //FIXME check ppc64 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
357 static inline uint64_t read_time(void) |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
358 { |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
359 uint32_t tbu, tbl, temp; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
360 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
361 /* 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
|
362 __asm__ __volatile__( |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
363 "1:\n" |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
364 "mftbu %2\n" |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
365 "mftb %0\n" |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
366 "mftbu %1\n" |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
367 "cmpw %2,%1\n" |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
368 "bne 1b\n" |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
369 : "=r"(tbl), "=r"(tbu), "=r"(temp) |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
370 : |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
371 : "cc"); |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
372 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
373 return (((uint64_t)tbu)<<32) | (uint64_t)tbl; |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
374 } |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
375 #endif |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
376 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
377 #define START_TIMER \ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
378 uint64_t tend;\ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
379 uint64_t tstart= read_time();\ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
380 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
381 #define STOP_TIMER(id) \ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
382 tend= read_time();\ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
383 {\ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
384 static uint64_t tsum=0;\ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
385 static int tcount=0;\ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
386 static int tskip_count=0;\ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
387 if(tcount<2 || tend - tstart < 8*tsum/tcount){\ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
388 tsum+= tend - tstart;\ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
389 tcount++;\ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
390 }else\ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
391 tskip_count++;\ |
112 | 392 if(((tcount+tskip_count)&(tcount+tskip_count-1))==0){\ |
7 | 393 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
|
394 }\ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
395 } |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
396 #else |
12 | 397 #define START_TIMER |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
398 #define STOP_TIMER(id) {} |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
399 #endif |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
400 |
82
8fb151c4d4c7
Move av_malloc(), av_realloc(), and av_free() from libavcodec to libavutil
lucabe
parents:
80
diff
changeset
|
401 /* memory */ |
104
5111e87117b7
Align the input buffer in ffplay, introduce a public macro for aligned declarations
lu_zero
parents:
100
diff
changeset
|
402 |
5111e87117b7
Align the input buffer in ffplay, introduce a public macro for aligned declarations
lu_zero
parents:
100
diff
changeset
|
403 #ifdef __GNUC__ |
5111e87117b7
Align the input buffer in ffplay, introduce a public macro for aligned declarations
lu_zero
parents:
100
diff
changeset
|
404 #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
|
405 #else |
5111e87117b7
Align the input buffer in ffplay, introduce a public macro for aligned declarations
lu_zero
parents:
100
diff
changeset
|
406 #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
|
407 #endif |
5111e87117b7
Align the input buffer in ffplay, introduce a public macro for aligned declarations
lu_zero
parents:
100
diff
changeset
|
408 |
113 | 409 /* memory */ |
82
8fb151c4d4c7
Move av_malloc(), av_realloc(), and av_free() from libavcodec to libavutil
lucabe
parents:
80
diff
changeset
|
410 void *av_malloc(unsigned int size); |
8fb151c4d4c7
Move av_malloc(), av_realloc(), and av_free() from libavcodec to libavutil
lucabe
parents:
80
diff
changeset
|
411 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
|
412 void av_free(void *ptr); |
8fb151c4d4c7
Move av_malloc(), av_realloc(), and av_free() from libavcodec to libavutil
lucabe
parents:
80
diff
changeset
|
413 |
113 | 414 void *av_mallocz(unsigned int size); |
415 char *av_strdup(const char *s); | |
416 void av_freep(void *ptr); | |
417 | |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
418 #endif /* COMMON_H */ |