Mercurial > libavcodec.hg
annotate common.h @ 2531:eed7d92a1dfc libavcodec
VP3 post-processing loop filter; disabled until the correct final step
is determined
author | melanson |
---|---|
date | Tue, 01 Mar 2005 06:14:45 +0000 |
parents | e25782262d7d |
children | 9a7770ebed14 |
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 |
2522
e25782262d7d
kill warnings patch by (Mns Rullgrd <mru inprovide com>)
michael
parents:
2424
diff
changeset
|
88 #ifndef attribute_unused |
e25782262d7d
kill warnings patch by (Mns Rullgrd <mru inprovide com>)
michael
parents:
2424
diff
changeset
|
89 #if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ > 0) |
e25782262d7d
kill warnings patch by (Mns Rullgrd <mru inprovide com>)
michael
parents:
2424
diff
changeset
|
90 # define attribute_unused __attribute__((unused)) |
e25782262d7d
kill warnings patch by (Mns Rullgrd <mru inprovide com>)
michael
parents:
2424
diff
changeset
|
91 #else |
e25782262d7d
kill warnings patch by (Mns Rullgrd <mru inprovide com>)
michael
parents:
2424
diff
changeset
|
92 # define attribute_unused |
e25782262d7d
kill warnings patch by (Mns Rullgrd <mru inprovide com>)
michael
parents:
2424
diff
changeset
|
93 #endif |
e25782262d7d
kill warnings patch by (Mns Rullgrd <mru inprovide com>)
michael
parents:
2424
diff
changeset
|
94 #endif |
e25782262d7d
kill warnings patch by (Mns Rullgrd <mru inprovide com>)
michael
parents:
2424
diff
changeset
|
95 |
1738
378e98870df4
more sane inttypes emulation behavior if libavcodec is used outside ffmpeg
michael
parents:
1735
diff
changeset
|
96 #ifndef EMULATE_INTTYPES |
1735
cb0abe523bc6
inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents:
1660
diff
changeset
|
97 # include <inttypes.h> |
cb0abe523bc6
inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents:
1660
diff
changeset
|
98 #else |
cb0abe523bc6
inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents:
1660
diff
changeset
|
99 typedef signed char int8_t; |
cb0abe523bc6
inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents:
1660
diff
changeset
|
100 typedef signed short int16_t; |
cb0abe523bc6
inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents:
1660
diff
changeset
|
101 typedef signed int int32_t; |
cb0abe523bc6
inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents:
1660
diff
changeset
|
102 typedef unsigned char uint8_t; |
cb0abe523bc6
inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents:
1660
diff
changeset
|
103 typedef unsigned short uint16_t; |
cb0abe523bc6
inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents:
1660
diff
changeset
|
104 typedef unsigned int uint32_t; |
cb0abe523bc6
inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents:
1660
diff
changeset
|
105 |
cb0abe523bc6
inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents:
1660
diff
changeset
|
106 # ifdef CONFIG_WIN32 |
cb0abe523bc6
inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents:
1660
diff
changeset
|
107 typedef signed __int64 int64_t; |
cb0abe523bc6
inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents:
1660
diff
changeset
|
108 typedef unsigned __int64 uint64_t; |
cb0abe523bc6
inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents:
1660
diff
changeset
|
109 # else /* other OS */ |
cb0abe523bc6
inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents:
1660
diff
changeset
|
110 typedef signed long long int64_t; |
cb0abe523bc6
inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents:
1660
diff
changeset
|
111 typedef unsigned long long uint64_t; |
cb0abe523bc6
inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents:
1660
diff
changeset
|
112 # endif /* other OS */ |
cb0abe523bc6
inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents:
1660
diff
changeset
|
113 #endif /* HAVE_INTTYPES_H */ |
cb0abe523bc6
inttypes emulation cleanup patch by ("Chris Flerackers" <cflerackers at androme dot be>)
michael
parents:
1660
diff
changeset
|
114 |
2318
1925d732ea42
INT MIN/MAX patch by (Bohdan Horst <nexus at irc dot pl>)
michael
parents:
2293
diff
changeset
|
115 #ifndef INT16_MIN |
1925d732ea42
INT MIN/MAX patch by (Bohdan Horst <nexus at irc dot pl>)
michael
parents:
2293
diff
changeset
|
116 #define INT16_MIN (-0x7fff-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 |
1925d732ea42
INT MIN/MAX patch by (Bohdan Horst <nexus at irc dot pl>)
michael
parents:
2293
diff
changeset
|
119 #ifndef INT16_MAX |
1925d732ea42
INT MIN/MAX patch by (Bohdan Horst <nexus at irc dot pl>)
michael
parents:
2293
diff
changeset
|
120 #define INT16_MAX 0x7fff |
1925d732ea42
INT MIN/MAX patch by (Bohdan Horst <nexus at irc dot pl>)
michael
parents:
2293
diff
changeset
|
121 #endif |
1925d732ea42
INT MIN/MAX patch by (Bohdan Horst <nexus at irc dot pl>)
michael
parents:
2293
diff
changeset
|
122 |
1925d732ea42
INT MIN/MAX patch by (Bohdan Horst <nexus at irc dot pl>)
michael
parents:
2293
diff
changeset
|
123 #ifndef INT64_MIN |
1925d732ea42
INT MIN/MAX patch by (Bohdan Horst <nexus at irc dot pl>)
michael
parents:
2293
diff
changeset
|
124 #define INT64_MIN (-0x7fffffffffffffffLL-1) |
1925d732ea42
INT MIN/MAX patch by (Bohdan Horst <nexus at irc dot pl>)
michael
parents:
2293
diff
changeset
|
125 #endif |
1925d732ea42
INT MIN/MAX patch by (Bohdan Horst <nexus at irc dot pl>)
michael
parents:
2293
diff
changeset
|
126 |
1761
3620e301643a
int64max fix by (Michel Bardiaux <mbardiaux at peaktime dot be>)
michael
parents:
1758
diff
changeset
|
127 #ifndef INT64_MAX |
1840
0287241a0c18
int64_t_C patch by (Gael Chardon <gael-announcements+ffmpeg at 4now dot net>)
michael
parents:
1824
diff
changeset
|
128 #define INT64_MAX int64_t_C(9223372036854775807) |
1761
3620e301643a
int64max fix by (Michel Bardiaux <mbardiaux at peaktime dot be>)
michael
parents:
1758
diff
changeset
|
129 #endif |
3620e301643a
int64max fix by (Michel Bardiaux <mbardiaux at peaktime dot be>)
michael
parents:
1758
diff
changeset
|
130 |
2016 | 131 #ifndef UINT64_MAX |
132 #define UINT64_MAX uint64_t_C(0xFFFFFFFFFFFFFFFF) | |
133 #endif | |
134 | |
1603
3a633a3feef6
* fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents:
1598
diff
changeset
|
135 #ifdef EMULATE_FAST_INT |
3a633a3feef6
* fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents:
1598
diff
changeset
|
136 /* note that we don't emulate 64bit ints */ |
3a633a3feef6
* fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents:
1598
diff
changeset
|
137 typedef signed char int_fast8_t; |
3a633a3feef6
* fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents:
1598
diff
changeset
|
138 typedef signed int int_fast16_t; |
3a633a3feef6
* fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents:
1598
diff
changeset
|
139 typedef signed int int_fast32_t; |
3a633a3feef6
* fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents:
1598
diff
changeset
|
140 typedef unsigned char uint_fast8_t; |
3a633a3feef6
* fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents:
1598
diff
changeset
|
141 typedef unsigned int uint_fast16_t; |
3a633a3feef6
* fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents:
1598
diff
changeset
|
142 typedef unsigned int uint_fast32_t; |
3a633a3feef6
* fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents:
1598
diff
changeset
|
143 #endif |
3a633a3feef6
* fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents:
1598
diff
changeset
|
144 |
2093 | 145 #ifndef INT_BIT |
2112 | 146 # if INT_MAX != 2147483647 |
2093 | 147 # define INT_BIT 64 |
148 # else | |
149 # define INT_BIT 32 | |
150 # endif | |
151 #endif | |
152 | |
1603
3a633a3feef6
* fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents:
1598
diff
changeset
|
153 #if defined(CONFIG_OS2) || defined(CONFIG_SUNOS) |
3a633a3feef6
* fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents:
1598
diff
changeset
|
154 static inline float floorf(float f) { |
3a633a3feef6
* fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents:
1598
diff
changeset
|
155 return floor(f); |
3a633a3feef6
* fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents:
1598
diff
changeset
|
156 } |
3a633a3feef6
* fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents:
1598
diff
changeset
|
157 #endif |
3a633a3feef6
* fixes for broken builds on Solaris, OS2 and all bingendian
romansh
parents:
1598
diff
changeset
|
158 |
64 | 159 #ifdef CONFIG_WIN32 |
160 | |
161 /* windows */ | |
162 | |
1961
603d4a0e974c
libavcodec Cygwin compilation failure (II) patch by (Sascha Sommer)
michael
parents:
1954
diff
changeset
|
163 # if !defined(__MINGW32__) && !defined(__CYGWIN__) |
1064 | 164 # define int64_t_C(c) (c ## i64) |
165 # define uint64_t_C(c) (c ## i64) | |
64 | 166 |
1509 | 167 # ifdef HAVE_AV_CONFIG_H |
168 # define inline __inline | |
169 # endif | |
64 | 170 |
708
1aa1cbb8c3c1
indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents:
706
diff
changeset
|
171 # else |
1064 | 172 # define int64_t_C(c) (c ## LL) |
173 # define uint64_t_C(c) (c ## ULL) | |
708
1aa1cbb8c3c1
indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents:
706
diff
changeset
|
174 # endif /* __MINGW32__ */ |
76 | 175 |
1509 | 176 # ifdef HAVE_AV_CONFIG_H |
177 # ifdef _DEBUG | |
178 # define DEBUG | |
179 # endif | |
180 | |
181 # define snprintf _snprintf | |
182 # define vsnprintf _vsnprintf | |
708
1aa1cbb8c3c1
indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents:
706
diff
changeset
|
183 # endif |
64 | 184 |
994
7701ff462e3a
os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents:
976
diff
changeset
|
185 /* CONFIG_WIN32 end */ |
7701ff462e3a
os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents:
976
diff
changeset
|
186 #elif defined (CONFIG_OS2) |
7701ff462e3a
os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents:
976
diff
changeset
|
187 /* OS/2 EMX */ |
7701ff462e3a
os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents:
976
diff
changeset
|
188 |
1064 | 189 #ifndef int64_t_C |
190 #define int64_t_C(c) (c ## LL) | |
191 #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
|
192 #endif |
7701ff462e3a
os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents:
976
diff
changeset
|
193 |
1413 | 194 #ifdef HAVE_AV_CONFIG_H |
195 | |
994
7701ff462e3a
os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents:
976
diff
changeset
|
196 #ifdef USE_FASTMEMCPY |
7701ff462e3a
os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents:
976
diff
changeset
|
197 #include "fastmemcpy.h" |
7701ff462e3a
os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents:
976
diff
changeset
|
198 #endif |
7701ff462e3a
os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents:
976
diff
changeset
|
199 |
7701ff462e3a
os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents:
976
diff
changeset
|
200 #include <float.h> |
7701ff462e3a
os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents:
976
diff
changeset
|
201 |
7701ff462e3a
os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents:
976
diff
changeset
|
202 #endif /* HAVE_AV_CONFIG_H */ |
7701ff462e3a
os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents:
976
diff
changeset
|
203 |
7701ff462e3a
os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents:
976
diff
changeset
|
204 /* CONFIG_OS2 end */ |
7701ff462e3a
os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents:
976
diff
changeset
|
205 #else |
64 | 206 |
207 /* unix */ | |
208 | |
1413 | 209 #ifndef int64_t_C |
210 #define int64_t_C(c) (c ## LL) | |
211 #define uint64_t_C(c) (c ## ULL) | |
212 #endif | |
213 | |
214 #ifdef HAVE_AV_CONFIG_H | |
64 | 215 |
708
1aa1cbb8c3c1
indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents:
706
diff
changeset
|
216 # ifdef USE_FASTMEMCPY |
1aa1cbb8c3c1
indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents:
706
diff
changeset
|
217 # include "fastmemcpy.h" |
1aa1cbb8c3c1
indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents:
706
diff
changeset
|
218 # endif |
1aa1cbb8c3c1
indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents:
706
diff
changeset
|
219 # endif /* HAVE_AV_CONFIG_H */ |
76 | 220 |
994
7701ff462e3a
os2 support patch by ("Slavik Gnatenko" <miracle9 at newmail dot ru>)
michaelni
parents:
976
diff
changeset
|
221 #endif /* !CONFIG_WIN32 && !CONFIG_OS2 */ |
76 | 222 |
488 | 223 #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
|
224 |
708
1aa1cbb8c3c1
indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents:
706
diff
changeset
|
225 # include "bswap.h" |
426 | 226 |
2391
336a239ad9a4
fixes for PIC code on x86-64 patch by (Drew Hess <drew.hess gmail com>)
michael
parents:
2370
diff
changeset
|
227 // 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
|
228 # if defined(__MINGW32__) || defined(__CYGWIN__) || \ |
1226
dbc7e3c814a9
Tiny patch for OpenBSD by (Bjrn Sandell <biorn at dce dot chalmers dot se>)
michaelni
parents:
1177
diff
changeset
|
229 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
|
230 # 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
|
231 # 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
|
232 # else |
336a239ad9a4
fixes for PIC code on x86-64 patch by (Drew Hess <drew.hess gmail com>)
michael
parents:
2370
diff
changeset
|
233 # 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
|
234 # endif |
708
1aa1cbb8c3c1
indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents:
706
diff
changeset
|
235 # else |
2391
336a239ad9a4
fixes for PIC code on x86-64 patch by (Drew Hess <drew.hess gmail com>)
michael
parents:
2370
diff
changeset
|
236 # 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
|
237 # 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
|
238 # else |
336a239ad9a4
fixes for PIC code on x86-64 patch by (Drew Hess <drew.hess gmail com>)
michael
parents:
2370
diff
changeset
|
239 # 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
|
240 # endif |
708
1aa1cbb8c3c1
indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents:
706
diff
changeset
|
241 # endif |
432 | 242 |
76 | 243 /* debug stuff */ |
244 | |
708
1aa1cbb8c3c1
indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents:
706
diff
changeset
|
245 # ifndef DEBUG |
1aa1cbb8c3c1
indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents:
706
diff
changeset
|
246 # define NDEBUG |
1aa1cbb8c3c1
indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents:
706
diff
changeset
|
247 # endif |
1aa1cbb8c3c1
indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents:
706
diff
changeset
|
248 # include <assert.h> |
64 | 249 |
76 | 250 /* dprintf macros */ |
1964
2b16a3c32318
cygwin patch by ("Sascha Sommer" <saschasommer at freenet dot de>)
michael
parents:
1961
diff
changeset
|
251 # if defined(CONFIG_WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__) |
76 | 252 |
253 inline void dprintf(const char* fmt,...) {} | |
254 | |
708
1aa1cbb8c3c1
indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents:
706
diff
changeset
|
255 # else |
76 | 256 |
708
1aa1cbb8c3c1
indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents:
706
diff
changeset
|
257 # ifdef DEBUG |
1940 | 258 # 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
|
259 # else |
1545
b340e83b8d0d
gcc->C99 and warning fixes patch by (Dan Christiansen <danchr at daimi dot au dot dk>)
michael
parents:
1522
diff
changeset
|
260 # define dprintf(fmt,...) |
708
1aa1cbb8c3c1
indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents:
706
diff
changeset
|
261 # endif |
64 | 262 |
708
1aa1cbb8c3c1
indenting preprocessor stuff, as its completly unreadable otherwise
michaelni
parents:
706
diff
changeset
|
263 # endif /* !CONFIG_WIN32 */ |
64 | 264 |
1598
932d306bf1dc
av_log() patch by (Michel Bardiaux <mbardiaux at peaktime dot be>)
michael
parents:
1548
diff
changeset
|
265 # 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
|
266 |
753 | 267 //rounded divison & shift |
1954 | 268 #define RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b)) |
344 | 269 /* assume b>0 */ |
270 #define ROUNDED_DIV(a,b) (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b)) | |
359 | 271 #define ABS(a) ((a) >= 0 ? (a) : (-(a))) |
823 | 272 |
847 | 273 #define FFMAX(a,b) ((a) > (b) ? (a) : (b)) |
274 #define FFMIN(a,b) ((a) > (b) ? (b) : (a)) | |
344 | 275 |
1261
362947395f5c
fastdiv patch by (BERO <bero at geocities dot co dot jp>) with fixes & cleanup by me
michaelni
parents:
1257
diff
changeset
|
276 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
|
277 |
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
|
278 #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
|
279 # 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
|
280 ({\ |
362947395f5c
fastdiv patch by (BERO <bero at geocities dot co dot jp>) with fixes & cleanup by me
michaelni
parents:
1257
diff
changeset
|
281 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
|
282 asm volatile(\ |
362947395f5c
fastdiv patch by (BERO <bero at geocities dot co dot jp>) with fixes & cleanup by me
michaelni
parents:
1257
diff
changeset
|
283 "mull %3"\ |
362947395f5c
fastdiv patch by (BERO <bero at geocities dot co dot jp>) with fixes & cleanup by me
michaelni
parents:
1257
diff
changeset
|
284 :"=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
|
285 :"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
|
286 );\ |
362947395f5c
fastdiv patch by (BERO <bero at geocities dot co dot jp>) with fixes & cleanup by me
michaelni
parents:
1257
diff
changeset
|
287 ret;\ |
362947395f5c
fastdiv patch by (BERO <bero at geocities dot co dot jp>) with fixes & cleanup by me
michaelni
parents:
1257
diff
changeset
|
288 }) |
362947395f5c
fastdiv patch by (BERO <bero at geocities dot co dot jp>) with fixes & cleanup by me
michaelni
parents:
1257
diff
changeset
|
289 #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
|
290 # 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
|
291 #else |
362947395f5c
fastdiv patch by (BERO <bero at geocities dot co dot jp>) with fixes & cleanup by me
michaelni
parents:
1257
diff
changeset
|
292 # 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
|
293 #endif |
362947395f5c
fastdiv patch by (BERO <bero at geocities dot co dot jp>) with fixes & cleanup by me
michaelni
parents:
1257
diff
changeset
|
294 |
0 | 295 /* define it to include statistics code (useful only for optimizing |
296 codec efficiency */ | |
297 //#define STATS | |
298 | |
299 #ifdef STATS | |
300 | |
301 enum { | |
302 ST_UNKNOWN, | |
303 ST_DC, | |
304 ST_INTRA_AC, | |
305 ST_INTER_AC, | |
306 ST_INTRA_MB, | |
307 ST_INTER_MB, | |
308 ST_MV, | |
309 ST_NB, | |
310 }; | |
311 | |
312 extern int st_current_index; | |
313 extern unsigned int st_bit_counts[ST_NB]; | |
314 extern unsigned int st_out_bit_counts[ST_NB]; | |
315 | |
316 void print_stats(void); | |
317 #endif | |
318 | |
319 /* misc math functions */ | |
1037 | 320 extern const uint8_t ff_log2_tab[256]; |
0 | 321 |
151
ae0516eadae2
fixed gcc-3.0.x compilation (by Michael Niedermayer)
nickols_k
parents:
144
diff
changeset
|
322 static inline int av_log2(unsigned int v) |
0 | 323 { |
324 int n; | |
325 | |
326 n = 0; | |
327 if (v & 0xffff0000) { | |
328 v >>= 16; | |
329 n += 16; | |
330 } | |
331 if (v & 0xff00) { | |
332 v >>= 8; | |
333 n += 8; | |
334 } | |
1037 | 335 n += ff_log2_tab[v]; |
336 | |
0 | 337 return n; |
338 } | |
339 | |
1037 | 340 static inline int av_log2_16bit(unsigned int v) |
341 { | |
342 int n; | |
343 | |
344 n = 0; | |
345 if (v & 0xff00) { | |
346 v >>= 8; | |
347 n += 8; | |
348 } | |
349 n += ff_log2_tab[v]; | |
350 | |
351 return n; | |
352 } | |
353 | |
277
5cb2978e701f
new motion estimation (epzs) not complete yet but allready pretty good :)
michaelni
parents:
264
diff
changeset
|
354 /* median of 3 */ |
5cb2978e701f
new motion estimation (epzs) not complete yet but allready pretty good :)
michaelni
parents:
264
diff
changeset
|
355 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
|
356 { |
1756 | 357 #if 0 |
358 int t= (a-b)&((a-b)>>31); | |
359 a-=t; | |
360 b+=t; | |
361 b-= (b-c)&((b-c)>>31); | |
362 b+= (a-b)&((a-b)>>31); | |
277
5cb2978e701f
new motion estimation (epzs) not complete yet but allready pretty good :)
michaelni
parents:
264
diff
changeset
|
363 |
1756 | 364 return b; |
365 #else | |
366 if(a>b){ | |
367 if(c>b){ | |
368 if(c>a) b=a; | |
369 else b=c; | |
370 } | |
371 }else{ | |
372 if(b>c){ | |
373 if(c>a) b=c; | |
374 else b=a; | |
375 } | |
376 } | |
377 return b; | |
378 #endif | |
277
5cb2978e701f
new motion estimation (epzs) not complete yet but allready pretty good :)
michaelni
parents:
264
diff
changeset
|
379 } |
5cb2978e701f
new motion estimation (epzs) not complete yet but allready pretty good :)
michaelni
parents:
264
diff
changeset
|
380 |
327 | 381 static inline int clip(int a, int amin, int amax) |
382 { | |
383 if (a < amin) | |
384 return amin; | |
385 else if (a > amax) | |
386 return amax; | |
387 else | |
388 return a; | |
389 } | |
390 | |
1898 | 391 static inline int clip_uint8(int a) |
392 { | |
393 if (a&(~255)) return (-a)>>31; | |
394 else return a; | |
395 } | |
396 | |
324 | 397 /* math */ |
1037 | 398 extern const uint8_t ff_sqrt_tab[128]; |
609 | 399 |
1126
77ccf7fe3bd0
per context frame_rate_base, this should finally fix frame_rate related av sync issues
michaelni
parents:
1124
diff
changeset
|
400 int64_t ff_gcd(int64_t a, int64_t b); |
324 | 401 |
451 | 402 static inline int ff_sqrt(int a) |
403 { | |
404 int ret=0; | |
405 int s; | |
406 int ret_sq=0; | |
609 | 407 |
408 if(a<128) return ff_sqrt_tab[a]; | |
409 | |
451 | 410 for(s=15; s>=0; s--){ |
411 int b= ret_sq + (1<<(s*2)) + (ret<<s)*2; | |
412 if(b<=a){ | |
413 ret_sq=b; | |
414 ret+= 1<<s; | |
415 } | |
416 } | |
417 return ret; | |
418 } | |
701 | 419 |
420 /** | |
421 * converts fourcc string to int | |
422 */ | |
865 | 423 static inline int ff_get_fourcc(const char *s){ |
701 | 424 assert( strlen(s)==4 ); |
1401 | 425 |
701 | 426 return (s[0]) + (s[1]<<8) + (s[2]<<16) + (s[3]<<24); |
427 } | |
428 | |
1139
6842feb093c1
rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
1130
diff
changeset
|
429 #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
|
430 #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
|
431 |
6842feb093c1
rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents:
1130
diff
changeset
|
432 |
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
|
433 #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
|
434 #define MASK_ABS(mask, level)\ |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
701
diff
changeset
|
435 asm volatile(\ |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
701
diff
changeset
|
436 "cdq \n\t"\ |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
701
diff
changeset
|
437 "xorl %1, %0 \n\t"\ |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
701
diff
changeset
|
438 "subl %1, %0 \n\t"\ |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
701
diff
changeset
|
439 : "+a" (level), "=&d" (mask)\ |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
701
diff
changeset
|
440 ); |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
701
diff
changeset
|
441 #else |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
701
diff
changeset
|
442 #define MASK_ABS(mask, level)\ |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
701
diff
changeset
|
443 mask= level>>31;\ |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
701
diff
changeset
|
444 level= (level^mask)-mask; |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
701
diff
changeset
|
445 #endif |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
701
diff
changeset
|
446 |
e65798d228ea
idct permutation cleanup, idct can be selected per context now
michaelni
parents:
701
diff
changeset
|
447 |
451 | 448 #if __CPU__ >= 686 && !defined(RUNTIME_CPUDETECT) |
449 #define COPY3_IF_LT(x,y,a,b,c,d)\ | |
450 asm volatile (\ | |
451 "cmpl %0, %3 \n\t"\ | |
452 "cmovl %3, %0 \n\t"\ | |
453 "cmovl %4, %1 \n\t"\ | |
454 "cmovl %5, %2 \n\t"\ | |
455 : "+r" (x), "+r" (a), "+r" (c)\ | |
456 : "r" (y), "r" (b), "r" (d)\ | |
457 ); | |
458 #else | |
459 #define COPY3_IF_LT(x,y,a,b,c,d)\ | |
460 if((y)<(x)){\ | |
461 (x)=(y);\ | |
462 (a)=(b);\ | |
463 (c)=(d);\ | |
464 } | |
465 #endif | |
466 | |
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
|
467 #if defined(ARCH_X86) || defined(ARCH_X86_64) |
2288 | 468 static inline long long rdtsc(void) |
1281 | 469 { |
470 long long l; | |
471 asm volatile( "rdtsc\n\t" | |
472 : "=A" (l) | |
473 ); | |
474 return l; | |
475 } | |
476 | |
477 #define START_TIMER \ | |
478 uint64_t tend;\ | |
479 uint64_t tstart= rdtsc();\ | |
480 | |
481 #define STOP_TIMER(id) \ | |
482 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
|
483 {\ |
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 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
|
485 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
|
486 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
|
487 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
|
488 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
|
489 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
|
490 }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
|
491 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
|
492 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
|
493 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
|
494 }\ |
1281 | 495 } |
2140 | 496 #else |
497 #define START_TIMER | |
498 #define STOP_TIMER(id) {} | |
1281 | 499 #endif |
500 | |
370
0eca28d16cbd
clamp intra matrix to 8bit for mjpeg (workaround for qscale>=25)
al3x
parents:
359
diff
changeset
|
501 #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
|
502 |
1031
19de1445beb2
use av_malloc() functions - added av_strdup and av_realloc()
bellard
parents:
1025
diff
changeset
|
503 /* avoid usage of various functions */ |
19de1445beb2
use av_malloc() functions - added av_strdup and av_realloc()
bellard
parents:
1025
diff
changeset
|
504 #define malloc please_use_av_malloc |
19de1445beb2
use av_malloc() functions - added av_strdup and av_realloc()
bellard
parents:
1025
diff
changeset
|
505 #define free please_use_av_free |
19de1445beb2
use av_malloc() functions - added av_strdup and av_realloc()
bellard
parents:
1025
diff
changeset
|
506 #define realloc please_use_av_realloc |
1921 | 507 #define time time_is_forbidden_due_to_security_issues |
508 #define rand rand_is_forbidden_due_to_state_trashing | |
509 #define srand srand_is_forbidden_due_to_state_trashing | |
2423 | 510 #define sprintf sprintf_is_forbidden_due_to_security_issues_use_snprintf |
2424 | 511 #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
|
512 #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
|
513 #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
|
514 #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
|
515 #endif |
1031
19de1445beb2
use av_malloc() functions - added av_strdup and av_realloc()
bellard
parents:
1025
diff
changeset
|
516 |
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
|
517 #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
|
518 {\ |
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
|
519 p= av_mallocz(size);\ |
1332 | 520 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
|
521 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
|
522 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
|
523 }\ |
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
|
524 } |
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
|
525 |
488 | 526 #endif /* HAVE_AV_CONFIG_H */ |
527 | |
528 #endif /* COMMON_H */ |