diff options
author | Daniel Baumann <mail@daniel-baumann.ch> | 2015-11-07 06:47:26 +0000 |
---|---|---|
committer | Daniel Baumann <mail@daniel-baumann.ch> | 2015-11-07 06:47:26 +0000 |
commit | 5fc94e271f253bfc9685333287db76b73524f355 (patch) | |
tree | b21d894fb49a3e60d45cc2f642ff1037fb87f225 /lzd.cc | |
parent | Adding upstream version 0.4. (diff) | |
download | lzd-5fc94e271f253bfc9685333287db76b73524f355.tar.xz lzd-5fc94e271f253bfc9685333287db76b73524f355.zip |
Adding upstream version 0.5.upstream/0.5
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to '')
-rw-r--r-- | lzd.cc | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -56,6 +56,7 @@ enum { pos_states = 1 << pos_state_bits, pos_state_mask = pos_states - 1, + len_states = 4, dis_slot_bits = 6, start_dis_model = 4, end_dis_model = 14, @@ -72,7 +73,6 @@ enum { max_len_symbols = len_low_symbols + len_mid_symbols + len_high_symbols, min_match_len = 2, // must be 2 - max_dis_states = 4, bit_model_move_bits = 5, bit_model_total_bits = 11, @@ -299,7 +299,7 @@ bool LZ_decoder::decode_member() // Returns false if error Bit_model bm_rep1[State::states]; Bit_model bm_rep2[State::states]; Bit_model bm_len[State::states][pos_states]; - Bit_model bm_dis_slot[max_dis_states][1<<dis_slot_bits]; + Bit_model bm_dis_slot[len_states][1<<dis_slot_bits]; Bit_model bm_dis[modeled_distances-end_dis_model]; Bit_model bm_align[dis_align_size]; Len_model match_len_model; @@ -327,9 +327,9 @@ bool LZ_decoder::decode_member() // Returns false if error else { int len; - if( rdec.decode_bit( bm_rep[state()] ) == 1 ) // 2nd bit + if( rdec.decode_bit( bm_rep[state()] ) != 0 ) // 2nd bit { - if( rdec.decode_bit( bm_rep0[state()] ) == 1 ) // 3rd bit + if( rdec.decode_bit( bm_rep0[state()] ) != 0 ) // 3rd bit { unsigned distance; if( rdec.decode_bit( bm_rep1[state()] ) == 0 ) // 4th bit @@ -350,16 +350,16 @@ bool LZ_decoder::decode_member() // Returns false if error if( rdec.decode_bit( bm_len[state()][pos_state] ) == 0 ) // 4th bit { state.set_short_rep(); put_byte( get_byte( rep0 ) ); continue; } } - len = min_match_len + rdec.decode_len( rep_len_model, pos_state ); state.set_rep(); + len = min_match_len + rdec.decode_len( rep_len_model, pos_state ); } else { rep3 = rep2; rep2 = rep1; rep1 = rep0; len = min_match_len + rdec.decode_len( match_len_model, pos_state ); - const int dis_state = std::min( len - min_match_len, max_dis_states - 1 ); + const int len_state = std::min( len - min_match_len, len_states - 1 ); const int dis_slot = - rdec.decode_tree( bm_dis_slot[dis_state], dis_slot_bits ); + rdec.decode_tree( bm_dis_slot[len_state], dis_slot_bits ); if( dis_slot < start_dis_model ) rep0 = dis_slot; else { |