diff options
author | gdkchan <gab.dark.100@gmail.com> | 2022-03-23 17:09:32 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-23 17:09:32 -0300 |
commit | 1402d8391d84f912110104e3e6c1a50a8c000d59 (patch) | |
tree | 20c22eb021a92d0256c45ba676d05a7504460bfa /Ryujinx.Graphics.Vic/Image/InputSurface.cs | |
parent | e3b36db71c62a34a26b30683dd5ad5410c97cc9c (diff) |
Support NVDEC H264 interlaced video decoding and VIC deinterlacing (#3225)1.1.84
* Support NVDEC H264 interlaced video decoding and VIC deinterlacing
* Remove unused code
Diffstat (limited to 'Ryujinx.Graphics.Vic/Image/InputSurface.cs')
-rw-r--r-- | Ryujinx.Graphics.Vic/Image/InputSurface.cs | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/Ryujinx.Graphics.Vic/Image/InputSurface.cs b/Ryujinx.Graphics.Vic/Image/InputSurface.cs index de003194..15ac0460 100644 --- a/Ryujinx.Graphics.Vic/Image/InputSurface.cs +++ b/Ryujinx.Graphics.Vic/Image/InputSurface.cs @@ -2,16 +2,85 @@ namespace Ryujinx.Graphics.Vic.Image { + ref struct RentedBuffer + { + public static RentedBuffer Empty => new RentedBuffer(Span<byte>.Empty, -1); + + public Span<byte> Data; + public int Index; + + public RentedBuffer(Span<byte> data, int index) + { + Data = data; + Index = index; + } + + public void Return(BufferPool<byte> pool) + { + if (Index != -1) + { + pool.Return(Index); + } + } + } + ref struct InputSurface { public ReadOnlySpan<byte> Buffer0; public ReadOnlySpan<byte> Buffer1; public ReadOnlySpan<byte> Buffer2; + public int Buffer0Index; + public int Buffer1Index; + public int Buffer2Index; + public int Width; public int Height; public int UvWidth; public int UvHeight; + + public void Initialize() + { + Buffer0Index = -1; + Buffer1Index = -1; + Buffer2Index = -1; + } + + public void SetBuffer0(RentedBuffer buffer) + { + Buffer0 = buffer.Data; + Buffer0Index = buffer.Index; + } + + public void SetBuffer1(RentedBuffer buffer) + { + Buffer1 = buffer.Data; + Buffer1Index = buffer.Index; + } + + public void SetBuffer2(RentedBuffer buffer) + { + Buffer2 = buffer.Data; + Buffer2Index = buffer.Index; + } + + public void Return(BufferPool<byte> pool) + { + if (Buffer0Index != -1) + { + pool.Return(Buffer0Index); + } + + if (Buffer1Index != -1) + { + pool.Return(Buffer1Index); + } + + if (Buffer2Index != -1) + { + pool.Return(Buffer2Index); + } + } } } |