Use configure checks for various inline keywords.

Change-Id: I8508f1a3d3430f998bb9295f849e88e626a52a24
This commit is contained in:
Ronald S. Bultje 2013-02-06 12:45:28 -08:00
parent a788e0fe63
commit aac73df1a7
13 changed files with 104 additions and 91 deletions

View File

@ -460,6 +460,7 @@ write_common_target_config_h() {
#ifndef VPX_CONFIG_H
#define VPX_CONFIG_H
#define RESTRICT ${RESTRICT}
#define INLINE ${INLINE}
EOF
print_config_h ARCH "${TMP_H}" ${ARCH_LIST}
print_config_h HAVE "${TMP_H}" ${HAVE_LIST}
@ -1160,6 +1161,14 @@ EOF
[ -f "${TMP_O}" ] && od -A n -t x1 "${TMP_O}" | tr -d '\n' |
grep '4f *32 *42 *45' >/dev/null 2>&1 && enable big_endian
# Try to find which inline keywords are supported
check_cc <<EOF && INLINE="inline"
static inline function() {}
EOF
check_cc <<EOF && INLINE="__attribute__((always_inline))"
static __attribute__((always_inline)) function() {}
EOF
# Almost every platform uses pthreads.
if enabled multithread; then
case ${toolchain} in

1
configure vendored
View File

@ -644,6 +644,7 @@ process_toolchain() {
enable solution
vs_version=${tgt_cc##vs}
all_targets="${all_targets} solution"
INLINE="__forceinline"
;;
esac

View File

@ -42,7 +42,7 @@
#define vp9_zero_array(Dest, N) vpx_memset(Dest, 0, N * sizeof(*Dest));
static __inline uint8_t clip_pixel(int val) {
static INLINE uint8_t clip_pixel(int val) {
return (val > 255) ? 255u : (val < 0) ? 0u : val;
}

View File

@ -495,7 +495,7 @@ static const int cospi_29_64 = 2404;
static const int cospi_30_64 = 1606;
static const int cospi_31_64 = 804;
static inline int dct_const_round_shift(int input) {
static INLINE int dct_const_round_shift(int input) {
int rv = (input + DCT_CONST_ROUNDING) >> DCT_CONST_BITS;
assert((rv <= INT16_MAX) && (rv >= INT16_MIN));
return rv;

View File

@ -13,7 +13,7 @@
#include "vp9/common/vp9_loopfilter.h"
#include "vp9/common/vp9_onyxc_int.h"
static __inline int8_t signed_char_clamp(int t) {
static INLINE int8_t signed_char_clamp(int t) {
t = (t < -128 ? -128 : t);
t = (t > 127 ? 127 : t);
return (int8_t) t;
@ -21,7 +21,7 @@ static __inline int8_t signed_char_clamp(int t) {
/* should we apply any filter at all ( 11111111 yes, 00000000 no) */
static __inline int8_t filter_mask(uint8_t limit, uint8_t blimit,
static INLINE int8_t filter_mask(uint8_t limit, uint8_t blimit,
uint8_t p3, uint8_t p2,
uint8_t p1, uint8_t p0,
uint8_t q0, uint8_t q1,
@ -39,7 +39,7 @@ static __inline int8_t filter_mask(uint8_t limit, uint8_t blimit,
}
/* is there high variance internal edge ( 11111111 yes, 00000000 no) */
static __inline int8_t hevmask(uint8_t thresh, uint8_t p1, uint8_t p0,
static INLINE int8_t hevmask(uint8_t thresh, uint8_t p1, uint8_t p0,
uint8_t q0, uint8_t q1) {
int8_t hev = 0;
hev |= (abs(p1 - p0) > thresh) * -1;
@ -47,7 +47,7 @@ static __inline int8_t hevmask(uint8_t thresh, uint8_t p1, uint8_t p0,
return hev;
}
static __inline void filter(int8_t mask, uint8_t hev, uint8_t *op1,
static INLINE void filter(int8_t mask, uint8_t hev, uint8_t *op1,
uint8_t *op0, uint8_t *oq0, uint8_t *oq1) {
int8_t ps0, qs0;
int8_t ps1, qs1;
@ -143,7 +143,7 @@ void vp9_loop_filter_vertical_edge_c(uint8_t *s,
s += p;
} while (++i < count * 8);
}
static __inline signed char flatmask4(uint8_t thresh,
static INLINE signed char flatmask4(uint8_t thresh,
uint8_t p3, uint8_t p2,
uint8_t p1, uint8_t p0,
uint8_t q0, uint8_t q1,
@ -158,7 +158,7 @@ static __inline signed char flatmask4(uint8_t thresh,
flat = ~flat;
return flat;
}
static __inline signed char flatmask5(uint8_t thresh,
static INLINE signed char flatmask5(uint8_t thresh,
uint8_t p4, uint8_t p3, uint8_t p2,
uint8_t p1, uint8_t p0,
uint8_t q0, uint8_t q1, uint8_t q2,
@ -171,7 +171,7 @@ static __inline signed char flatmask5(uint8_t thresh,
}
static __inline void mbfilter(int8_t mask, uint8_t hev, uint8_t flat,
static INLINE void mbfilter(int8_t mask, uint8_t hev, uint8_t flat,
uint8_t *op3, uint8_t *op2,
uint8_t *op1, uint8_t *op0,
uint8_t *oq0, uint8_t *oq1,
@ -301,7 +301,7 @@ void vp9_mbloop_filter_vertical_edge_c(uint8_t *s,
}
/* should we apply any filter at all ( 11111111 yes, 00000000 no) */
static __inline int8_t simple_filter_mask(uint8_t blimit,
static INLINE int8_t simple_filter_mask(uint8_t blimit,
uint8_t p1, uint8_t p0,
uint8_t q0, uint8_t q1) {
/* Why does this cause problems for win32?
@ -312,7 +312,7 @@ static __inline int8_t simple_filter_mask(uint8_t blimit,
return mask;
}
static __inline void simple_filter(int8_t mask,
static INLINE void simple_filter(int8_t mask,
uint8_t *op1, uint8_t *op0,
uint8_t *oq0, uint8_t *oq1) {
int8_t filter, Filter1, Filter2;
@ -487,7 +487,7 @@ void vp9_loop_filter_bvs_c(uint8_t *y_ptr, int y_stride,
vp9_loop_filter_simple_vertical_edge_c(y_ptr + 12, y_stride, blimit);
}
static __inline void wide_mbfilter(int8_t mask, uint8_t hev,
static INLINE void wide_mbfilter(int8_t mask, uint8_t hev,
uint8_t flat, uint8_t flat2,
uint8_t *op7, uint8_t *op6, uint8_t *op5,
uint8_t *op4, uint8_t *op3, uint8_t *op2,

View File

@ -16,6 +16,7 @@ extern "C"
{
#endif
#include "./vpx_config.h"
#include "vpx/internal/vpx_codec_internal.h"
#include "vpx/vp8cx.h"
#include "vpx_scale/yv12config.h"
@ -62,7 +63,7 @@ extern "C"
#include <assert.h>
static __inline void Scale2Ratio(int mode, int *hr, int *hs) {
static INLINE void Scale2Ratio(int mode, int *hr, int *hs) {
switch (mode) {
case NORMAL:
*hr = 1;

View File

@ -11,9 +11,10 @@
#ifndef VP9_COMMON_VP9_SADMXN_H_
#define VP9_COMMON_VP9_SADMXN_H_
#include "./vpx_config.h"
#include "vpx/vpx_integer.h"
static __inline unsigned int sad_mx_n_c(const uint8_t *src_ptr,
static INLINE unsigned int sad_mx_n_c(const uint8_t *src_ptr,
int src_stride,
const uint8_t *ref_ptr,
int ref_stride,

View File

@ -11,6 +11,7 @@
#ifndef VP9_COMMON_VP9_TREECODER_H_
#define VP9_COMMON_VP9_TREECODER_H_
#include "./vpx_config.h"
#include "vpx/vpx_integer.h"
typedef uint8_t vp9_prob;
@ -53,20 +54,20 @@ void vp9_tree_probs_from_distribution(int n, /* n = size of alphabet */
unsigned int branch_ct[ /* n - 1 */ ][2],
const unsigned int num_events[ /* n */ ]);
static __inline vp9_prob clip_prob(int p) {
static INLINE vp9_prob clip_prob(int p) {
return (p > 255) ? 255u : (p < 1) ? 1u : p;
}
static __inline vp9_prob get_prob(int num, int den) {
static INLINE vp9_prob get_prob(int num, int den) {
return (den == 0) ? 128u : clip_prob((num * 256 + (den >> 1)) / den);
}
static __inline vp9_prob get_binary_prob(int n0, int n1) {
static INLINE vp9_prob get_binary_prob(int n0, int n1) {
return get_prob(n0, n0 + n1);
}
/* this function assumes prob1 and prob2 are already within [1,255] range */
static __inline vp9_prob weighted_prob(int prob1, int prob2, int factor) {
static INLINE vp9_prob weighted_prob(int prob1, int prob2, int factor) {
return (prob1 * (256 - factor) + prob2 * factor + 128) >> 8;
}

View File

@ -871,7 +871,7 @@ void vp9_mbloop_filter_horizontal_edge_uv_sse2(unsigned char *u,
_mm_loadl_epi64((__m128i *)(src + 120)));
}
static __inline void transpose8x16(unsigned char *in0, unsigned char *in1,
static INLINE void transpose8x16(unsigned char *in0, unsigned char *in1,
int in_p, unsigned char *out, int out_p) {
__m128i x0, x1, x2, x3, x4, x5, x6, x7;
__m128i x8, x9, x10, x11, x12, x13, x14, x15;
@ -937,7 +937,7 @@ static __inline void transpose8x16(unsigned char *in0, unsigned char *in1,
_mm_storeu_si128((__m128i *)(out + 7 * out_p), _mm_unpackhi_epi64(x7, x15));
}
static __inline void transpose(unsigned char *src[], int in_p,
static INLINE void transpose(unsigned char *src[], int in_p,
unsigned char *dst[], int out_p,
int num_8x8_to_transpose) {
int idx8x8 = 0;

View File

@ -763,7 +763,7 @@ static const int cospi_29_64 = 2404;
static const int cospi_30_64 = 1606;
static const int cospi_31_64 = 804;
static inline int dct_const_round_shift(int input) {
static INLINE int dct_const_round_shift(int input) {
int rv = (input + DCT_CONST_ROUNDING) >> DCT_CONST_BITS;
assert((rv <= INT16_MAX) && (rv >= INT16_MIN));
return rv;

View File

@ -2368,8 +2368,7 @@ typedef struct {
} BEST_SEG_INFO;
static __inline
int mv_check_bounds(MACROBLOCK *x, int_mv *mv) {
static INLINE int mv_check_bounds(MACROBLOCK *x, int_mv *mv) {
int r = 0;
r |= (mv->as_mv.row >> 3) < x->mv_row_min;
r |= (mv->as_mv.row >> 3) > x->mv_row_max;
@ -2744,7 +2743,7 @@ static void rd_check_segment(VP9_COMP *cpi, MACROBLOCK *x,
}
}
static __inline void cal_step_param(int sr, int *sp) {
static INLINE void cal_step_param(int sr, int *sp) {
int step = 0;
if (sr > MAX_FIRST_STEP) sr = MAX_FIRST_STEP;
@ -3011,7 +3010,8 @@ static void estimate_curframe_refprobs(VP9_COMP *cpi, vp9_prob mod_refprobs[3],
}
}
static __inline unsigned weighted_cost(vp9_prob *tab0, vp9_prob *tab1, int idx, int val, int weight) {
static INLINE unsigned weighted_cost(vp9_prob *tab0, vp9_prob *tab1,
int idx, int val, int weight) {
unsigned cost0 = tab0[idx] ? vp9_cost_bit(tab0[idx], val) : 0;
unsigned cost1 = tab1[idx] ? vp9_cost_bit(tab1[idx], val) : 0;
// weight is 16-bit fixed point, so this basically calculates:

View File

@ -714,7 +714,7 @@ void vp9_tokenize_initialize() {
fill_value_tokens();
}
static __inline void stuff_b(VP9_COMP *cpi,
static INLINE void stuff_b(VP9_COMP *cpi,
MACROBLOCKD *xd,
const int ib,
TOKENEXTRA **tp,

View File

@ -37,14 +37,14 @@ typedef BOOL_CODER vp9_writer;
/* Both of these return bits, not scaled bits. */
static __inline unsigned int cost_branch(const unsigned int ct[2],
static INLINE unsigned int cost_branch(const unsigned int ct[2],
vp9_prob p) {
/* Imitate existing calculation */
return ((ct[0] * vp9_cost_zero(p))
+ (ct[1] * vp9_cost_one(p))) >> 8;
}
static __inline unsigned int cost_branch256(const unsigned int ct[2],
static INLINE unsigned int cost_branch256(const unsigned int ct[2],
vp9_prob p) {
/* Imitate existing calculation */
return ((ct[0] * vp9_cost_zero(p))
@ -54,7 +54,7 @@ static __inline unsigned int cost_branch256(const unsigned int ct[2],
/* Small functions to write explicit values and tokens, as well as
estimate their lengths. */
static __inline void treed_write(vp9_writer *const w,
static INLINE void treed_write(vp9_writer *const w,
vp9_tree t,
const vp9_prob *const p,
int v,
@ -69,14 +69,14 @@ static __inline void treed_write(vp9_writer *const w,
} while (n);
}
static __inline void write_token(vp9_writer *const w,
static INLINE void write_token(vp9_writer *const w,
vp9_tree t,
const vp9_prob *const p,
vp9_token *const x) {
treed_write(w, t, p, x->value, x->Len);
}
static __inline int treed_cost(vp9_tree t,
static INLINE int treed_cost(vp9_tree t,
const vp9_prob *const p,
int v,
/* number of bits in v, assumed nonzero */
@ -93,7 +93,7 @@ static __inline int treed_cost(vp9_tree t,
return c;
}
static __inline int cost_token(vp9_tree t,
static INLINE int cost_token(vp9_tree t,
const vp9_prob *const p,
vp9_token *const x) {
return treed_cost(t, p, x->value, x->Len);