1
0
Fork 0
mirror of https://github.com/Ryujinx/Ryujinx.git synced 2024-11-14 03:36:40 +00:00
Ryujinx/Ryujinx.Graphics.Nvdec/Image/SurfaceCommon.cs

27 lines
819 B
C#
Raw Normal View History

using Ryujinx.Graphics.Texture;
using Ryujinx.Graphics.Video;
using System;
namespace Ryujinx.Graphics.Nvdec.Image
{
static class SurfaceCommon
{
public static int GetBlockLinearSize(int width, int height, int bytesPerPixel)
{
return SizeCalculator.GetBlockLinearTextureSize(width, height, 1, 1, 1, 1, 1, bytesPerPixel, 2, 1, 1).TotalSize;
}
public static void Copy(ISurface src, ISurface dst)
{
src.YPlane.AsSpan().CopyTo(dst.YPlane.AsSpan());
src.UPlane.AsSpan().CopyTo(dst.UPlane.AsSpan());
src.VPlane.AsSpan().CopyTo(dst.VPlane.AsSpan());
}
public unsafe static Span<byte> AsSpan(this Plane plane)
{
return new Span<byte>((void*)plane.Pointer, plane.Length);
}
}
}