diff options
author | Przemyslaw Skibinski <inikep@gmail.com> | 2016-12-06 14:21:28 (GMT) |
---|---|---|
committer | Przemyslaw Skibinski <inikep@gmail.com> | 2016-12-06 14:21:28 (GMT) |
commit | c1ef7a177fae1f5435f191cbdebb0c59fb81d8ff (patch) | |
tree | b4804bdccf4dc5d5283a3f169532d2c7fa581d9d /lib/lz4hc.c | |
parent | 3f430daf7aa6ce0a96a863387de33be54d45806e (diff) | |
download | lz4-c1ef7a177fae1f5435f191cbdebb0c59fb81d8ff.zip lz4-c1ef7a177fae1f5435f191cbdebb0c59fb81d8ff.tar.gz lz4-c1ef7a177fae1f5435f191cbdebb0c59fb81d8ff.tar.bz2 |
introduced LZ4HC_compress_hashChain
Diffstat (limited to 'lib/lz4hc.c')
-rw-r--r-- | lib/lz4hc.c | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/lib/lz4hc.c b/lib/lz4hc.c index 298550c..57587f3 100644 --- a/lib/lz4hc.c +++ b/lib/lz4hc.c @@ -305,8 +305,9 @@ FORCE_INLINE int LZ4HC_encodeSequence ( return 0; } +#include "lz4opt.h" -static int LZ4HC_compress_generic ( +static int LZ4HC_compress_hashChain ( LZ4HC_CCtx_internal* const ctx, const char* const source, char* const dest, @@ -336,8 +337,6 @@ static int LZ4HC_compress_generic ( const BYTE* ref0; /* init */ - if (compressionLevel > LZ4HC_MAX_CLEVEL) compressionLevel = LZ4HC_MAX_CLEVEL; - if (compressionLevel < 1) compressionLevel = LZ4HC_DEFAULT_CLEVEL; maxNbAttempts = 1 << (compressionLevel-1); ctx->end += inputSize; @@ -490,6 +489,31 @@ _Search3: } +static int LZ4HC_compress_generic ( + LZ4HC_CCtx_internal* const ctx, + const char* const source, + char* const dest, + int const inputSize, + int const maxOutputSize, + int compressionLevel, + limitedOutput_directive limit + ) +{ + if (compressionLevel < 1) compressionLevel = LZ4HC_DEFAULT_CLEVEL; + if (compressionLevel > 16) { + switch (compressionLevel) { + case 17: ctx->searchNum = 64; return LZ4HC_compress_optimal(ctx, source, dest, inputSize, maxOutputSize, limit, 0, 64, 0); + case 18: ctx->searchNum = 256; return LZ4HC_compress_optimal(ctx, source, dest, inputSize, maxOutputSize, limit, 0, 256, 0); + case 19: ctx->searchNum = 64; return LZ4HC_compress_optimal(ctx, source, dest, inputSize, maxOutputSize, limit, 1, 64, 0); + case 20: + default: ctx->searchNum = 256; return LZ4HC_compress_optimal(ctx, source, dest, inputSize, maxOutputSize, limit, 1, 256, 0); + } + } + + return LZ4HC_compress_hashChain(ctx, source, dest, inputSize, maxOutputSize, compressionLevel, limit); +} + + int LZ4_sizeofStateHC(void) { return sizeof(LZ4_streamHC_t); } int LZ4_compress_HC_extStateHC (void* state, const char* src, char* dst, int srcSize, int maxDstSize, int compressionLevel) |