mirror of https://github.com/SixLabors/ImageSharp
committed by
GitHub
10 changed files with 332 additions and 135 deletions
@ -0,0 +1,21 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using BenchmarkDotNet.Attributes; |
|||
using SixLabors.ImageSharp.Formats.Jpeg.Components; |
|||
|
|||
namespace SixLabors.ImageSharp.Benchmarks.Codecs.Jpeg.BlockOperations |
|||
{ |
|||
[Config(typeof(Config.HwIntrinsics_SSE_AVX))] |
|||
public class Block8x8F_AddInPlace |
|||
{ |
|||
[Benchmark] |
|||
public float AddInplace() |
|||
{ |
|||
float f = 42F; |
|||
Block8x8F b = default; |
|||
b.AddInPlace(f); |
|||
return f; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,37 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using BenchmarkDotNet.Attributes; |
|||
using SixLabors.ImageSharp.Formats.Jpeg.Components; |
|||
|
|||
namespace SixLabors.ImageSharp.Benchmarks.Codecs.Jpeg.BlockOperations |
|||
{ |
|||
[Config(typeof(Config.HwIntrinsics_SSE_AVX))] |
|||
public class Block8x8F_MultiplyInPlaceBlock |
|||
{ |
|||
private static readonly Block8x8F Source = Create8x8FloatData(); |
|||
|
|||
[Benchmark] |
|||
public void MultiplyInPlaceBlock() |
|||
{ |
|||
Block8x8F dest = default; |
|||
Source.MultiplyInPlace(ref dest); |
|||
} |
|||
|
|||
private static Block8x8F Create8x8FloatData() |
|||
{ |
|||
var result = new float[64]; |
|||
for (int i = 0; i < 8; i++) |
|||
{ |
|||
for (int j = 0; j < 8; j++) |
|||
{ |
|||
result[(i * 8) + j] = (i * 10) + j; |
|||
} |
|||
} |
|||
|
|||
var source = default(Block8x8F); |
|||
source.LoadFrom(result); |
|||
return source; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,21 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
using BenchmarkDotNet.Attributes; |
|||
using SixLabors.ImageSharp.Formats.Jpeg.Components; |
|||
|
|||
namespace SixLabors.ImageSharp.Benchmarks.Codecs.Jpeg.BlockOperations |
|||
{ |
|||
[Config(typeof(Config.HwIntrinsics_SSE_AVX))] |
|||
public class Block8x8F_MultiplyInPlaceScalar |
|||
{ |
|||
[Benchmark] |
|||
public float MultiplyInPlaceScalar() |
|||
{ |
|||
float f = 42F; |
|||
Block8x8F b = default; |
|||
b.MultiplyInPlace(f); |
|||
return f; |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue