From 07fc3ded687fd1321f9ae73d0c72b2d7566c87d5 Mon Sep 17 00:00:00 2001 From: TSRBerry <20988865+TSRBerry@users.noreply.github.com> Date: Sun, 25 Jun 2023 21:44:42 +0200 Subject: [Ryujinx.Graphics.Nvdec] Address dotnet-format issues (#5369) * dotnet format style --severity info Some changes were manually reverted. * Restore a few unused methods and variables * Address most dotnet format whitespace warnings * Apply dotnet format whitespace formatting A few of them have been manually reverted and the corresponding warning was silenced * Add previously silenced warnings back I have no clue how these disappeared * Add comments to disabled warnings * Simplify properties and array initialization, Use const when possible, Remove trailing commas * Address IDE0251 warnings * Revert "Simplify properties and array initialization, Use const when possible, Remove trailing commas" This reverts commit 9462e4136c0a2100dc28b20cf9542e06790aa67e. * dotnet format whitespace after rebase * First dotnet format pass --- .../Types/H264/PictureInfo.cs | 39 +++++++++++----------- .../Types/H264/ReferenceFrame.cs | 4 +-- 2 files changed, 22 insertions(+), 21 deletions(-) (limited to 'src/Ryujinx.Graphics.Nvdec/Types/H264') diff --git a/src/Ryujinx.Graphics.Nvdec/Types/H264/PictureInfo.cs b/src/Ryujinx.Graphics.Nvdec/Types/H264/PictureInfo.cs index 7c779dff..c0e0a463 100644 --- a/src/Ryujinx.Graphics.Nvdec/Types/H264/PictureInfo.cs +++ b/src/Ryujinx.Graphics.Nvdec/Types/H264/PictureInfo.cs @@ -5,8 +5,9 @@ namespace Ryujinx.Graphics.Nvdec.Types.H264 { struct PictureInfo { -#pragma warning disable CS0169, CS0649 +#pragma warning disable IDE0051, CS0169, CS0649 // Remove unused private member Array18 Unknown0; +#pragma warning restore IDE0051 public uint BitstreamSize; public uint NumSlices; public uint Unknown50; @@ -50,24 +51,24 @@ namespace Ryujinx.Graphics.Nvdec.Types.H264 public Array10 Unknown2D4; #pragma warning restore CS0169, CS0649 - 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 OutputSurfaceIndex => (uint)(Flags >> 34) & 0x7f; - public uint ColIndex => (uint)(Flags >> 41) & 0x1f; - public ushort FrameNum => (ushort)(Flags >> 46); - public bool QpprimeYZeroTransformBypassFlag => (Flags2 & (1 << 1)) != 0; + public readonly bool MbAdaptiveFrameFieldFlag => (Flags & (1 << 0)) != 0; + public readonly bool Direct8x8InferenceFlag => (Flags & (1 << 1)) != 0; + public readonly bool WeightedPredFlag => (Flags & (1 << 2)) != 0; + public readonly bool ConstrainedIntraPredFlag => (Flags & (1 << 3)) != 0; + public readonly bool IsReference => (Flags & (1 << 4)) != 0; + public readonly bool FieldPicFlag => (Flags & (1 << 5)) != 0; + public readonly bool BottomFieldFlag => (Flags & (1 << 6)) != 0; + public readonly uint Log2MaxFrameNumMinus4 => (uint)(Flags >> 8) & 0xf; + public readonly ushort ChromaFormatIdc => (ushort)((Flags >> 12) & 3); + public readonly uint PicOrderCntType => (uint)(Flags >> 14) & 3; + public readonly int PicInitQpMinus26 => ExtractSx(Flags, 16, 6); + public readonly int ChromaQpIndexOffset => ExtractSx(Flags, 22, 5); + public readonly int SecondChromaQpIndexOffset => ExtractSx(Flags, 27, 5); + public readonly uint WeightedBipredIdc => (uint)(Flags >> 32) & 3; + public readonly uint OutputSurfaceIndex => (uint)(Flags >> 34) & 0x7f; + public readonly uint ColIndex => (uint)(Flags >> 41) & 0x1f; + public readonly ushort FrameNum => (ushort)(Flags >> 46); + public readonly bool QpprimeYZeroTransformBypassFlag => (Flags2 & (1 << 1)) != 0; private static int ExtractSx(ulong packed, int lsb, int length) { diff --git a/src/Ryujinx.Graphics.Nvdec/Types/H264/ReferenceFrame.cs b/src/Ryujinx.Graphics.Nvdec/Types/H264/ReferenceFrame.cs index d205a47a..9ab9d132 100644 --- a/src/Ryujinx.Graphics.Nvdec/Types/H264/ReferenceFrame.cs +++ b/src/Ryujinx.Graphics.Nvdec/Types/H264/ReferenceFrame.cs @@ -4,12 +4,12 @@ namespace Ryujinx.Graphics.Nvdec.Types.H264 { struct ReferenceFrame { -#pragma warning disable CS0649 +#pragma warning disable CS0649 // Field is never assigned to public uint Flags; public Array2 FieldOrderCnt; public uint FrameNum; #pragma warning restore CS0649 - public uint OutputSurfaceIndex => (uint)Flags & 0x7f; + public readonly uint OutputSurfaceIndex => (uint)Flags & 0x7f; } } -- cgit v1.2.3