diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-01-23 14:39:08 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-01-23 14:39:17 +0000 |
commit | 18cc9814761e1b87c81168fd495f54d27176bf71 (patch) | |
tree | aa2fbba67797c895a4d00c0dd9848abf8aa78dc4 /encoder.c | |
parent | Releasing debian version 1.13-6. (diff) | |
download | lzlib-18cc9814761e1b87c81168fd495f54d27176bf71.tar.xz lzlib-18cc9814761e1b87c81168fd495f54d27176bf71.zip |
Merging upstream version 1.14.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'encoder.c')
-rw-r--r-- | encoder.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -1,5 +1,5 @@ /* Lzlib - Compression library for the lzip format - Copyright (C) 2009-2022 Antonio Diaz Diaz. + Copyright (C) 2009-2024 Antonio Diaz Diaz. This library is free software. Redistribution and use in source and binary forms, with or without modification, are permitted provided @@ -200,8 +200,6 @@ static int LZe_sequence_optimizer( struct LZ_encoder * const e, } const int pos_state = Mb_data_position( &e->eb.mb ) & pos_state_mask; - const int match_price = price1( e->eb.bm_match[state][pos_state] ); - const int rep_match_price = match_price + price1( e->eb.bm_rep[state] ); const uint8_t prev_byte = Mb_peek( &e->eb.mb, 1 ); const uint8_t cur_byte = Mb_peek( &e->eb.mb, 0 ); const uint8_t match_byte = Mb_peek( &e->eb.mb, reps[0] + 1 ); @@ -213,6 +211,9 @@ static int LZe_sequence_optimizer( struct LZ_encoder * const e, e->trials[1].price += LZeb_price_matched( &e->eb, prev_byte, cur_byte, match_byte ); e->trials[1].dis4 = -1; /* literal */ + const int match_price = price1( e->eb.bm_match[state][pos_state] ); + const int rep_match_price = match_price + price1( e->eb.bm_rep[state] ); + if( match_byte == cur_byte ) Tr_update( &e->trials[1], rep_match_price + LZeb_price_shortrep( &e->eb, state, pos_state ), 0, 0 ); |