Skip to content

Commit 45151c1

Browse files
committed
Implement scaling (WIP)
1 parent b0230f2 commit 45151c1

15 files changed

+444
-75
lines changed

paket.dependencies

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ group Test
1414
storage: none
1515
source https://api.nuget.org/v3/index.json
1616

17-
nuget NUnit ~> 3.14.0
18-
nuget NUnit3TestAdapter ~> 4.5.0
19-
nuget Microsoft.NET.Test.Sdk ~> 17.9.0
17+
nuget FSharp.Core ~> 8.0.0
18+
19+
nuget FsUnit ~> 6.0.0
20+
nuget NUnit ~> 4.2.2
21+
nuget NUnit3TestAdapter ~> 4.6.0
22+
nuget Microsoft.NET.Test.Sdk ~> 17.9.0
23+
24+
nuget BenchmarkDotNet ~> 0.14.0

paket.lock

Lines changed: 120 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,23 @@ STORAGE: NONE
22
RESTRICTION: || (== net8.0) (== netstandard2.0)
33
NUGET
44
remote: https://api.nuget.org/v3/index.json
5-
Aardvark.Base (5.3)
6-
Aardvark.Base.Telemetry (5.3)
5+
Aardvark.Base (5.3.3)
6+
Aardvark.Base.Telemetry (5.3.3)
7+
SingleFileExtractor.Core (>= 2.2.1 < 2.3)
78
System.Collections.Immutable (>= 8.0)
89
System.Reflection.Metadata (>= 8.0)
910
System.Text.Json (>= 8.0.4)
10-
Aardvark.Base.FSharp (5.3)
11-
Aardvark.Base (5.3)
11+
Aardvark.Base.FSharp (5.3.3)
12+
Aardvark.Base (5.3.3)
1213
Aardvark.Base.TypeProviders (>= 4.5.15 < 4.6)
1314
FSharp.Core (>= 8.0)
1415
FSharp.Data.Adaptive (>= 1.2 < 1.3)
1516
FsPickler (>= 5.3.2 < 5.4)
1617
System.Dynamic.Runtime (>= 4.3 < 4.4)
17-
Aardvark.Base.Telemetry (5.3)
18-
Aardvark.Base.Tensors (5.3)
19-
Aardvark.Base (5.3)
20-
Aardvark.Base.FSharp (5.3)
18+
Aardvark.Base.Telemetry (5.3.3)
19+
Aardvark.Base.Tensors (5.3.3)
20+
Aardvark.Base (5.3.3)
21+
Aardvark.Base.FSharp (5.3.3)
2122
FSharp.Core (>= 8.0)
2223
Aardvark.Base.TypeProviders (4.5.15)
2324
FSharp.Core (>= 4.2.3)
@@ -36,6 +37,8 @@ NUGET
3637
OpenCvSharp4 (4.10.0.20240616)
3738
System.Memory (>= 4.5.5)
3839
System.Runtime.CompilerServices.Unsafe (>= 6.0)
40+
SingleFileExtractor.Core (2.2.1)
41+
System.Memory (>= 4.5.5) - restriction: || (&& (== net8.0) (< netstandard2.1)) (== netstandard2.0)
3942
System.Buffers (4.5.1) - restriction: || (&& (== net8.0) (>= monotouch)) (&& (== net8.0) (>= net461)) (&& (== net8.0) (< netcoreapp2.0)) (&& (== net8.0) (< netstandard1.1)) (&& (== net8.0) (< netstandard2.0)) (&& (== net8.0) (>= xamarinios)) (&& (== net8.0) (>= xamarinmac)) (&& (== net8.0) (>= xamarintvos)) (&& (== net8.0) (>= xamarinwatchos)) (== netstandard2.0)
4043
System.Collections (4.3)
4144
Microsoft.NETCore.Platforms (>= 1.1)
@@ -176,22 +179,123 @@ STORAGE: NONE
176179
RESTRICTION: || (== net8.0) (== netstandard2.0)
177180
NUGET
178181
remote: https://api.nuget.org/v3/index.json
182+
BenchmarkDotNet (0.14)
183+
BenchmarkDotNet.Annotations (>= 0.14)
184+
CommandLineParser (>= 2.9.1)
185+
Gee.External.Capstone (>= 2.3)
186+
Iced (>= 1.17)
187+
Microsoft.CodeAnalysis.CSharp (>= 4.1)
188+
Microsoft.Diagnostics.Runtime (>= 2.2.332302)
189+
Microsoft.Diagnostics.Tracing.TraceEvent (>= 3.1.8)
190+
Microsoft.DotNet.PlatformAbstractions (>= 3.1.6)
191+
Microsoft.Win32.Registry (>= 5.0) - restriction: || (&& (== net8.0) (< net6.0)) (== netstandard2.0)
192+
Perfolizer (0.3.17)
193+
System.Management (>= 5.0)
194+
System.Numerics.Vectors (>= 4.5) - restriction: || (&& (== net8.0) (< net6.0)) (== netstandard2.0)
195+
System.Reflection.Emit (>= 4.7) - restriction: || (&& (== net8.0) (< net6.0)) (== netstandard2.0)
196+
System.Reflection.Emit.Lightweight (>= 4.7) - restriction: || (&& (== net8.0) (< net6.0)) (== netstandard2.0)
197+
System.Threading.Tasks.Extensions (>= 4.5.4) - restriction: || (&& (== net8.0) (< net6.0)) (== netstandard2.0)
198+
BenchmarkDotNet.Annotations (0.14)
199+
CommandLineParser (2.9.1)
200+
FSharp.Core (8.0.400)
201+
FsUnit (6.0)
202+
FSharp.Core (>= 5.0.2)
203+
NUnit (>= 4.0.1)
204+
Gee.External.Capstone (2.3)
205+
Iced (1.21)
206+
Microsoft.Bcl.AsyncInterfaces (8.0) - restriction: || (&& (== net8.0) (>= net462)) (&& (== net8.0) (< net6.0)) (&& (== net8.0) (< netstandard2.1)) (== netstandard2.0)
207+
System.Threading.Tasks.Extensions (>= 4.5.4) - restriction: || (&& (== net8.0) (>= net462)) (&& (== net8.0) (< netstandard2.1)) (== netstandard2.0)
208+
Microsoft.CodeAnalysis.Analyzers (3.3.4)
209+
Microsoft.CodeAnalysis.Common (4.11)
210+
Microsoft.CodeAnalysis.Analyzers (>= 3.3.4)
211+
System.Buffers (>= 4.5.1) - restriction: || (&& (== net8.0) (< net7.0)) (== netstandard2.0)
212+
System.Collections.Immutable (>= 8.0)
213+
System.Memory (>= 4.5.5) - restriction: || (&& (== net8.0) (< net7.0)) (== netstandard2.0)
214+
System.Numerics.Vectors (>= 4.5) - restriction: || (&& (== net8.0) (< net7.0)) (== netstandard2.0)
215+
System.Reflection.Metadata (>= 8.0)
216+
System.Runtime.CompilerServices.Unsafe (>= 6.0) - restriction: || (&& (== net8.0) (< net7.0)) (== netstandard2.0)
217+
System.Text.Encoding.CodePages (>= 7.0) - restriction: || (&& (== net8.0) (< net7.0)) (== netstandard2.0)
218+
System.Threading.Tasks.Extensions (>= 4.5.4) - restriction: || (&& (== net8.0) (< net7.0)) (== netstandard2.0)
219+
Microsoft.CodeAnalysis.CSharp (4.11)
220+
Microsoft.CodeAnalysis.Analyzers (>= 3.3.4)
221+
Microsoft.CodeAnalysis.Common (4.11)
222+
System.Buffers (>= 4.5.1) - restriction: || (&& (== net8.0) (< net7.0)) (== netstandard2.0)
223+
System.Collections.Immutable (>= 8.0)
224+
System.Memory (>= 4.5.5) - restriction: || (&& (== net8.0) (< net7.0)) (== netstandard2.0)
225+
System.Numerics.Vectors (>= 4.5) - restriction: || (&& (== net8.0) (< net7.0)) (== netstandard2.0)
226+
System.Reflection.Metadata (>= 8.0)
227+
System.Runtime.CompilerServices.Unsafe (>= 6.0) - restriction: || (&& (== net8.0) (< net7.0)) (== netstandard2.0)
228+
System.Text.Encoding.CodePages (>= 7.0) - restriction: || (&& (== net8.0) (< net7.0)) (== netstandard2.0)
229+
System.Threading.Tasks.Extensions (>= 4.5.4) - restriction: || (&& (== net8.0) (< net7.0)) (== netstandard2.0)
179230
Microsoft.CodeCoverage (17.10) - restriction: || (== net8.0) (&& (== netstandard2.0) (>= net462)) (&& (== netstandard2.0) (>= netcoreapp3.1))
231+
Microsoft.Diagnostics.NETCore.Client (0.2.532401)
232+
Microsoft.Bcl.AsyncInterfaces (>= 6.0) - restriction: || (&& (== net8.0) (< net6.0)) (== netstandard2.0)
233+
Microsoft.Extensions.Logging.Abstractions (>= 6.0.4)
234+
System.Buffers (>= 4.5.1) - restriction: || (&& (== net8.0) (< net6.0)) (== netstandard2.0)
235+
Microsoft.Diagnostics.Runtime (3.1.512801)
236+
Microsoft.Diagnostics.NETCore.Client (>= 0.2.410101)
237+
System.Collections.Immutable (>= 6.0) - restriction: || (&& (== net8.0) (< net6.0)) (== netstandard2.0)
238+
System.Runtime.CompilerServices.Unsafe (>= 6.0) - restriction: || (&& (== net8.0) (< net6.0)) (== netstandard2.0)
239+
Microsoft.Diagnostics.Tracing.TraceEvent (3.1.15)
240+
Microsoft.Diagnostics.NETCore.Client (>= 0.2.510501)
241+
Microsoft.Win32.Registry (>= 5.0)
242+
System.Collections.Immutable (>= 8.0)
243+
System.Reflection.Metadata (>= 8.0)
244+
System.Reflection.TypeExtensions (>= 4.7)
245+
System.Runtime.CompilerServices.Unsafe (>= 6.0)
246+
Microsoft.DotNet.PlatformAbstractions (3.1.6)
247+
Microsoft.Extensions.DependencyInjection.Abstractions (8.0.1)
248+
Microsoft.Bcl.AsyncInterfaces (>= 8.0) - restriction: || (&& (== net8.0) (>= net462)) (&& (== net8.0) (< netstandard2.1)) (== netstandard2.0)
249+
System.Threading.Tasks.Extensions (>= 4.5.4) - restriction: || (&& (== net8.0) (>= net462)) (&& (== net8.0) (< netstandard2.1)) (== netstandard2.0)
250+
Microsoft.Extensions.Logging.Abstractions (8.0.1)
251+
Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.1)
252+
System.Buffers (>= 4.5.1) - restriction: || (&& (== net8.0) (>= net462)) (&& (== net8.0) (< net6.0)) (== netstandard2.0)
253+
System.Memory (>= 4.5.5) - restriction: || (&& (== net8.0) (>= net462)) (&& (== net8.0) (< net6.0)) (== netstandard2.0)
180254
Microsoft.NET.Test.Sdk (17.9)
181255
Microsoft.CodeCoverage (>= 17.9) - restriction: || (== net8.0) (&& (== netstandard2.0) (>= net462)) (&& (== netstandard2.0) (>= netcoreapp3.1))
182256
Microsoft.TestPlatform.TestHost (>= 17.9) - restriction: || (== net8.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
183-
Microsoft.NETCore.Platforms (7.0.4)
184257
Microsoft.TestPlatform.ObjectModel (17.10) - restriction: || (== net8.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
185258
System.Reflection.Metadata (>= 1.6)
186259
Microsoft.TestPlatform.TestHost (17.10) - restriction: || (== net8.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
187260
Microsoft.TestPlatform.ObjectModel (>= 17.10) - restriction: || (== net8.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
188261
Newtonsoft.Json (>= 13.0.1) - restriction: || (== net8.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
189-
NETStandard.Library (2.0.3)
190-
Microsoft.NETCore.Platforms (>= 1.1)
262+
Microsoft.Win32.Registry (5.0)
263+
System.Buffers (>= 4.5.1) - restriction: || (&& (== net8.0) (>= monoandroid) (< netstandard1.3)) (&& (== net8.0) (>= monotouch)) (&& (== net8.0) (< netcoreapp2.0)) (&& (== net8.0) (>= xamarinios)) (&& (== net8.0) (>= xamarinmac)) (&& (== net8.0) (>= xamarintvos)) (&& (== net8.0) (>= xamarinwatchos)) (== netstandard2.0)
264+
System.Memory (>= 4.5.4) - restriction: || (&& (== net8.0) (< netcoreapp2.0)) (&& (== net8.0) (< netcoreapp2.1)) (&& (== net8.0) (>= uap10.1)) (== netstandard2.0)
265+
System.Security.AccessControl (>= 5.0)
266+
System.Security.Principal.Windows (>= 5.0)
191267
Newtonsoft.Json (13.0.3) - restriction: || (== net8.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
192-
NUnit (3.14)
193-
NETStandard.Library (>= 2.0)
194-
NUnit3TestAdapter (4.5)
195-
System.Collections.Immutable (8.0) - restriction: || (== net8.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
196-
System.Reflection.Metadata (8.0) - restriction: || (== net8.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
268+
NUnit (4.2.2)
269+
NUnit3TestAdapter (4.6)
270+
Perfolizer (0.3.17)
271+
System.Memory (>= 4.5.5) - restriction: || (&& (== net8.0) (< netstandard2.1)) (== netstandard2.0)
272+
System.Buffers (4.5.1) - restriction: || (&& (== net8.0) (>= monoandroid) (< netstandard1.3)) (&& (== net8.0) (>= monotouch)) (&& (== net8.0) (< net6.0) (>= xamarinios)) (&& (== net8.0) (< net6.0) (>= xamarinmac)) (&& (== net8.0) (< net6.0) (>= xamarintvos)) (&& (== net8.0) (< net6.0) (>= xamarinwatchos)) (&& (== net8.0) (< netcoreapp2.0)) (== netstandard2.0)
273+
System.CodeDom (8.0)
274+
System.Collections.Immutable (8.0)
275+
System.Memory (>= 4.5.5) - restriction: || (&& (== net8.0) (>= net462)) (&& (== net8.0) (< net6.0)) (== netstandard2.0)
276+
System.Runtime.CompilerServices.Unsafe (>= 6.0) - restriction: || (&& (== net8.0) (>= net462)) (&& (== net8.0) (< net6.0)) (&& (== net8.0) (< net7.0)) (== netstandard2.0)
277+
System.Management (8.0)
278+
System.CodeDom (>= 8.0)
279+
System.Memory (4.5.5) - restriction: || (&& (== net8.0) (< netstandard2.1)) (== netstandard2.0)
280+
System.Buffers (>= 4.5.1) - restriction: || (&& (== net8.0) (>= monotouch)) (&& (== net8.0) (>= net461)) (&& (== net8.0) (< netcoreapp2.0)) (&& (== net8.0) (< netstandard1.1)) (&& (== net8.0) (< netstandard2.0)) (&& (== net8.0) (>= xamarinios)) (&& (== net8.0) (>= xamarinmac)) (&& (== net8.0) (>= xamarintvos)) (&& (== net8.0) (>= xamarinwatchos)) (== netstandard2.0)
281+
System.Numerics.Vectors (>= 4.4) - restriction: || (&& (== net8.0) (< netcoreapp2.0)) (== netstandard2.0)
282+
System.Runtime.CompilerServices.Unsafe (>= 4.5.3) - restriction: || (&& (== net8.0) (>= monotouch)) (&& (== net8.0) (>= net461)) (&& (== net8.0) (< netcoreapp2.0)) (&& (== net8.0) (< netcoreapp2.1)) (&& (== net8.0) (< netstandard1.1)) (&& (== net8.0) (< netstandard2.0)) (&& (== net8.0) (>= uap10.1)) (&& (== net8.0) (>= xamarinios)) (&& (== net8.0) (>= xamarinmac)) (&& (== net8.0) (>= xamarintvos)) (&& (== net8.0) (>= xamarinwatchos)) (== netstandard2.0)
283+
System.Numerics.Vectors (4.5) - restriction: || (&& (== net8.0) (< net6.0)) (== netstandard2.0)
284+
System.Reflection.Emit (4.7) - restriction: || (&& (== net8.0) (< net6.0)) (== netstandard2.0)
285+
System.Reflection.Emit.ILGeneration (>= 4.7) - restriction: || (&& (== net8.0) (< netcoreapp2.0) (< netstandard2.1)) (&& (== net8.0) (< netstandard1.1)) (&& (== net8.0) (< netstandard2.0)) (&& (== net8.0) (>= uap10.1)) (== netstandard2.0)
286+
System.Reflection.Emit.ILGeneration (4.7) - restriction: || (&& (== net8.0) (< netcoreapp2.0) (< netstandard2.1)) (&& (== net8.0) (< netstandard1.1)) (&& (== net8.0) (< netstandard2.0)) (&& (== net8.0) (>= uap10.1)) (== netstandard2.0)
287+
System.Reflection.Emit.Lightweight (4.7) - restriction: || (&& (== net8.0) (< net6.0)) (== netstandard2.0)
288+
System.Reflection.Emit.ILGeneration (>= 4.7) - restriction: || (&& (== net8.0) (< netcoreapp2.0) (< netstandard2.1)) (&& (== net8.0) (< netstandard2.0)) (&& (== net8.0) (< portable-net45+wp8)) (&& (== net8.0) (>= uap10.1)) (== netstandard2.0)
289+
System.Reflection.Metadata (8.0)
197290
System.Collections.Immutable (>= 8.0)
291+
System.Memory (>= 4.5.5) - restriction: || (&& (== net8.0) (>= net462)) (&& (== net8.0) (< net6.0)) (== netstandard2.0)
292+
System.Reflection.TypeExtensions (4.7)
293+
System.Runtime.CompilerServices.Unsafe (6.0)
294+
System.Security.AccessControl (6.0.1) - restriction: || (&& (== net8.0) (>= monoandroid) (< netstandard1.3)) (&& (== net8.0) (>= monotouch)) (&& (== net8.0) (>= net461)) (&& (== net8.0) (< net6.0)) (&& (== net8.0) (< netcoreapp2.0)) (&& (== net8.0) (>= uap10.1)) (== netstandard2.0)
295+
System.Security.Principal.Windows (>= 5.0) - restriction: || (&& (== net8.0) (>= net461)) (&& (== net8.0) (< net6.0)) (== netstandard2.0)
296+
System.Security.Principal.Windows (5.0) - restriction: || (&& (== net8.0) (>= monoandroid) (< netstandard1.3)) (&& (== net8.0) (>= monotouch)) (&& (== net8.0) (>= net461)) (&& (== net8.0) (< net6.0)) (&& (== net8.0) (< netcoreapp2.0)) (&& (== net8.0) (>= uap10.1)) (== netstandard2.0)
297+
System.Text.Encoding.CodePages (8.0) - restriction: || (&& (== net8.0) (< net7.0)) (== netstandard2.0)
298+
System.Memory (>= 4.5.5) - restriction: || (&& (== net8.0) (>= net462)) (&& (== net8.0) (< net6.0)) (== netstandard2.0)
299+
System.Runtime.CompilerServices.Unsafe (>= 6.0) - restriction: || (&& (== net8.0) (>= net462)) (&& (== net8.0) (< net6.0)) (&& (== net8.0) (< net7.0)) (== netstandard2.0)
300+
System.Threading.Tasks.Extensions (4.5.4) - restriction: || (&& (== net8.0) (< net6.0)) (== netstandard2.0)
301+
System.Runtime.CompilerServices.Unsafe (>= 4.5.3) - restriction: || (&& (== net8.0) (>= net461)) (&& (== net8.0) (< netcoreapp2.1)) (&& (== net8.0) (< netstandard1.0)) (&& (== net8.0) (< netstandard2.0)) (&& (== net8.0) (>= wp8)) (== netstandard2.0)

src/Aardvark.OpenCV.Tests/Aardvark.OpenCV.Tests.csproj renamed to src/Aardvark.OpenCV.Tests/Aardvark.OpenCV.Tests.fsproj

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,22 @@
33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
55
<TargetFramework>net8.0</TargetFramework>
6+
<GenerateProgramFile>false</GenerateProgramFile>
67
</PropertyGroup>
78
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
89
<OutputPath>..\..\bin\Debug</OutputPath>
910
</PropertyGroup>
1011
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
1112
<OutputPath>..\..\bin\Release</OutputPath>
1213
</PropertyGroup>
14+
<ItemGroup>
15+
<Compile Include="Benchmarks\ImageBench.fs" />
16+
<Compile Include="Tests\ClusteringTests.fs" />
17+
<Compile Include="Tests\FittingTests.fs" />
18+
<Compile Include="Tests\ImageTests.fs" />
19+
<Compile Include="Program.fs" />
20+
<None Include="paket.references" />
21+
</ItemGroup>
1322
<ItemGroup>
1423
<ProjectReference Include="..\Aardvark.OpenCV\Aardvark.OpenCV.csproj" />
1524
</ItemGroup>
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
namespace Aardvark.OpenCV.Benchmarks
2+
3+
open Aardvark.Base
4+
open Aardvark.OpenCV
5+
open BenchmarkDotNet.Attributes
6+
7+
module ``Image Processing Benchmarks`` =
8+
9+
type Scaling() =
10+
11+
[<DefaultValue; Params(128, 1024, 2048, 4096)>]
12+
val mutable Size : int
13+
14+
[<DefaultValue; Params(ImageInterpolation.Linear, ImageInterpolation.Cubic, ImageInterpolation.Lanczos)>]
15+
val mutable Interpolation : ImageInterpolation
16+
17+
let mutable image = null
18+
19+
let scaleFactor = V2d(0.234, 0.894)
20+
21+
[<GlobalSetup>]
22+
member x.Setup() =
23+
Aardvark.Init()
24+
let rnd = RandomSystem 0
25+
image <- new PixImage<float32>(Col.Format.RGBA, x.Size, x.Size)
26+
image.Volume.SetByIndex(ignore >> rnd.UniformFloat) |> ignore
27+
28+
[<Benchmark(Description = "Aardvark (Tensors)", Baseline = true)>]
29+
member x.AardvarkTensors() =
30+
let volume = Aardvark.Base.TensorExtensions.Scaled(image.Volume, scaleFactor, x.Interpolation)
31+
PixImage<float32>(image.Format, volume)
32+
33+
[<Benchmark>]
34+
member x.OpenCV() =
35+
ImageProcessing.ScaledOpenCV(image, scaleFactor, x.Interpolation)

src/Aardvark.OpenCV.Tests/ClusteringTests.cs

Lines changed: 0 additions & 25 deletions
This file was deleted.

src/Aardvark.OpenCV.Tests/FittingTests.cs

Lines changed: 0 additions & 25 deletions
This file was deleted.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
namespace Aardvark.OpenCV.Benchmarks
2+
3+
open System.Reflection
4+
open BenchmarkDotNet.Running;
5+
open BenchmarkDotNet.Configs
6+
open BenchmarkDotNet.Jobs
7+
open BenchmarkDotNet.Toolchains
8+
9+
module Program =
10+
11+
[<EntryPoint>]
12+
let main argv =
13+
14+
let cfg =
15+
let job = Job.ShortRun.WithToolchain(InProcess.Emit.InProcessEmitToolchain.Instance)
16+
ManualConfig.Create(DefaultConfig.Instance).WithOptions(ConfigOptions.DisableOptimizationsValidator).AddJob(job)
17+
18+
BenchmarkSwitcher.FromAssembly(Assembly.GetExecutingAssembly()).Run(argv, cfg) |> ignore
19+
20+
0
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
using Aardvark.Base;
2+
using BenchmarkDotNet.Attributes;
3+
4+
namespace Aardvark.OpenCV.Tests
5+
{
6+
public class Scaling
7+
{
8+
[Params(128, 1024, 2048, 4096)]
9+
public int Size;
10+
11+
[Params(ImageInterpolation.Linear, ImageInterpolation.Cubic)]
12+
public ImageInterpolation Interpolation;
13+
14+
private PixImage<float> _image;
15+
16+
private readonly V2d _scaleFactor = new (0.234, 0.894);
17+
18+
[GlobalSetup]
19+
public void Init()
20+
{
21+
Aardvark.Base.Aardvark.Init();
22+
var rnd = new RandomSystem(0);
23+
_image = new PixImage<float>(Col.Format.RGBA, new V2i(Size, Size));
24+
_image.Volume.SetByIndex((_) => rnd.UniformFloat());
25+
}
26+
27+
[Benchmark(Description = "Aardvark (Tensors)", Baseline = true)]
28+
public PixImage<float> AardvarkTensors()
29+
{
30+
var volume = Aardvark.Base.TensorExtensions.Scaled(_image.Volume, _scaleFactor, Interpolation);
31+
return new PixImage<float>(_image.Format, volume);
32+
}
33+
34+
[Benchmark]
35+
public PixImage<float> OpenCV()
36+
=> TensorExtensions.ScaledOpenCV(_image, _scaleFactor, Interpolation);
37+
}
38+
}

0 commit comments

Comments
 (0)