added : ZSTD_maxCLevel()
added : 256KB blocks mode
This commit is contained in:
parent
9ad743e74d
commit
d608088ca3
@ -65,6 +65,7 @@
|
||||
/* *************************************
|
||||
* Constants
|
||||
***************************************/
|
||||
unsigned ZSTD_maxCLevel(void) { return ZSTD_MAX_CLEVEL; }
|
||||
static const U32 g_searchStrength = 8;
|
||||
|
||||
|
||||
@ -599,7 +600,7 @@ static unsigned ZSTD_NbCommonBytes (register size_t val)
|
||||
# if defined(_MSC_VER) && defined(_WIN64)
|
||||
unsigned long r = 0;
|
||||
_BitScanForward64( &r, (U64)val );
|
||||
return (int)(r>>3);
|
||||
return (unsigned)(r>>3);
|
||||
# elif defined(__GNUC__) && (__GNUC__ >= 3)
|
||||
return (__builtin_ctzll((U64)val) >> 3);
|
||||
# else
|
||||
@ -612,7 +613,7 @@ static unsigned ZSTD_NbCommonBytes (register size_t val)
|
||||
# if defined(_MSC_VER)
|
||||
unsigned long r=0;
|
||||
_BitScanForward( &r, (U32)val );
|
||||
return (int)(r>>3);
|
||||
return (unsigned)(r>>3);
|
||||
# elif defined(__GNUC__) && (__GNUC__ >= 3)
|
||||
return (__builtin_ctz((U32)val) >> 3);
|
||||
# else
|
||||
@ -2097,7 +2098,7 @@ size_t ZSTD_compressBegin_advanced(ZSTD_CCtx* ctx,
|
||||
ZSTD_parameters ZSTD_getParams(int compressionLevel, U64 srcSizeHint)
|
||||
{
|
||||
ZSTD_parameters result;
|
||||
int tableID = ((srcSizeHint-1) <= 128 KB) + ((srcSizeHint-1) <= 16 KB); /* intentional underflow for srcSizeHint == 0 */
|
||||
int tableID = ((srcSizeHint-1) <= 256 KB) + ((srcSizeHint-1) <= 128 KB) + ((srcSizeHint-1) <= 16 KB); /* intentional underflow for srcSizeHint == 0 */
|
||||
if (compressionLevel<=0) compressionLevel = 1;
|
||||
if (compressionLevel > ZSTD_MAX_CLEVEL) compressionLevel = ZSTD_MAX_CLEVEL;
|
||||
result = ZSTD_defaultParameters[tableID][compressionLevel];
|
||||
|
@ -180,7 +180,8 @@ size_t ZSTD_decompressContinue(ZSTD_DCtx* dctx, void* dst, size_t maxDstSize, co
|
||||
* Pre-defined compression levels
|
||||
***************************************/
|
||||
#define ZSTD_MAX_CLEVEL 20
|
||||
static const ZSTD_parameters ZSTD_defaultParameters[3][ZSTD_MAX_CLEVEL+1] = {
|
||||
unsigned ZSTD_maxCLevel (void);
|
||||
static const ZSTD_parameters ZSTD_defaultParameters[4][ZSTD_MAX_CLEVEL+1] = {
|
||||
{ /* "default" */
|
||||
/* W, C, H, S, L, strat */
|
||||
{ 0, 18, 12, 12, 1, 4, ZSTD_fast }, /* level 0 - never used */
|
||||
@ -205,6 +206,30 @@ static const ZSTD_parameters ZSTD_defaultParameters[3][ZSTD_MAX_CLEVEL+1] = {
|
||||
{ 0, 25, 26, 23, 5, 5, ZSTD_btlazy2 }, /* level 19 */
|
||||
{ 0, 26, 27, 25, 9, 5, ZSTD_btlazy2 }, /* level 20 */
|
||||
},
|
||||
{ /* for srcSize <= 256 KB */
|
||||
/* W, C, H, S, L, strat */
|
||||
{ 0, 0, 0, 0, 0, 0, ZSTD_fast }, /* level 0 - never used */
|
||||
{ 0, 18, 16, 15, 1, 7, ZSTD_fast }, /* level 1 */
|
||||
{ 0, 18, 16, 16, 1, 7, ZSTD_fast }, /* level 2 */
|
||||
{ 0, 18, 18, 18, 1, 7, ZSTD_fast }, /* level 3 */
|
||||
{ 0, 18, 14, 15, 4, 6, ZSTD_greedy }, /* level 4 */
|
||||
{ 0, 18, 16, 16, 1, 6, ZSTD_lazy }, /* level 5 */
|
||||
{ 0, 18, 15, 15, 3, 6, ZSTD_lazy }, /* level 6 */
|
||||
{ 0, 18, 15, 15, 4, 6, ZSTD_lazy }, /* level 7 */
|
||||
{ 0, 18, 16, 18, 4, 6, ZSTD_lazy }, /* level 8 */
|
||||
{ 0, 18, 18, 18, 4, 6, ZSTD_lazy }, /* level 9 */
|
||||
{ 0, 18, 18, 18, 5, 6, ZSTD_lazy }, /* level 10 */
|
||||
{ 0, 18, 18, 19, 6, 6, ZSTD_lazy }, /* level 11 */
|
||||
{ 0, 18, 18, 19, 7, 6, ZSTD_lazy }, /* level 12 */
|
||||
{ 0, 18, 19, 15, 7, 5, ZSTD_btlazy2 }, /* level 13 */
|
||||
{ 0, 18, 19, 16, 8, 5, ZSTD_btlazy2 }, /* level 14 */
|
||||
{ 0, 18, 19, 17, 9, 5, ZSTD_btlazy2 }, /* level 15 */
|
||||
{ 0, 18, 19, 17, 10, 5, ZSTD_btlazy2 }, /* level 16 */
|
||||
{ 0, 18, 19, 17, 11, 5, ZSTD_btlazy2 }, /* level 17 */
|
||||
{ 0, 18, 19, 17, 12, 5, ZSTD_btlazy2 }, /* level 18 */
|
||||
{ 0, 18, 19, 17, 13, 5, ZSTD_btlazy2 }, /* level 19 */
|
||||
{ 0, 18, 19, 17, 14, 5, ZSTD_btlazy2 }, /* level 20 */
|
||||
},
|
||||
{ /* for srcSize <= 128 KB */
|
||||
/* W, C, H, S, L, strat */
|
||||
{ 0, 17, 12, 12, 1, 4, ZSTD_fast }, /* level 0 - never used */
|
||||
|
Loading…
Reference in New Issue
Block a user