diff options
Diffstat (limited to 'src/Ryujinx.Graphics.Nvdec.Vp9/ReconIntra.cs')
-rw-r--r-- | src/Ryujinx.Graphics.Nvdec.Vp9/ReconIntra.cs | 136 |
1 files changed, 66 insertions, 70 deletions
diff --git a/src/Ryujinx.Graphics.Nvdec.Vp9/ReconIntra.cs b/src/Ryujinx.Graphics.Nvdec.Vp9/ReconIntra.cs index e346c01d..270ff8b7 100644 --- a/src/Ryujinx.Graphics.Nvdec.Vp9/ReconIntra.cs +++ b/src/Ryujinx.Graphics.Nvdec.Vp9/ReconIntra.cs @@ -7,18 +7,17 @@ namespace Ryujinx.Graphics.Nvdec.Vp9 { internal static class ReconIntra { - public static readonly TxType[] IntraModeToTxTypeLookup = new TxType[] - { - TxType.DctDct, // DC - TxType.AdstDct, // V - TxType.DctAdst, // H - TxType.DctDct, // D45 - TxType.AdstAdst, // D135 - TxType.AdstDct, // D117 - TxType.DctAdst, // D153 - TxType.DctAdst, // D207 - TxType.AdstDct, // D63 - TxType.AdstAdst // TM + public static readonly TxType[] IntraModeToTxTypeLookup = { + TxType.DctDct, // DC + TxType.AdstDct, // V + TxType.DctAdst, // H + TxType.DctDct, // D45 + TxType.AdstAdst, // D135 + TxType.AdstDct, // D117 + TxType.DctAdst, // D153 + TxType.DctAdst, // D207 + TxType.AdstDct, // D63 + TxType.AdstAdst, // TM }; private const int NeedLeft = 1 << 1; @@ -27,244 +26,240 @@ namespace Ryujinx.Graphics.Nvdec.Vp9 private static ReadOnlySpan<byte> ExtendModes => new byte[] { - NeedAbove | NeedLeft, // DC - NeedAbove, // V - NeedLeft, // H - NeedAboveRight, // D45 - NeedLeft | NeedAbove, // D135 - NeedLeft | NeedAbove, // D117 - NeedLeft | NeedAbove, // D153 - NeedLeft, // D207 - NeedAboveRight, // D63 - NeedLeft | NeedAbove, // TM + NeedAbove | NeedLeft, // DC + NeedAbove, // V + NeedLeft, // H + NeedAboveRight, // D45 + NeedLeft | NeedAbove, // D135 + NeedLeft | NeedAbove, // D117 + NeedLeft | NeedAbove, // D153 + NeedLeft, // D207 + NeedAboveRight, // D63 + NeedLeft | NeedAbove, // TM }; private unsafe delegate void IntraPredFn(byte* dst, int stride, byte* above, byte* left); - private static unsafe IntraPredFn[][] _pred = new IntraPredFn[][] - { + private static readonly unsafe IntraPredFn[][] _pred = { new IntraPredFn[] { null, null, null, - null + null, }, new IntraPredFn[] { VPredictor4x4, VPredictor8x8, VPredictor16x16, - VPredictor32x32 + VPredictor32x32, }, new IntraPredFn[] { HPredictor4x4, HPredictor8x8, HPredictor16x16, - HPredictor32x32 + HPredictor32x32, }, new IntraPredFn[] { D45Predictor4x4, D45Predictor8x8, D45Predictor16x16, - D45Predictor32x32 + D45Predictor32x32, }, new IntraPredFn[] { D135Predictor4x4, D135Predictor8x8, D135Predictor16x16, - D135Predictor32x32 + D135Predictor32x32, }, new IntraPredFn[] { D117Predictor4x4, D117Predictor8x8, D117Predictor16x16, - D117Predictor32x32 + D117Predictor32x32, }, new IntraPredFn[] { D153Predictor4x4, D153Predictor8x8, D153Predictor16x16, - D153Predictor32x32 + D153Predictor32x32, }, new IntraPredFn[] { D207Predictor4x4, D207Predictor8x8, D207Predictor16x16, - D207Predictor32x32 + D207Predictor32x32, }, new IntraPredFn[] { D63Predictor4x4, D63Predictor8x8, D63Predictor16x16, - D63Predictor32x32 + D63Predictor32x32, }, new IntraPredFn[] { TMPredictor4x4, TMPredictor8x8, TMPredictor16x16, - TMPredictor32x32 - } + TMPredictor32x32, + }, }; - private static unsafe IntraPredFn[][][] _dcPred = new IntraPredFn[][][] - { - new IntraPredFn[][] + private static readonly unsafe IntraPredFn[][][] _dcPred = { + new[] { new IntraPredFn[] { Dc128Predictor4x4, Dc128Predictor8x8, Dc128Predictor16x16, - Dc128Predictor32x32 + Dc128Predictor32x32, }, new IntraPredFn[] { DcTopPredictor4x4, DcTopPredictor8x8, DcTopPredictor16x16, - DcTopPredictor32x32 - } + DcTopPredictor32x32, + }, }, - new IntraPredFn[][] + new[] { new IntraPredFn[] { DcLeftPredictor4x4, DcLeftPredictor8x8, DcLeftPredictor16x16, - DcLeftPredictor32x32 + DcLeftPredictor32x32, }, new IntraPredFn[] { DcPredictor4x4, DcPredictor8x8, DcPredictor16x16, - DcPredictor32x32 - } - } + DcPredictor32x32, + }, + }, }; private unsafe delegate void IntraHighPredFn(ushort* dst, int stride, ushort* above, ushort* left, int bd); - private static unsafe IntraHighPredFn[][] _predHigh = new IntraHighPredFn[][] - { + private static readonly unsafe IntraHighPredFn[][] _predHigh = { new IntraHighPredFn[] { null, null, null, - null + null, }, new IntraHighPredFn[] { HighbdVPredictor4x4, HighbdVPredictor8x8, HighbdVPredictor16x16, - HighbdVPredictor32x32 + HighbdVPredictor32x32, }, new IntraHighPredFn[] { HighbdHPredictor4x4, HighbdHPredictor8x8, HighbdHPredictor16x16, - HighbdHPredictor32x32 + HighbdHPredictor32x32, }, new IntraHighPredFn[] { HighbdD45Predictor4x4, HighbdD45Predictor8x8, HighbdD45Predictor16x16, - HighbdD45Predictor32x32 + HighbdD45Predictor32x32, }, new IntraHighPredFn[] { HighbdD135Predictor4x4, HighbdD135Predictor8x8, HighbdD135Predictor16x16, - HighbdD135Predictor32x32 + HighbdD135Predictor32x32, }, new IntraHighPredFn[] { HighbdD117Predictor4x4, HighbdD117Predictor8x8, HighbdD117Predictor16x16, - HighbdD117Predictor32x32 + HighbdD117Predictor32x32, }, new IntraHighPredFn[] { HighbdD153Predictor4x4, HighbdD153Predictor8x8, HighbdD153Predictor16x16, - HighbdD153Predictor32x32 + HighbdD153Predictor32x32, }, new IntraHighPredFn[] { HighbdD207Predictor4x4, HighbdD207Predictor8x8, HighbdD207Predictor16x16, - HighbdD207Predictor32x32 + HighbdD207Predictor32x32, }, new IntraHighPredFn[] { HighbdD63Predictor4x4, HighbdD63Predictor8x8, HighbdD63Predictor16x16, - HighbdD63Predictor32x32 + HighbdD63Predictor32x32, }, new IntraHighPredFn[] { HighbdTMPredictor4x4, HighbdTMPredictor8x8, HighbdTMPredictor16x16, - HighbdTMPredictor32x32 - } + HighbdTMPredictor32x32, + }, }; - private static unsafe IntraHighPredFn[][][] _dcPredHigh = new IntraHighPredFn[][][] - { - new IntraHighPredFn[][] + private static readonly unsafe IntraHighPredFn[][][] _dcPredHigh = { + new[] { new IntraHighPredFn[] { HighbdDc128Predictor4x4, HighbdDc128Predictor8x8, HighbdDc128Predictor16x16, - HighbdDc128Predictor32x32 + HighbdDc128Predictor32x32, }, new IntraHighPredFn[] { HighbdDcTopPredictor4x4, HighbdDcTopPredictor8x8, HighbdDcTopPredictor16x16, - HighbdDcTopPredictor32x32 - } + HighbdDcTopPredictor32x32, + }, }, - new IntraHighPredFn[][] + new[] { new IntraHighPredFn[] { HighbdDcLeftPredictor4x4, HighbdDcLeftPredictor8x8, HighbdDcLeftPredictor16x16, - HighbdDcLeftPredictor32x32 + HighbdDcLeftPredictor32x32, }, new IntraHighPredFn[] { HighbdDcPredictor4x4, HighbdDcPredictor8x8, HighbdDcPredictor16x16, - HighbdDcPredictor32x32 - } - } + HighbdDcPredictor32x32, + }, + }, }; private static unsafe void BuildIntraPredictorsHigh( @@ -741,6 +736,7 @@ namespace Ryujinx.Graphics.Nvdec.Vp9 x, y, plane); + return; } BuildIntraPredictors( |