Skip to content

Commit 418f9c3

Browse files
Merge branch 'main' into js/parallel-cleanup
2 parents 3a87933 + 988314a commit 418f9c3

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

tests/ImageSharp.Tests.ProfilingSandbox/ProcessorThroughputBenchmark.cs

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using CommandLine.Text;
77
using SixLabors.ImageSharp.PixelFormats;
88
using SixLabors.ImageSharp.Processing;
9+
using SixLabors.ImageSharp.Processing.Processors.Convolution;
910

1011
namespace SixLabors.ImageSharp.Tests.ProfilingSandbox;
1112

@@ -49,10 +50,12 @@ private async Task RunAsync()
4950
{
5051
Method.Crop => this.Crop,
5152
Method.Edges => this.DetectEdges,
53+
Method.EdgesCompass => this.EdgesCompass,
5254
Method.DrawImage => this.DrawImage,
5355
Method.BinaryThreshold => this.BinaryThreshold,
5456
Method.Histogram => this.Histogram,
5557
Method.OilPaint => this.OilPaint,
58+
Method.GaussianBlur => this.GaussianBlur,
5659
_ => throw new NotImplementedException(),
5760
};
5861

@@ -138,6 +141,13 @@ private int DetectEdges()
138141
return image.Width * image.Height;
139142
}
140143

144+
private int EdgesCompass()
145+
{
146+
using Image<Rgba32> image = new(this.options.Width, this.options.Height);
147+
image.Mutate(this.configuration, x => x.DetectEdges(EdgeDetectorCompassKernel.Kirsch));
148+
return image.Width * image.Height;
149+
}
150+
141151
private int Crop()
142152
{
143153
using Image<Rgba32> image = new(this.options.Width, this.options.Height);
@@ -151,32 +161,41 @@ private int DrawImage()
151161
{
152162
using Image<Rgba32> image = new(this.options.Width, this.options.Height);
153163
using Image<Rgba32> foreground = new(this.options.Width, this.options.Height);
154-
image.Mutate(c => c.DrawImage(foreground, 0.5f));
164+
image.Mutate(this.configuration, c => c.DrawImage(foreground, 0.5f));
155165
return image.Width * image.Height;
156166
}
157167

158168
private int BinaryThreshold()
159169
{
160170
using Image<Rgba32> image = new(this.options.Width, this.options.Height);
161-
image.Mutate(c => c.BinaryThreshold(0.5f));
171+
image.Mutate(this.configuration, c => c.BinaryThreshold(0.5f));
162172
return image.Width * image.Height;
163173
}
164174

165175
private int Histogram()
166176
{
167177
using Image<Rgba32> image = new(this.options.Width, this.options.Height);
168-
image.Mutate(c => c.HistogramEqualization());
178+
image.Mutate(this.configuration, c => c.HistogramEqualization());
179+
return image.Width * image.Height;
180+
}
181+
182+
private int GaussianBlur()
183+
{
184+
using Image<Rgba32> image = new(this.options.Width, this.options.Height);
185+
image.Mutate(this.configuration, c => c.GaussianBlur());
169186
return image.Width * image.Height;
170187
}
171188

172189
private enum Method
173190
{
174191
Edges,
192+
EdgesCompass,
175193
Crop,
176194
DrawImage,
177195
BinaryThreshold,
178196
Histogram,
179-
OilPaint
197+
OilPaint,
198+
GaussianBlur,
180199
}
181200

182201
private sealed class CommandLineOptions

0 commit comments

Comments
 (0)