mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-07-27 03:47:11 +02:00
parent
417df486b1
commit
361d0c5632
622 changed files with 3080 additions and 2652 deletions
|
@ -6,4 +6,4 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
Bits10 = 10, // < 10 bits
|
||||
Bits12 = 12, // < 12 bits
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
namespace Ryujinx.Graphics.Nvdec.Vp9
|
||||
namespace Ryujinx.Graphics.Nvdec.Vp9
|
||||
{
|
||||
internal enum CodecErr
|
||||
{
|
||||
|
@ -49,18 +49,18 @@
|
|||
/// </remarks>
|
||||
UnsupFeature,
|
||||
|
||||
/// <summary>
|
||||
/// The coded data for this stream is corrupt or incomplete.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// There was a problem decoding the current frame.<br/>
|
||||
/// This return code should only be used
|
||||
/// for failures that prevent future pictures from being properly decoded.<br/>
|
||||
/// <br/>
|
||||
/// This error MAY be treated as fatal to the stream or MAY be treated as fatal to the current GOP.<br/>
|
||||
/// If decoding is continued for the current GOP, artifacts may be present.
|
||||
/// </remarks>
|
||||
CorruptFrame,
|
||||
/// <summary>
|
||||
/// The coded data for this stream is corrupt or incomplete.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// There was a problem decoding the current frame.<br/>
|
||||
/// This return code should only be used
|
||||
/// for failures that prevent future pictures from being properly decoded.<br/>
|
||||
/// <br/>
|
||||
/// This error MAY be treated as fatal to the stream or MAY be treated as fatal to the current GOP.<br/>
|
||||
/// If decoding is continued for the current GOP, artifacts may be present.
|
||||
/// </remarks>
|
||||
CorruptFrame,
|
||||
|
||||
/// <summary>
|
||||
/// An application-supplied parameter is not valid.
|
||||
|
@ -72,4 +72,4 @@
|
|||
/// </summary>
|
||||
ListEnd
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,4 +56,4 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Common
|
|||
return numValues > 0 ? GetMsb(numValues) + 1 : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Common
|
|||
|
||||
ArrayPtr<T> allocation = new(ptr, length);
|
||||
|
||||
allocation.AsSpan().Fill(default);
|
||||
allocation.AsSpan().Clear();
|
||||
|
||||
return allocation;
|
||||
}
|
||||
|
|
|
@ -20,4 +20,4 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Common
|
|||
new Span<T>(ptr, length).Fill(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using Ryujinx.Graphics.Nvdec.Vp9.Types;
|
||||
using Ryujinx.Graphics.Nvdec.Vp9.Types;
|
||||
|
||||
namespace Ryujinx.Graphics.Nvdec.Vp9
|
||||
{
|
||||
|
@ -97,4 +97,4 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
public const int SkipContexts = 3;
|
||||
public const int InterModeContexts = 7;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System.Diagnostics;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Ryujinx.Graphics.Nvdec.Vp9
|
||||
{
|
||||
|
@ -44,4 +44,4 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
return Prob.MaxProb - InvRecenterNonneg(v, Prob.MaxProb - 1 - m);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using Ryujinx.Common.Memory;
|
||||
using Ryujinx.Common.Memory;
|
||||
using Ryujinx.Graphics.Nvdec.Vp9.Common;
|
||||
using Ryujinx.Graphics.Nvdec.Vp9.Dsp;
|
||||
using Ryujinx.Graphics.Nvdec.Vp9.Types;
|
||||
|
@ -63,7 +63,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
{
|
||||
for (int j = 0; j < Constants.InterModes - 1; ++j)
|
||||
{
|
||||
r.DiffUpdateProb( ref fc.InterModeProb[i][j]);
|
||||
r.DiffUpdateProb(ref fc.InterModeProb[i][j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -172,15 +172,15 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
{
|
||||
if (txSize <= TxSize.Tx16X16 && eob <= 10)
|
||||
{
|
||||
dqcoeff.AsSpan().Slice(0, 4 * (4 << (int)txSize)).Clear();
|
||||
dqcoeff.AsSpan()[..(4 * (4 << (int)txSize))].Clear();
|
||||
}
|
||||
else if (txSize == TxSize.Tx32X32 && eob <= 34)
|
||||
{
|
||||
dqcoeff.AsSpan().Slice(0, 256).Clear();
|
||||
dqcoeff.AsSpan()[..256].Clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
dqcoeff.AsSpan().Slice(0, 16 << ((int)txSize << 1)).Clear();
|
||||
dqcoeff.AsSpan()[..(16 << ((int)txSize << 1))].Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -263,15 +263,15 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
{
|
||||
if (txType == TxType.DctDct && txSize <= TxSize.Tx16X16 && eob <= 10)
|
||||
{
|
||||
dqcoeff.AsSpan().Slice(0, 4 * (4 << (int)txSize)).Clear();
|
||||
dqcoeff.AsSpan()[..(4 * (4 << (int)txSize))].Clear();
|
||||
}
|
||||
else if (txSize == TxSize.Tx32X32 && eob <= 34)
|
||||
{
|
||||
dqcoeff.AsSpan().Slice(0, 256).Clear();
|
||||
dqcoeff.AsSpan()[..256].Clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
dqcoeff.AsSpan().Slice(0, 16 << ((int)txSize << 1)).Clear();
|
||||
dqcoeff.AsSpan()[..(16 << ((int)txSize << 1))].Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -289,7 +289,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
PredictionMode mode = plane == 0 ? mi.Mode : mi.UvMode;
|
||||
int dstOffset = (4 * row * pd.Dst.Stride) + (4 * col);
|
||||
byte* dst = &pd.Dst.Buf.ToPointer()[dstOffset];
|
||||
Span<byte> dstSpan = pd.Dst.Buf.AsSpan().Slice(dstOffset);
|
||||
Span<byte> dstSpan = pd.Dst.Buf.AsSpan()[dstOffset..];
|
||||
|
||||
if (mi.SbType < BlockSize.Block8X8)
|
||||
{
|
||||
|
@ -329,7 +329,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
ref MacroBlockDPlane pd = ref xd.Plane[plane];
|
||||
Luts.ScanOrder sc = Luts.DefaultScanOrders[(int)txSize];
|
||||
int eob = Detokenize.DecodeBlockTokens(ref twd, plane, sc, col, row, txSize, mi.SegmentId);
|
||||
Span<byte> dst = pd.Dst.Buf.AsSpan().Slice((4 * row * pd.Dst.Stride) + (4 * col));
|
||||
Span<byte> dst = pd.Dst.Buf.AsSpan()[((4 * row * pd.Dst.Stride) + (4 * col))..];
|
||||
|
||||
if (eob > 0)
|
||||
{
|
||||
|
@ -1024,8 +1024,8 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
// Update the partition context at the end notes. Set partition bits
|
||||
// of block sizes larger than the current one to be one, and partition
|
||||
// bits of smaller block sizes to be zero.
|
||||
aboveCtx.Slice(0, bw).Fill(Luts.PartitionContextLookup[(int)subsize].Above);
|
||||
leftCtx.Slice(0, bw).Fill(Luts.PartitionContextLookup[(int)subsize].Left);
|
||||
aboveCtx[..bw].Fill(Luts.PartitionContextLookup[(int)subsize].Above);
|
||||
leftCtx[..bw].Fill(Luts.PartitionContextLookup[(int)subsize].Left);
|
||||
}
|
||||
|
||||
private static PartitionType ReadPartition(
|
||||
|
@ -1174,7 +1174,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
{
|
||||
for (int m = 0; m < Entropy.UnconstrainedNodes; ++m)
|
||||
{
|
||||
r.DiffUpdateProb( ref coefProbs[i][j][k][l][m]);
|
||||
r.DiffUpdateProb(ref coefProbs[i][j][k][l][m]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1262,9 +1262,8 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
|
||||
private static void SetupFrameSize(MemoryAllocator allocator, ref Vp9Common cm, ref ReadBitBuffer rb)
|
||||
{
|
||||
int width = 0, height = 0;
|
||||
ref BufferPool pool = ref cm.BufferPool.Value;
|
||||
rb.ReadFrameSize(out width, out height);
|
||||
rb.ReadFrameSize(out int width, out int height);
|
||||
cm.ResizeContextBuffers(allocator, width, height);
|
||||
SetupRenderSize(ref cm, ref rb);
|
||||
|
||||
|
@ -1608,13 +1607,13 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
|
||||
GetTileBuffers(ref cm, data, tileCols, ref tileBuffers);
|
||||
|
||||
tileBuffers.AsSpan().Slice(0, tileCols).Sort(CompareTileBuffers);
|
||||
tileBuffers.AsSpan()[..tileCols].Sort(CompareTileBuffers);
|
||||
|
||||
if (numWorkers == tileCols)
|
||||
{
|
||||
TileBuffer largest = tileBuffers[0];
|
||||
Span<TileBuffer> buffers = tileBuffers.AsSpan();
|
||||
buffers.Slice(1).CopyTo(buffers.Slice(0, tileBuffers.Length - 1));
|
||||
buffers[1..].CopyTo(buffers[..(tileBuffers.Length - 1)]);
|
||||
tileBuffers[tileCols - 1] = largest;
|
||||
}
|
||||
else
|
||||
|
@ -1734,9 +1733,13 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
|
||||
private static bool ReadSyncCode(ref ReadBitBuffer rb)
|
||||
{
|
||||
return rb.ReadLiteral(8) == SyncCode0 &&
|
||||
rb.ReadLiteral(8) == SyncCode1 &&
|
||||
rb.ReadLiteral(8) == SyncCode2;
|
||||
int readSyncCode0 = rb.ReadLiteral(8);
|
||||
int readSyncCode1 = rb.ReadLiteral(8);
|
||||
int readSyncCode2 = rb.ReadLiteral(8);
|
||||
|
||||
return readSyncCode0 == SyncCode0 &&
|
||||
readSyncCode1 == SyncCode1 &&
|
||||
readSyncCode2 == SyncCode2;
|
||||
}
|
||||
|
||||
private static void RefCntFb(ref Array12<RefCntBuffer> bufs, ref int idx, int newIdx)
|
||||
|
@ -2014,7 +2017,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
|
||||
for (int i = 0; i < Constants.IntraInterContexts; i++)
|
||||
{
|
||||
r.DiffUpdateProb( ref fc.IntraInterProb[i]);
|
||||
r.DiffUpdateProb(ref fc.IntraInterProb[i]);
|
||||
}
|
||||
|
||||
cm.ReferenceMode = cm.ReadFrameReferenceMode(ref r);
|
||||
|
@ -2029,7 +2032,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
{
|
||||
for (int i = 0; i < Constants.IntraModes - 1; ++i)
|
||||
{
|
||||
r.DiffUpdateProb( ref fc.YModeProb[j][i]);
|
||||
r.DiffUpdateProb(ref fc.YModeProb[j][i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2037,7 +2040,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
{
|
||||
for (int i = 0; i < Constants.PartitionTypes - 1; ++i)
|
||||
{
|
||||
r.DiffUpdateProb( ref fc.PartitionProb[j][i]);
|
||||
r.DiffUpdateProb(ref fc.PartitionProb[j][i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2119,7 +2122,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
allocator.Free(cm.TileWorkerData);
|
||||
}
|
||||
|
||||
cm.CheckMemError( ref cm.TileWorkerData, allocator.Allocate<TileWorkerData>(numTileWorkers));
|
||||
cm.CheckMemError(ref cm.TileWorkerData, allocator.Allocate<TileWorkerData>(numTileWorkers));
|
||||
cm.TotalTiles = tileRows * tileCols;
|
||||
}
|
||||
|
||||
|
@ -2168,4 +2171,4 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using Ryujinx.Common.Memory;
|
||||
using Ryujinx.Common.Memory;
|
||||
using Ryujinx.Graphics.Nvdec.Vp9.Dsp;
|
||||
using Ryujinx.Graphics.Nvdec.Vp9.Types;
|
||||
using Ryujinx.Graphics.Video;
|
||||
|
@ -59,9 +59,12 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
{
|
||||
switch (maxTxSize)
|
||||
{
|
||||
case TxSize.Tx8X8: return fc.Tx8x8Prob[ctx].AsSpan();
|
||||
case TxSize.Tx16X16: return fc.Tx16x16Prob[ctx].AsSpan();
|
||||
case TxSize.Tx32X32: return fc.Tx32x32Prob[ctx].AsSpan();
|
||||
case TxSize.Tx8X8:
|
||||
return fc.Tx8x8Prob[ctx].AsSpan();
|
||||
case TxSize.Tx16X16:
|
||||
return fc.Tx16x16Prob[ctx].AsSpan();
|
||||
case TxSize.Tx32X32:
|
||||
return fc.Tx32x32Prob[ctx].AsSpan();
|
||||
default:
|
||||
Debug.Assert(false, "Invalid maxTxSize.");
|
||||
return ReadOnlySpan<byte>.Empty;
|
||||
|
@ -72,9 +75,12 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
{
|
||||
switch (maxTxSize)
|
||||
{
|
||||
case TxSize.Tx8X8: return counts.Tx8x8[ctx].AsSpan();
|
||||
case TxSize.Tx16X16: return counts.Tx16x16[ctx].AsSpan();
|
||||
case TxSize.Tx32X32: return counts.Tx32x32[ctx].AsSpan();
|
||||
case TxSize.Tx8X8:
|
||||
return counts.Tx8x8[ctx].AsSpan();
|
||||
case TxSize.Tx16X16:
|
||||
return counts.Tx16x16[ctx].AsSpan();
|
||||
case TxSize.Tx32X32:
|
||||
return counts.Tx32x32[ctx].AsSpan();
|
||||
default:
|
||||
Debug.Assert(false, "Invalid maxTxSize.");
|
||||
return Span<uint>.Empty;
|
||||
|
@ -129,13 +135,13 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
}
|
||||
}
|
||||
|
||||
Debug.Assert(segmentId >= 0 && segmentId < Constants.MaxSegments);
|
||||
Debug.Assert(segmentId is >= 0 and < Constants.MaxSegments);
|
||||
return segmentId;
|
||||
}
|
||||
|
||||
private static void SetSegmentId(ref Vp9Common cm, int miOffset, int xMis, int yMis, int segmentId)
|
||||
{
|
||||
Debug.Assert(segmentId >= 0 && segmentId < Constants.MaxSegments);
|
||||
Debug.Assert(segmentId is >= 0 and < Constants.MaxSegments);
|
||||
|
||||
for (int y = 0; y < yMis; y++)
|
||||
{
|
||||
|
@ -412,7 +418,6 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
{
|
||||
BlockSize bsize = mi.SbType;
|
||||
|
||||
|
||||
switch (bsize)
|
||||
{
|
||||
case BlockSize.Block4X4:
|
||||
|
@ -494,7 +499,8 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
ZeroPair(ref mv);
|
||||
break;
|
||||
}
|
||||
default: return false;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -609,7 +615,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
bool earlyBreak = mode != PredictionMode.NearMv;
|
||||
|
||||
// Blank the reference vector list
|
||||
mvRefList.Slice(0, Constants.MaxMvRefCandidates).Fill(new Mv());
|
||||
mvRefList[..Constants.MaxMvRefCandidates].Clear();
|
||||
|
||||
i = 0;
|
||||
if (isSub8X8 != 0)
|
||||
|
@ -760,7 +766,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
refmvCount = 1;
|
||||
}
|
||||
|
||||
Done:
|
||||
Done:
|
||||
// Clamp vectors
|
||||
for (i = 0; i < refmvCount; ++i)
|
||||
{
|
||||
|
@ -950,7 +956,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
int j = (idy * 2) + idx;
|
||||
bMode = ReadInterMode(ref cm, ref xd, ref r, interModeCtx);
|
||||
|
||||
if (bMode == PredictionMode.NearestMv || bMode == PredictionMode.NearMv)
|
||||
if (bMode is PredictionMode.NearestMv or PredictionMode.NearMv)
|
||||
{
|
||||
for (refr = 0; refr < 1 + isCompound; ++refr)
|
||||
{
|
||||
|
@ -1018,7 +1024,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
|
||||
private static PredictionMode LeftBlockMode(Ptr<ModeInfo> curMi, Ptr<ModeInfo> leftMi, int b)
|
||||
{
|
||||
if (b == 0 || b == 2)
|
||||
if (b is 0 or 2)
|
||||
{
|
||||
if (leftMi.IsNull || leftMi.Value.IsInterBlock())
|
||||
{
|
||||
|
@ -1028,13 +1034,13 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
return leftMi.Value.GetYMode(b + 1);
|
||||
}
|
||||
|
||||
Debug.Assert(b == 1 || b == 3);
|
||||
Debug.Assert(b is 1 or 3);
|
||||
return curMi.Value.Bmi[b - 1].Mode;
|
||||
}
|
||||
|
||||
private static PredictionMode AboveBlockMode(Ptr<ModeInfo> curMi, Ptr<ModeInfo> aboveMi, int b)
|
||||
{
|
||||
if (b == 0 || b == 1)
|
||||
if (b is 0 or 1)
|
||||
{
|
||||
if (aboveMi.IsNull || aboveMi.Value.IsInterBlock())
|
||||
{
|
||||
|
@ -1044,7 +1050,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
return aboveMi.Value.GetYMode(b + 2);
|
||||
}
|
||||
|
||||
Debug.Assert(b == 2 || b == 3);
|
||||
Debug.Assert(b is 2 or 3);
|
||||
return curMi.Value.Bmi[b - 2].Mode;
|
||||
}
|
||||
|
||||
|
@ -1154,4 +1160,4 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using Ryujinx.Common.Memory;
|
||||
using Ryujinx.Common.Memory;
|
||||
using Ryujinx.Graphics.Nvdec.Vp9.Common;
|
||||
using Ryujinx.Graphics.Nvdec.Vp9.Types;
|
||||
using Ryujinx.Graphics.Video;
|
||||
|
@ -29,49 +29,53 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
ReadOnlySpan<Vp9MvRef> mvsIn,
|
||||
Span<Vp9MvRef> mvsOut)
|
||||
{
|
||||
Vp9Common cm = new();
|
||||
Vp9Common cm = new()
|
||||
{
|
||||
FrameType = pictureInfo.IsKeyFrame ? FrameType.KeyFrame : FrameType.InterFrame,
|
||||
IntraOnly = pictureInfo.IntraOnly,
|
||||
|
||||
cm.FrameType = pictureInfo.IsKeyFrame ? FrameType.KeyFrame : FrameType.InterFrame;
|
||||
cm.IntraOnly = pictureInfo.IntraOnly;
|
||||
Width = output.Width,
|
||||
Height = output.Height,
|
||||
SubsamplingX = 1,
|
||||
SubsamplingY = 1,
|
||||
|
||||
cm.Width = output.Width;
|
||||
cm.Height = output.Height;
|
||||
cm.SubsamplingX = 1;
|
||||
cm.SubsamplingY = 1;
|
||||
UsePrevFrameMvs = pictureInfo.UsePrevInFindMvRefs,
|
||||
|
||||
cm.UsePrevFrameMvs = pictureInfo.UsePrevInFindMvRefs;
|
||||
RefFrameSignBias = pictureInfo.RefFrameSignBias,
|
||||
|
||||
cm.RefFrameSignBias = pictureInfo.RefFrameSignBias;
|
||||
BaseQindex = pictureInfo.BaseQIndex,
|
||||
YDcDeltaQ = pictureInfo.YDcDeltaQ,
|
||||
UvAcDeltaQ = pictureInfo.UvAcDeltaQ,
|
||||
UvDcDeltaQ = pictureInfo.UvDcDeltaQ,
|
||||
|
||||
cm.BaseQindex = pictureInfo.BaseQIndex;
|
||||
cm.YDcDeltaQ = pictureInfo.YDcDeltaQ;
|
||||
cm.UvAcDeltaQ = pictureInfo.UvAcDeltaQ;
|
||||
cm.UvDcDeltaQ = pictureInfo.UvDcDeltaQ;
|
||||
TxMode = (TxMode)pictureInfo.TransformMode,
|
||||
|
||||
AllowHighPrecisionMv = pictureInfo.AllowHighPrecisionMv,
|
||||
|
||||
InterpFilter = (byte)pictureInfo.InterpFilter,
|
||||
|
||||
ReferenceMode = (ReferenceMode)pictureInfo.ReferenceMode,
|
||||
|
||||
CompFixedRef = pictureInfo.CompFixedRef,
|
||||
CompVarRef = pictureInfo.CompVarRef,
|
||||
|
||||
BitDepth = BitDepth.Bits8,
|
||||
|
||||
Log2TileCols = pictureInfo.Log2TileCols,
|
||||
Log2TileRows = pictureInfo.Log2TileRows,
|
||||
|
||||
Fc = new Ptr<Vp9EntropyProbs>(ref pictureInfo.Entropy),
|
||||
Counts = new Ptr<Vp9BackwardUpdates>(ref pictureInfo.BackwardUpdateCounts)
|
||||
};
|
||||
|
||||
cm.Mb.Lossless = pictureInfo.Lossless;
|
||||
cm.Mb.Bd = 8;
|
||||
|
||||
cm.TxMode = (TxMode)pictureInfo.TransformMode;
|
||||
|
||||
cm.AllowHighPrecisionMv = pictureInfo.AllowHighPrecisionMv;
|
||||
|
||||
cm.InterpFilter = (byte)pictureInfo.InterpFilter;
|
||||
|
||||
if (cm.InterpFilter != Constants.Switchable)
|
||||
{
|
||||
cm.InterpFilter = LiteralToFilter[cm.InterpFilter];
|
||||
}
|
||||
|
||||
cm.ReferenceMode = (ReferenceMode)pictureInfo.ReferenceMode;
|
||||
|
||||
cm.CompFixedRef = pictureInfo.CompFixedRef;
|
||||
cm.CompVarRef = pictureInfo.CompVarRef;
|
||||
|
||||
cm.BitDepth = BitDepth.Bits8;
|
||||
|
||||
cm.Log2TileCols = pictureInfo.Log2TileCols;
|
||||
cm.Log2TileRows = pictureInfo.Log2TileRows;
|
||||
|
||||
cm.Seg.Enabled = pictureInfo.SegmentEnabled;
|
||||
cm.Seg.UpdateMap = pictureInfo.SegmentMapUpdate;
|
||||
cm.Seg.TemporalUpdate = pictureInfo.SegmentMapTemporalUpdate;
|
||||
|
@ -85,9 +89,6 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
cm.Lf.RefDeltas = pictureInfo.RefDeltas;
|
||||
cm.Lf.ModeDeltas = pictureInfo.ModeDeltas;
|
||||
|
||||
cm.Fc = new Ptr<Vp9EntropyProbs>(ref pictureInfo.Entropy);
|
||||
cm.Counts = new Ptr<Vp9BackwardUpdates>(ref pictureInfo.BackwardUpdateCounts);
|
||||
|
||||
cm.FrameRefs[0].Buf = (Surface)pictureInfo.LastReference;
|
||||
cm.FrameRefs[1].Buf = (Surface)pictureInfo.GoldenReference;
|
||||
cm.FrameRefs[2].Buf = (Surface)pictureInfo.AltReference;
|
||||
|
@ -164,4 +165,4 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
_allocator.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using Ryujinx.Common.Memory;
|
||||
using Ryujinx.Common.Memory;
|
||||
using Ryujinx.Graphics.Nvdec.Vp9.Dsp;
|
||||
using Ryujinx.Graphics.Nvdec.Vp9.Types;
|
||||
using Ryujinx.Graphics.Video;
|
||||
|
@ -48,7 +48,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
ReadOnlySpan<byte> cat6Prob = xd.Bd == 12
|
||||
? Luts.Cat6ProbHigh12
|
||||
: xd.Bd == 10
|
||||
? Luts.Cat6ProbHigh12.Slice(2)
|
||||
? Luts.Cat6ProbHigh12[2..]
|
||||
: Luts.Cat6Prob;
|
||||
int cat6Bits = xd.Bd == 12 ? 18 : xd.Bd == 10 ? 16 : 14;
|
||||
// Keep value, range, and count as locals. The compiler produces better
|
||||
|
@ -61,7 +61,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
{
|
||||
int val = -1;
|
||||
band = bandTranslate[0];
|
||||
bandTranslate = bandTranslate.Slice(1);
|
||||
bandTranslate = bandTranslate[1..];
|
||||
ref Array3<byte> prob = ref coefProbs[band][ctx];
|
||||
if (!xd.Counts.IsNull)
|
||||
{
|
||||
|
@ -98,7 +98,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
|
||||
ctx = GetCoefContext(nb, tokenCache, c);
|
||||
band = bandTranslate[0];
|
||||
bandTranslate = bandTranslate.Slice(1);
|
||||
bandTranslate = bandTranslate[1..];
|
||||
prob = ref coefProbs[band][ctx];
|
||||
}
|
||||
|
||||
|
@ -234,8 +234,8 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
ref MacroBlockDPlane pd = ref xd.Plane[plane];
|
||||
ref Array2<short> dequant = ref pd.SegDequant[segId];
|
||||
int eob;
|
||||
Span<sbyte> a = pd.AboveContext.AsSpan().Slice(x);
|
||||
Span<sbyte> l = pd.LeftContext.AsSpan().Slice(y);
|
||||
Span<sbyte> a = pd.AboveContext.AsSpan()[x..];
|
||||
Span<sbyte> l = pd.LeftContext.AsSpan()[y..];
|
||||
int ctx;
|
||||
int ctxShiftA = 0;
|
||||
int ctxShiftL = 0;
|
||||
|
@ -320,4 +320,4 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
return eob;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using Ryujinx.Common.Memory;
|
||||
using Ryujinx.Common.Memory;
|
||||
using Ryujinx.Graphics.Nvdec.Vp9.Common;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
@ -944,4 +944,4 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,4 +9,4 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
public const int SubpelShifts = 1 << SubpelBits;
|
||||
public const int SubpelTaps = 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using Ryujinx.Graphics.Nvdec.Vp9.Common;
|
||||
using Ryujinx.Graphics.Nvdec.Vp9.Common;
|
||||
|
||||
namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using Ryujinx.Graphics.Nvdec.Vp9.Common;
|
||||
using Ryujinx.Graphics.Nvdec.Vp9.Common;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
@ -114,8 +114,8 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
op[1] = WrapLow(b1);
|
||||
op[2] = WrapLow(c1);
|
||||
op[3] = WrapLow(d1);
|
||||
ip = ip.Slice(4);
|
||||
op = op.Slice(4);
|
||||
ip = ip[4..];
|
||||
op = op[4..];
|
||||
}
|
||||
|
||||
Span<int> ip2 = output;
|
||||
|
@ -137,8 +137,8 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
dest[stride * 2] = ClipPixelAdd(dest[stride * 2], WrapLow(c1));
|
||||
dest[stride * 3] = ClipPixelAdd(dest[stride * 3], WrapLow(d1));
|
||||
|
||||
ip2 = ip2.Slice(1);
|
||||
dest = dest.Slice(1);
|
||||
ip2 = ip2[1..];
|
||||
dest = dest[1..];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -165,8 +165,8 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
dest[stride * 1] = ClipPixelAdd(dest[stride * 1], e1);
|
||||
dest[stride * 2] = ClipPixelAdd(dest[stride * 2], e1);
|
||||
dest[stride * 3] = ClipPixelAdd(dest[stride * 3], e1);
|
||||
ip2 = ip2.Slice(1);
|
||||
dest = dest.Slice(1);
|
||||
ip2 = ip2[1..];
|
||||
dest = dest[1..];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -180,7 +180,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
|
||||
if ((x0 | x1 | x2 | x3) == 0)
|
||||
{
|
||||
output.Slice(0, 4).Clear();
|
||||
output[..4].Clear();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -244,8 +244,8 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
Idct4(input, outptr);
|
||||
input = input.Slice(4);
|
||||
outptr = outptr.Slice(4);
|
||||
input = input[4..];
|
||||
outptr = outptr[4..];
|
||||
}
|
||||
|
||||
// Columns
|
||||
|
@ -279,7 +279,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
dest[1] = ClipPixelAdd(dest[1], a1);
|
||||
dest[2] = ClipPixelAdd(dest[2], a1);
|
||||
dest[3] = ClipPixelAdd(dest[3], a1);
|
||||
dest = dest.Slice(stride);
|
||||
dest = dest[stride..];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -297,7 +297,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
|
||||
if ((x0 | x1 | x2 | x3 | x4 | x5 | x6 | x7) == 0)
|
||||
{
|
||||
output.Slice(0, 8).Clear();
|
||||
output[..8].Clear();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -430,8 +430,8 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
for (int i = 0; i < 8; ++i)
|
||||
{
|
||||
Idct8(input, outptr);
|
||||
input = input.Slice(8);
|
||||
outptr = outptr.Slice(8);
|
||||
input = input[8..];
|
||||
outptr = outptr[8..];
|
||||
}
|
||||
|
||||
// Then transform columns
|
||||
|
@ -466,8 +466,8 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
Idct8(input, outptr);
|
||||
input = input.Slice(8);
|
||||
outptr = outptr.Slice(8);
|
||||
input = input[8..];
|
||||
outptr = outptr[8..];
|
||||
}
|
||||
|
||||
// Then transform columns
|
||||
|
@ -501,7 +501,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
dest[i] = ClipPixelAdd(dest[i], a1);
|
||||
}
|
||||
|
||||
dest = dest.Slice(stride);
|
||||
dest = dest[stride..];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -528,7 +528,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
|
||||
if ((x0 | x1 | x2 | x3 | x4 | x5 | x6 | x7 | x8 | x9 | x10 | x11 | x12 | x13 | x14 | x15) == 0)
|
||||
{
|
||||
output.Slice(0, 16).Clear();
|
||||
output[..16].Clear();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -854,8 +854,8 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
for (int i = 0; i < 16; ++i)
|
||||
{
|
||||
Idct16(input, outptr);
|
||||
input = input.Slice(16);
|
||||
outptr = outptr.Slice(16);
|
||||
input = input[16..];
|
||||
outptr = outptr[16..];
|
||||
}
|
||||
|
||||
// Then transform columns
|
||||
|
@ -890,8 +890,8 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
for (int i = 0; i < 8; ++i)
|
||||
{
|
||||
Idct16(input, outptr);
|
||||
input = input.Slice(16);
|
||||
outptr = outptr.Slice(16);
|
||||
input = input[16..];
|
||||
outptr = outptr[16..];
|
||||
}
|
||||
|
||||
// Then transform columns
|
||||
|
@ -926,8 +926,8 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
Idct16(input, outptr);
|
||||
input = input.Slice(16);
|
||||
outptr = outptr.Slice(16);
|
||||
input = input[16..];
|
||||
outptr = outptr[16..];
|
||||
}
|
||||
|
||||
// Then transform columns
|
||||
|
@ -961,7 +961,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
dest[i] = ClipPixelAdd(dest[i], a1);
|
||||
}
|
||||
|
||||
dest = dest.Slice(stride);
|
||||
dest = dest[stride..];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1358,11 +1358,11 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
}
|
||||
else
|
||||
{
|
||||
outptr.Slice(0, 32).Clear();
|
||||
outptr[..32].Clear();
|
||||
}
|
||||
|
||||
input = input.Slice(32);
|
||||
outptr = outptr.Slice(32);
|
||||
input = input[32..];
|
||||
outptr = outptr[32..];
|
||||
}
|
||||
|
||||
// Columns
|
||||
|
@ -1397,8 +1397,8 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
for (int i = 0; i < 16; ++i)
|
||||
{
|
||||
Idct32(input, outptr);
|
||||
input = input.Slice(32);
|
||||
outptr = outptr.Slice(32);
|
||||
input = input[32..];
|
||||
outptr = outptr[32..];
|
||||
}
|
||||
|
||||
// Columns
|
||||
|
@ -1433,8 +1433,8 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
for (int i = 0; i < 8; ++i)
|
||||
{
|
||||
Idct32(input, outptr);
|
||||
input = input.Slice(32);
|
||||
outptr = outptr.Slice(32);
|
||||
input = input[32..];
|
||||
outptr = outptr[32..];
|
||||
}
|
||||
|
||||
// Columns
|
||||
|
@ -1469,7 +1469,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
dest[i] = ClipPixelAdd(dest[i], a1);
|
||||
}
|
||||
|
||||
dest = dest.Slice(stride);
|
||||
dest = dest[stride..];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1501,8 +1501,8 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
op[1] = HighbdWrapLow(b1, bd);
|
||||
op[2] = HighbdWrapLow(c1, bd);
|
||||
op[3] = HighbdWrapLow(d1, bd);
|
||||
ip = ip.Slice(4);
|
||||
op = op.Slice(4);
|
||||
ip = ip[4..];
|
||||
op = op[4..];
|
||||
}
|
||||
|
||||
ReadOnlySpan<int> ip2 = output;
|
||||
|
@ -1524,8 +1524,8 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
dest[stride * 2] = HighbdClipPixelAdd(dest[stride * 2], HighbdWrapLow(c1, bd), bd);
|
||||
dest[stride * 3] = HighbdClipPixelAdd(dest[stride * 3], HighbdWrapLow(d1, bd), bd);
|
||||
|
||||
ip2 = ip2.Slice(1);
|
||||
dest = dest.Slice(1);
|
||||
ip2 = ip2[1..];
|
||||
dest = dest[1..];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1552,8 +1552,8 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
dest[stride * 1] = HighbdClipPixelAdd(dest[stride * 1], e1, bd);
|
||||
dest[stride * 2] = HighbdClipPixelAdd(dest[stride * 2], e1, bd);
|
||||
dest[stride * 3] = HighbdClipPixelAdd(dest[stride * 3], e1, bd);
|
||||
ip2 = ip2.Slice(1);
|
||||
dest = dest.Slice(1);
|
||||
ip2 = ip2[1..];
|
||||
dest = dest[1..];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1568,13 +1568,13 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
if (DetectInvalidHighbdInput(input, 4) != 0)
|
||||
{
|
||||
Debug.Assert(false, "invalid highbd txfm input");
|
||||
output.Slice(0, 4).Clear();
|
||||
output[..4].Clear();
|
||||
return;
|
||||
}
|
||||
|
||||
if ((x0 | x1 | x2 | x3) == 0)
|
||||
{
|
||||
output.Slice(0, 4).Clear();
|
||||
output[..4].Clear();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1611,7 +1611,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
if (DetectInvalidHighbdInput(input, 4) != 0)
|
||||
{
|
||||
Debug.Assert(false, "invalid highbd txfm input");
|
||||
output.Slice(0, 4).Clear();
|
||||
output[..4].Clear();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1644,8 +1644,8 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
HighbdIdct4(input, outptr, bd);
|
||||
input = input.Slice(4);
|
||||
outptr = outptr.Slice(4);
|
||||
input = input[4..];
|
||||
outptr = outptr[4..];
|
||||
}
|
||||
|
||||
// Columns
|
||||
|
@ -1679,7 +1679,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
dest[1] = HighbdClipPixelAdd(dest[1], a1, bd);
|
||||
dest[2] = HighbdClipPixelAdd(dest[2], a1, bd);
|
||||
dest[3] = HighbdClipPixelAdd(dest[3], a1, bd);
|
||||
dest = dest.Slice(stride);
|
||||
dest = dest[stride..];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1698,13 +1698,13 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
if (DetectInvalidHighbdInput(input, 8) != 0)
|
||||
{
|
||||
Debug.Assert(false, "invalid highbd txfm input");
|
||||
output.Slice(0, 8).Clear();
|
||||
output[..8].Clear();
|
||||
return;
|
||||
}
|
||||
|
||||
if ((x0 | x1 | x2 | x3 | x4 | x5 | x6 | x7) == 0)
|
||||
{
|
||||
output.Slice(0, 8).Clear();
|
||||
output[..8].Clear();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1777,7 +1777,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
if (DetectInvalidHighbdInput(input, 8) != 0)
|
||||
{
|
||||
Debug.Assert(false, "invalid highbd txfm input");
|
||||
output.Slice(0, 8).Clear();
|
||||
output[..8].Clear();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1835,8 +1835,8 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
for (int i = 0; i < 8; ++i)
|
||||
{
|
||||
HighbdIdct8(input, outptr, bd);
|
||||
input = input.Slice(8);
|
||||
outptr = outptr.Slice(8);
|
||||
input = input[8..];
|
||||
outptr = outptr[8..];
|
||||
}
|
||||
|
||||
// Then transform columns
|
||||
|
@ -1871,8 +1871,8 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
HighbdIdct8(input, outptr, bd);
|
||||
input = input.Slice(8);
|
||||
outptr = outptr.Slice(8);
|
||||
input = input[8..];
|
||||
outptr = outptr[8..];
|
||||
}
|
||||
|
||||
// Then transform columns
|
||||
|
@ -1906,7 +1906,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
dest[i] = HighbdClipPixelAdd(dest[i], a1, bd);
|
||||
}
|
||||
|
||||
dest = dest.Slice(stride);
|
||||
dest = dest[stride..];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1933,13 +1933,13 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
if (DetectInvalidHighbdInput(input, 16) != 0)
|
||||
{
|
||||
Debug.Assert(false, "invalid highbd txfm input");
|
||||
output.Slice(0, 16).Clear();
|
||||
output[..16].Clear();
|
||||
return;
|
||||
}
|
||||
|
||||
if ((x0 | x1 | x2 | x3 | x4 | x5 | x6 | x7 | x8 | x9 | x10 | x11 | x12 | x13 | x14 | x15) == 0)
|
||||
{
|
||||
output.Slice(0, 16).Clear();
|
||||
output[..16].Clear();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2095,7 +2095,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
if (DetectInvalidHighbdInput(input, 16) != 0)
|
||||
{
|
||||
Debug.Assert(false, "invalid highbd txfm input");
|
||||
output.Slice(0, 16).Clear();
|
||||
output[..16].Clear();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2272,8 +2272,8 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
for (int i = 0; i < 16; ++i)
|
||||
{
|
||||
HighbdIdct16(input, outptr, bd);
|
||||
input = input.Slice(16);
|
||||
outptr = outptr.Slice(16);
|
||||
input = input[16..];
|
||||
outptr = outptr[16..];
|
||||
}
|
||||
|
||||
// Then transform columns
|
||||
|
@ -2308,8 +2308,8 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
for (int i = 0; i < 8; ++i)
|
||||
{
|
||||
HighbdIdct16(input, outptr, bd);
|
||||
input = input.Slice(16);
|
||||
outptr = outptr.Slice(16);
|
||||
input = input[16..];
|
||||
outptr = outptr[16..];
|
||||
}
|
||||
|
||||
// Then transform columns
|
||||
|
@ -2325,7 +2325,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
for (int j = 0; j < 16; ++j)
|
||||
{
|
||||
destT[i] = HighbdClipPixelAdd(destT[i], BitUtils.RoundPowerOfTwo(tempOut[j], 6), bd);
|
||||
destT = destT.Slice(stride);
|
||||
destT = destT[stride..];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2345,8 +2345,8 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
HighbdIdct16(input, outptr, bd);
|
||||
input = input.Slice(16);
|
||||
outptr = outptr.Slice(16);
|
||||
input = input[16..];
|
||||
outptr = outptr[16..];
|
||||
}
|
||||
|
||||
// Then transform columns
|
||||
|
@ -2380,7 +2380,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
dest[i] = HighbdClipPixelAdd(dest[i], a1, bd);
|
||||
}
|
||||
|
||||
dest = dest.Slice(stride);
|
||||
dest = dest[stride..];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2394,7 +2394,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
if (DetectInvalidHighbdInput(input, 32) != 0)
|
||||
{
|
||||
Debug.Assert(false, "invalid highbd txfm input");
|
||||
output.Slice(0, 32).Clear();
|
||||
output[..32].Clear();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2784,11 +2784,11 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
}
|
||||
else
|
||||
{
|
||||
outptr.Slice(0, 32).Clear();
|
||||
outptr[..32].Clear();
|
||||
}
|
||||
|
||||
input = input.Slice(32);
|
||||
outptr = outptr.Slice(32);
|
||||
input = input[32..];
|
||||
outptr = outptr[32..];
|
||||
}
|
||||
|
||||
// Columns
|
||||
|
@ -2823,8 +2823,8 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
for (int i = 0; i < 16; ++i)
|
||||
{
|
||||
HighbdIdct32(input, outptr, bd);
|
||||
input = input.Slice(32);
|
||||
outptr = outptr.Slice(32);
|
||||
input = input[32..];
|
||||
outptr = outptr[32..];
|
||||
}
|
||||
|
||||
// Columns
|
||||
|
@ -2840,7 +2840,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
for (int j = 0; j < 32; ++j)
|
||||
{
|
||||
destT[i] = HighbdClipPixelAdd(destT[i], BitUtils.RoundPowerOfTwo(tempOut[j], 6), bd);
|
||||
destT = destT.Slice(stride);
|
||||
destT = destT[stride..];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2860,8 +2860,8 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
for (int i = 0; i < 8; ++i)
|
||||
{
|
||||
HighbdIdct32(input, outptr, bd);
|
||||
input = input.Slice(32);
|
||||
outptr = outptr.Slice(32);
|
||||
input = input[32..];
|
||||
outptr = outptr[32..];
|
||||
}
|
||||
|
||||
// Columns
|
||||
|
@ -2896,8 +2896,8 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
dest[i] = HighbdClipPixelAdd(dest[i], a1, bd);
|
||||
}
|
||||
|
||||
dest = dest.Slice(stride);
|
||||
dest = dest[stride..];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using Ryujinx.Common.Memory;
|
||||
using Ryujinx.Common.Memory;
|
||||
using System;
|
||||
using System.Runtime.Intrinsics.X86;
|
||||
|
||||
|
@ -226,4 +226,4 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1090,4 +1090,4 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
HighBdMbLpfVerticalEdgeW(s, pitch, blimit, limit, thresh, 16, bd);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using Ryujinx.Common.Memory;
|
||||
using Ryujinx.Common.Memory;
|
||||
using System;
|
||||
using System.Runtime.Intrinsics;
|
||||
using System.Runtime.Intrinsics.X86;
|
||||
|
@ -133,8 +133,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
}
|
||||
|
||||
Vector128<byte> ff = Sse2.CompareEqual(zero, zero);
|
||||
Vector128<byte> q1P1, q0P0, p3P2, p2P1, p1P0, q3Q2, q2Q1, q1Q0, ps1Ps0, qs1Qs0;
|
||||
Vector128<byte> mask, hev;
|
||||
Vector128<byte> q1P1, q0P0, p3P2, p2P1, p1P0, q3Q2, q2Q1, q1Q0;
|
||||
|
||||
p3P2 = Sse2.UnpackLow(Sse2.LoadScalarVector128((long*)(s.ToPointer() - (3 * pitch))),
|
||||
Sse2.LoadScalarVector128((long*)(s.ToPointer() - (4 * pitch)))).AsByte();
|
||||
|
@ -149,8 +148,8 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
q1Q0 = Sse2.UnpackHigh(q0P0.AsInt64(), q1P1.AsInt64()).AsByte();
|
||||
q2Q1 = Sse2.UnpackLow(Sse2.ShiftRightLogical128BitLane(q1P1, 8).AsInt64(), q3Q2.AsInt64()).AsByte();
|
||||
|
||||
FilterHevMask(q1P1, q0P0, p3P2, p2P1, p1P0, q3Q2, q2Q1, q1Q0, limitV, threshV, out hev, out mask);
|
||||
Filter4(p1P0, q1Q0, hev, mask, ff, out ps1Ps0, out qs1Qs0);
|
||||
FilterHevMask(q1P1, q0P0, p3P2, p2P1, p1P0, q3Q2, q2Q1, q1Q0, limitV, threshV, out Vector128<byte> hev, out Vector128<byte> mask);
|
||||
Filter4(p1P0, q1Q0, hev, mask, ff, out Vector128<byte> ps1Ps0, out Vector128<byte> qs1Qs0);
|
||||
|
||||
Sse.StoreHigh((float*)(s.ToPointer() - (2 * pitch)), ps1Ps0.AsSingle()); // *op1
|
||||
Sse2.StoreScalar((long*)(s.ToPointer() - (1 * pitch)), ps1Ps0.AsInt64()); // *op0
|
||||
|
@ -178,8 +177,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
|
||||
Vector128<byte> ff = Sse2.CompareEqual(zero, zero);
|
||||
Vector128<byte> x0, x1, x2, x3;
|
||||
Vector128<byte> q1P1, q0P0, p3P2, p2P1, p1P0, q3Q2, q2Q1, q1Q0, ps1Ps0, qs1Qs0;
|
||||
Vector128<byte> mask, hev;
|
||||
Vector128<byte> q1P1, q0P0, p3P2, p2P1, p1P0, q3Q2, q2Q1, q1Q0;
|
||||
|
||||
// 00 10 01 11 02 12 03 13 04 14 05 15 06 16 07 17
|
||||
q1Q0 = Sse2.UnpackLow(
|
||||
|
@ -230,8 +228,8 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
p2P1 = Sse2.UnpackLow(q1P1.AsInt64(), p3P2.AsInt64()).AsByte();
|
||||
q2Q1 = Sse2.UnpackLow(Sse2.ShiftRightLogical128BitLane(q1P1, 8).AsInt64(), q3Q2.AsInt64()).AsByte();
|
||||
|
||||
FilterHevMask(q1P1, q0P0, p3P2, p2P1, p1P0, q3Q2, q2Q1, q1Q0, limitV, threshV, out hev, out mask);
|
||||
Filter4(p1P0, q1Q0, hev, mask, ff, out ps1Ps0, out qs1Qs0);
|
||||
FilterHevMask(q1P1, q0P0, p3P2, p2P1, p1P0, q3Q2, q2Q1, q1Q0, limitV, threshV, out Vector128<byte> hev, out Vector128<byte> mask);
|
||||
Filter4(p1P0, q1Q0, hev, mask, ff, out Vector128<byte> ps1Ps0, out Vector128<byte> qs1Qs0);
|
||||
|
||||
// Transpose 8x4 to 4x8
|
||||
// qs1qs0: 20 21 22 23 24 25 26 27 30 31 32 33 34 34 36 37
|
||||
|
@ -1262,6 +1260,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
flat = Sse2.CompareEqual(flat, zero);
|
||||
flat = Sse2.And(flat, mask);
|
||||
}
|
||||
|
||||
{
|
||||
Vector128<short> four = Vector128.Create((short)4);
|
||||
ArrayPtr<byte> src = s;
|
||||
|
@ -1834,4 +1833,4 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
Transpose8X16(tDst.Slice(8), tDst.Slice(8 + (8 * 16)), 16, s.Slice(-8 + (8 * pitch)), pitch);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using Ryujinx.Graphics.Nvdec.Vp9.Common;
|
||||
using Ryujinx.Graphics.Nvdec.Vp9.Common;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
|
||||
|
@ -68,4 +68,4 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
TreeMergeProbsImpl(0, tree, preProbs, counts, probs);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using Ryujinx.Common.Memory;
|
||||
using Ryujinx.Common.Memory;
|
||||
using Ryujinx.Graphics.Nvdec.Vp9.Types;
|
||||
using System;
|
||||
using System.Buffers.Binary;
|
||||
|
@ -63,7 +63,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
ulong bigEndianValues = BinaryPrimitives.ReadUInt64BigEndian(buffer);
|
||||
nv = bigEndianValues >> (BdValueSize - bits);
|
||||
count += bits;
|
||||
buffer = buffer.Slice(bits >> 3);
|
||||
buffer = buffer[(bits >> 3)..];
|
||||
value = Value | (nv << (shift & 0x7));
|
||||
}
|
||||
else
|
||||
|
@ -82,7 +82,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
{
|
||||
count += 8;
|
||||
value |= (ulong)buffer[0] << shift;
|
||||
buffer = buffer.Slice(1);
|
||||
buffer = buffer[1..];
|
||||
shift -= 8;
|
||||
}
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
Count = count;
|
||||
}
|
||||
|
||||
public bool HasError()
|
||||
public readonly bool HasError()
|
||||
{
|
||||
// Check if we have reached the end of the buffer.
|
||||
//
|
||||
|
@ -112,7 +112,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
//
|
||||
// 1 if we have tried to decode bits after the end of stream was encountered.
|
||||
// 0 No error.
|
||||
return Count > BdValueSize && Count < LotsOfBits;
|
||||
return Count is > BdValueSize and < LotsOfBits;
|
||||
}
|
||||
|
||||
public int Read(int prob)
|
||||
|
@ -149,6 +149,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
value <<= shift;
|
||||
count -= shift;
|
||||
}
|
||||
|
||||
Value = value;
|
||||
Count = count;
|
||||
Range = range;
|
||||
|
@ -200,14 +201,15 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
|
||||
if (value >= bigsplit)
|
||||
{
|
||||
range = range - split;
|
||||
value = value - bigsplit;
|
||||
range -= split;
|
||||
value -= bigsplit;
|
||||
{
|
||||
int shift = _norm[range];
|
||||
range <<= shift;
|
||||
value <<= shift;
|
||||
count -= shift;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -218,13 +220,14 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
value <<= shift;
|
||||
count -= shift;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public ArrayPtr<byte> FindEnd()
|
||||
{
|
||||
// Find the end of the coded buffer
|
||||
while (Count > 8 && Count < BdValueSize)
|
||||
while (Count is > 8 and < BdValueSize)
|
||||
{
|
||||
Count -= 8;
|
||||
_buffer = _buffer.Slice(-1);
|
||||
|
@ -307,4 +310,4 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,4 +51,4 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Dsp
|
|||
public const short SinPi39 = 13377;
|
||||
public const short SinPi49 = 15212;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using Ryujinx.Graphics.Nvdec.Vp9.Types;
|
||||
using Ryujinx.Graphics.Nvdec.Vp9.Types;
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
@ -620,4 +620,4 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
internal const int CoefCountSatAfterKey = 24;
|
||||
internal const int CoefMaxUpdateFactorAfterKey = 128;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using Ryujinx.Common.Memory;
|
||||
using Ryujinx.Common.Memory;
|
||||
using Ryujinx.Graphics.Nvdec.Vp9.Common;
|
||||
using Ryujinx.Graphics.Nvdec.Vp9.Types;
|
||||
using Ryujinx.Graphics.Video;
|
||||
|
@ -252,35 +252,35 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
private static readonly byte[] _defaultSingleRefP = [33, 16, 77, 74, 142, 142, 172, 170, 238, 247];
|
||||
private static readonly byte[] _defaultTxProbs = [3, 136, 37, 5, 52, 13, 20, 152, 15, 101, 100, 66];
|
||||
|
||||
static EntropyMode()
|
||||
{
|
||||
byte[][] kfPartitionProbs =
|
||||
[
|
||||
// 8x8 . 4x4
|
||||
[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
|
||||
//static EntropyMode()
|
||||
//{
|
||||
// byte[][] kfPartitionProbs =
|
||||
// [
|
||||
// // 8x8 . 4x4
|
||||
// [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
|
||||
[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
|
||||
// // 16x16 . 8x8
|
||||
// [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
|
||||
[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
|
||||
// // 32x32 . 16x16
|
||||
// [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
|
||||
[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
|
||||
];
|
||||
}
|
||||
// // 64x64 . 32x32
|
||||
// [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
|
||||
// ];
|
||||
//}
|
||||
|
||||
private static readonly byte[] _defaultSkipProbs = [192, 128, 64];
|
||||
|
||||
|
@ -296,7 +296,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
Entropy.CopyProbs(ref fc.CompInterProb, _defaultCompInterP);
|
||||
Entropy.CopyProbs(ref fc.CompRefProb, _defaultCompRefP);
|
||||
Entropy.CopyProbs(ref fc.SingleRefProb, _defaultSingleRefP);
|
||||
Entropy.CopyProbs(ref fc.Tx32x32Prob, _defaultTxProbs.AsSpan().Slice(0, 6));
|
||||
Entropy.CopyProbs(ref fc.Tx32x32Prob, _defaultTxProbs.AsSpan()[..6]);
|
||||
Entropy.CopyProbs(ref fc.Tx16x16Prob, _defaultTxProbs.AsSpan().Slice(6, 4));
|
||||
Entropy.CopyProbs(ref fc.Tx8x8Prob, _defaultTxProbs.AsSpan().Slice(10, 2));
|
||||
Entropy.CopyProbs(ref fc.SkipProb, _defaultSkipProbs);
|
||||
|
@ -387,4 +387,4 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
cm.FrameContextIdx = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using Ryujinx.Common.Memory;
|
||||
using Ryujinx.Common.Memory;
|
||||
using Ryujinx.Graphics.Nvdec.Vp9.Types;
|
||||
using Ryujinx.Graphics.Video;
|
||||
using System.Diagnostics;
|
||||
|
@ -12,7 +12,6 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
/* Symbols for coding which components are zero jointly */
|
||||
public const int Joints = 4;
|
||||
|
||||
|
||||
public static readonly sbyte[] JointTree =
|
||||
[
|
||||
-(sbyte)MvJointType.Zero, 2, -(sbyte)MvJointType.Hnzvz, 4,
|
||||
|
@ -33,12 +32,12 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
|
||||
private static bool JointVertical(MvJointType type)
|
||||
{
|
||||
return type == MvJointType.Hzvnz || type == MvJointType.Hnzvnz;
|
||||
return type is MvJointType.Hzvnz or MvJointType.Hnzvnz;
|
||||
}
|
||||
|
||||
private static bool JointHorizontal(MvJointType type)
|
||||
{
|
||||
return type == MvJointType.Hnzvz || type == MvJointType.Hnzvnz;
|
||||
return type is MvJointType.Hnzvz or MvJointType.Hnzvnz;
|
||||
}
|
||||
|
||||
private static readonly byte[] _logInBase2 =
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using Ryujinx.Common.Memory;
|
||||
using Ryujinx.Common.Memory;
|
||||
using Ryujinx.Graphics.Nvdec.Vp9.Common;
|
||||
using Ryujinx.Graphics.Nvdec.Vp9.Types;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using Ryujinx.Graphics.Nvdec.Vp9.Common;
|
||||
using Ryujinx.Graphics.Nvdec.Vp9.Common;
|
||||
using Ryujinx.Graphics.Nvdec.Vp9.Types;
|
||||
using System;
|
||||
using static Ryujinx.Graphics.Nvdec.Vp9.Dsp.InvTxfm;
|
||||
|
@ -11,7 +11,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
|
||||
private delegate void HighbdTransform1D(ReadOnlySpan<int> input, Span<int> output, int bd);
|
||||
|
||||
private struct Transform2D
|
||||
private readonly struct Transform2D
|
||||
{
|
||||
public readonly Transform1D Cols; // Vertical and horizontal
|
||||
public readonly Transform1D Rows; // Vertical and horizontal
|
||||
|
@ -23,7 +23,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
}
|
||||
}
|
||||
|
||||
private struct HighbdTransform2D
|
||||
private readonly struct HighbdTransform2D
|
||||
{
|
||||
public readonly HighbdTransform1D Cols; // Vertical and horizontal
|
||||
public readonly HighbdTransform1D Rows; // Vertical and horizontal
|
||||
|
@ -54,8 +54,8 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
_iht4[txType].Rows(input, outptr);
|
||||
input = input.Slice(4);
|
||||
outptr = outptr.Slice(4);
|
||||
input = input[4..];
|
||||
outptr = outptr[4..];
|
||||
}
|
||||
|
||||
// Inverse transform column vectors
|
||||
|
@ -95,8 +95,8 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
for (int 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
|
||||
|
@ -136,8 +136,8 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
for (int i = 0; i < 16; ++i)
|
||||
{
|
||||
ht.Rows(input, outptr);
|
||||
input = input.Slice(16);
|
||||
outptr = outptr.Slice(16);
|
||||
input = input[16..];
|
||||
outptr = outptr[16..];
|
||||
}
|
||||
|
||||
// Columns
|
||||
|
@ -305,8 +305,8 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
_highbdIht4[txType].Rows(input, outptr, bd);
|
||||
input = input.Slice(4);
|
||||
outptr = outptr.Slice(4);
|
||||
input = input[4..];
|
||||
outptr = outptr[4..];
|
||||
}
|
||||
|
||||
// Inverse transform column vectors.
|
||||
|
@ -346,8 +346,8 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
for (int 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.
|
||||
|
@ -388,8 +388,8 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
for (int 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
|
||||
|
@ -540,4 +540,4 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,4 +12,4 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,4 +11,4 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
throw new InternalErrorException(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using Ryujinx.Common.Memory;
|
||||
using Ryujinx.Common.Memory;
|
||||
using Ryujinx.Graphics.Nvdec.Vp9.Common;
|
||||
using Ryujinx.Graphics.Nvdec.Vp9.Dsp;
|
||||
using Ryujinx.Graphics.Nvdec.Vp9.Types;
|
||||
|
@ -62,7 +62,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
_curSbCol.AsSpan().Fill(-1);
|
||||
}
|
||||
|
||||
public void SyncRead(int r, int c)
|
||||
public readonly void SyncRead(int r, int c)
|
||||
{
|
||||
if (_curSbCol == null)
|
||||
{
|
||||
|
@ -84,7 +84,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
}
|
||||
}
|
||||
|
||||
public void SyncWrite(int r, int c, int sbCols)
|
||||
public readonly void SyncWrite(int r, int c, int sbCols)
|
||||
{
|
||||
if (_curSbCol == null)
|
||||
{
|
||||
|
@ -336,7 +336,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
|
||||
private static Span<LoopFilterMask> GetLfm(ref Types.LoopFilter lf, int miRow, int miCol)
|
||||
{
|
||||
return lf.Lfm.AsSpan().Slice((miCol >> 3) + ((miRow >> 3) * lf.LfmStride));
|
||||
return lf.Lfm.AsSpan()[((miCol >> 3) + ((miRow >> 3) * lf.LfmStride))..];
|
||||
}
|
||||
|
||||
// 8x8 blocks in a superblock. A "1" represents the first block in a 16x16
|
||||
|
@ -380,7 +380,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
|
||||
for (int i = 0; i < bh; i++)
|
||||
{
|
||||
MemoryMarshal.CreateSpan(ref lfm.LflY[index], 64 - index).Slice(0, bw).Fill((byte)filterLevel);
|
||||
MemoryMarshal.CreateSpan(ref lfm.LflY[index], 64 - index)[..bw].Fill((byte)filterLevel);
|
||||
index += 8;
|
||||
}
|
||||
|
||||
|
@ -445,7 +445,6 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
const ushort LeftBorderUv = 0x1111;
|
||||
const ushort AboveBorderUv = 0x000f;
|
||||
|
||||
|
||||
// The largest loopfilter we have is 16x16 so we use the 16x16 mask
|
||||
// for 32x32 transforms also.
|
||||
lfm.LeftY[(int)TxSize.Tx16X16] |= lfm.LeftY[(int)TxSize.Tx32X32];
|
||||
|
@ -775,7 +774,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
}
|
||||
|
||||
ss[0] = ss[0].Slice(8);
|
||||
lfl = lfl.Slice(1);
|
||||
lfl = lfl[1..];
|
||||
mask16X16 >>= 1;
|
||||
mask8X8 >>= 1;
|
||||
mask4X4 >>= 1;
|
||||
|
@ -903,7 +902,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
}
|
||||
|
||||
ss[0] = ss[0].Slice(8);
|
||||
lfl = lfl.Slice(1);
|
||||
lfl = lfl[1..];
|
||||
mask16X16 >>= 1;
|
||||
mask8X8 >>= 1;
|
||||
mask4X4 >>= 1;
|
||||
|
@ -1060,7 +1059,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
}
|
||||
|
||||
s = s.Slice(8 * count);
|
||||
lfl = lfl.Slice(count);
|
||||
lfl = lfl[count..];
|
||||
mask16X16 >>= count;
|
||||
mask8X8 >>= count;
|
||||
mask4X4 >>= count;
|
||||
|
@ -1222,7 +1221,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
}
|
||||
|
||||
s = s.Slice(8 * count);
|
||||
lfl = lfl.Slice(count);
|
||||
lfl = lfl[count..];
|
||||
mask16X16 >>= count;
|
||||
mask8X8 >>= count;
|
||||
mask4X4 >>= count;
|
||||
|
@ -1270,7 +1269,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
}
|
||||
|
||||
s = s.Slice(8);
|
||||
lfl = lfl.Slice(1);
|
||||
lfl = lfl[1..];
|
||||
mask16X16 >>= 1;
|
||||
mask8X8 >>= 1;
|
||||
mask4X4 >>= 1;
|
||||
|
@ -1315,7 +1314,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
}
|
||||
|
||||
s = s.Slice(8);
|
||||
lfl = lfl.Slice(1);
|
||||
lfl = lfl[1..];
|
||||
mask16X16 >>= 1;
|
||||
mask8X8 >>= 1;
|
||||
mask4X4 >>= 1;
|
||||
|
@ -1348,7 +1347,6 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
Span<int> mask4X4Int = stackalloc int[Constants.MiBlockSize];
|
||||
Span<byte> lfl = stackalloc byte[Constants.MiBlockSize * Constants.MiBlockSize];
|
||||
|
||||
|
||||
for (int r = 0; r < Constants.MiBlockSize && miRow + r < cm.MiRows; r += rowStep)
|
||||
{
|
||||
uint mask16X16C = 0;
|
||||
|
@ -1478,7 +1476,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
mask4X4C & borderMask,
|
||||
(uint)mask4X4Int[r],
|
||||
cm.LfInfo.Lfthr.AsSpan(),
|
||||
lfl.Slice(r << 3),
|
||||
lfl[(r << 3)..],
|
||||
(int)cm.BitDepth);
|
||||
}
|
||||
else
|
||||
|
@ -1491,7 +1489,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
mask4X4C & borderMask,
|
||||
(uint)mask4X4Int[r],
|
||||
cm.LfInfo.Lfthr.AsSpan(),
|
||||
lfl.Slice(r << 3));
|
||||
lfl[(r << 3)..]);
|
||||
}
|
||||
|
||||
dst.Buf = dst.Buf.Slice(8 * dst.Stride);
|
||||
|
@ -1532,7 +1530,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
mask4X4R,
|
||||
mask4X4IntR,
|
||||
cm.LfInfo.Lfthr.AsSpan(),
|
||||
lfl.Slice(r << 3),
|
||||
lfl[(r << 3)..],
|
||||
(int)cm.BitDepth);
|
||||
}
|
||||
else
|
||||
|
@ -1545,7 +1543,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
mask4X4R,
|
||||
mask4X4IntR,
|
||||
cm.LfInfo.Lfthr.AsSpan(),
|
||||
lfl.Slice(r << 3));
|
||||
lfl[(r << 3)..]);
|
||||
}
|
||||
|
||||
dst.Buf = dst.Buf.Slice(8 * dst.Stride);
|
||||
|
@ -1579,7 +1577,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
(uint)mask4X4,
|
||||
(uint)mask4X4Int,
|
||||
cm.LfInfo.Lfthr.AsSpan(),
|
||||
lfm.LflY.AsSpan().Slice(r << 3),
|
||||
lfm.LflY.AsSpan()[(r << 3)..],
|
||||
(int)cm.BitDepth);
|
||||
}
|
||||
else
|
||||
|
@ -1594,7 +1592,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
(uint)mask4X4,
|
||||
(uint)mask4X4Int,
|
||||
cm.LfInfo.Lfthr.AsSpan(),
|
||||
lfm.LflY.AsSpan().Slice(r << 3));
|
||||
lfm.LflY.AsSpan()[(r << 3)..]);
|
||||
}
|
||||
|
||||
dst.Buf = dst.Buf.Slice(16 * dst.Stride);
|
||||
|
@ -1640,7 +1638,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
mask4X4R,
|
||||
(uint)mask4X4Int & 0xff,
|
||||
cm.LfInfo.Lfthr.AsSpan(),
|
||||
lfm.LflY.AsSpan().Slice(r << 3),
|
||||
lfm.LflY.AsSpan()[(r << 3)..],
|
||||
(int)cm.BitDepth);
|
||||
}
|
||||
else
|
||||
|
@ -1653,7 +1651,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
mask4X4R,
|
||||
(uint)mask4X4Int & 0xff,
|
||||
cm.LfInfo.Lfthr.AsSpan(),
|
||||
lfm.LflY.AsSpan().Slice(r << 3));
|
||||
lfm.LflY.AsSpan()[(r << 3)..]);
|
||||
}
|
||||
|
||||
dst.Buf = dst.Buf.Slice(8 * dst.Stride);
|
||||
|
@ -1700,7 +1698,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
mask4X4,
|
||||
mask4X4Int,
|
||||
cm.LfInfo.Lfthr.AsSpan(),
|
||||
lflUv.Slice(r << 1),
|
||||
lflUv[(r << 1)..],
|
||||
(int)cm.BitDepth);
|
||||
}
|
||||
else
|
||||
|
@ -1715,7 +1713,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
mask4X4,
|
||||
mask4X4Int,
|
||||
cm.LfInfo.Lfthr.AsSpan(),
|
||||
lflUv.Slice(r << 1));
|
||||
lflUv[(r << 1)..]);
|
||||
}
|
||||
|
||||
dst.Buf = dst.Buf.Slice(16 * dst.Stride);
|
||||
|
@ -1763,7 +1761,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
mask4X4R,
|
||||
mask4X4IntR,
|
||||
cm.LfInfo.Lfthr.AsSpan(),
|
||||
lflUv.Slice(r << 1),
|
||||
lflUv[(r << 1)..],
|
||||
(int)cm.BitDepth);
|
||||
}
|
||||
else
|
||||
|
@ -1776,7 +1774,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
mask4X4R,
|
||||
mask4X4IntR,
|
||||
cm.LfInfo.Lfthr.AsSpan(),
|
||||
lflUv.Slice(r << 1));
|
||||
lflUv[(r << 1)..]);
|
||||
}
|
||||
|
||||
dst.Buf = dst.Buf.Slice(8 * dst.Stride);
|
||||
|
@ -1831,7 +1829,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
ArrayPtr<Ptr<ModeInfo>> mi = cm.MiGridVisible.Slice(miRow * cm.MiStride);
|
||||
Span<LoopFilterMask> lfm = GetLfm(ref cm.Lf, miRow, 0);
|
||||
|
||||
for (miCol = 0; miCol < cm.MiCols; miCol += Constants.MiBlockSize, lfm = lfm.Slice(1))
|
||||
for (miCol = 0; miCol < cm.MiCols; miCol += Constants.MiBlockSize, lfm = lfm[1..])
|
||||
{
|
||||
int r = miRow >> Constants.MiBlockSizeLog2;
|
||||
int c = miCol >> Constants.MiBlockSizeLog2;
|
||||
|
@ -1963,4 +1961,4 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
return new ArrayPtr<ushort>((ushort*)s.ToPointer(), s.Length / 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using Ryujinx.Common.Memory;
|
||||
using Ryujinx.Common.Memory;
|
||||
using Ryujinx.Graphics.Nvdec.Vp9.Types;
|
||||
using System;
|
||||
|
||||
|
@ -270,11 +270,11 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
|
||||
private static Array8<short> NewArray8Short(short e0, short e1, short e2, short e3, short e4, short e5, short e6, short e7)
|
||||
{
|
||||
Array8<short> output = new()
|
||||
{
|
||||
[0] = e0,
|
||||
[1] = e1,
|
||||
[2] = e2,
|
||||
Array8<short> output = new()
|
||||
{
|
||||
[0] = e0,
|
||||
[1] = e1,
|
||||
[2] = e2,
|
||||
[3] = e3,
|
||||
[4] = e4,
|
||||
[5] = e5,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using Ryujinx.Graphics.Nvdec.Vp9.Types;
|
||||
using Ryujinx.Graphics.Nvdec.Vp9.Types;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Ryujinx.Graphics.Nvdec.Vp9
|
||||
|
@ -61,7 +61,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
ctx = 1;
|
||||
}
|
||||
|
||||
Debug.Assert(ctx >= 0 && ctx < Constants.CompInterContexts);
|
||||
Debug.Assert(ctx is >= 0 and < Constants.CompInterContexts);
|
||||
return ctx;
|
||||
}
|
||||
|
||||
|
@ -186,7 +186,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
predContext = 2;
|
||||
}
|
||||
|
||||
Debug.Assert(predContext >= 0 && predContext < Constants.RefContexts);
|
||||
Debug.Assert(predContext is >= 0 and < Constants.RefContexts);
|
||||
return predContext;
|
||||
}
|
||||
|
||||
|
@ -294,7 +294,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
predContext = 2;
|
||||
}
|
||||
|
||||
Debug.Assert(predContext >= 0 && predContext < Constants.RefContexts);
|
||||
Debug.Assert(predContext is >= 0 and < Constants.RefContexts);
|
||||
return predContext;
|
||||
}
|
||||
|
||||
|
@ -430,8 +430,8 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
predContext = 2;
|
||||
}
|
||||
|
||||
Debug.Assert(predContext >= 0 && predContext < Constants.RefContexts);
|
||||
Debug.Assert(predContext is >= 0 and < Constants.RefContexts);
|
||||
return predContext;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using Ryujinx.Common.Memory;
|
||||
using Ryujinx.Common.Memory;
|
||||
using Ryujinx.Graphics.Nvdec.Vp9.Common;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
|
@ -91,4 +91,4 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
TreeMergeProbsImpl(0, tree, preProbs, counts, probs);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Ryujinx.Graphics.Nvdec.Vp9
|
||||
|
@ -117,9 +117,12 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
{
|
||||
switch (bitDepth)
|
||||
{
|
||||
case BitDepth.Bits8: return _dcQlookup[Math.Clamp(qindex + delta, 0, MaxQ)];
|
||||
case BitDepth.Bits10: return _dcQlookup10[Math.Clamp(qindex + delta, 0, MaxQ)];
|
||||
case BitDepth.Bits12: return _dcQlookup12[Math.Clamp(qindex + delta, 0, MaxQ)];
|
||||
case BitDepth.Bits8:
|
||||
return _dcQlookup[Math.Clamp(qindex + delta, 0, MaxQ)];
|
||||
case BitDepth.Bits10:
|
||||
return _dcQlookup10[Math.Clamp(qindex + delta, 0, MaxQ)];
|
||||
case BitDepth.Bits12:
|
||||
return _dcQlookup12[Math.Clamp(qindex + delta, 0, MaxQ)];
|
||||
default:
|
||||
Debug.Assert(false, "bitDepth should be Bits8, Bits10 or Bits12");
|
||||
return -1;
|
||||
|
@ -130,13 +133,16 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
{
|
||||
switch (bitDepth)
|
||||
{
|
||||
case BitDepth.Bits8: return _acQlookup[Math.Clamp(qindex + delta, 0, MaxQ)];
|
||||
case BitDepth.Bits10: return _acQlookup10[Math.Clamp(qindex + delta, 0, MaxQ)];
|
||||
case BitDepth.Bits12: return _acQlookup12[Math.Clamp(qindex + delta, 0, MaxQ)];
|
||||
case BitDepth.Bits8:
|
||||
return _acQlookup[Math.Clamp(qindex + delta, 0, MaxQ)];
|
||||
case BitDepth.Bits10:
|
||||
return _acQlookup10[Math.Clamp(qindex + delta, 0, MaxQ)];
|
||||
case BitDepth.Bits12:
|
||||
return _acQlookup12[Math.Clamp(qindex + delta, 0, MaxQ)];
|
||||
default:
|
||||
Debug.Assert(false, "bitDepth should be Bits8, Bits10 or Bits12");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using Ryujinx.Graphics.Nvdec.Vp9.Common;
|
||||
using Ryujinx.Graphics.Nvdec.Vp9.Common;
|
||||
using Ryujinx.Graphics.Nvdec.Vp9.Types;
|
||||
using System;
|
||||
|
||||
|
@ -16,7 +16,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
return data > max ? max : data;
|
||||
}
|
||||
|
||||
public ulong BytesRead()
|
||||
public readonly ulong BytesRead()
|
||||
{
|
||||
return (BitOffset + 7) >> 3;
|
||||
}
|
||||
|
@ -81,4 +81,4 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
return (BitstreamProfile)profile;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using Ryujinx.Common.Memory;
|
||||
using Ryujinx.Common.Memory;
|
||||
using Ryujinx.Graphics.Nvdec.Vp9.Types;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
|
@ -98,7 +98,8 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
int spelBottom = spelTop - SubpelShifts;
|
||||
Mv clampedMv = new()
|
||||
{
|
||||
Row = (short)(srcMv.Row * (1 << (1 - ssY))), Col = (short)(srcMv.Col * (1 << (1 - ssX)))
|
||||
Row = (short)(srcMv.Row * (1 << (1 - ssY))),
|
||||
Col = (short)(srcMv.Col * (1 << (1 - ssX)))
|
||||
};
|
||||
|
||||
Debug.Assert(ssX <= 1);
|
||||
|
@ -132,7 +133,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
res = mi.MvPredQ4(refr);
|
||||
break;
|
||||
default:
|
||||
Debug.Assert(ssIdx <= 3 && ssIdx >= 0);
|
||||
Debug.Assert(ssIdx is <= 3 and >= 0);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -213,4 +214,4 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using Ryujinx.Graphics.Nvdec.Vp9.Common;
|
||||
using Ryujinx.Graphics.Nvdec.Vp9.Common;
|
||||
using Ryujinx.Graphics.Nvdec.Vp9.Types;
|
||||
using System;
|
||||
using static Ryujinx.Graphics.Nvdec.Vp9.Dsp.IntraPred;
|
||||
|
@ -632,4 +632,4 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
plane);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,4 +8,4 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
public ArrayPtr<byte> Data;
|
||||
public int Size;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,4 +28,4 @@ namespace Ryujinx.Graphics.Nvdec.Vp9
|
|||
return (left * 2) + above + (bsl * Constants.PartitionPloffset);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,4 +7,4 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
|||
public PredictionMode Mode;
|
||||
public Array2<Mv> Mv; // First, second inter predictor motion vectors
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
||||
namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
||||
{
|
||||
public enum BitstreamProfile
|
||||
{
|
||||
|
@ -8,4 +8,4 @@
|
|||
Profile3,
|
||||
MaxProfiles
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
||||
namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
||||
{
|
||||
internal enum BlockSize
|
||||
{
|
||||
|
@ -18,4 +18,4 @@
|
|||
BlockSizes,
|
||||
BlockInvalid = BlockSizes
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,4 +7,4 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
|||
public ArrayPtr<byte> Buf;
|
||||
public int Stride;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using Ryujinx.Common.Memory;
|
||||
using Ryujinx.Common.Memory;
|
||||
|
||||
namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
||||
{
|
||||
|
@ -15,4 +15,4 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
|||
// Frame buffers allocated internally by the codec.
|
||||
public InternalFrameBufferList IntFrameBuffers;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,4 +5,4 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
|||
KeyFrame = 0,
|
||||
InterFrame = 1,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,4 +37,4 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
|||
ModeDeltas[1] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,4 +7,4 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
|||
public Array64<LoopFilterThresh> Lfthr;
|
||||
public Array8<Array4<Array2<byte>>> Lvl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,4 +21,4 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
|||
public ushort Int4X4Uv;
|
||||
public Array64<byte> LflY;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,4 +12,4 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
|||
public Array16<byte> HevThr;
|
||||
#pragma warning restore CS0649
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using Ryujinx.Common.Memory;
|
||||
using Ryujinx.Common.Memory;
|
||||
using Ryujinx.Graphics.Nvdec.Vp9.Common;
|
||||
using Ryujinx.Graphics.Video;
|
||||
|
||||
|
@ -55,7 +55,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
|||
|
||||
public Ptr<InternalErrorInfo> ErrorInfo;
|
||||
|
||||
public int GetPredContextSegId()
|
||||
public readonly int GetPredContextSegId()
|
||||
{
|
||||
sbyte aboveSip = !AboveMi.IsNull ? AboveMi.Value.SegIdPredicted : (sbyte)0;
|
||||
sbyte leftSip = !LeftMi.IsNull ? LeftMi.Value.SegIdPredicted : (sbyte)0;
|
||||
|
@ -63,14 +63,14 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
|||
return aboveSip + leftSip;
|
||||
}
|
||||
|
||||
public int GetSkipContext()
|
||||
public readonly int GetSkipContext()
|
||||
{
|
||||
int aboveSkip = !AboveMi.IsNull ? AboveMi.Value.Skip : 0;
|
||||
int leftSkip = !LeftMi.IsNull ? LeftMi.Value.Skip : 0;
|
||||
return aboveSkip + leftSkip;
|
||||
}
|
||||
|
||||
public int GetPredContextSwitchableInterp()
|
||||
public readonly int GetPredContextSwitchableInterp()
|
||||
{
|
||||
// Note:
|
||||
// The mode info data structure has a one element border above and to the
|
||||
|
@ -104,7 +104,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
|||
// 1 - intra/inter, inter/intra
|
||||
// 2 - intra/--, --/intra
|
||||
// 3 - intra/intra
|
||||
public int GetIntraInterContext()
|
||||
public readonly int GetIntraInterContext()
|
||||
{
|
||||
if (!AboveMi.IsNull && !LeftMi.IsNull)
|
||||
{
|
||||
|
@ -127,7 +127,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
|||
// The mode info data structure has a one element border above and to the
|
||||
// left of the entries corresponding to real blocks.
|
||||
// The prediction flags in these dummy entries are initialized to 0.
|
||||
public int GetTxSizeContext()
|
||||
public readonly int GetTxSizeContext()
|
||||
{
|
||||
int maxTxSize = (int)Luts.MaxTxSizeLookup[(int)Mi[0].Value.SbType];
|
||||
int aboveCtx = !AboveMi.IsNull && AboveMi.Value.Skip == 0 ? (int)AboveMi.Value.TxSize : maxTxSize;
|
||||
|
@ -190,4 +190,4 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,4 +19,4 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
|||
// Log2 of N4W, N4H
|
||||
public byte N4Wl, N4Hl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using Ryujinx.Common.Memory;
|
||||
using Ryujinx.Common.Memory;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
||||
|
@ -32,7 +32,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
|||
return SbType < BlockSize.Block8X8 ? Bmi[block].Mode : Mode;
|
||||
}
|
||||
|
||||
public TxSize GetUvTxSize(ref MacroBlockDPlane pd)
|
||||
public readonly TxSize GetUvTxSize(ref MacroBlockDPlane pd)
|
||||
{
|
||||
Debug.Assert(SbType < BlockSize.Block8X8 ||
|
||||
Luts.SsSizeLookup[(int)SbType][pd.SubsamplingX][pd.SubsamplingY] != BlockSize.BlockInvalid);
|
||||
|
@ -104,4 +104,4 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
|||
return mv;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,4 +11,4 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
|||
BothIntra = 6,
|
||||
InvalidCase = 9,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using Ryujinx.Common.Memory;
|
||||
using Ryujinx.Common.Memory;
|
||||
using Ryujinx.Graphics.Video;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
|
@ -44,7 +44,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
|||
9, 9, 9, 9, 9, 9, 9, 9, 9, 10
|
||||
];
|
||||
|
||||
public bool UseHp()
|
||||
public readonly bool UseHp()
|
||||
{
|
||||
const int KMvRefThresh = 64; // Threshold for use of high-precision 1/8 mv
|
||||
return Math.Abs(Row) < KMvRefThresh && Math.Abs(Col) < KMvRefThresh;
|
||||
|
@ -52,12 +52,12 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
|||
|
||||
public static bool JointVertical(MvJointType type)
|
||||
{
|
||||
return type == MvJointType.Hzvnz || type == MvJointType.Hnzvnz;
|
||||
return type is MvJointType.Hzvnz or MvJointType.Hnzvnz;
|
||||
}
|
||||
|
||||
public static bool JointHorizontal(MvJointType type)
|
||||
{
|
||||
return type == MvJointType.Hnzvz || type == MvJointType.Hnzvnz;
|
||||
return type is MvJointType.Hnzvz or MvJointType.Hnzvnz;
|
||||
}
|
||||
|
||||
private static int ClassBase(MvClassType c)
|
||||
|
@ -110,7 +110,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
|||
}
|
||||
}
|
||||
|
||||
public MvJointType GetJoint()
|
||||
public readonly MvJointType GetJoint()
|
||||
{
|
||||
if (Row == 0)
|
||||
{
|
||||
|
@ -120,7 +120,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
|||
return Col == 0 ? MvJointType.Hzvnz : MvJointType.Hnzvnz;
|
||||
}
|
||||
|
||||
internal void Inc(Ptr<Vp9BackwardUpdates> counts)
|
||||
internal readonly void Inc(Ptr<Vp9BackwardUpdates> counts)
|
||||
{
|
||||
if (!counts.IsNull)
|
||||
{
|
||||
|
@ -173,10 +173,10 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
|||
}
|
||||
}
|
||||
|
||||
public bool IsValid()
|
||||
public readonly bool IsValid()
|
||||
{
|
||||
return Row is > Constants.MvLow and < Constants.MvUpp &&
|
||||
Col is > Constants.MvLow and < Constants.MvUpp;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,4 +5,4 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
|||
public int Row;
|
||||
public int Col;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,4 +14,4 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
|||
Class9, /* (512, 1024] integer pel */
|
||||
Class10 /* (1024,2048] integer pel */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,4 +7,4 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
|||
Hzvnz, /* Hor zero, vert nonzero */
|
||||
Hnzvnz /* Both components nonzero */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,4 +7,4 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
|||
public Array2<Mv> Mv;
|
||||
public Array2<sbyte> RefFrame;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,4 +9,4 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
|||
PartitionTypes,
|
||||
PartitionInvalid = PartitionTypes,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
||||
namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
||||
{
|
||||
internal enum PlaneType
|
||||
{
|
||||
|
@ -6,4 +6,4 @@
|
|||
Uv,
|
||||
PlaneTypes
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,4 +11,4 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
|||
Col = col;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
||||
namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
||||
{
|
||||
internal enum PredictionMode
|
||||
{
|
||||
|
@ -18,4 +18,4 @@
|
|||
NewMv,
|
||||
MbModeCount
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,4 +8,4 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
|||
public Surface Buf;
|
||||
public ScaleFactors Sf;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
||||
namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
||||
{
|
||||
internal struct RefCntBuffer
|
||||
{
|
||||
|
@ -9,4 +9,4 @@
|
|||
public VpxCodecFrameBuffer RawFrameBuffer;
|
||||
public Surface Buf;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
||||
namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
||||
{
|
||||
internal enum ReferenceMode
|
||||
{
|
||||
|
@ -7,4 +7,4 @@
|
|||
Select,
|
||||
ReferenceModes
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using Ryujinx.Common.Memory;
|
||||
using Ryujinx.Common.Memory;
|
||||
using System.Runtime.CompilerServices;
|
||||
using static Ryujinx.Graphics.Nvdec.Vp9.Dsp.Convolve;
|
||||
using static Ryujinx.Graphics.Nvdec.Vp9.Dsp.Filter;
|
||||
|
@ -123,18 +123,18 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
|||
public int XStepQ4;
|
||||
public int YStepQ4;
|
||||
|
||||
public int ScaleValueX(int val)
|
||||
public readonly int ScaleValueX(int val)
|
||||
{
|
||||
return IsScaled() ? ScaledX(val) : val;
|
||||
}
|
||||
|
||||
public int ScaleValueY(int val)
|
||||
public readonly int ScaleValueY(int val)
|
||||
{
|
||||
return IsScaled() ? ScaledY(val) : val;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public unsafe void InterPredict(
|
||||
public readonly unsafe void InterPredict(
|
||||
int horiz,
|
||||
int vert,
|
||||
int avg,
|
||||
|
@ -182,7 +182,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
|||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public unsafe void HighbdInterPredict(
|
||||
public readonly unsafe void HighbdInterPredict(
|
||||
int horiz,
|
||||
int vert,
|
||||
int avg,
|
||||
|
@ -231,12 +231,12 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
|||
}
|
||||
}
|
||||
|
||||
private int ScaledX(int val)
|
||||
private readonly int ScaledX(int val)
|
||||
{
|
||||
return (int)(((long)val * XScaleFp) >> RefScaleShift);
|
||||
}
|
||||
|
||||
private int ScaledY(int val)
|
||||
private readonly int ScaledY(int val)
|
||||
{
|
||||
return (int)(((long)val * YScaleFp) >> RefScaleShift);
|
||||
}
|
||||
|
@ -258,12 +258,12 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
|||
return res;
|
||||
}
|
||||
|
||||
public bool IsValidScale()
|
||||
public readonly bool IsValidScale()
|
||||
{
|
||||
return XScaleFp != RefInvalidScale && YScaleFp != RefInvalidScale;
|
||||
}
|
||||
|
||||
public bool IsScaled()
|
||||
public readonly bool IsScaled()
|
||||
{
|
||||
return IsValidScale() && (XScaleFp != RefNoScale || YScaleFp != RefNoScale);
|
||||
}
|
||||
|
@ -291,4 +291,4 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
|||
YStepQ4 = ScaledY(16);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
||||
namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
||||
{
|
||||
internal enum SegLvlFeatures
|
||||
{
|
||||
|
@ -8,4 +8,4 @@
|
|||
Skip, // Optional Segment (0,0) + skip mode
|
||||
Max // Number of features supported
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using Ryujinx.Common.Memory;
|
||||
using Ryujinx.Common.Memory;
|
||||
using Ryujinx.Graphics.Video;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
|
@ -161,4 +161,4 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using Ryujinx.Common.Memory;
|
||||
using Ryujinx.Common.Memory;
|
||||
using Ryujinx.Graphics.Nvdec.Vp9.Common;
|
||||
using Ryujinx.Graphics.Video;
|
||||
using System.Diagnostics;
|
||||
|
@ -26,7 +26,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
|||
public readonly unsafe Plane UPlane => new((nint)UBuffer.ToPointer(), UBuffer.Length);
|
||||
public readonly unsafe Plane VPlane => new((nint)VBuffer.ToPointer(), VBuffer.Length);
|
||||
|
||||
public FrameField Field => FrameField.Progressive;
|
||||
public readonly FrameField Field => FrameField.Progressive;
|
||||
|
||||
public int Width { get; private set; }
|
||||
public int Height { get; private set; }
|
||||
|
@ -43,10 +43,10 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
|||
public int FrameSize { get; private set; }
|
||||
public int Border { get; private set; }
|
||||
|
||||
public int YCropWidth => Width;
|
||||
public int YCropHeight => Height;
|
||||
public int UvCropWidth => UvWidth;
|
||||
public int UvCropHeight => UvHeight;
|
||||
public readonly int YCropWidth => Width;
|
||||
public readonly int YCropHeight => Height;
|
||||
public readonly int UvCropWidth => UvWidth;
|
||||
public readonly int UvCropHeight => UvHeight;
|
||||
|
||||
public ArrayPtr<byte> BufferAlloc;
|
||||
public int BufferAllocSz;
|
||||
|
@ -119,7 +119,6 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
|||
VpxGetFrameBufferCbFnT cb,
|
||||
Ptr<InternalFrameBufferList> cbPriv)
|
||||
{
|
||||
int byteAlign = byteAlignment == 0 ? 1 : byteAlignment; // TODO: Is it safe to ignore the alignment?
|
||||
int alignedWidth = (width + 7) & ~7;
|
||||
int alignedHeight = (height + 7) & ~7;
|
||||
int yStride = (alignedWidth + (2 * border) + 31) & ~31;
|
||||
|
@ -135,8 +134,6 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
|||
|
||||
ulong frameSize = (ulong)(1 + (useHighbitdepth ? 1 : 0)) * (yplaneSize + (2 * uvplaneSize));
|
||||
|
||||
ArrayPtr<byte> buf = ArrayPtr<byte>.Null;
|
||||
|
||||
// frame_size is stored in buffer_alloc_sz, which is an int. If it won't
|
||||
// fit, fail early.
|
||||
if (frameSize > int.MaxValue)
|
||||
|
@ -211,7 +208,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
|||
SubsamplingX = ssX;
|
||||
SubsamplingY = ssY;
|
||||
|
||||
buf = BufferAlloc;
|
||||
ArrayPtr<byte> buf = BufferAlloc;
|
||||
if (useHighbitdepth)
|
||||
{
|
||||
// Store uint16 addresses when using 16bit framebuffers
|
||||
|
@ -231,7 +228,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
|||
return 0;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
public readonly void Dispose()
|
||||
{
|
||||
Marshal.FreeHGlobal(_pointer);
|
||||
}
|
||||
|
|
|
@ -83,4 +83,4 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
|||
Debug.Assert(minLog2TileCols <= maxLog2TileCols);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
||||
namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
||||
{
|
||||
public enum TxMode
|
||||
{
|
||||
|
@ -9,4 +9,4 @@
|
|||
TxModeSelect, // Transform specified for each block
|
||||
TxModes
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
||||
namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
||||
{
|
||||
public enum TxSize
|
||||
{
|
||||
|
@ -8,4 +8,4 @@
|
|||
Tx32X32, // 32x32 transform
|
||||
TxSizes
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
||||
namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
||||
{
|
||||
internal enum TxType
|
||||
{
|
||||
|
@ -8,4 +8,4 @@
|
|||
AdstAdst, // ADST in both directions
|
||||
TxTypes
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using Ryujinx.Common.Memory;
|
||||
using Ryujinx.Common.Memory;
|
||||
using Ryujinx.Graphics.Nvdec.Vp9.Common;
|
||||
using Ryujinx.Graphics.Nvdec.Vp9.Dsp;
|
||||
using Ryujinx.Graphics.Video;
|
||||
|
@ -148,7 +148,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
|||
public ArrayPtr<sbyte> AboveSegContext;
|
||||
public ArrayPtr<sbyte> AboveContext;
|
||||
|
||||
public bool FrameIsIntraOnly()
|
||||
public readonly bool FrameIsIntraOnly()
|
||||
{
|
||||
return FrameType == FrameType.KeyFrame || IntraOnly;
|
||||
}
|
||||
|
@ -166,12 +166,12 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
|||
return false;
|
||||
}
|
||||
|
||||
public ref Surface GetFrameNewBuffer()
|
||||
public readonly ref Surface GetFrameNewBuffer()
|
||||
{
|
||||
return ref BufferPool.Value.FrameBufs[NewFbIdx].Buf;
|
||||
}
|
||||
|
||||
public int GetFreeFb()
|
||||
public readonly int GetFreeFb()
|
||||
{
|
||||
ref Array12<RefCntBuffer> frameBufs = ref BufferPool.Value.FrameBufs;
|
||||
|
||||
|
@ -233,7 +233,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
|||
allocator.Allocate<TileWorkerData>((tileCols * tileRows) + (maxThreads > 1 ? maxThreads : 0));
|
||||
}
|
||||
|
||||
public void FreeTileWorkerData(MemoryAllocator allocator)
|
||||
public readonly void FreeTileWorkerData(MemoryAllocator allocator)
|
||||
{
|
||||
allocator.Free(TileWorkerData);
|
||||
}
|
||||
|
@ -357,7 +357,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
|||
}
|
||||
}
|
||||
|
||||
private void SetPartitionProbs(ref MacroBlockD xd)
|
||||
private readonly void SetPartitionProbs(ref MacroBlockD xd)
|
||||
{
|
||||
xd.PartitionProbs = FrameIsIntraOnly()
|
||||
? new ArrayPtr<Array3<byte>>(ref Fc.Value.KfPartitionProb[0], 16)
|
||||
|
@ -429,7 +429,6 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
|||
{
|
||||
ref Vp9EntropyProbs fc = ref Fc.Value;
|
||||
|
||||
|
||||
if (ReferenceMode == ReferenceMode.Select)
|
||||
{
|
||||
for (int i = 0; i < Constants.CompInterContexts; ++i)
|
||||
|
@ -490,7 +489,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
|||
}
|
||||
}
|
||||
|
||||
public void InitMvProbs()
|
||||
public readonly void InitMvProbs()
|
||||
{
|
||||
Fc.Value.Joints[0] = 32;
|
||||
Fc.Value.Joints[1] = 64;
|
||||
|
@ -684,11 +683,10 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
|||
|
||||
public void SetupTileInfo(ref ReadBitBuffer rb)
|
||||
{
|
||||
int minLog2TileCols = 0, maxLog2TileCols = 0, maxOnes;
|
||||
TileInfo.GetTileNBits(MiCols, out minLog2TileCols, out maxLog2TileCols);
|
||||
TileInfo.GetTileNBits(MiCols, out int minLog2TileCols, out int maxLog2TileCols);
|
||||
|
||||
// columns
|
||||
maxOnes = maxLog2TileCols - minLog2TileCols;
|
||||
int maxOnes = maxLog2TileCols - minLog2TileCols;
|
||||
Log2TileCols = minLog2TileCols;
|
||||
while (maxOnes-- != 0 && rb.ReadBit() != 0)
|
||||
{
|
||||
|
@ -725,7 +723,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
|||
if (ColorSpace != VpxColorSpace.Srgb)
|
||||
{
|
||||
ColorRange = (VpxColorRange)rb.ReadBit();
|
||||
if (Profile == BitstreamProfile.Profile1 || Profile == BitstreamProfile.Profile3)
|
||||
if (Profile is BitstreamProfile.Profile1 or BitstreamProfile.Profile3)
|
||||
{
|
||||
SubsamplingX = rb.ReadBit();
|
||||
SubsamplingY = rb.ReadBit();
|
||||
|
@ -748,7 +746,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
|||
else
|
||||
{
|
||||
ColorRange = VpxColorRange.Full;
|
||||
if (Profile == BitstreamProfile.Profile1 || Profile == BitstreamProfile.Profile3)
|
||||
if (Profile is BitstreamProfile.Profile1 or BitstreamProfile.Profile3)
|
||||
{
|
||||
// Note if colorspace is SRGB then 4:4:4 chroma sampling is assumed.
|
||||
// 4:2:2 or 4:4:0 chroma sampling is not allowed.
|
||||
|
@ -988,7 +986,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
|||
}
|
||||
}
|
||||
|
||||
public void DefaultCoefProbs()
|
||||
public readonly void DefaultCoefProbs()
|
||||
{
|
||||
Entropy.CopyProbs(ref Fc.Value.CoefProbs[(int)TxSize.Tx4X4], Entropy.DefaultCoefProbs4X4);
|
||||
Entropy.CopyProbs(ref Fc.Value.CoefProbs[(int)TxSize.Tx8X8], Entropy.DefaultCoefProbs8X8);
|
||||
|
@ -996,4 +994,4 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
|||
Entropy.CopyProbs(ref Fc.Value.CoefProbs[(int)TxSize.Tx32X32], Entropy.DefaultCoefProbs32X32);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using Ryujinx.Common.Memory;
|
||||
using Ryujinx.Common.Memory;
|
||||
using Ryujinx.Graphics.Nvdec.Vp9.Common;
|
||||
using Ryujinx.Graphics.Video;
|
||||
using System.Diagnostics;
|
||||
|
@ -279,9 +279,8 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
|||
ArrayPtr<byte> dataStart = data;
|
||||
CodecErr res;
|
||||
Array8<uint> frameSizes = new();
|
||||
int frameCount = 0;
|
||||
|
||||
res = Decoder.ParseSuperframeIndex(data, (ulong)data.Length, ref frameSizes, out frameCount);
|
||||
res = Decoder.ParseSuperframeIndex(data, (ulong)data.Length, ref frameSizes, out int frameCount);
|
||||
if (res != CodecErr.Ok)
|
||||
{
|
||||
return res;
|
||||
|
@ -407,4 +406,4 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
|||
return CodecErr.Ok;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using Ryujinx.Common.Memory;
|
||||
using Ryujinx.Common.Memory;
|
||||
|
||||
namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
||||
{
|
||||
|
@ -7,4 +7,4 @@ namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
|||
public ArrayPtr<byte> Data;
|
||||
public Ptr<InternalFrameBuffer> Priv;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
||||
namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
||||
{
|
||||
internal enum VpxColorRange
|
||||
{
|
||||
|
@ -8,4 +8,4 @@
|
|||
// YUV/RGB [0..255]
|
||||
Full
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
||||
namespace Ryujinx.Graphics.Nvdec.Vp9.Types
|
||||
{
|
||||
internal enum VpxColorSpace
|
||||
{
|
||||
|
@ -26,4 +26,4 @@
|
|||
// sRGB
|
||||
Srgb
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue