• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# RangeCoder类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中RangeCoder的典型用法代码示例。如果您正苦于以下问题:C# RangeCoder类的具体用法?C# RangeCoder怎么用?C# RangeCoder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



RangeCoder类属于命名空间,在下文中一共展示了RangeCoder类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Decode

		public uint Decode(RangeCoder.Decoder rangeDecoder)
		{
			uint newBound = (uint)(rangeDecoder.Range >> kNumBitModelTotalBits) * (uint)Prob;
			if (rangeDecoder.Code < newBound)
			{
				rangeDecoder.Range = newBound;
				Prob += (kBitModelTotal - Prob) >> kNumMoveBits;
				if (rangeDecoder.Range < Decoder.kTopValue)
				{
					rangeDecoder.Code = (rangeDecoder.Code << 8) | (byte)rangeDecoder.Stream.ReadByte();
					rangeDecoder.Range <<= 8;
				}
				return 0;
			}
			else
			{
				rangeDecoder.Range -= newBound;
				rangeDecoder.Code -= newBound;
				Prob -= (Prob) >> kNumMoveBits;
				if (rangeDecoder.Range < Decoder.kTopValue)
				{
					rangeDecoder.Code = (rangeDecoder.Code << 8) | (byte)rangeDecoder.Stream.ReadByte();
					rangeDecoder.Range <<= 8;
				}
				return 1;
			}
		}
开发者ID:RafaelRMachado,项目名称:de4dot,代码行数:27,代码来源:RangeCoderBit.cs


示例2: Decode

 public uint Decode(RangeCoder.Decoder rangeDecoder)
 {
     uint m = 1;
     for (int bitIndex = NumBitLevels; bitIndex > 0; bitIndex--)
         m = (m << 1) + Models[m].Decode(rangeDecoder);
     return m - ((uint)1 << NumBitLevels);
 }
开发者ID:jbtule,项目名称:DaringDocs,代码行数:7,代码来源:RangeCoderBitTree.cs


示例3: DecodeNormal

 public byte DecodeNormal(RangeCoder.Decoder rangeDecoder)
 {
     uint symbol = 1;
     do
         symbol = (symbol << 1) | m_Decoders[symbol].Decode(rangeDecoder); while (symbol < 0x100);
     return (byte) symbol;
 }
开发者ID:yaozd,项目名称:sharpcompress,代码行数:7,代码来源:LzmaDecoder.cs


示例4: Encode

 public void Encode(RangeCoder.Encoder rangeEncoder, byte symbol) {
     uint context = 1;
     for(int i = 7; i >= 0; i--) {
         uint bit = (uint)((symbol >> i) & 1);
         m_Encoders[context].Encode(rangeEncoder, bit);
         context = (context << 1) | bit;
     }
 }
开发者ID:debop,项目名称:NFramework,代码行数:8,代码来源:LzmaEncoder.cs


示例5: ReverseDecode

 public uint ReverseDecode(RangeCoder.Decoder rangeDecoder)
 {
     uint m = 1;
     uint symbol = 0;
     for (int bitIndex = 0; bitIndex < NumBitLevels; bitIndex++) {
         uint bit = Models[m].Decode(rangeDecoder);
         m <<= 1;
         m += bit;
         symbol |= (bit << bitIndex);
     }
     return symbol;
 }
开发者ID:KOLANICH,项目名称:SevenZipSharp,代码行数:12,代码来源:RangeCoderBitTree.cs


示例6: ReverseDecode

 public static uint ReverseDecode(BitDecoder[] models, uint startIndex, RangeCoder.Decoder rangeDecoder, int numBitLevels)
 {
     uint m = 1;
     uint symbol = 0;
     for (int bitIndex = 0; bitIndex < numBitLevels; bitIndex++)
     {
         uint bit = models[startIndex + m].Decode(rangeDecoder);
         m <<= 1;
         m += bit;
         symbol |= (bit << bitIndex);
     }
     return symbol;
 }
开发者ID:BclEx,项目名称:AdamsyncEx,代码行数:13,代码来源:BitTreeDecoder.cs


示例7: ReverseDecode

        public static uint ReverseDecode(BitDecoder[] Models, UInt32 startIndex,
			RangeCoder.Decoder rangeDecoder, int NumBitLevels)
        {
            uint m = 1;
            uint symbol = 0;
            for (int bitIndex = 0; bitIndex < NumBitLevels; bitIndex++)
            {
                uint bit = Models[startIndex + m].Decode(rangeDecoder);
                m <<= 1;
                m += bit;
                symbol |= bit << bitIndex;
            }
            return symbol;
        }
