diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-11-30 08:53:49 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-11-30 08:53:49 +0000 |
commit | 965a62ddfc3ba4816b5a6af896546b80a037c41b (patch) | |
tree | c90836e226b5bc10164689c463c94ec7f54608c7 /encoder.c | |
parent | Releasing debian version 1.14-2. (diff) | |
download | clzip-965a62ddfc3ba4816b5a6af896546b80a037c41b.tar.xz clzip-965a62ddfc3ba4816b5a6af896546b80a037c41b.zip |
Merging upstream version 1.15~rc1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'encoder.c')
-rw-r--r-- | encoder.c | 23 |
1 files changed, 11 insertions, 12 deletions
@@ -31,7 +31,7 @@ CRC32 crc32; -int LZe_get_match_pairs( struct LZ_encoder * const e, struct Pair * pairs ) +int LZe_get_match_pairs( LZ_encoder * const e, Pair * pairs ) { int len_limit = e->match_len_limit; if( len_limit > Mb_available_bytes( &e->eb.mb ) ) @@ -133,7 +133,7 @@ int LZe_get_match_pairs( struct LZ_encoder * const e, struct Pair * pairs ) } -static void LZe_update_distance_prices( struct LZ_encoder * const e ) +static void LZe_update_distance_prices( LZ_encoder * const e ) { int dis, len_state; for( dis = start_dis_model; dis < modeled_distances; ++dis ) @@ -172,7 +172,7 @@ static void LZe_update_distance_prices( struct LZ_encoder * const e ) ( trials[0].dis4 == -1 ) means literal. A match/rep longer or equal than match_len_limit finishes the sequence. */ -static int LZe_sequence_optimizer( struct LZ_encoder * const e, +static int LZe_sequence_optimizer( LZ_encoder * const e, const int reps[num_rep_distances], const State state ) { @@ -291,7 +291,7 @@ static int LZe_sequence_optimizer( struct LZ_encoder * const e, } /* give final values to current trial */ - struct Trial * cur_trial = &e->trials[cur]; + Trial * cur_trial = &e->trials[cur]; State cur_state; { const int dis4 = cur_trial->dis4; @@ -336,7 +336,7 @@ static int LZe_sequence_optimizer( struct LZ_encoder * const e, next_price += LZeb_price_matched( &e->eb, prev_byte, cur_byte, match_byte ); /* try last updates to next trial */ - struct Trial * next_trial = &e->trials[cur+1]; + Trial * next_trial = &e->trials[cur+1]; Tr_update( next_trial, next_price, -1, cur ); /* literal */ @@ -346,8 +346,7 @@ static int LZe_sequence_optimizer( struct LZ_encoder * const e, if( match_byte == cur_byte && next_trial->dis4 != 0 && next_trial->prev_index2 == single_step_trial ) { - const int price = rep_match_price + - LZeb_price_shortrep( &e->eb, cur_state, pos_state ); + const int price = rep_match_price + LZeb_price_shortrep( &e->eb, cur_state, pos_state ); if( price <= next_trial->price ) { next_trial->price = price; @@ -478,12 +477,12 @@ static int LZe_sequence_optimizer( struct LZ_encoder * const e, } -bool LZe_encode_member( struct LZ_encoder * const e, +bool LZe_encode_member( LZ_encoder * const e, const unsigned long long member_size ) { const unsigned long long member_size_limit = member_size - Lt_size - max_marker_size; - const bool best = ( e->match_len_limit > 12 ); + const bool best = e->match_len_limit > 12; const int dis_price_count = best ? 1 : 512; const int align_price_count = best ? 1 : dis_align_size; const int price_count = ( e->match_len_limit > 36 ) ? 1013 : 4093; @@ -537,7 +536,7 @@ bool LZe_encode_member( struct LZ_encoder * const e, const int len = e->trials[i].price; int dis = e->trials[i].dis4; - bool bit = ( dis < 0 ); + bool bit = dis < 0; Re_encode_bit( &e->eb.renc, &e->eb.bm_match[state][pos_state], !bit ); if( bit ) /* literal byte */ { @@ -556,11 +555,11 @@ bool LZe_encode_member( struct LZ_encoder * const e, { CRC32_update_buf( &e->eb.crc, Mb_ptr_to_current_pos( &e->eb.mb ) - ahead, len ); mtf_reps( dis, reps ); - bit = ( dis < num_rep_distances ); + bit = dis < num_rep_distances; Re_encode_bit( &e->eb.renc, &e->eb.bm_rep[state], bit ); if( bit ) /* repeated match */ { - bit = ( dis == 0 ); + bit = dis == 0; Re_encode_bit( &e->eb.renc, &e->eb.bm_rep0[state], !bit ); if( bit ) Re_encode_bit( &e->eb.renc, &e->eb.bm_len[state][pos_state], len > 1 ); |