本文整理汇总了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];
}
示例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;
}
示例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);
}