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

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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

mercurial