Browse code

Force inlining of avutil common routines

On some versions of gcc, these weren't always getting inlined due to hitting
the inline cap limit in some files. This is generally bad, as most of these
functions are smaller inlined than not.
(cherry picked from commit eb3755a5aa65da685d81399cfae4bd35e4a178b6)

Jason Garrett-Glaser authored on 2011/02/17 03:20:54
Showing 2 changed files
... ...
@@ -31,7 +31,7 @@
31 31
 #if HAVE_ARMV6
32 32
 
33 33
 #define FASTDIV FASTDIV
34
-static inline av_const int FASTDIV(int a, int b)
34
+static av_always_inline av_const int FASTDIV(int a, int b)
35 35
 {
36 36
     int r, t;
37 37
     __asm__ volatile("cmp     %3, #2               \n\t"
... ...
@@ -43,7 +43,7 @@ static inline av_const int FASTDIV(int a, int b)
43 43
 }
44 44
 
45 45
 #define av_clip_uint8 av_clip_uint8_arm
46
-static inline av_const uint8_t av_clip_uint8_arm(int a)
46
+static av_always_inline av_const uint8_t av_clip_uint8_arm(int a)
47 47
 {
48 48
     unsigned x;
49 49
     __asm__ volatile ("usat %0, #8,  %1" : "=r"(x) : "r"(a));
... ...
@@ -51,7 +51,7 @@ static inline av_const uint8_t av_clip_uint8_arm(int a)
51 51
 }
52 52
 
53 53
 #define av_clip_int8 av_clip_int8_arm
54
-static inline av_const uint8_t av_clip_int8_arm(int a)
54
+static av_always_inline av_const uint8_t av_clip_int8_arm(int a)
55 55
 {
56 56
     unsigned x;
57 57
     __asm__ volatile ("ssat %0, #8,  %1" : "=r"(x) : "r"(a));
... ...
@@ -59,7 +59,7 @@ static inline av_const uint8_t av_clip_int8_arm(int a)
59 59
 }
60 60
 
61 61
 #define av_clip_uint16 av_clip_uint16_arm
62
-static inline av_const uint16_t av_clip_uint16_arm(int a)
62
+static av_always_inline av_const uint16_t av_clip_uint16_arm(int a)
63 63
 {
64 64
     unsigned x;
65 65
     __asm__ volatile ("usat %0, #16, %1" : "=r"(x) : "r"(a));
... ...
@@ -67,7 +67,7 @@ static inline av_const uint16_t av_clip_uint16_arm(int a)
67 67
 }
68 68
 
69 69
 #define av_clip_int16 av_clip_int16_arm
70
-static inline av_const int16_t av_clip_int16_arm(int a)
70
+static av_always_inline av_const int16_t av_clip_int16_arm(int a)
71 71
 {
72 72
     int x;
73 73
     __asm__ volatile ("ssat %0, #16, %1" : "=r"(x) : "r"(a));
... ...
@@ -77,7 +77,7 @@ static inline av_const int16_t av_clip_int16_arm(int a)
77 77
 #else /* HAVE_ARMV6 */
78 78
 
79 79
 #define FASTDIV FASTDIV
80
-static inline av_const int FASTDIV(int a, int b)
80
+static av_always_inline av_const int FASTDIV(int a, int b)
81 81
 {
82 82
     int r, t;
83 83
     __asm__ volatile("umull %1, %0, %2, %3"
... ...
@@ -88,7 +88,7 @@ static inline av_const int FASTDIV(int a, int b)
88 88
 #endif /* HAVE_ARMV6 */
89 89
 
90 90
 #define av_clipl_int32 av_clipl_int32_arm
91
-static inline av_const int32_t av_clipl_int32_arm(int64_t a)
91
+static av_always_inline av_const int32_t av_clipl_int32_arm(int64_t a)
92 92
 {
93 93
     int x, y;
94 94
     __asm__ volatile ("adds   %1, %R2, %Q2, lsr #31  \n\t"
... ...
@@ -64,7 +64,7 @@ extern const uint8_t ff_log2_tab[256];
64 64
 
65 65
 extern const uint8_t av_reverse[256];
66 66
 
67
-static inline av_const int av_log2_c(unsigned int v)
67
+static av_always_inline av_const int av_log2_c(unsigned int v)
68 68
 {
69 69
     int n = 0;
70 70
     if (v & 0xffff0000) {
... ...
@@ -80,7 +80,7 @@ static inline av_const int av_log2_c(unsigned int v)
80 80
     return n;
81 81
 }
82 82
 
83
-static inline av_const int av_log2_16bit_c(unsigned int v)
83
+static av_always_inline av_const int av_log2_16bit_c(unsigned int v)
84 84
 {
85 85
     int n = 0;
86 86
     if (v & 0xff00) {
... ...
@@ -107,7 +107,7 @@ static inline av_const int av_log2_16bit_c(unsigned int v)
107 107
  * @param amax maximum value of the clip range
108 108
  * @return clipped value
109 109
  */
110
-static inline av_const int av_clip_c(int a, int amin, int amax)
110
+static av_always_inline av_const int av_clip_c(int a, int amin, int amax)
111 111
 {
112 112
     if      (a < amin) return amin;
113 113
     else if (a > amax) return amax;
... ...
@@ -119,7 +119,7 @@ static inline av_const int av_clip_c(int a, int amin, int amax)
119 119
  * @param a value to clip
120 120
  * @return clipped value
121 121
  */
122
-static inline av_const uint8_t av_clip_uint8_c(int a)
122
+static av_always_inline av_const uint8_t av_clip_uint8_c(int a)
123 123
 {
124 124
     if (a&(~0xFF)) return (-a)>>31;
125 125
     else           return a;
... ...
@@ -130,7 +130,7 @@ static inline av_const uint8_t av_clip_uint8_c(int a)
130 130
  * @param a value to clip
131 131
  * @return clipped value
132 132
  */
133
-static inline av_const int8_t av_clip_int8_c(int a)
133
+static av_always_inline av_const int8_t av_clip_int8_c(int a)
134 134
 {
135 135
     if ((a+0x80) & ~0xFF) return (a>>31) ^ 0x7F;
136 136
     else                  return a;
... ...
@@ -141,7 +141,7 @@ static inline av_const int8_t av_clip_int8_c(int a)
141 141
  * @param a value to clip
142 142
  * @return clipped value
143 143
  */
144
-static inline av_const uint16_t av_clip_uint16_c(int a)
144
+static av_always_inline av_const uint16_t av_clip_uint16_c(int a)
145 145
 {
146 146
     if (a&(~0xFFFF)) return (-a)>>31;
147 147
     else             return a;
... ...
@@ -152,7 +152,7 @@ static inline av_const uint16_t av_clip_uint16_c(int a)
152 152
  * @param a value to clip
153 153
  * @return clipped value
154 154
  */
155
-static inline av_const int16_t av_clip_int16_c(int a)
155
+static av_always_inline av_const int16_t av_clip_int16_c(int a)
156 156
 {
157 157
     if ((a+0x8000) & ~0xFFFF) return (a>>31) ^ 0x7FFF;
158 158
     else                      return a;
... ...
@@ -163,7 +163,7 @@ static inline av_const int16_t av_clip_int16_c(int a)
163 163
  * @param a value to clip
164 164
  * @return clipped value
165 165
  */
166
-static inline av_const int32_t av_clipl_int32_c(int64_t a)
166
+static av_always_inline av_const int32_t av_clipl_int32_c(int64_t a)
167 167
 {
168 168
     if ((a+0x80000000u) & ~UINT64_C(0xFFFFFFFF)) return (a>>63) ^ 0x7FFFFFFF;
169 169
     else                                         return a;
... ...
@@ -176,7 +176,7 @@ static inline av_const int32_t av_clipl_int32_c(int64_t a)
176 176
  * @param amax maximum value of the clip range
177 177
  * @return clipped value
178 178
  */
179
-static inline av_const float av_clipf_c(float a, float amin, float amax)
179
+static av_always_inline av_const float av_clipf_c(float a, float amin, float amax)
180 180
 {
181 181
     if      (a < amin) return amin;
182 182
     else if (a > amax) return amax;
... ...
@@ -187,7 +187,7 @@ static inline av_const float av_clipf_c(float a, float amin, float amax)
187 187
  * @param x value used to compute ceil(log2(x))
188 188
  * @return computed ceiling of log2(x)
189 189
  */
190
-static inline av_const int av_ceil_log2_c(int x)
190
+static av_always_inline av_const int av_ceil_log2_c(int x)
191 191
 {
192 192
     return av_log2((x - 1) << 1);
193 193
 }
... ...
@@ -197,7 +197,7 @@ static inline av_const int av_ceil_log2_c(int x)
197 197
  * @param x value to count bits of
198 198
  * @return the number of bits set to one in x
199 199
  */
200
-static inline av_const int av_popcount_c(uint32_t x)
200
+static av_always_inline av_const int av_popcount_c(uint32_t x)
201 201
 {
202 202
     x -= (x >> 1) & 0x55555555;
203 203
     x = (x & 0x33333333) + ((x >> 2) & 0x33333333);