New NVDEC and VIC implementation (#1384)
* Initial NVDEC and VIC implementation * Update FFmpeg.AutoGen to 4.3.0 * Add nvdec dependencies for Windows * Unify some VP9 structures * Rename VP9 structure fields * Improvements to Video API * XML docs for Common.Memory * Remove now unused or redundant overloads from MemoryAccessor * NVDEC UV surface read/write scalar paths * Add FIXME comments about hacky things/stuff that will need to be fixed in the future * Cleaned up VP9 memory allocation * Remove some debug logs * Rename some VP9 structs * Remove unused struct * No need to compile Ryujinx.Graphics.Host1x with unsafe anymore * Name AsyncWorkQueue threads to make debugging easier * Make Vp9PictureInfo a ref struct * LayoutConverter no longer needs the depth argument (broken by rebase) * Pooling of VP9 buffers, plus fix a memory leak on VP9 * Really wish VS could rename projects properly... * Address feedback * Remove using * Catch OperationCanceledException * Add licensing informations * Add THIRDPARTY.md to release too Co-authored-by: Thog <me@thog.eu>
This commit is contained in:
parent
38b26cf424
commit
4d02a2d2c0
202 changed files with 20563 additions and 2567 deletions
120
Ryujinx.Graphics.Nvdec/Types/H264/PictureInfo.cs
Normal file
120
Ryujinx.Graphics.Nvdec/Types/H264/PictureInfo.cs
Normal file
|
@ -0,0 +1,120 @@
|
|||
using Ryujinx.Common.Memory;
|
||||
using Ryujinx.Graphics.Video;
|
||||
|
||||
namespace Ryujinx.Graphics.Nvdec.Types.H264
|
||||
{
|
||||
struct PictureInfo
|
||||
{
|
||||
Array18<uint> Unknown0;
|
||||
public uint BitstreamSize;
|
||||
public uint NumSlices;
|
||||
public uint Unknown50;
|
||||
public uint Unknown54;
|
||||
public uint Log2MaxPicOrderCntLsbMinus4;
|
||||
public uint DeltaPicOrderAlwaysZeroFlag;
|
||||
public uint FrameMbsOnlyFlag;
|
||||
public uint PicWidthInMbs;
|
||||
public uint PicHeightInMbs;
|
||||
public uint BlockLayout; // Not supported on T210
|
||||
public uint EntropyCodingModeFlag;
|
||||
public uint PicOrderPresentFlag;
|
||||
public uint NumRefIdxL0ActiveMinus1;
|
||||
public uint NumRefIdxL1ActiveMinus1;
|
||||
public uint DeblockingFilterControlPresentFlag;
|
||||
public uint RedundantPicCntPresentFlag;
|
||||
public uint Transform8x8ModeFlag;
|
||||
public uint LumaPitch;
|
||||
public uint ChromaPitch;
|
||||
public uint Unknown94;
|
||||
public uint LumaSecondFieldOffset;
|
||||
public uint Unknown9C;
|
||||
public uint UnknownA0;
|
||||
public uint ChromaSecondFieldOffset;
|
||||
public uint UnknownA8;
|
||||
public uint UnknownAC;
|
||||
public ulong Flags;
|
||||
public Array2<int> FieldOrderCnt;
|
||||
public Array16<ReferenceFrame> RefFrames;
|
||||
public Array6<Array16<byte>> ScalingLists4x4;
|
||||
public Array2<Array64<byte>> ScalingLists8x8;
|
||||
public byte MvcextNumInterViewRefsL0;
|
||||
public byte MvcextNumInterViewRefsL1;
|
||||
public ushort Padding2A2;
|
||||
public uint Unknown2A4;
|
||||
public uint Unknown2A8;
|
||||
public uint Unknown2AC;
|
||||
public Array16<byte> MvcextViewRefMasksL0;
|
||||
public Array16<byte> MvcextViewRefMasksL1;
|
||||
public uint Flags2;
|
||||
public Array10<uint> Unknown2D4;
|
||||
|
||||
public bool MbAdaptiveFrameFieldFlag => (Flags & (1 << 0)) != 0;
|
||||
public bool Direct8x8InferenceFlag => (Flags & (1 << 1)) != 0;
|
||||
public bool WeightedPredFlag => (Flags & (1 << 2)) != 0;
|
||||
public bool ConstrainedIntraPredFlag => (Flags & (1 << 3)) != 0;
|
||||
public bool IsReference => (Flags & (1 << 4)) != 0;
|
||||
public bool FieldPicFlag => (Flags & (1 << 5)) != 0;
|
||||
public bool BottomFieldFlag => (Flags & (1 << 6)) != 0;
|
||||
public uint Log2MaxFrameNumMinus4 => (uint)(Flags >> 8) & 0xf;
|
||||
public ushort ChromaFormatIdc => (ushort)((Flags >> 12) & 3);
|
||||
public uint PicOrderCntType => (uint)(Flags >> 14) & 3;
|
||||
public int PicInitQpMinus26 => ExtractSx(Flags, 16, 6);
|
||||
public int ChromaQpIndexOffset => ExtractSx(Flags, 22, 5);
|
||||
public int SecondChromaQpIndexOffset => ExtractSx(Flags, 27, 5);
|
||||
public uint WeightedBipredIdc => (uint)(Flags >> 32) & 3;
|
||||
public uint LumaOutputSurfaceIndex => (uint)(Flags >> 34) & 0x7f;
|
||||
public uint ChromaOutputSurfaceIndex => (uint)(Flags >> 41) & 0x1f;
|
||||
public ushort FrameNum => (ushort)(Flags >> 46);
|
||||
public bool QpprimeYZeroTransformBypassFlag => (Flags2 & (1 << 1)) != 0;
|
||||
|
||||
private static int ExtractSx(ulong packed, int lsb, int length)
|
||||
{
|
||||
return (int)((long)packed << (64 - (lsb + length)) >> (64 - length));
|
||||
}
|
||||
|
||||
public H264PictureInfo Convert()
|
||||
{
|
||||
return new H264PictureInfo()
|
||||
{
|
||||
FieldOrderCnt = FieldOrderCnt,
|
||||
IsReference = IsReference,
|
||||
ChromaFormatIdc = ChromaFormatIdc,
|
||||
FrameNum = FrameNum,
|
||||
FieldPicFlag = FieldPicFlag,
|
||||
BottomFieldFlag = BottomFieldFlag,
|
||||
NumRefFrames = 0,
|
||||
MbAdaptiveFrameFieldFlag = MbAdaptiveFrameFieldFlag,
|
||||
ConstrainedIntraPredFlag = ConstrainedIntraPredFlag,
|
||||
WeightedPredFlag = WeightedPredFlag,
|
||||
WeightedBipredIdc = WeightedBipredIdc,
|
||||
FrameMbsOnlyFlag = FrameMbsOnlyFlag != 0,
|
||||
Transform8x8ModeFlag = Transform8x8ModeFlag != 0,
|
||||
ChromaQpIndexOffset = ChromaQpIndexOffset,
|
||||
SecondChromaQpIndexOffset = SecondChromaQpIndexOffset,
|
||||
PicInitQpMinus26 = PicInitQpMinus26,
|
||||
NumRefIdxL0ActiveMinus1 = NumRefIdxL0ActiveMinus1,
|
||||
NumRefIdxL1ActiveMinus1 = NumRefIdxL1ActiveMinus1,
|
||||
Log2MaxFrameNumMinus4 = Log2MaxFrameNumMinus4,
|
||||
PicOrderCntType = PicOrderCntType,
|
||||
Log2MaxPicOrderCntLsbMinus4 = Log2MaxPicOrderCntLsbMinus4,
|
||||
DeltaPicOrderAlwaysZeroFlag = DeltaPicOrderAlwaysZeroFlag != 0,
|
||||
Direct8x8InferenceFlag = Direct8x8InferenceFlag,
|
||||
EntropyCodingModeFlag = EntropyCodingModeFlag != 0,
|
||||
PicOrderPresentFlag = PicOrderPresentFlag != 0,
|
||||
DeblockingFilterControlPresentFlag = DeblockingFilterControlPresentFlag != 0,
|
||||
RedundantPicCntPresentFlag = RedundantPicCntPresentFlag != 0,
|
||||
NumSliceGroupsMinus1 = 0,
|
||||
SliceGroupMapType = 0,
|
||||
SliceGroupChangeRateMinus1 = 0,
|
||||
FmoAsoEnable = false,
|
||||
ScalingMatrixPresent = true,
|
||||
ScalingLists4x4 = ScalingLists4x4,
|
||||
ScalingLists8x8 = ScalingLists8x8,
|
||||
FrameType = 0,
|
||||
PicWidthInMbsMinus1 = PicWidthInMbs - 1,
|
||||
PicHeightInMapUnitsMinus1 = (PicHeightInMbs >> (FrameMbsOnlyFlag != 0 ? 0 : 1)) - 1,
|
||||
QpprimeYZeroTransformBypassFlag = QpprimeYZeroTransformBypassFlag
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
10
Ryujinx.Graphics.Nvdec/Types/H264/ReferenceFrame.cs
Normal file
10
Ryujinx.Graphics.Nvdec/Types/H264/ReferenceFrame.cs
Normal file
|
@ -0,0 +1,10 @@
|
|||
namespace Ryujinx.Graphics.Nvdec.Types.H264
|
||||
{
|
||||
struct ReferenceFrame
|
||||
{
|
||||
public uint Unknown0;
|
||||
public uint Unknown4;
|
||||
public uint Unknown8;
|
||||
public uint UnknownC;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue