Another LZSA2 compression speedup

This commit is contained in:
Emmanuel Marty 2020-07-14 17:01:07 +02:00 committed by GitHub
parent cf49af5cda
commit 61698b5036
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -481,14 +481,13 @@ static void lzsa_optimize_forward_v2(lzsa_compressor *pCompressor, const unsigne
} }
if (!exists) { if (!exists) {
int nScore = cur_arrival[j].score + 3 + nScorePenalty;
int nn; int nn;
for (nn = n; for (nn = n;
nn < nMatchesPerArrival && pDestSlots[nn].cost == nCodingChoiceCost; nn < nMatchesPerArrival && pDestSlots[nn].cost == nCodingChoiceCost;
nn++) { nn++) {
if (pDestSlots[nn].rep_offset == nMatchOffset && if (pDestSlots[nn].rep_offset == nMatchOffset &&
(!nInsertForwardReps || pDestSlots[nn].rep_pos >= i || nScore >= (pDestSlots[nn].score + nDisableScore) || (!nInsertForwardReps || pDestSlots[nn].rep_pos >= i ||
pDestSlots[nMatchesPerArrival - 1].from_slot)) { pDestSlots[nMatchesPerArrival - 1].from_slot)) {
exists = 1; exists = 1;
break; break;
@ -496,6 +495,8 @@ static void lzsa_optimize_forward_v2(lzsa_compressor *pCompressor, const unsigne
} }
if (!exists) { if (!exists) {
int nScore = cur_arrival[j].score + 3 + nScorePenalty;
for (; n < nMatchesPerArrival - 1; n++) { for (; n < nMatchesPerArrival - 1; n++) {
lzsa_arrival* pDestArrival = &pDestSlots[n]; lzsa_arrival* pDestArrival = &pDestSlots[n];