summaryrefslogtreecommitdiffstats
path: root/encoder.h
diff options
context:
space:
mode:
authorDaniel Baumann <mail@daniel-baumann.ch>2015-11-07 09:59:28 +0000
committerDaniel Baumann <mail@daniel-baumann.ch>2015-11-07 09:59:28 +0000
commita12430a7bff80cea63fa05ffd716f0d5e91ddb6d (patch)
tree8dfed744f7334264782fa74b40386eec0061d03d /encoder.h
parentAdding debian version 1.15~pre2-4. (diff)
downloadlzip-a12430a7bff80cea63fa05ffd716f0d5e91ddb6d.tar.xz
lzip-a12430a7bff80cea63fa05ffd716f0d5e91ddb6d.zip
Merging upstream version 1.15~pre3.
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to '')
-rw-r--r--encoder.h32
1 files changed, 15 insertions, 17 deletions
diff --git a/encoder.h b/encoder.h
index d3f3e77..973ba6c 100644
--- a/encoder.h
+++ b/encoder.h
@@ -1,4 +1,4 @@
-/* Lzip - Data compressor based on the LZMA algorithm
+/* Lzip - LZMA lossless data compressor
Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013 Antonio Diaz Diaz.
This program is free software: you can redistribute it and/or modify
@@ -405,8 +405,7 @@ public:
for( int i = 0; i < pos_states; ++i ) update_prices( i );
}
- void encode( Range_encoder & range_encoder, int symbol,
- const int pos_state );
+ void encode( Range_encoder & renc, int symbol, const int pos_state );
int price( const int symbol, const int pos_state ) const
{ return prices[pos_state][symbol - min_match_len]; }
@@ -432,7 +431,7 @@ protected:
Bit_model bm_dis[modeled_distances-end_dis_model];
Bit_model bm_align[dis_align_size];
- Range_encoder range_encoder;
+ Range_encoder renc;
Len_encoder match_len_encoder;
Len_encoder rep_len_encoder;
@@ -444,13 +443,13 @@ protected:
const int match_len_limit, const int outfd )
:
crc_( 0xFFFFFFFFU ),
- range_encoder( outfd ),
+ renc( outfd ),
match_len_encoder( match_len_limit ),
rep_len_encoder( match_len_limit ),
num_dis_slots( 2 * real_bits( dictionary_size - 1 ) )
{
for( int i = 0; i < File_header::size; ++i )
- range_encoder.put_byte( header.data[i] );
+ renc.put_byte( header.data[i] );
}
// move-to-front dis in/into reps
@@ -478,18 +477,18 @@ protected:
symbol, match_byte ); }
void encode_literal( const uint8_t prev_byte, const uint8_t symbol )
- { range_encoder.encode_tree( bm_literal[get_lit_state(prev_byte)], symbol, 8 ); }
+ { renc.encode_tree( bm_literal[get_lit_state(prev_byte)], symbol, 8 ); }
void encode_matched( const uint8_t prev_byte, const uint8_t symbol,
const uint8_t match_byte )
- { range_encoder.encode_matched( bm_literal[get_lit_state(prev_byte)],
- symbol, match_byte ); }
+ { renc.encode_matched( bm_literal[get_lit_state(prev_byte)], symbol,
+ match_byte ); }
void encode_pair( const uint32_t dis, const int len, const int pos_state )
{
- match_len_encoder.encode( range_encoder, len, pos_state );
+ match_len_encoder.encode( renc, len, pos_state );
const int dis_slot = get_slot( dis );
- range_encoder.encode_tree( bm_dis_slot[get_dis_state(len)], dis_slot, dis_slot_bits );
+ renc.encode_tree( bm_dis_slot[get_dis_state(len)], dis_slot, dis_slot_bits );
if( dis_slot >= start_dis_model )
{
@@ -498,12 +497,12 @@ protected:
const uint32_t direct_dis = dis - base;
if( dis_slot < end_dis_model )
- range_encoder.encode_tree_reversed( bm_dis + base - dis_slot - 1,
- direct_dis, direct_bits );
+ renc.encode_tree_reversed( bm_dis + base - dis_slot - 1, direct_dis,
+ direct_bits );
else
{
- range_encoder.encode( direct_dis >> dis_align_bits, direct_bits - dis_align_bits );
- range_encoder.encode_tree_reversed( bm_align, direct_dis, dis_align_bits );
+ renc.encode( direct_dis >> dis_align_bits, direct_bits - dis_align_bits );
+ renc.encode_tree_reversed( bm_align, direct_dis, dis_align_bits );
}
}
}
@@ -511,8 +510,7 @@ protected:
void full_flush( const unsigned long long data_position, const State state );
public:
- unsigned long long member_position() const
- { return range_encoder.member_position(); }
+ unsigned long long member_position() const { return renc.member_position(); }
};