mirror of
https://github.com/webmproject/libwebp.git
synced 2025-07-19 07:20:02 +02:00
Refactor code for HistogramCombine.
Refactor code for HistogramCombine and optimize the code by calculating the combined entropy and avoid un-necessary Histogram merges. This speeds up lossless encoding by 1-2% and almost no impact on compression density. Change-Id: Iedfcf4c1f3e88077bc77fc7b8c780c4cd5d6362b
This commit is contained in:
@ -186,9 +186,9 @@ static int GetHuffBitLengthsAndCodes(
|
||||
const VP8LHistogram* const histo = histogram_image->histograms[i];
|
||||
HuffmanTreeCode* const codes = &huffman_codes[5 * i];
|
||||
for (k = 0; k < 5; ++k) {
|
||||
const int num_symbols = (k == 0) ? VP8LHistogramNumCodes(histo)
|
||||
: (k == 4) ? NUM_DISTANCE_CODES
|
||||
: 256;
|
||||
const int num_symbols =
|
||||
(k == 0) ? VP8LHistogramNumCodes(histo->palette_code_bits_) :
|
||||
(k == 4) ? NUM_DISTANCE_CODES : 256;
|
||||
codes[k].num_symbols = num_symbols;
|
||||
total_length_size += num_symbols;
|
||||
}
|
||||
|
Reference in New Issue
Block a user