mirror of
https://github.com/emmanuel-marty/lzsa.git
synced 2025-02-18 00:30:44 +00:00
Another small compression speedup
This commit is contained in:
parent
78276c18da
commit
236df36f2b
@ -431,7 +431,7 @@ static void lzsa_optimize_forward_v2(lzsa_compressor *pCompressor, const unsigne
|
|||||||
int nScore = arrival[(i << MATCHES_PER_ARRIVAL_SHIFT) + j].score + 3 + nScorePenalty;
|
int nScore = arrival[(i << MATCHES_PER_ARRIVAL_SHIFT) + j].score + 3 + nScorePenalty;
|
||||||
|
|
||||||
for (n = 0;
|
for (n = 0;
|
||||||
n < nMatchesPerArrival && pDestSlots[n].cost <= nCodingChoiceCost;
|
n < nMatchesPerArrival && pDestSlots[n].cost < nCodingChoiceCost;
|
||||||
n++) {
|
n++) {
|
||||||
if (pDestSlots[n].rep_offset == nMatchOffset &&
|
if (pDestSlots[n].rep_offset == nMatchOffset &&
|
||||||
(!nInsertForwardReps || pDestSlots[n].cost != nCodingChoiceCost || pDestSlots[n].rep_pos >= i || nScore >= (pDestSlots[n].score + nDisableScore) ||
|
(!nInsertForwardReps || pDestSlots[n].cost != nCodingChoiceCost || pDestSlots[n].rep_pos >= i || nScore >= (pDestSlots[n].score + nDisableScore) ||
|
||||||
@ -442,7 +442,19 @@ static void lzsa_optimize_forward_v2(lzsa_compressor *pCompressor, const unsigne
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!exists) {
|
if (!exists) {
|
||||||
for (n = 0; n < nMatchesPerArrival - 1; n++) {
|
for (int nn = n;
|
||||||
|
nn < nMatchesPerArrival && pDestSlots[nn].cost == nCodingChoiceCost;
|
||||||
|
nn++) {
|
||||||
|
if (pDestSlots[nn].rep_offset == nMatchOffset &&
|
||||||
|
(!nInsertForwardReps || pDestSlots[nn].cost != nCodingChoiceCost || pDestSlots[nn].rep_pos >= i || nScore >= (pDestSlots[nn].score + nDisableScore) ||
|
||||||
|
pDestSlots[nMatchesPerArrival - 1].from_slot)) {
|
||||||
|
exists = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!exists) {
|
||||||
|
for (; n < nMatchesPerArrival - 1; n++) {
|
||||||
lzsa_arrival *pDestArrival = &pDestSlots[n];
|
lzsa_arrival *pDestArrival = &pDestSlots[n];
|
||||||
|
|
||||||
if (nCodingChoiceCost < pDestArrival->cost ||
|
if (nCodingChoiceCost < pDestArrival->cost ||
|
||||||
@ -480,6 +492,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