Commit 545dc699 authored by Jason Garrett-Glaser's avatar Jason Garrett-Glaser Committed by Michael Niedermayer

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 eb3755a5)
parent 8e624c1c
......@@ -31,7 +31,7 @@
#if HAVE_ARMV6
#define FASTDIV FASTDIV
static inline av_const int FASTDIV(int a, int b)
static av_always_inline av_const int FASTDIV(int a, int b)
{
int r, t;
__asm__ volatile("cmp %3, #2 \n\t"
......@@ -43,7 +43,7 @@ static inline av_const int FASTDIV(int a, int b)
}
#define av_clip_uint8 av_clip_uint8_arm
static inline av_const uint8_t av_clip_uint8_arm(int a)
static av_always_inline av_const uint8_t av_clip_uint8_arm(int a)
{
unsigned x;
__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)
}
#define av_clip_int8 av_clip_int8_arm
static inline av_const uint8_t av_clip_int8_arm(int a)
static av_always_inline av_const uint8_t av_clip_int8_arm(int a)
{
unsigned x;
__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)
}
#define av_clip_uint16 av_clip_uint16_arm
static inline av_const uint16_t av_clip_uint16_arm(int a)
static av_always_inline av_const uint16_t av_clip_uint16_arm(int a)
{
unsigned x;
__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)
}
#define av_clip_int16 av_clip_int16_arm
static inline av_const int16_t av_clip_int16_arm(int a)
static av_always_inline av_const int16_t av_clip_int16_arm(int a)
{
int x;
__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)
#else /* HAVE_ARMV6 */
#define FASTDIV FASTDIV
static inline av_const int FASTDIV(int a, int b)
static av_always_inline av_const int FASTDIV(int a, int b)
{
int r, t;
__asm__ volatile("umull %1, %0, %2, %3"
......@@ -88,7 +88,7 @@ static inline av_const int FASTDIV(int a, int b)
#endif /* HAVE_ARMV6 */
#define av_clipl_int32 av_clipl_int32_arm
static inline av_const int32_t av_clipl_int32_arm(int64_t a)
static av_always_inline av_const int32_t av_clipl_int32_arm(int64_t a)
{
int x, y;
__asm__ volatile ("adds %1, %R2, %Q2, lsr #31 \n\t"
......
......@@ -64,7 +64,7 @@ extern const uint8_t ff_log2_tab[256];
extern const uint8_t av_reverse[256];
static inline av_const int av_log2_c(unsigned int v)
static av_always_inline av_const int av_log2_c(unsigned int v)
{
int n = 0;
if (v & 0xffff0000) {
......@@ -80,7 +80,7 @@ static inline av_const int av_log2_c(unsigned int v)
return n;
}
static inline av_const int av_log2_16bit_c(unsigned int v)
static av_always_inline av_const int av_log2_16bit_c(unsigned int v)
{
int n = 0;
if (v & 0xff00) {
......@@ -107,7 +107,7 @@ static inline av_const int av_log2_16bit_c(unsigned int v)
* @param amax maximum value of the clip range
* @return clipped value
*/
static inline av_const int av_clip_c(int a, int amin, int amax)
static av_always_inline av_const int av_clip_c(int a, int amin, int amax)
{
if (a < amin) return amin;
else if (a > amax) return amax;
......@@ -119,7 +119,7 @@ static inline av_const int av_clip_c(int a, int amin, int amax)
* @param a value to clip
* @return clipped value
*/
static inline av_const uint8_t av_clip_uint8_c(int a)
static av_always_inline av_const uint8_t av_clip_uint8_c(int a)
{
if (a&(~0xFF)) return (-a)>>31;
else return a;
......@@ -130,7 +130,7 @@ static inline av_const uint8_t av_clip_uint8_c(int a)
* @param a value to clip
* @return clipped value
*/
static inline av_const int8_t av_clip_int8_c(int a)
static av_always_inline av_const int8_t av_clip_int8_c(int a)
{
if ((a+0x80) & ~0xFF) return (a>>31) ^ 0x7F;
else return a;
......@@ -141,7 +141,7 @@ static inline av_const int8_t av_clip_int8_c(int a)
* @param a value to clip
* @return clipped value
*/
static inline av_const uint16_t av_clip_uint16_c(int a)
static av_always_inline av_const uint16_t av_clip_uint16_c(int a)
{
if (a&(~0xFFFF)) return (-a)>>31;
else return a;
......@@ -152,7 +152,7 @@ static inline av_const uint16_t av_clip_uint16_c(int a)
* @param a value to clip
* @return clipped value
*/
static inline av_const int16_t av_clip_int16_c(int a)
static av_always_inline av_const int16_t av_clip_int16_c(int a)
{
if ((a+0x8000) & ~0xFFFF) return (a>>31) ^ 0x7FFF;
else return a;
......@@ -163,7 +163,7 @@ static inline av_const int16_t av_clip_int16_c(int a)
* @param a value to clip
* @return clipped value
*/
static inline av_const int32_t av_clipl_int32_c(int64_t a)
static av_always_inline av_const int32_t av_clipl_int32_c(int64_t a)
{
if ((a+0x80000000u) & ~UINT64_C(0xFFFFFFFF)) return (a>>63) ^ 0x7FFFFFFF;
else return a;
......@@ -176,7 +176,7 @@ static inline av_const int32_t av_clipl_int32_c(int64_t a)
* @param amax maximum value of the clip range
* @return clipped value
*/
static inline av_const float av_clipf_c(float a, float amin, float amax)
static av_always_inline av_const float av_clipf_c(float a, float amin, float amax)
{
if (a < amin) return amin;
else if (a > amax) return amax;
......@@ -187,7 +187,7 @@ static inline av_const float av_clipf_c(float a, float amin, float amax)
* @param x value used to compute ceil(log2(x))
* @return computed ceiling of log2(x)
*/
static inline av_const int av_ceil_log2_c(int x)
static av_always_inline av_const int av_ceil_log2_c(int x)
{
return av_log2((x - 1) << 1);
}
......@@ -197,7 +197,7 @@ static inline av_const int av_ceil_log2_c(int x)
* @param x value to count bits of
* @return the number of bits set to one in x
*/
static inline av_const int av_popcount_c(uint32_t x)
static av_always_inline av_const int av_popcount_c(uint32_t x)
{
x -= (x >> 1) & 0x55555555;
x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment