Added vp8_update_zbin_extra
[libvpx.git] / vpx_mem / memory_manager / include / heapmm.h
blob33004cadc74a9f9506fe9cdcd7b0d21518af7855
1 /*
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
12 /* This code is in the public domain.
13 ** Version: 1.1 Author: Walt Karas
16 /* External header file for Heap Memory Manager. See documentation in
17 ** heapmm.html.
20 #undef HMM_PROCESS
22 /* Include once per configuration in a particular translation unit. */
24 #ifndef HMM_CNFG_NUM
26 /* Default configuration. */
28 #ifndef HMM_INC_CNFG_DFLT
29 #define HMM_INC_CNFG_DFLT
30 #define HMM_PROCESS
31 #endif
33 #elif HMM_CNFG_NUM == 0
35 /* Test configuration. */
37 #ifndef HMM_INC_CNFG_0
38 #define HMM_INC_CNFG_0
39 #define HMM_PROCESS
40 #endif
42 #elif HMM_CNFG_NUM == 1
44 #ifndef HMM_INC_CNFG_1
45 #define HMM_INC_CNFG_1
46 #define HMM_PROCESS
47 #endif
49 #elif HMM_CNFG_NUM == 2
51 #ifndef HMM_INC_CNFG_2
52 #define HMM_INC_CNFG_2
53 #define HMM_PROCESS
54 #endif
56 #elif HMM_CNFG_NUM == 3
58 #ifndef HMM_INC_CNFG_3
59 #define HMM_INC_CNFG_3
60 #define HMM_PROCESS
61 #endif
63 #elif HMM_CNFG_NUM == 4
65 #ifndef HMM_INC_CNFG_4
66 #define HMM_INC_CNFG_4
67 #define HMM_PROCESS
68 #endif
70 #elif HMM_CNFG_NUM == 5
72 #ifndef HMM_INC_CNFG_5
73 #define HMM_INC_CNFG_5
74 #define HMM_PROCESS
75 #endif
77 #endif
79 #ifdef HMM_PROCESS
81 #include "hmm_cnfg.h"
83 /* Heap descriptor. */
84 typedef struct HMM_UNIQUE(structure)
86 /* private: */
88 /* Pointer to (payload of) root node in AVL tree. This field should
89 ** really be the AVL tree descriptor (type avl_avl). But (in the
90 ** instantiation of the AVL tree generic package used in package) the
91 ** AVL tree descriptor simply contains a pointer to the root. So,
92 ** whenever a pointer to the AVL tree descriptor is needed, I use the
93 ** cast:
95 ** (avl_avl *) &(heap_desc->avl_tree_root)
97 ** (where heap_desc is a pointer to a heap descriptor). This trick
98 ** allows me to avoid including cavl_if.h in this external header. */
99 void *avl_tree_root;
101 /* Pointer to first byte of last block freed, after any coalescing. */
102 void *last_freed;
104 /* public: */
106 HMM_UNIQUE(size_bau) num_baus_can_shrink;
107 void *end_of_shrinkable_chunk;
109 HMM_UNIQUE(descriptor);
111 /* Prototypes for externally-callable functions. */
113 void HMM_UNIQUE(init)(HMM_UNIQUE(descriptor) *desc);
115 void *HMM_UNIQUE(alloc)(
116 HMM_UNIQUE(descriptor) *desc, HMM_UNIQUE(size_aau) num_addr_align_units);
118 /* NOT YET IMPLEMENTED */
119 void *HMM_UNIQUE(greedy_alloc)(
120 HMM_UNIQUE(descriptor) *desc, HMM_UNIQUE(size_aau) needed_addr_align_units,
121 HMM_UNIQUE(size_aau) coveted_addr_align_units);
123 int HMM_UNIQUE(resize)(
124 HMM_UNIQUE(descriptor) *desc, void *mem,
125 HMM_UNIQUE(size_aau) num_addr_align_units);
127 /* NOT YET IMPLEMENTED */
128 int HMM_UNIQUE(greedy_resize)(
129 HMM_UNIQUE(descriptor) *desc, void *mem,
130 HMM_UNIQUE(size_aau) needed_addr_align_units,
131 HMM_UNIQUE(size_aau) coveted_addr_align_units);
133 void HMM_UNIQUE(free)(HMM_UNIQUE(descriptor) *desc, void *mem);
135 HMM_UNIQUE(size_aau) HMM_UNIQUE(true_size)(void *mem);
137 HMM_UNIQUE(size_aau) HMM_UNIQUE(largest_available)(
138 HMM_UNIQUE(descriptor) *desc);
140 void HMM_UNIQUE(new_chunk)(
141 HMM_UNIQUE(descriptor) *desc, void *start_of_chunk,
142 HMM_UNIQUE(size_bau) num_block_align_units);
144 void HMM_UNIQUE(grow_chunk)(
145 HMM_UNIQUE(descriptor) *desc, void *end_of_chunk,
146 HMM_UNIQUE(size_bau) num_block_align_units);
148 /* NOT YET IMPLEMENTED */
149 void HMM_UNIQUE(shrink_chunk)(
150 HMM_UNIQUE(descriptor) *desc,
151 HMM_UNIQUE(size_bau) num_block_align_units);
153 #endif /* defined HMM_PROCESS */