mirror of
https://github.com/rosenbjerg/FFMpegCore.git
synced 2025-01-18 12:36:44 +00:00
Improved SkiaSharp CreateVideoFrame performance
Execution time is now approximately one fifth of what it was previously
This commit is contained in:
parent
317ba47dd2
commit
5593bc4a4b
1 changed files with 3 additions and 6 deletions
|
@ -50,12 +50,9 @@ public static Extensions.SkiaSharp.BitmapVideoFrameWrapper CreateVideoFrame(int
|
|||
{
|
||||
var bitmap = new SKBitmap(w, h, fmt, SKAlphaType.Opaque);
|
||||
|
||||
using var bitmapCanvas = new SKCanvas(bitmap);
|
||||
foreach (var (x, y, red, green, blue) in GenerateVideoFramePixels(index, w, h, scaleNoise, offset))
|
||||
{
|
||||
var color = new SKColor(red, blue, green);
|
||||
bitmapCanvas.DrawPoint(x, y, color);
|
||||
}
|
||||
bitmap.Pixels = GenerateVideoFramePixels(index, w, h, scaleNoise, offset)
|
||||
.Select(args => new SKColor(args.red, args.blue, args.green))
|
||||
.ToArray();
|
||||
|
||||
return new Extensions.SkiaSharp.BitmapVideoFrameWrapper(bitmap);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue