blob: 0c712d2c4dac8a6d5cbb806cbaf1bed5c1717c0d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
using System.IO;
namespace Ryujinx.Graphics.VDec
{
class VpxBitStreamWriter : BitStreamWriter
{
public VpxBitStreamWriter(Stream BaseStream) : base(BaseStream) { }
public void WriteU(int Value, int ValueSize)
{
WriteBits(Value, ValueSize);
}
public void WriteS(int Value, int ValueSize)
{
bool Sign = Value < 0;
if (Sign)
{
Value = -Value;
}
WriteBits((Value << 1) | (Sign ? 1 : 0), ValueSize + 1);
}
public void WriteDeltaQ(int Value)
{
bool DeltaCoded = Value != 0;
WriteBit(DeltaCoded);
if (DeltaCoded)
{
WriteBits(Value, 4);
}
}
}
}
|