1
0
Fork 0

Merging upstream version 1.15~rc1.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-20 21:34:58 +01:00
parent 5fdbdd44aa
commit ae3eafc693
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
27 changed files with 724 additions and 791 deletions

View file

@ -17,7 +17,7 @@
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
static int LZe_get_match_pairs( struct LZ_encoder * const e, struct Pair * pairs )
static int LZe_get_match_pairs( LZ_encoder * const e, Pair * pairs )
{
int32_t * ptr0 = e->eb.mb.pos_array + ( e->eb.mb.cyclic_pos << 1 );
int32_t * ptr1 = ptr0 + 1;
@ -31,8 +31,8 @@ static int LZe_get_match_pairs( struct LZ_encoder * const e, struct Pair * pairs
int maxlen = 3; /* only used if pairs != 0 */
int num_pairs = 0;
const int min_pos = ( e->eb.mb.pos > e->eb.mb.dictionary_size ) ?
e->eb.mb.pos - e->eb.mb.dictionary_size : 0;
const int min_pos = (e->eb.mb.pos > e->eb.mb.dictionary_size) ?
e->eb.mb.pos - e->eb.mb.dictionary_size : 0;
const uint8_t * const data = Mb_ptr_to_current_pos( &e->eb.mb );
unsigned tmp = crc32[data[0]] ^ data[1];
@ -121,7 +121,7 @@ static 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 )
@ -160,7 +160,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 )
{
@ -174,7 +174,7 @@ static int LZe_sequence_optimizer( struct LZ_encoder * const e,
}
else
num_pairs = LZe_read_match_distances( e );
const int main_len = ( num_pairs > 0 ) ? e->pairs[num_pairs-1].len : 0;
const int main_len = (num_pairs > 0) ? e->pairs[num_pairs-1].len : 0;
int replens[num_rep_distances];
int rep_index = 0;
@ -270,7 +270,7 @@ static int LZe_sequence_optimizer( struct LZ_encoder * const e,
}
const int num_pairs = LZe_read_match_distances( e );
const int newlen = ( num_pairs > 0 ) ? e->pairs[num_pairs-1].len : 0;
const int newlen = (num_pairs > 0) ? e->pairs[num_pairs-1].len : 0;
if( newlen >= e->match_len_limit )
{
e->pending_num_pairs = num_pairs;
@ -279,7 +279,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;
@ -324,7 +324,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 */
@ -466,12 +466,12 @@ static int LZe_sequence_optimizer( struct LZ_encoder * const e,
}
static bool LZe_encode_member( struct LZ_encoder * const e )
static bool LZe_encode_member( LZ_encoder * const e )
{
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;
const int price_count = (e->match_len_limit > 36) ? 1013 : 4093;
int i;
State * const state = &e->eb.state;
@ -522,7 +522,7 @@ static 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 */
{
@ -541,11 +541,11 @@ static 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, e->eb.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 );