]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
changed advanced parameter overlapLog
authorYann Collet <cyan@fb.com>
Mon, 30 Jan 2017 19:00:00 +0000 (11:00 -0800)
committerYann Collet <cyan@fb.com>
Mon, 30 Jan 2017 19:00:00 +0000 (11:00 -0800)
Follows a positive logic (increasing value => increasing overlap)
which is easier to use

lib/compress/zstdmt_compress.c
lib/compress/zstdmt_compress.h

index ca9bf6a26406cae7ffd42752bc6daf279f2b5f73..07c7c1b38909a4afb9da1cb966f2d11befcbef9a 100644 (file)
@@ -286,7 +286,7 @@ struct ZSTDMT_CCtx_s {
     unsigned nextJobID;
     unsigned frameEnded;
     unsigned allJobsCompleted;
-    unsigned overlapWrLog;
+    unsigned overlapRLog;
     unsigned long long frameContentSize;
     size_t sectionSize;
     ZSTD_CDict* cdict;
@@ -309,7 +309,7 @@ ZSTDMT_CCtx *ZSTDMT_createCCtx(unsigned nbThreads)
     cctx->jobIDMask = nbJobs - 1;
     cctx->allJobsCompleted = 1;
     cctx->sectionSize = 0;
-    cctx->overlapWrLog = 3;
+    cctx->overlapRLog = 3;
     cctx->factory = POOL_create(nbThreads, 1);
     cctx->buffPool = ZSTDMT_createBufferPool(nbThreads);
     cctx->cctxPool = ZSTDMT_createCCtxPool(nbThreads);
@@ -369,8 +369,8 @@ size_t ZSTDMT_setMTCtxParameter(ZSTDMT_CCtx* mtctx, ZSDTMT_parameter parameter,
     case ZSTDMT_p_sectionSize :
         mtctx->sectionSize = value;
         return 0;
-    case ZSTDMT_p_overlapSectionRLog :
-        mtctx->overlapWrLog = value;
+    case ZSTDMT_p_overlapSectionLog :
+        mtctx->overlapRLog = (value >= 9) ? 0 : 9 - value;
         return 0;
     default :
         return ERROR(compressionParameter_unsupported);
@@ -516,7 +516,7 @@ static size_t ZSTDMT_initCStream_internal(ZSTDMT_CCtx* zcs,
     zcs->targetSectionSize = zcs->sectionSize ? zcs->sectionSize : (size_t)1 << (zcs->params.cParams.windowLog + 2);
     zcs->targetSectionSize = MAX(ZSTDMT_SECTION_SIZE_MIN, zcs->targetSectionSize);
     zcs->marginSize = zcs->targetSectionSize >> 2;
-    zcs->targetDictSize = zcs->overlapWrLog < 10 ? (size_t)1 << (zcs->params.cParams.windowLog - zcs->overlapWrLog) : 0;
+    zcs->targetDictSize = (size_t)1 << (zcs->params.cParams.windowLog - zcs->overlapRLog);
     zcs->inBuffSize = zcs->targetDictSize + zcs->targetSectionSize + zcs->marginSize;
     zcs->inBuff.buffer = ZSTDMT_getBuffer(zcs->buffPool, zcs->inBuffSize);
     if (zcs->inBuff.buffer.start == NULL) return ERROR(memory_allocation);
index 92de52d652e1bcee59c3b8b49fc5bd03dd084ff2..acd03b37e4f1d17dbd33a78bb0174f72d3c2489d 100644 (file)
@@ -53,7 +53,7 @@ ZSTDLIB_API size_t ZSTDMT_initCStream_advanced(ZSTDMT_CCtx* mtctx, const void* d
  * List of parameters that can be set using ZSTDMT_setMTCtxParameter() */
 typedef enum {
     ZSTDMT_p_sectionSize,        /* size of input "section". Each section is compressed in parallel. 0 means default, which is dynamically determined within compression functions */
-    ZSTDMT_p_overlapSectionRLog  /* reverse log of overlapped section; 0 == use a complete window, 3(default) == use 1/8th of window, values >=10 means no overlap */
+    ZSTDMT_p_overlapSectionLog   /* Log of overlapped section; 0 == no overlap, 6(default) == use 1/8th of window, >=9 == use full window */
 } ZSDTMT_parameter;
 
 /* ZSTDMT_setMTCtxParameter() :