Rename and Move DD_BLOG Constant to ZSTD_LAZY_DDSS_BUCKET_LOG
This commit is contained in:
parent
5e91ae27eb
commit
5390fee4f7
@ -4328,14 +4328,14 @@ ZSTD_dedicatedDictSearch_defaultCParameters[4][ZSTD_MAX_CLEVEL+1] = {
|
||||
{ 0, 0, 0, 0, 0, 0, (ZSTD_strategy)0 }, /* level 2 (not adjusted) */
|
||||
{ 0, 0, 0, 0, 0, 0, (ZSTD_strategy)0 }, /* level 3 (not adjusted) */
|
||||
{ 0, 0, 0, 0, 0, 0, (ZSTD_strategy)0 }, /* level 4 (not adjusted) */
|
||||
{ 21, 18, 19 + DD_BLOG, 2, 5, 2, ZSTD_greedy }, /* level 5 */
|
||||
{ 21, 19, 19 + DD_BLOG, 3, 5, 4, ZSTD_greedy }, /* level 6 */
|
||||
{ 21, 19, 19 + DD_BLOG, 3, 5, 8, ZSTD_lazy }, /* level 7 */
|
||||
{ 21, 19, 19 + DD_BLOG, 3, 5, 16, ZSTD_lazy2 }, /* level 8 */
|
||||
{ 21, 19, 20 + DD_BLOG, 4, 5, 16, ZSTD_lazy2 }, /* level 9 */
|
||||
{ 22, 20, 21 + DD_BLOG, 4, 5, 16, ZSTD_lazy2 }, /* level 10 */
|
||||
{ 22, 21, 22 + DD_BLOG, 4, 5, 16, ZSTD_lazy2 }, /* level 11 */
|
||||
{ 22, 21, 22 + DD_BLOG, 5, 5, 16, ZSTD_lazy2 }, /* level 12 */
|
||||
{ 21, 18, 19 + ZSTD_LAZY_DDSS_BUCKET_LOG, 2, 5, 2, ZSTD_greedy }, /* level 5 */
|
||||
{ 21, 19, 19 + ZSTD_LAZY_DDSS_BUCKET_LOG, 3, 5, 4, ZSTD_greedy }, /* level 6 */
|
||||
{ 21, 19, 19 + ZSTD_LAZY_DDSS_BUCKET_LOG, 3, 5, 8, ZSTD_lazy }, /* level 7 */
|
||||
{ 21, 19, 19 + ZSTD_LAZY_DDSS_BUCKET_LOG, 3, 5, 16, ZSTD_lazy2 }, /* level 8 */
|
||||
{ 21, 19, 20 + ZSTD_LAZY_DDSS_BUCKET_LOG, 4, 5, 16, ZSTD_lazy2 }, /* level 9 */
|
||||
{ 22, 20, 21 + ZSTD_LAZY_DDSS_BUCKET_LOG, 4, 5, 16, ZSTD_lazy2 }, /* level 10 */
|
||||
{ 22, 21, 22 + ZSTD_LAZY_DDSS_BUCKET_LOG, 4, 5, 16, ZSTD_lazy2 }, /* level 11 */
|
||||
{ 22, 21, 22 + ZSTD_LAZY_DDSS_BUCKET_LOG, 5, 5, 16, ZSTD_lazy2 }, /* level 12 */
|
||||
{ 0, 0, 0, 0, 0, 0, (ZSTD_strategy)0 }, /* level 13 (not adjusted) */
|
||||
{ 0, 0, 0, 0, 0, 0, (ZSTD_strategy)0 }, /* level 14 (not adjusted) */
|
||||
{ 0, 0, 0, 0, 0, 0, (ZSTD_strategy)0 }, /* level 15 (not adjusted) */
|
||||
@ -4353,13 +4353,13 @@ ZSTD_dedicatedDictSearch_defaultCParameters[4][ZSTD_MAX_CLEVEL+1] = {
|
||||
{ 0, 0, 0, 0, 0, 0, (ZSTD_strategy)0 }, /* level 1 (not adjusted) */
|
||||
{ 0, 0, 0, 0, 0, 0, (ZSTD_strategy)0 }, /* level 2 (not adjusted) */
|
||||
{ 0, 0, 0, 0, 0, 0, (ZSTD_strategy)0 }, /* level 3 (not adjusted) */
|
||||
{ 18, 16, 17 + DD_BLOG, 2, 5, 2, ZSTD_greedy }, /* level 4 */
|
||||
{ 18, 18, 18 + DD_BLOG, 3, 5, 2, ZSTD_greedy }, /* level 5 */
|
||||
{ 18, 18, 19 + DD_BLOG, 3, 5, 4, ZSTD_lazy }, /* level 6 */
|
||||
{ 18, 18, 19 + DD_BLOG, 4, 4, 4, ZSTD_lazy }, /* level 7 */
|
||||
{ 18, 18, 19 + DD_BLOG, 4, 4, 8, ZSTD_lazy2 }, /* level 8 */
|
||||
{ 18, 18, 19 + DD_BLOG, 5, 4, 8, ZSTD_lazy2 }, /* level 9 */
|
||||
{ 18, 18, 19 + DD_BLOG, 6, 4, 8, ZSTD_lazy2 }, /* level 10 */
|
||||
{ 18, 16, 17 + ZSTD_LAZY_DDSS_BUCKET_LOG, 2, 5, 2, ZSTD_greedy }, /* level 4 */
|
||||
{ 18, 18, 18 + ZSTD_LAZY_DDSS_BUCKET_LOG, 3, 5, 2, ZSTD_greedy }, /* level 5 */
|
||||
{ 18, 18, 19 + ZSTD_LAZY_DDSS_BUCKET_LOG, 3, 5, 4, ZSTD_lazy }, /* level 6 */
|
||||
{ 18, 18, 19 + ZSTD_LAZY_DDSS_BUCKET_LOG, 4, 4, 4, ZSTD_lazy }, /* level 7 */
|
||||
{ 18, 18, 19 + ZSTD_LAZY_DDSS_BUCKET_LOG, 4, 4, 8, ZSTD_lazy2 }, /* level 8 */
|
||||
{ 18, 18, 19 + ZSTD_LAZY_DDSS_BUCKET_LOG, 5, 4, 8, ZSTD_lazy2 }, /* level 9 */
|
||||
{ 18, 18, 19 + ZSTD_LAZY_DDSS_BUCKET_LOG, 6, 4, 8, ZSTD_lazy2 }, /* level 10 */
|
||||
{ 0, 0, 0, 0, 0, 0, (ZSTD_strategy)0 }, /* level 11 (not adjusted) */
|
||||
{ 0, 0, 0, 0, 0, 0, (ZSTD_strategy)0 }, /* level 12 (not adjusted) */
|
||||
{ 0, 0, 0, 0, 0, 0, (ZSTD_strategy)0 }, /* level 13 (not adjusted) */
|
||||
@ -4380,12 +4380,12 @@ ZSTD_dedicatedDictSearch_defaultCParameters[4][ZSTD_MAX_CLEVEL+1] = {
|
||||
{ 0, 0, 0, 0, 0, 0, (ZSTD_strategy)0 }, /* level 2 (not adjusted) */
|
||||
{ 0, 0, 0, 0, 0, 0, (ZSTD_strategy)0 }, /* level 3 (not adjusted) */
|
||||
{ 0, 0, 0, 0, 0, 0, (ZSTD_strategy)0 }, /* level 4 (not adjusted) */
|
||||
{ 17, 16, 17 + DD_BLOG, 3, 4, 2, ZSTD_greedy }, /* level 5 */
|
||||
{ 17, 17, 17 + DD_BLOG, 3, 4, 4, ZSTD_lazy }, /* level 6 */
|
||||
{ 17, 17, 17 + DD_BLOG, 3, 4, 8, ZSTD_lazy2 }, /* level 7 */
|
||||
{ 17, 17, 17 + DD_BLOG, 4, 4, 8, ZSTD_lazy2 }, /* level 8 */
|
||||
{ 17, 17, 17 + DD_BLOG, 5, 4, 8, ZSTD_lazy2 }, /* level 9 */
|
||||
{ 17, 17, 17 + DD_BLOG, 6, 4, 8, ZSTD_lazy2 }, /* level 10 */
|
||||
{ 17, 16, 17 + ZSTD_LAZY_DDSS_BUCKET_LOG, 3, 4, 2, ZSTD_greedy }, /* level 5 */
|
||||
{ 17, 17, 17 + ZSTD_LAZY_DDSS_BUCKET_LOG, 3, 4, 4, ZSTD_lazy }, /* level 6 */
|
||||
{ 17, 17, 17 + ZSTD_LAZY_DDSS_BUCKET_LOG, 3, 4, 8, ZSTD_lazy2 }, /* level 7 */
|
||||
{ 17, 17, 17 + ZSTD_LAZY_DDSS_BUCKET_LOG, 4, 4, 8, ZSTD_lazy2 }, /* level 8 */
|
||||
{ 17, 17, 17 + ZSTD_LAZY_DDSS_BUCKET_LOG, 5, 4, 8, ZSTD_lazy2 }, /* level 9 */
|
||||
{ 17, 17, 17 + ZSTD_LAZY_DDSS_BUCKET_LOG, 6, 4, 8, ZSTD_lazy2 }, /* level 10 */
|
||||
{ 0, 0, 0, 0, 0, 0, (ZSTD_strategy)0 }, /* level 11 (not adjusted) */
|
||||
{ 0, 0, 0, 0, 0, 0, (ZSTD_strategy)0 }, /* level 12 (not adjusted) */
|
||||
{ 0, 0, 0, 0, 0, 0, (ZSTD_strategy)0 }, /* level 13 (not adjusted) */
|
||||
@ -4405,11 +4405,11 @@ ZSTD_dedicatedDictSearch_defaultCParameters[4][ZSTD_MAX_CLEVEL+1] = {
|
||||
{ 0, 0, 0, 0, 0, 0, (ZSTD_strategy)0 }, /* level 1 (not adjusted) */
|
||||
{ 0, 0, 0, 0, 0, 0, (ZSTD_strategy)0 }, /* level 2 (not adjusted) */
|
||||
{ 0, 0, 0, 0, 0, 0, (ZSTD_strategy)0 }, /* level 3 (not adjusted) */
|
||||
{ 14, 14, 14 + DD_BLOG, 4, 4, 2, ZSTD_greedy }, /* level 4 */
|
||||
{ 14, 14, 14 + DD_BLOG, 3, 4, 4, ZSTD_lazy }, /* level 5 */
|
||||
{ 14, 14, 14 + DD_BLOG, 4, 4, 8, ZSTD_lazy2 }, /* level 6 */
|
||||
{ 14, 14, 14 + DD_BLOG, 6, 4, 8, ZSTD_lazy2 }, /* level 7 */
|
||||
{ 14, 14, 14 + DD_BLOG, 8, 4, 8, ZSTD_lazy2 }, /* level 8 */
|
||||
{ 14, 14, 14 + ZSTD_LAZY_DDSS_BUCKET_LOG, 4, 4, 2, ZSTD_greedy }, /* level 4 */
|
||||
{ 14, 14, 14 + ZSTD_LAZY_DDSS_BUCKET_LOG, 3, 4, 4, ZSTD_lazy }, /* level 5 */
|
||||
{ 14, 14, 14 + ZSTD_LAZY_DDSS_BUCKET_LOG, 4, 4, 8, ZSTD_lazy2 }, /* level 6 */
|
||||
{ 14, 14, 14 + ZSTD_LAZY_DDSS_BUCKET_LOG, 6, 4, 8, ZSTD_lazy2 }, /* level 7 */
|
||||
{ 14, 14, 14 + ZSTD_LAZY_DDSS_BUCKET_LOG, 8, 4, 8, ZSTD_lazy2 }, /* level 8 */
|
||||
{ 0, 0, 0, 0, 0, 0, (ZSTD_strategy)0 }, /* level 9 (not adjusted) */
|
||||
{ 0, 0, 0, 0, 0, 0, (ZSTD_strategy)0 }, /* level 10 (not adjusted) */
|
||||
{ 0, 0, 0, 0, 0, 0, (ZSTD_strategy)0 }, /* level 11 (not adjusted) */
|
||||
|
@ -28,13 +28,6 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* Dedicated dict search bucket log:
|
||||
* ---------------------------------
|
||||
* This determines the additional space we need for the hash table.
|
||||
* We will have 2^DD_BLOG slots in our bucket. */
|
||||
#define DD_BLOG 2
|
||||
|
||||
/*-*************************************
|
||||
* Constants
|
||||
***************************************/
|
||||
|
@ -484,12 +484,12 @@ void ZSTD_dedicatedDictSearch_lazy_loadDictionary(ZSTD_matchState_t* ms, const B
|
||||
for (U32 idx = ms->nextToUpdate; idx < target; idx++) {
|
||||
U32 const h = ZSTD_hashPtr(
|
||||
ms->window.base + idx,
|
||||
ms->cParams.hashLog - DD_BLOG,
|
||||
ms->cParams.minMatch) << DD_BLOG;
|
||||
ms->cParams.hashLog - ZSTD_LAZY_DDSS_BUCKET_LOG,
|
||||
ms->cParams.minMatch) << ZSTD_LAZY_DDSS_BUCKET_LOG;
|
||||
chainTable[idx & chainMask] = ms->hashTable[h];
|
||||
ms->hashTable[h] = idx;
|
||||
/* Same logic as before. But now, just copy the chain into the bucket */
|
||||
for (U32 i = 0; i < (1 << DD_BLOG) - 1; i++)
|
||||
for (U32 i = 0; i < (1 << ZSTD_LAZY_DDSS_BUCKET_LOG) - 1; i++)
|
||||
ms->hashTable[h + i + 1] = chainTable[ms->hashTable[h + i] & chainMask];
|
||||
}
|
||||
ms->nextToUpdate = target;
|
||||
@ -525,9 +525,9 @@ size_t ZSTD_HcFindBestMatch_generic (
|
||||
|
||||
const ZSTD_matchState_t* const dms = ms->dictMatchState;
|
||||
const U32 ddsHashLog = dictMode == ZSTD_dedicatedDictSearch
|
||||
? dms->cParams.hashLog - DD_BLOG : 0;
|
||||
? dms->cParams.hashLog - ZSTD_LAZY_DDSS_BUCKET_LOG : 0;
|
||||
const U32 ddsIdx = dictMode == ZSTD_dedicatedDictSearch
|
||||
? ZSTD_hashPtr(ip, ddsHashLog, mls) << DD_BLOG : 0;
|
||||
? ZSTD_hashPtr(ip, ddsHashLog, mls) << ZSTD_LAZY_DDSS_BUCKET_LOG : 0;
|
||||
|
||||
U32 matchIndex;
|
||||
|
||||
@ -573,7 +573,7 @@ size_t ZSTD_HcFindBestMatch_generic (
|
||||
const U32 ddsSize = (U32)(ddsEnd - ddsBase);
|
||||
const U32 ddsIndexDelta = dictLimit - ddsSize;
|
||||
const U32 ddsMinChain = ddsSize > ddsChainSize ? ddsSize - ddsChainSize : 0;
|
||||
const U32 bucketSize = (1 << DD_BLOG);
|
||||
const U32 bucketSize = (1 << ZSTD_LAZY_DDSS_BUCKET_LOG);
|
||||
U32 attemptNb;
|
||||
|
||||
matchIndex = dms->hashTable[ddsIdx];
|
||||
|
@ -17,6 +17,14 @@ extern "C" {
|
||||
|
||||
#include "zstd_compress_internal.h"
|
||||
|
||||
/**
|
||||
* Dedicated Dictionary Search Structure bucket log. In the
|
||||
* ZSTD_dedicatedDictSearch mode, the hashTable has
|
||||
* 2 ** ZSTD_LAZY_DDSS_BUCKET_LOG entries in each bucket, rather than just
|
||||
* one.
|
||||
*/
|
||||
#define ZSTD_LAZY_DDSS_BUCKET_LOG 2
|
||||
|
||||
U32 ZSTD_insertAndFindFirstIndex(ZSTD_matchState_t* ms, const BYTE* ip);
|
||||
|
||||
void ZSTD_dedicatedDictSearch_lazy_loadDictionary(ZSTD_matchState_t* ms, const BYTE* const ip);
|
||||
|
Loading…
Reference in New Issue
Block a user