diff options
author | Alexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com> | 2022-10-14 19:15:31 +0300 |
---|---|---|
committer | Alexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com> | 2022-10-14 19:15:31 +0300 |
commit | d74fd537626fd5dc215e3a87214f3c23aae80531 (patch) | |
tree | 3d63f99ee6748b55f129556a885494cbc0650a37 /Benchmarks | |
parent | 1e080c4db6b28fc5b34be211c03a45eebab9e261 (diff) |
More tests
Diffstat (limited to 'Benchmarks')
-rw-r--r-- | Benchmarks/Program.cs | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/Benchmarks/Program.cs b/Benchmarks/Program.cs index 317f19e..b90e57a 100644 --- a/Benchmarks/Program.cs +++ b/Benchmarks/Program.cs @@ -125,11 +125,91 @@ namespace com.clusterrr.Famicom.NesTiler.Benchmarks DoBenchmarkSplit4(imagePath); } + [Benchmark] + public void BenchmarkJurassic() + { + var imagePath = Path.Combine(ImagesPath, "jurassic.png"); + DoBenchmarkSplit2(imagePath); + } + + [Benchmark] + public void BenchmarkJurassic2() + { + var imagePath = Path.Combine(ImagesPath, "jurassic2.png"); + DoBenchmarkSplit2(imagePath); + } + + [Benchmark] + public void BenchmarkBlasterMasterLeft() + { + var imagePath = Path.Combine(ImagesPath, "blaster_master_left.png"); + DoBenchmarkNoSplit(imagePath, "#000000"); + } + + [Benchmark] + public void BenchmarkBlasterMasterRight() + { + var imagePath = Path.Combine(ImagesPath, "blaster_master_right.png"); + DoBenchmarkNoSplit(imagePath, "#000000"); + } + + [Benchmark] + public void BenchmarkBlasterMasterRightFull() + { + var imagePath = Path.Combine(ImagesPath, "blaster_master_right_full.png"); + DoBenchmarkNoSplit(imagePath, "#000000"); + } + private string PatternTablePath(string prefix, int number) => $"{prefix}_pattern_{number}.bin"; private string NameTablePath(string prefix, int number) => $"{prefix}_name_table_{number}.bin"; private string AttrTablePath(string prefix, int number) => $"{prefix}_attr_table_{number}.bin"; private string PalettePath(string prefix, int number) => $"{prefix}_palette_{number}.bin"; + public void DoBenchmarkNoSplit(string imagePath, string bgColor = "auto") + { + var prefix = Path.GetFileNameWithoutExtension(imagePath); + var args = new string[] { + "--enable-palettes", "0,1,2,3", + "-input-0", $"{imagePath}", + "--out-pattern-table-0", PatternTablePath(prefix, 0), + "--out-name-table-0", NameTablePath(prefix, 0), + "--out-attribute-table-0", AttrTablePath(prefix, 0), + "--out-palette-0", PalettePath(prefix, 0), + "--out-palette-1", PalettePath(prefix, 1), + "--out-palette-2", PalettePath(prefix, 2), + "--out-palette-3", PalettePath(prefix, 3), + "--bg-color", bgColor, + }; + var r = Program.Main(args); + if (r != 0) throw new InvalidOperationException($"Return code: {r}"); + + //foreach (var file in Directory.GetFiles(".", "*.bin")) File.Copy(file, Path.Join(@"E:\bins", Path.GetFileName(file)), true); + } + + public void DoBenchmarkSplit2(string imagePath) + { + var prefix = Path.GetFileNameWithoutExtension(imagePath); + var args = new string[] { + "--enable-palettes", "0,1,2,3", + "-input-0", $"{imagePath}:0:128", + "-input-1", $"{imagePath}:128:112", + "--out-pattern-table-0", PatternTablePath(prefix, 0), + "--out-pattern-table-1", PatternTablePath(prefix, 1), + "--out-name-table-0", NameTablePath(prefix, 0), + "--out-name-table-1", NameTablePath(prefix, 1), + "--out-attribute-table-0", AttrTablePath(prefix, 0), + "--out-attribute-table-1", AttrTablePath(prefix, 1), + "--out-palette-0", PalettePath(prefix, 0), + "--out-palette-1", PalettePath(prefix, 1), + "--out-palette-2", PalettePath(prefix, 2), + "--out-palette-3", PalettePath(prefix, 3), + }; + var r = Program.Main(args); + if (r != 0) throw new InvalidOperationException($"Return code: {r}"); + + //foreach (var file in Directory.GetFiles(".", "*.bin")) File.Copy(file, Path.Join(@"E:\bins", Path.GetFileName(file)), true); + } + public void DoBenchmarkSplit4(string imagePath) { var prefix = Path.GetFileNameWithoutExtension(imagePath); @@ -161,5 +241,6 @@ namespace com.clusterrr.Famicom.NesTiler.Benchmarks //foreach (var file in Directory.GetFiles(".", "*.bin")) File.Copy(file, Path.Join(@"E:\bins", Path.GetFileName(file)), true); } + } }
\ No newline at end of file |