lossless: rle mode not to accept lengths smaller than 4.

Gives a compression gain of 0.22 %

Change-Id: I0f3b8dad6b4c1bfb16eab095a467f34466b9e3b7
This commit is contained in:
Jyrki Alakuijala 2015-06-11 18:49:37 +00:00 committed by James Zern
parent 84326e4ab0
commit 5e75642efd

View File

@ -368,7 +368,15 @@ static int BackwardReferencesRle(int xsize, int ysize,
if (argb[i] == argb[i - 1]) {
++match_len;
} else {
PushBackCopy(refs, match_len);
const int kMinLength = 4;
if (match_len >= kMinLength) {
PushBackCopy(refs, match_len);
} else {
int k;
for(k = match_len; k >= 1; --k) {
AddSingleLiteral(argb[i - k], use_color_cache, &hashers, refs);
}
}
match_len = 0;
AddSingleLiteral(argb[i], use_color_cache, &hashers, refs);
}