Home | History | Annotate | Download | only in enc

Lines Matching defs:histograms

30 // Maximum number of histograms allowed in greedy combining algorithm.
115 sizeof(*set) + size * (sizeof(*set->histograms) +
122 set->histograms = (VP8LHistogram**)memory;
123 memory += size * sizeof(*set->histograms);
128 set->histograms[i] = (VP8LHistogram*)memory;
130 set->histograms[i]->literal_ = (uint32_t*)(memory + sizeof(VP8LHistogram));
131 VP8LHistogramInit(set->histograms[i], cache_bits);
415 // Construct the histograms from backward references.
421 VP8LHistogram** const histograms = image_histo->histograms;
427 VP8LHistogramAddSinglePixOrCopy(histograms[ix], v);
437 // Copies the histograms
442 VP8LHistogram** const orig_histograms = orig_histo->histograms;
443 VP8LHistogram** const histograms = image_histo->histograms;
447 // Copy histograms from orig_histo[] to image_histo[].
448 HistogramCopy(histo, histograms[i]);
452 // Partition histograms to different entropy bins for three dominant (literal,
457 VP8LHistogram** const histograms = image_histo->histograms;
465 VP8LHistogram* const histo = histograms[i];
469 // bin-hash histograms on three of the dominant (literal, red and blue)
473 VP8LHistogram* const histo = histograms[i];
479 // histograms in that bin.
490 VP8LHistogram** const histograms = image_histo->histograms;
494 if (histograms[i] != NULL && histograms[i]->bit_cost_ != 0.) {
496 histograms[j] = histograms[i];
497 histograms[i] = NULL;
511 VP8LHistogram** const histograms = image_histo->histograms;
522 // Merge all histograms with the same bin index, irrespective of cost of
523 // the merged histograms.
524 VP8LHistogramAdd(histograms[idx1], histograms[idx2], histograms[idx1]);
525 histograms[idx2]->bit_cost_ = 0.;
527 const double bit_cost_idx2 = histograms[idx2]->bit_cost_;
531 HistogramAddEval(histograms[idx1], histograms[idx2],
534 // Try to merge two histograms only if the combo is a trivial one or
535 // the two candidate histograms are already non-trivial.
538 // histograms as usual to avoid increasing the header size.
541 ((histograms[idx1]->trivial_symbol_ == VP8L_NON_TRIVIAL_SYM) &&
542 (histograms[idx2]->trivial_symbol_ == VP8L_NON_TRIVIAL_SYM));
545 HistogramSwap(&cur_combo, &histograms[idx1]);
546 histograms[idx2]->bit_cost_ = 0.;
555 // Update the bit_cost for the merged histograms (per bin index).
556 UpdateHistogramCost(histograms[idx1]);
574 // Pair of histograms. Negative idx1 value means that pair is out-of-date.
638 static void PreparePair(VP8LHistogram** histograms, int idx1, int idx2,
649 HistogramAddEval(histograms[idx1], histograms[idx2], histos, 0);
653 // Combines histograms by continuously choosing the one with the highest cost
660 VP8LHistogram** const histograms = image_histo->histograms;
661 // Indexes of remaining histograms.
675 PreparePair(histograms, i, j, &histo_queue.queue[histo_queue.size],
685 VP8LHistogramAdd(histograms[idx2], histograms[idx1], histograms[idx1]);
686 histograms[idx1]->bit_cost_ = histo_queue.queue[0].cost_combo;
717 PreparePair(histograms, idx1, clusters[i],
723 // Move remaining histograms to the beginning of the array.
725 if (i != clusters[i]) { // swap the two histograms
726 HistogramSwap(&histograms[i], &histograms[clusters[i]]);
752 VP8LHistogram** const histograms = image_histo->histograms;
754 // Collapse similar histograms in 'image_histo'.
767 // Choose two histograms at random and try to combine them.
778 curr_cost_diff = HistogramAddEval(histograms[idx1], histograms[idx2],
789 HistogramSwap(&best_combo, &histograms[best_idx1]);
793 HistogramSwap(&histograms[image_histo_size], &histograms[best_idx2]);
794 histograms[image_histo_size] = NULL;
809 // Find the best 'out' histogram for each of the 'in' histograms.
815 VP8LHistogram** const orig_histograms = orig_histo->histograms;
816 VP8LHistogram** const histograms = image_histo->histograms;
823 HistogramAddThresh(histograms[0], orig_histograms[i], MAX_COST);
827 HistogramAddThresh(histograms[k], orig_histograms[i], best_bits);
844 HistogramClear(histograms[i]);
849 VP8LHistogramAdd(orig_histograms[i], histograms[idx], histograms[idx]);
878 // bin_map[n][0] = num_histo; // The number of histograms in that bin.
893 // histograms of small sizes, as bin_map will be very sparse and;
901 // Construct the histograms from backward references.
903 // Copies the histograms and computes its bit_cost.
906 cur_combo = tmp_histos->histograms[1]; // pick up working slot
911 // Collapse histograms with similar entropy.
917 // Don't combine the histograms using stochastic and greedy heuristics for
924 tmp_histos->histograms[0],
933 // Find the optimal map from original histograms to the final ones.