mirror of
https://github.com/emmanuel-marty/lzsa.git
synced 2025-01-19 19:30:13 +00:00
Split non-rep from repmatch candidates
This commit is contained in:
parent
a38e8b126c
commit
0b5e915d83
@ -334,13 +334,17 @@ static void lzsa_optimize_forward_v2(lzsa_compressor *pCompressor, const unsigne
|
|||||||
int nRepOffset = arrival[(i << MATCHES_PER_ARRIVAL_SHIFT) + j].rep_offset;
|
int nRepOffset = arrival[(i << MATCHES_PER_ARRIVAL_SHIFT) + j].rep_offset;
|
||||||
int nCurMaxRepLen = 0;
|
int nCurMaxRepLen = 0;
|
||||||
|
|
||||||
if (nMatchOffset != nRepOffset &&
|
if (nRepOffset) {
|
||||||
nRepOffset &&
|
if (nMatchOffset == nRepOffset)
|
||||||
i > nRepOffset &&
|
nCurMaxRepLen = nMatchLen;
|
||||||
|
else {
|
||||||
|
if (i > nRepOffset &&
|
||||||
(i - nRepOffset + nMatchLen) <= (nEndOffset - LAST_LITERALS)) {
|
(i - nRepOffset + nMatchLen) <= (nEndOffset - LAST_LITERALS)) {
|
||||||
while (nCurMaxRepLen < nMatchLen && pInWindow[i - nRepOffset + nCurMaxRepLen] == pInWindow[i - nMatchOffset + nCurMaxRepLen])
|
while (nCurMaxRepLen < nMatchLen && pInWindow[i - nRepOffset + nCurMaxRepLen] == pInWindow[i - nMatchOffset + nCurMaxRepLen])
|
||||||
nCurMaxRepLen++;
|
nCurMaxRepLen++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
nMaxRepLen[j] = nCurMaxRepLen;
|
nMaxRepLen[j] = nCurMaxRepLen;
|
||||||
}
|
}
|
||||||
@ -365,15 +369,16 @@ static void lzsa_optimize_forward_v2(lzsa_compressor *pCompressor, const unsigne
|
|||||||
|
|
||||||
if (nRepCodingChoiceCost <= pDestSlots[nMatchesPerArrival - 1].cost) {
|
if (nRepCodingChoiceCost <= pDestSlots[nMatchesPerArrival - 1].cost) {
|
||||||
int nRepOffset = arrival[(i << MATCHES_PER_ARRIVAL_SHIFT) + j].rep_offset;
|
int nRepOffset = arrival[(i << MATCHES_PER_ARRIVAL_SHIFT) + j].rep_offset;
|
||||||
int nMatchOffsetCost = (nMatchOffset == nRepOffset) ? 0 : nNoRepmatchOffsetCost;
|
|
||||||
int nCodingChoiceCost = nRepCodingChoiceCost + nMatchOffsetCost;
|
if (nMatchOffset != nRepOffset) {
|
||||||
|
int nCodingChoiceCost = nRepCodingChoiceCost + nNoRepmatchOffsetCost;
|
||||||
|
|
||||||
if (!nFavorRatio && !arrival[(i << MATCHES_PER_ARRIVAL_SHIFT) + j].num_literals)
|
if (!nFavorRatio && !arrival[(i << MATCHES_PER_ARRIVAL_SHIFT) + j].num_literals)
|
||||||
nCodingChoiceCost += MODESWITCH_PENALTY;
|
nCodingChoiceCost += MODESWITCH_PENALTY;
|
||||||
|
|
||||||
if (nCodingChoiceCost <= pDestSlots[nMatchesPerArrival - 1].cost) {
|
if (nCodingChoiceCost <= pDestSlots[nMatchesPerArrival - 1].cost) {
|
||||||
int exists = 0;
|
int exists = 0;
|
||||||
int nScore = arrival[(i << MATCHES_PER_ARRIVAL_SHIFT) + j].score + ((nMatchOffset == nRepOffset) ? 2 : 3);
|
int nScore = arrival[(i << MATCHES_PER_ARRIVAL_SHIFT) + j].score + 3;
|
||||||
|
|
||||||
for (n = 0;
|
for (n = 0;
|
||||||
n < nMatchesPerArrival && pDestSlots[n].cost <= nCodingChoiceCost;
|
n < nMatchesPerArrival && pDestSlots[n].cost <= nCodingChoiceCost;
|
||||||
@ -413,6 +418,7 @@ static void lzsa_optimize_forward_v2(lzsa_compressor *pCompressor, const unsigne
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* If this coding choice doesn't rep-match, see if we still get a match by using the current repmatch offset for this arrival. This can occur (and not have the
|
/* If this coding choice doesn't rep-match, see if we still get a match by using the current repmatch offset for this arrival. This can occur (and not have the
|
||||||
* matchfinder offer the offset in the first place, or have too many choices with the same cost to retain the repmatchable offset) when compressing regions
|
* matchfinder offer the offset in the first place, or have too many choices with the same cost to retain the repmatchable offset) when compressing regions
|
||||||
|
Loading…
x
Reference in New Issue
Block a user