mirror of
https://github.com/AssetRipper/AssetRipper.TextureDecoder.git
synced 2026-11-13 03:39:17 -10:00
26 lines
821 B
C#
26 lines
821 B
C#
using AssetRipper.TextureDecoder.Rgb;
|
|
using AssetRipper.TextureDecoder.Rgb.Formats;
|
|
using BenchmarkDotNet.Attributes;
|
|
|
|
namespace AssetRipper.TextureDecoder.Benchmarks;
|
|
|
|
public class Argb32Decoding
|
|
{
|
|
private const int Width = 256;//ignoring smaller mips
|
|
private const int Height = 256;//ignoring smaller mips
|
|
private readonly byte[] inputData;
|
|
private readonly byte[] outputData;
|
|
|
|
public Argb32Decoding()
|
|
{
|
|
inputData = File.ReadAllBytes(PathConstants.PathToTestFiles + "Rgb/" + "test.argb32");
|
|
outputData = new byte[Width * Height * sizeof(uint)];
|
|
}
|
|
|
|
[Benchmark]
|
|
public int OriginalMethod() => RgbConverter.ARGB32ToBGRA32(inputData, Width, Height, outputData);
|
|
|
|
[Benchmark]
|
|
public int GenericMethod() => RgbConverter.Convert<ColorARGB32, byte, ColorBGRA32, byte>(inputData, Width, Height, outputData);
|
|
}
|