Skip to content

Commit 752bae4

Browse files
committed
added warning message
when pathological dataset is detected (note : cover_optimize needs -v to display the warning)
1 parent e8093dd commit 752bae4

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

lib/dictBuilder/cover.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1007,7 +1007,7 @@ ZDICTLIB_API size_t ZDICT_optimizeTrainFromBuffer_cover(
10071007
data->parameters.k = k;
10081008
data->parameters.d = d;
10091009
data->parameters.steps = kSteps;
1010-
data->parameters.zParams.notificationLevel = displayLevel;
1010+
data->parameters.zParams.notificationLevel = g_displayLevel;
10111011
/* Check the parameters */
10121012
if (!COVER_checkParameters(data->parameters, dictBufferCapacity)) {
10131013
DISPLAYLEVEL(1, "Cover parameters incorrect\n");

lib/dictBuilder/zdict.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,7 @@ static size_t ZDICT_analyzeEntropy(void* dstBuffer, size_t maxDstSize,
750750
goto _cleanup;
751751
}
752752
if (maxNbBits==8) { /* not compressible : will fail on HUF_writeCTable() */
753+
DISPLAYLEVEL(2, "warning : pathological dataset : literals are not compressible : samples are noisy or too regular \n");
753754
ZDICT_flatLit(countLit); /* replace distribution by a fake "mostly flat but still compressible" distribution, that HUF_writeCTable() can encode */
754755
maxNbBits = HUF_buildCTable (hufTable, countLit, 255, huffLog);
755756
assert(maxNbBits==9);
@@ -1052,8 +1053,9 @@ size_t ZDICT_trainFromBuffer_unsafe_legacy(
10521053
}
10531054

10541055

1055-
/* issue : samplesBuffer need to be followed by a noisy guard band.
1056-
* work around : duplicate the buffer, and add the noise */
1056+
/* ZDICT_trainFromBuffer_legacy() :
1057+
* issue : samplesBuffer need to be followed by a noisy guard band.
1058+
* work around : duplicate the buffer, and add the noise */
10571059
size_t ZDICT_trainFromBuffer_legacy(void* dictBuffer, size_t dictBufferCapacity,
10581060
const void* samplesBuffer, const size_t* samplesSizes, unsigned nbSamples,
10591061
ZDICT_legacy_params_t params)

0 commit comments

Comments
 (0)