2019-12-27 01:09:49 -05:00
|
|
|
|
using System;
|
|
|
|
|
using System.Numerics;
|
2018-09-08 13:51:50 -04:00
|
|
|
|
|
2019-10-13 02:02:07 -04:00
|
|
|
|
namespace Ryujinx.Graphics.Texture.Astc
|
2018-09-08 13:51:50 -04:00
|
|
|
|
{
|
2019-12-27 01:09:49 -05:00
|
|
|
|
internal struct IntegerEncoded
|
2018-09-08 13:51:50 -04:00
|
|
|
|
{
|
2019-12-27 01:09:49 -05:00
|
|
|
|
internal const int StructSize = 8;
|
|
|
|
|
private static readonly IntegerEncoded[] Encodings;
|
|
|
|
|
|
|
|
|
|
public enum EIntegerEncoding : byte
|
2018-09-08 13:51:50 -04:00
|
|
|
|
{
|
|
|
|
|
JustBits,
|
|
|
|
|
Quint,
|
|
|
|
|
Trit
|
|
|
|
|
}
|
|
|
|
|
|
2019-03-03 20:45:25 -05:00
|
|
|
|
EIntegerEncoding _encoding;
|
2019-12-27 01:09:49 -05:00
|
|
|
|
public byte NumberBits { get; private set; }
|
|
|
|
|
public byte TritValue { get; private set; }
|
|
|
|
|
public byte QuintValue { get; private set; }
|
|
|
|
|
public int BitValue { get; private set; }
|
|
|
|
|
|
|
|
|
|
static IntegerEncoded()
|
|
|
|
|
{
|
|
|
|
|
Encodings = new IntegerEncoded[0x100];
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < Encodings.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
Encodings[i] = CreateEncodingCalc(i);
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-09-08 13:51:50 -04:00
|
|
|
|
|
2019-03-03 20:45:25 -05:00
|
|
|
|
public IntegerEncoded(EIntegerEncoding encoding, int numBits)
|
2018-09-08 13:51:50 -04:00
|
|
|
|
{
|
2019-12-27 01:09:49 -05:00
|
|
|
|
_encoding = encoding;
|
|
|
|
|
NumberBits = (byte)numBits;
|
|
|
|
|
BitValue = 0;
|
|
|
|
|
TritValue = 0;
|
2018-09-08 13:51:50 -04:00
|
|
|
|
QuintValue = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2019-03-03 20:45:25 -05:00
|
|
|
|
public bool MatchesEncoding(IntegerEncoded other)
|
2018-09-08 13:51:50 -04:00
|
|
|
|
{
|
2019-03-03 20:45:25 -05:00
|
|
|
|
return _encoding == other._encoding && NumberBits == other.NumberBits;
|
2018-09-08 13:51:50 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public EIntegerEncoding GetEncoding()
|
|
|
|
|
{
|
2019-03-03 20:45:25 -05:00
|
|
|
|
return _encoding;
|
2018-09-08 13:51:50 -04:00
|
|
|
|
}
|
|
|
|
|
|
2019-03-03 20:45:25 -05:00
|
|
|
|
public int GetBitLength(int numberVals)
|
2018-09-08 13:51:50 -04:00
|
|
|
|
{
|
2019-03-03 20:45:25 -05:00
|
|
|
|
int totalBits = NumberBits * numberVals;
|
|
|
|
|
if (_encoding == EIntegerEncoding.Trit)
|
2018-09-08 13:51:50 -04:00
|
|
|
|
{
|
2019-03-03 20:45:25 -05:00
|
|
|
|
totalBits += (numberVals * 8 + 4) / 5;
|
2018-09-08 13:51:50 -04:00
|
|
|
|
}
|
2019-03-03 20:45:25 -05:00
|
|
|
|
else if (_encoding == EIntegerEncoding.Quint)
|
2018-09-08 13:51:50 -04:00
|
|
|
|
{
|
2019-03-03 20:45:25 -05:00
|
|
|
|
totalBits += (numberVals * 7 + 2) / 3;
|
2018-09-08 13:51:50 -04:00
|
|
|
|
}
|
2019-03-03 20:45:25 -05:00
|
|
|
|
return totalBits;
|
2018-09-08 13:51:50 -04:00
|
|
|
|
}
|
|
|
|
|
|
2019-03-03 20:45:25 -05:00
|
|
|
|
public static IntegerEncoded CreateEncoding(int maxVal)
|
2019-12-27 01:09:49 -05:00
|
|
|
|
{
|
|
|
|
|
return Encodings[maxVal];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static IntegerEncoded CreateEncodingCalc(int maxVal)
|
2018-09-08 13:51:50 -04:00
|
|
|
|
{
|
2019-03-03 20:45:25 -05:00
|
|
|
|
while (maxVal > 0)
|
2018-09-08 13:51:50 -04:00
|
|
|
|
{
|
2019-03-03 20:45:25 -05:00
|
|
|
|
int check = maxVal + 1;
|
2018-09-08 13:51:50 -04:00
|
|
|
|
|
|
|
|
|
// Is maxVal a power of two?
|
2019-03-03 20:45:25 -05:00
|
|
|
|
if ((check & (check - 1)) == 0)
|
2018-09-08 13:51:50 -04:00
|
|
|
|
{
|
2019-12-27 01:09:49 -05:00
|
|
|
|
return new IntegerEncoded(EIntegerEncoding.JustBits, BitOperations.PopCount((uint)maxVal));
|
2018-09-08 13:51:50 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Is maxVal of the type 3*2^n - 1?
|
2019-03-03 20:45:25 -05:00
|
|
|
|
if ((check % 3 == 0) && ((check / 3) & ((check / 3) - 1)) == 0)
|
2018-09-08 13:51:50 -04:00
|
|
|
|
{
|
2019-12-27 01:09:49 -05:00
|
|
|
|
return new IntegerEncoded(EIntegerEncoding.Trit, BitOperations.PopCount((uint)(check / 3 - 1)));
|
2018-09-08 13:51:50 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Is maxVal of the type 5*2^n - 1?
|
2019-03-03 20:45:25 -05:00
|
|
|
|
if ((check % 5 == 0) && ((check / 5) & ((check / 5) - 1)) == 0)
|
2018-09-08 13:51:50 -04:00
|
|
|
|
{
|
2019-12-27 01:09:49 -05:00
|
|
|
|
return new IntegerEncoded(EIntegerEncoding.Quint, BitOperations.PopCount((uint)(check / 5 - 1)));
|
2018-09-08 13:51:50 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Apparently it can't be represented with a bounded integer sequence...
|
|
|
|
|
// just iterate.
|
2019-03-03 20:45:25 -05:00
|
|
|
|
maxVal--;
|
2018-09-08 13:51:50 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return new IntegerEncoded(EIntegerEncoding.JustBits, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void DecodeTritBlock(
|
2019-12-27 01:09:49 -05:00
|
|
|
|
ref BitStream128 bitStream,
|
|
|
|
|
ref IntegerSequence listIntegerEncoded,
|
|
|
|
|
int numberBitsPerValue)
|
2018-09-08 13:51:50 -04:00
|
|
|
|
{
|
|
|
|
|
// Implement the algorithm in section C.2.12
|
2019-12-27 01:09:49 -05:00
|
|
|
|
Span<int> m = stackalloc int[5];
|
2018-09-08 13:51:50 -04:00
|
|
|
|
|
2019-03-03 20:45:25 -05:00
|
|
|
|
m[0] = bitStream.ReadBits(numberBitsPerValue);
|
2019-12-27 01:09:49 -05:00
|
|
|
|
int encoded = bitStream.ReadBits(2);
|
2019-03-03 20:45:25 -05:00
|
|
|
|
m[1] = bitStream.ReadBits(numberBitsPerValue);
|
2019-12-27 01:09:49 -05:00
|
|
|
|
encoded |= bitStream.ReadBits(2) << 2;
|
2019-03-03 20:45:25 -05:00
|
|
|
|
m[2] = bitStream.ReadBits(numberBitsPerValue);
|
2019-12-27 01:09:49 -05:00
|
|
|
|
encoded |= bitStream.ReadBits(1) << 4;
|
2019-03-03 20:45:25 -05:00
|
|
|
|
m[3] = bitStream.ReadBits(numberBitsPerValue);
|
2019-12-27 01:09:49 -05:00
|
|
|
|
encoded |= bitStream.ReadBits(2) << 5;
|
2019-03-03 20:45:25 -05:00
|
|
|
|
m[4] = bitStream.ReadBits(numberBitsPerValue);
|
2019-12-27 01:09:49 -05:00
|
|
|
|
encoded |= bitStream.ReadBits(1) << 7;
|
2018-09-08 13:51:50 -04:00
|
|
|
|
|
2019-12-27 01:09:49 -05:00
|
|
|
|
ReadOnlySpan<byte> encodings = GetTritEncoding(encoded);
|
2018-09-08 13:51:50 -04:00
|
|
|
|
|
2019-12-27 01:09:49 -05:00
|
|
|
|
IntegerEncoded intEncoded = new IntegerEncoded(EIntegerEncoding.Trit, numberBitsPerValue);
|
2018-09-08 13:51:50 -04:00
|
|
|
|
|
|
|
|
|
for (int i = 0; i < 5; i++)
|
|
|
|
|
{
|
2019-12-27 01:09:49 -05:00
|
|
|
|
intEncoded.BitValue = m[i];
|
|
|
|
|
intEncoded.TritValue = encodings[i];
|
|
|
|
|
|
|
|
|
|
listIntegerEncoded.Add(ref intEncoded);
|
2018-09-08 13:51:50 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void DecodeQuintBlock(
|
2019-12-27 01:09:49 -05:00
|
|
|
|
ref BitStream128 bitStream,
|
|
|
|
|
ref IntegerSequence listIntegerEncoded,
|
|
|
|
|
int numberBitsPerValue)
|
2018-09-08 13:51:50 -04:00
|
|
|
|
{
|
2019-12-27 01:09:49 -05:00
|
|
|
|
ReadOnlySpan<byte> interleavedBits = new byte[] { 3, 2, 2 };
|
2018-09-08 13:51:50 -04:00
|
|
|
|
|
2019-12-27 01:09:49 -05:00
|
|
|
|
// Implement the algorithm in section C.2.12
|
|
|
|
|
Span<int> m = stackalloc int[3];
|
|
|
|
|
ulong encoded = 0;
|
|
|
|
|
int encodedBitsRead = 0;
|
2018-09-08 13:51:50 -04:00
|
|
|
|
|
2019-12-27 01:09:49 -05:00
|
|
|
|
for (int i = 0; i < m.Length; i++)
|
2018-09-08 13:51:50 -04:00
|
|
|
|
{
|
2019-12-27 01:09:49 -05:00
|
|
|
|
m[i] = bitStream.ReadBits(numberBitsPerValue);
|
2018-09-08 13:51:50 -04:00
|
|
|
|
|
2019-12-27 01:09:49 -05:00
|
|
|
|
uint encodedBits = (uint)bitStream.ReadBits(interleavedBits[i]);
|
|
|
|
|
|
|
|
|
|
encoded |= encodedBits << encodedBitsRead;
|
|
|
|
|
encodedBitsRead += interleavedBits[i];
|
2018-09-08 13:51:50 -04:00
|
|
|
|
}
|
|
|
|
|
|
2019-12-27 01:09:49 -05:00
|
|
|
|
ReadOnlySpan<byte> encodings = GetQuintEncoding((int)encoded);
|
|
|
|
|
|
2018-09-08 13:51:50 -04:00
|
|
|
|
for (int i = 0; i < 3; i++)
|
|
|
|
|
{
|
2019-03-03 20:45:25 -05:00
|
|
|
|
IntegerEncoded intEncoded = new IntegerEncoded(EIntegerEncoding.Quint, numberBitsPerValue)
|
2018-09-08 13:51:50 -04:00
|
|
|
|
{
|
2019-12-27 01:09:49 -05:00
|
|
|
|
BitValue = m[i],
|
|
|
|
|
QuintValue = encodings[i]
|
2018-09-08 13:51:50 -04:00
|
|
|
|
};
|
2019-12-27 01:09:49 -05:00
|
|
|
|
|
|
|
|
|
listIntegerEncoded.Add(ref intEncoded);
|
2018-09-08 13:51:50 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void DecodeIntegerSequence(
|
2019-12-27 01:09:49 -05:00
|
|
|
|
ref IntegerSequence decodeIntegerSequence,
|
|
|
|
|
ref BitStream128 bitStream,
|
|
|
|
|
int maxRange,
|
|
|
|
|
int numberValues)
|
2018-09-08 13:51:50 -04:00
|
|
|
|
{
|
|
|
|
|
// Determine encoding parameters
|
2019-03-03 20:45:25 -05:00
|
|
|
|
IntegerEncoded intEncoded = CreateEncoding(maxRange);
|
2018-09-08 13:51:50 -04:00
|
|
|
|
|
|
|
|
|
// Start decoding
|
2019-03-03 20:45:25 -05:00
|
|
|
|
int numberValuesDecoded = 0;
|
|
|
|
|
while (numberValuesDecoded < numberValues)
|
2018-09-08 13:51:50 -04:00
|
|
|
|
{
|
2019-03-03 20:45:25 -05:00
|
|
|
|
switch (intEncoded.GetEncoding())
|
2018-09-08 13:51:50 -04:00
|
|
|
|
{
|
|
|
|
|
case EIntegerEncoding.Quint:
|
|
|
|
|
{
|
2019-12-27 01:09:49 -05:00
|
|
|
|
DecodeQuintBlock(ref bitStream, ref decodeIntegerSequence, intEncoded.NumberBits);
|
2019-03-03 20:45:25 -05:00
|
|
|
|
numberValuesDecoded += 3;
|
2018-09-08 13:51:50 -04:00
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case EIntegerEncoding.Trit:
|
|
|
|
|
{
|
2019-12-27 01:09:49 -05:00
|
|
|
|
DecodeTritBlock(ref bitStream, ref decodeIntegerSequence, intEncoded.NumberBits);
|
2019-03-03 20:45:25 -05:00
|
|
|
|
numberValuesDecoded += 5;
|
2018-09-08 13:51:50 -04:00
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case EIntegerEncoding.JustBits:
|
|
|
|
|
{
|
2019-03-03 20:45:25 -05:00
|
|
|
|
intEncoded.BitValue = bitStream.ReadBits(intEncoded.NumberBits);
|
2019-12-27 01:09:49 -05:00
|
|
|
|
decodeIntegerSequence.Add(ref intEncoded);
|
2019-03-03 20:45:25 -05:00
|
|
|
|
numberValuesDecoded++;
|
2018-09-08 13:51:50 -04:00
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-12-27 01:09:49 -05:00
|
|
|
|
|
|
|
|
|
private static ReadOnlySpan<byte> GetTritEncoding(int index)
|
|
|
|
|
{
|
|
|
|
|
return TritEncodings.Slice(index * 5, 5);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static ReadOnlySpan<byte> GetQuintEncoding(int index)
|
|
|
|
|
{
|
|
|
|
|
return QuintEncodings.Slice(index * 3, 3);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static ReadOnlySpan<byte> TritEncodings => new byte[]
|
|
|
|
|
{
|
|
|
|
|
0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 2, 0, 0, 0, 0,
|
|
|
|
|
0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0,
|
|
|
|
|
2, 1, 0, 0, 0, 1, 0, 2, 0, 0, 0, 2, 0, 0, 0,
|
|
|
|
|
1, 2, 0, 0, 0, 2, 2, 0, 0, 0, 2, 0, 2, 0, 0,
|
|
|
|
|
0, 2, 2, 0, 0, 1, 2, 2, 0, 0, 2, 2, 2, 0, 0,
|
|
|
|
|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