Commit aac73df1 authored by Ronald S. Bultje's avatar Ronald S. Bultje

Use configure checks for various inline keywords.

Change-Id: I8508f1a3d3430f998bb9295f849e88e626a52a24
parent a788e0fe
......@@ -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
......
......@@ -644,6 +644,7 @@ process_toolchain() {
enable solution
vs_version=${tgt_cc##vs}
all_targets="${all_targets} solution"
INLINE="__forceinline"
;;
esac
......
......@@ -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;
}
......
......@@ -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;
......
......@@ -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,11 +21,11 @@ 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,
uint8_t p3, uint8_t p2,
uint8_t p1, uint8_t p0,
uint8_t q0, uint8_t q1,
uint8_t q2, uint8_t q3) {
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,
uint8_t q2, uint8_t q3) {
int8_t mask = 0;
mask |= (abs(p3 - p2) > limit) * -1;
mask |= (abs(p2 - p1) > limit) * -1;
......@@ -39,16 +39,16 @@ 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,
uint8_t q0, uint8_t q1) {
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;
hev |= (abs(q1 - q0) > thresh) * -1;
return hev;
}
static __inline void filter(int8_t mask, uint8_t hev, uint8_t *op1,
uint8_t *op0, uint8_t *oq0, uint8_t *oq1) {
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;
int8_t filter, Filter1, Filter2;
......@@ -143,11 +143,11 @@ void vp9_loop_filter_vertical_edge_c(uint8_t *s,
s += p;
} while (++i < count * 8);
}
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,
uint8_t q2, uint8_t q3) {
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,
uint8_t q2, uint8_t q3) {
int8_t flat = 0;
flat |= (abs(p1 - p0) > thresh) * -1;
flat |= (abs(q1 - q0) > thresh) * -1;
......@@ -158,11 +158,11 @@ static __inline signed char flatmask4(uint8_t thresh,
flat = ~flat;
return flat;
}
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,
uint8_t q3, uint8_t q4) {
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,
uint8_t q3, uint8_t q4) {
int8_t flat = 0;
flat |= (abs(p4 - p0) > thresh) * -1;
flat |= (abs(q4 - q0) > thresh) * -1;
......@@ -171,11 +171,11 @@ static __inline signed char flatmask5(uint8_t thresh,
}
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,
uint8_t *oq2, uint8_t *oq3) {
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,
uint8_t *oq2, uint8_t *oq3) {
/* use a 7 tap filter [1, 1, 1, 2, 1, 1, 1] for flat line */
if (flat && mask) {
uint8_t p0, q0;
......@@ -301,9 +301,9 @@ 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,
uint8_t p1, uint8_t p0,
uint8_t q0, uint8_t q1) {
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?
* error C2143: syntax error : missing ';' before 'type'
* (void) limit;
......@@ -312,9 +312,9 @@ static __inline int8_t simple_filter_mask(uint8_t blimit,
return mask;
}
static __inline void simple_filter(int8_t mask,
uint8_t *op1, uint8_t *op0,
uint8_t *oq0, uint8_t *oq1) {
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;
int8_t p1 = (int8_t) *op1 ^ 0x80;
int8_t p0 = (int8_t) *op0 ^ 0x80;
......@@ -487,14 +487,14 @@ 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,
uint8_t flat, uint8_t flat2,
uint8_t *op7, uint8_t *op6, uint8_t *op5,
uint8_t *op4, uint8_t *op3, uint8_t *op2,
uint8_t *op1, uint8_t *op0, uint8_t *oq0,
uint8_t *oq1, uint8_t *oq2, uint8_t *oq3,
uint8_t *oq4, uint8_t *oq5, uint8_t *oq6,
uint8_t *oq7) {
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,
uint8_t *op1, uint8_t *op0, uint8_t *oq0,
uint8_t *oq1, uint8_t *oq2, uint8_t *oq3,
uint8_t *oq4, uint8_t *oq5, uint8_t *oq6,
uint8_t *oq7) {
/* use a 15 tap filter [1,1,1,1,1,1,1,2,1,1,1,1,1,1,1] for flat line */
if (flat2 && flat && mask) {
uint8_t p0, q0;
......
......@@ -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;
......
......@@ -11,14 +11,15 @@
#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,
int src_stride,
const uint8_t *ref_ptr,
int ref_stride,
int m,
int n) {
static INLINE unsigned int sad_mx_n_c(const uint8_t *src_ptr,
int src_stride,
const uint8_t *ref_ptr,
int ref_stride,
int m,
int n) {
int r, c;
unsigned int sad = 0;
......
......@@ -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;
}
......
......@@ -871,8 +871,8 @@ 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,
int in_p, unsigned char *out, int out_p) {
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,9 +937,9 @@ 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,
unsigned char *dst[], int out_p,
int num_8x8_to_transpose) {
static INLINE void transpose(unsigned char *src[], int in_p,
unsigned char *dst[], int out_p,
int num_8x8_to_transpose) {
int idx8x8 = 0;
__m128i x0, x1, x2, x3, x4, x5, x6, x7;
do {
......
......@@ -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;
......
......@@ -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:
......
......@@ -714,13 +714,13 @@ void vp9_tokenize_initialize() {
fill_value_tokens();
}
static __inline void stuff_b(VP9_COMP *cpi,
MACROBLOCKD *xd,
const int ib,
TOKENEXTRA **tp,
PLANE_TYPE type,
TX_SIZE tx_size,
int dry_run) {
static INLINE void stuff_b(VP9_COMP *cpi,
MACROBLOCKD *xd,
const int ib,
TOKENEXTRA **tp,
PLANE_TYPE type,
TX_SIZE tx_size,
int dry_run) {
const BLOCKD * const b = xd->block + ib;
const int *bands;
vp9_coeff_count *counts;
......
......@@ -37,15 +37,15 @@ typedef BOOL_CODER vp9_writer;
/* Both of these return bits, not scaled bits. */
static __inline unsigned int cost_branch(const unsigned int ct[2],
vp9_prob p) {
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],
vp9_prob p) {
static INLINE unsigned int cost_branch256(const unsigned int ct[2],
vp9_prob p) {
/* Imitate existing calculation */
return ((ct[0] * vp9_cost_zero(p))
+ (ct[1] * vp9_cost_one(p)));
......@@ -54,12 +54,12 @@ 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,
vp9_tree t,
const vp9_prob *const p,
int v,
/* number of bits in v, assumed nonzero */
int n) {
static INLINE void treed_write(vp9_writer *const w,
vp9_tree t,
const vp9_prob *const p,
int v,
/* number of bits in v, assumed nonzero */
int n) {
vp9_tree_index i = 0;
do {
......@@ -69,18 +69,18 @@ static __inline void treed_write(vp9_writer *const w,
} while (n);
}
static __inline void write_token(vp9_writer *const w,
vp9_tree t,
const vp9_prob *const p,
vp9_token *const x) {
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,
const vp9_prob *const p,
int v,
/* number of bits in v, assumed nonzero */
int n) {
static INLINE int treed_cost(vp9_tree t,
const vp9_prob *const p,
int v,
/* number of bits in v, assumed nonzero */
int n) {
int c = 0;
vp9_tree_index i = 0;
......@@ -93,9 +93,9 @@ static __inline int treed_cost(vp9_tree t,
return c;
}
static __inline int cost_token(vp9_tree t,
const vp9_prob *const p,
vp9_token *const x) {
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);
}
......
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