• Home
  • Raw
  • Download

Lines Matching refs:histo_queue

744 static int HistoQueueInit(HistoQueue* const histo_queue, const int max_size) {  in HistoQueueInit()  argument
745 histo_queue->size = 0; in HistoQueueInit()
746 histo_queue->max_size = max_size; in HistoQueueInit()
749 histo_queue->queue = (HistogramPair*)WebPSafeMalloc( in HistoQueueInit()
750 histo_queue->max_size + 1, sizeof(*histo_queue->queue)); in HistoQueueInit()
751 return histo_queue->queue != NULL; in HistoQueueInit()
754 static void HistoQueueClear(HistoQueue* const histo_queue) { in HistoQueueClear() argument
755 assert(histo_queue != NULL); in HistoQueueClear()
756 WebPSafeFree(histo_queue->queue); in HistoQueueClear()
757 histo_queue->size = 0; in HistoQueueClear()
758 histo_queue->max_size = 0; in HistoQueueClear()
763 static void HistoQueuePopPair(HistoQueue* const histo_queue, in HistoQueuePopPair() argument
765 assert(pair >= histo_queue->queue && in HistoQueuePopPair()
766 pair < (histo_queue->queue + histo_queue->size)); in HistoQueuePopPair()
767 assert(histo_queue->size > 0); in HistoQueuePopPair()
768 *pair = histo_queue->queue[histo_queue->size - 1]; in HistoQueuePopPair()
769 --histo_queue->size; in HistoQueuePopPair()
773 static void HistoQueueUpdateHead(HistoQueue* const histo_queue, in HistoQueueUpdateHead() argument
776 assert(pair >= histo_queue->queue && in HistoQueueUpdateHead()
777 pair < (histo_queue->queue + histo_queue->size)); in HistoQueueUpdateHead()
778 assert(histo_queue->size > 0); in HistoQueueUpdateHead()
779 if (pair->cost_diff < histo_queue->queue[0].cost_diff) { in HistoQueueUpdateHead()
781 const HistogramPair tmp = histo_queue->queue[0]; in HistoQueueUpdateHead()
782 histo_queue->queue[0] = *pair; in HistoQueueUpdateHead()
802 static double HistoQueuePush(HistoQueue* const histo_queue, in HistoQueuePush() argument
810 if (histo_queue->size == histo_queue->max_size) return 0.; in HistoQueuePush()
827 histo_queue->queue[histo_queue->size++] = pair; in HistoQueuePush()
828 HistoQueueUpdateHead(histo_queue, &histo_queue->queue[histo_queue->size - 1]); in HistoQueuePush()
844 HistoQueue histo_queue; in HistogramCombineGreedy() local
853 if (!HistoQueueInit(&histo_queue, image_histo_size * image_histo_size)) { in HistogramCombineGreedy()
862 HistoQueuePush(&histo_queue, histograms, i, j, 0.); in HistogramCombineGreedy()
866 while (histo_queue.size > 0) { in HistogramCombineGreedy()
867 const int idx1 = histo_queue.queue[0].idx1; in HistogramCombineGreedy()
868 const int idx2 = histo_queue.queue[0].idx2; in HistogramCombineGreedy()
870 histograms[idx1]->bit_cost_ = histo_queue.queue[0].cost_combo; in HistogramCombineGreedy()
876 for (i = 0; i < histo_queue.size;) { in HistogramCombineGreedy()
877 HistogramPair* const p = histo_queue.queue + i; in HistogramCombineGreedy()
880 HistoQueuePopPair(&histo_queue, p); in HistogramCombineGreedy()
882 HistoQueueUpdateHead(&histo_queue, p); in HistogramCombineGreedy()
890 HistoQueuePush(&histo_queue, image_histo->histograms, idx1, i, 0.); in HistogramCombineGreedy()
897 HistoQueueClear(&histo_queue); in HistogramCombineGreedy()
920 HistoQueue histo_queue; in HistogramCombineStochastic() local
934 if (!HistoQueueInit(&histo_queue, kHistoQueueSize)) goto End; in HistogramCombineStochastic()
949 (histo_queue.size == 0) ? 0. : histo_queue.queue[0].cost_diff; in HistogramCombineStochastic()
969 HistoQueuePush(&histo_queue, histograms, idx1, idx2, best_cost); in HistogramCombineStochastic()
973 if (histo_queue.size == histo_queue.max_size) break; in HistogramCombineStochastic()
976 if (histo_queue.size == 0) continue; in HistogramCombineStochastic()
979 best_idx1 = histo_queue.queue[0].idx1; in HistogramCombineStochastic()
980 best_idx2 = histo_queue.queue[0].idx2; in HistogramCombineStochastic()
991 histograms[best_idx1]->bit_cost_ = histo_queue.queue[0].cost_combo; in HistogramCombineStochastic()
995 for (j = 0; j < histo_queue.size;) { in HistogramCombineStochastic()
996 HistogramPair* const p = histo_queue.queue + j; in HistogramCombineStochastic()
1003 HistoQueuePopPair(&histo_queue, p); in HistogramCombineStochastic()
1025 HistoQueuePopPair(&histo_queue, p); in HistogramCombineStochastic()
1029 HistoQueueUpdateHead(&histo_queue, p); in HistogramCombineStochastic()
1038 HistoQueueClear(&histo_queue); in HistogramCombineStochastic()