Project Alice
Loading...
Searching...
No Matches
zstd_opt.c File Reference
#include "zstd_compress_internal.h"
#include "hist.h"
#include "zstd_opt.h"
Include dependency graph for zstd_opt.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ZSTD_optLdm_t
 

Macros

#define ZSTD_LITFREQ_ADD   2 /* scaling factor for litFreq, so that frequencies adapt faster to new stats */
 
#define ZSTD_MAX_PRICE   (1<<30)
 
#define ZSTD_PREDEF_THRESHOLD   8 /* if srcSize < ZSTD_PREDEF_THRESHOLD, symbols' cost is assumed static, directly determined by pre-defined distributions */
 
#define BITCOST_ACCURACY   8
 
#define BITCOST_MULTIPLIER   (1 << BITCOST_ACCURACY)
 
#define WEIGHT(stat, opt)   ((opt) ? ZSTD_fracWeight(stat) : ZSTD_bitWeight(stat))
 
#define ZSTD_BT_GET_ALL_MATCHES_FN(dictMode, mls)   ZSTD_btGetAllMatches_##dictMode##_##mls
 
#define GEN_ZSTD_BT_GET_ALL_MATCHES_(dictMode, mls)
 
#define GEN_ZSTD_BT_GET_ALL_MATCHES(dictMode)
 
#define ZSTD_BT_GET_ALL_MATCHES_ARRAY(dictMode)
 
#define LIT_PRICE(_p)   (int)ZSTD_rawLiteralsCost(_p, 1, optStatePtr, optLevel)
 
#define LL_PRICE(_l)   (int)ZSTD_litLengthPrice(_l, optStatePtr, optLevel)
 
#define LL_INCPRICE(_l)   (LL_PRICE(_l) - LL_PRICE(_l-1))
 

Typedefs

typedef U32(* ZSTD_getAllMatchesFn) (ZSTD_match_t *, ZSTD_matchState_t *, U32 *, const BYTE *, const BYTE *, const U32 rep[ZSTD_REP_NUM], U32 const ll0, U32 const lengthToBeat)
 

Enumerations

enum  base_directive_e { base_0possible =0 , base_1guaranteed =1 }
 

Functions

MEM_STATIC U32 ZSTD_bitWeight (U32 stat)
 
MEM_STATIC U32 ZSTD_fracWeight (U32 rawStat)
 
FORCE_INLINE_TEMPLATE U32 ZSTD_getMatchPrice (U32 const offBase, U32 const matchLength, const optState_t *const optPtr, int const optLevel)
 
MEM_STATIC U32 ZSTD_readMINMATCH (const void *memPtr, U32 length)
 
FORCE_INLINE_TEMPLATE ZSTD_ALLOW_POINTER_OVERFLOW_ATTR void ZSTD_updateTree_internal (ZSTD_matchState_t *ms, const BYTE *const ip, const BYTE *const iend, const U32 mls, const ZSTD_dictMode_e dictMode)
 
void ZSTD_updateTree (ZSTD_matchState_t *ms, const BYTE *ip, const BYTE *iend)
 
FORCE_INLINE_TEMPLATE ZSTD_ALLOW_POINTER_OVERFLOW_ATTR U32 ZSTD_insertBtAndGetAllMatches (ZSTD_match_t *matches, ZSTD_matchState_t *ms, U32 *nextToUpdate3, const BYTE *const ip, const BYTE *const iLimit, const ZSTD_dictMode_e dictMode, const U32 rep[ZSTD_REP_NUM], const U32 ll0, const U32 lengthToBeat, const U32 mls)
 
FORCE_INLINE_TEMPLATE ZSTD_ALLOW_POINTER_OVERFLOW_ATTR U32 ZSTD_btGetAllMatches_internal (ZSTD_match_t *matches, ZSTD_matchState_t *ms, U32 *nextToUpdate3, const BYTE *ip, const BYTE *const iHighLimit, const U32 rep[ZSTD_REP_NUM], U32 const ll0, U32 const lengthToBeat, const ZSTD_dictMode_e dictMode, const U32 mls)
 
FORCE_INLINE_TEMPLATE ZSTD_ALLOW_POINTER_OVERFLOW_ATTR size_t ZSTD_compressBlock_opt_generic (ZSTD_matchState_t *ms, seqStore_t *seqStore, U32 rep[ZSTD_REP_NUM], const void *src, size_t srcSize, const int optLevel, const ZSTD_dictMode_e dictMode)
 
