mirror of
https://github.com/emmanuel-marty/lzsa.git
synced 2024-12-28 09:29:39 +00:00
Small LZSA2 improvement
This commit is contained in:
parent
a5f3691d4f
commit
38bfea7ecf
@ -328,19 +328,25 @@ static void lzsa_optimize_forward_v2(lzsa_compressor *pCompressor, const unsigne
|
|||||||
const int nNumLiterals = cur_arrival[j].num_literals + 1;
|
const int nNumLiterals = cur_arrival[j].num_literals + 1;
|
||||||
const int nRepOffset = cur_arrival[j].rep_offset;
|
const int nRepOffset = cur_arrival[j].rep_offset;
|
||||||
|
|
||||||
if (nNumLiterals == 1) {
|
switch (nNumLiterals) {
|
||||||
|
case 1:
|
||||||
nCodingChoiceCost += nModeSwitchPenalty;
|
nCodingChoiceCost += nModeSwitchPenalty;
|
||||||
}
|
break;
|
||||||
else if (nNumLiterals == LITERALS_RUN_LEN_V2) {
|
|
||||||
|
case LITERALS_RUN_LEN_V2:
|
||||||
nCodingChoiceCost += 4;
|
nCodingChoiceCost += 4;
|
||||||
}
|
break;
|
||||||
else if (nNumLiterals >= (LITERALS_RUN_LEN_V2 + 15)) {
|
|
||||||
if (nNumLiterals == (LITERALS_RUN_LEN_V2 + 15)) {
|
case LITERALS_RUN_LEN_V2 + 15:
|
||||||
nCodingChoiceCost += 8;
|
nCodingChoiceCost += 8;
|
||||||
}
|
break;
|
||||||
else if (nNumLiterals == 256) {
|
|
||||||
nCodingChoiceCost += 16;
|
case 256:
|
||||||
}
|
nCodingChoiceCost += 16;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nCodingChoiceCost < pDestLiteralSlots[nArrivalsPerPosition - 1].cost ||
|
if (nCodingChoiceCost < pDestLiteralSlots[nArrivalsPerPosition - 1].cost ||
|
||||||
|
Loading…
Reference in New Issue
Block a user