shithub: libvpx

Download patch

ref: 07a67520d3c614dcffcab55a8f8f91a3527fce4b
parent: f45296176504475fce7b00c19aee984cfb6a7f82
author: Jim Bankoski <[email protected]>
date: Tue Aug 12 12:28:08 EDT 2014

inline vpx functions in headers to avoid unused function warning

Change-Id: I80284ae82915b9df56f7c5ef4953bd53e8cffd1f

--- a/vpx/vpx_integer.h
+++ b/vpx/vpx_integer.h
@@ -15,6 +15,15 @@
 /* get ptrdiff_t, size_t, wchar_t, NULL */
 #include <stddef.h>
 
+#if defined(_MSC_VER)
+#define VPX_FORCE_INLINE __forceinline
+#define VPX_INLINE __inline
+#else
+#define VPX_FORCE_INLINE __inline__ __attribute__(always_inline)
+// TODO(jbb): Allow a way to force inline off for older compilers.
+#define VPX_INLINE inline
+#endif
+
 #if (defined(_MSC_VER) && (_MSC_VER < 1600)) || defined(VPX_EMULATE_INTTYPES)
 typedef signed char  int8_t;
 typedef signed short int16_t;
--- a/vpx_ports/mem_ops.h
+++ b/vpx_ports/mem_ops.h
@@ -133,7 +133,7 @@
 }
 
 #define mem_get_s_generic(end,sz) \
-  static signed MEM_VALUE_T mem_get_s##end##sz(const void *vmem) {\
+  static VPX_INLINE signed MEM_VALUE_T mem_get_s##end##sz(const void *vmem) {\
     const MAU_T *mem = (const MAU_T*)vmem;\
     signed MEM_VALUE_T val = mem_get_##end##sz(mem);\
     return (val << (MEM_VALUE_T_SZ_BITS - sz)) >> (MEM_VALUE_T_SZ_BITS - sz);\
@@ -165,7 +165,7 @@
 
 #undef  mem_put_be16
 #define mem_put_be16 mem_ops_wrap_symbol(mem_put_be16)
-static void mem_put_be16(void *vmem, MEM_VALUE_T val) {
+static VPX_INLINE void mem_put_be16(void *vmem, MEM_VALUE_T val) {
   MAU_T *mem = (MAU_T *)vmem;
 
   mem[0] = (val >> 8) & 0xff;
@@ -174,7 +174,7 @@
 
 #undef  mem_put_be24
 #define mem_put_be24 mem_ops_wrap_symbol(mem_put_be24)
-static void mem_put_be24(void *vmem, MEM_VALUE_T val) {
+static VPX_INLINE void mem_put_be24(void *vmem, MEM_VALUE_T val) {
   MAU_T *mem = (MAU_T *)vmem;
 
   mem[0] = (val >> 16) & 0xff;
@@ -184,7 +184,7 @@
 
 #undef  mem_put_be32
 #define mem_put_be32 mem_ops_wrap_symbol(mem_put_be32)
-static void mem_put_be32(void *vmem, MEM_VALUE_T val) {
+static VPX_INLINE void mem_put_be32(void *vmem, MEM_VALUE_T val) {
   MAU_T *mem = (MAU_T *)vmem;
 
   mem[0] = (val >> 24) & 0xff;
@@ -195,7 +195,7 @@
 
 #undef  mem_put_le16
 #define mem_put_le16 mem_ops_wrap_symbol(mem_put_le16)
-static void mem_put_le16(void *vmem, MEM_VALUE_T val) {
+static VPX_INLINE void mem_put_le16(void *vmem, MEM_VALUE_T val) {
   MAU_T *mem = (MAU_T *)vmem;
 
   mem[0] = (val >>  0) & 0xff;
@@ -204,7 +204,7 @@
 
 #undef  mem_put_le24
 #define mem_put_le24 mem_ops_wrap_symbol(mem_put_le24)
-static void mem_put_le24(void *vmem, MEM_VALUE_T val) {
+static VPX_INLINE void mem_put_le24(void *vmem, MEM_VALUE_T val) {
   MAU_T *mem = (MAU_T *)vmem;
 
   mem[0] = (val >>  0) & 0xff;
@@ -214,7 +214,7 @@
 
 #undef  mem_put_le32
 #define mem_put_le32 mem_ops_wrap_symbol(mem_put_le32)
-static void mem_put_le32(void *vmem, MEM_VALUE_T val) {
+static VPX_INLINE void mem_put_le32(void *vmem, MEM_VALUE_T val) {
   MAU_T *mem = (MAU_T *)vmem;
 
   mem[0] = (val >>  0) & 0xff;
--- a/vpx_ports/mem_ops_aligned.h
+++ b/vpx_ports/mem_ops_aligned.h
@@ -44,19 +44,22 @@
 #define swap_endian_32_se(val,raw) swap_endian_32(val,raw)
 
 #define mem_get_ne_aligned_generic(end,sz) \
-  static unsigned MEM_VALUE_T mem_get_##end##sz##_aligned(const void *vmem) {\
+  static VPX_INLINE unsigned MEM_VALUE_T \
+    mem_get_##end##sz##_aligned(const void *vmem) {\
     const uint##sz##_t *mem = (const uint##sz##_t *)vmem;\
     return *mem;\
   }
 
 #define mem_get_sne_aligned_generic(end,sz) \
-  static signed MEM_VALUE_T mem_get_s##end##sz##_aligned(const void *vmem) {\
+  static VPX_INLINE signed MEM_VALUE_T \
+    mem_get_s##end##sz##_aligned(const void *vmem) {\
     const int##sz##_t *mem = (const int##sz##_t *)vmem;\
     return *mem;\
   }
 
 #define mem_get_se_aligned_generic(end,sz) \
-  static unsigned MEM_VALUE_T mem_get_##end##sz##_aligned(const void *vmem) {\
+  static VPX_INLINE unsigned MEM_VALUE_T \
+    mem_get_##end##sz##_aligned(const void *vmem) {\
     const uint##sz##_t *mem = (const uint##sz##_t *)vmem;\
     unsigned MEM_VALUE_T val, raw = *mem;\
     swap_endian_##sz(val,raw);\
@@ -64,7 +67,8 @@
   }
 
 #define mem_get_sse_aligned_generic(end,sz) \
-  static signed MEM_VALUE_T mem_get_s##end##sz##_aligned(const void *vmem) {\
+  static VPX_INLINE signed MEM_VALUE_T \
+    mem_get_s##end##sz##_aligned(const void *vmem) {\
     const int##sz##_t *mem = (const int##sz##_t *)vmem;\
     unsigned MEM_VALUE_T val, raw = *mem;\
     swap_endian_##sz##_se(val,raw);\
@@ -72,13 +76,15 @@
   }
 
 #define mem_put_ne_aligned_generic(end,sz) \
-  static void mem_put_##end##sz##_aligned(void *vmem, MEM_VALUE_T val) {\
+  static VPX_INLINE void \
+    mem_put_##end##sz##_aligned(void *vmem, MEM_VALUE_T val) {\
     uint##sz##_t *mem = (uint##sz##_t *)vmem;\
     *mem = (uint##sz##_t)val;\
   }
 
 #define mem_put_se_aligned_generic(end,sz) \
-  static void mem_put_##end##sz##_aligned(void *vmem, MEM_VALUE_T val) {\
+  static VPX_INLINE void \
+    mem_put_##end##sz##_aligned(void *vmem, MEM_VALUE_T val) {\
     uint##sz##_t *mem = (uint##sz##_t *)vmem, raw;\
     swap_endian_##sz(raw,val);\
     *mem = (uint##sz##_t)raw;\