aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Graphics.Nvdec.Vp9/Idct.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Ryujinx.Graphics.Nvdec.Vp9/Idct.cs')
-rw-r--r--src/Ryujinx.Graphics.Nvdec.Vp9/Idct.cs112
1 files changed, 53 insertions, 59 deletions
diff --git a/src/Ryujinx.Graphics.Nvdec.Vp9/Idct.cs b/src/Ryujinx.Graphics.Nvdec.Vp9/Idct.cs
index 9fa5842a..1ee7f68b 100644
--- a/src/Ryujinx.Graphics.Nvdec.Vp9/Idct.cs
+++ b/src/Ryujinx.Graphics.Nvdec.Vp9/Idct.cs
@@ -12,7 +12,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
private struct Transform2D
{
- public Transform1D Cols, Rows; // Vertical and horizontal
+ public Transform1D Cols, Rows; // Vertical and horizontal
public Transform2D(Transform1D cols, Transform1D rows)
{
@@ -23,7 +23,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
private struct HighbdTransform2D
{
- public HighbdTransform1D Cols, Rows; // Vertical and horizontal
+ public HighbdTransform1D Cols, Rows; // Vertical and horizontal
public HighbdTransform2D(HighbdTransform1D cols, HighbdTransform1D rows)
{
@@ -32,12 +32,11 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
}
}
- private static readonly Transform2D[] Iht4 = new Transform2D[]
- {
- new Transform2D(Idct4, Idct4), // DCT_DCT = 0
- new Transform2D(Iadst4, Idct4), // ADST_DCT = 1
- new Transform2D(Idct4, Iadst4), // DCT_ADST = 2
- new Transform2D(Iadst4, Iadst4) // ADST_ADST = 3
+ private static readonly Transform2D[] _iht4 = {
+ new(Idct4, Idct4), // DCT_DCT = 0
+ new(Iadst4, Idct4), // ADST_DCT = 1
+ new(Idct4, Iadst4), // DCT_ADST = 2
+ new(Iadst4, Iadst4), // ADST_ADST = 3
};
public static void Iht4x416Add(ReadOnlySpan<int> input, Span<byte> dest, int stride, int txType)
@@ -51,9 +50,9 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
// Inverse transform row vectors
for (i = 0; i < 4; ++i)
{
- Iht4[txType].Rows(input, outptr);
- input = input.Slice(4);
- outptr = outptr.Slice(4);
+ _iht4[txType].Rows(input, outptr);
+ input = input[4..];
+ outptr = outptr[4..];
}
// Inverse transform column vectors
@@ -64,7 +63,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
tempIn[j] = output[j * 4 + i];
}
- Iht4[txType].Cols(tempIn, tempOut);
+ _iht4[txType].Cols(tempIn, tempOut);
for (j = 0; j < 4; ++j)
{
dest[j * stride + i] = ClipPixelAdd(dest[j * stride + i], BitUtils.RoundPowerOfTwo(tempOut[j], 4));
@@ -72,12 +71,11 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
}
}
- private static readonly Transform2D[] Iht8 = new Transform2D[]
- {
- new Transform2D(Idct8, Idct8), // DCT_DCT = 0
- new Transform2D(Iadst8, Idct8), // ADST_DCT = 1
- new Transform2D(Idct8, Iadst8), // DCT_ADST = 2
- new Transform2D(Iadst8, Iadst8) // ADST_ADST = 3
+ private static readonly Transform2D[] _iht8 = {
+ new(Idct8, Idct8), // DCT_DCT = 0
+ new(Iadst8, Idct8), // ADST_DCT = 1
+ new(Idct8, Iadst8), // DCT_ADST = 2
+ new(Iadst8, Iadst8), // ADST_ADST = 3
};
public static void Iht8x864Add(ReadOnlySpan<int> input, Span<byte> dest, int stride, int txType)
@@ -87,14 +85,14 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
Span<int> outptr = output;
Span<int> tempIn = stackalloc int[8];
Span<int> tempOut = stackalloc int[8];
- Transform2D ht = Iht8[txType];
+ Transform2D ht = _iht8[txType];
// Inverse transform row vectors
for (i = 0; i < 8; ++i)
{
ht.Rows(input, outptr);
- input = input.Slice(8);
- outptr = outptr.Slice(8);
+ input = input[8..];
+ outptr = outptr[8..];
}
// Inverse transform column vectors
@@ -113,12 +111,11 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
}
}
- private static readonly Transform2D[] Iht16 = new Transform2D[]
- {
- new Transform2D(Idct16, Idct16), // DCT_DCT = 0
- new Transform2D(Iadst16, Idct16), // ADST_DCT = 1
- new Transform2D(Idct16, Iadst16), // DCT_ADST = 2
- new Transform2D(Iadst16, Iadst16) // ADST_ADST = 3
+ private static readonly Transform2D[] _iht16 = {
+ new(Idct16, Idct16), // DCT_DCT = 0
+ new(Iadst16, Idct16), // ADST_DCT = 1
+ new(Idct16, Iadst16), // DCT_ADST = 2
+ new(Iadst16, Iadst16), // ADST_ADST = 3
};
public static void Iht16x16256Add(ReadOnlySpan<int> input, Span<byte> dest, int stride, int txType)
@@ -128,14 +125,14 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
Span<int> outptr = output;
Span<int> tempIn = stackalloc int[16];
Span<int> tempOut = stackalloc int[16];
- Transform2D ht = Iht16[txType];
+ Transform2D ht = _iht16[txType];
// Rows
for (i = 0; i < 16; ++i)
{
ht.Rows(input, outptr);
- input = input.Slice(16);
- outptr = outptr.Slice(16);
+ input = input[16..];
+ outptr = outptr[16..];
}
// Columns
@@ -283,12 +280,11 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
}
}
- private static readonly HighbdTransform2D[] HighbdIht4 = new HighbdTransform2D[]
- {
- new HighbdTransform2D(HighbdIdct4, HighbdIdct4), // DCT_DCT = 0
- new HighbdTransform2D(HighbdIadst4, HighbdIdct4), // ADST_DCT = 1
- new HighbdTransform2D(HighbdIdct4, HighbdIadst4), // DCT_ADST = 2
- new HighbdTransform2D(HighbdIadst4, HighbdIadst4) // ADST_ADST = 3
+ private static readonly HighbdTransform2D[] _highbdIht4 = {
+ new(HighbdIdct4, HighbdIdct4), // DCT_DCT = 0
+ new(HighbdIadst4, HighbdIdct4), // ADST_DCT = 1
+ new(HighbdIdct4, HighbdIadst4), // DCT_ADST = 2
+ new(HighbdIadst4, HighbdIadst4), // ADST_ADST = 3
};
public static void HighbdIht4x416Add(ReadOnlySpan<int> input, Span<ushort> dest, int stride, int txType, int bd)
@@ -302,9 +298,9 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
// Inverse transform row vectors.
for (i = 0; i < 4; ++i)
{
- HighbdIht4[txType].Rows(input, outptr, bd);
- input = input.Slice(4);
- outptr = outptr.Slice(4);
+ _highbdIht4[txType].Rows(input, outptr, bd);
+ input = input[4..];
+ outptr = outptr[4..];
}
// Inverse transform column vectors.
@@ -315,7 +311,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
tempIn[j] = output[j * 4 + i];
}
- HighbdIht4[txType].Cols(tempIn, tempOut, bd);
+ _highbdIht4[txType].Cols(tempIn, tempOut, bd);
for (j = 0; j < 4; ++j)
{
dest[j * stride + i] = HighbdClipPixelAdd(dest[j * stride + i], BitUtils.RoundPowerOfTwo(tempOut[j], 4), bd);
@@ -323,12 +319,11 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
}
}
- private static readonly HighbdTransform2D[] HighIht8 = new HighbdTransform2D[]
- {
- new HighbdTransform2D(HighbdIdct8, HighbdIdct8), // DCT_DCT = 0
- new HighbdTransform2D(HighbdIadst8, HighbdIdct8), // ADST_DCT = 1
- new HighbdTransform2D(HighbdIdct8, HighbdIadst8), // DCT_ADST = 2
- new HighbdTransform2D(HighbdIadst8, HighbdIadst8) // ADST_ADST = 3
+ private static readonly HighbdTransform2D[] _highIht8 = {
+ new(HighbdIdct8, HighbdIdct8), // DCT_DCT = 0
+ new(HighbdIadst8, HighbdIdct8), // ADST_DCT = 1
+ new(HighbdIdct8, HighbdIadst8), // DCT_ADST = 2
+ new(HighbdIadst8, HighbdIadst8), // ADST_ADST = 3
};
public static void HighbdIht8x864Add(ReadOnlySpan<int> input, Span<ushort> dest, int stride, int txType, int bd)
@@ -338,14 +333,14 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
Span<int> outptr = output;
Span<int> tempIn = stackalloc int[8];
Span<int> tempOut = stackalloc int[8];
- HighbdTransform2D ht = HighIht8[txType];
+ HighbdTransform2D ht = _highIht8[txType];
// Inverse transform row vectors.
for (i = 0; i < 8; ++i)
{
ht.Rows(input, outptr, bd);
- input = input.Slice(8);
- outptr = output.Slice(8);
+ input = input[8..];
+ outptr = output[8..];
}
// Inverse transform column vectors.
@@ -364,12 +359,11 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
}
}
- private static readonly HighbdTransform2D[] HighIht16 = new HighbdTransform2D[]
- {
- new HighbdTransform2D(HighbdIdct16, HighbdIdct16), // DCT_DCT = 0
- new HighbdTransform2D(HighbdIadst16, HighbdIdct16), // ADST_DCT = 1
- new HighbdTransform2D(HighbdIdct16, HighbdIadst16), // DCT_ADST = 2
- new HighbdTransform2D(HighbdIadst16, HighbdIadst16) // ADST_ADST = 3
+ private static readonly HighbdTransform2D[] _highIht16 = {
+ new(HighbdIdct16, HighbdIdct16), // DCT_DCT = 0
+ new(HighbdIadst16, HighbdIdct16), // ADST_DCT = 1
+ new(HighbdIdct16, HighbdIadst16), // DCT_ADST = 2
+ new(HighbdIadst16, HighbdIadst16), // ADST_ADST = 3
};
public static void HighbdIht16x16256Add(ReadOnlySpan<int> input, Span<ushort> dest, int stride, int txType, int bd)
@@ -379,14 +373,14 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
Span<int> outptr = output;
Span<int> tempIn = stackalloc int[16];
Span<int> tempOut = stackalloc int[16];
- HighbdTransform2D ht = HighIht16[txType];
+ HighbdTransform2D ht = _highIht16[txType];
// Rows
for (i = 0; i < 16; ++i)
{
ht.Rows(input, outptr, bd);
- input = input.Slice(16);
- outptr = output.Slice(16);
+ input = input[16..];
+ outptr = output[16..];
}
// Columns
@@ -440,7 +434,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
// DC only DCT coefficient
if (eob == 1)
{
- vpx_Highbdidct8x8_1_add_c(input, dest, stride, bd);
+ Vpx_Highbdidct8x8_1_add_c(input, dest, stride, bd);
}
else if (eob <= 12)
{