This is a bit hackish. I will try to think of something nicer, but
this will do for now.
Originally committed as revision 22366 to svn://svn.ffmpeg.org/ffmpeg/trunk
... | ... |
@@ -36,11 +36,6 @@ |
36 | 36 |
#include <string.h> |
37 | 37 |
#include "attributes.h" |
38 | 38 |
|
39 |
-#ifdef HAVE_AV_CONFIG_H |
|
40 |
-# include "config.h" |
|
41 |
-# include "intmath.h" |
|
42 |
-#endif |
|
43 |
- |
|
44 | 39 |
//rounded division & shift |
45 | 40 |
#define RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b)) |
46 | 41 |
/* assume b>0 */ |
... | ... |
@@ -62,8 +57,7 @@ extern const uint8_t ff_log2_tab[256]; |
62 | 62 |
|
63 | 63 |
extern const uint8_t av_reverse[256]; |
64 | 64 |
|
65 |
-#ifndef av_log2 |
|
66 |
-static inline av_const int av_log2(unsigned int v) |
|
65 |
+static inline av_const int av_log2_c(unsigned int v) |
|
67 | 66 |
{ |
68 | 67 |
int n = 0; |
69 | 68 |
if (v & 0xffff0000) { |
... | ... |
@@ -78,10 +72,8 @@ static inline av_const int av_log2(unsigned int v) |
78 | 78 |
|
79 | 79 |
return n; |
80 | 80 |
} |
81 |
-#endif |
|
82 | 81 |
|
83 |
-#ifndef av_log2_16bit |
|
84 |
-static inline av_const int av_log2_16bit(unsigned int v) |
|
82 |
+static inline av_const int av_log2_16bit_c(unsigned int v) |
|
85 | 83 |
{ |
86 | 84 |
int n = 0; |
87 | 85 |
if (v & 0xff00) { |
... | ... |
@@ -92,6 +84,17 @@ static inline av_const int av_log2_16bit(unsigned int v) |
92 | 92 |
|
93 | 93 |
return n; |
94 | 94 |
} |
95 |
+ |
|
96 |
+#ifdef HAVE_AV_CONFIG_H |
|
97 |
+# include "config.h" |
|
98 |
+# include "intmath.h" |
|
99 |
+#endif |
|
100 |
+ |
|
101 |
+#ifndef av_log2 |
|
102 |
+# define av_log2 av_log2_c |
|
103 |
+#endif |
|
104 |
+#ifndef av_log2_16bit |
|
105 |
+# define av_log2_16bit av_log2_16bit_c |
|
95 | 106 |
#endif |
96 | 107 |
|
97 | 108 |
/** |
... | ... |
@@ -21,8 +21,9 @@ |
21 | 21 |
#ifndef AVUTIL_INTMATH_H |
22 | 22 |
#define AVUTIL_INTMATH_H |
23 | 23 |
|
24 |
+#include <stdint.h> |
|
24 | 25 |
#include "config.h" |
25 |
-#include "common.h" |
|
26 |
+#include "attributes.h" |
|
26 | 27 |
|
27 | 28 |
extern const uint32_t ff_inverse[257]; |
28 | 29 |
|
... | ... |
@@ -56,6 +57,22 @@ extern const uint32_t ff_inverse[257]; |
56 | 56 |
|
57 | 57 |
#endif /* FASTDIV */ |
58 | 58 |
|
59 |
+/* |
|
60 |
+ * Get definition of av_log2_c from common.h. In the event we got |
|
61 |
+ * here through common.h including this file, including it again will |
|
62 |
+ * be a no-op due to multi-inclusion guards, so we must duplicate the |
|
63 |
+ * fallback defines here. |
|
64 |
+ */ |
|
65 |
+ |
|
66 |
+#include "common.h" |
|
67 |
+ |
|
68 |
+#ifndef av_log2 |
|
69 |
+# define av_log2 av_log2_c |
|
70 |
+#endif |
|
71 |
+#ifndef av_log2_16bit |
|
72 |
+# define av_log2_16bit av_log2_16bit_c |
|
73 |
+#endif |
|
74 |
+ |
|
59 | 75 |
extern const uint8_t ff_sqrt_tab[256]; |
60 | 76 |
|
61 | 77 |
static inline av_const unsigned int ff_sqrt(unsigned int a) |