OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 26 matching lines...) Expand all Loading... |
37 | ((raw<<8) & 0x00ff0000) \ | 37 | ((raw<<8) & 0x00ff0000) \ |
38 | ((raw<<24) & 0xff000000); \ | 38 | ((raw<<24) & 0xff000000); \ |
39 } while(0) | 39 } while(0) |
40 #define swap_endian_16_se(val,raw) do {\ | 40 #define swap_endian_16_se(val,raw) do {\ |
41 swap_endian_16(val,raw);\ | 41 swap_endian_16(val,raw);\ |
42 val = ((val << 16) >> 16);\ | 42 val = ((val << 16) >> 16);\ |
43 } while(0) | 43 } while(0) |
44 #define swap_endian_32_se(val,raw) swap_endian_32(val,raw) | 44 #define swap_endian_32_se(val,raw) swap_endian_32(val,raw) |
45 | 45 |
46 #define mem_get_ne_aligned_generic(end,sz) \ | 46 #define mem_get_ne_aligned_generic(end,sz) \ |
47 static unsigned MEM_VALUE_T mem_get_##end##sz##_aligned(const void *vmem) {\ | 47 static VPX_INLINE unsigned MEM_VALUE_T \ |
| 48 mem_get_##end##sz##_aligned(const void *vmem) {\ |
48 const uint##sz##_t *mem = (const uint##sz##_t *)vmem;\ | 49 const uint##sz##_t *mem = (const uint##sz##_t *)vmem;\ |
49 return *mem;\ | 50 return *mem;\ |
50 } | 51 } |
51 | 52 |
52 #define mem_get_sne_aligned_generic(end,sz) \ | 53 #define mem_get_sne_aligned_generic(end,sz) \ |
53 static signed MEM_VALUE_T mem_get_s##end##sz##_aligned(const void *vmem) {\ | 54 static VPX_INLINE signed MEM_VALUE_T \ |
| 55 mem_get_s##end##sz##_aligned(const void *vmem) {\ |
54 const int##sz##_t *mem = (const int##sz##_t *)vmem;\ | 56 const int##sz##_t *mem = (const int##sz##_t *)vmem;\ |
55 return *mem;\ | 57 return *mem;\ |
56 } | 58 } |
57 | 59 |
58 #define mem_get_se_aligned_generic(end,sz) \ | 60 #define mem_get_se_aligned_generic(end,sz) \ |
59 static unsigned MEM_VALUE_T mem_get_##end##sz##_aligned(const void *vmem) {\ | 61 static VPX_INLINE unsigned MEM_VALUE_T \ |
| 62 mem_get_##end##sz##_aligned(const void *vmem) {\ |
60 const uint##sz##_t *mem = (const uint##sz##_t *)vmem;\ | 63 const uint##sz##_t *mem = (const uint##sz##_t *)vmem;\ |
61 unsigned MEM_VALUE_T val, raw = *mem;\ | 64 unsigned MEM_VALUE_T val, raw = *mem;\ |
62 swap_endian_##sz(val,raw);\ | 65 swap_endian_##sz(val,raw);\ |
63 return val;\ | 66 return val;\ |
64 } | 67 } |
65 | 68 |
66 #define mem_get_sse_aligned_generic(end,sz) \ | 69 #define mem_get_sse_aligned_generic(end,sz) \ |
67 static signed MEM_VALUE_T mem_get_s##end##sz##_aligned(const void *vmem) {\ | 70 static VPX_INLINE signed MEM_VALUE_T \ |
| 71 mem_get_s##end##sz##_aligned(const void *vmem) {\ |
68 const int##sz##_t *mem = (const int##sz##_t *)vmem;\ | 72 const int##sz##_t *mem = (const int##sz##_t *)vmem;\ |
69 unsigned MEM_VALUE_T val, raw = *mem;\ | 73 unsigned MEM_VALUE_T val, raw = *mem;\ |
70 swap_endian_##sz##_se(val,raw);\ | 74 swap_endian_##sz##_se(val,raw);\ |
71 return val;\ | 75 return val;\ |
72 } | 76 } |
73 | 77 |
74 #define mem_put_ne_aligned_generic(end,sz) \ | 78 #define mem_put_ne_aligned_generic(end,sz) \ |
75 static void mem_put_##end##sz##_aligned(void *vmem, MEM_VALUE_T val) {\ | 79 static VPX_INLINE void \ |
| 80 mem_put_##end##sz##_aligned(void *vmem, MEM_VALUE_T val) {\ |
76 uint##sz##_t *mem = (uint##sz##_t *)vmem;\ | 81 uint##sz##_t *mem = (uint##sz##_t *)vmem;\ |
77 *mem = (uint##sz##_t)val;\ | 82 *mem = (uint##sz##_t)val;\ |
78 } | 83 } |
79 | 84 |
80 #define mem_put_se_aligned_generic(end,sz) \ | 85 #define mem_put_se_aligned_generic(end,sz) \ |
81 static void mem_put_##end##sz##_aligned(void *vmem, MEM_VALUE_T val) {\ | 86 static VPX_INLINE void \ |
| 87 mem_put_##end##sz##_aligned(void *vmem, MEM_VALUE_T val) {\ |
82 uint##sz##_t *mem = (uint##sz##_t *)vmem, raw;\ | 88 uint##sz##_t *mem = (uint##sz##_t *)vmem, raw;\ |
83 swap_endian_##sz(raw,val);\ | 89 swap_endian_##sz(raw,val);\ |
84 *mem = (uint##sz##_t)raw;\ | 90 *mem = (uint##sz##_t)raw;\ |
85 } | 91 } |
86 | 92 |
87 #include "vpx_config.h" | 93 #include "vpx_config.h" |
88 #if CONFIG_BIG_ENDIAN | 94 #if CONFIG_BIG_ENDIAN |
89 #define mem_get_be_aligned_generic(sz) mem_get_ne_aligned_generic(be,sz) | 95 #define mem_get_be_aligned_generic(sz) mem_get_ne_aligned_generic(be,sz) |
90 #define mem_get_sbe_aligned_generic(sz) mem_get_sne_aligned_generic(be,sz) | 96 #define mem_get_sbe_aligned_generic(sz) mem_get_sne_aligned_generic(be,sz) |
91 #define mem_get_le_aligned_generic(sz) mem_get_se_aligned_generic(le,sz) | 97 #define mem_get_le_aligned_generic(sz) mem_get_se_aligned_generic(le,sz) |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 #undef mem_get_sne_aligned_generic | 160 #undef mem_get_sne_aligned_generic |
155 #undef mem_get_sse_aligned_generic | 161 #undef mem_get_sse_aligned_generic |
156 #undef mem_put_ne_aligned_generic | 162 #undef mem_put_ne_aligned_generic |
157 #undef mem_put_se_aligned_generic | 163 #undef mem_put_se_aligned_generic |
158 #undef swap_endian_16 | 164 #undef swap_endian_16 |
159 #undef swap_endian_32 | 165 #undef swap_endian_32 |
160 #undef swap_endian_16_se | 166 #undef swap_endian_16_se |
161 #undef swap_endian_32_se | 167 #undef swap_endian_32_se |
162 | 168 |
163 #endif // VPX_PORTS_MEM_OPS_ALIGNED_H_ | 169 #endif // VPX_PORTS_MEM_OPS_ALIGNED_H_ |
OLD | NEW |