Rizin
unix-like reverse engineering framework and cli tools
range_common.h
Go to the documentation of this file.
1 //
6 // Authors: Igor Pavlov
7 // Lasse Collin
8 //
9 // This file has been put into the public domain.
10 // You can do whatever you want with this file.
11 //
13 
14 #ifndef LZMA_RANGE_COMMON_H
15 #define LZMA_RANGE_COMMON_H
16 
17 #include "common.h"
18 
19 
21 // Constants //
23 
24 #define RC_SHIFT_BITS 8
25 #define RC_TOP_BITS 24
26 #define RC_TOP_VALUE (UINT32_C(1) << RC_TOP_BITS)
27 #define RC_BIT_MODEL_TOTAL_BITS 11
28 #define RC_BIT_MODEL_TOTAL (UINT32_C(1) << RC_BIT_MODEL_TOTAL_BITS)
29 #define RC_MOVE_BITS 5
30 
31 
33 // Macros //
35 
36 // Resets the probability so that both 0 and 1 have probability of 50 %
37 #define bit_reset(prob) \
38  prob = RC_BIT_MODEL_TOTAL >> 1
39 
40 // This does the same for a complete bit tree.
41 // (A tree represented as an array.)
42 #define bittree_reset(probs, bit_levels) \
43  for (uint32_t bt_i = 0; bt_i < (1 << (bit_levels)); ++bt_i) \
44  bit_reset((probs)[bt_i])
45 
46 
48 // Type definitions //
50 
70 
71 #endif
uint16_t probability
Type of probabilities used with range coder.
Definition: range_common.h:69
unsigned short uint16_t
Definition: sftypes.h:30