Mercurial > libavcodec.hg
annotate common.h @ 2482:5d28ea40fd98 libavcodec
Documentation patch by anonymous
author | michael |
---|---|
date | Tue, 01 Feb 2005 09:51:49 +0000 |
parents | 35ca0ef0c279 |
children | e25782262d7d |
rev | line source |
---|---|
1106 | 1 /** |
2 * @file common.h | |
3 * common internal api header. | |
4 */ | |
5 | |
0 | 6 #ifndef COMMON_H |
7 #define COMMON_H | |
8 | |
213
e80ad397d30e
Cygwin's mangling by Felix Buenemann <atmosfear@users.sourceforge.net>
nickols_k
parents:
199
diff
changeset
|
9 #if defined(WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__) |
708
1aa1cbb8c3c1
indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents:
706
diff
changeset
|
10 # define CONFIG_WIN32 |
64 | 11 #endif |
12 | |
1758
d49aae2f9027
freebsd fix for mpeg12.c (moving INT64_MAX to common.h)
alex
parents:
1756
diff
changeset
|
13 #ifndef M_PI |
d49aae2f9027
freebsd fix for mpeg12.c (moving INT64_MAX to common.h)
alex
parents:
1756
diff
changeset
|
14 #define M_PI 3.14159265358979323846 |
d49aae2f9027
freebsd fix for mpeg12.c (moving INT64_MAX to common.h)
alex
parents:
1756
diff
changeset
|
15 #endif |
d49aae2f9027
freebsd fix for mpeg12.c (moving INT64_MAX to common.h)
alex
parents:
1756
diff
changeset
|
16 |
10 | 17 #ifdef HAVE_AV_CONFIG_H |
64 | 18 /* only include the following when compiling package */ |
708
1aa1cbb8c3c1
indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents:
706
diff
changeset
|
19 # include "config.h" |
64 | 20 |
708
1aa1cbb8c3c1
indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents:
706
diff
changeset
|
21 # include <stdlib.h> |
1aa1cbb8c3c1
indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents:
706
diff
changeset
|
22 # include <stdio.h> |
1aa1cbb8c3c1
indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents:
706
diff
changeset
|
23 # include <string.h> |
1444 | 24 # include <ctype.h> |
2112 | 25 # include <limits.h> |
708
1aa1cbb8c3c1
indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents:
706
diff
changeset
|
26 # ifndef __BEOS__ |
1aa1cbb8c3c1
indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents:
706
diff
changeset
|
27 # include <errno.h> |
1aa1cbb8c3c1
indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents:
706
diff
changeset
|
28 # else |
1aa1cbb8c3c1
indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents:
706
diff
changeset
|
29 # include "berrno.h" |
1aa1cbb8c3c1
indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents:
706
diff
changeset
|
30 # endif |
1aa1cbb8c3c1
indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents:
706
diff
changeset
|
31 # include <math.h> |
64 | 32 |
708
1aa1cbb8c3c1
indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents:
706
diff
changeset
|
33 # ifndef ENODATA |
1aa1cbb8c3c1
indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents:
706
diff
changeset
|
34 # define ENODATA 61 |
1aa1cbb8c3c1
indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents:
706
diff
changeset
|
35 # endif |
0 | 36 |
1059 | 37 #include <stddef.h> |
38 #ifndef offsetof | |
39 # define offsetof(T,F) ((unsigned int)((char *)&((T *)0)->F)) | |
40 #endif | |
41 | |
42 #define AVOPTION_CODEC_BOOL(name, help, field) \ | |
43 { name, help, offsetof(AVCodecContext, field), FF_OPT_TYPE_BOOL } | |
1130 | 44 #define AVOPTION_CODEC_DOUBLE(name, help, field, minv, maxv, defval) \ |
45 { name, help, offsetof(AVCodecContext, field), FF_OPT_TYPE_DOUBLE, minv, maxv, defval } | |
1059 | 46 #define AVOPTION_CODEC_FLAG(name, help, field, flag, defval) \ |
47 { name, help, offsetof(AVCodecContext, field), FF_OPT_TYPE_FLAG, flag, 0, defval } | |
48 #define AVOPTION_CODEC_INT(name, help, field, minv, maxv, defval) \ | |
49 { name, help, offsetof(AVCodecContext, field), FF_OPT_TYPE_INT, minv, maxv, defval } | |
50 #define AVOPTION_CODEC_STRING(name, help, field, str, val) \ | |
51 { name, help, offsetof(AVCodecContext, field), FF_OPT_TYPE_STRING, .defval = val, .defstr = str } | |
52 #define AVOPTION_CODEC_RCOVERRIDE(name, help, field) \ | |
53 { name, help, offsetof(AVCodecContext, field), FF_OPT_TYPE_RCOVERRIDE, .defval = 0, .defstr = NULL } | |
1114 | 54 #define AVOPTION_SUB(ptr) { .name = NULL, .help = (const char*)ptr } |
1059 | 55 #define AVOPTION_END() AVOPTION_SUB(NULL) |
56 | |
1124
64c7c76ed17c
* 'externaly' visible option list begins avoptions_ prefix
kabi
parents:
1118
diff
changeset
|
57 struct AVOption; |
64c7c76ed17c
* 'externaly' visible option list begins avoptions_ prefix
kabi
parents:
1118
diff
changeset
|
58 #ifdef HAVE_MMX |
64c7c76ed17c
* 'externaly' visible option list begins avoptions_ prefix
kabi
parents:
1118
diff
changeset
|
59 extern const struct AVOption avoptions_common[3 + 5]; |
64c7c76ed17c
* 'externaly' visible option list begins avoptions_ prefix
kabi
parents:
1118
diff
changeset
|
60 #else |
64c7c76ed17c
* 'externaly' visible option list begins avoptions_ prefix
kabi
parents:
1118
diff
changeset
|
61 extern const struct AVOption avoptions_common[3]; |
64c7c76ed17c
* 'externaly' visible option list begins avoptions_ prefix
kabi
parents:
1118
diff
changeset
|
62 #endif |
64c7c76ed17c
* 'externaly' visible option list begins avoptions_ prefix
kabi
parents:
1118
diff
changeset
|
63 extern const struct AVOption avoptions_workaround_bug[11]; |
64c7c76ed17c
* 'externaly' visible option list begins avoptions_ prefix
kabi
parents:
1118
diff
changeset
|
64 |
390
48e08d9871da
added proper memory handling functions - fixed include paths
glantau
parents:
370
diff
changeset
|
65 #endif /* HAVE_AV_CONFIG_H */ |
64 | 66 |
517 | 67 /* Suppress restrict if it was not defined in config.h. */ |
68 #ifndef restrict | |
708
1aa1cbb8c3c1
indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents:
706
diff
changeset
|
69 # define restrict |
517 | 70 #endif |
71 | |
1982 | 72 #ifndef always_inline |
550 | 73 #if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ > 0) |
708
1aa1cbb8c3c1
indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents:
706
diff
changeset
|
74 # define always_inline __attribute__((always_inline)) inline |
550 | 75 #else |
708
1aa1cbb8c3c1
indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents:
706
diff
changeset
|
76 # define always_inline inline |
550 | 77 #endif |
1982 | 78 #endif |
550 | 79 |
1982 | 80 #ifndef attribute_used |
1845
3054613980a8
attribute used patch by (mitya at school dot ioffe dot ru (Dmitry Baryshkov))
michael
parents:
1840
diff
changeset
|
81 #if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ > 0) |
3054613980a8
attribute used patch by (mitya at school dot ioffe dot ru (Dmitry Baryshkov))
michael
parents:
1840
diff
changeset
|
82 # define attribute_used __attribute__((used)) |
3054613980a8
attribute used patch by (mitya at school dot ioffe dot ru (Dmitry Baryshkov))
michael
parents:
1840
diff
changeset
|
83 #else |
3054613980a8
attribute used patch by (mitya at school dot ioffe dot ru (Dmitry Baryshkov))
michael
parents:
1840
diff
changeset
|
84 # define attribute_used |
3054613980a8
attribute used patch by (mitya at school dot ioffe dot ru (Dmitry Baryshkov))
michael
parents:
1840
diff
changeset
|
85 #endif |
1982 | 86 #endif |
1845
3054613980a8
attribute used patch by (mitya at school dot ioffe dot ru (Dmitry Baryshkov))
michael
parents:
1840
diff
changeset
|
87 |
1738
378e98870df4
more sane inttypes emulation behavior if libavcodec is used outside ffmpeg
michael
parents:
1735
diff
changeset
|
88 #ifndef EMULATE_INTTYPES |
1735
cb0abe523bc6
inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents:
1660
diff
changeset
|
89 # include <inttypes.h> |
cb0abe523bc6
inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents:
1660
diff
changeset
|
90 #else |
cb0abe523bc6
inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents:
1660
diff
changeset
|
91 typedef signed char int8_t; |
cb0abe523bc6
inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents:
1660
diff
changeset
|
92 typedef signed short int16_t; |
cb0abe523bc6
inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents:
1660
diff
changeset
|
93 typedef signed int int32_t; |
cb0abe523bc6
inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents:
1660
diff
changeset
|
94 typedef unsigned char uint8_t; |
cb0abe523bc6
inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents:
1660
diff
changeset
|
95 typedef unsigned short uint16_t; |
cb0abe523bc6
inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents:
1660
diff
changeset
|
96 typedef unsigned int uint32_t; |
cb0abe523bc6
inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents:
1660
diff
changeset
|
97 |
cb0abe523bc6
inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents:
1660
diff
changeset
|
98 # ifdef CONFIG_WIN32 |
cb0abe523bc6
inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents:
1660
diff
changeset
|
99 typedef signed __int64 int64_t; |
cb0abe523bc6
inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents:
1660
diff
changeset
|
100 typedef unsigned __int64 uint64_t; |
cb0abe523bc6
inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents:
1660
diff
changeset
|
101 # else /* other OS */ |
cb0abe523bc6
inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents:
1660
diff
changeset
|
102 typedef signed long long int64_t; |
cb0abe523bc6
inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents:
1660
diff
changeset
|
103 typedef unsigned long long uint64_t; |
cb0abe523bc6
inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents:
1660
diff
changeset
|
104 # endif /* other OS */ |
cb0abe523bc6
inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents:
1660
diff
changeset
|
105 #endif /* HAVE_INTTYPES_H */ |
cb0abe523bc6
inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents:
1660
diff
changeset
|
106 |
2318
1925d732ea42
INT MIN/MAX patch by (Bohdan Horst <nexus at irc dot pl>)
michael
parents:
2293
diff
changeset
|
107 #ifndef INT16_MIN |
1925d732ea42
INT MIN/MAX patch by (Bohdan Horst <nexus at irc dot pl>)
michael
parents:
2293
diff
changeset
|
108 #define INT16_MIN (-0x7fff-1) |
1925d732ea42
INT MIN/MAX patch by (Bohdan Horst <nexus at irc dot pl>)
michael
parents:
2293
diff
changeset
|
109 #endif |
1925d732ea42
INT MIN/MAX patch by (Bohdan Horst <nexus at irc dot pl>)
michael
parents:
2293
diff
changeset
|
110 |
1925d732ea42
INT MIN/MAX patch by (Bohdan Horst <nexus at irc dot pl>)
michael
parents:
2293
diff
changeset
|
111 #ifndef INT16_MAX |
1925d732ea42
INT MIN/MAX patch by (Bohdan Horst <nexus at irc dot pl>)
michael
parents:
2293
diff
changeset
|
112 #define INT16_MAX 0x7fff |
1925d732ea42
INT MIN/MAX patch by (Bohdan Horst <nexus at irc dot pl>)
michael
parents:
2293
diff
changeset
|
113 #endif |
1925d732ea42
INT MIN/MAX patch by (Bohdan Horst <nexus at irc dot pl>)
michael
parents:
2293
diff
changeset
|
114 |
1925d732ea42
INT MIN/MAX patch by (Bohdan Horst <nexus at irc dot pl>)
michael
parents:
2293
diff
changeset
|
115 #ifndef INT64_MIN |
1925d732ea42
INT MIN/MAX patch by (Bohdan Horst <nexus at irc dot pl>)
michael
parents:
2293
diff
changeset
|
116 #define INT64_MIN (-0x7fffffffffffffffLL-1) |
1925d732ea42
INT MIN/MAX patch by (Bohdan Horst <nexus at irc dot pl>)
michael
parents:
2293
diff
changeset
|
117 #endif |
1925d732ea42
INT MIN/MAX patch by (Bohdan Horst <nexus at irc dot pl>)
michael
parents:
2293
diff
changeset
|
118 |
1761
3620e301643a
int64max fix by (Michel Bardiaux <mbardiaux at peaktime dot be>)
michael
parents:
1758
diff
changeset
|
119 #ifndef INT64_MAX |
1840
0287241a0c18
int64_t_C patch by (Gael Chardon <gael-announcements+ffmpeg at 4now dot net>)
michael
parents:
1824
diff
changeset
|
120 #define INT64_MAX int64_t_C(9223372036854775807) |
1761
3620e301643a
int64max fix by (Michel Bardiaux <mbardiaux at peaktime dot be>)
michael
parents:
1758
diff
changeset
|
121 #endif |
3620e301643a
int64max fix by (Michel Bardiaux <mbardiaux at peaktime dot be>)
michael
parents:
1758
diff
changeset
|
122 |
2016 | 123 #ifndef UINT64_MAX |
124 #define UINT64_MAX uint64_t_C(0xFFFFFFFFFFFFFFFF) | |
125 #endif | |
126 | |
1603
3a633a3feef6
* fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents:
1598
diff
changeset
|
127 #ifdef EMULATE_FAST_INT |
3a633a3feef6
* fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents:
1598
diff
changeset
|
128 /* note that we don't emulate 64bit ints */ |
3a633a3feef6
* fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents:
1598
diff
changeset
|
129 typedef signed char int_fast8_t; |
3a633a3feef6
* fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents:
1598
diff
changeset
|
130 typedef signed int int_fast16_t; |
3a633a3feef6
* fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents:
1598
diff
changeset
|
131 typedef signed int int_fast32_t; |
3a633a3feef6
* fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents:
1598
diff
changeset
|
132 typedef unsigned char uint_fast8_t; |
3a633a3feef6
* fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents:
1598
diff
changeset
|
133 typedef unsigned int uint_fast16_t; |
3a633a3feef6
* fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents:
1598
diff
changeset
|
134 typedef unsigned int uint_fast32_t; |
3a633a3feef6
* fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents:
1598
diff
changeset
|
135 #endif |
3a633a3feef6
* fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents:
1598
diff
changeset
|
136 |
2093 | 137 #ifndef INT_BIT |
2112 | 138 # if INT_MAX != 2147483647 |
2093 | 139 # define INT_BIT 64 |
140 # else | |
141 # define INT_BIT 32 | |
142 # endif | |
143 #endif | |
144 | |
1603
3a633a3feef6
* fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents:
1598
diff
changeset
|
145 #if defined(CONFIG_OS2) || defined(CONFIG_SUNOS) |
3a633a3feef6
* fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents:
1598
diff
changeset
|
146 static inline float floorf(float f) { |
3a633a3feef6
* fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents:
1598
diff
changeset
|
147 return floor(f); |
3a633a3feef6
* fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents:
1598
diff
changeset
|
148 } |
3a633a3feef6
* fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents:
1598
diff
changeset
|
149 #endif |
3a633a3feef6
* fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents:
1598
diff
changeset
|
150 |
64 | 151 #ifdef CONFIG_WIN32 |
152 | |
153 /* windows */ | |
154 | |
1961
603d4a0e974c
libavcodec Cygwin compilation failure (II) patch by (Sascha Sommer)
michael
parents:
1954
diff
changeset
|
155 # if !defined(__MINGW32__) && !defined(__CYGWIN__) |
1064 | 156 # define int64_t_C(c) (c ## i64) |
157 # define uint64_t_C(c) (c ## i64) | |
64 | 158 |
1509 | 159 # ifdef HAVE_AV_CONFIG_H |
160 # define inline __inline | |
161 # endif | |
64 | 162 |
708
1aa1cbb8c3c1
indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents:
706
diff
changeset
|
163 # else |
1064 | 164 # define int64_t_C(c) (c ## LL) |
165 # define uint64_t_C(c) (c ## ULL) | |
708
1aa1cbb8c3c1
indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents:
706
diff
changeset
|
166 # endif /* __MINGW32__ */ |
76 | 167 |
1509 | 168 # ifdef HAVE_AV_CONFIG_H |
169 # ifdef _DEBUG | |
170 # define DEBUG | |
171 # endif | |
172 | |
173 # define snprintf _snprintf | |
174 # define vsnprintf _vsnprintf | |
708
1aa1cbb8c3c1
indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents:
706
diff
changeset
|
175 # endif |
64 | 176 |
994
7701ff462e3a
os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents:
976
diff
changeset
|
177 /* CONFIG_WIN32 end */ |
7701ff462e3a
os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents:
976
diff
changeset
|
178 #elif defined (CONFIG_OS2) |
7701ff462e3a
os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents:
976
diff
changeset
|
179 /* OS/2 EMX */ |
7701ff462e3a
os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents:
976
diff
changeset
|
180 |
1064 | 181 #ifndef int64_t_C |
182 #define int64_t_C(c) (c ## LL) | |
183 #define uint64_t_C(c) (c ## ULL) | |
994
7701ff462e3a
os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents:
976
diff
changeset
|
184 #endif |
7701ff462e3a
os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents:
976
diff
changeset
|
185 |
1413 | 186 #ifdef HAVE_AV_CONFIG_H |
187 | |
994
7701ff462e3a
os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents:
976
diff
changeset
|
188 #ifdef USE_FASTMEMCPY |
7701ff462e3a
os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents:
976
diff
changeset
|
189 #include "fastmemcpy.h" |
7701ff462e3a
os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents:
976
diff
changeset
|
190 #endif |
7701ff462e3a
os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents:
976
diff
changeset
|
191 |
7701ff462e3a
os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents:
976
diff
changeset
|
192 #include <float.h> |
7701ff462e3a
os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents:
976
diff
changeset
|
193 |
7701ff462e3a
os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents:
976
diff
changeset
|
194 #endif /* HAVE_AV_CONFIG_H */ |
7701ff462e3a
os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents:
976
diff
changeset
|
195 |
7701ff462e3a
os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents:
976
diff
changeset
|
196 /* CONFIG_OS2 end */ |
7701ff462e3a
os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents:
976
diff
changeset
|
197 #else |
64 | 198 |
199 /* unix */ | |
200 | |
1413 | 201 #ifndef int64_t_C |
202 #define int64_t_C(c) (c ## LL) | |
203 #define uint64_t_C(c) (c ## ULL) | |
204 #endif | |
205 | |
206 #ifdef HAVE_AV_CONFIG_H | |
64 | 207 |
708
1aa1cbb8c3c1
indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents:
706
diff
changeset
|
208 # ifdef USE_FASTMEMCPY |
1aa1cbb8c3c1
indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents:
706
diff
changeset
|
209 # include "fastmemcpy.h" |
1aa1cbb8c3c1
indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents:
706
diff
changeset
|
210 # endif |
1aa1cbb8c3c1
indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents:
706
diff
changeset
|
211 # endif /* HAVE_AV_CONFIG_H */ |
76 | 212 |
994
7701ff462e3a
os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents:
976
diff
changeset
|
213 #endif /* !CONFIG_WIN32 && !CONFIG_OS2 */ |
76 | 214 |
488 | 215 #ifdef HAVE_AV_CONFIG_H |
192
1e5f64be86fc
another bitstream reader code (faster on intel cpus) - patch by Michael Niedermayer <michaelni@gmx.at>
uid46427
parents:
151
diff
changeset
|
216 |
708
1aa1cbb8c3c1
indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents:
706
diff
changeset
|
217 # include "bswap.h" |
426 | 218 |
2391
336a239ad9a4
fixes for PIC code on x86-64 patch by (Drew Hess <drew.hess gmail com>)
michael
parents:
2370
diff
changeset
|
219 // Use rip-relative addressing if compiling PIC code on x86-64. |
708
1aa1cbb8c3c1
indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents:
706
diff
changeset
|
220 # if defined(__MINGW32__) || defined(__CYGWIN__) || \ |
1226
dbc7e3c814a9
Tiny patch for OpenBSD by (Bj«Órn Sandell <biorn at dce dot chalmers dot se>)
michaelni
parents:
1177
diff
changeset
|
221 defined(__OS2__) || (defined (__OpenBSD__) && !defined(__ELF__)) |
2391
336a239ad9a4
fixes for PIC code on x86-64 patch by (Drew Hess <drew.hess gmail com>)
michael
parents:
2370
diff
changeset
|
222 # if defined(ARCH_X86_64) && defined(PIC) |
336a239ad9a4
fixes for PIC code on x86-64 patch by (Drew Hess <drew.hess gmail com>)
michael
parents:
2370
diff
changeset
|
223 # define MANGLE(a) "_" #a"(%%rip)" |
336a239ad9a4
fixes for PIC code on x86-64 patch by (Drew Hess <drew.hess gmail com>)
michael
parents:
2370
diff
changeset
|
224 # else |
336a239ad9a4
fixes for PIC code on x86-64 patch by (Drew Hess <drew.hess gmail com>)
michael
parents:
2370
diff
changeset
|
225 # define MANGLE(a) "_" #a |
336a239ad9a4
fixes for PIC code on x86-64 patch by (Drew Hess <drew.hess gmail com>)
michael
parents:
2370
diff
changeset
|
226 # endif |
708
1aa1cbb8c3c1
indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents:
706
diff
changeset
|
227 # else |
2391
336a239ad9a4
fixes for PIC code on x86-64 patch by (Drew Hess <drew.hess gmail com>)
michael
parents:
2370
diff
changeset
|
228 # if defined(ARCH_X86_64) && defined(PIC) |
336a239ad9a4
fixes for PIC code on x86-64 patch by (Drew Hess <drew.hess gmail com>)
michael
parents:
2370
diff
changeset
|
229 # define MANGLE(a) #a"(%%rip)" |
336a239ad9a4
fixes for PIC code on x86-64 patch by (Drew Hess <drew.hess gmail com>)
michael
parents:
2370
diff
changeset
|
230 # else |
336a239ad9a4
fixes for PIC code on x86-64 patch by (Drew Hess <drew.hess gmail com>)
michael
parents:
2370
diff
changeset
|
231 # define MANGLE(a) #a |
336a239ad9a4
fixes for PIC code on x86-64 patch by (Drew Hess <drew.hess gmail com>)
michael
parents:
2370
diff
changeset
|
232 # endif |
708
1aa1cbb8c3c1
indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents:
706
diff
changeset
|
233 # endif |
432 | 234 |
76 | 235 /* debug stuff */ |
236 | |
708
1aa1cbb8c3c1
indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents:
706
diff
changeset
|
237 # ifndef DEBUG |
1aa1cbb8c3c1
indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents:
706
diff
changeset
|
238 # define NDEBUG |
1aa1cbb8c3c1
indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents:
706
diff
changeset
|
239 # endif |
1aa1cbb8c3c1
indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents:
706
diff
changeset
|
240 # include <assert.h> |
64 | 241 |
76 | 242 /* dprintf macros */ |
1964
2b16a3c32318
cygwin patch by ("Sascha Sommer" <saschasommer at freenet dot de>)
michael
parents:
1961
diff
changeset
|
243 # if defined(CONFIG_WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__) |
76 | 244 |
245 inline void dprintf(const char* fmt,...) {} | |
246 | |
708
1aa1cbb8c3c1
indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents:
706
diff
changeset
|
247 # else |
76 | 248 |
708
1aa1cbb8c3c1
indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents:
706
diff
changeset
|
249 # ifdef DEBUG |
1940 | 250 # define dprintf(fmt,...) av_log(NULL, AV_LOG_DEBUG, fmt, __VA_ARGS__) |
708
1aa1cbb8c3c1
indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents:
706
diff
changeset
|
251 # else |
1545
b340e83b8d0d
gcc->C99 and warning fixes patch by (Dan Christiansen <danchr at daimi dot au dot dk>)
michael
parents:
1522
diff
changeset
|
252 # define dprintf(fmt,...) |
708
1aa1cbb8c3c1
indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents:
706
diff
changeset
|
253 # endif |
64 | 254 |
708
1aa1cbb8c3c1
indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents:
706
diff
changeset
|
255 # endif /* !CONFIG_WIN32 */ |
64 | 256 |
1598
932d306bf1dc
av_log() patch by (Michel Bardiaux <mbardiaux at peaktime dot be>)
michael
parents:
1548
diff
changeset
|
257 # define av_abort() do { av_log(NULL, AV_LOG_ERROR, "Abort at %s:%d\n", __FILE__, __LINE__); abort(); } while (0) |
423
ed6098c4216a
Add an av_abort macro that aborts, but also prints out the location of the abort.
philipjsg
parents:
408
diff
changeset
|
258 |
753 | 259 //rounded divison & shift |
1954 | 260 #define RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b)) |
344 | 261 /* assume b>0 */ |
262 #define ROUNDED_DIV(a,b) (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b)) | |
359 | 263 #define ABS(a) ((a) >= 0 ? (a) : (-(a))) |
823 | 264 |
847 | 265 #define FFMAX(a,b) ((a) > (b) ? (a) : (b)) |
266 #define FFMIN(a,b) ((a) > (b) ? (b) : (a)) | |
344 | 267 |
1261
362947395f5c
fastdiv patch by (BERO <bero at geocities dot co dot jp>) with fixes & cleanup by me
michaelni
parents:
1257
diff
changeset
|
268 extern const uint32_t inverse[256]; |
362947395f5c
fastdiv patch by (BERO <bero at geocities dot co dot jp>) with fixes & cleanup by me
michaelni
parents:
1257
diff
changeset
|
269 |
2293
15cfba1b97b5
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents:
2288
diff
changeset
|
270 #if defined(ARCH_X86) || defined(ARCH_X86_64) |
1261
362947395f5c
fastdiv patch by (BERO <bero at geocities dot co dot jp>) with fixes & cleanup by me
michaelni
parents:
1257
diff
changeset
|
271 # define FASTDIV(a,b) \ |
362947395f5c
fastdiv patch by (BERO <bero at geocities dot co dot jp>) with fixes & cleanup by me
michaelni
parents:
1257
diff
changeset
|
272 ({\ |
362947395f5c
fastdiv patch by (BERO <bero at geocities dot co dot jp>) with fixes & cleanup by me
michaelni
parents:
1257
diff
changeset
|
273 int ret,dmy;\ |
362947395f5c
fastdiv patch by (BERO <bero at geocities dot co dot jp>) with fixes & cleanup by me
michaelni
parents:
1257
diff
changeset
|
274 asm volatile(\ |
362947395f5c
fastdiv patch by (BERO <bero at geocities dot co dot jp>) with fixes & cleanup by me
michaelni
parents:
1257
diff
changeset
|
275 "mull %3"\ |
362947395f5c
fastdiv patch by (BERO <bero at geocities dot co dot jp>) with fixes & cleanup by me
michaelni
parents:
1257
diff
changeset
|
276 :"=d"(ret),"=a"(dmy)\ |
362947395f5c
fastdiv patch by (BERO <bero at geocities dot co dot jp>) with fixes & cleanup by me
michaelni
parents:
1257
diff
changeset
|
277 :"1"(a),"g"(inverse[b])\ |
362947395f5c
fastdiv patch by (BERO <bero at geocities dot co dot jp>) with fixes & cleanup by me
michaelni
parents:
1257
diff
changeset
|
278 );\ |
362947395f5c
fastdiv patch by (BERO <bero at geocities dot co dot jp>) with fixes & cleanup by me
michaelni
parents:
1257
diff
changeset
|
279 ret;\ |
362947395f5c
fastdiv patch by (BERO <bero at geocities dot co dot jp>) with fixes & cleanup by me
michaelni
parents:
1257
diff
changeset
|
280 }) |
362947395f5c
fastdiv patch by (BERO <bero at geocities dot co dot jp>) with fixes & cleanup by me
michaelni
parents:
1257
diff
changeset
|
281 #elif defined(CONFIG_FASTDIV) |
362947395f5c
fastdiv patch by (BERO <bero at geocities dot co dot jp>) with fixes & cleanup by me
michaelni
parents:
1257
diff
changeset
|
282 # define FASTDIV(a,b) ((uint32_t)((((uint64_t)a)*inverse[b])>>32)) |
362947395f5c
fastdiv patch by (BERO <bero at geocities dot co dot jp>) with fixes & cleanup by me
michaelni
parents:
1257
diff
changeset
|
283 #else |
362947395f5c
fastdiv patch by (BERO <bero at geocities dot co dot jp>) with fixes & cleanup by me
michaelni
parents:
1257
diff
changeset
|
284 # define FASTDIV(a,b) ((a)/(b)) |
362947395f5c
fastdiv patch by (BERO <bero at geocities dot co dot jp>) with fixes & cleanup by me
michaelni
parents:
1257
diff
changeset
|
285 #endif |
362947395f5c
fastdiv patch by (BERO <bero at geocities dot co dot jp>) with fixes & cleanup by me
michaelni
parents:
1257
diff
changeset
|
286 |
0 | 287 /* define it to include statistics code (useful only for optimizing |
288 codec efficiency */ | |
289 //#define STATS | |
290 | |
291 #ifdef STATS | |
292 | |
293 enum { | |
294 ST_UNKNOWN, | |
295 ST_DC, | |
296 ST_INTRA_AC, | |
297 ST_INTER_AC, | |
298 ST_INTRA_MB, | |
299 ST_INTER_MB, | |
300 ST_MV, | |
301 ST_NB, | |
302 }; | |
303 | |
304 extern int st_current_index; | |
305 extern unsigned int st_bit_counts[ST_NB]; | |
306 extern unsigned int st_out_bit_counts[ST_NB]; | |
307 | |
308 void print_stats(void); | |
309 #endif | |
310 | |
311 /* misc math functions */ | |
1037 | 312 extern const uint8_t ff_log2_tab[256]; |
0 | 313 |
151
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
144
diff
changeset
|
314 static inline int av_log2(unsigned int v) |
0 | 315 { |
316 int n; | |
317 | |
318 n = 0; | |
319 if (v & 0xffff0000) { | |
320 v >>= 16; | |
321 n += 16; | |
322 } | |
323 if (v & 0xff00) { | |
324 v >>= 8; | |
325 n += 8; | |
326 } | |
1037 | 327 n += ff_log2_tab[v]; |
328 | |
0 | 329 return n; |
330 } | |
331 | |
1037 | 332 static inline int av_log2_16bit(unsigned int v) |
333 { | |
334 int n; | |
335 | |
336 n = 0; | |
337 if (v & 0xff00) { | |
338 v >>= 8; | |
339 n += 8; | |
340 } | |
341 n += ff_log2_tab[v]; | |
342 | |
343 return n; | |
344 } | |
345 | |
277
5cb2978e701f
new motion estimation (epzs) not complete yet but allready pretty good :)
michaelni
parents:
264
diff
changeset
|
346 /* median of 3 */ |
5cb2978e701f
new motion estimation (epzs) not complete yet but allready pretty good :)
michaelni
parents:
264
diff
changeset
|
347 static inline int mid_pred(int a, int b, int c) |
5cb2978e701f
new motion estimation (epzs) not complete yet but allready pretty good :)
michaelni
parents:
264
diff
changeset
|
348 { |
1756 | 349 #if 0 |
350 int t= (a-b)&((a-b)>>31); | |
351 a-=t; | |
352 b+=t; | |
353 b-= (b-c)&((b-c)>>31); | |
354 b+= (a-b)&((a-b)>>31); | |
277
5cb2978e701f
new motion estimation (epzs) not complete yet but allready pretty good :)
michaelni
parents:
264
diff
changeset
|
355 |
1756 | 356 return b; |
357 #else | |
358 if(a>b){ | |
359 if(c>b){ | |
360 if(c>a) b=a; | |
361 else b=c; | |
362 } | |
363 }else{ | |
364 if(b>c){ | |
365 if(c>a) b=c; | |
366 else b=a; | |
367 } | |
368 } | |
369 return b; | |
370 #endif | |
277
5cb2978e701f
new motion estimation (epzs) not complete yet but allready pretty good :)
michaelni
parents:
264
diff
changeset
|
371 } |
5cb2978e701f
new motion estimation (epzs) not complete yet but allready pretty good :)
michaelni
parents:
264
diff
changeset
|
372 |
327 | 373 static inline int clip(int a, int amin, int amax) |
374 { | |
375 if (a < amin) | |
376 return amin; | |
377 else if (a > amax) | |
378 return amax; | |
379 else | |
380 return a; | |
381 } | |
382 | |
1898 | 383 static inline int clip_uint8(int a) |
384 { | |
385 if (a&(~255)) return (-a)>>31; | |
386 else return a; | |
387 } | |
388 | |
324 | 389 /* math */ |
1037 | 390 extern const uint8_t ff_sqrt_tab[128]; |
609 | 391 |
1126
77ccf7fe3bd0
per context frame_rate_base, this should finally fix frame_rate related av sync issues
michaelni
parents:
1124
diff
changeset
|
392 int64_t ff_gcd(int64_t a, int64_t b); |
324 | 393 |
451 | 394 static inline int ff_sqrt(int a) |
395 { | |
396 int ret=0; | |
397 int s; | |
398 int ret_sq=0; | |
609 | 399 |
400 if(a<128) return ff_sqrt_tab[a]; | |
401 | |
451 | 402 for(s=15; s>=0; s--){ |
403 int b= ret_sq + (1<<(s*2)) + (ret<<s)*2; | |
404 if(b<=a){ | |
405 ret_sq=b; | |
406 ret+= 1<<s; | |
407 } | |
408 } | |
409 return ret; | |
410 } | |
701 | 411 |
412 /** | |
413 * converts fourcc string to int | |
414 */ | |
865 | 415 static inline int ff_get_fourcc(const char *s){ |
701 | 416 assert( strlen(s)==4 ); |
1401 | 417 |
701 | 418 return (s[0]) + (s[1]<<8) + (s[2]<<16) + (s[3]<<24); |
419 } | |
420 | |
1139
6842feb093c1
rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
1130
diff
changeset
|
421 #define MKTAG(a,b,c,d) (a | (b << 8) | (c << 16) | (d << 24)) |
6842feb093c1
rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
1130
diff
changeset
|
422 #define MKBETAG(a,b,c,d) (d | (c << 8) | (b << 16) | (a << 24)) |
6842feb093c1
rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
1130
diff
changeset
|
423 |
6842feb093c1
rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
1130
diff
changeset
|
424 |
2293
15cfba1b97b5
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents:
2288
diff
changeset
|
425 #if defined(ARCH_X86) || defined(ARCH_X86_64) |
706
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
701
diff
changeset
|
426 #define MASK_ABS(mask, level)\ |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
701
diff
changeset
|
427 asm volatile(\ |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
701
diff
changeset
|
428 "cdq \n\t"\ |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
701
diff
changeset
|
429 "xorl %1, %0 \n\t"\ |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
701
diff
changeset
|
430 "subl %1, %0 \n\t"\ |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
701
diff
changeset
|
431 : "+a" (level), "=&d" (mask)\ |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
701
diff
changeset
|
432 ); |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
701
diff
changeset
|
433 #else |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
701
diff
changeset
|
434 #define MASK_ABS(mask, level)\ |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
701
diff
changeset
|
435 mask= level>>31;\ |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
701
diff
changeset
|
436 level= (level^mask)-mask; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
701
diff
changeset
|
437 #endif |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
701
diff
changeset
|
438 |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
701
diff
changeset
|
439 |
451 | 440 #if __CPU__ >= 686 && !defined(RUNTIME_CPUDETECT) |
441 #define COPY3_IF_LT(x,y,a,b,c,d)\ | |
442 asm volatile (\ | |
443 "cmpl %0, %3 \n\t"\ | |
444 "cmovl %3, %0 \n\t"\ | |
445 "cmovl %4, %1 \n\t"\ | |
446 "cmovl %5, %2 \n\t"\ | |
447 : "+r" (x), "+r" (a), "+r" (c)\ | |
448 : "r" (y), "r" (b), "r" (d)\ | |
449 ); | |
450 #else | |
451 #define COPY3_IF_LT(x,y,a,b,c,d)\ | |
452 if((y)<(x)){\ | |
453 (x)=(y);\ | |
454 (a)=(b);\ | |
455 (c)=(d);\ | |
456 } | |
457 #endif | |
458 | |
2293
15cfba1b97b5
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
michael
parents:
2288
diff
changeset
|
459 #if defined(ARCH_X86) || defined(ARCH_X86_64) |
2288 | 460 static inline long long rdtsc(void) |
1281 | 461 { |
462 long long l; | |
463 asm volatile( "rdtsc\n\t" | |
464 : "=A" (l) | |
465 ); | |
466 return l; | |
467 } | |
468 | |
469 #define START_TIMER \ | |
470 uint64_t tend;\ | |
471 uint64_t tstart= rdtsc();\ | |
472 | |
473 #define STOP_TIMER(id) \ | |
474 tend= rdtsc();\ | |
1823
a660ef952580
(f)printf() is disallowed in libavcodec, compilation will fail now if its used, except that codecs which where added after the printf->av_log change which did ignore av_log() and used prinf are now silent and wont print anything, they should be changed to use av_log, i could do that, but its better if the orginal developer decides which AV_LOG level each message should get
michael
parents:
1799
diff
changeset
|
475 {\ |
a660ef952580
(f)printf() is disallowed in libavcodec, compilation will fail now if its used, except that codecs which where added after the printf->av_log change which did ignore av_log() and used prinf are now silent and wont print anything, they should be changed to use av_log, i could do that, but its better if the orginal developer decides which AV_LOG level each message should get
michael
parents:
1799
diff
changeset
|
476 static uint64_t tsum=0;\ |
a660ef952580
(f)printf() is disallowed in libavcodec, compilation will fail now if its used, except that codecs which where added after the printf->av_log change which did ignore av_log() and used prinf are now silent and wont print anything, they should be changed to use av_log, i could do that, but its better if the orginal developer decides which AV_LOG level each message should get
michael
parents:
1799
diff
changeset
|
477 static int tcount=0;\ |
a660ef952580
(f)printf() is disallowed in libavcodec, compilation will fail now if its used, except that codecs which where added after the printf->av_log change which did ignore av_log() and used prinf are now silent and wont print anything, they should be changed to use av_log, i could do that, but its better if the orginal developer decides which AV_LOG level each message should get
michael
parents:
1799
diff
changeset
|
478 static int tskip_count=0;\ |
a660ef952580
(f)printf() is disallowed in libavcodec, compilation will fail now if its used, except that codecs which where added after the printf->av_log change which did ignore av_log() and used prinf are now silent and wont print anything, they should be changed to use av_log, i could do that, but its better if the orginal developer decides which AV_LOG level each message should get
michael
parents:
1799
diff
changeset
|
479 if(tcount<2 || tend - tstart < 8*tsum/tcount){\ |
a660ef952580
(f)printf() is disallowed in libavcodec, compilation will fail now if its used, except that codecs which where added after the printf->av_log change which did ignore av_log() and used prinf are now silent and wont print anything, they should be changed to use av_log, i could do that, but its better if the orginal developer decides which AV_LOG level each message should get
michael
parents:
1799
diff
changeset
|
480 tsum+= tend - tstart;\ |
a660ef952580
(f)printf() is disallowed in libavcodec, compilation will fail now if its used, except that codecs which where added after the printf->av_log change which did ignore av_log() and used prinf are now silent and wont print anything, they should be changed to use av_log, i could do that, but its better if the orginal developer decides which AV_LOG level each message should get
michael
parents:
1799
diff
changeset
|
481 tcount++;\ |
a660ef952580
(f)printf() is disallowed in libavcodec, compilation will fail now if its used, except that codecs which where added after the printf->av_log change which did ignore av_log() and used prinf are now silent and wont print anything, they should be changed to use av_log, i could do that, but its better if the orginal developer decides which AV_LOG level each message should get
michael
parents:
1799
diff
changeset
|
482 }else\ |
a660ef952580
(f)printf() is disallowed in libavcodec, compilation will fail now if its used, except that codecs which where added after the printf->av_log change which did ignore av_log() and used prinf are now silent and wont print anything, they should be changed to use av_log, i could do that, but its better if the orginal developer decides which AV_LOG level each message should get
michael
parents:
1799
diff
changeset
|
483 tskip_count++;\ |
a660ef952580
(f)printf() is disallowed in libavcodec, compilation will fail now if its used, except that codecs which where added after the printf->av_log change which did ignore av_log() and used prinf are now silent and wont print anything, they should be changed to use av_log, i could do that, but its better if the orginal developer decides which AV_LOG level each message should get
michael
parents:
1799
diff
changeset
|
484 if(256*256*256*64%(tcount+tskip_count)==0){\ |
a660ef952580
(f)printf() is disallowed in libavcodec, compilation will fail now if its used, except that codecs which where added after the printf->av_log change which did ignore av_log() and used prinf are now silent and wont print anything, they should be changed to use av_log, i could do that, but its better if the orginal developer decides which AV_LOG level each message should get
michael
parents:
1799
diff
changeset
|
485 av_log(NULL, AV_LOG_DEBUG, "%Ld dezicycles in %s, %d runs, %d skips\n", tsum*10/tcount, id, tcount, tskip_count);\ |
a660ef952580
(f)printf() is disallowed in libavcodec, compilation will fail now if its used, except that codecs which where added after the printf->av_log change which did ignore av_log() and used prinf are now silent and wont print anything, they should be changed to use av_log, i could do that, but its better if the orginal developer decides which AV_LOG level each message should get
michael
parents:
1799
diff
changeset
|
486 }\ |
1281 | 487 } |
2140 | 488 #else |
489 #define START_TIMER | |
490 #define STOP_TIMER(id) {} | |
1281 | 491 #endif |
492 | |
370
0eca28d16cbd
clamp intra matrix to 8bit for mjpeg (workaround for qscale>=25)
al3x
parents:
359
diff
changeset
|
493 #define CLAMP_TO_8BIT(d) ((d > 0xff) ? 0xff : (d < 0) ? 0 : d) |
0eca28d16cbd
clamp intra matrix to 8bit for mjpeg (workaround for qscale>=25)
al3x
parents:
359
diff
changeset
|
494 |
1031
19de1445beb2
use av_malloc() functions - added av_strdup and av_realloc()
bellard
parents:
1025
diff
changeset
|
495 /* avoid usage of various functions */ |
19de1445beb2
use av_malloc() functions - added av_strdup and av_realloc()
bellard
parents:
1025
diff
changeset
|
496 #define malloc please_use_av_malloc |
19de1445beb2
use av_malloc() functions - added av_strdup and av_realloc()
bellard
parents:
1025
diff
changeset
|
497 #define free please_use_av_free |
19de1445beb2
use av_malloc() functions - added av_strdup and av_realloc()
bellard
parents:
1025
diff
changeset
|
498 #define realloc please_use_av_realloc |
1921 | 499 #define time time_is_forbidden_due_to_security_issues |
500 #define rand rand_is_forbidden_due_to_state_trashing | |
501 #define srand srand_is_forbidden_due_to_state_trashing | |
2423 | 502 #define sprintf sprintf_is_forbidden_due_to_security_issues_use_snprintf |
2424 | 503 #define strcat strcat_is_forbidden_due_to_security_issues_use_pstrcat |
1823
a660ef952580
(f)printf() is disallowed in libavcodec, compilation will fail now if its used, except that codecs which where added after the printf->av_log change which did ignore av_log() and used prinf are now silent and wont print anything, they should be changed to use av_log, i could do that, but its better if the orginal developer decides which AV_LOG level each message should get
michael
parents:
1799
diff
changeset
|
504 #if !(defined(LIBAVFORMAT_BUILD) || defined(_FRAMEHOOK_H)) |
a660ef952580
(f)printf() is disallowed in libavcodec, compilation will fail now if its used, except that codecs which where added after the printf->av_log change which did ignore av_log() and used prinf are now silent and wont print anything, they should be changed to use av_log, i could do that, but its better if the orginal developer decides which AV_LOG level each message should get
michael
parents:
1799
diff
changeset
|
505 #define printf please_use_av_log |
a660ef952580
(f)printf() is disallowed in libavcodec, compilation will fail now if its used, except that codecs which where added after the printf->av_log change which did ignore av_log() and used prinf are now silent and wont print anything, they should be changed to use av_log, i could do that, but its better if the orginal developer decides which AV_LOG level each message should get
michael
parents:
1799
diff
changeset
|
506 #define fprintf please_use_av_log |
a660ef952580
(f)printf() is disallowed in libavcodec, compilation will fail now if its used, except that codecs which where added after the printf->av_log change which did ignore av_log() and used prinf are now silent and wont print anything, they should be changed to use av_log, i could do that, but its better if the orginal developer decides which AV_LOG level each message should get
michael
parents:
1799
diff
changeset
|
507 #endif |
1031
19de1445beb2
use av_malloc() functions - added av_strdup and av_realloc()
bellard
parents:
1025
diff
changeset
|
508 |
1177
fea03d2c4946
simplified adressing of most mb based arrays (mb_x + mb_y*s->mb_stride) now instead of mb_x + mb_y*mb_width and 1+mb_x + (1+mb_y)*(mb_width+2) and ... mixture
michaelni
parents:
1171
diff
changeset
|
509 #define CHECKED_ALLOCZ(p, size)\ |
fea03d2c4946
simplified adressing of most mb based arrays (mb_x + mb_y*s->mb_stride) now instead of mb_x + mb_y*mb_width and 1+mb_x + (1+mb_y)*(mb_width+2) and ... mixture
michaelni
parents:
1171
diff
changeset
|
510 {\ |
fea03d2c4946
simplified adressing of most mb based arrays (mb_x + mb_y*s->mb_stride) now instead of mb_x + mb_y*mb_width and 1+mb_x + (1+mb_y)*(mb_width+2) and ... mixture
michaelni
parents:
1171
diff
changeset
|
511 p= av_mallocz(size);\ |
1332 | 512 if(p==NULL && (size)!=0){\ |
1177
fea03d2c4946
simplified adressing of most mb based arrays (mb_x + mb_y*s->mb_stride) now instead of mb_x + mb_y*mb_width and 1+mb_x + (1+mb_y)*(mb_width+2) and ... mixture
michaelni
parents:
1171
diff
changeset
|
513 perror("malloc");\ |
fea03d2c4946
simplified adressing of most mb based arrays (mb_x + mb_y*s->mb_stride) now instead of mb_x + mb_y*mb_width and 1+mb_x + (1+mb_y)*(mb_width+2) and ... mixture
michaelni
parents:
1171
diff
changeset
|
514 goto fail;\ |
fea03d2c4946
simplified adressing of most mb based arrays (mb_x + mb_y*s->mb_stride) now instead of mb_x + mb_y*mb_width and 1+mb_x + (1+mb_y)*(mb_width+2) and ... mixture
michaelni
parents:
1171
diff
changeset
|
515 }\ |
fea03d2c4946
simplified adressing of most mb based arrays (mb_x + mb_y*s->mb_stride) now instead of mb_x + mb_y*mb_width and 1+mb_x + (1+mb_y)*(mb_width+2) and ... mixture
michaelni
parents:
1171
diff
changeset
|
516 } |
fea03d2c4946
simplified adressing of most mb based arrays (mb_x + mb_y*s->mb_stride) now instead of mb_x + mb_y*mb_width and 1+mb_x + (1+mb_y)*(mb_width+2) and ... mixture
michaelni
parents:
1171
diff
changeset
|
517 |
488 | 518 #endif /* HAVE_AV_CONFIG_H */ |
519 | |
520 #endif /* COMMON_H */ |