14 #ifndef LZMA_LZMA_COMMON_H
15 #define LZMA_LZMA_COMMON_H
28 #define POS_STATES_MAX (1 << LZMA_PB_MAX)
80 #define update_literal(state) \
81 state = ((state) <= STATE_SHORTREP_LIT_LIT \
83 : ((state) <= STATE_LIT_SHORTREP \
88 #define update_match(state) \
89 state = ((state) < LIT_STATES ? STATE_LIT_MATCH : STATE_NONLIT_MATCH)
92 #define update_long_rep(state) \
93 state = ((state) < LIT_STATES ? STATE_LIT_LONGREP : STATE_NONLIT_REP)
96 #define update_short_rep(state) \
97 state = ((state) < LIT_STATES ? STATE_LIT_SHORTREP : STATE_NONLIT_REP)
100 #define is_literal_state(state) \
101 ((state) < LIT_STATES)
115 #define LITERAL_CODER_SIZE 0x300
118 #define LITERAL_CODERS_MAX (1 << LZMA_LCLP_MAX)
124 #define literal_subcoder(probs, lc, lp_mask, pos, prev_byte) \
125 ((probs)[(((pos) & (lp_mask)) << (lc)) \
126 + ((uint32_t)(prev_byte) >> (8U - (lc)))])
135 const uint32_t coders = 1U << (lc + lp);
150 #define MATCH_LEN_MIN 2
158 #define LEN_LOW_BITS 3
159 #define LEN_LOW_SYMBOLS (1 << LEN_LOW_BITS)
160 #define LEN_MID_BITS 3
161 #define LEN_MID_SYMBOLS (1 << LEN_MID_BITS)
162 #define LEN_HIGH_BITS 8
163 #define LEN_HIGH_SYMBOLS (1 << LEN_HIGH_BITS)
164 #define LEN_SYMBOLS (LEN_LOW_SYMBOLS + LEN_MID_SYMBOLS + LEN_HIGH_SYMBOLS)
168 #define MATCH_LEN_MAX (MATCH_LEN_MIN + LEN_SYMBOLS - 1)
179 #define DIST_STATES 4
182 #define get_dist_state(len) \
183 ((len) < DIST_STATES + MATCH_LEN_MIN \
184 ? (len) - MATCH_LEN_MIN \
189 #define DIST_SLOT_BITS 6
190 #define DIST_SLOTS (1 << DIST_SLOT_BITS)
198 #define DIST_MODEL_START 4
209 #define DIST_MODEL_END 14
212 #define FULL_DISTANCES_BITS (DIST_MODEL_END / 2)
213 #define FULL_DISTANCES (1 << FULL_DISTANCES_BITS)
218 #define ALIGN_SIZE (1 << ALIGN_BITS)
219 #define ALIGN_MASK (ALIGN_SIZE - 1)
static const char struct stat static buf struct stat static buf static vhangup int options
#define LITERAL_CODER_SIZE
static void literal_init(probability(*probs)[LITERAL_CODER_SIZE], uint32_t lc, uint32_t lp)
static bool is_lclppb_valid(const lzma_options_lzma *options)
Validates lc, lp, and pb.
assert(limit<=UINT32_MAX/2)
Common things for range encoder and decoder.
uint16_t probability
Type of probabilities used with range coder.
Options specific to the LZMA1 and LZMA2 filters.