misc: chore: VP9 project cleanup

Target-typed new, remove var usage, use collection expressions, rename many fields & properties to match C# standard
This commit is contained in:
Evan Husted 2025-02-18 21:33:07 -06:00
parent f91cd05260
commit b1de7696ee
33 changed files with 2281 additions and 2382 deletions

View file

@ -2,19 +2,19 @@
{
internal enum BlockSize
{
Block4x4,
Block4x8,
Block8x4,
Block8x8,
Block8x16,
Block16x8,
Block16x16,
Block16x32,
Block32x16,
Block32x32,
Block32x64,
Block64x32,
Block64x64,
Block4X4,
Block4X8,
Block8X4,
Block8X8,
Block8X16,
Block16X8,
Block16X16,
Block16X32,
Block32X16,
Block32X32,
Block32X64,
Block64X32,
Block64X64,
BlockSizes,
BlockInvalid = BlockSizes
}

View file

@ -15,10 +15,10 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
{
public Array4<ulong> LeftY;
public Array4<ulong> AboveY;
public ulong Int4x4Y;
public ulong Int4X4Y;
public Array4<ushort> LeftUv;
public Array4<ushort> AboveUv;
public ushort Int4x4Uv;
public ushort Int4X4Uv;
public Array64<byte> LflY;
}
}

View file

@ -29,12 +29,12 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
public PredictionMode GetYMode(int block)
{
return SbType < BlockSize.Block8x8 ? Bmi[block].Mode : Mode;
return SbType < BlockSize.Block8X8 ? Bmi[block].Mode : Mode;
}
public TxSize GetUvTxSize(ref MacroBlockDPlane pd)
{
Debug.Assert(SbType < BlockSize.Block8x8 ||
Debug.Assert(SbType < BlockSize.Block8X8 ||
Luts.SsSizeLookup[(int)SbType][pd.SubsamplingX][pd.SubsamplingY] != BlockSize.BlockInvalid);
return Luts.UvTxsizeLookup[(int)SbType][(int)TxSize][pd.SubsamplingX][pd.SubsamplingY];
}
@ -49,17 +49,17 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
return RefFrame[1] > Constants.IntraFrame;
}
private static readonly int[][] IdxNColumnToSubblock =
{
new[] { 1, 2 }, new[] { 1, 3 }, new[] { 3, 2 }, new[] { 3, 3 }
};
private static readonly int[][] _idxNColumnToSubblock =
[
[1, 2], [1, 3], [3, 2], [3, 3]
];
// This function returns either the appropriate sub block or block's mv
// on whether the block_size < 8x8 and we have check_sub_blocks set.
public Mv GetSubBlockMv(int whichMv, int searchCol, int blockIdx)
{
return blockIdx >= 0 && SbType < BlockSize.Block8x8
? Bmi[IdxNColumnToSubblock[blockIdx][searchCol == 0 ? 1 : 0]].Mv[whichMv]
return blockIdx >= 0 && SbType < BlockSize.Block8X8
? Bmi[_idxNColumnToSubblock[blockIdx][searchCol == 0 ? 1 : 0]].Mv[whichMv]
: Mv[whichMv];
}

View file

@ -10,8 +10,8 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
public short Row;
public short Col;
private static ReadOnlySpan<byte> LogInBase2 => new byte[]
{
private static ReadOnlySpan<byte> LogInBase2 =>
[
0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6,
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
@ -42,12 +42,12 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
9, 9, 9, 9, 9, 9, 9, 9, 9, 10
};
];
public bool UseHp()
{
const int kMvRefThresh = 64; // Threshold for use of high-precision 1/8 mv
return Math.Abs(Row) < kMvRefThresh && Math.Abs(Col) < kMvRefThresh;
const int KMvRefThresh = 64; // Threshold for use of high-precision 1/8 mv
return Math.Abs(Row) < KMvRefThresh && Math.Abs(Col) < KMvRefThresh;
}
public static bool JointVertical(MvJointType type)

View file

