Another small LZSA2 speedup

This commit is contained in:
Emmanuel Marty 2021-10-12 21:02:16 +02:00 committed by GitHub
parent 6aee0031ed
commit 854c03bd53
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -329,7 +329,7 @@ static void lzsa_optimize_forward_v2(lzsa_compressor *pCompressor, const unsigne
int exists = 0;
for (n = 0;
n < nArrivalsPerPosition && pDestLiteralSlots[n].cost < nCodingChoiceCost;
pDestLiteralSlots[n].cost < nCodingChoiceCost;
n++) {
if (pDestLiteralSlots[n].rep_offset == nRepOffset) {
exists = 1;
@ -396,13 +396,14 @@ static void lzsa_optimize_forward_v2(lzsa_compressor *pCompressor, const unsigne
int nRepMatchArrivalIdxAndLen[(NARRIVALS_PER_POSITION_V2_MAX * 2) + 1];
int nNumRepMatchArrivals = 0;
if ((i + MIN_MATCH_SIZE_V2) <= nEndOffset) {
int nMaxRepLenForPos = nEndOffset - i;
if (nMaxRepLenForPos > LCP_MAX)
nMaxRepLenForPos = LCP_MAX;
const unsigned char* pInWindowStart = pInWindow + i;
const unsigned char* pInWindowMax = pInWindowStart + nMaxRepLenForPos;
for (j = 0; j < nNumArrivalsForThisPos && (i + MIN_MATCH_SIZE_V2) <= nEndOffset; j++) {
for (j = 0; j < nNumArrivalsForThisPos; j++) {
const int nRepOffset = cur_arrival[j].rep_offset;
if (nRepOffset) {
@ -434,6 +435,7 @@ static void lzsa_optimize_forward_v2(lzsa_compressor *pCompressor, const unsigne
}
}
}
}
nRepMatchArrivalIdxAndLen[nNumRepMatchArrivals] = -1;
if (!nReduce) {
@ -507,7 +509,7 @@ static void lzsa_optimize_forward_v2(lzsa_compressor *pCompressor, const unsigne
int exists = 0;
for (n = 0;
n < nArrivalsPerPosition && pDestSlots[n].cost < nCodingChoiceCost;
pDestSlots[n].cost < nCodingChoiceCost;
n++) {
if (pDestSlots[n].rep_offset == nMatchOffset) {
exists = 1;
@ -605,7 +607,7 @@ static void lzsa_optimize_forward_v2(lzsa_compressor *pCompressor, const unsigne
int exists = 0;
for (n = 0;
n < nArrivalsPerPosition && pDestSlots[n].cost < nRepCodingChoiceCost;
pDestSlots[n].cost < nRepCodingChoiceCost;
n++) {
if (pDestSlots[n].rep_offset == nRepOffset) {
exists = 1;