summaryrefslogtreecommitdiffstats
path: root/fast_encoder.cc
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 /fast_encoder.cc
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 'fast_encoder.cc')
-rw-r--r--fast_encoder.cc36
1 files changed, 18 insertions, 18 deletions
diff --git a/fast_encoder.cc b/fast_encoder.cc
index fc5f891..21e1a2b 100644
--- a/fast_encoder.cc
+++ b/fast_encoder.cc
@@ -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
@@ -124,21 +124,21 @@ bool FLZ_encoder::encode_member( const unsigned long long member_size )
for( int i = 0; i < num_rep_distances; ++i ) reps[i] = 0;
if( fmatchfinder.data_position() != 0 ||
- range_encoder.member_position() != File_header::size )
+ renc.member_position() != File_header::size )
return false; // can be called only once
if( !fmatchfinder.finished() ) // encode first byte
{
const uint8_t prev_byte = 0;
const uint8_t cur_byte = fmatchfinder[0];
- range_encoder.encode_bit( bm_match[state()][0], 0 );
+ renc.encode_bit( bm_match[state()][0], 0 );
encode_literal( prev_byte, cur_byte );
crc32.update( crc_, cur_byte );
fmatchfinder.longest_match_len( 1 );
}
while( !fmatchfinder.finished() &&
- range_encoder.member_position() < member_size_limit )
+ renc.member_position() < member_size_limit )
{
int match_distance;
const int main_len = fmatchfinder.longest_match_len( &match_distance );
@@ -154,22 +154,22 @@ bool FLZ_encoder::encode_member( const unsigned long long member_size )
if( len > min_match_len && len + 4 > main_len )
{
crc32.update( crc_, fmatchfinder.ptr_to_current_pos(), len );
- range_encoder.encode_bit( bm_match[state()][pos_state], 1 );
- range_encoder.encode_bit( bm_rep[state()], 1 );
+ renc.encode_bit( bm_match[state()][pos_state], 1 );
+ renc.encode_bit( bm_rep[state()], 1 );
const bool bit = ( dis == 0 );
- range_encoder.encode_bit( bm_rep0[state()], !bit );
+ renc.encode_bit( bm_rep0[state()], !bit );
if( bit )
- range_encoder.encode_bit( bm_len[state()][pos_state], 1 );
+ renc.encode_bit( bm_len[state()][pos_state], 1 );
else
{
const int distance = reps[dis];
for( int i = dis; i > 0; --i ) reps[i] = reps[i-1];
reps[0] = distance;
- range_encoder.encode_bit( bm_rep1[state()], dis > 1 );
+ renc.encode_bit( bm_rep1[state()], dis > 1 );
if( dis > 1 )
- range_encoder.encode_bit( bm_rep2[state()], dis > 2 );
+ renc.encode_bit( bm_rep2[state()], dis > 2 );
}
- rep_len_encoder.encode( range_encoder, len, pos_state );
+ rep_len_encoder.encode( renc, len, pos_state );
state.set_rep();
move_pos( len );
continue;
@@ -180,8 +180,8 @@ bool FLZ_encoder::encode_member( const unsigned long long member_size )
{
crc32.update( crc_, fmatchfinder.ptr_to_current_pos(), main_len );
dis = match_distance;
- range_encoder.encode_bit( bm_match[state()][pos_state], 1 );
- range_encoder.encode_bit( bm_rep[state()], 0 );
+ renc.encode_bit( bm_match[state()][pos_state], 1 );
+ renc.encode_bit( bm_rep[state()], 0 );
encode_pair( dis, main_len, pos_state );
state.set_match();
move_pos( main_len );
@@ -209,17 +209,17 @@ bool FLZ_encoder::encode_member( const unsigned long long member_size )
price0( bm_len[state()][pos_state] );
if( short_rep_price < price )
{
- range_encoder.encode_bit( bm_match[state()][pos_state], 1 );
- range_encoder.encode_bit( bm_rep[state()], 1 );
- range_encoder.encode_bit( bm_rep0[state()], 0 );
- range_encoder.encode_bit( bm_len[state()][pos_state], 0 );
+ renc.encode_bit( bm_match[state()][pos_state], 1 );
+ renc.encode_bit( bm_rep[state()], 1 );
+ renc.encode_bit( bm_rep0[state()], 0 );
+ renc.encode_bit( bm_len[state()][pos_state], 0 );
state.set_short_rep();
continue;
}
}
// literal byte
- range_encoder.encode_bit( bm_match[state()][pos_state], 0 );
+ renc.encode_bit( bm_match[state()][pos_state], 0 );
if( state.is_char() )
encode_literal( prev_byte, cur_byte );
else