mirror of https://github.com/SixLabors/ImageSharp
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.2 KiB
42 lines
1.2 KiB
// Copyright (c) Six Labors and contributors.
|
|
// Licensed under the Apache License, Version 2.0.
|
|
|
|
using System.IO;
|
|
|
|
using BenchmarkDotNet.Attributes;
|
|
|
|
using ImageMagick;
|
|
|
|
using SixLabors.ImageSharp.PixelFormats;
|
|
using SixLabors.ImageSharp.Tests;
|
|
using SixLabors.Primitives;
|
|
|
|
namespace SixLabors.ImageSharp.Benchmarks.Codecs
|
|
{
|
|
[Config(typeof(Config.ShortClr))]
|
|
public class DecodeTga : BenchmarkBase
|
|
{
|
|
private string TestImageFullPath => Path.Combine(TestEnvironment.InputImagesDirectoryFullPath, this.TestImage);
|
|
|
|
[Params(TestImages.Tga.Bit24)]
|
|
public string TestImage { get; set; }
|
|
|
|
[Benchmark(Baseline = true, Description = "ImageMagick Tga")]
|
|
public Size TgaImageMagick()
|
|
{
|
|
using (var magickImage = new MagickImage(this.TestImageFullPath))
|
|
{
|
|
return new Size(magickImage.Width, magickImage.Height);
|
|
}
|
|
}
|
|
|
|
[Benchmark(Description = "ImageSharp Tga")]
|
|
public Size TgaCore()
|
|
{
|
|
using (var image = Image.Load<Rgba32>(this.TestImageFullPath))
|
|
{
|
|
return new Size(image.Width, image.Height);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|