31 #ifndef OPENCV_FLANN_ALLOCATOR_H_
32 #define OPENCV_FLANN_ALLOCATOR_H_
51 T* allocate(
size_t count = 1)
73 const size_t WORDSIZE=16;
74 const size_t BLOCKSIZE=8192;
97 PooledAllocator(
int blockSize = BLOCKSIZE)
115 while (base != NULL) {
116 prev = *((
void**) base);
126 void* allocateMemory(
int size)
134 size = (
size + (WORDSIZE - 1)) & ~(WORDSIZE - 1);
139 if (
size > remaining) {
141 wastedMemory += remaining;
144 blockSize = (
size +
sizeof(
void*) + (WORDSIZE-1) > BLOCKSIZE) ?
145 size +
sizeof(
void*) + (WORDSIZE-1) : BLOCKSIZE;
150 fprintf(stderr,
"Failed to allocate memory.\n");
155 ((
void**) m)[0] = base;
161 remaining =
blockSize -
sizeof(
void*) - shift;
162 loc = ((
char*)m +
sizeof(
void*) + shift);
165 loc = (
char*)loc +
size;
180 template <
typename T>
181 T* allocate(
size_t count = 1)
183 T* mem = (
T*) this->allocateMemory((
int)(
sizeof(
T)*
count));
188 PooledAllocator(
const PooledAllocator &);
189 PooledAllocator& operator=(
const PooledAllocator &);
InputArrayOfArrays InputArrayOfArrays InputOutputArray InputOutputArray InputOutputArray InputOutputArray Size InputOutputArray InputOutputArray T
Definition: calib3d.hpp:1867
CvSize size
Definition: core_c.h:112
int count
Definition: core_c.h:1413
CV_EXPORTS OutputArray int double double InputArray OutputArray int blockSize
Definition: imgproc.hpp:2132