size_t ZSTD_compressBlock_btopt (ZSTD_matchState_t *ms, seqStore_t *seqStore, U32 rep[ZSTD_REP_NUM], const void *src, size_t srcSize)
 
size_t ZSTD_compressBlock_btultra (ZSTD_matchState_t *ms, seqStore_t *seqStore, U32 rep[ZSTD_REP_NUM], const void *src, size_t srcSize)
 
size_t ZSTD_compressBlock_btultra2 (ZSTD_matchState_t *ms, seqStore_t *seqStore, U32 rep[ZSTD_REP_NUM], const void *src, size_t srcSize)
 
size_t ZSTD_compressBlock_btopt_dictMatchState (ZSTD_matchState_t *ms, seqStore_t *seqStore, U32 rep[ZSTD_REP_NUM], const void *src, size_t srcSize)
 
size_t ZSTD_compressBlock_btopt_extDict (ZSTD_matchState_t *ms, seqStore_t *seqStore, U32 rep[ZSTD_REP_NUM], const void *src, size_t srcSize)
 
size_t ZSTD_compressBlock_btultra_dictMatchState (ZSTD_matchState_t *ms, seqStore_t *seqStore, U32 rep[ZSTD_REP_NUM], const void *src, size_t srcSize)
 
size_t ZSTD_compressBlock_btultra_extDict (ZSTD_matchState_t *ms, seqStore_t *seqStore, U32 rep[ZSTD_REP_NUM], const void *src, size_t srcSize)
 

Macro Definition Documentation

◆ BITCOST_ACCURACY

#define BITCOST_ACCURACY   8

Definition at line 38 of file zstd_opt.c.

◆ BITCOST_MULTIPLIER

#define BITCOST_MULTIPLIER   (1 << BITCOST_ACCURACY)

Definition at line 39 of file zstd_opt.c.

◆ GEN_ZSTD_BT_GET_ALL_MATCHES

#define GEN_ZSTD_BT_GET_ALL_MATCHES (   dictMode)
Value:
GEN_ZSTD_BT_GET_ALL_MATCHES_(dictMode, 4) \
GEN_ZSTD_BT_GET_ALL_MATCHES_(dictMode, 5) \
GEN_ZSTD_BT_GET_ALL_MATCHES_(dictMode, 6)
#define GEN_ZSTD_BT_GET_ALL_MATCHES_(dictMode, mls)
Definition: zstd_opt.c:854

Definition at line 870 of file zstd_opt.c.

◆ GEN_ZSTD_BT_GET_ALL_MATCHES_

#define GEN_ZSTD_BT_GET_ALL_MATCHES_ (   dictMode,
  mls 
)
Value:
static U32 ZSTD_BT_GET_ALL_MATCHES_FN(dictMode, mls)( \
ZSTD_match_t* matches, \
U32* nextToUpdate3, \
const BYTE* ip, \
const BYTE* const iHighLimit, \
const U32 rep[ZSTD_REP_NUM], \
U32 const ll0, \
U32 const lengthToBeat) \
{ \
matches, ms, nextToUpdate3, ip, iHighLimit, \
rep, ll0, lengthToBeat, ZSTD_##dictMode, mls); \
}
unsigned char BYTE
Definition: mem.h:58
unsigned int U32
Definition: mem.h:69
#define ZSTD_REP_NUM
Definition: zstd_internal.h:68
#define ZSTD_BT_GET_ALL_MATCHES_FN(dictMode, mls)
Definition: zstd_opt.c:852
FORCE_INLINE_TEMPLATE ZSTD_ALLOW_POINTER_OVERFLOW_ATTR U32 ZSTD_btGetAllMatches_internal(ZSTD_match_t *matches, ZSTD_matchState_t *ms, U32 *nextToUpdate3, const BYTE *ip, const BYTE *const iHighLimit, const U32 rep[ZSTD_REP_NUM], U32 const ll0, U32 const lengthToBeat, const ZSTD_dictMode_e dictMode, const U32 mls)
Definition: zstd_opt.c:832

Definition at line 854 of file zstd_opt.c.

◆ LIT_PRICE

#define LIT_PRICE (   _p)    (int)ZSTD_rawLiteralsCost(_p, 1, optStatePtr, optLevel)

