diff options
Diffstat (limited to 'encoder.h')
-rw-r--r-- | encoder.h | 23 |
1 files changed, 9 insertions, 14 deletions
@@ -113,9 +113,9 @@ inline int price_symbol_reversed( const Bit_model bm[], int symbol, for( int i = num_bits; i > 0; --i ) { const int bit = symbol & 1; - symbol >>= 1; price += price_bit( bm[model], bit ); model = ( model << 1 ) | bit; + symbol >>= 1; } return price; } @@ -372,13 +372,8 @@ public: }; -class Len_encoder +class Len_encoder : public Len_model { - Bit_model choice1; - Bit_model choice2; - Bit_model bm_low[pos_states][len_low_symbols]; - Bit_model bm_mid[pos_states][len_mid_symbols]; - Bit_model bm_high[len_high_symbols]; int prices[pos_states][max_len_symbols]; const int len_symbols; int counters[pos_states]; @@ -438,8 +433,8 @@ protected: Bit_model bm_align[dis_align_size]; Range_encoder range_encoder; - Len_encoder len_encoder; - Len_encoder rep_match_len_encoder; + Len_encoder match_len_encoder; + Len_encoder rep_len_encoder; const int num_dis_slots; @@ -450,8 +445,8 @@ protected: : crc_( 0xFFFFFFFFU ), range_encoder( outfd ), - len_encoder( match_len_limit ), - rep_match_len_encoder( match_len_limit ), + match_len_encoder( match_len_limit ), + rep_len_encoder( match_len_limit ), num_dis_slots( 2 * real_bits( dictionary_size - 1 ) ) { for( int i = 0; i < File_header::size; ++i ) @@ -492,7 +487,7 @@ protected: void encode_pair( const uint32_t dis, const int len, const int pos_state ) { - len_encoder.encode( range_encoder, len, pos_state ); + match_len_encoder.encode( range_encoder, len, pos_state ); const int dis_slot = get_slot( dis ); range_encoder.encode_tree( bm_dis_slot[get_dis_state(len)], dis_slot, dis_slot_bits ); @@ -598,7 +593,7 @@ class LZ_encoder : public LZ_encoder_base int price_rep0_len( const int len, const State state, const int pos_state ) const { return price_rep( 0, state, pos_state ) + - rep_match_len_encoder.price( len, pos_state ); + rep_len_encoder.price( len, pos_state ); } int price_dis( const int dis, const int dis_state ) const @@ -612,7 +607,7 @@ class LZ_encoder : public LZ_encoder_base int price_pair( const int dis, const int len, const int pos_state ) const { - return len_encoder.price( len, pos_state ) + + return match_len_encoder.price( len, pos_state ) + price_dis( dis, get_dis_state( len ) ); } |