mirror of
https://github.com/emmanuel-marty/lzsa.git
synced 2025-02-16 17:30:44 +00:00
Faster LZSA2 compression
This commit is contained in:
parent
c39158eea8
commit
cf49af5cda
@ -558,7 +558,7 @@ static void lzsa_optimize_forward_v2(lzsa_compressor *pCompressor, const unsigne
|
||||
int exists = 0;
|
||||
|
||||
for (n = 0;
|
||||
n < nMatchesPerArrival && pDestSlots[n].cost <= nRepCodingChoiceCost;
|
||||
n < nMatchesPerArrival && pDestSlots[n].cost < nRepCodingChoiceCost;
|
||||
n++) {
|
||||
if (pDestSlots[n].rep_offset == nRepOffset) {
|
||||
exists = 1;
|
||||
@ -569,11 +569,32 @@ static void lzsa_optimize_forward_v2(lzsa_compressor *pCompressor, const unsigne
|
||||
if (!exists) {
|
||||
int nScore = cur_arrival[j].score + 2;
|
||||
|
||||
for (n = 0; n < nMatchesPerArrival; n++) {
|
||||
for (;
|
||||
n < nMatchesPerArrival && pDestSlots[n].cost == nRepCodingChoiceCost && nScore >= (pDestSlots[n].score + nDisableScore);
|
||||
n++) {
|
||||
if (pDestSlots[n].rep_offset == nRepOffset) {
|
||||
exists = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!exists) {
|
||||
int nn;
|
||||
|
||||
for (nn = n;
|
||||
nn < nMatchesPerArrival && pDestSlots[nn].cost == nRepCodingChoiceCost;
|
||||
nn++) {
|
||||
if (pDestSlots[nn].rep_offset == nRepOffset) {
|
||||
exists = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!exists) {
|
||||
for (; n < nMatchesPerArrival; n++) {
|
||||
lzsa_arrival* pDestArrival = &pDestSlots[n];
|
||||
|
||||
if (nRepCodingChoiceCost < pDestArrival->cost ||
|
||||
(nRepCodingChoiceCost == pDestArrival->cost && nScore < (pDestArrival->score + nDisableScore))) {
|
||||
if (nRepCodingChoiceCost < pDestArrival->cost || nScore < (pDestArrival->score + nDisableScore)) {
|
||||
if (pDestArrival->from_slot) {
|
||||
int z;
|
||||
|
||||
@ -602,6 +623,8 @@ static void lzsa_optimize_forward_v2(lzsa_compressor *pCompressor, const unsigne
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user