mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-26 13:48:21 +01:00
Better estimate of the cache cost.
Change-Id: I171a8f80f1597bbdeb724957e789b947df3c2885
This commit is contained in:
parent
4f9f00ccf4
commit
749a8b99f7
@ -753,12 +753,18 @@ static int CalculateBestCacheSize(const uint32_t* argb, int quality,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
int code, extra_bits, extra_bits_value;
|
||||||
// We should compute the contribution of the (distance,length)
|
// We should compute the contribution of the (distance,length)
|
||||||
// histograms but those are the same independently from the cache size.
|
// histograms but those are the same independently from the cache size.
|
||||||
// As those constant contributions are in the end added to the other
|
// As those constant contributions are in the end added to the other
|
||||||
// histogram contributions, we can safely ignore them.
|
// histogram contributions, we can ignore them, except for the length
|
||||||
|
// prefix that is part of the literal_ histogram.
|
||||||
int len = PixOrCopyLength(v);
|
int len = PixOrCopyLength(v);
|
||||||
uint32_t argb_prev = *argb ^ 0xffffffffu;
|
uint32_t argb_prev = *argb ^ 0xffffffffu;
|
||||||
|
VP8LPrefixEncode(len, &code, &extra_bits, &extra_bits_value);
|
||||||
|
for (i = 0; i <= cache_bits_max; ++i) {
|
||||||
|
++histos[i]->literal_[NUM_LITERAL_CODES + code];
|
||||||
|
}
|
||||||
// Update the color caches.
|
// Update the color caches.
|
||||||
do {
|
do {
|
||||||
if (*argb != argb_prev) {
|
if (*argb != argb_prev) {
|
||||||
|
Loading…
Reference in New Issue
Block a user