From 61698b5036773986cb191f0e301501857b35ec8a Mon Sep 17 00:00:00 2001 From: Emmanuel Marty Date: Tue, 14 Jul 2020 17:01:07 +0200 Subject: [PATCH] Another LZSA2 compression speedup --- src/shrink_block_v2.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/shrink_block_v2.c b/src/shrink_block_v2.c index 4d61913..f3849ba 100644 --- a/src/shrink_block_v2.c +++ b/src/shrink_block_v2.c @@ -481,14 +481,13 @@ static void lzsa_optimize_forward_v2(lzsa_compressor *pCompressor, const unsigne } if (!exists) { - int nScore = cur_arrival[j].score + 3 + nScorePenalty; int nn; for (nn = n; nn < nMatchesPerArrival && pDestSlots[nn].cost == nCodingChoiceCost; nn++) { 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)) { exists = 1; break; @@ -496,6 +495,8 @@ static void lzsa_optimize_forward_v2(lzsa_compressor *pCompressor, const unsigne } if (!exists) { + int nScore = cur_arrival[j].score + 3 + nScorePenalty; + for (; n < nMatchesPerArrival - 1; n++) { lzsa_arrival* pDestArrival = &pDestSlots[n];