History

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 committed 15 years ago

Commit 545dc691 parent 8e624c12 files · +18 −18Browse files

Unified · Split

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

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t