]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
added warning message 982/head
authorYann Collet <cyan@fb.com>
Thu, 11 Jan 2018 19:29:28 +0000 (11:29 -0800)
committerYann Collet <cyan@fb.com>
Thu, 11 Jan 2018 19:29:28 +0000 (11:29 -0800)
when pathological dataset is detected
(note : cover_optimize needs -v to display the warning)

lib/dictBuilder/cover.c
lib/dictBuilder/zdict.c

index b683706710d79de1e273d3e7c67138eae4d077a1..b5a3957a9b960933066b4f857647abeb1ed40cfb 100644 (file)
@@ -1007,7 +1007,7 @@ ZDICTLIB_API size_t ZDICT_optimizeTrainFromBuffer_cover(
       data->parameters.k = k;
       data->parameters.d = d;
       data->parameters.steps = kSteps;
-      data->parameters.zParams.notificationLevel = displayLevel;
+      data->parameters.zParams.notificationLevel = g_displayLevel;
       /* Check the parameters */
       if (!COVER_checkParameters(data->parameters, dictBufferCapacity)) {
         DISPLAYLEVEL(1, "Cover parameters incorrect\n");
index 2380599c9b0e2be640558a14cf9c85fd793b21f9..7d24e4991812ea95fa65a8c75242b1dabd4d2203 100644 (file)
@@ -750,6 +750,7 @@ static size_t ZDICT_analyzeEntropy(void*  dstBuffer, size_t maxDstSize,
             goto _cleanup;
         }
         if (maxNbBits==8) {  /* not compressible : will fail on HUF_writeCTable() */
+            DISPLAYLEVEL(2, "warning : pathological dataset : literals are not compressible : samples are noisy or too regular \n");
             ZDICT_flatLit(countLit);  /* replace distribution by a fake "mostly flat but still compressible" distribution, that HUF_writeCTable() can encode */
             maxNbBits = HUF_buildCTable (hufTable, countLit, 255, huffLog);
             assert(maxNbBits==9);
@@ -1052,8 +1053,9 @@ size_t ZDICT_trainFromBuffer_unsafe_legacy(
 }
 
 
-/* issue : samplesBuffer need to be followed by a noisy guard band.
-*  work around : duplicate the buffer, and add the noise */
+/* ZDICT_trainFromBuffer_legacy() :
+ * issue : samplesBuffer need to be followed by a noisy guard band.
+ * work around : duplicate the buffer, and add the noise */
 size_t ZDICT_trainFromBuffer_legacy(void* dictBuffer, size_t dictBufferCapacity,
                               const void* samplesBuffer, const size_t* samplesSizes, unsigned nbSamples,
                               ZDICT_legacy_params_t params)