From d1604aa762a3f669a3fecff0a30b7360399954bc Mon Sep 17 00:00:00 2001 From: Ac_K Date: Tue, 12 Oct 2021 22:55:57 +0200 Subject: nvdec: Adding Vp8 codec support (#2707) * first try * second try * working update * Final impl * Fixes nits * Fix everything * remove leftover * Update FFmpegContext.cs * Update Surface.cs * Addresses gdkchan feedback * bool not byte * Addresses gdkchan feedback --- Ryujinx.Graphics.Nvdec.H264/Decoder.cs | 55 ---------------------------------- 1 file changed, 55 deletions(-) delete mode 100644 Ryujinx.Graphics.Nvdec.H264/Decoder.cs (limited to 'Ryujinx.Graphics.Nvdec.H264/Decoder.cs') diff --git a/Ryujinx.Graphics.Nvdec.H264/Decoder.cs b/Ryujinx.Graphics.Nvdec.H264/Decoder.cs deleted file mode 100644 index fed64af4..00000000 --- a/Ryujinx.Graphics.Nvdec.H264/Decoder.cs +++ /dev/null @@ -1,55 +0,0 @@ -using Ryujinx.Graphics.Video; -using System; - -namespace Ryujinx.Graphics.Nvdec.H264 -{ - public sealed class Decoder : IH264Decoder - { - public bool IsHardwareAccelerated => false; - - private const int WorkBufferSize = 0x200; - - private readonly byte[] _workBuffer = new byte[WorkBufferSize]; - - private FFmpegContext _context = new FFmpegContext(); - - private int _oldOutputWidth; - private int _oldOutputHeight; - - public ISurface CreateSurface(int width, int height) - { - return new Surface(width, height); - } - - public bool Decode(ref H264PictureInfo pictureInfo, ISurface output, ReadOnlySpan bitstream) - { - Surface outSurf = (Surface)output; - - if (outSurf.RequestedWidth != _oldOutputWidth || - outSurf.RequestedHeight != _oldOutputHeight) - { - _context.Dispose(); - _context = new FFmpegContext(); - - _oldOutputWidth = outSurf.RequestedWidth; - _oldOutputHeight = outSurf.RequestedHeight; - } - - Span bs = Prepend(bitstream, SpsAndPpsReconstruction.Reconstruct(ref pictureInfo, _workBuffer)); - - return _context.DecodeFrame(outSurf, bs) == 0; - } - - private static byte[] Prepend(ReadOnlySpan data, ReadOnlySpan prep) - { - byte[] output = new byte[data.Length + prep.Length]; - - prep.CopyTo(output); - data.CopyTo(new Span(output).Slice(prep.Length)); - - return output; - } - - public void Dispose() => _context.Dispose(); - } -} -- cgit v1.2.3