Definition at line 1068 of file zstd_opt.c.

◆ LL_INCPRICE

#define LL_INCPRICE (   _l)    (LL_PRICE(_l) - LL_PRICE(_l-1))

Definition at line 1070 of file zstd_opt.c.

◆ LL_PRICE

#define LL_PRICE (   _l)    (int)ZSTD_litLengthPrice(_l, optStatePtr, optLevel)

Definition at line 1069 of file zstd_opt.c.

◆ WEIGHT

#define WEIGHT (   stat,
  opt 
)    ((opt) ? ZSTD_fracWeight(stat) : ZSTD_bitWeight(stat))

Definition at line 40 of file zstd_opt.c.

◆ ZSTD_BT_GET_ALL_MATCHES_ARRAY

#define ZSTD_BT_GET_ALL_MATCHES_ARRAY (   dictMode)
Value:
{ \
ZSTD_BT_GET_ALL_MATCHES_FN(dictMode, 3), \
ZSTD_BT_GET_ALL_MATCHES_FN(dictMode, 4), \
ZSTD_BT_GET_ALL_MATCHES_FN(dictMode, 5), \
ZSTD_BT_GET_ALL_MATCHES_FN(dictMode, 6) \
}

Definition at line 880 of file zstd_opt.c.

◆ ZSTD_BT_GET_ALL_MATCHES_FN

#define ZSTD_BT_GET_ALL_MATCHES_FN (   dictMode,
  mls 
)    ZSTD_btGetAllMatches_##dictMode##_##mls

Definition at line 852 of file zstd_opt.c.

◆ ZSTD_LITFREQ_ADD

#define ZSTD_LITFREQ_ADD   2 /* scaling factor for litFreq, so that frequencies adapt faster to new stats */

Definition at line 19 of file zstd_opt.c.

◆ ZSTD_MAX_PRICE

#define ZSTD_MAX_PRICE   (1<<30)

Definition at line 20 of file zstd_opt.c.

◆ ZSTD_PREDEF_THRESHOLD

#define ZSTD_PREDEF_THRESHOLD   8 /* if srcSize < ZSTD_PREDEF_THRESHOLD, symbols' cost is assumed static, directly determined by pre-defined distributions */

Definition at line 22 of file zstd_opt.c.

Typedef Documentation

◆ ZSTD_getAllMatchesFn

typedef U32(* ZSTD_getAllMatchesFn) (ZSTD_match_t *, ZSTD_matchState_t *, U32 *, const BYTE *, const BYTE *, const U32 rep[ZSTD_REP_NUM], U32 const ll0, U32 const lengthToBeat)

Definition at line 820 of file zstd_opt.c.

Enumeration Type Documentation

◆ base_directive_e

Enumerator
base_0possible 
base_1guaranteed 

Definition at line 102 of file zstd_opt.c.

Function Documentation

◆ ZSTD_bitWeight()

MEM_STATIC U32 ZSTD_bitWeight ( U32  stat)

Definition at line 45 of file zstd_opt.c.

Here is the call graph for this function:

◆ ZSTD_btGetAllMatches_internal()

FORCE_INLINE_TEMPLATE ZSTD_ALLOW_POINTER_OVERFLOW_ATTR U32 ZSTD_btGetAllMatches_internal ( ZSTD_match_t matches,
ZSTD_matchState_t ms,
U32 nextToUpdate3,
const BYTE ip,
const BYTE *const  iHighLimit,
const U32  rep[ZSTD_REP_NUM],
U32 const  ll0,
U32 const  lengthToBeat,
const ZSTD_dictMode_e  dictMode,
const U32  mls 
)

Definition at line 832 of file zstd_opt.c.

Here is the call graph for this function:

◆ ZSTD_compressBlock_btopt()

size_t ZSTD_compressBlock_btopt ( ZSTD_matchState_t ms,
seqStore_t seqStore,
U32  rep[ZSTD_REP_NUM],
const void *  src,
size_t  srcSize 
)

Definition at line 1460 of file zstd_opt.c.

◆ ZSTD_compressBlock_btopt_dictMatchState()

size_t ZSTD_compressBlock_btopt_dictMatchState ( ZSTD_matchState_t ms,
seqStore_t seqStore,
U32  rep[ZSTD_REP_NUM],
const void *  src,
size_t  srcSize 
)

