summaryrefslogtreecommitdiffstats
path: root/lzd.cc
diff options
context:
space:
mode:
authorDaniel Baumann <mail@daniel-baumann.ch>2015-11-07 06:47:31 +0000
committerDaniel Baumann <mail@daniel-baumann.ch>2015-11-07 06:47:31 +0000
commitb6e14044c7667a5c8b0eaa67f35da6d289118042 (patch)
tree53809fb0e162029e01a6adec3e3c4b32de0936d4 /lzd.cc
parentAdding debian version 0.4-1. (diff)
downloadlzd-b6e14044c7667a5c8b0eaa67f35da6d289118042.tar.xz
lzd-b6e14044c7667a5c8b0eaa67f35da6d289118042.zip
Merging upstream version 0.5.
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to '')
-rw-r--r--lzd.cc14
1 files changed, 7 insertions, 7 deletions
diff --git a/lzd.cc b/lzd.cc
index b5c5ac8..b069f0c 100644
--- a/lzd.cc
+++ b/lzd.cc
@@ -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
{