Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 76627 | Differences between
and this patch

Collapse All | Expand All

(-)lzma-0.02-orig/AriBitCoder.h (-6 / +6 lines)
Lines 51-63 Link Here
51
public:
51
public:
52
  void Encode(CRangeEncoder *aRangeEncoder, UINT32 aSymbol)
52
  void Encode(CRangeEncoder *aRangeEncoder, UINT32 aSymbol)
53
  {
53
  {
54
    aRangeEncoder->EncodeBit(m_Probability, kNumBitModelTotalBits, aSymbol);
54
    aRangeEncoder->EncodeBit(CBitEncoder<aNumMoveBits>::m_Probability, kNumBitModelTotalBits, aSymbol);
55
    UpdateModel(aSymbol);
55
    CBitEncoder<aNumMoveBits>::UpdateModel(aSymbol);
56
  }
56
  }
57
  UINT32 GetPrice(UINT32 aSymbol) const
57
  UINT32 GetPrice(UINT32 aSymbol) const
58
  {
58
  {
59
    return g_PriceTables.m_StatePrices[
59
    return g_PriceTables.m_StatePrices[
60
      (((m_Probability - aSymbol) ^ ((-(int)aSymbol))) & (kBitModelTotal - 1)) >> kNumMoveReducingBits];
60
      (((CBitEncoder<aNumMoveBits>::m_Probability - aSymbol) ^ ((-(int)aSymbol))) & (kBitModelTotal - 1)) >> kNumMoveReducingBits];
61
  }
61
  }
62
};
62
};
63
63
Lines 68-78 Link Here
68
public:
68
public:
69
  UINT32 Decode(CRangeDecoder *aRangeDecoder)
69
  UINT32 Decode(CRangeDecoder *aRangeDecoder)
70
  {
70
  {
71
    UINT32 aNewBound = (aRangeDecoder->m_Range >> kNumBitModelTotalBits) * m_Probability;
71
    UINT32 aNewBound = (aRangeDecoder->m_Range >> kNumBitModelTotalBits) * CBitDecoder<aNumMoveBits>::m_Probability;
72
    if (aRangeDecoder->m_Code < aNewBound)
72
    if (aRangeDecoder->m_Code < aNewBound)
73
    {
73
    {
74
      aRangeDecoder->m_Range = aNewBound;
74
      aRangeDecoder->m_Range = aNewBound;
75
      m_Probability += (kBitModelTotal - m_Probability) >> aNumMoveBits;
75
      CBitDecoder<aNumMoveBits>::m_Probability += (kBitModelTotal - CBitDecoder<aNumMoveBits>::m_Probability) >> aNumMoveBits;
76
      if (aRangeDecoder->m_Range < kTopValue)
76
      if (aRangeDecoder->m_Range < kTopValue)
77
      {
77
      {
78
        aRangeDecoder->m_Code = (aRangeDecoder->m_Code << 8) | aRangeDecoder->m_Stream.ReadByte();
78
        aRangeDecoder->m_Code = (aRangeDecoder->m_Code << 8) | aRangeDecoder->m_Stream.ReadByte();
Lines 84-90 Link Here
84
    {
84
    {
85
      aRangeDecoder->m_Range -= aNewBound;
85
      aRangeDecoder->m_Range -= aNewBound;
86
      aRangeDecoder->m_Code -= aNewBound;
86
      aRangeDecoder->m_Code -= aNewBound;
87
      m_Probability -= (m_Probability) >> aNumMoveBits;
87
      CBitDecoder<aNumMoveBits>::m_Probability -= (CBitDecoder<aNumMoveBits>::m_Probability) >> aNumMoveBits;
88
      if (aRangeDecoder->m_Range < kTopValue)
88
      if (aRangeDecoder->m_Range < kTopValue)
89
      {
89
      {
90
        aRangeDecoder->m_Code = (aRangeDecoder->m_Code << 8) | aRangeDecoder->m_Stream.ReadByte();
90
        aRangeDecoder->m_Code = (aRangeDecoder->m_Code << 8) | aRangeDecoder->m_Stream.ReadByte();

Return to bug 76627