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

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/other-licenses/7zstub/src/7zip/Compress/RangeCoder/RangeCoderOpt.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,31 @@
     1.4 +// Compress/RangeCoder/RangeCoderOpt.h
     1.5 +
     1.6 +#ifndef __COMPRESS_RANGECODER_OPT_H
     1.7 +#define __COMPRESS_RANGECODER_OPT_H
     1.8 +
     1.9 +#define RC_INIT_VAR \
    1.10 +  UInt32 range = rangeDecoder->Range; \
    1.11 +  UInt32 code = rangeDecoder->Code;        
    1.12 +
    1.13 +#define RC_FLUSH_VAR \
    1.14 +  rangeDecoder->Range = range; \
    1.15 +  rangeDecoder->Code = code;
    1.16 +
    1.17 +#define RC_NORMALIZE \
    1.18 +  if (range < NCompress::NRangeCoder::kTopValue) \
    1.19 +    { code = (code << 8) | rangeDecoder->Stream.ReadByte(); range <<= 8; }
    1.20 +
    1.21 +#define RC_GETBIT2(numMoveBits, prob, mi, A0, A1) \
    1.22 +  { UInt32 bound = (range >> NCompress::NRangeCoder::kNumBitModelTotalBits) * prob; \
    1.23 +  if (code < bound) \
    1.24 +  { A0; range = bound; \
    1.25 +    prob += (NCompress::NRangeCoder::kBitModelTotal - prob) >> numMoveBits; \
    1.26 +    mi <<= 1; } \
    1.27 +  else \
    1.28 +  { A1; range -= bound; code -= bound; prob -= (prob) >> numMoveBits; \
    1.29 +    mi = (mi + mi) + 1; }} \
    1.30 +  RC_NORMALIZE
    1.31 +
    1.32 +#define RC_GETBIT(numMoveBits, prob, mi) RC_GETBIT2(numMoveBits, prob, mi, ; , ;)
    1.33 +
    1.34 +#endif

mercurial