/ src / Ryujinx.Graphics.Nvdec / Image / SurfaceCommon.cs
SurfaceCommon.cs
 1  using Ryujinx.Graphics.Texture;
 2  using Ryujinx.Graphics.Video;
 3  using System;
 4  
 5  namespace Ryujinx.Graphics.Nvdec.Image
 6  {
 7      static class SurfaceCommon
 8      {
 9          public static int GetBlockLinearSize(int width, int height, int bytesPerPixel)
10          {
11              return SizeCalculator.GetBlockLinearTextureSize(width, height, 1, 1, 1, 1, 1, bytesPerPixel, 2, 1, 1).TotalSize;
12          }
13  
14          public static void Copy(ISurface src, ISurface dst)
15          {
16              src.YPlane.AsSpan().CopyTo(dst.YPlane.AsSpan());
17              src.UPlane.AsSpan().CopyTo(dst.UPlane.AsSpan());
18              src.VPlane.AsSpan().CopyTo(dst.VPlane.AsSpan());
19          }
20  
21          public unsafe static Span<byte> AsSpan(this Plane plane)
22          {
23              return new Span<byte>((void*)plane.Pointer, plane.Length);
24          }
25      }
26  }