diff options
Diffstat (limited to 'encoder.h')
-rw-r--r-- | encoder.h | 21 |
1 files changed, 10 insertions, 11 deletions
@@ -1,4 +1,4 @@ -/* Clzip - Data compressor based on the LZMA algorithm +/* Clzip - LZMA lossless data compressor Copyright (C) 2010, 2011, 2012, 2013 Antonio Diaz Diaz. This program is free software: you can redistribute it and/or modify @@ -493,7 +493,7 @@ struct LZ_encoder Bit_model bm_align[dis_align_size]; struct Matchfinder * matchfinder; - struct Range_encoder range_encoder; + struct Range_encoder renc; struct Len_encoder match_len_encoder; struct Len_encoder rep_len_encoder; @@ -512,7 +512,7 @@ bool LZe_init( struct LZ_encoder * const encoder, const File_header header, const int outfd ); static inline void LZe_free( struct LZ_encoder * const encoder ) - { Re_free( &encoder->range_encoder ); } + { Re_free( &encoder->renc ); } static inline unsigned LZe_crc( const struct LZ_encoder * const encoder ) { return encoder->crc ^ 0xFFFFFFFFU; } @@ -597,13 +597,13 @@ static inline int LZe_price_matched( const struct LZ_encoder * const encoder, static inline void LZe_encode_literal( struct LZ_encoder * const encoder, uint8_t prev_byte, uint8_t symbol ) - { Re_encode_tree( &encoder->range_encoder, + { Re_encode_tree( &encoder->renc, encoder->bm_literal[get_lit_state(prev_byte)], symbol, 8 ); } static inline void LZe_encode_matched( struct LZ_encoder * const encoder, uint8_t prev_byte, uint8_t symbol, uint8_t match_byte ) - { Re_encode_matched( &encoder->range_encoder, + { Re_encode_matched( &encoder->renc, encoder->bm_literal[get_lit_state(prev_byte)], symbol, match_byte ); } @@ -612,9 +612,8 @@ static inline void LZe_encode_pair( struct LZ_encoder * const encoder, const int pos_state ) { const int dis_slot = get_slot( dis ); - Lee_encode( &encoder->match_len_encoder, &encoder->range_encoder, len, pos_state ); - Re_encode_tree( &encoder->range_encoder, - encoder->bm_dis_slot[get_dis_state(len)], + Lee_encode( &encoder->match_len_encoder, &encoder->renc, len, pos_state ); + Re_encode_tree( &encoder->renc, encoder->bm_dis_slot[get_dis_state(len)], dis_slot, dis_slot_bits ); if( dis_slot >= start_dis_model ) @@ -624,14 +623,14 @@ static inline void LZe_encode_pair( struct LZ_encoder * const encoder, const uint32_t direct_dis = dis - base; if( dis_slot < end_dis_model ) - Re_encode_tree_reversed( &encoder->range_encoder, + Re_encode_tree_reversed( &encoder->renc, encoder->bm_dis + base - dis_slot - 1, direct_dis, direct_bits ); else { - Re_encode( &encoder->range_encoder, direct_dis >> dis_align_bits, + Re_encode( &encoder->renc, direct_dis >> dis_align_bits, direct_bits - dis_align_bits ); - Re_encode_tree_reversed( &encoder->range_encoder, encoder->bm_align, + Re_encode_tree_reversed( &encoder->renc, encoder->bm_align, direct_dis, dis_align_bits ); --encoder->align_price_count; } |