开发者ID:kakkerlakgly,项目名称:de4dot,代码行数:14,代码来源:RangeCoderBitTree.cs


示例8: Decode

			public uint Decode(RangeCoder.Decoder rangeDecoder, uint posState)
			{
				if (m_Choice.Decode(rangeDecoder) == 0)
					return m_LowCoder[posState].Decode(rangeDecoder);
			    uint symbol = Base.kNumLowLenSymbols;
			    if (m_Choice2.Decode(rangeDecoder) == 0)
			        symbol += m_MidCoder[posState].Decode(rangeDecoder);
			    else
			    {
			        symbol += Base.kNumMidLenSymbols;
			        symbol += m_HighCoder.Decode(rangeDecoder);
			    }
			    return symbol;
			}
开发者ID:Ygocore,项目名称:ygosharp_v0.1.1,代码行数:14,代码来源:LzmaDecoder.cs


示例9: DecodeWithMatchByte

 public byte DecodeWithMatchByte(RangeCoder.Decoder rangeDecoder, byte matchByte) {
     uint symbol = 1;
     do {
         uint matchBit = (uint)(matchByte >> 7) & 1;
         matchByte <<= 1;
         uint bit = m_Decoders[((1 + matchBit) << 8) + symbol].Decode(rangeDecoder);
         symbol = (symbol << 1) | bit;
         if(matchBit != bit) {
             while(symbol < 0x100)
                 symbol = (symbol << 1) | m_Decoders[symbol].Decode(rangeDecoder);
             break;
         }
     } while(symbol < 0x100);
     return (byte)symbol;
 }
开发者ID:debop,项目名称:NFramework,代码行数:15,代码来源:LzmaDecoder.cs


示例10: EncodeMatched

 public void EncodeMatched(RangeCoder.Encoder rangeEncoder, byte matchByte, byte symbol) {
     uint context = 1;
     bool same = true;
     for(int i = 7; i >= 0; i--) {
         uint bit = (uint)((symbol >> i) & 1);
         uint state = context;
         if(same) {
             uint matchBit = (uint)((matchByte >> i) & 1);
             state += ((1 + matchBit) << 8);
             same = (matchBit == bit);
         }
         m_Encoders[state].Encode(rangeEncoder, bit);
         context = (context << 1) | bit;
     }
 }
开发者ID:debop,项目名称:NFramework,代码行数:15,代码来源:LzmaEncoder.cs


示例11: Decode

 /// <summary>
 /// Decodes the specified range decoder.
 /// </summary>
 /// <param name="rangeDecoder">The range decoder.</param>
 /// <param name="posState">State of the pos.</param>
 /// <returns></returns>
 public uint Decode(RangeCoder.Decoder rangeDecoder, uint posState)
 {
     if (_choice.Decode(rangeDecoder) == 0)
         return _lowCoder[posState].Decode(rangeDecoder);
     else
     {
         uint symbol = Base.kNumLowLenSymbols;
         if (_choice2.Decode(rangeDecoder) == 0)
             symbol += _midCoder[posState].Decode(rangeDecoder);
         else
         {
             symbol += Base.kNumMidLenSymbols;
             symbol += _highCoder.Decode(rangeDecoder);
         }
         return symbol;
     }
 }
开发者ID:BclEx,项目名称:AdamsyncEx,代码行数:23,代码来源:Decoder+LenDecoder.cs


示例12: Encode

			public new void Encode(RangeCoder.Encoder rangeEncoder, UInt32 symbol, UInt32 posState)
			{
				base.Encode(rangeEncoder, symbol, posState);
				if (--_counters[posState] == 0)
					UpdateTable(posState);
			}
开发者ID:naterh,项目名称:firmware-mod-kit-osx,代码行数:6,代码来源:LzmaEncoder.cs


示例13: DecodeWithMatchByte

 public byte DecodeWithMatchByte(RangeCoder.Decoder rangeDecoder, uint pos, byte prevByte, byte matchByte)
 {
     return m_Coders[GetState(pos, prevByte)].DecodeWithMatchByte(rangeDecoder, matchByte);
 }
开发者ID:dnywu,项目名称:sales,代码行数:4,代码来源:LzmaDecoder.cs


示例14: DecodeNormal

 public byte DecodeNormal(RangeCoder.Decoder rangeDecoder, uint pos, byte prevByte)
 {
     return m_Coders[GetState(pos, prevByte)].DecodeNormal(rangeDecoder);
 }
开发者ID:dnywu,项目名称:sales,代码行数:4,代码来源:LzmaDecoder.cs


