]> granicus.if.org Git - libvpx/commitdiff
Use configure checks for various inline keywords.
authorRonald S. Bultje <rbultje@google.com>
Wed, 6 Feb 2013 20:45:28 +0000 (12:45 -0800)
committerRonald S. Bultje <rbultje@google.com>
Thu, 7 Feb 2013 00:12:56 +0000 (16:12 -0800)
Change-Id: I8508f1a3d3430f998bb9295f849e88e626a52a24

13 files changed:
build/make/configure.sh
configure
vp9/common/vp9_common.h
vp9/common/vp9_idctllm.c
vp9/common/vp9_loopfilter_filters.c
vp9/common/vp9_onyx.h
vp9/common/vp9_sadmxn.h
vp9/common/vp9_treecoder.h
vp9/common/x86/vp9_loopfilter_x86.c
vp9/encoder/vp9_dct.c
vp9/encoder/vp9_rdopt.c
vp9/encoder/vp9_tokenize.c
vp9/encoder/vp9_treewriter.h

index 318f0f7601f05f5636429c389c00dd55f767c32d..9e1d7ed7221bdd0dab90445d79c36d6c3968b2fe 100755 (executable)
@@ -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
index cb3c07e79b8543f0112bd52407f4031b5313e8b2..46919bd3a378328d3846109cd946e1049bfb094b 100755 (executable)
--- a/configure
+++ b/configure
@@ -644,6 +644,7 @@ process_toolchain() {
              enable solution
              vs_version=${tgt_cc##vs}
              all_targets="${all_targets} solution"
+             INLINE="__forceinline"
         ;;
     esac
 
index 2e1ee4b1a92b06b3fb0ec24b80c60f2d89e45892..4295eba871c0fb123f34ef01744d27a9a7ad8cf8 100644 (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;
 }
 
index f6ffa1aeef809949a6a64c9689ba79b3ee8d8167..f9318191d6035c008538c296feca6a68f5f54678 100644 (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;
index f9f86c3dbbd5c4d549dad34ffd3a09e4efd7740d..6f434dafe49c07e2151527043b4ec9af5fbfd406 100644 (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,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;
index 0536aa05af9ae1ed67bf4d6fbf192209e4dc1cd6..0b7d98a583d7e2058ec733d9c1a54c0b933f0c22 100644 (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;
index fe3cdc2b3ab85c5c779188a8b9ef73317fedae2b..b2dfd63f9b41e5d5ddb0aebe981d3e1f45e64c45 100644 (file)
 #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;
 
index 0c0c5e96e601c975c7ac63eb5cddf399ca7470a8..8eca8a8bcd7ca4d26a970cf16409517339890386 100644 (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;
 }
 
index 70499d94a64a984c70208f2a703c5f4dfc1b4c3b..c8487547b5b984ea1c590b634016890daa7ec9a0 100644 (file)
@@ -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 {
index fbbea9aa0d51655dc38fdd87aa714c0f393c8708..dcd19ca429197eadff5977b057c3c456dfd826c3 100644 (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;
index 89707a260d9b0c7acb81eb92be157b5ce1b2bd77..2868db55f9fb13e7cdb84fd24b96632ef220a817 100644 (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:
index 0d444b80de5648160a1970a081116539fe478479..2dedb1a51247cab19503f05b84a5b0b2ec4d5541 100644 (file)
@@ -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;
index 4e0e5e12c5bf9d973e0905d5a46ccfefae2fed6c..3c4b7364d6e123a6346e5b557ea559085b26d7fb 100644 (file)
@@ -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);
 }