1
0
mirror of https://github.com/facebook/zstd.git synced 2025-12-24 17:21:03 +03:00

Merge Ultra and Ultra2 Exclusion

Ultra2 does not exist for dict compression, and so uses ultra. So ultra must
be present if ultra2 is.
This commit is contained in:
W. Felix Handte
2023-04-20 11:53:23 -04:00
parent 6761e1c949
commit b12e8cb3e7
4 changed files with 8 additions and 22 deletions

View File

@@ -1469,12 +1469,10 @@ ZSTD_adjustCParams_internal(ZSTD_compressionParameters cPar,
/* Cascade the selected strategy down to the next-highest one built into
* this binary. */
#ifdef ZSTD_EXCLUDE_BTULTRA2_BLOCK_COMPRESSOR
#ifdef ZSTD_EXCLUDE_BTULTRA_BLOCK_COMPRESSOR
if (cPar.strategy == ZSTD_btultra2) {
cPar.strategy = ZSTD_btultra;
}
#endif
#ifdef ZSTD_EXCLUDE_BTULTRA_BLOCK_COMPRESSOR
if (cPar.strategy == ZSTD_btultra) {
cPar.strategy = ZSTD_btopt;
}
@@ -3068,12 +3066,9 @@ ZSTD_blockCompressor ZSTD_selectBlockCompressor(ZSTD_strategy strat, ZSTD_paramS
#endif
#ifdef ZSTD_EXCLUDE_BTULTRA_BLOCK_COMPRESSOR
NULL,
#else
ZSTD_compressBlock_btultra,
#endif
#ifdef ZSTD_EXCLUDE_BTULTRA2_BLOCK_COMPRESSOR
NULL
#else
ZSTD_compressBlock_btultra,
ZSTD_compressBlock_btultra2
#endif
},
@@ -5006,8 +5001,7 @@ static size_t ZSTD_loadDictionaryContent(ZSTD_matchState_t* ms,
case ZSTD_btultra2:
#if !defined(ZSTD_EXCLUDE_BTLAZY2_BLOCK_COMPRESSOR) \
|| !defined(ZSTD_EXCLUDE_BTOPT_BLOCK_COMPRESSOR) \
|| !defined(ZSTD_EXCLUDE_BTULTRA_BLOCK_COMPRESSOR) \
|| !defined(ZSTD_EXCLUDE_BTULTRA2_BLOCK_COMPRESSOR)
|| !defined(ZSTD_EXCLUDE_BTULTRA_BLOCK_COMPRESSOR)
assert(srcSize >= HASH_READ_SIZE);
ZSTD_updateTree(ms, iend-HASH_READ_SIZE, iend);
#endif

View File

@@ -14,8 +14,7 @@
#if !defined(ZSTD_EXCLUDE_BTLAZY2_BLOCK_COMPRESSOR) \
|| !defined(ZSTD_EXCLUDE_BTOPT_BLOCK_COMPRESSOR) \
|| !defined(ZSTD_EXCLUDE_BTULTRA_BLOCK_COMPRESSOR) \
|| !defined(ZSTD_EXCLUDE_BTULTRA2_BLOCK_COMPRESSOR)
|| !defined(ZSTD_EXCLUDE_BTULTRA_BLOCK_COMPRESSOR)
#define ZSTD_LITFREQ_ADD 2 /* scaling factor for litFreq, so that frequencies adapt faster to new stats */
#define ZSTD_MAX_PRICE (1<<30)
@@ -1361,8 +1360,7 @@ static size_t ZSTD_compressBlock_opt0(
}
#endif
#if !defined(ZSTD_EXCLUDE_BTULTRA_BLOCK_COMPRESSOR) \
|| !defined(ZSTD_EXCLUDE_BTULTRA2_BLOCK_COMPRESSOR)
#ifndef ZSTD_EXCLUDE_BTULTRA_BLOCK_COMPRESSOR
static size_t ZSTD_compressBlock_opt2(
ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
const void* src, size_t srcSize, const ZSTD_dictMode_e dictMode)
@@ -1384,7 +1382,7 @@ size_t ZSTD_compressBlock_btopt(
#ifndef ZSTD_EXCLUDE_BTULTRA2_BLOCK_COMPRESSOR
#ifndef ZSTD_EXCLUDE_BTULTRA_BLOCK_COMPRESSOR
/* ZSTD_initStats_ultra():
* make a first compression pass, just to seed stats with more accurate starting values.
* only works on first block, with no dictionary and no ldm.
@@ -1425,9 +1423,7 @@ size_t ZSTD_compressBlock_btultra(
DEBUGLOG(5, "ZSTD_compressBlock_btultra (srcSize=%zu)", srcSize);
return ZSTD_compressBlock_opt2(ms, seqStore, rep, src, srcSize, ZSTD_noDict);
}
#endif
#ifndef ZSTD_EXCLUDE_BTULTRA2_BLOCK_COMPRESSOR
size_t ZSTD_compressBlock_btultra2(
ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
const void* src, size_t srcSize)

View File

@@ -19,8 +19,7 @@ extern "C" {
#if !defined(ZSTD_EXCLUDE_BTLAZY2_BLOCK_COMPRESSOR) \
|| !defined(ZSTD_EXCLUDE_BTOPT_BLOCK_COMPRESSOR) \
|| !defined(ZSTD_EXCLUDE_BTULTRA_BLOCK_COMPRESSOR) \
|| !defined(ZSTD_EXCLUDE_BTULTRA2_BLOCK_COMPRESSOR)
|| !defined(ZSTD_EXCLUDE_BTULTRA_BLOCK_COMPRESSOR)
/* used in ZSTD_loadDictionaryContent() */
void ZSTD_updateTree(ZSTD_matchState_t* ms, const BYTE* ip, const BYTE* iend);
#endif
@@ -34,8 +33,6 @@ size_t ZSTD_compressBlock_btopt(
size_t ZSTD_compressBlock_btultra(
ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
void const* src, size_t srcSize);
#endif
#ifndef ZSTD_EXCLUDE_BTULTRA2_BLOCK_COMPRESSOR
size_t ZSTD_compressBlock_btultra2(
ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM],
void const* src, size_t srcSize);

View File

@@ -2433,8 +2433,7 @@ static int basicUnitTests(U32 const seed, double compressibility)
&& !defined(ZSTD_EXCLUDE_LAZY2_BLOCK_COMPRESSOR) \
&& !defined(ZSTD_EXCLUDE_BTLAZY2_BLOCK_COMPRESSOR) \
&& !defined(ZSTD_EXCLUDE_BTOPT_BLOCK_COMPRESSOR) \
&& !defined(ZSTD_EXCLUDE_BTULTRA_BLOCK_COMPRESSOR) \
&& !defined(ZSTD_EXCLUDE_BTULTRA2_BLOCK_COMPRESSOR)
&& !defined(ZSTD_EXCLUDE_BTULTRA_BLOCK_COMPRESSOR)
/* Note : these tests should be replaced by proper regression tests,
* but existing ones do not focus on small data + dictionary + all levels.
*/