mirror of
https://github.com/facebook/zstd.git
synced 2025-07-16 20:24:32 +02:00
slightly improved ratio at -22
merging of repcode search into btsearch introduced a small compression ratio regressio at max level : 1.3.2 : 52728769 after repMerge patch : 52760789 (+32020) A few minor changes have produced this difference. They can be hard to spot. This patch buys back about half of the difference, by no longer inserting position at hc3 when a long match is found there. It feels strangely counter-intuitive, but works : after this patch : 52742555 (-18234)
This commit is contained in:
@ -263,7 +263,7 @@ U32 ZSTD_insertBtAndGetAllMatches (
|
||||
U32 const windowLow = zc->lowLimit;
|
||||
U32* smallerPtr = bt + 2*(current&btMask);
|
||||
U32* largerPtr = bt + 2*(current&btMask) + 1;
|
||||
U32 matchEndIdx = current+8; /* farthest referenced position of any match => detects repetitive patterns */
|
||||
U32 matchEndIdx = current+8+1; /* farthest referenced position of any match => detects repetitive patterns */
|
||||
U32 dummy32; /* to be nullified at the end */
|
||||
U32 mnum = 0;
|
||||
|
||||
@ -328,8 +328,9 @@ U32 ZSTD_insertBtAndGetAllMatches (
|
||||
matches[0].off = (current - matchIndex3) + ZSTD_REP_MOVE;
|
||||
matches[0].len = (U32)mlen;
|
||||
mnum = 1;
|
||||
if ( (mlen > sufficient_len)
|
||||
| (ip+mlen == iLimit) ) { /* best possible */
|
||||
if ( (mlen > sufficient_len) |
|
||||
(ip+mlen == iLimit) ) { /* best possible length */
|
||||
zc->nextToUpdate = current+1; /* skip insertion */
|
||||
return 1;
|
||||
} } } }
|
||||
|
||||
@ -387,7 +388,8 @@ U32 ZSTD_insertBtAndGetAllMatches (
|
||||
|
||||
*smallerPtr = *largerPtr = 0;
|
||||
|
||||
zc->nextToUpdate = (matchEndIdx > current + 8) ? matchEndIdx - 8 : current+1; /* skip repetitive patterns */
|
||||
assert(matchEndIdx > current+8);
|
||||
zc->nextToUpdate = matchEndIdx - 8; /* skip repetitive patterns */
|
||||
return mnum;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user