Initial implementation (files added, macros fixed)
Hashing functions still to fix.
This commit is contained in:
@@ -74,3 +74,8 @@
|
|||||||
#include "decompress/zstd_ddict.c"
|
#include "decompress/zstd_ddict.c"
|
||||||
#include "decompress/zstd_decompress.c"
|
#include "decompress/zstd_decompress.c"
|
||||||
#include "decompress/zstd_decompress_block.c"
|
#include "decompress/zstd_decompress_block.c"
|
||||||
|
|
||||||
|
#include "dictBuilder/cover.c"
|
||||||
|
#include "dictBuilder/divsufsort.c"
|
||||||
|
#include "dictBuilder/fastcover.c"
|
||||||
|
#include "dictBuilder/zdict.c"
|
||||||
|
|||||||
+13
-4
@@ -40,23 +40,33 @@
|
|||||||
* Constants
|
* Constants
|
||||||
***************************************/
|
***************************************/
|
||||||
#define COVER_MAX_SAMPLES_SIZE (sizeof(size_t) == 8 ? ((unsigned)-1) : ((unsigned)1 GB))
|
#define COVER_MAX_SAMPLES_SIZE (sizeof(size_t) == 8 ? ((unsigned)-1) : ((unsigned)1 GB))
|
||||||
#define DEFAULT_SPLITPOINT 1.0
|
#define COVER_DEFAULT_SPLITPOINT 1.0
|
||||||
|
|
||||||
/*-*************************************
|
/*-*************************************
|
||||||
* Console display
|
* Console display
|
||||||
***************************************/
|
***************************************/
|
||||||
|
#ifndef LOCALDISPLAYLEVEL
|
||||||
static int g_displayLevel = 2;
|
static int g_displayLevel = 2;
|
||||||
|
#endif
|
||||||
|
#undef DISPLAY
|
||||||
#define DISPLAY(...) \
|
#define DISPLAY(...) \
|
||||||
{ \
|
{ \
|
||||||
fprintf(stderr, __VA_ARGS__); \
|
fprintf(stderr, __VA_ARGS__); \
|
||||||
fflush(stderr); \
|
fflush(stderr); \
|
||||||
}
|
}
|
||||||
|
#undef LOCALDISPLAYLEVEL
|
||||||
#define LOCALDISPLAYLEVEL(displayLevel, l, ...) \
|
#define LOCALDISPLAYLEVEL(displayLevel, l, ...) \
|
||||||
if (displayLevel >= l) { \
|
if (displayLevel >= l) { \
|
||||||
DISPLAY(__VA_ARGS__); \
|
DISPLAY(__VA_ARGS__); \
|
||||||
} /* 0 : no display; 1: errors; 2: default; 3: details; 4: debug */
|
} /* 0 : no display; 1: errors; 2: default; 3: details; 4: debug */
|
||||||
|
#undef DISPLAYLEVEL
|
||||||
#define DISPLAYLEVEL(l, ...) LOCALDISPLAYLEVEL(g_displayLevel, l, __VA_ARGS__)
|
#define DISPLAYLEVEL(l, ...) LOCALDISPLAYLEVEL(g_displayLevel, l, __VA_ARGS__)
|
||||||
|
|
||||||
|
#ifndef LOCALDISPLAYUPDATE
|
||||||
|
static const clock_t refreshRate = CLOCKS_PER_SEC * 15 / 100;
|
||||||
|
static clock_t g_time = 0;
|
||||||
|
#endif
|
||||||
|
#undef LOCALDISPLAYUPDATE
|
||||||
#define LOCALDISPLAYUPDATE(displayLevel, l, ...) \
|
#define LOCALDISPLAYUPDATE(displayLevel, l, ...) \
|
||||||
if (displayLevel >= l) { \
|
if (displayLevel >= l) { \
|
||||||
if ((clock() - g_time > refreshRate) || (displayLevel >= 4)) { \
|
if ((clock() - g_time > refreshRate) || (displayLevel >= 4)) { \
|
||||||
@@ -64,9 +74,8 @@ static int g_displayLevel = 2;
|
|||||||
DISPLAY(__VA_ARGS__); \
|
DISPLAY(__VA_ARGS__); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
#undef DISPLAYUPDATE
|
||||||
#define DISPLAYUPDATE(l, ...) LOCALDISPLAYUPDATE(g_displayLevel, l, __VA_ARGS__)
|
#define DISPLAYUPDATE(l, ...) LOCALDISPLAYUPDATE(g_displayLevel, l, __VA_ARGS__)
|
||||||
static const clock_t refreshRate = CLOCKS_PER_SEC * 15 / 100;
|
|
||||||
static clock_t g_time = 0;
|
|
||||||
|
|
||||||
/*-*************************************
|
/*-*************************************
|
||||||
* Hash table
|
* Hash table
|
||||||
@@ -1106,7 +1115,7 @@ ZDICTLIB_API size_t ZDICT_optimizeTrainFromBuffer_cover(
|
|||||||
/* constants */
|
/* constants */
|
||||||
const unsigned nbThreads = parameters->nbThreads;
|
const unsigned nbThreads = parameters->nbThreads;
|
||||||
const double splitPoint =
|
const double splitPoint =
|
||||||
parameters->splitPoint <= 0.0 ? DEFAULT_SPLITPOINT : parameters->splitPoint;
|
parameters->splitPoint <= 0.0 ? COVER_DEFAULT_SPLITPOINT : parameters->splitPoint;
|
||||||
const unsigned kMinD = parameters->d == 0 ? 6 : parameters->d;
|
const unsigned kMinD = parameters->d == 0 ? 6 : parameters->d;
|
||||||
const unsigned kMaxD = parameters->d == 0 ? 8 : parameters->d;
|
const unsigned kMaxD = parameters->d == 0 ? 8 : parameters->d;
|
||||||
const unsigned kMinK = parameters->k == 0 ? 50 : parameters->k;
|
const unsigned kMinK = parameters->k == 0 ? 50 : parameters->k;
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
#define FASTCOVER_MAX_SAMPLES_SIZE (sizeof(size_t) == 8 ? ((unsigned)-1) : ((unsigned)1 GB))
|
#define FASTCOVER_MAX_SAMPLES_SIZE (sizeof(size_t) == 8 ? ((unsigned)-1) : ((unsigned)1 GB))
|
||||||
#define FASTCOVER_MAX_F 31
|
#define FASTCOVER_MAX_F 31
|
||||||
#define FASTCOVER_MAX_ACCEL 10
|
#define FASTCOVER_MAX_ACCEL 10
|
||||||
#define DEFAULT_SPLITPOINT 0.75
|
#define FASTCOVER_DEFAULT_SPLITPOINT 0.75
|
||||||
#define DEFAULT_F 20
|
#define DEFAULT_F 20
|
||||||
#define DEFAULT_ACCEL 1
|
#define DEFAULT_ACCEL 1
|
||||||
|
|
||||||
@@ -41,18 +41,28 @@
|
|||||||
/*-*************************************
|
/*-*************************************
|
||||||
* Console display
|
* Console display
|
||||||
***************************************/
|
***************************************/
|
||||||
|
#ifndef LOCALDISPLAYLEVEL
|
||||||
static int g_displayLevel = 2;
|
static int g_displayLevel = 2;
|
||||||
|
#endif
|
||||||
|
#undef DISPLAY
|
||||||
#define DISPLAY(...) \
|
#define DISPLAY(...) \
|
||||||
{ \
|
{ \
|
||||||
fprintf(stderr, __VA_ARGS__); \
|
fprintf(stderr, __VA_ARGS__); \
|
||||||
fflush(stderr); \
|
fflush(stderr); \
|
||||||
}
|
}
|
||||||
|
#undef LOCALDISPLAYLEVEL
|
||||||
#define LOCALDISPLAYLEVEL(displayLevel, l, ...) \
|
#define LOCALDISPLAYLEVEL(displayLevel, l, ...) \
|
||||||
if (displayLevel >= l) { \
|
if (displayLevel >= l) { \
|
||||||
DISPLAY(__VA_ARGS__); \
|
DISPLAY(__VA_ARGS__); \
|
||||||
} /* 0 : no display; 1: errors; 2: default; 3: details; 4: debug */
|
} /* 0 : no display; 1: errors; 2: default; 3: details; 4: debug */
|
||||||
|
#undef DISPLAYLEVEL
|
||||||
#define DISPLAYLEVEL(l, ...) LOCALDISPLAYLEVEL(g_displayLevel, l, __VA_ARGS__)
|
#define DISPLAYLEVEL(l, ...) LOCALDISPLAYLEVEL(g_displayLevel, l, __VA_ARGS__)
|
||||||
|
|
||||||
|
#ifndef LOCALDISPLAYUPDATE
|
||||||
|
static const clock_t refreshRate = CLOCKS_PER_SEC * 15 / 100;
|
||||||
|
static clock_t g_time = 0;
|
||||||
|
#endif
|
||||||
|
#undef LOCALDISPLAYUPDATE
|
||||||
#define LOCALDISPLAYUPDATE(displayLevel, l, ...) \
|
#define LOCALDISPLAYUPDATE(displayLevel, l, ...) \
|
||||||
if (displayLevel >= l) { \
|
if (displayLevel >= l) { \
|
||||||
if ((clock() - g_time > refreshRate) || (displayLevel >= 4)) { \
|
if ((clock() - g_time > refreshRate) || (displayLevel >= 4)) { \
|
||||||
@@ -60,9 +70,8 @@ static int g_displayLevel = 2;
|
|||||||
DISPLAY(__VA_ARGS__); \
|
DISPLAY(__VA_ARGS__); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
#undef DISPLAYUPDATE
|
||||||
#define DISPLAYUPDATE(l, ...) LOCALDISPLAYUPDATE(g_displayLevel, l, __VA_ARGS__)
|
#define DISPLAYUPDATE(l, ...) LOCALDISPLAYUPDATE(g_displayLevel, l, __VA_ARGS__)
|
||||||
static const clock_t refreshRate = CLOCKS_PER_SEC * 15 / 100;
|
|
||||||
static clock_t g_time = 0;
|
|
||||||
|
|
||||||
|
|
||||||
/*-*************************************
|
/*-*************************************
|
||||||
@@ -617,7 +626,7 @@ ZDICT_optimizeTrainFromBuffer_fastCover(
|
|||||||
/* constants */
|
/* constants */
|
||||||
const unsigned nbThreads = parameters->nbThreads;
|
const unsigned nbThreads = parameters->nbThreads;
|
||||||
const double splitPoint =
|
const double splitPoint =
|
||||||
parameters->splitPoint <= 0.0 ? DEFAULT_SPLITPOINT : parameters->splitPoint;
|
parameters->splitPoint <= 0.0 ? FASTCOVER_DEFAULT_SPLITPOINT : parameters->splitPoint;
|
||||||
const unsigned kMinD = parameters->d == 0 ? 6 : parameters->d;
|
const unsigned kMinD = parameters->d == 0 ? 6 : parameters->d;
|
||||||
const unsigned kMaxD = parameters->d == 0 ? 8 : parameters->d;
|
const unsigned kMaxD = parameters->d == 0 ? 8 : parameters->d;
|
||||||
const unsigned kMinK = parameters->k == 0 ? 50 : parameters->k;
|
const unsigned kMinK = parameters->k == 0 ? 50 : parameters->k;
|
||||||
|
|||||||
@@ -69,7 +69,9 @@ static const U32 g_selectivity_default = 9;
|
|||||||
/*-*************************************
|
/*-*************************************
|
||||||
* Console display
|
* Console display
|
||||||
***************************************/
|
***************************************/
|
||||||
|
#undef DISPLAY
|
||||||
#define DISPLAY(...) { fprintf(stderr, __VA_ARGS__); fflush( stderr ); }
|
#define DISPLAY(...) { fprintf(stderr, __VA_ARGS__); fflush( stderr ); }
|
||||||
|
#undef DISPLAYLEVEL
|
||||||
#define DISPLAYLEVEL(l, ...) if (notificationLevel>=l) { DISPLAY(__VA_ARGS__); } /* 0 : no display; 1: errors; 2: default; 3: details; 4: debug */
|
#define DISPLAYLEVEL(l, ...) if (notificationLevel>=l) { DISPLAY(__VA_ARGS__); } /* 0 : no display; 1: errors; 2: default; 3: details; 4: debug */
|
||||||
|
|
||||||
static clock_t ZDICT_clockSpan(clock_t nPrevious) { return clock() - nPrevious; }
|
static clock_t ZDICT_clockSpan(clock_t nPrevious) { return clock() - nPrevious; }
|
||||||
@@ -529,6 +531,7 @@ static size_t ZDICT_trainBuffer_legacy(dictItem* dictList, U32 dictListSize,
|
|||||||
clock_t displayClock = 0;
|
clock_t displayClock = 0;
|
||||||
clock_t const refreshRate = CLOCKS_PER_SEC * 3 / 10;
|
clock_t const refreshRate = CLOCKS_PER_SEC * 3 / 10;
|
||||||
|
|
||||||
|
# undef DISPLAYUPDATE
|
||||||
# define DISPLAYUPDATE(l, ...) if (notificationLevel>=l) { \
|
# define DISPLAYUPDATE(l, ...) if (notificationLevel>=l) { \
|
||||||
if (ZDICT_clockSpan(displayClock) > refreshRate) \
|
if (ZDICT_clockSpan(displayClock) > refreshRate) \
|
||||||
{ displayClock = clock(); DISPLAY(__VA_ARGS__); \
|
{ displayClock = clock(); DISPLAY(__VA_ARGS__); \
|
||||||
|
|||||||
Reference in New Issue
Block a user