Line | Count | Source |
1 | | |
2 | | |
3 | | inline unsigned int RangeCoder::GetChar() |
4 | 2.06k | { |
5 | 2.06k | return(UnpackRead->GetChar()); |
6 | 2.06k | } |
7 | | |
8 | | |
9 | | void RangeCoder::InitDecoder(Unpack *UnpackRead) |
10 | 517 | { |
11 | 517 | RangeCoder::UnpackRead=UnpackRead; |
12 | | |
13 | 517 | low=code=0; |
14 | 517 | range=uint(-1); |
15 | 2.58k | for (int i=0;i < 4;i++) |
16 | 2.06k | code=(code << 8) | GetChar(); |
17 | 517 | } |
18 | | |
19 | | |
20 | | // (int) cast before "low" added only to suppress compiler warnings. |
21 | 5.58M | #define ARI_DEC_NORMALIZE(code,low,range,read) \ |
22 | 5.58M | { \ |
23 | 7.37M | while ((low^(low+range))<TOP || range<BOT && ((range=-(int)low&(BOT-1)),1)) \ |
24 | 5.58M | { \ |
25 | 1.78M | code=(code << 8) | read->GetChar(); \ |
26 | 1.78M | range <<= 8; \ |
27 | 1.78M | low <<= 8; \ |
28 | 1.78M | } \ |
29 | 5.58M | } |
30 | | |
31 | | |
32 | | inline int RangeCoder::GetCurrentCount() |
33 | 4.91M | { |
34 | 4.91M | return (code-low)/(range /= SubRange.scale); |
35 | 4.91M | } |
36 | | |
37 | | |
38 | | inline uint RangeCoder::GetCurrentShiftCount(uint SHIFT) |
39 | 678k | { |
40 | 678k | return (code-low)/(range >>= SHIFT); |
41 | 678k | } |
42 | | |
43 | | |
44 | | inline void RangeCoder::Decode() |
45 | 5.58M | { |
46 | 5.58M | low += range*SubRange.LowCount; |
47 | 5.58M | range *= SubRange.HighCount-SubRange.LowCount; |
48 | 5.58M | } |