ReactOS 0.4.16-dev-91-g764881a
|
Go to the source code of this file.
Macros | |
#define | LDM_BUCKET_SIZE_LOG 3 |
#define | LDM_MIN_MATCH_LENGTH 64 |
#define | LDM_HASH_RLOG 7 |
#define | LDM_HASH_CHAR_OFFSET 10 |
#define LDM_BUCKET_SIZE_LOG 3 |
Definition at line 17 of file zstd_ldm.c.
#define LDM_HASH_CHAR_OFFSET 10 |
Definition at line 20 of file zstd_ldm.c.
#define LDM_HASH_RLOG 7 |
Definition at line 19 of file zstd_ldm.c.
#define LDM_MIN_MATCH_LENGTH 64 |
Definition at line 18 of file zstd_ldm.c.
|
static |
If the sequence length is longer than remaining then the sequence is split between this block and the next.
Returns the current sequence to handle, or if the rest of the block should be literals, it returns a sequence with offset == 0.
Definition at line 541 of file zstd_ldm.c.
Referenced by ZSTD_ldm_blockCompress().
void ZSTD_ldm_adjustParameters | ( | ldmParams_t * | params, |
ZSTD_compressionParameters const * | cParams | ||
) |
ZSTD_ldm_adjustParameters() : If the params->hashRateLog is not set, set it to its default value based on windowLog and params->hashLog.
Ensures that params->bucketSizeLog is <= params->hashLog (setting it to params->hashLog if it is not).
Ensures that the minMatchLength >= targetLength during optimal parsing.
Definition at line 22 of file zstd_ldm.c.
Referenced by ZSTD_resetCCtx_internal().
size_t ZSTD_ldm_blockCompress | ( | rawSeqStore_t * | rawSeqStore, |
ZSTD_matchState_t * | ms, | ||
seqStore_t * | seqStore, | ||
U32 | rep[ZSTD_REP_NUM], | ||
void const * | src, | ||
size_t | srcSize | ||
) |
Compresses a block using the predefined sequences, along with a secondary block compressor. The literals section of every sequence is passed to the secondary block compressor, and those sequences are interspersed with the predefined sequences. Returns the length of the last literals. Updates rawSeqStore.pos
to indicate how many sequences have been consumed. rawSeqStore.seq
may also be updated to split the last sequence between two blocks.
NOTE: The source must be at most the maximum block size, but the predefined sequences can be any size, and may be longer than the block. In the case that they are longer than the block, the last sequences may need to be split into two. We handle that case correctly, and update rawSeqStore
appropriately. NOTE: This function does not return any errors.
Definition at line 565 of file zstd_ldm.c.
Referenced by ZSTD_buildSeqStore().
|
static |
ZSTD_ldm_countBackwardsMatch() : Returns the number of bytes that match backwards before pIn and pMatch.
We count only bytes where pMatch >= pBase and pIn >= pAnchor.
Definition at line 151 of file zstd_ldm.c.
Referenced by ZSTD_ldm_generateSequences_internal().
|
static |
Fills the relevant tables for the ZSTD_fast and ZSTD_dfast strategies. This is similar to ZSTD_loadDictionaryContent.
The tables for the other strategies are filled within their block compressors.
Definition at line 171 of file zstd_ldm.c.
Referenced by ZSTD_ldm_blockCompress().
void ZSTD_ldm_fillHashTable | ( | ldmState_t * | state, |
const BYTE * | ip, | ||
const BYTE * | iend, | ||
ldmParams_t const * | params | ||
) |
Definition at line 227 of file zstd_ldm.c.
Referenced by ZSTD_loadDictionaryContent().
|
static |
Fills hashTable from (lastHashed + 1) to iend (non-inclusive). lastHash is the rolling hash that corresponds to lastHashed.
Returns the rolling hash corresponding to position iend-1.
Definition at line 207 of file zstd_ldm.c.
Referenced by ZSTD_ldm_fillHashTable(), and ZSTD_ldm_generateSequences_internal().
size_t ZSTD_ldm_generateSequences | ( | ldmState_t * | ldms, |
rawSeqStore_t * | sequences, | ||
ldmParams_t const * | params, | ||
void const * | src, | ||
size_t | srcSize | ||
) |
Generates the sequences using the long distance match finder. Generates long range matching sequences in sequences
, which parse a prefix of the source. sequences
must be large enough to store every sequence, which can be checked with ZSTD_ldm_getMaxNbSeq()
.
NOTE: The user must have called ZSTD_window_update() for all of the input they have, even if they pass it to ZSTD_ldm_generateSequences() in chunks. NOTE: This function returns an error if it runs out of space to store sequences.
Definition at line 429 of file zstd_ldm.c.
Referenced by ZSTD_buildSeqStore().
|
static |
Definition at line 256 of file zstd_ldm.c.
Referenced by ZSTD_ldm_generateSequences().
|
static |
ZSTD_ldm_getBucket() : Returns a pointer to the start of the bucket associated with hash.
Definition at line 101 of file zstd_ldm.c.
Referenced by ZSTD_ldm_generateSequences_internal(), and ZSTD_ldm_insertEntry().
ZSTD_ldm_getChecksum() : numBitsToDiscard should be <= 32
Definition at line 77 of file zstd_ldm.c.
Referenced by ZSTD_ldm_generateSequences_internal(), and ZSTD_ldm_makeEntryAndInsertByTag().
size_t ZSTD_ldm_getMaxNbSeq | ( | ldmParams_t | params, |
size_t | maxChunkSize | ||
) |
ZSTD_ldm_getSeqSpace() : Return an upper bound on the number of sequences that can be produced by the long distance matcher, or 0 if LDM is disabled.
Definition at line 59 of file zstd_ldm.c.
Referenced by ZSTD_estimateCCtxSize_usingCCtxParams(), and ZSTD_resetCCtx_internal().
ZSTD_ldm_getSmallHash() : numBits should be <= 32 If numBits==0, returns 0.
Definition at line 68 of file zstd_ldm.c.
Referenced by ZSTD_ldm_generateSequences_internal(), and ZSTD_ldm_makeEntryAndInsertByTag().
size_t ZSTD_ldm_getTableSize | ( | ldmParams_t | params | ) |
ZSTD_ldm_getTableSize() : Estimate the space needed for long distance matching tables or 0 if LDM is disabled.
Definition at line 49 of file zstd_ldm.c.
Referenced by ZSTD_estimateCCtxSize_usingCCtxParams(), and ZSTD_resetCCtx_internal().
ZSTD_ldm_getTag() ; Given the hash, returns the most significant numTagBits bits after (32 + hbits) bits.
If there are not enough bits remaining, return the last numTagBits bits.
Definition at line 89 of file zstd_ldm.c.
Referenced by ZSTD_ldm_generateSequences_internal(), and ZSTD_ldm_makeEntryAndInsertByTag().
|
static |
ZSTD_ldm_insertEntry() : Insert the entry with corresponding hash into the hash table
Definition at line 109 of file zstd_ldm.c.
Referenced by ZSTD_ldm_makeEntryAndInsertByTag().
|
static |
Sets cctx->nextToUpdate to a position corresponding closer to anchor if it is far way (after a long match, only update tables a limited amount).
Definition at line 247 of file zstd_ldm.c.
Referenced by ZSTD_ldm_blockCompress().
|
static |
ZSTD_ldm_makeEntryAndInsertByTag() :
Gets the small hash, checksum, and tag from the rollingHash.
If the tag matches (1 << ldmParams.hashRateLog)-1, then creates an ldmEntry from the offset, and inserts it into the hash table.
hBits is the length of the small hash, which is the most significant hBits of rollingHash. The checksum is the next 32 most significant bits, followed by ldmParams.hashRateLog bits that make up the tag.
Definition at line 129 of file zstd_ldm.c.
Referenced by ZSTD_ldm_fillLdmHashTable(), and ZSTD_ldm_generateSequences_internal().
|
static |
ZSTD_ldm_reduceTable() : reduce table indexes by reducerValue
Definition at line 419 of file zstd_ldm.c.
Referenced by ZSTD_ldm_generateSequences().
void ZSTD_ldm_skipSequences | ( | rawSeqStore_t * | rawSeqStore, |
size_t | srcSize, | ||
U32 const | minMatch | ||
) |
Skip past srcSize
bytes worth of sequences in rawSeqStore
. Avoids emitting matches less than minMatch
bytes. Must be called for data with is not passed to ZSTD_ldm_blockCompress().
Definition at line 506 of file zstd_ldm.c.
Referenced by maybeSplitSequence(), and ZSTD_buildSeqStore().