mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-27 22:28:22 +01:00
lossless: simplify HashChainFindCopy heuristics
for small speedup 0.0003 % worse compression Change-Id: Ic4b6b21e5279231c6321f2cec1c79f7e17e56afa
This commit is contained in:
parent
888429f409
commit
8e9c94dedb
@ -281,34 +281,32 @@ static int HashChainFindCopy(const VP8LHashChain* const p,
|
||||
int* const distance_ptr,
|
||||
int* const length_ptr) {
|
||||
const uint32_t* const argb_start = argb + base_position;
|
||||
int iter = 0;
|
||||
int iter = iter_max;
|
||||
int best_length = 1;
|
||||
const int length_max = 256;
|
||||
int best_distance = 0;
|
||||
const int min_pos =
|
||||
(base_position > window_size) ? base_position - window_size : 0;
|
||||
int pos;
|
||||
int length_max = 256;
|
||||
if (max_len < length_max) {
|
||||
length_max = max_len;
|
||||
}
|
||||
assert(xsize > 0);
|
||||
for (pos = p->hash_to_first_index_[GetPixPairHash64(argb_start)];
|
||||
pos >= min_pos;
|
||||
pos = p->chain_[pos]) {
|
||||
int curr_length;
|
||||
int distance;
|
||||
if (iter > 8) {
|
||||
if (iter > iter_max || best_length >= length_max) {
|
||||
break;
|
||||
}
|
||||
if (--iter < 0) {
|
||||
break;
|
||||
}
|
||||
++iter;
|
||||
|
||||
curr_length = FindMatchLength(argb + pos, argb_start, best_length, max_len);
|
||||
if (curr_length < best_length) continue;
|
||||
|
||||
distance = base_position - pos;
|
||||
if (best_length < curr_length) {
|
||||
distance = base_position - pos;
|
||||
best_length = curr_length;
|
||||
best_distance = distance;
|
||||
if (curr_length >= max_len) {
|
||||
if (curr_length >= length_max) {
|
||||
break;
|
||||
}
|
||||
if ((distance == 1 || distance == xsize) &&
|
||||
|
Loading…
Reference in New Issue
Block a user