Set threshold to use optimal table log

This commit is contained in:
Danielle Rozenblit 2022-10-11 14:33:25 -07:00
parent 8888a2ddcc
commit fa7d9c1139
2 changed files with 3 additions and 3 deletions

View File

@ -173,7 +173,7 @@ size_t HUF_decompress4X2_DCtx_wksp(HUF_DTable* dctx, void* dst, size_t dstSize,
/* **************************************** /* ****************************************
* HUF detailed API * HUF detailed API
* ****************************************/ * ****************************************/
#define HUF_OPTIMAL_DEPTH_THRESHOLD 1 #define HUF_OPTIMAL_DEPTH_THRESHOLD ZSTD_btlazy2
typedef enum { typedef enum {
HUF_depth_fast, /** Use heuristic to find the table depth**/ HUF_depth_fast, /** Use heuristic to find the table depth**/
HUF_depth_optimal /** Test possible table depths to find the one that produces the smallest header + encoded size**/ HUF_depth_optimal /** Test possible table depths to find the one that produces the smallest header + encoded size**/

View File

@ -2654,7 +2654,7 @@ ZSTD_entropyCompressSeqStore_internal(seqStore_t* seqStorePtr,
unsigned const suspectUncompressible = (numSequences == 0) || (numLiterals / numSequences >= SUSPECT_UNCOMPRESSIBLE_LITERAL_RATIO); unsigned const suspectUncompressible = (numSequences == 0) || (numLiterals / numSequences >= SUSPECT_UNCOMPRESSIBLE_LITERAL_RATIO);
size_t const litSize = (size_t)(seqStorePtr->lit - literals); size_t const litSize = (size_t)(seqStorePtr->lit - literals);
HUF_depth_mode depthMode = cctxParams->cParams.strategy > HUF_OPTIMAL_DEPTH_THRESHOLD ? HUF_depth_optimal : HUF_depth_fast; HUF_depth_mode depthMode = cctxParams->cParams.strategy >= HUF_OPTIMAL_DEPTH_THRESHOLD ? HUF_depth_optimal : HUF_depth_fast;
size_t const cSize = ZSTD_compressLiterals( size_t const cSize = ZSTD_compressLiterals(
&prevEntropy->huf, &nextEntropy->huf, &prevEntropy->huf, &nextEntropy->huf,
cctxParams->cParams.strategy, cctxParams->cParams.strategy,
@ -3270,7 +3270,7 @@ size_t ZSTD_buildBlockEntropyStats(seqStore_t* seqStorePtr,
void* workspace, size_t wkspSize) void* workspace, size_t wkspSize)
{ {
size_t const litSize = seqStorePtr->lit - seqStorePtr->litStart; size_t const litSize = seqStorePtr->lit - seqStorePtr->litStart;
HUF_depth_mode depthMode = cctxParams->cParams.strategy > HUF_OPTIMAL_DEPTH_THRESHOLD ? HUF_depth_optimal : HUF_depth_fast; HUF_depth_mode depthMode = cctxParams->cParams.strategy >= HUF_OPTIMAL_DEPTH_THRESHOLD ? HUF_depth_optimal : HUF_depth_fast;
entropyMetadata->hufMetadata.hufDesSize = entropyMetadata->hufMetadata.hufDesSize =
ZSTD_buildBlockEntropyStats_literals(seqStorePtr->litStart, litSize, ZSTD_buildBlockEntropyStats_literals(seqStorePtr->litStart, litSize,