LZ4HC_MAX_CLEVEL = 12

This commit is contained in:
Przemyslaw Skibinski 2016-12-07 12:16:33 +01:00
parent 757ef1d5fc
commit e3fee94742
2 changed files with 8 additions and 12 deletions

View File

@ -313,7 +313,7 @@ static int LZ4HC_compress_hashChain (
char* const dest,
int const inputSize,
int const maxOutputSize,
int compressionLevel,
unsigned maxNbAttempts,
limitedOutput_directive limit
)
{
@ -326,7 +326,6 @@ static int LZ4HC_compress_hashChain (
BYTE* op = (BYTE*) dest;
BYTE* const oend = op + maxOutputSize;
unsigned maxNbAttempts;
int ml, ml2, ml3, ml0;
const BYTE* ref = NULL;
const BYTE* start2 = NULL;
@ -337,7 +336,6 @@ static int LZ4HC_compress_hashChain (
const BYTE* ref0;
/* init */
maxNbAttempts = 1 << (compressionLevel-1);
ctx->end += inputSize;
ip++;
@ -504,17 +502,15 @@ static int LZ4HC_compress_generic (
*/
if (compressionLevel < 1) compressionLevel = LZ4HC_DEFAULT_CLEVEL;
if (compressionLevel > 16) {
if (compressionLevel > 9) {
switch (compressionLevel) {
case 17: ctx->searchNum = 16; return LZ4HC_compress_optimal(ctx, source, dest, inputSize, maxOutputSize, limit, 16);
case 18: ctx->searchNum = 64; return LZ4HC_compress_optimal(ctx, source, dest, inputSize, maxOutputSize, limit, 64);
case 19: ctx->searchNum = 256; return LZ4HC_compress_optimal(ctx, source, dest, inputSize, maxOutputSize, limit, 256);
case 10: return LZ4HC_compress_hashChain(ctx, source, dest, inputSize, maxOutputSize, 1 << (16-1), limit);
case 11: ctx->searchNum = 256; return LZ4HC_compress_optimal(ctx, source, dest, inputSize, maxOutputSize, limit, 256);
default:
case 20: ctx->searchNum = 1<<14; return LZ4HC_compress_optimal(ctx, source, dest, inputSize, maxOutputSize, limit, LZ4_OPT_NUM);
case 12: ctx->searchNum = 1<<14; return LZ4HC_compress_optimal(ctx, source, dest, inputSize, maxOutputSize, limit, LZ4_OPT_NUM);
}
}
return LZ4HC_compress_hashChain(ctx, source, dest, inputSize, maxOutputSize, compressionLevel, limit);
return LZ4HC_compress_hashChain(ctx, source, dest, inputSize, maxOutputSize, 1 << (compressionLevel-1), limit);
}

View File

@ -46,7 +46,7 @@ extern "C" {
/* --- Useful constants --- */
#define LZ4HC_MIN_CLEVEL 3
#define LZ4HC_DEFAULT_CLEVEL 9
#define LZ4HC_MAX_CLEVEL 20
#define LZ4HC_MAX_CLEVEL 12
/*-************************************
@ -134,7 +134,7 @@ LZ4LIB_API int LZ4_saveDictHC (LZ4_streamHC_t* streamHCPtr, char* safeBuffer, in
#define LZ4HC_MAXD (1<<(LZ4HC_DICTIONARY_LOGSIZE+1))
#define LZ4HC_MAXD_MASK (LZ4HC_MAXD - 1)
#define LZ4HC_HASH_LOG (LZ4HC_DICTIONARY_LOGSIZE-1)
#define LZ4HC_HASH_LOG (LZ4HC_DICTIONARY_LOGSIZE+2)
#define LZ4HC_HASHTABLESIZE (1 << LZ4HC_HASH_LOG)
#define LZ4HC_HASH_MASK (LZ4HC_HASHTABLESIZE - 1)