Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Side by Side Diff: source/libvpx/vpx_ports/mem_ops_aligned.h

Issue 11555023: libvpx: Add VP9 decoder. (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
11 11
12 /* \file 12 /* \file
13 * \brief Provides portable memory access primitives for operating on aligned 13 * \brief Provides portable memory access primitives for operating on aligned
14 * data 14 * data
15 * 15 *
16 * This file is split from mem_ops.h for easier maintenance. See mem_ops.h 16 * This file is split from mem_ops.h for easier maintenance. See mem_ops.h
17 * for a more detailed description of these primitives. 17 * for a more detailed description of these primitives.
18 */ 18 */
19 #ifndef INCLUDED_BY_MEM_OPS_H 19 #ifndef INCLUDED_BY_MEM_OPS_H
20 #error Include mem_ops.h, not mem_ops_aligned.h directly. 20 #error Include mem_ops.h, not mem_ops_aligned.h directly.
21 #endif 21 #endif
22 22
23 /* Architectures that provide instructions for doing this byte swapping 23 /* Architectures that provide instructions for doing this byte swapping
24 * could redefine these macros. 24 * could redefine these macros.
25 */ 25 */
26 #define swap_endian_16(val,raw) do {\ 26 #define swap_endian_16(val,raw) do {\
27 val = ((raw>>8) & 0x00ff) \ 27 val = ((raw>>8) & 0x00ff) \
28 | ((raw<<8) & 0xff00);\ 28 | ((raw<<8) & 0xff00);\
29 } while(0) 29 } while(0)
30 #define swap_endian_32(val,raw) do {\ 30 #define swap_endian_32(val,raw) do {\
31 val = ((raw>>24) & 0x000000ff) \ 31 val = ((raw>>24) & 0x000000ff) \
32 | ((raw>>8) & 0x0000ff00) \ 32 | ((raw>>8) & 0x0000ff00) \
33 | ((raw<<8) & 0x00ff0000) \ 33 | ((raw<<8) & 0x00ff0000) \
34 | ((raw<<24) & 0xff000000); \ 34 | ((raw<<24) & 0xff000000); \
35 } while(0) 35 } while(0)
36 #define swap_endian_16_se(val,raw) do {\ 36 #define swap_endian_16_se(val,raw) do {\
37 swap_endian_16(val,raw);\ 37 swap_endian_16(val,raw);\
38 val = ((val << 16) >> 16);\ 38 val = ((val << 16) >> 16);\
39 } while(0) 39 } while(0)
40 #define swap_endian_32_se(val,raw) swap_endian_32(val,raw) 40 #define swap_endian_32_se(val,raw) swap_endian_32(val,raw)
41 41
42 #define mem_get_ne_aligned_generic(end,sz) \ 42 #define mem_get_ne_aligned_generic(end,sz) \
43 static unsigned MEM_VALUE_T mem_get_##end##sz##_aligned(const void *vmem) {\ 43 static unsigned MEM_VALUE_T mem_get_##end##sz##_aligned(const void *vmem) {\
44 const uint##sz##_t *mem = (const uint##sz##_t *)vmem;\ 44 const uint##sz##_t *mem = (const uint##sz##_t *)vmem;\
45 return *mem;\ 45 return *mem;\
46 } 46 }
47 47
48 #define mem_get_sne_aligned_generic(end,sz) \ 48 #define mem_get_sne_aligned_generic(end,sz) \
49 static signed MEM_VALUE_T mem_get_s##end##sz##_aligned(const void *vmem) {\ 49 static signed MEM_VALUE_T mem_get_s##end##sz##_aligned(const void *vmem) {\
50 const int##sz##_t *mem = (const int##sz##_t *)vmem;\ 50 const int##sz##_t *mem = (const int##sz##_t *)vmem;\
51 return *mem;\ 51 return *mem;\
52 } 52 }
53 53
54 #define mem_get_se_aligned_generic(end,sz) \ 54 #define mem_get_se_aligned_generic(end,sz) \
55 static unsigned MEM_VALUE_T mem_get_##end##sz##_aligned(const void *vmem) {\ 55 static unsigned MEM_VALUE_T mem_get_##end##sz##_aligned(const void *vmem) {\
56 const uint##sz##_t *mem = (const uint##sz##_t *)vmem;\ 56 const uint##sz##_t *mem = (const uint##sz##_t *)vmem;\
57 unsigned MEM_VALUE_T val, raw = *mem;\ 57 unsigned MEM_VALUE_T val, raw = *mem;\
58 swap_endian_##sz(val,raw);\ 58 swap_endian_##sz(val,raw);\
59 return val;\ 59 return val;\
60 } 60 }
61 61
62 #define mem_get_sse_aligned_generic(end,sz) \ 62 #define mem_get_sse_aligned_generic(end,sz) \
63 static signed MEM_VALUE_T mem_get_s##end##sz##_aligned(const void *vmem) {\ 63 static signed MEM_VALUE_T mem_get_s##end##sz##_aligned(const void *vmem) {\
64 const int##sz##_t *mem = (const int##sz##_t *)vmem;\ 64 const int##sz##_t *mem = (const int##sz##_t *)vmem;\
65 unsigned MEM_VALUE_T val, raw = *mem;\ 65 unsigned MEM_VALUE_T val, raw = *mem;\
66 swap_endian_##sz##_se(val,raw);\ 66 swap_endian_##sz##_se(val,raw);\
67 return val;\ 67 return val;\
68 } 68 }
69 69
70 #define mem_put_ne_aligned_generic(end,sz) \ 70 #define mem_put_ne_aligned_generic(end,sz) \
71 static void mem_put_##end##sz##_aligned(void *vmem, MEM_VALUE_T val) {\ 71 static void mem_put_##end##sz##_aligned(void *vmem, MEM_VALUE_T val) {\
72 uint##sz##_t *mem = (uint##sz##_t *)vmem;\ 72 uint##sz##_t *mem = (uint##sz##_t *)vmem;\
73 *mem = (uint##sz##_t)val;\ 73 *mem = (uint##sz##_t)val;\
74 } 74 }
75 75
76 #define mem_put_se_aligned_generic(end,sz) \ 76 #define mem_put_se_aligned_generic(end,sz) \
77 static void mem_put_##end##sz##_aligned(void *vmem, MEM_VALUE_T val) {\ 77 static void mem_put_##end##sz##_aligned(void *vmem, MEM_VALUE_T val) {\
78 uint##sz##_t *mem = (uint##sz##_t *)vmem, raw;\ 78 uint##sz##_t *mem = (uint##sz##_t *)vmem, raw;\
79 swap_endian_##sz(raw,val);\ 79 swap_endian_##sz(raw,val);\
80 *mem = (uint##sz##_t)raw;\ 80 *mem = (uint##sz##_t)raw;\
81 } 81 }
82 82
83 #include "vpx_config.h" 83 #include "vpx_config.h"
84 #if CONFIG_BIG_ENDIAN 84 #if CONFIG_BIG_ENDIAN
85 #define mem_get_be_aligned_generic(sz) mem_get_ne_aligned_generic(be,sz) 85 #define mem_get_be_aligned_generic(sz) mem_get_ne_aligned_generic(be,sz)
86 #define mem_get_sbe_aligned_generic(sz) mem_get_sne_aligned_generic(be,sz) 86 #define mem_get_sbe_aligned_generic(sz) mem_get_sne_aligned_generic(be,sz)
87 #define mem_get_le_aligned_generic(sz) mem_get_se_aligned_generic(le,sz) 87 #define mem_get_le_aligned_generic(sz) mem_get_se_aligned_generic(le,sz)
88 #define mem_get_sle_aligned_generic(sz) mem_get_sse_aligned_generic(le,sz) 88 #define mem_get_sle_aligned_generic(sz) mem_get_sse_aligned_generic(le,sz)
89 #define mem_put_be_aligned_generic(sz) mem_put_ne_aligned_generic(be,sz) 89 #define mem_put_be_aligned_generic(sz) mem_put_ne_aligned_generic(be,sz)
90 #define mem_put_le_aligned_generic(sz) mem_put_se_aligned_generic(le,sz) 90 #define mem_put_le_aligned_generic(sz) mem_put_se_aligned_generic(le,sz)
91 #else 91 #else
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 #undef mem_get_ne_aligned_generic 148 #undef mem_get_ne_aligned_generic
149 #undef mem_get_se_aligned_generic 149 #undef mem_get_se_aligned_generic
150 #undef mem_get_sne_aligned_generic 150 #undef mem_get_sne_aligned_generic
151 #undef mem_get_sse_aligned_generic 151 #undef mem_get_sse_aligned_generic
152 #undef mem_put_ne_aligned_generic 152 #undef mem_put_ne_aligned_generic
153 #undef mem_put_se_aligned_generic 153 #undef mem_put_se_aligned_generic
154 #undef swap_endian_16 154 #undef swap_endian_16
155 #undef swap_endian_32 155 #undef swap_endian_32
156 #undef swap_endian_16_se 156 #undef swap_endian_16_se
157 #undef swap_endian_32_se 157 #undef swap_endian_32_se
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698