Rizin
unix-like reverse engineering framework and cli tools
|
LZMA encoder. More...
Go to the source code of this file.
Macros | |
#define | LOOP_INPUT_MAX (OPTS + 1) |
LZMA encoder.
Definition in file lzma_encoder.c.
#define LOOP_INPUT_MAX (OPTS + 1) |
Number of bytes that a single encoding loop in lzma_lzma_encode() can consume from the dictionary. This limit comes from lzma_lzma_optimum() and may need to be updated if that function is significantly modified.
Definition at line 308 of file lzma_encoder.c.
|
static |
Definition at line 296 of file lzma_encoder.c.
References lzma_lzma1_encoder_s::is_match, lzma_lzma1_encoder_s::is_rep, match(), MATCH_LEN_MIN, lzma_lzma1_encoder_s::pos_mask, lzma_lzma1_encoder_s::rc, rc_bit, lzma_lzma1_encoder_s::state, and UINT32_MAX.
Referenced by lzma_lzma_encode().
|
static |
Definition at line 268 of file lzma_encoder.c.
References lzma_mf_s::action, assert(), lzma_mf_s::buffer, lzma_lzma1_encoder_s::is_initialized, lzma_lzma1_encoder_s::is_match, lzma_lzma1_encoder_s::literal, LZMA_FINISH, LZMA_RUN, mf_position(), mf_skip(), lzma_lzma1_encoder_s::rc, rc_bit, rc_bittree(), lzma_mf_s::read_ahead, lzma_mf_s::read_limit, lzma_mf_s::read_pos, and lzma_mf_s::write_pos.
Referenced by lzma_lzma_encode().
|
static |
Definition at line 234 of file lzma_encoder.c.
References assert(), lzma_lzma1_encoder_s::is_match, lzma_lzma1_encoder_s::is_rep, len, literal(), match(), lzma_lzma1_encoder_s::pos_mask, lzma_lzma1_encoder_s::rc, rc_bit, lzma_mf_s::read_ahead, rep_match(), REPS, lzma_lzma1_encoder_s::state, and UINT32_MAX.
Referenced by lzma_lzma_encode().
|
static |
Definition at line 422 of file lzma_encoder.c.
References is_lclppb_valid(), LZMA_MODE_FAST, LZMA_MODE_NORMAL, MATCH_LEN_MAX, MATCH_LEN_MIN, and options.
Referenced by lzma_lzma_encoder_memusage(), and lzma_lzma_encoder_reset().
|
inlinestatic |
Definition at line 107 of file lzma_encoder.c.
References assert(), lzma_length_encoder::choice, lzma_length_encoder::choice2, lzma_length_encoder::counters, lzma_length_encoder::high, len, LEN_HIGH_BITS, LEN_LOW_BITS, LEN_LOW_SYMBOLS, LEN_MID_BITS, LEN_MID_SYMBOLS, length_update_prices(), lzma_length_encoder::low, MATCH_LEN_MAX, MATCH_LEN_MIN, lzma_length_encoder::mid, rc_bit, and rc_bittree().
Referenced by match(), and rep_match().
|
static |
Definition at line 453 of file lzma_encoder.c.
References bit_reset, bittree_reset, lzma_length_encoder::choice, lzma_length_encoder::choice2, lzma_length_encoder::high, LEN_HIGH_BITS, LEN_LOW_BITS, LEN_MID_BITS, length_update_prices(), lzma_length_encoder::low, and lzma_length_encoder::mid.
Referenced by lzma_lzma_encoder_reset().
|
static |
Definition at line 78 of file lzma_encoder.c.
References a0, b1, lzma_length_encoder::choice, lzma_length_encoder::choice2, lzma_length_encoder::counters, lzma_length_encoder::high, i, LEN_HIGH_BITS, LEN_LOW_BITS, LEN_LOW_SYMBOLS, LEN_MID_BITS, LEN_MID_SYMBOLS, lzma_length_encoder::low, lzma_length_encoder::mid, lzma_length_encoder::prices, rc_bit_0_price(), rc_bit_1_price(), rc_bittree_price(), and lzma_length_encoder::table_size.
Referenced by length(), and length_encoder_reset().
|
inlinestatic |
Definition at line 46 of file lzma_encoder.c.
References lzma_mf_s::buffer, is_literal_state, lzma_lzma1_encoder_s::literal, lzma_lzma1_encoder_s::literal_context_bits, literal_matched(), lzma_lzma1_encoder_s::literal_pos_mask, literal_subcoder, lzma_lzma1_encoder_s::rc, rc_bittree(), lzma_mf_s::read_ahead, lzma_mf_s::read_pos, lzma_lzma1_encoder_s::reps, lzma_lzma1_encoder_s::state, and update_literal.
Referenced by encode_symbol().
|
inlinestatic |
LZMA_API | ( | lzma_bool | ) |
|
static |
Definition at line 405 of file lzma_encoder.c.
References lzma_lzma_encode(), LZMA_OPTIONS_ERROR, LZMA_SYNC_FLUSH, out, out_pos, UINT32_MAX, and unlikely.
Referenced by lzma_encoder_init().
|
static |
Definition at line 609 of file lzma_encoder.c.
References allocator, lzma_lz_encoder::code, lzma_lz_encoder::coder, lzma_encode(), lzma_lzma_encoder_create(), and options.
Referenced by lzma_lzma_encoder_init().
lzma_ret lzma_lzma_encode | ( | lzma_lzma1_encoder *restrict | coder, |
lzma_mf *restrict | mf, | ||
uint8_t *restrict | out, | ||
size_t *restrict | out_pos, | ||
size_t | out_size, | ||
uint32_t | limit | ||
) |
Definition at line 312 of file lzma_encoder.c.
References assert(), encode_eopm(), encode_init(), encode_symbol(), len, limit, LOOP_INPUT_MAX, LZMA2_CHUNK_MAX, lzma_lzma_optimum_fast(), lzma_lzma_optimum_normal(), LZMA_OK, LZMA_RUN, LZMA_STREAM_END, mf_position(), out, out_pos, rc_encode(), rc_flush(), rc_pending(), and UINT32_MAX.
Referenced by lzma2_encode(), and lzma_encode().
lzma_ret lzma_lzma_encoder_create | ( | void ** | coder_ptr, |
const lzma_allocator * | allocator, | ||
const lzma_options_lzma * | options, | ||
lzma_lz_options * | lz_options | ||
) |
Definition at line 549 of file lzma_encoder.c.
References allocator, lzma_lzma1_encoder_s::dist_table_size, lzma_lzma1_encoder_s::fast_mode, lzma_lzma1_encoder_s::is_flushed, lzma_lzma1_encoder_s::is_initialized, lzma_alloc(), lzma_lzma_encoder_reset(), LZMA_MEM_ERROR, LZMA_MODE_FAST, LZMA_MODE_NORMAL, LZMA_OPTIONS_ERROR, lzma_lzma1_encoder_s::match_len_encoder, MATCH_LEN_MIN, NULL, options, lzma_lzma1_encoder_s::rep_len_encoder, set_lz_options(), lzma_length_encoder::table_size, and UINT32_C.
Referenced by lzma2_encoder_init(), and lzma_encoder_init().
lzma_ret lzma_lzma_encoder_init | ( | lzma_next_coder * | next, |
const lzma_allocator * | allocator, | ||
const lzma_filter_info * | filters | ||
) |
Definition at line 619 of file lzma_encoder.c.
References allocator, filters, lzma_encoder_init(), and lzma_lz_encoder_init().
Referenced by alone_encoder_init().
Definition at line 628 of file lzma_encoder.c.
References is_options_valid(), lzma_lz_encoder_memusage(), options, set_lz_options(), and UINT64_MAX.
Referenced by lzma_lzma2_encoder_memusage().
lzma_ret lzma_lzma_encoder_reset | ( | lzma_lzma1_encoder * | coder, |
const lzma_options_lzma * | options | ||
) |
Definition at line 476 of file lzma_encoder.c.
References ALIGN_BITS, lzma_lzma1_encoder_s::align_price_count, bit_reset, bittree_reset, lzma_lzma1_encoder_s::dist_align, DIST_MODEL_END, lzma_lzma1_encoder_s::dist_slot, DIST_SLOT_BITS, lzma_lzma1_encoder_s::dist_special, DIST_STATES, lzma_lzma1_encoder_s::fast_mode, FULL_DISTANCES, i, lzma_lzma1_encoder_s::is_match, is_options_valid(), lzma_lzma1_encoder_s::is_rep, lzma_lzma1_encoder_s::is_rep0, lzma_lzma1_encoder_s::is_rep0_long, lzma_lzma1_encoder_s::is_rep1, lzma_lzma1_encoder_s::is_rep2, length_encoder_reset(), lzma_lzma1_encoder_s::literal, lzma_lzma1_encoder_s::literal_context_bits, literal_init(), lzma_lzma1_encoder_s::literal_pos_mask, LZMA_OK, LZMA_OPTIONS_ERROR, lzma_lzma1_encoder_s::match_len_encoder, lzma_lzma1_encoder_s::match_price_count, options, lzma_lzma1_encoder_s::opts_current_index, lzma_lzma1_encoder_s::opts_end_index, lzma_lzma1_encoder_s::pos_mask, lzma_lzma1_encoder_s::rc, rc_reset, lzma_lzma1_encoder_s::rep_len_encoder, REPS, lzma_lzma1_encoder_s::reps, lzma_lzma1_encoder_s::state, STATE_LIT_LIT, STATES, and UINT32_MAX.
Referenced by lzma2_encode(), and lzma_lzma_encoder_create().
bool lzma_lzma_lclppb_encode | ( | const lzma_options_lzma * | options, |
uint8_t * | byte | ||
) |
Encodes lc/lp/pb into one byte. Returns false on success and true on error.
Definition at line 645 of file lzma_encoder.c.
References assert(), is_lclppb_valid(), and options.
Referenced by alone_encoder_init(), and lzma2_header_lzma().
|
inlinestatic |
Definition at line 143 of file lzma_encoder.c.
References ALIGN_BITS, ALIGN_MASK, lzma_lzma1_encoder_s::align_price_count, lzma_lzma1_encoder_s::dist_align, DIST_MODEL_END, DIST_MODEL_START, lzma_lzma1_encoder_s::dist_slot, DIST_SLOT_BITS, lzma_lzma1_encoder_s::dist_special, lzma_lzma1_encoder_s::fast_mode, get_dist_slot(), get_dist_state, len, length(), lzma_lzma1_encoder_s::match_len_encoder, lzma_lzma1_encoder_s::match_price_count, lzma_lzma1_encoder_s::rc, rc_bittree(), rc_bittree_reverse(), rc_direct, lzma_lzma1_encoder_s::reps, lzma_lzma1_encoder_s::state, and update_match.
Referenced by encode_eopm(), and encode_symbol().
|
inlinestatic |
Definition at line 190 of file lzma_encoder.c.
References lzma_lzma1_encoder_s::fast_mode, lzma_lzma1_encoder_s::is_rep0, lzma_lzma1_encoder_s::is_rep0_long, lzma_lzma1_encoder_s::is_rep1, lzma_lzma1_encoder_s::is_rep2, len, length(), lzma_lzma1_encoder_s::rc, rc_bit, lzma_lzma1_encoder_s::rep_len_encoder, lzma_lzma1_encoder_s::reps, lzma_lzma1_encoder_s::state, update_long_rep, and update_short_rep.
Referenced by encode_symbol().
|
static |
Definition at line 435 of file lzma_encoder.c.
References lzma_lz_options::after_size, lzma_lz_options::before_size, lzma_lz_options::depth, lzma_lz_options::dict_size, LOOP_INPUT_MAX, lzma_lz_options::match_finder, lzma_lz_options::match_len_max, MATCH_LEN_MAX, lzma_lz_options::nice_len, options, OPTS, lzma_lz_options::preset_dict, and lzma_lz_options::preset_dict_size.
Referenced by lzma_lzma_encoder_create(), and lzma_lzma_encoder_memusage().