From: Yann Collet Date: Fri, 3 Nov 2017 07:15:52 +0000 (-0700) Subject: optimized skip strategy for level 12 X-Git-Tag: upstream/1.9.3~11^2~25^2~21 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=890c0553d08ad6a6a4f2801523667413b5477512;p=platform%2Fupstream%2Flz4.git optimized skip strategy for level 12 --- diff --git a/lib/lz4opt.h b/lib/lz4opt.h index 0463cb1..edcfc10 100644 --- a/lib/lz4opt.h +++ b/lib/lz4opt.h @@ -243,7 +243,6 @@ static int LZ4HC_compress_optimal ( const BYTE* const matchlimit = iend - LASTLITERALS; BYTE* op = (BYTE*) dst; BYTE* const oend = op + dstCapacity; - int const front = fullUpdate ? 2 : 1; /* init */ DEBUGLOG(5, "LZ4HC_compress_optimal"); @@ -317,12 +316,16 @@ static int LZ4HC_compress_optimal ( if (curPtr >= mflimit) break; DEBUGLOG(7, "rPos:%u[%u] vs [%u]%u", cur, opt[cur].price, opt[cur+1].price, cur+1); - if (opt[cur+front].price <= opt[cur].price) continue; + if (fullUpdate) { + if ((opt[cur+1].price <= opt[cur].price) && (opt[cur+4].price < opt[cur].price+3)) continue; + } else { + if (opt[cur+1].price <= opt[cur].price) continue; + } DEBUGLOG(7, "search at rPos:%u", cur); //nb_matches = LZ4HC_BinTree_GetAllMatches(ctx, curPtr, matchlimit, MINMATCH-1, matches, fullUpdate); nb_matches = LZ4HC_HashChain_GetAllMatches(ctx, curPtr, matchlimit, MINMATCH-1, matches, fullUpdate); - //nb_matches = LZ4HC_HashChain_GetAllMatches(ctx, curPtr, matchlimit, last_match_pos - cur - 1, matches, fullUpdate); /* only test matches of a minimum length */ + //nb_matches = LZ4HC_HashChain_GetAllMatches(ctx, curPtr, matchlimit, last_match_pos - cur, matches, fullUpdate); /* only test matches of a minimum length */ if (!nb_matches) continue; if ( ((size_t)matches[nb_matches-1].len > sufficient_len)