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 |
11 | 11 |
12 #ifndef __VPX_MEM_INTRNL_H__ | 12 #ifndef __VPX_MEM_INTRNL_H__ |
13 #define __VPX_MEM_INTRNL_H__ | 13 #define __VPX_MEM_INTRNL_H__ |
14 #include "vpx_config.h" | 14 #include "vpx_ports/config.h" |
15 | 15 |
16 #ifndef CONFIG_MEM_MANAGER | 16 #ifndef CONFIG_MEM_MANAGER |
17 # if defined(VXWORKS) | 17 # if defined(VXWORKS) |
18 # define CONFIG_MEM_MANAGER 1 /*include heap manager functionality,*/ | 18 # define CONFIG_MEM_MANAGER 1 /*include heap manager functionality,*/ |
19 /*default: enabled on vxworks*/ | 19 /*default: enabled on vxworks*/ |
20 # else | 20 # else |
21 # define CONFIG_MEM_MANAGER 0 /*include heap manager functionality*/ | 21 # define CONFIG_MEM_MANAGER 0 /*include heap manager functionality*/ |
22 # endif | 22 # endif |
23 #endif /*CONFIG_MEM_MANAGER*/ | 23 #endif /*CONFIG_MEM_MANAGER*/ |
24 | 24 |
(...skipping 15 matching lines...) Expand all Loading... |
40 # if VPX_MEM_TRACKER_VERSION_CHIEF != 2 || VPX_MEM_TRACKER_VERSION_MAJOR != 5 | 40 # if VPX_MEM_TRACKER_VERSION_CHIEF != 2 || VPX_MEM_TRACKER_VERSION_MAJOR != 5 |
41 # error "vpx_mem requires memory tracker version 2.5 to track memory usage" | 41 # error "vpx_mem requires memory tracker version 2.5 to track memory usage" |
42 # endif | 42 # endif |
43 #endif | 43 #endif |
44 | 44 |
45 #define ADDRESS_STORAGE_SIZE sizeof(size_t) | 45 #define ADDRESS_STORAGE_SIZE sizeof(size_t) |
46 | 46 |
47 #ifndef DEFAULT_ALIGNMENT | 47 #ifndef DEFAULT_ALIGNMENT |
48 # if defined(VXWORKS) | 48 # if defined(VXWORKS) |
49 # define DEFAULT_ALIGNMENT 32 /*default addr alignment to use in | 49 # define DEFAULT_ALIGNMENT 32 /*default addr alignment to use in |
50 calls to vpx_* functions other | 50 calls to vpx_* functions other |
51 than vpx_memalign*/ | 51 than vpx_memalign*/ |
52 # else | 52 # else |
53 # define DEFAULT_ALIGNMENT 1 | 53 # define DEFAULT_ALIGNMENT 1 |
54 # endif | 54 # endif |
55 #endif | 55 #endif |
56 | 56 |
57 #if DEFAULT_ALIGNMENT < 1 | 57 #if DEFAULT_ALIGNMENT < 1 |
58 # error "DEFAULT_ALIGNMENT must be >= 1!" | 58 # error "DEFAULT_ALIGNMENT must be >= 1!" |
59 #endif | 59 #endif |
60 | 60 |
61 #if CONFIG_MEM_TRACKER | 61 #if CONFIG_MEM_TRACKER |
62 # define TRY_BOUNDS_CHECK 1 /*when set to 1 pads each allocation, | 62 # define TRY_BOUNDS_CHECK 1 /*when set to 1 pads each allocation, |
63 integrity can be checked using | 63 integrity can be checked using |
64 vpx_memory_tracker_check_integrity | 64 vpx_memory_tracker_check_integrity |
65 or on free by defining*/ | 65 or on free by defining*/ |
66 /*TRY_BOUNDS_CHECK_ON_FREE*/ | 66 /*TRY_BOUNDS_CHECK_ON_FREE*/ |
67 #else | 67 #else |
68 # define TRY_BOUNDS_CHECK 0 | 68 # define TRY_BOUNDS_CHECK 0 |
69 #endif /*CONFIG_MEM_TRACKER*/ | 69 #endif /*CONFIG_MEM_TRACKER*/ |
70 | 70 |
71 #if TRY_BOUNDS_CHECK | 71 #if TRY_BOUNDS_CHECK |
72 # define TRY_BOUNDS_CHECK_ON_FREE 0 /*checks mem integrity on every | 72 # define TRY_BOUNDS_CHECK_ON_FREE 0 /*checks mem integrity on every |
73 free, very expensive*/ | 73 free, very expensive*/ |
74 # define BOUNDS_CHECK_VALUE 0xdeadbeef /*value stored before/after ea. | 74 # define BOUNDS_CHECK_VALUE 0xdeadbeef /*value stored before/after ea. |
75 mem addr for bounds checking*/ | 75 mem addr for bounds checking*/ |
76 # define BOUNDS_CHECK_PAD_SIZE 32 /*size of the padding before and | 76 # define BOUNDS_CHECK_PAD_SIZE 32 /*size of the padding before and |
77 after ea allocation to be filled | 77 after ea allocation to be filled |
78 with BOUNDS_CHECK_VALUE. | 78 with BOUNDS_CHECK_VALUE. |
79 this should be a multiple of 4*/ | 79 this should be a multiple of 4*/ |
80 #else | 80 #else |
81 # define BOUNDS_CHECK_VALUE 0 | 81 # define BOUNDS_CHECK_VALUE 0 |
82 # define BOUNDS_CHECK_PAD_SIZE 0 | 82 # define BOUNDS_CHECK_PAD_SIZE 0 |
83 #endif /*TRY_BOUNDS_CHECK*/ | 83 #endif /*TRY_BOUNDS_CHECK*/ |
84 | 84 |
85 #ifndef REMOVE_PRINTFS | 85 #ifndef REMOVE_PRINTFS |
86 # define REMOVE_PRINTFS 0 | 86 # define REMOVE_PRINTFS 0 |
87 #endif | 87 #endif |
88 | 88 |
89 /* Should probably use a vpx_mem logger function. */ | 89 /* Should probably use a vpx_mem logger function. */ |
90 #if REMOVE_PRINTFS | 90 #if REMOVE_PRINTFS |
91 # define _P(x) | 91 # define _P(x) |
92 #else | 92 #else |
93 # define _P(x) x | 93 # define _P(x) x |
94 #endif | 94 #endif |
95 | 95 |
96 /*returns an addr aligned to the byte boundary specified by align*/ | 96 /*returns an addr aligned to the byte boundary specified by align*/ |
97 #define align_addr(addr,align) (void*)(((size_t)(addr) + ((align) - 1)) & (size_
t)-(align)) | 97 #define align_addr(addr,align) (void*)(((size_t)(addr) + ((align) - 1)) & (size_
t)-(align)) |
98 | 98 |
99 #endif /*__VPX_MEM_INTRNL_H__*/ | 99 #endif /*__VPX_MEM_INTRNL_H__*/ |
OLD | NEW |