diff options
Diffstat (limited to '')
-rw-r--r-- | encoder_base.h | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/encoder_base.h b/encoder_base.h index b2985f1..c574dcc 100644 --- a/encoder_base.h +++ b/encoder_base.h @@ -1,5 +1,5 @@ /* Clzip - LZMA lossless data compressor - Copyright (C) 2010-2017 Antonio Diaz Diaz. + Copyright (C) 2010-2018 Antonio Diaz Diaz. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -170,6 +170,7 @@ struct Matchfinder_base int stream_pos; /* first byte not yet read from file */ int pos_limit; /* when reached, a new block must be read */ int key4_mask; + int num_prev_positions23; int num_prev_positions; /* size of prev_positions */ int pos_array_size; int infd; /* input file descriptor */ @@ -179,7 +180,7 @@ struct Matchfinder_base bool Mb_read_block( struct Matchfinder_base * const mb ); void Mb_normalize_pos( struct Matchfinder_base * const mb ); -bool Mb_init( struct Matchfinder_base * const mb, const int before, +bool Mb_init( struct Matchfinder_base * const mb, const int before_size, const int dict_size, const int after_size, const int dict_factor, const int num_prev_positions23, const int pos_array_factor, const int ifd ); @@ -262,7 +263,8 @@ static inline void Re_shift_low( struct Range_encoder * const renc ) renc->low = ( renc->low & 0x00FFFFFFU ) << 8; } -static inline void Re_reset( struct Range_encoder * const renc ) +static inline void Re_reset( struct Range_encoder * const renc, + const unsigned dictionary_size ) { int i; renc->low = 0; @@ -271,6 +273,7 @@ static inline void Re_reset( struct Range_encoder * const renc ) renc->range = 0xFFFFFFFFU; renc->ff_count = 0; renc->cache = 0; + Fh_set_dictionary_size( renc->header, dictionary_size ); for( i = 0; i < Fh_size; ++i ) Re_put_byte( renc, renc->header[i] ); } @@ -282,8 +285,7 @@ static inline bool Re_init( struct Range_encoder * const renc, if( !renc->buffer ) return false; renc->outfd = ofd; Fh_set_magic( renc->header ); - Fh_set_dictionary_size( renc->header, dictionary_size ); - Re_reset( renc ); + Re_reset( renc, dictionary_size ); return true; } @@ -445,13 +447,13 @@ struct LZ_encoder_base void LZeb_reset( struct LZ_encoder_base * const eb ); static inline bool LZeb_init( struct LZ_encoder_base * const eb, - const int before, const int dict_size, + const int before_size, const int dict_size, const int after_size, const int dict_factor, const int num_prev_positions23, const int pos_array_factor, const int ifd, const int outfd ) { - if( !Mb_init( &eb->mb, before, dict_size, after_size, dict_factor, + if( !Mb_init( &eb->mb, before_size, dict_size, after_size, dict_factor, num_prev_positions23, pos_array_factor, ifd ) ) return false; if( !Re_init( &eb->renc, eb->mb.dictionary_size, outfd ) ) return false; LZeb_reset( eb ); |