1 ///////////////////////////////////////////////////////////////////////////////
3 /// \file price_table_init.c
4 /// \brief Static initializations for the range encoder's prices array
6 // Copyright (C) 1999-2006 Igor Pavlov
7 // Copyright (C) 2007 Lasse Collin
9 // This library is free software; you can redistribute it and/or
10 // modify it under the terms of the GNU Lesser General Public
11 // License as published by the Free Software Foundation; either
12 // version 2.1 of the License, or (at your option) any later version.
14 // This library is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 // Lesser General Public License for more details.
19 ///////////////////////////////////////////////////////////////////////////////
22 # include "range_encoder.h"
26 uint32_t lzma_rc_prices[RC_PRICE_TABLE_SIZE];
32 for (uint32_t i = (UINT32_C(1) << RC_MOVE_REDUCING_BITS) / 2;
33 i < RC_BIT_MODEL_TOTAL;
34 i += (UINT32_C(1) << RC_MOVE_REDUCING_BITS)) {
35 const uint32_t cycles_bits = RC_BIT_PRICE_SHIFT_BITS;
37 uint32_t bit_count = 0;
39 for (uint32_t j = 0; j < cycles_bits; ++j) {
43 while (w >= (UINT32_C(1) << 16)) {
49 lzma_rc_prices[i >> RC_MOVE_REDUCING_BITS]
50 = (RC_BIT_MODEL_TOTAL_BITS << cycles_bits)