mirror of
https://github.com/webmproject/libwebp.git
synced 2025-09-20 09:42:03 +02:00
Improve lossless compression.
This is essentially a revert ofa3611513d2
andcfbcc5ece0
. Here is what happened: there was a corruption bug that eventually got fixed by0174d18d8b
. But before finding the root,a3611513d2
andcfbcc5ece0
hid the bug by not imposing length of 1 when it was actually 2 or 3 (which does help compression as a litteral is more efficient than an offset and a length of size 2 or 3). Change-Id: I6f18fc1f583a51ac9d8aab2508458264047cd493
This commit is contained in:
@@ -442,7 +442,7 @@ static int BackwardReferencesLz77(int xsize, int ysize,
|
|||||||
int len = 0;
|
int len = 0;
|
||||||
int j;
|
int j;
|
||||||
HashChainFindCopy(hash_chain, i, &offset, &len);
|
HashChainFindCopy(hash_chain, i, &offset, &len);
|
||||||
if (len > MIN_LENGTH) {
|
if (len > MIN_LENGTH + 1) {
|
||||||
const int len_ini = len;
|
const int len_ini = len;
|
||||||
int max_reach = 0;
|
int max_reach = 0;
|
||||||
assert(i + len < pix_count);
|
assert(i + len < pix_count);
|
||||||
@@ -464,7 +464,7 @@ static int BackwardReferencesLz77(int xsize, int ysize,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
len = (len == 0) ? 1 : len;
|
len = 1;
|
||||||
}
|
}
|
||||||
// Go with literal or backward reference.
|
// Go with literal or backward reference.
|
||||||
assert(len > 0);
|
assert(len > 0);
|
||||||
|
Reference in New Issue
Block a user