Welcome to mirror list, hosted at ThFree Co, Russian Federation.

Program.cs « Benchmarks - github.com/ClusterM/NesTiler.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7844739a53dc5c3540616f7bb327ab7b82c52738 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;

namespace com.clusterrr.Famicom.NesTiler.Benchmarks
{
    public class Benchmarks
    {
        static void Main()
        {
            var summary = BenchmarkRunner.Run<Benchmarks>();
            Console.WriteLine(summary);
        }

        [Benchmark]
        public void BenchmarkBelayaAkula()
        {
            var imagePath = @"Images\belaya_akula.gif";
            DoBenchmarkSplit4(imagePath);
        }

        [Benchmark]
        public void BenchmarkBuhanka()
        {
            var imagePath = @"Images\buhanka.gif";
            DoBenchmarkSplit4(imagePath);
        }

        [Benchmark]
        public void BenchmarkChernobyl()
        {
            var imagePath = @"Images\chernobyl.gif";
            DoBenchmarkSplit4(imagePath);
        }

        [Benchmark]
        public void BenchmarkDira()
        {
            var imagePath = @"Images\dira.gif";
            DoBenchmarkSplit4(imagePath);
        }

        [Benchmark]
        public void BenchmarkGlaza()
        {
            var imagePath = @"Images\glaza.gif";
            DoBenchmarkSplit4(imagePath);
        }

        [Benchmark]
        public void BenchmarkGorgona()
        {
            var imagePath = @"Images\gorgona.gif";
            DoBenchmarkSplit4(imagePath);
        }

        [Benchmark]
        public void BenchmarkMyatejl()
        {
            var imagePath = @"Images\myatej.gif";
            DoBenchmarkSplit4(imagePath);
        }

        [Benchmark]
        public void BenchmarkPagoda()
        {
            var imagePath = @"Images\pagoda.gif";
            DoBenchmarkSplit4(imagePath);
        }

        [Benchmark]
        public void BenchmarkRayon4()
        {
            var imagePath = @"Images\rayon4.gif";
            DoBenchmarkSplit4(imagePath);
        }

        [Benchmark]
        public void BenchmarkShkola()
        {
            var imagePath = @"Images\shkola.gif";
            DoBenchmarkSplit4(imagePath);
        }

        [Benchmark]
        public void BenchmarkSindikat()
        {
            var imagePath = @"Images\sindikat.gif";
            DoBenchmarkSplit4(imagePath);
        }

        [Benchmark]
        public void BenchmarkSputnik()
        {
            var imagePath = @"Images\sputnik.gif";
            DoBenchmarkSplit4(imagePath);
        }

        [Benchmark]
        public void BenchmarkSworm()
        {
            var imagePath = @"Images\sworm.gif";
            DoBenchmarkSplit4(imagePath);
        }

        [Benchmark]
        public void BenchmarkTrailerPark()
        {
            var imagePath = @"Images\trailer-park.gif";
            DoBenchmarkSplit4(imagePath);
        }

        [Benchmark]
        public void BenchmarkWarfaceLogo()
        {
            var imagePath = @"Images\warface_logo.gif";
            DoBenchmarkSplit4(imagePath);
        }

        [Benchmark]
        public void BenchmarkZapravka()
        {
            var imagePath = @"Images\zapravka.gif";
            DoBenchmarkSplit4(imagePath);
        }

        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 DoBenchmarkSplit4(string imagePath)
        {
            var prefix = Path.GetFileNameWithoutExtension(imagePath);
            var args = new string[] {
                "--enable-palettes", "0,1,2,3",
                "-input-0", $"{imagePath}:0:64",
                "-input-1", $"{imagePath}:64:64",
                "-input-2", $"{imagePath}:128:64",
                "-input-3", $"{imagePath}:192:48",
                "--out-pattern-table-0", PatternTablePath(prefix, 0),
                "--out-pattern-table-1", PatternTablePath(prefix, 1),
                "--out-pattern-table-2", PatternTablePath(prefix, 2),
                "--out-pattern-table-3", PatternTablePath(prefix, 3),
                "--out-name-table-0", NameTablePath(prefix, 0),
                "--out-name-table-1", NameTablePath(prefix, 1),
                "--out-name-table-2", NameTablePath(prefix, 2),
                "--out-name-table-3", NameTablePath(prefix, 3),
                "--out-attribute-table-0", AttrTablePath(prefix, 0),
                "--out-attribute-table-1", AttrTablePath(prefix, 1),
                "--out-attribute-table-2", AttrTablePath(prefix, 2),
                "--out-attribute-table-3", AttrTablePath(prefix, 3),
                "--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);
        }
    }
}