rangecoderopt.h

来自「7-Zip 3.11的源码」· C头文件 代码 · 共 44 行

H
44
字号
// Compress/RangeCoder/RangeCoderOpt.h

// #pragma once

#ifndef __COMPRESS_RANGECODER_OPT_H
#define __COMPRESS_RANGECODER_OPT_H

#define RC_INIT_VAR                            \
  UINT32 range = rangeDecoder->Range;      \
  UINT32 code = rangeDecoder->Code;        

#define RC_FLUSH_VAR                          \
  rangeDecoder->Range = range;            \
  rangeDecoder->Code = code;

#define RC_NORMALIZE                                    \
    if (range < NCompress::NRangeCoder::kTopValue)               \
    {                                                              \
      code = (code << 8) | rangeDecoder->Stream.ReadByte();   \
      range <<= 8; }

#define RC_GETBIT2(numMoveBits, prob, modelIndex, Action0, Action1)                        \
    {UINT32 newBound = (range >> NCompress::NRangeCoder::kNumBitModelTotalBits) * prob; \
    if (code < newBound)                               \
    {                                                             \
      Action0;                                                    \
      range = newBound;                                         \
      prob += (NCompress::NRangeCoder::kBitModelTotal - prob) >> numMoveBits;          \
      modelIndex <<= 1;                                          \
    }                                                             \
    else                                                          \
    {                                                             \
      Action1;                                                    \
      range -= newBound;                                        \
      code -= newBound;                                          \
      prob -= (prob) >> numMoveBits;                           \
      modelIndex = (modelIndex << 1) + 1;                       \
    }}                                                             \
    RC_NORMALIZE

#define RC_GETBIT(numMoveBits, prob, modelIndex) RC_GETBIT2(numMoveBits, prob, modelIndex, ; , ;)               

#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?