Definition at line 1543 of file zstd_opt.c.

◆ ZSTD_compressBlock_btopt_extDict()

size_t ZSTD_compressBlock_btopt_extDict ( ZSTD_matchState_t ms,
seqStore_t seqStore,
U32  rep[ZSTD_REP_NUM],
const void *  src,
size_t  srcSize 
)

Definition at line 1550 of file zstd_opt.c.

◆ ZSTD_compressBlock_btultra()

size_t ZSTD_compressBlock_btultra ( ZSTD_matchState_t ms,
seqStore_t seqStore,
U32  rep[ZSTD_REP_NUM],
const void *  src,
size_t  srcSize 
)

Definition at line 1505 of file zstd_opt.c.

◆ ZSTD_compressBlock_btultra2()

size_t ZSTD_compressBlock_btultra2 ( ZSTD_matchState_t ms,
seqStore_t seqStore,
U32  rep[ZSTD_REP_NUM],
const void *  src,
size_t  srcSize 
)

Definition at line 1513 of file zstd_opt.c.

◆ ZSTD_compressBlock_btultra_dictMatchState()

size_t ZSTD_compressBlock_btultra_dictMatchState ( ZSTD_matchState_t ms,
seqStore_t seqStore,
U32  rep[ZSTD_REP_NUM],
const void *  src,
size_t  srcSize 
)

Definition at line 1559 of file zstd_opt.c.

◆ ZSTD_compressBlock_btultra_extDict()

size_t ZSTD_compressBlock_btultra_extDict ( ZSTD_matchState_t ms,
seqStore_t seqStore,
U32  rep[ZSTD_REP_NUM],
const void *  src,
size_t  srcSize 
)

Definition at line 1566 of file zstd_opt.c.

◆ ZSTD_compressBlock_opt_generic()

FORCE_INLINE_TEMPLATE ZSTD_ALLOW_POINTER_OVERFLOW_ATTR size_t ZSTD_compressBlock_opt_generic ( ZSTD_matchState_t ms,
seqStore_t seqStore,
U32  rep[ZSTD_REP_NUM],
const void *  src,
size_t  srcSize,
const int  optLevel,
const ZSTD_dictMode_e  dictMode 
)

Definition at line 1075 of file zstd_opt.c.

Here is the call graph for this function:

◆ ZSTD_fracWeight()

MEM_STATIC U32 ZSTD_fracWeight ( U32  rawStat)

Definition at line 53 of file zstd_opt.c.

Here is the call graph for this function:

◆ ZSTD_getMatchPrice()

FORCE_INLINE_TEMPLATE U32 ZSTD_getMatchPrice ( U32 const  offBase,
U32 const  matchLength,
const optState_t *const  optPtr,
int const  optLevel 
)

Definition at line 324 of file zstd_opt.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ZSTD_insertBtAndGetAllMatches()

FORCE_INLINE_TEMPLATE ZSTD_ALLOW_POINTER_OVERFLOW_ATTR U32 ZSTD_insertBtAndGetAllMatches ( ZSTD_match_t matches,
ZSTD_matchState_t ms,
U32 nextToUpdate3,
const BYTE *const  ip,
const BYTE *const  iLimit,
const ZSTD_dictMode_e  dictMode,
const U32  rep[ZSTD_REP_NUM],
const U32  ll0,
const U32  lengthToBeat,
const U32  mls 
)

Definition at line 590 of file zstd_opt.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ZSTD_readMINMATCH()

MEM_STATIC U32 ZSTD_readMINMATCH ( const void *  memPtr,
U32  length 
)

Definition at line 393 of file zstd_opt.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ZSTD_updateTree()

void ZSTD_updateTree ( ZSTD_matchState_t ms,
const BYTE ip,
const BYTE iend 
)

Definition at line 583 of file zstd_opt.c.

Here is the call graph for this function:

◆ ZSTD_updateTree_internal()

FORCE_INLINE_TEMPLATE ZSTD_ALLOW_POINTER_OVERFLOW_ATTR void ZSTD_updateTree_internal ( ZSTD_matchState_t ms,
const BYTE *const  ip,
const BYTE *const  iend,
const U32  mls,
const ZSTD_dictMode_e  dictMode 
)

Definition at line 562 of file zstd_opt.c.

Here is the caller graph for this function: