From: senhuang42 Date: Sun, 27 Sep 2020 17:25:27 +0000 (-0400) Subject: Add base adjustment correction X-Git-Tag: v1.4.7~57^2~37 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f57c7e6bbfc1e61d92ba31d7ecf25d35744591d9;p=thirdparty%2Fzstd.git Add base adjustment correction --- diff --git a/lib/compress/zstd_ldm.c b/lib/compress/zstd_ldm.c index 42e6aa2d8..5f44ce78a 100644 --- a/lib/compress/zstd_ldm.c +++ b/lib/compress/zstd_ldm.c @@ -579,8 +579,15 @@ size_t ZSTD_ldm_blockCompress(rawSeqStore_t* rawSeqStore, if (cParams->strategy >= ZSTD_btopt) { size_t lastLLSize; ms->ldmSeqStore = *rawSeqStore; /* copy current seqStore */ + const BYTE* const prevBase = (BYTE const*)ms->window.base; lastLLSize = blockCompressor(ms, seqStore, rep, src, srcSize); rawSeqStore->pos = ms->ldmSeqStore.pos; + ms->ldmSeqStore = *rawSeqStore; + if (prevBase != ms->window.base) { + int baseDiff = (int)(prevBase - ms->window.base); + printf("Bases were different, adjusting, diff = %d\n", baseDiff); + rawSeqStore->seq[rawSeqStore->pos].litLength += baseDiff; + } return lastLLSize; }