当前位置: 首页>>代码示例>>C#>>正文


C# BitStream.Skip方法代码示例

本文整理汇总了C#中BitStream.Skip方法的典型用法代码示例。如果您正苦于以下问题:C# BitStream.Skip方法的具体用法?C# BitStream.Skip怎么用?C# BitStream.Skip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BitStream的用法示例。


在下文中一共展示了BitStream.Skip方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetCode

        public ushort GetCode(BitStream bs)
        {
            byte peek = (byte)bs.PeekBits(Math.Min(bs.Size - bs.Position, 8));
            int p = _prefixtree[peek];
            bs.Skip(_prefixlength[peek]);

            while ((_tree[p] & SMK_NODE) != 0)
            {
                if (bs.GetBit() != 0)
                    p += (_tree[p] & ~SMK_NODE);
                p++;
            }

            return _tree[p];
        }
开发者ID:scemino,项目名称:nscumm,代码行数:15,代码来源:SmallHuffmanTree.cs

示例2: GetCode

        public uint GetCode(BitStream bs)
        {
            byte peek = (byte)bs.PeekBits(Math.Min(bs.Size - bs.Position, 8));
            var p = _prefixtree[peek];
            bs.Skip(_prefixlength[peek]);

            while ((_tree[p] & SMK_NODE) != 0)
            {
                if (bs.GetBit() != 0)
                    p += _tree[p] & ~SMK_NODE;
                p++;
            }

            uint v = _tree[p];
            if (v != _tree[_last[0]])
            {
                _tree[_last[2]] = _tree[_last[1]];
                _tree[_last[1]] = _tree[_last[0]];
                _tree[_last[0]] = v;
            }

            return v;
        }
开发者ID:scemino,项目名称:nscumm,代码行数:23,代码来源:BigHuffmanTree.cs

示例3: DecodeFrame

            public void DecodeFrame(Stream frame, int sectorCount)
            {
                // A frame is essentially an MPEG-1 intra frame

                var bits = new BitStream(frame, BitStreamType.SixteenBits, true, true);

                bits.Skip(16); // unknown
                bits.Skip(16); // 0x3800
                ushort scale = (ushort)bits.GetBits(16);
                ushort version = (ushort)bits.GetBits(16);

                if (version != 2 && version != 3)
                    throw new InvalidOperationException("Unknown PSX stream frame version");

                // Initalize default v3 DC here
                _lastDC[0] = _lastDC[1] = _lastDC[2] = 0;

                for (int mbX = 0; mbX < _macroBlocksW; mbX++)
                    for (int mbY = 0; mbY < _macroBlocksH; mbY++)
                        DecodeMacroBlock(bits, mbX, mbY, scale, version);

                // Output data onto the frame
                YUVToRGBManager.Convert420(_surface, LuminanceScale.ScaleFull, _yBuffer, _cbBuffer, _crBuffer, _surface.Width, _surface.Height, _macroBlocksW * 16, _macroBlocksW * 8);

                _curFrame++;

                // Increase the time by the amount of sectors we read
                // One may notice that this is still not the most precise
                // method since a frame takes up the time its sectors took
                // up instead of the amount of time it takes the next frame
                // to be read from the sectors. The actual frame rate should
                // be constant instead of variable, so the slight difference
                // in a frame's showing time is negligible (1/150 of a second).
                _nextFrameStartTime = _nextFrameStartTime.AddFrames(sectorCount);
            }
开发者ID:scemino,项目名称:nscumm,代码行数:35,代码来源:PsxStreamDecoder.Video.cs


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