#define ZSTD_DUBT_UNSORTED_MARK 1 /* For btlazy2 strategy, index 1 now means "unsorted".
#define ZSTD_DUBT_UNSORTED_MARK 1 /* For btlazy2 strategy, index ZSTD_DUBT_UNSORTED_MARK==1 means "unsorted".
It could be confused for a real successor at index "1", if sorted as larger than its predecessor.
It's not a big deal though : candidate will just be sorted again.
Additionally, candidate position 1 will be lost.
But candidate 1 cannot hide a large tree of candidates, so it's a minimal loss.
The benefit is that ZSTD_DUBT_UNSORTED_MARK cannot be mishandled after table re-use with a different strategy
Constant required by ZSTD_compressBlock_btlazy2() and ZSTD_reduceTable_internal() */
The benefit is that ZSTD_DUBT_UNSORTED_MARK cannot be mishandled after table re-use with a different strategy.
This constant is required by ZSTD_compressBlock_btlazy2() and ZSTD_reduceTable_internal() */
/*-*************************************
...
...
@@ -128,21 +128,20 @@ typedef struct {
BYTEconst*base;/* All regular indexes relative to this position */
BYTEconst*dictBase;/* extDict indexes relative to this position */
U32dictLimit;/* below that point, need extDict */
U32lowLimit;/* below that point, no more data */
U32lowLimit;/* below that point, no more valid data */
}ZSTD_window_t;
typedefstructZSTD_matchState_tZSTD_matchState_t;
structZSTD_matchState_t{
ZSTD_window_twindow;/* State for window round buffer management */
U32loadedDictEnd;/* index of end of dictionary */
U32loadedDictEnd;/* index of end of dictionary, within context's referential. When dict referential is copied into active context (i.e. not attached), effectively same value as dictSize, since referential starts from zero */
U32nextToUpdate;/* index from which to continue table update */
U32nextToUpdate3;/* index from which to continue table update */
U32hashLog3;/* dispatch table : larger == faster, more memory */
U32*hashTable;
U32*hashTable3;
U32*chainTable;
optState_topt;/* optimal parser state */
constZSTD_matchState_t*dictMatchState;
constZSTD_matchState_t*dictMatchState;
ZSTD_compressionParameterscParams;
};
...
...
@@ -195,6 +194,9 @@ struct ZSTD_CCtx_params_s {
intcompressionLevel;
intforceWindow;/* force back-references to respect limit of
* 1<<wLog, even for dictionary */
size_ttargetCBlockSize;/* Tries to fit compressed block size to be around targetCBlockSize.
* No target when targetCBlockSize == 0.
* There is no guarantee on compressed block size */
U32matchIndex=*smallerPtr;/* this candidate is unsorted : next sorted candidate is reached through *smallerPtr, while *largerPtr contains previous unsorted candidate (which is already saved and can be overwritten) */
ZSTD_wildcopy(op+8,(*litPtr)+8,sequence.litLength-8);/* note : since oLitEnd <= oend-WILDCOPY_OVERLENGTH, no risk of overwrite beyond oend */
ZSTD_wildcopy_16min(op,(*litPtr),sequence.litLength,ZSTD_no_overlap);/* note : since oLitEnd <= oend-WILDCOPY_OVERLENGTH, no risk of overwrite beyond oend */
ZSTD_wildcopy(op+8,(*litPtr)+8,sequence.litLength-8);/* note : since oLitEnd <= oend-WILDCOPY_OVERLENGTH, no risk of overwrite beyond oend */
ZSTD_wildcopy_16min(op,*litPtr,sequence.litLength,ZSTD_no_overlap);/* note : since oLitEnd <= oend-WILDCOPY_OVERLENGTH, no risk of overwrite beyond oend */
* They are not required : ZSTD_compressStream*() happily accepts any buffer size, for both input and output.
* Respecting the recommended size just makes it a bit easier for ZSTD_compressStream*(),
* reducing the amount of memory shuffling and buffering, resulting in minor performance savings.
*
* However, note that these recommendations are from the perspective of a C caller program.
* If the streaming interface is invoked from some other language,
* especially managed ones such as Java or Go, through a foreign function interface such as jni or cgo,
* a major performance rule is to reduce crossing such interface to an absolute minimum.
* It's not rare that performance ends being spent more into the interface, rather than compression itself.
* In which cases, prefer using large buffers, as large as practical,
* for both input and output, to reduce the nb of roundtrips.
*/
ZSTDLIB_APIsize_tZSTD_CStreamInSize(void);/**< recommended size for input buffer */
ZSTDLIB_APIsize_tZSTD_CStreamOutSize(void);/**< recommended size for output buffer. Guarantee to successfully flush at least one complete compressed block in all circumstances. */
ZSTDLIB_APIsize_tZSTD_CStreamOutSize(void);/**< recommended size for output buffer. Guarantee to successfully flush at least one complete compressed block. */