@ -38,96 +38,85 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
int h,
int bd);
private static readonly unsafe ConvolveFn[][][] PredictX16Y16 =
{
new[]
{
new ConvolveFn[] { ConvolveCopy, ConvolveAvg },
new ConvolveFn[] { Convolve8Vert, Convolve8AvgVert }
},
new[]
{
new ConvolveFn[] { Convolve8Horiz, Convolve8AvgHoriz },
new ConvolveFn[] { Convolve8, Convolve8Avg }
}
};
private static readonly unsafe ConvolveFn[][][] _predictX16Y16 =
[
[
[ConvolveCopy, ConvolveAvg],
[Convolve8Vert, Convolve8AvgVert]
],
[
[Convolve8Horiz, Convolve8AvgHoriz],
[Convolve8, Convolve8Avg]
]
];
private static readonly unsafe ConvolveFn[][][] PredictX16 =
{
new[]
{
new ConvolveFn[] { ScaledVert, ScaledAvgVert }, new ConvolveFn[] { ScaledVert, ScaledAvgVert }
},
new[] { new ConvolveFn[] { Scaled2D, ScaledAvg2D }, new ConvolveFn[] { Scaled2D, ScaledAvg2D } }
};
private static readonly unsafe ConvolveFn[][][] _predictX16 =
[
[
[ScaledVert, ScaledAvgVert], [ScaledVert, ScaledAvgVert]
],
[[Scaled2D, ScaledAvg2D], [Scaled2D, ScaledAvg2D]]
];
private static readonly unsafe ConvolveFn[][][] PredictY16 =
{
new[] { new ConvolveFn[] { ScaledHoriz, ScaledAvgHoriz }, new ConvolveFn[] { Scaled2D, ScaledAvg2D } },
new[] { new ConvolveFn[] { ScaledHoriz, ScaledAvgHoriz }, new ConvolveFn[] { Scaled2D, ScaledAvg2D } }
};
private static readonly unsafe ConvolveFn[][][] _predictY16 =
[
[[ScaledHoriz, ScaledAvgHoriz], [Scaled2D, ScaledAvg2D]],
[[ScaledHoriz, ScaledAvgHoriz], [Scaled2D, ScaledAvg2D]]
];
private static readonly unsafe ConvolveFn[][][] Predict =
{
new[] { new ConvolveFn[] { Scaled2D, ScaledAvg2D }, new ConvolveFn[] { Scaled2D, ScaledAvg2D } },
new[] { new ConvolveFn[] { Scaled2D, ScaledAvg2D }, new ConvolveFn[] { Scaled2D, ScaledAvg2D } }
};
private static readonly unsafe ConvolveFn[][][] _predict =
[
[[Scaled2D, ScaledAvg2D], [Scaled2D, ScaledAvg2D]],
[[Scaled2D, ScaledAvg2D], [Scaled2D, ScaledAvg2D]]
];
private static readonly unsafe HighbdConvolveFn[][][] HighbdPredictX16Y16 =
{
new[]
{
new HighbdConvolveFn[] { HighbdConvolveCopy, HighbdConvolveAvg },
new HighbdConvolveFn[] { HighbdConvolve8Vert, HighbdConvolve8AvgVert }
},
new[]
{
new HighbdConvolveFn[] { HighbdConvolve8Horiz, HighbdConvolve8AvgHoriz },
new HighbdConvolveFn[] { HighbdConvolve8, HighbdConvolve8Avg }
}
};
private static readonly unsafe HighbdConvolveFn[][][] _highbdPredictX16Y16 =
[
[
[HighbdConvolveCopy, HighbdConvolveAvg],
[HighbdConvolve8Vert, HighbdConvolve8AvgVert]
],
[
[HighbdConvolve8Horiz, HighbdConvolve8AvgHoriz],
[HighbdConvolve8, HighbdConvolve8Avg]
]
];
private static readonly unsafe HighbdConvolveFn[][][] HighbdPredictX16 =
{
new[]
{
new HighbdConvolveFn[] { HighbdConvolve8Vert, HighbdConvolve8AvgVert },
new HighbdConvolveFn[] { HighbdConvolve8Vert, HighbdConvolve8AvgVert }
},
new[]
{
new HighbdConvolveFn[] { HighbdConvolve8, HighbdConvolve8Avg },
new HighbdConvolveFn[] { HighbdConvolve8, HighbdConvolve8Avg }
}
};
private static readonly unsafe HighbdConvolveFn[][][] _highbdPredictX16 =
[
[
[HighbdConvolve8Vert, HighbdConvolve8AvgVert],
[HighbdConvolve8Vert, HighbdConvolve8AvgVert]
],
[
[HighbdConvolve8, HighbdConvolve8Avg],
[HighbdConvolve8, HighbdConvolve8Avg]
]
];
private static readonly unsafe HighbdConvolveFn[][][] HighbdPredictY16 =
{
new[]
{
new HighbdConvolveFn[] { HighbdConvolve8Horiz, HighbdConvolve8AvgHoriz },
new HighbdConvolveFn[] { HighbdConvolve8, HighbdConvolve8Avg }
},
new[]
{
new HighbdConvolveFn[] { HighbdConvolve8Horiz, HighbdConvolve8AvgHoriz },
new HighbdConvolveFn[] { HighbdConvolve8, HighbdConvolve8Avg }
}
};
private static readonly unsafe HighbdConvolveFn[][][] _highbdPredictY16 =
[
[
[HighbdConvolve8Horiz, HighbdConvolve8AvgHoriz],
[HighbdConvolve8, HighbdConvolve8Avg]
],
[
[HighbdConvolve8Horiz, HighbdConvolve8AvgHoriz],
[HighbdConvolve8, HighbdConvolve8Avg]
]
];
private static readonly unsafe HighbdConvolveFn[][][] HighbdPredict =
{
new[]
{
new HighbdConvolveFn[] { HighbdConvolve8, HighbdConvolve8Avg },
new HighbdConvolveFn[] { HighbdConvolve8, HighbdConvolve8Avg }
},
new[]
{
new HighbdConvolveFn[] { HighbdConvolve8, HighbdConvolve8Avg },
new HighbdConvolveFn[] { HighbdConvolve8, HighbdConvolve8Avg }
}
};
private static readonly unsafe HighbdConvolveFn[][][] _highbdPredict =
[
[
[HighbdConvolve8, HighbdConvolve8Avg],
[HighbdConvolve8, HighbdConvolve8Avg]
],
[
[HighbdConvolve8, HighbdConvolve8Avg],
[HighbdConvolve8, HighbdConvolve8Avg]
]
];
public int XScaleFp; // Horizontal fixed point scale factor
public int YScaleFp; // Vertical fixed point scale factor
@ -166,13 +155,13 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
if (YStepQ4 == 16)
{
// No scaling in either direction.
PredictX16Y16[horiz][vert][avg](src, srcStride, dst, dstStride, kernel, subpelX, xs, subpelY, ys, w,
_predictX16Y16[horiz][vert][avg](src, srcStride, dst, dstStride, kernel, subpelX, xs, subpelY, ys, w,
h);
}
else
{
// No scaling in x direction. Must always scale in the y direction.
PredictX16[horiz][vert][avg](src, srcStride, dst, dstStride, kernel, subpelX, xs, subpelY, ys, w,
_predictX16[horiz][vert][avg](src, srcStride, dst, dstStride, kernel, subpelX, xs, subpelY, ys, w,
h);
}
}
@ -181,13 +170,13 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
if (YStepQ4 == 16)
{
// No scaling in the y direction. Must always scale in the x direction.
PredictY16[horiz][vert][avg](src, srcStride, dst, dstStride, kernel, subpelX, xs, subpelY, ys, w,
_predictY16[horiz][vert][avg](src, srcStride, dst, dstStride, kernel, subpelX, xs, subpelY, ys, w,
h);
}
else
{
// Must always scale in both directions.
Predict[horiz][vert][avg](src, srcStride, dst, dstStride, kernel, subpelX, xs, subpelY, ys, w, h);
_predict[horiz][vert][avg](src, srcStride, dst, dstStride, kernel, subpelX, xs, subpelY, ys, w, h);
}
}
}
@ -215,13 +204,13 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
if (YStepQ4 == 16)
{
// No scaling in either direction.
HighbdPredictX16Y16[horiz][vert][avg](src, srcStride, dst, dstStride, kernel, subpelX, xs, subpelY,
_highbdPredictX16Y16[horiz][vert][avg](src, srcStride, dst, dstStride, kernel, subpelX, xs, subpelY,
ys, w, h, bd);
}
else
{
// No scaling in x direction. Must always scale in the y direction.
HighbdPredictX16[horiz][vert][avg](src, srcStride, dst, dstStride, kernel, subpelX, xs, subpelY, ys,
_highbdPredictX16[horiz][vert][avg](src, srcStride, dst, dstStride, kernel, subpelX, xs, subpelY, ys,
w, h, bd);
}
}
@ -230,13 +219,13 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
if (YStepQ4 == 16)
{
// No scaling in the y direction. Must always scale in the x direction.
HighbdPredictY16[horiz][vert][avg](src, srcStride, dst, dstStride, kernel, subpelX, xs, subpelY, ys,
_highbdPredictY16[horiz][vert][avg](src, srcStride, dst, dstStride, kernel, subpelX, xs, subpelY, ys,
w, h, bd);
}
else
{
// Must always scale in both directions.
HighbdPredict[horiz][vert][avg](src, srcStride, dst, dstStride, kernel, subpelX, xs, subpelY, ys, w,
_highbdPredict[horiz][vert][avg](src, srcStride, dst, dstStride, kernel, subpelX, xs, subpelY, ys, w,
h, bd);
}
}

View file

@ -16,8 +16,8 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
public const int PredictionProbs = 3;
private static readonly int[] SegFeatureDataSigned = { 1, 1, 0, 0 };
private static readonly int[] SegFeatureDataMax = { QuantCommon.MaxQ, Vp9.LoopFilter.MaxLoopFilter, 3, 0 };
private static readonly int[] _segFeatureDataSigned = [1, 1, 0, 0];
private static readonly int[] _segFeatureDataMax = [QuantCommon.MaxQ, Vp9.LoopFilter.MaxLoopFilter, 3, 0];
public bool Enabled;
public bool UpdateMap;
@ -48,21 +48,21 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
internal static int FeatureDataMax(SegLvlFeatures featureId)
{
return SegFeatureDataMax[(int)featureId];
return _segFeatureDataMax[(int)featureId];
}
internal static int IsSegFeatureSigned(SegLvlFeatures featureId)
{
return SegFeatureDataSigned[(int)featureId];
return _segFeatureDataSigned[(int)featureId];
}
internal void SetSegData(int segmentId, SegLvlFeatures featureId, int segData)
{
Debug.Assert(segData <= SegFeatureDataMax[(int)featureId]);
Debug.Assert(segData <= _segFeatureDataMax[(int)featureId]);
if (segData < 0)
{
Debug.Assert(SegFeatureDataSigned[(int)featureId] != 0);
Debug.Assert(-segData <= SegFeatureDataMax[(int)featureId]);
Debug.Assert(_segFeatureDataSigned[(int)featureId] != 0);
Debug.Assert(-segData <= _segFeatureDataMax[(int)featureId]);
}
FeatureData[segmentId][(int)featureId] = (short)segData;

View file

@ -65,23 +65,23 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
public Surface(int width, int height)
{
const int border = 32;
const int ssX = 1;
const int ssY = 1;
const bool highbd = false;
const int Border = 32;
const int SsX = 1;
const int SsY = 1;
const bool Highbd = false;
int alignedWidth = (width + 7) & ~7;
int alignedHeight = (height + 7) & ~7;
int yStride = (alignedWidth + (2 * border) + 31) & ~31;
int yplaneSize = (alignedHeight + (2 * border)) * yStride;
int uvWidth = alignedWidth >> ssX;
int uvHeight = alignedHeight >> ssY;
int uvStride = yStride >> ssX;
int uvBorderW = border >> ssX;
int uvBorderH = border >> ssY;
int yStride = (alignedWidth + (2 * Border) + 31) & ~31;
int yplaneSize = (alignedHeight + (2 * Border)) * yStride;
int uvWidth = alignedWidth >> SsX;
int uvHeight = alignedHeight >> SsY;
int uvStride = yStride >> SsX;
int uvBorderW = Border >> SsX;
int uvBorderH = Border >> SsY;
int uvplaneSize = (uvHeight + (2 * uvBorderH)) * uvStride;
int frameSize = (highbd ? 2 : 1) * (yplaneSize + (2 * uvplaneSize));
int frameSize = (Highbd ? 2 : 1) * (yplaneSize + (2 * uvplaneSize));
nint pointer = Marshal.AllocHGlobal(frameSize);
_pointer = pointer;
@ -90,8 +90,8 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
AlignedWidth = alignedWidth;
AlignedHeight = alignedHeight;
Stride = yStride;
UvWidth = (width + ssX) >> ssX;
UvHeight = (height + ssY) >> ssY;
UvWidth = (width + SsX) >> SsX;
UvHeight = (height + SsY) >> SsY;
UvAlignedWidth = uvWidth;
UvAlignedHeight = uvHeight;
UvStride = uvStride;
@ -101,7 +101,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
return new ArrayPtr<byte>(pointer + start + border, size - border);
}
YBuffer = NewPlane(0, yplaneSize, (border * yStride) + border);
YBuffer = NewPlane(0, yplaneSize, (Border * yStride) + Border);
UBuffer = NewPlane(yplaneSize, uvplaneSize, (uvBorderH * uvStride) + uvBorderW);
VBuffer = NewPlane(yplaneSize + uvplaneSize, uvplaneSize, (uvBorderH * uvStride) + uvBorderW);
}
@ -146,8 +146,8 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
if (cb != null)
{
const int alignAddrExtraSize = 31;
ulong externalFrameSize = frameSize + alignAddrExtraSize;
const int AlignAddrExtraSize = 31;
ulong externalFrameSize = frameSize + AlignAddrExtraSize;
Debug.Assert(!fb.IsNull);

View file

@ -2,10 +2,10 @@
{
public enum TxMode
{
Only4x4, // Only 4x4 transform used
Allow8x8, // Allow block transform size up to 8x8
Allow16x16, // Allow block transform size up to 16x16
Allow32x32, // Allow block transform size up to 32x32
Only4X4, // Only 4x4 transform used
Allow8X8, // Allow block transform size up to 8x8
Allow16X16, // Allow block transform size up to 16x16
Allow32X32, // Allow block transform size up to 32x32
TxModeSelect, // Transform specified for each block
TxModes
}

View file

@ -2,10 +2,10 @@
{
public enum TxSize
{
Tx4x4, // 4x4 transform
Tx8x8, // 8x8 transform
Tx16x16, // 16x16 transform
Tx32x32, // 32x32 transform
Tx4X4, // 4x4 transform
Tx8X8, // 8x8 transform
Tx16X16, // 16x16 transform
Tx32X32, // 32x32 transform
TxSizes
}
}

View file

@ -845,30 +845,30 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
if (TxMode == TxMode.TxModeSelect)
{
Array1<Array2<uint>> branchCt8x8P = new();
Array2<Array2<uint>> branchCt16x16P = new();
Array3<Array2<uint>> branchCt32x32P = new();
Array1<Array2<uint>> branchCt8X8P = new();
Array2<Array2<uint>> branchCt16X16P = new();
Array3<Array2<uint>> branchCt32X32P = new();
for (int i = 0; i < EntropyMode.TxSizeContexts; ++i)
{
EntropyMode.TxCountsToBranchCounts8x8(counts.Tx8x8[i].AsSpan(), ref branchCt8x8P);
EntropyMode.TxCountsToBranchCounts8X8(counts.Tx8x8[i].AsSpan(), ref branchCt8X8P);
for (int j = 0; j < (int)TxSize.TxSizes - 3; ++j)
{
fc.Tx8x8Prob[i][j] = Prob.ModeMvMergeProbs(preFc.Tx8x8Prob[i][j], ref branchCt8x8P[j]);
fc.Tx8x8Prob[i][j] = Prob.ModeMvMergeProbs(preFc.Tx8x8Prob[i][j], ref branchCt8X8P[j]);
}
EntropyMode.TxCountsToBranchCounts16x16(counts.Tx16x16[i].AsSpan(), ref branchCt16x16P);
EntropyMode.TxCountsToBranchCounts16X16(counts.Tx16x16[i].AsSpan(), ref branchCt16X16P);
for (int j = 0; j < (int)TxSize.TxSizes - 2; ++j)
{
fc.Tx16x16Prob[i][j] =
Prob.ModeMvMergeProbs(preFc.Tx16x16Prob[i][j], ref branchCt16x16P[j]);
Prob.ModeMvMergeProbs(preFc.Tx16x16Prob[i][j], ref branchCt16X16P[j]);
}
EntropyMode.TxCountsToBranchCounts32x32(counts.Tx32x32[i].AsSpan(), ref branchCt32x32P);
EntropyMode.TxCountsToBranchCounts32X32(counts.Tx32x32[i].AsSpan(), ref branchCt32X32P);
for (int j = 0; j < (int)TxSize.TxSizes - 1; ++j)
{
fc.Tx32x32Prob[i][j] =
Prob.ModeMvMergeProbs(preFc.Tx32x32Prob[i][j], ref branchCt32x32P[j]);
Prob.ModeMvMergeProbs(preFc.Tx32x32Prob[i][j], ref branchCt32X32P[j]);
}
}
}
@ -900,7 +900,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
countSat = Entropy.CoefCountSat;
}
for (t = (int)TxSize.Tx4x4; t <= (int)TxSize.Tx32x32; t++)
for (t = (int)TxSize.Tx4X4; t <= (int)TxSize.Tx32X32; t++)
{
AdaptCoefProbs(t, countSat, updateFactor);
}
@ -990,10 +990,10 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
public void DefaultCoefProbs()
{
Entropy.CopyProbs(ref Fc.Value.CoefProbs[(int)TxSize.Tx4x4], Entropy.DefaultCoefProbs4x4);
Entropy.CopyProbs(ref Fc.Value.CoefProbs[(int)TxSize.Tx8x8], Entropy.DefaultCoefProbs8x8);
Entropy.CopyProbs(ref Fc.Value.CoefProbs[(int)TxSize.Tx16x16], Entropy.DefaultCoefProbs16x16);
Entropy.CopyProbs(ref Fc.Value.CoefProbs[(int)TxSize.Tx32x32], Entropy.DefaultCoefProbs32x32);
Entropy.CopyProbs(ref Fc.Value.CoefProbs[(int)TxSize.Tx4X4], Entropy.DefaultCoefProbs4X4);
Entropy.CopyProbs(ref Fc.Value.CoefProbs[(int)TxSize.Tx8X8], Entropy.DefaultCoefProbs8X8);
Entropy.CopyProbs(ref Fc.Value.CoefProbs[(int)TxSize.Tx16X16], Entropy.DefaultCoefProbs16X16);
Entropy.CopyProbs(ref Fc.Value.CoefProbs[(int)TxSize.Tx32X32], Entropy.DefaultCoefProbs32X32);
}
}
}

View file

@ -62,38 +62,38 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
}
}
byte[][] KfPartitionProbs =
{
byte[][] kfPartitionProbs =
[
// 8x8 . 4x4
new byte[] { 158, 97, 94 }, // a/l both not split
new byte[] { 93, 24, 99 }, // a split, l not split
new byte[] { 85, 119, 44 }, // l split, a not split
new byte[] { 62, 59, 67 }, // a/l both split
[158, 97, 94], // a/l both not split
[93, 24, 99], // a split, l not split
[85, 119, 44], // l split, a not split
[62, 59, 67], // a/l both split
// 16x16 . 8x8
new byte[] { 149, 53, 53 }, // a/l both not split
new byte[] { 94, 20, 48 }, // a split, l not split
new byte[] { 83, 53, 24 }, // l split, a not split
new byte[] { 52, 18, 18 }, // a/l both split
[149, 53, 53], // a/l both not split
[94, 20, 48], // a split, l not split
[83, 53, 24], // l split, a not split
[52, 18, 18], // a/l both split
// 32x32 . 16x16
new byte[] { 150, 40, 39 }, // a/l both not split
new byte[] { 78, 12, 26 }, // a split, l not split
new byte[] { 67, 33, 11 }, // l split, a not split
new byte[] { 24, 7, 5 }, // a/l both split
[150, 40, 39], // a/l both not split
[78, 12, 26], // a split, l not split
[67, 33, 11], // l split, a not split
[24, 7, 5], // a/l both split
// 64x64 . 32x32
new byte[] { 174, 35, 49 }, // a/l both not split
new byte[] { 68, 11, 27 }, // a split, l not split
new byte[] { 57, 15, 9 }, // l split, a not split
new byte[] { 12, 3, 3 } // a/l both split
};
[174, 35, 49], // a/l both not split
[68, 11, 27], // a split, l not split
[57, 15, 9], // l split, a not split
[12, 3, 3] // a/l both split
];
for (int i = 0; i < KfPartitionProbs.Length; i++)
for (int i = 0; i < kfPartitionProbs.Length; i++)
{
for (int j = 0; j < KfPartitionProbs[i].Length; j++)
for (int j = 0; j < kfPartitionProbs[i].Length; j++)
{
cm.Fc.Value.KfPartitionProb[i][j] = KfPartitionProbs[i][j];
cm.Fc.Value.KfPartitionProb[i][j] = kfPartitionProbs[i][j];
}
}
@ -281,7 +281,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
Array8<uint> frameSizes = new();
int frameCount = 0;
res = Types.Decoder.ParseSuperframeIndex(data, (ulong)data.Length, ref frameSizes, out frameCount);
res = Decoder.ParseSuperframeIndex(data, (ulong)data.Length, ref frameSizes, out frameCount);
if (res != CodecErr.Ok)
{
return res;
@ -322,7 +322,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
// Account for suboptimal termination by the encoder.
while (dataStart.Length != 0)
{
byte marker = Types.Decoder.ReadMarker(dataStart);
byte marker = Decoder.ReadMarker(dataStart);
if (marker != 0)
{
break;