示例15: Code

        internal bool Code(int dictionarySize, LZ.OutWindow outWindow, RangeCoder.Decoder rangeDecoder)
        {
            int dictionarySizeCheck = Math.Max(dictionarySize, 1);

            outWindow.CopyPending();

            while (outWindow.HasSpace)
            {
                uint posState = (uint)outWindow.Total & m_PosStateMask;
                if (m_IsMatchDecoders[(state.Index << Base.kNumPosStatesBitsMax) + posState].Decode(rangeDecoder) == 0)
                {
                    byte b;
                    byte prevByte = outWindow.GetByte(0);
                    if (!state.IsCharState())
                        b = m_LiteralDecoder.DecodeWithMatchByte(rangeDecoder,
                            (uint)outWindow.Total, prevByte, outWindow.GetByte((int)rep0));
                    else
                        b = m_LiteralDecoder.DecodeNormal(rangeDecoder, (uint)outWindow.Total, prevByte);
                    outWindow.PutByte(b);
                    state.UpdateChar();
                }
                else
                {
                    uint len;
                    if (m_IsRepDecoders[state.Index].Decode(rangeDecoder) == 1)
                    {
                        if (m_IsRepG0Decoders[state.Index].Decode(rangeDecoder) == 0)
                        {
                            if (m_IsRep0LongDecoders[(state.Index << Base.kNumPosStatesBitsMax) + posState].Decode(rangeDecoder) == 0)
                            {
                                state.UpdateShortRep();
                                outWindow.PutByte(outWindow.GetByte((int)rep0));
                                continue;
                            }
                        }
                        else
                        {
                            UInt32 distance;
                            if (m_IsRepG1Decoders[state.Index].Decode(rangeDecoder) == 0)
                            {
                                distance = rep1;
                            }
                            else
                            {
                                if (m_IsRepG2Decoders[state.Index].Decode(rangeDecoder) == 0)
                                    distance = rep2;
                                else
                                {
                                    distance = rep3;
                                    rep3 = rep2;
                                }
                                rep2 = rep1;
                            }
                            rep1 = rep0;
                            rep0 = distance;
                        }
                        len = m_RepLenDecoder.Decode(rangeDecoder, posState) + Base.kMatchMinLen;
                        state.UpdateRep();
                    }
                    else
                    {
                        rep3 = rep2;
                        rep2 = rep1;
                        rep1 = rep0;
                        len = Base.kMatchMinLen + m_LenDecoder.Decode(rangeDecoder, posState);
                        state.UpdateMatch();
                        uint posSlot = m_PosSlotDecoder[Base.GetLenToPosState(len)].Decode(rangeDecoder);
                        if (posSlot >= Base.kStartPosModelIndex)
                        {
                            int numDirectBits = (int)((posSlot >> 1) - 1);
                            rep0 = ((2 | (posSlot & 1)) << numDirectBits);
                            if (posSlot < Base.kEndPosModelIndex)
                                rep0 += BitTreeDecoder.ReverseDecode(m_PosDecoders,
                                        rep0 - posSlot - 1, rangeDecoder, numDirectBits);
                            else
                            {
                                rep0 += (rangeDecoder.DecodeDirectBits(
                                    numDirectBits - Base.kNumAlignBits) << Base.kNumAlignBits);
                                rep0 += m_PosAlignDecoder.ReverseDecode(rangeDecoder);
                            }
                        }
                        else
                            rep0 = posSlot;
                    }
                    if (rep0 >= outWindow.Total || rep0 >= dictionarySizeCheck)
                    {
                        if (rep0 == 0xFFFFFFFF)
                            return true;
                        throw new DataErrorException();
                    }
                    outWindow.CopyBlock((int)rep0, (int)len);
                }
            }
            return false;
        }
开发者ID:theahuramazda,项目名称:Saluse-ComicReader,代码行数:95,代码来源:LzmaDecoder.cs


示例16: Decode

 public uint Decode(RangeCoder.Decoder rangeDecoder, uint posState)
 {
     if (_mChoice.Decode(rangeDecoder) == 0)
         return _mLowCoder[posState].Decode(rangeDecoder);
     var symbol = Base.KNumLowLenSymbols;
     if (_mChoice2.Decode(rangeDecoder) == 0)
         symbol += _mMidCoder[posState].Decode(rangeDecoder);
     else
     {
         symbol += Base.KNumMidLenSymbols;
         symbol += _mHighCoder.Decode(rangeDecoder);
     }
     return symbol;
 }
开发者ID:Ciphra333,项目名称:Osu-Bot,代码行数:14,代码来源:LzmaDecoder.cs



注:本文中的RangeCoder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# RangeCollection类代码示例发布时间:2022-05-24
下一篇:
C# RangeBoundaryType类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap