From 7dce9d949758bf16fab80e9938dfbba732413081 Mon Sep 17 00:00:00 2001 From: antonfirsov Date: Fri, 10 Apr 2026 00:42:57 +0200 Subject: [PATCH] test additional processors --- .../ProcessorThroughputTest.cs | 42 ++++++++++++++++++- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/tests/ImageSharp.Tests.ProfilingSandbox/ProcessorThroughputTest.cs b/tests/ImageSharp.Tests.ProfilingSandbox/ProcessorThroughputTest.cs index d94aaf1ba5..31a484ee3b 100644 --- a/tests/ImageSharp.Tests.ProfilingSandbox/ProcessorThroughputTest.cs +++ b/tests/ImageSharp.Tests.ProfilingSandbox/ProcessorThroughputTest.cs @@ -49,7 +49,12 @@ public sealed class ProcessorThroughputTest Func action = this.options.Method switch { Method.Crop => this.Crop, - _ => this.DetectEdges, + Method.Edges => this.DetectEdges, + Method.DrawImage => this.DrawImage, + Method.BinaryThreshold => this.BinaryThreshold, + Method.Histogram => this.Histogram, + Method.OilPaint => this.OilPaint, + _ => throw new NotImplementedException(), }; Console.WriteLine(this.options); @@ -120,6 +125,13 @@ public sealed class ProcessorThroughputTest Console.WriteLine($"MegaPixelsPerSec: {megapixelsPerSec:F2}"); } + private int OilPaint() + { + using Image image = new(this.options.Width, this.options.Height); + image.Mutate(this.configuration, x => x.OilPaint()); + return image.Width * image.Height; + } + private int DetectEdges() { using Image image = new(this.options.Width, this.options.Height); @@ -136,10 +148,36 @@ public sealed class ProcessorThroughputTest return image.Width * image.Height; } + private int DrawImage() + { + using Image image = new(this.options.Width, this.options.Height); + using Image foreground = new(this.options.Width, this.options.Height); + image.Mutate(c => c.DrawImage(foreground, 0.5f)); + return image.Width * image.Height; + } + + private int BinaryThreshold() + { + using Image image = new(this.options.Width, this.options.Height); + image.Mutate(c => c.BinaryThreshold(0.5f)); + return image.Width * image.Height; + } + + private int Histogram() + { + using Image image = new(this.options.Width, this.options.Height); + image.Mutate(c => c.HistogramEqualization()); + return image.Width * image.Height; + } + private enum Method { Edges, - Crop + Crop, + DrawImage, + BinaryThreshold, + Histogram, + OilPaint } private sealed class CommandLineOptions