Lines Matching refs:histo_queue

588 static int HistoQueueInit(HistoQueue* const histo_queue, const int max_index) {  in HistoQueueInit()  argument
589 histo_queue->size = 0; in HistoQueueInit()
597 histo_queue->max_size = max_index * max_index; in HistoQueueInit()
600 histo_queue->queue = WebPSafeMalloc(histo_queue->max_size + 1, in HistoQueueInit()
601 sizeof(*histo_queue->queue)); in HistoQueueInit()
602 return histo_queue->queue != NULL; in HistoQueueInit()
605 static void HistoQueueClear(HistoQueue* const histo_queue) { in HistoQueueClear() argument
606 assert(histo_queue != NULL); in HistoQueueClear()
607 WebPSafeFree(histo_queue->queue); in HistoQueueClear()
620 static void UpdateQueueFront(HistoQueue* const histo_queue) { in UpdateQueueFront() argument
621 if (histo_queue->queue[histo_queue->size].cost_diff >= 0) return; in UpdateQueueFront()
623 if (histo_queue->queue[histo_queue->size].cost_diff < in UpdateQueueFront()
624 histo_queue->queue[0].cost_diff) { in UpdateQueueFront()
625 SwapHistogramPairs(histo_queue->queue, in UpdateQueueFront()
626 histo_queue->queue + histo_queue->size); in UpdateQueueFront()
628 ++histo_queue->size; in UpdateQueueFront()
633 assert(histo_queue->size <= histo_queue->max_size); in UpdateQueueFront()
664 HistoQueue histo_queue; in HistogramCombineGreedy() local
666 if (!HistoQueueInit(&histo_queue, image_histo_size) || clusters == NULL) { in HistogramCombineGreedy()
675 PreparePair(histograms, i, j, &histo_queue.queue[histo_queue.size], in HistogramCombineGreedy()
677 UpdateQueueFront(&histo_queue); in HistogramCombineGreedy()
681 while (image_histo_size > 1 && histo_queue.size > 0) { in HistogramCombineGreedy()
683 const int idx1 = histo_queue.queue[0].idx1; in HistogramCombineGreedy()
684 const int idx2 = histo_queue.queue[0].idx2; in HistogramCombineGreedy()
686 histograms[idx1]->bit_cost_ = histo_queue.queue[0].cost_combo; in HistogramCombineGreedy()
697 copy_to = histo_queue.queue; in HistogramCombineGreedy()
698 for (i = 0; i < histo_queue.size; ++i) { in HistogramCombineGreedy()
699 HistogramPair* const p = histo_queue.queue + i; in HistogramCombineGreedy()
705 if (p->cost_diff < histo_queue.queue[0].cost_diff) { in HistogramCombineGreedy()
707 SwapHistogramPairs(histo_queue.queue, p); in HistogramCombineGreedy()
712 histo_queue.size = (int)(copy_to - histo_queue.queue); in HistogramCombineGreedy()
718 &histo_queue.queue[histo_queue.size], histos); in HistogramCombineGreedy()
719 UpdateQueueFront(&histo_queue); in HistogramCombineGreedy()
735 HistoQueueClear(&histo_queue); in HistogramCombineGreedy()