other-licenses/7zstub/src/7zip/Compress/RangeCoder/RangeCoderOpt.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 // Compress/RangeCoder/RangeCoderOpt.h
michael@0 2
michael@0 3 #ifndef __COMPRESS_RANGECODER_OPT_H
michael@0 4 #define __COMPRESS_RANGECODER_OPT_H
michael@0 5
michael@0 6 #define RC_INIT_VAR \
michael@0 7 UInt32 range = rangeDecoder->Range; \
michael@0 8 UInt32 code = rangeDecoder->Code;
michael@0 9
michael@0 10 #define RC_FLUSH_VAR \
michael@0 11 rangeDecoder->Range = range; \
michael@0 12 rangeDecoder->Code = code;
michael@0 13
michael@0 14 #define RC_NORMALIZE \
michael@0 15 if (range < NCompress::NRangeCoder::kTopValue) \
michael@0 16 { code = (code << 8) | rangeDecoder->Stream.ReadByte(); range <<= 8; }
michael@0 17
michael@0 18 #define RC_GETBIT2(numMoveBits, prob, mi, A0, A1) \
michael@0 19 { UInt32 bound = (range >> NCompress::NRangeCoder::kNumBitModelTotalBits) * prob; \
michael@0 20 if (code < bound) \
michael@0 21 { A0; range = bound; \
michael@0 22 prob += (NCompress::NRangeCoder::kBitModelTotal - prob) >> numMoveBits; \
michael@0 23 mi <<= 1; } \
michael@0 24 else \
michael@0 25 { A1; range -= bound; code -= bound; prob -= (prob) >> numMoveBits; \
michael@0 26 mi = (mi + mi) + 1; }} \
michael@0 27 RC_NORMALIZE
michael@0 28
michael@0 29 #define RC_GETBIT(numMoveBits, prob, mi) RC_GETBIT2(numMoveBits, prob, mi, ; , ;)
michael@0 30
michael@0 31 #endif

mercurial