summaryrefslogtreecommitdiffstats
path: root/encoder.h
diff options
context:
space:
mode:
Diffstat (limited to 'encoder.h')
-rw-r--r--encoder.h33
1 files changed, 17 insertions, 16 deletions
diff --git a/encoder.h b/encoder.h
index fe74f7c..975fe01 100644
--- a/encoder.h
+++ b/encoder.h
@@ -112,14 +112,14 @@ static inline int price_matched( const Bit_model bm[], const int symbol,
for( int i = 7; i >= 0; --i )
{
const int match_bit = ( match_byte >> i ) & 1;
- const int bit = ( symbol >> i ) & 1;
+ int bit = ( symbol >> i ) & 1;
price += price_bit( bm[(match_bit<<8)+model+0x100], bit );
model = ( model << 1 ) | bit;
if( match_bit != bit )
{
while( --i >= 0 )
{
- const int bit = ( symbol >> i ) & 1;
+ bit = ( symbol >> i ) & 1;
price += price_bit( bm[model], bit );
model = ( model << 1 ) | bit;
}
@@ -251,7 +251,7 @@ static inline void Re_put_byte( struct Range_encoder * const range_encoder,
static inline void Re_shift_low( struct Range_encoder * const range_encoder )
{
const uint32_t carry = range_encoder->low >> 32;
- if( range_encoder->low < 0xFF000000LL || carry == 1 )
+ if( range_encoder->low < 0xFF000000U || carry == 1 )
{
Re_put_byte( range_encoder, range_encoder->cache + carry );
for( ; range_encoder->ff_count > 0; --range_encoder->ff_count )
@@ -259,7 +259,7 @@ static inline void Re_shift_low( struct Range_encoder * const range_encoder )
range_encoder->cache = range_encoder->low >> 24;
}
else ++range_encoder->ff_count;
- range_encoder->low = ( range_encoder->low & 0x00FFFFFFLL ) << 8;
+ range_encoder->low = ( range_encoder->low & 0x00FFFFFFU ) << 8;
}
static inline void Re_init( struct Range_encoder * const range_encoder,
@@ -274,7 +274,7 @@ static inline void Re_init( struct Range_encoder * const range_encoder,
cleanup_and_fail( 1 );
}
range_encoder->pos = 0;
- range_encoder->range = 0xFFFFFFFF;
+ range_encoder->range = 0xFFFFFFFFU;
range_encoder->ff_count = 0;
range_encoder->outfd_ = outfd;
range_encoder->cache = 0;
@@ -296,7 +296,7 @@ static inline void Re_encode( struct Range_encoder * const range_encoder,
{
range_encoder->range >>= 1;
if( (symbol >> i) & 1 ) range_encoder->low += range_encoder->range;
- if( range_encoder->range <= 0x00FFFFFF )
+ if( range_encoder->range <= 0x00FFFFFFU )
{ range_encoder->range <<= 8; Re_shift_low( range_encoder ); }
}
}
@@ -316,7 +316,7 @@ static inline void Re_encode_bit( struct Range_encoder * const range_encoder,
range_encoder->range -= bound;
*probability -= *probability >> bit_model_move_bits;
}
- if( range_encoder->range <= 0x00FFFFFF )
+ if( range_encoder->range <= 0x00FFFFFFU )
{ range_encoder->range <<= 8; Re_shift_low( range_encoder ); }
}
@@ -353,15 +353,15 @@ static inline void Re_encode_matched( struct Range_encoder * const range_encoder
int model = 1;
for( int i = 7; i >= 0; --i )
{
- const int bit = ( symbol >> i ) & 1;
const int match_bit = ( match_byte >> i ) & 1;
+ int bit = ( symbol >> i ) & 1;
Re_encode_bit( range_encoder, &bm[(match_bit<<8)+model+0x100], bit );
model = ( model << 1 ) | bit;
if( match_bit != bit )
{
while( --i >= 0 )
{
- const int bit = ( symbol >> i ) & 1;
+ bit = ( symbol >> i ) & 1;
Re_encode_bit( range_encoder, &bm[model], bit );
model = ( model << 1 ) | bit;
}
@@ -387,17 +387,17 @@ static inline void Lee_update_prices( struct Len_encoder * const len_encoder,
const int pos_state )
{
int * const pps = len_encoder->prices[pos_state];
- int price = price0( len_encoder->choice1 );
+ int tmp = price0( len_encoder->choice1 );
int len = 0;
for( ; len < len_low_symbols && len < len_encoder->len_symbols; ++len )
- pps[len] = price +
+ pps[len] = tmp +
price_symbol( len_encoder->bm_low[pos_state], len, len_low_bits );
- price = price1( len_encoder->choice1 );
+ tmp = price1( len_encoder->choice1 );
for( ; len < len_low_symbols + len_mid_symbols && len < len_encoder->len_symbols; ++len )
- pps[len] = price + price0( len_encoder->choice2 ) +
+ pps[len] = tmp + price0( len_encoder->choice2 ) +
price_symbol( len_encoder->bm_mid[pos_state], len - len_low_symbols, len_mid_bits );
for( ; len < len_encoder->len_symbols; ++len )
- pps[len] = price + price1( len_encoder->choice2 ) +
+ pps[len] = tmp + price1( len_encoder->choice2 ) +
price_symbol( len_encoder->bm_high, len - len_low_symbols - len_mid_symbols, len_high_bits );
len_encoder->counters[pos_state] = len_encoder->len_symbols;
}
@@ -519,8 +519,9 @@ void LZe_fill_align_prices( struct LZ_encoder * const encoder );
void LZe_fill_distance_prices( struct LZ_encoder * const encoder );
static inline uint32_t LZe_crc( struct LZ_encoder * const encoder )
- { return encoder->crc_ ^ 0xFFFFFFFF; }
+ { return encoder->crc_ ^ 0xFFFFFFFFU; }
+ // move-to-front dis in/into reps
static inline void LZe_mtf_reps( const int dis, int reps[num_rep_distances] )
{
if( dis >= num_rep_distances )
@@ -631,7 +632,7 @@ static inline void LZe_backward( struct LZ_encoder * const encoder, int cur )
}
}
-int LZe_best_pair_sequence( struct LZ_encoder * const encoder,
+int LZe_sequence_optimizer( struct LZ_encoder * const encoder,
const int reps[num_rep_distances], const State state );
void LZe_full_flush( struct LZ_encoder * const encoder, const State state );