diff --git a/lib/zstd_compress.c b/lib/zstd_compress.c index da519201..219b13f8 100644 --- a/lib/zstd_compress.c +++ b/lib/zstd_compress.c @@ -107,7 +107,7 @@ struct ZSTD_CCtx_s seqStore_t seqStore; /* sequences storage ptrs */ U32* hashTable; U32* hashTable3; - U32* contentTable; + U32* chainTable; HUF_CElt* hufTable; U32 flagStaticTables; FSE_CTable offcodeCTable [FSE_CTABLE_SIZE_U32(OffFSELog, MaxOff)]; @@ -142,7 +142,7 @@ const seqStore_t* ZSTD_getSeqStore(const ZSTD_CCtx* ctx) /* hidden interface * size_t ZSTD_checkCParams(ZSTD_compressionParameters cParams) { CLAMPCHECK(cParams.windowLog, ZSTD_WINDOWLOG_MIN, ZSTD_WINDOWLOG_MAX); - CLAMPCHECK(cParams.contentLog, ZSTD_CONTENTLOG_MIN, ZSTD_CONTENTLOG_MAX); + CLAMPCHECK(cParams.chainLog, ZSTD_CHAINLOG_MIN, ZSTD_CHAINLOG_MAX); CLAMPCHECK(cParams.hashLog, ZSTD_HASHLOG_MIN, ZSTD_HASHLOG_MAX); CLAMPCHECK(cParams.searchLog, ZSTD_SEARCHLOG_MIN, ZSTD_SEARCHLOG_MAX); { U32 const searchLengthMin = (cParams.strategy == ZSTD_btopt) ? ZSTD_SEARCHLENGTH_MIN : ZSTD_SEARCHLENGTH_MIN+1; @@ -162,8 +162,8 @@ size_t ZSTD_checkCParams_advanced(ZSTD_compressionParameters cParams, U64 srcSiz { if (srcSize > (1ULL << ZSTD_WINDOWLOG_MIN)) return ZSTD_checkCParams(cParams); if (cParams.windowLog < ZSTD_WINDOWLOG_ABSOLUTEMIN) return ERROR(compressionParameter_unsupported); - if (srcSize <= (1ULL << cParams.windowLog)) cParams.windowLog = ZSTD_WINDOWLOG_MIN; /* fake value - temporary work around */ - if (srcSize <= (1ULL << cParams.contentLog)) cParams.contentLog = ZSTD_CONTENTLOG_MIN; /* fake value - temporary work around */ + if (srcSize <= (1ULL << cParams.windowLog)) cParams.windowLog = ZSTD_WINDOWLOG_MIN; /* fake value - temporary work around */ + if (srcSize <= (1ULL << cParams.chainLog)) cParams.chainLog = ZSTD_CHAINLOG_MIN; /* fake value - temporary work around */ if ((srcSize <= (1ULL << cParams.hashLog)) && ((U32)cParams.strategy < (U32)ZSTD_btlazy2)) cParams.hashLog = ZSTD_HASHLOG_MIN; /* fake value - temporary work around */ return ZSTD_checkCParams(cParams); } @@ -188,8 +188,8 @@ void ZSTD_adjustCParams(ZSTD_compressionParameters* params, U64 srcSize, size_t } } if (params->hashLog > params->windowLog) params->hashLog = params->windowLog; { U32 const btPlus = (params->strategy == ZSTD_btlazy2) || (params->strategy == ZSTD_btopt); - U32 const maxContentLog = params->windowLog+btPlus; - if (params->contentLog > maxContentLog) params->contentLog = maxContentLog; } /* <= ZSTD_CONTENTLOG_MAX */ + U32 const maxChainLog = params->windowLog+btPlus; + if (params->chainLog > maxChainLog) params->chainLog = maxChainLog; } /* <= ZSTD_CHAINLOG_MAX */ if (params->windowLog < ZSTD_WINDOWLOG_ABSOLUTEMIN) params->windowLog = ZSTD_WINDOWLOG_ABSOLUTEMIN; /* required for frame header */ if ((params->hashLog < ZSTD_HASHLOG_MIN) && ((U32)params->strategy >= (U32)ZSTD_btlazy2)) params->hashLog = ZSTD_HASHLOG_MIN; /* required to ensure collision resistance in bt */ @@ -217,10 +217,10 @@ static size_t ZSTD_resetCCtx_advanced (ZSTD_CCtx* zc, const U32 divider = (params.cParams.searchLength==3) ? 3 : 4; const size_t maxNbSeq = blockSize / divider; const size_t tokenSpace = blockSize + 11*maxNbSeq; - const size_t contentSize = (params.cParams.strategy == ZSTD_fast) ? 0 : (1 << params.cParams.contentLog); + const size_t chainSize = (params.cParams.strategy == ZSTD_fast) ? 0 : (1 << params.cParams.chainLog); const size_t hSize = 1 << params.cParams.hashLog; const size_t h3Size = (params.cParams.searchLength==3) ? (1 << HASHLOG3) : 0; - const size_t tableSpace = (contentSize + hSize + h3Size) * sizeof(U32); + const size_t tableSpace = (chainSize + hSize + h3Size) * sizeof(U32); /* Check if workSpace is large enough, alloc a new one if needed */ { size_t const optSpace = ((MaxML+1) + (MaxLL+1) + (1<workSpace, 0, tableSpace ); /* reset only tables */ zc->hashTable3 = (U32*)(zc->workSpace); zc->hashTable = zc->hashTable3 + h3Size; - zc->contentTable = zc->hashTable + hSize; - zc->seqStore.buffer = zc->contentTable + contentSize; + zc->chainTable = zc->hashTable + hSize; + zc->seqStore.buffer = zc->chainTable + chainSize; zc->hufTable = (HUF_CElt*)zc->seqStore.buffer; zc->flagStaticTables = 0; zc->seqStore.buffer = ((U32*)(zc->seqStore.buffer)) + 256; @@ -289,10 +289,10 @@ size_t ZSTD_copyCCtx(ZSTD_CCtx* dstCCtx, const ZSTD_CCtx* srcCCtx) ZSTD_resetCCtx_advanced(dstCCtx, srcCCtx->params); /* copy tables */ - { const size_t contentSize = (srcCCtx->params.cParams.strategy == ZSTD_fast) ? 0 : (1 << srcCCtx->params.cParams.contentLog); + { const size_t chaineSize = (srcCCtx->params.cParams.strategy == ZSTD_fast) ? 0 : (1 << srcCCtx->params.cParams.chainLog); const size_t hSize = 1 << srcCCtx->params.cParams.hashLog; const size_t h3Size = (srcCCtx->params.cParams.searchLength == 3) ? (1 << HASHLOG3) : 0; - const size_t tableSpace = (contentSize + hSize + h3Size) * sizeof(U32); + const size_t tableSpace = (chaineSize + hSize + h3Size) * sizeof(U32); memcpy(dstCCtx->workSpace, srcCCtx->workSpace, tableSpace); } @@ -341,8 +341,8 @@ static void ZSTD_reduceIndex (ZSTD_CCtx* zc, const U32 reducerValue) { const U32 hSize = 1 << zc->params.cParams.hashLog; ZSTD_reduceTable(zc->hashTable, hSize, reducerValue); } - { const U32 contentSize = (zc->params.cParams.strategy == ZSTD_fast) ? 0 : (1 << zc->params.cParams.contentLog); - ZSTD_reduceTable(zc->contentTable, contentSize, reducerValue); } + { const U32 chainSize = (zc->params.cParams.strategy == ZSTD_fast) ? 0 : (1 << zc->params.cParams.chainLog); + ZSTD_reduceTable(zc->chainTable, chainSize, reducerValue); } { const U32 h3Size = (zc->params.cParams.searchLength == 3) ? (1 << HASHLOG3) : 0; ZSTD_reduceTable(zc->hashTable3, h3Size, reducerValue); } @@ -1257,8 +1257,8 @@ static U32 ZSTD_insertBt1(ZSTD_CCtx* zc, const BYTE* const ip, const U32 mls, co U32* const hashTable = zc->hashTable; const U32 hashLog = zc->params.cParams.hashLog; const size_t h = ZSTD_hashPtr(ip, hashLog, mls); - U32* const bt = zc->contentTable; - const U32 btLog = zc->params.cParams.contentLog - 1; + U32* const bt = zc->chainTable; + const U32 btLog = zc->params.cParams.chainLog - 1; const U32 btMask= (1 << btLog) - 1; U32 matchIndex = hashTable[h]; size_t commonLengthSmaller=0, commonLengthLarger=0; @@ -1359,8 +1359,8 @@ static size_t ZSTD_insertBtAndFindBestMatch ( U32* const hashTable = zc->hashTable; const U32 hashLog = zc->params.cParams.hashLog; const size_t h = ZSTD_hashPtr(ip, hashLog, mls); - U32* const bt = zc->contentTable; - const U32 btLog = zc->params.cParams.contentLog - 1; + U32* const bt = zc->chainTable; + const U32 btLog = zc->params.cParams.chainLog - 1; const U32 btMask= (1 << btLog) - 1; U32 matchIndex = hashTable[h]; size_t commonLengthSmaller=0, commonLengthLarger=0; @@ -1520,8 +1520,8 @@ U32 ZSTD_insertAndFindFirstIndex (ZSTD_CCtx* zc, const BYTE* ip, U32 mls) { U32* const hashTable = zc->hashTable; const U32 hashLog = zc->params.cParams.hashLog; - U32* const chainTable = zc->contentTable; - const U32 chainMask = (1 << zc->params.cParams.contentLog) - 1; + U32* const chainTable = zc->chainTable; + const U32 chainMask = (1 << zc->params.cParams.chainLog) - 1; const BYTE* const base = zc->base; const U32 target = (U32)(ip - base); U32 idx = zc->nextToUpdate; @@ -1545,8 +1545,8 @@ size_t ZSTD_HcFindBestMatch_generic ( size_t* offsetPtr, const U32 maxNbAttempts, const U32 mls, const U32 extDict) { - U32* const chainTable = zc->contentTable; - const U32 chainSize = (1 << zc->params.cParams.contentLog); + U32* const chainTable = zc->chainTable; + const U32 chainSize = (1 << zc->params.cParams.chainLog); const U32 chainMask = chainSize-1; const BYTE* const base = zc->base; const BYTE* const dictBase = zc->dictBase; @@ -2084,8 +2084,8 @@ static size_t ZSTD_compressContinue_internal (ZSTD_CCtx* zc, /* preemptive overflow correction */ if (zc->lowLimit > (1<<30)) { U32 const btplus = (zc->params.cParams.strategy == ZSTD_btlazy2) || (zc->params.cParams.strategy == ZSTD_btopt); - U32 const contentMask = (1 << (zc->params.cParams.contentLog - btplus)) - 1; - U32 const newLowLimit = zc->lowLimit & contentMask; /* preserve position % contentSize */ + U32 const chainMask = (1 << (zc->params.cParams.chainLog - btplus)) - 1; + U32 const newLowLimit = zc->lowLimit & chainMask; /* preserve position % chainSize */ U32 const correction = zc->lowLimit - newLowLimit; ZSTD_reduceIndex(zc, correction); zc->base += correction; @@ -2536,7 +2536,7 @@ ZSTD_compressionParameters ZSTD_getCParams(int compressionLevel, U64 srcSize, si cp = ZSTD_defaultCParameters[tableID][compressionLevel]; if (MEM_32bits()) { /* auto-correction, for 32-bits mode */ if (cp.windowLog > ZSTD_WINDOWLOG_MAX) cp.windowLog = ZSTD_WINDOWLOG_MAX; - if (cp.contentLog > ZSTD_CONTENTLOG_MAX) cp.contentLog = ZSTD_CONTENTLOG_MAX; + if (cp.chainLog > ZSTD_CHAINLOG_MAX) cp.chainLog = ZSTD_CHAINLOG_MAX; if (cp.hashLog > ZSTD_HASHLOG_MAX) cp.hashLog = ZSTD_HASHLOG_MAX; } return cp; diff --git a/lib/zstd_opt.h b/lib/zstd_opt.h index 0fb05d33..7618fcad 100644 --- a/lib/zstd_opt.h +++ b/lib/zstd_opt.h @@ -222,8 +222,8 @@ static U32 ZSTD_insertBtAndGetAllMatches ( const size_t h = ZSTD_hashPtr(ip, hashLog, mls); U32* const hashTable = zc->hashTable; U32 matchIndex = hashTable[h]; - U32* const bt = zc->contentTable; - const U32 btLog = zc->params.cParams.contentLog - 1; + U32* const bt = zc->chainTable; + const U32 btLog = zc->params.cParams.chainLog - 1; const U32 btMask= (1U << btLog) - 1; size_t commonLengthSmaller=0, commonLengthLarger=0; const BYTE* const dictBase = zc->dictBase; diff --git a/lib/zstd_static.h b/lib/zstd_static.h index acf9791e..2f11ceeb 100644 --- a/lib/zstd_static.h +++ b/lib/zstd_static.h @@ -59,8 +59,8 @@ extern "C" { ***************************************/ #define ZSTD_WINDOWLOG_MAX (MEM_32bits() ? 25 : 27) #define ZSTD_WINDOWLOG_MIN 18 -#define ZSTD_CONTENTLOG_MAX (ZSTD_WINDOWLOG_MAX+1) -#define ZSTD_CONTENTLOG_MIN 4 +#define ZSTD_CHAINLOG_MAX (ZSTD_WINDOWLOG_MAX+1) +#define ZSTD_CHAINLOG_MIN 4 #define ZSTD_HASHLOG_MAX ZSTD_WINDOWLOG_MAX #define ZSTD_HASHLOG_MIN 12 #define ZSTD_SEARCHLOG_MAX (ZSTD_WINDOWLOG_MAX-1) @@ -75,7 +75,7 @@ typedef enum { ZSTD_fast, ZSTD_greedy, ZSTD_lazy, ZSTD_lazy2, ZSTD_btlazy2, ZSTD typedef struct { U32 windowLog; /* largest match distance : larger == more compression, more memory needed during decompression */ - U32 contentLog; /* full search segment : larger == more compression, slower, more memory (useless for fast) */ + U32 chainLog; /* fully searched segment : larger == more compression, slower, more memory (useless for fast) */ U32 hashLog; /* dispatch table : larger == faster, more memory */ U32 searchLog; /* nb of searches : larger == more compression, slower */ U32 searchLength; /* match length searched : larger == faster decompression, sometimes less compression */ diff --git a/programs/paramgrill.c b/programs/paramgrill.c index 613bbf55..1e875b87 100644 --- a/programs/paramgrill.c +++ b/programs/paramgrill.c @@ -262,7 +262,7 @@ static size_t BMK_benchParam(BMK_result_t* resultPtr, void* const resultBuffer = malloc(srcSize); ZSTD_parameters params; U32 Wlog = cParams.windowLog; - U32 Clog = cParams.contentLog; + U32 Clog = cParams.chainLog; U32 Hlog = cParams.hashLog; U32 Slog = cParams.searchLog; U32 Slength = cParams.searchLength; @@ -415,7 +415,7 @@ static void BMK_printWinner(FILE* f, U32 cLevel, BMK_result_t result, ZSTD_compr { DISPLAY("\r%79s\r", ""); fprintf(f," {%3u,%3u,%3u,%3u,%3u,%3u, %s }, ", - params.windowLog, params.contentLog, params.hashLog, params.searchLog, params.searchLength, + params.windowLog, params.chainLog, params.hashLog, params.searchLog, params.searchLength, params.targetLength, g_stratName[(U32)(params.strategy)]); fprintf(f, "/* level %2u */ /* R:%5.3f at %5.1f MB/s - %5.1f MB/s */\n", @@ -549,7 +549,7 @@ static ZSTD_compressionParameters* sanitizeParams(ZSTD_compressionParameters par { g_params = params; if (params.strategy == ZSTD_fast) - g_params.contentLog = 0, g_params.searchLog = 0; + g_params.chainLog = 0, g_params.searchLog = 0; if (params.strategy != ZSTD_btopt ) g_params.targetLength = 0; return &g_params; @@ -568,9 +568,9 @@ static void paramVariation(ZSTD_compressionParameters* ptr) switch(changeID) { case 0: - p.contentLog++; break; + p.chainLog++; break; case 1: - p.contentLog--; break; + p.chainLog--; break; case 2: p.hashLog++; break; case 3: @@ -651,7 +651,7 @@ static void potentialRandomParams(ZSTD_compressionParameters* p, U32 inverseChan if (!chance) while (!validated) { /* totally random entry */ - p->contentLog = FUZ_rand(&g_rand) % (ZSTD_CONTENTLOG_MAX+1 - ZSTD_CONTENTLOG_MIN) + ZSTD_CONTENTLOG_MIN; + p->chainLog = FUZ_rand(&g_rand) % (ZSTD_CHAINLOG_MAX+1 - ZSTD_CHAINLOG_MIN) + ZSTD_CHAINLOG_MIN; p->hashLog = FUZ_rand(&g_rand) % (ZSTD_HASHLOG_MAX+1 - ZSTD_HASHLOG_MIN) + ZSTD_HASHLOG_MIN; p->searchLog = FUZ_rand(&g_rand) % (ZSTD_SEARCHLOG_MAX+1 - ZSTD_SEARCHLOG_MIN) + ZSTD_SEARCHLOG_MIN; p->windowLog = FUZ_rand(&g_rand) % (ZSTD_WINDOWLOG_MAX+1 - ZSTD_WINDOWLOG_MIN) + ZSTD_WINDOWLOG_MIN; @@ -1048,10 +1048,10 @@ int main(int argc, char** argv) g_params.windowLog *= 10, g_params.windowLog += *argument++ - '0'; continue; case 'c': - g_params.contentLog = 0; + g_params.chainLog = 0; argument++; while ((*argument>= '0') && (*argument<='9')) - g_params.contentLog *= 10, g_params.contentLog += *argument++ - '0'; + g_params.chainLog *= 10, g_params.chainLog += *argument++ - '0'; continue; case 'h': g_params.hashLog = 0;