Lines Matching full:heap
5284 // We build a heap of squared euclidean distances between current and last pointers
5289 PointerDistanceHeapElement heap[MAX_POINTERS * MAX_POINTERS];
5306 // Insert new element into the heap (sift up).
5307 heap[heapSize].currentPointerIndex = currentPointerIndex;
5308 heap[heapSize].lastPointerIndex = lastPointerIndex;
5309 heap[heapSize].distance = distance;
5325 && heap[childIndex + 1].distance < heap[childIndex].distance) {
5329 if (heap[parentIndex].distance <= heap[childIndex].distance) {
5333 swap(heap[parentIndex], heap[childIndex]);
5339 LOGD("assignPointerIds - initial distance min-heap: size=%d", heapSize);
5341 LOGD(" heap[%d]: cur=%d, last=%d, distance=%lld",
5342 i, heap[i].currentPointerIndex, heap[i].lastPointerIndex,
5343 heap[i].distance);
5359 // the heap (the one with smallest distance).
5362 // Previous iterations consumed the root element of the heap.
5363 // Pop root element off of the heap (sift down).
5364 heap[0] = heap[heapSize];
5372 && heap[childIndex + 1].distance < heap[childIndex].distance) {
5376 if (heap[parentIndex].distance <= heap[childIndex].distance) {
5380 swap(heap[parentIndex], heap[childIndex]);
5385 LOGD("assignPointerIds - reduced distance min-heap: size=%d", heapSize);
5387 LOGD(" heap[%d]: cur=%d, last=%d, distance=%lld",
5388 i, heap[i].currentPointerIndex, heap[i].lastPointerIndex,
5389 heap[i].distance);
5396 uint32_t currentPointerIndex = heap[0].currentPointerIndex;
5399 uint32_t lastPointerIndex = heap[0].lastPointerIndex;
5414 lastPointerIndex, currentPointerIndex, id, heap[0].distance);