Debian Codegraph @

modules/lsp-runtime-lib/src/test/utest/mm/pixel.cpp

raw
1 /*
2 * Copyright (C) 2026 Linux Studio Plugins Project <https://lsp-plug.in/>
3 * (C) 2026 Vladimir Sadovnikov <[email protected]>
4 *
5 * This file is part of lsp-runtime-lib
6 * Created on: 25 янв. 2026 г.
7 *
8 * lsp-runtime-lib is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU Lesser General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * any later version.
12 *
13 * lsp-runtime-lib is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with lsp-runtime-lib. If not, see <https://www.gnu.org/licenses/>.
20 */
21
22 #include <lsp-plug.in/test-fw/utest.h>
23 #include <lsp-plug.in/test-fw/ByteBuffer.h>
24 #include <lsp-plug.in/mm/pixel.h>
25 #include <lsp-plug.in/stdlib/string.h>
26
27 namespace lsp
28 {
29 // Data for g1 testing
30 const uint8_t src_g1[] = { 0xaa, 0xaa };
31
32 const uint8_t dst_g1_to_g2_x10[] = { 0xcc, 0xcc, 0x0c };
33 const uint8_t dst_g1_to_g2_x15[] = { 0xcc, 0xcc, 0xcc, 0x0c };
34 const uint8_t dst_g1_to_a2_x9[] = { 0xcc, 0xcc, 0x00 };
35 const uint8_t dst_g1_to_a2_x15[] = { 0xcc, 0xcc, 0xcc, 0x0c };
36
37 const uint8_t dst_g1_to_g4_x10[] = { 0xf0, 0xf0, 0xf0, 0xf0, 0xf0 };
38 const uint8_t dst_g1_to_g4_x15[] = { 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0x00 };
39 const uint8_t dst_g1_to_a4_x9[] = { 0xf0, 0xf0, 0xf0, 0xf0, 0x00 };
40 const uint8_t dst_g1_to_a4_x15[] = { 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0x00 };
41
42 const uint8_t dst_g1_to_g8_x10[] = { 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff };
43 const uint8_t dst_g1_to_g8_x15[] = { 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00 };
44 const uint8_t dst_g1_to_a8_x9[] = { 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00 };
45 const uint8_t dst_g1_to_a8_x14[] = { 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff };
46
47 const uint8_t dst_g1_to_rgb888_x10[] = {
48 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00,
49 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff,
50 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff,
51 0x00, 0x00, 0x00, 0xff, 0xff, 0xff
52 };
53 const uint8_t dst_g1_to_rgb888_x15[] = {
54 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00,
55 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff,
56 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff,
57 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00,
58 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff,
59 0xff, 0xff, 0x00, 0x00, 0x00
60 };
61
62 const uint8_t dst_g1_to_rgba8888_x10[] = {
63 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff,
64 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff,
65 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff,
66 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff,
67 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff
68 };
69 const uint8_t dst_g1_to_rgba8888_x15[] = {
70 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff,
71 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff,
72 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff,
73 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff,
74 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff,
75 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff,
76 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff,
77 0x00, 0x00, 0x00, 0xff
78 };
79
80 const uint8_t dst_g1_to_prgba8888_x10[] = {
81 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
82 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
83 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
84 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
85 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff
86 };
87 const uint8_t dst_g1_to_prgba8888_x15[] = {
88 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
89 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
90 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
91 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
92 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
93 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
94 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
95 0x00, 0x00, 0x00, 0x00
96 };
97
98 // Data for a1 testing
99 const uint8_t src_a1[] = { 0x55, 0x55 };
100
101 const uint8_t dst_a1_to_g2_x10[] = { 0x33, 0x33, 0x03 };
102 const uint8_t dst_a1_to_g2_x15[] = { 0x33, 0x33, 0x33, 0x33 };
103 const uint8_t dst_a1_to_a2_x9[] = { 0x33, 0x33, 0x03 };
104 const uint8_t dst_a1_to_a2_x15[] = { 0x33, 0x33, 0x33, 0x33 };
105
106 const uint8_t dst_a1_to_g4_x10[] = { 0x0f, 0x0f, 0x0f, 0x0f, 0x0f };
107 const uint8_t dst_a1_to_g4_x15[] = { 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f };
108 const uint8_t dst_a1_to_a4_x9[] = { 0x0f, 0x0f, 0x0f, 0x0f, 0x0f };
109 const uint8_t dst_a1_to_a4_x15[] = { 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f };
110
111 const uint8_t dst_a1_to_g8_x10[] = { 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00 };
112 const uint8_t dst_a1_to_g8_x15[] = { 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff };
113 const uint8_t dst_a1_to_a8_x9[] = { 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff };
114 const uint8_t dst_a1_to_a8_x14[] = { 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00 };
115
116 const uint8_t dst_a1_to_rgb888_x10[] = {
117 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff,
118 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00,
119 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00,
120 0xff, 0xff, 0xff, 0x00, 0x00, 0x00
121 };
122 const uint8_t dst_a1_to_rgb888_x15[] = {
123 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff,
124 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00,
125 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00,
126 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff,
127 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00,
128 0x00, 0x00, 0xff, 0xff, 0xff
129 };
130
131 const uint8_t dst_a1_to_rgba8888_x10[] = {
132 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00,
133 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00,
134 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00,
135 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00,
136 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00,
137 };
138 const uint8_t dst_a1_to_rgba8888_x15[] = {
139 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00,
140 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00,
141 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00,
142 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00,
143 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00,
144 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00,
145 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00,
146 0xff, 0xff, 0xff, 0xff
147 };
148
149 const uint8_t dst_a1_to_prgba8888_x10[] = {
150 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
151 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
152 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
153 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
154 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
155 };
156 const uint8_t dst_a1_to_prgba8888_x15[] = {
157 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
158 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
159 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
160 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
161 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
162 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
163 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
164 0xff, 0xff, 0xff, 0xff
165 };
166
167 // Data for g2 testing
168 const uint8_t src_g2[] = { 0xe4, 0xe4, 0xe4, 0xe4 };
169
170 const uint8_t dst_g2_to_g1_x10[] = { 0xcc, 0x00 };
171 const uint8_t dst_g2_to_g1_x15[] = { 0xcc, 0x4c };
172 const uint8_t dst_g2_to_a1_x9[] = { 0xcc, 0x00 };
173 const uint8_t dst_g2_to_a1_x15[] = { 0xcc, 0x4c };
174
175 const uint8_t dst_g2_to_g4_x10[] = { 0x50, 0xfa, 0x50, 0xfa, 0x50 };
176 const uint8_t dst_g2_to_g4_x15[] = { 0x50, 0xfa, 0x50, 0xfa, 0x50, 0xfa, 0x50, 0x0a };
177 const uint8_t dst_g2_to_a4_x9[] = { 0x50, 0xfa, 0x50, 0xfa, 0x00 };
178 const uint8_t dst_g2_to_a4_x15[] = { 0x50, 0xfa, 0x50, 0xfa, 0x50, 0xfa, 0x50, 0x0a };
179
180 const uint8_t dst_g2_to_g8_x10[] = { 0x00, 0x55, 0xaa, 0xff, 0x00, 0x55, 0xaa, 0xff, 0x00, 0x55 };
181 const uint8_t dst_g2_to_g8_x15[] = {
182 0x00, 0x55, 0xaa, 0xff, 0x00, 0x55, 0xaa, 0xff,
183 0x00, 0x55, 0xaa, 0xff, 0x00, 0x55, 0xaa
184 };
185 const uint8_t dst_g2_to_a8_x9[] = { 0x00, 0x55, 0xaa, 0xff, 0x00, 0x55, 0xaa, 0xff, 0x00 };
186 const uint8_t dst_g2_to_a8_x14[] = {
187 0x00, 0x55, 0xaa, 0xff, 0x00, 0x55, 0xaa, 0xff,
188 0x00, 0x55, 0xaa, 0xff, 0x00, 0x55
189 };
190
191 const uint8_t dst_g2_to_rgb888_x10[] = {
192 0x00, 0x00, 0x00, 0x55, 0x55, 0x55, 0xaa, 0xaa,
193 0xaa, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x55,
194 0x55, 0x55, 0xaa, 0xaa, 0xaa, 0xff, 0xff, 0xff,
195 0x00, 0x00, 0x00, 0x55, 0x55, 0x55
196 };
197 const uint8_t dst_g2_to_rgb888_x15[] = {
198 0x00, 0x00, 0x00, 0x55, 0x55, 0x55, 0xaa, 0xaa,
199 0xaa, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x55,
200 0x55, 0x55, 0xaa, 0xaa, 0xaa, 0xff, 0xff, 0xff,
201 0x00, 0x00, 0x00, 0x55, 0x55, 0x55, 0xaa, 0xaa,
202 0xaa, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x55,
203 0x55, 0x55, 0xaa, 0xaa, 0xaa
204 };
205
206 const uint8_t dst_g2_to_rgba8888_x10[] = {
207 0x00, 0x00, 0x00, 0xff, 0x55, 0x55, 0x55, 0xff,
208 0xaa, 0xaa, 0xaa, 0xff, 0xff, 0xff, 0xff, 0xff,
209 0x00, 0x00, 0x00, 0xff, 0x55, 0x55, 0x55, 0xff,
210 0xaa, 0xaa, 0xaa, 0xff, 0xff, 0xff, 0xff, 0xff,
211 0x00, 0x00, 0x00, 0xff, 0x55, 0x55, 0x55, 0xff
212 };
213 const uint8_t dst_g2_to_rgba8888_x15[] = {
214 0x00, 0x00, 0x00, 0xff, 0x55, 0x55, 0x55, 0xff,
215 0xaa, 0xaa, 0xaa, 0xff, 0xff, 0xff, 0xff, 0xff,
216 0x00, 0x00, 0x00, 0xff, 0x55, 0x55, 0x55, 0xff,
217 0xaa, 0xaa, 0xaa, 0xff, 0xff, 0xff, 0xff, 0xff,
218 0x00, 0x00, 0x00, 0xff, 0x55, 0x55, 0x55, 0xff,
219 0xaa, 0xaa, 0xaa, 0xff, 0xff, 0xff, 0xff, 0xff,
220 0x00, 0x00, 0x00, 0xff, 0x55, 0x55, 0x55, 0xff,
221 0xaa, 0xaa, 0xaa, 0xff
222 };
223
224 const uint8_t dst_g2_to_prgba8888_x10[] = {
225 0x00, 0x00, 0x00, 0xff, 0x55, 0x55, 0x55, 0xff,
226 0xaa, 0xaa, 0xaa, 0xff, 0xff, 0xff, 0xff, 0xff,
227 0x00, 0x00, 0x00, 0xff, 0x55, 0x55, 0x55, 0xff,
228 0xaa, 0xaa, 0xaa, 0xff, 0xff, 0xff, 0xff, 0xff,
229 0x00, 0x00, 0x00, 0xff, 0x55, 0x55, 0x55, 0xff
230 };
231 const uint8_t dst_g2_to_prgba8888_x15[] = {
232 0x00, 0x00, 0x00, 0xff, 0x55, 0x55, 0x55, 0xff,
233 0xaa, 0xaa, 0xaa, 0xff, 0xff, 0xff, 0xff, 0xff,
234 0x00, 0x00, 0x00, 0xff, 0x55, 0x55, 0x55, 0xff,
235 0xaa, 0xaa, 0xaa, 0xff, 0xff, 0xff, 0xff, 0xff,
236 0x00, 0x00, 0x00, 0xff, 0x55, 0x55, 0x55, 0xff,
237 0xaa, 0xaa, 0xaa, 0xff, 0xff, 0xff, 0xff, 0xff,
238 0x00, 0x00, 0x00, 0xff, 0x55, 0x55, 0x55, 0xff,
239 0xaa, 0xaa, 0xaa, 0xff
240 };
241
242 // Data for a2 testing
243 const uint8_t src_a2[] = { 0xd8, 0xd8, 0xd8, 0xd8 };
244
245 const uint8_t dst_a2_to_g1_x10[] = { 0xaa, 0x02 };
246 const uint8_t dst_a2_to_g1_x15[] = { 0xaa, 0x2a };
247 const uint8_t dst_a2_to_a1_x9[] = { 0xaa, 0x00 };
248 const uint8_t dst_a2_to_a1_x15[] = { 0xaa, 0x2a };
249
250 const uint8_t dst_a2_to_g4_x10[] = { 0xa0, 0xf5, 0xa0, 0xf5, 0xa0 };
251 const uint8_t dst_a2_to_g4_x15[] = { 0xa0, 0xf5, 0xa0, 0xf5, 0xa0, 0xf5, 0xa0, 0x05 };
252 const uint8_t dst_a2_to_a4_x9[] = { 0xa0, 0xf5, 0xa0, 0xf5, 0x00 };
253 const uint8_t dst_a2_to_a4_x15[] = { 0xa0, 0xf5, 0xa0, 0xf5, 0xa0, 0xf5, 0xa0, 0x05 };
254
255 const uint8_t dst_a2_to_g8_x10[] = { 0x00, 0xaa, 0x55, 0xff, 0x00, 0xaa, 0x55, 0xff, 0x00, 0xaa };
256 const uint8_t dst_a2_to_g8_x15[] = {
257 0x00, 0xaa, 0x55, 0xff, 0x00, 0xaa, 0x55, 0xff,
258 0x00, 0xaa, 0x55, 0xff, 0x00, 0xaa, 0x55
259 };
260 const uint8_t dst_a2_to_a8_x9[] = { 0x00, 0xaa, 0x55, 0xff, 0x00, 0xaa, 0x55, 0xff, 0x00 };
261 const uint8_t dst_a2_to_a8_x14[] = {
262 0x00, 0xaa, 0x55, 0xff, 0x00, 0xaa, 0x55, 0xff,
263 0x00, 0xaa, 0x55, 0xff, 0x00, 0xaa
264 };
265
266 const uint8_t dst_a2_to_rgb888_x10[] = {
267 0x00, 0x00, 0x00, 0xaa, 0xaa, 0xaa, 0x55, 0x55,
268 0x55, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0xaa,
269 0xaa, 0xaa, 0x55, 0x55, 0x55, 0xff, 0xff, 0xff,
270 0x00, 0x00, 0x00, 0xaa, 0xaa, 0xaa
271
272 };
273 const uint8_t dst_a2_to_rgb888_x15[] = {
274 0x00, 0x00, 0x00, 0xaa, 0xaa, 0xaa, 0x55, 0x55,
275 0x55, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0xaa,
276 0xaa, 0xaa, 0x55, 0x55, 0x55, 0xff, 0xff, 0xff,
277 0x00, 0x00, 0x00, 0xaa, 0xaa, 0xaa, 0x55, 0x55,
278 0x55, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0xaa,
279 0xaa, 0xaa, 0x55, 0x55, 0x55
280 };
281
282 const uint8_t dst_a2_to_rgba8888_x10[] = {
283 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xaa,
284 0xff, 0xff, 0xff, 0x55, 0xff, 0xff, 0xff, 0xff,
285 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xaa,
286 0xff, 0xff, 0xff, 0x55, 0xff, 0xff, 0xff, 0xff,
287 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xaa
288 };
289 const uint8_t dst_a2_to_rgba8888_x15[] = {
290 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xaa,
291 0xff, 0xff, 0xff, 0x55, 0xff, 0xff, 0xff, 0xff,
292 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xaa,
293 0xff, 0xff, 0xff, 0x55, 0xff, 0xff, 0xff, 0xff,
294 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xaa,
295 0xff, 0xff, 0xff, 0x55, 0xff, 0xff, 0xff, 0xff,
296 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xaa,
297 0xff, 0xff, 0xff, 0x55
298 };
299
300 const uint8_t dst_a2_to_prgba8888_x10[] = {
301 0x00, 0x00, 0x00, 0x00, 0xaa, 0xaa, 0xaa, 0xaa,
302 0x55, 0x55, 0x55, 0x55, 0xff, 0xff, 0xff, 0xff,
303 0x00, 0x00, 0x00, 0x00, 0xaa, 0xaa, 0xaa, 0xaa,
304 0x55, 0x55, 0x55, 0x55, 0xff, 0xff, 0xff, 0xff,
305 0x00, 0x00, 0x00, 0x00, 0xaa, 0xaa, 0xaa, 0xaa
306 };
307
308 const uint8_t dst_a2_to_prgba8888_x15[] = {
309 0x00, 0x00, 0x00, 0x00, 0xaa, 0xaa, 0xaa, 0xaa,
310 0x55, 0x55, 0x55, 0x55, 0xff, 0xff, 0xff, 0xff,
311 0x00, 0x00, 0x00, 0x00, 0xaa, 0xaa, 0xaa, 0xaa,
312 0x55, 0x55, 0x55, 0x55, 0xff, 0xff, 0xff, 0xff,
313 0x00, 0x00, 0x00, 0x00, 0xaa, 0xaa, 0xaa, 0xaa,
314 0x55, 0x55, 0x55, 0x55, 0xff, 0xff, 0xff, 0xff,
315 0x00, 0x00, 0x00, 0x00, 0xaa, 0xaa, 0xaa, 0xaa,
316 0x55, 0x55, 0x55, 0x55
317 };
318
319 // Data for g4 testing
320 const uint8_t src_g4[] = { 0x81, 0x92, 0xa3, 0xb4, 0xc5, 0xd6, 0xe7, 0xf1 };
321
322 const uint8_t dst_g4_to_g1_x10[] = { 0xaa, 0x02 };
323 const uint8_t dst_g4_to_g1_x15[] = { 0xaa, 0x2a };
324 const uint8_t dst_g4_to_a1_x9[] = { 0xaa, 0x00 };
325 const uint8_t dst_g4_to_a1_x15[] = { 0xaa, 0x2a };
326
327 const uint8_t dst_g4_to_g2_x10[] = { 0x88, 0x98, 0x0d };
328 const uint8_t dst_g4_to_g2_x15[] = { 0x88, 0x98, 0xdd, 0x0d };
329 const uint8_t dst_g4_to_a2_x9[] = { 0x88, 0x98, 0x01 };
330 const uint8_t dst_g4_to_a2_x13[] = { 0x88, 0x98, 0xdd, 0x01 };
331
332 const uint8_t dst_g4_to_g8_x10[] = { 0x11, 0x88, 0x22, 0x99, 0x33, 0xaa, 0x44, 0xbb, 0x55, 0xcc };
333 const uint8_t dst_g4_to_g8_x15[] = {
334 0x11, 0x88, 0x22, 0x99, 0x33, 0xaa, 0x44, 0xbb,
335 0x55, 0xcc, 0x66, 0xdd, 0x77, 0xee, 0x11
336 };
337 const uint8_t dst_g4_to_a8_x9[] = { 0x11, 0x88, 0x22, 0x99, 0x33, 0xaa, 0x44, 0xbb, 0x55 };
338 const uint8_t dst_g4_to_a8_x13[] = {
339 0x11, 0x88, 0x22, 0x99, 0x33, 0xaa, 0x44, 0xbb,
340 0x55, 0xcc, 0x66, 0xdd, 0x77
341 };
342
343 const uint8_t dst_g4_to_rgb888_x10[] = {
344 0x11, 0x11, 0x11, 0x88, 0x88, 0x88, 0x22, 0x22,
345 0x22, 0x99, 0x99, 0x99, 0x33, 0x33, 0x33, 0xaa,
346 0xaa, 0xaa, 0x44, 0x44, 0x44, 0xbb, 0xbb, 0xbb,
347 0x55, 0x55, 0x55, 0xcc, 0xcc, 0xcc
348 };
349 const uint8_t dst_g4_to_rgb888_x15[] = {
350 0x11, 0x11, 0x11, 0x88, 0x88, 0x88, 0x22, 0x22,
351 0x22, 0x99, 0x99, 0x99, 0x33, 0x33, 0x33, 0xaa,
352 0xaa, 0xaa, 0x44, 0x44, 0x44, 0xbb, 0xbb, 0xbb,
353 0x55, 0x55, 0x55, 0xcc, 0xcc, 0xcc, 0x66, 0x66,
354 0x66, 0xdd, 0xdd, 0xdd, 0x77, 0x77, 0x77, 0xee,
355 0xee, 0xee, 0x11, 0x11, 0x11
356 };
357
358 const uint8_t dst_g4_to_rgba8888_x10[] = {
359 0x11, 0x11, 0x11, 0xff, 0x88, 0x88, 0x88, 0xff,
360 0x22, 0x22, 0x22, 0xff, 0x99, 0x99, 0x99, 0xff,
361 0x33, 0x33, 0x33, 0xff, 0xaa, 0xaa, 0xaa, 0xff,
362 0x44, 0x44, 0x44, 0xff, 0xbb, 0xbb, 0xbb, 0xff,
363 0x55, 0x55, 0x55, 0xff, 0xcc, 0xcc, 0xcc, 0xff
364 };
365 const uint8_t dst_g4_to_rgba8888_x15[] = {
366 0x11, 0x11, 0x11, 0xff, 0x88, 0x88, 0x88, 0xff,
367 0x22, 0x22, 0x22, 0xff, 0x99, 0x99, 0x99, 0xff,
368 0x33, 0x33, 0x33, 0xff, 0xaa, 0xaa, 0xaa, 0xff,
369 0x44, 0x44, 0x44, 0xff, 0xbb, 0xbb, 0xbb, 0xff,
370 0x55, 0x55, 0x55, 0xff, 0xcc, 0xcc, 0xcc, 0xff,
371 0x66, 0x66, 0x66, 0xff, 0xdd, 0xdd, 0xdd, 0xff,
372 0x77, 0x77, 0x77, 0xff, 0xee, 0xee, 0xee, 0xff,
373 0x11, 0x11, 0x11, 0xff
374 };
375
376 const uint8_t dst_g4_to_prgba8888_x10[] = {
377 0x11, 0x11, 0x11, 0xff, 0x88, 0x88, 0x88, 0xff,
378 0x22, 0x22, 0x22, 0xff, 0x99, 0x99, 0x99, 0xff,
379 0x33, 0x33, 0x33, 0xff, 0xaa, 0xaa, 0xaa, 0xff,
380 0x44, 0x44, 0x44, 0xff, 0xbb, 0xbb, 0xbb, 0xff,
381 0x55, 0x55, 0x55, 0xff, 0xcc, 0xcc, 0xcc, 0xff
382 };
383 const uint8_t dst_g4_to_prgba8888_x15[] = {
384 0x11, 0x11, 0x11, 0xff, 0x88, 0x88, 0x88, 0xff,
385 0x22, 0x22, 0x22, 0xff, 0x99, 0x99, 0x99, 0xff,
386 0x33, 0x33, 0x33, 0xff, 0xaa, 0xaa, 0xaa, 0xff,
387 0x44, 0x44, 0x44, 0xff, 0xbb, 0xbb, 0xbb, 0xff,
388 0x55, 0x55, 0x55, 0xff, 0xcc, 0xcc, 0xcc, 0xff,
389 0x66, 0x66, 0x66, 0xff, 0xdd, 0xdd, 0xdd, 0xff,
390 0x77, 0x77, 0x77, 0xff, 0xee, 0xee, 0xee, 0xff,
391 0x11, 0x11, 0x11, 0xff
392 };
393
394 // Data for a4 testing
395 const uint8_t src_a4[] = { 0x18, 0x29, 0x3a, 0x4b, 0x5c, 0x6d, 0x7e, 0x1f };
396
397 const uint8_t dst_a4_to_g1_x10[] = { 0x55, 0x01 };
398 const uint8_t dst_a4_to_g1_x15[] = { 0x55, 0x55 };
399 const uint8_t dst_a4_to_a1_x9[] = { 0x55, 0x01 };
400 const uint8_t dst_a4_to_a1_x14[] = { 0x55, 0x15 };
401
402 const uint8_t dst_a4_to_g2_x10[] = { 0x22, 0x62, 0x07 };
403 const uint8_t dst_a4_to_g2_x15[] = { 0x22, 0x62, 0x77, 0x37 };
404 const uint8_t dst_a4_to_a2_x9[] = { 0x22, 0x62, 0x03 };
405 const uint8_t dst_a4_to_a2_x13[] = { 0x22, 0x62, 0x77, 0x03 };
406
407 const uint8_t dst_a4_to_g8_x10[] = { 0x88, 0x11, 0x99, 0x22, 0xaa, 0x33, 0xbb, 0x44, 0xcc, 0x55 };
408 const uint8_t dst_a4_to_g8_x15[] = {
409 0x88, 0x11, 0x99, 0x22, 0xaa, 0x33, 0xbb, 0x44,
410 0xcc, 0x55, 0xdd, 0x66, 0xee, 0x77, 0xff
411 };
412 const uint8_t dst_a4_to_a8_x9[] = { 0x88, 0x11, 0x99, 0x22, 0xaa, 0x33, 0xbb, 0x44, 0xcc };
413 const uint8_t dst_a4_to_a8_x13[] = {
414 0x88, 0x11, 0x99, 0x22, 0xaa, 0x33, 0xbb, 0x44,
415 0xcc, 0x55, 0xdd, 0x66, 0xee
416 };
417
418 const uint8_t dst_a4_to_rgb888_x10[] = {
419 0x88, 0x88, 0x88, 0x11, 0x11, 0x11, 0x99, 0x99,
420 0x99, 0x22, 0x22, 0x22, 0xaa, 0xaa, 0xaa, 0x33,
421 0x33, 0x33, 0xbb, 0xbb, 0xbb, 0x44, 0x44, 0x44,
422 0xcc, 0xcc, 0xcc, 0x55, 0x55, 0x55
423 };
424 const uint8_t dst_a4_to_rgb888_x15[] = {
425 0x88, 0x88, 0x88, 0x11, 0x11, 0x11, 0x99, 0x99,
426 0x99, 0x22, 0x22, 0x22, 0xaa, 0xaa, 0xaa, 0x33,
427 0x33, 0x33, 0xbb, 0xbb, 0xbb, 0x44, 0x44, 0x44,
428 0xcc, 0xcc, 0xcc, 0x55, 0x55, 0x55, 0xdd, 0xdd,
429 0xdd, 0x66, 0x66, 0x66, 0xee, 0xee, 0xee, 0x77,
430 0x77, 0x77, 0xff, 0xff, 0xff
431 };
432
433 const uint8_t dst_a4_to_rgba8888_x10[] = {
434 0xff, 0xff, 0xff, 0x88, 0xff, 0xff, 0xff, 0x11,
435 0xff, 0xff, 0xff, 0x99, 0xff, 0xff, 0xff, 0x22,
436 0xff, 0xff, 0xff, 0xaa, 0xff, 0xff, 0xff, 0x33,
437 0xff, 0xff, 0xff, 0xbb, 0xff, 0xff, 0xff, 0x44,
438 0xff, 0xff, 0xff, 0xcc, 0xff, 0xff, 0xff, 0x55
439 };
440 const uint8_t dst_a4_to_rgba8888_x15[] = {
441 0xff, 0xff, 0xff, 0x88, 0xff, 0xff, 0xff, 0x11,
442 0xff, 0xff, 0xff, 0x99, 0xff, 0xff, 0xff, 0x22,
443 0xff, 0xff, 0xff, 0xaa, 0xff, 0xff, 0xff, 0x33,
444 0xff, 0xff, 0xff, 0xbb, 0xff, 0xff, 0xff, 0x44,
445 0xff, 0xff, 0xff, 0xcc, 0xff, 0xff, 0xff, 0x55,
446 0xff, 0xff, 0xff, 0xdd, 0xff, 0xff, 0xff, 0x66,
447 0xff, 0xff, 0xff, 0xee, 0xff, 0xff, 0xff, 0x77,
448 0xff, 0xff, 0xff, 0xff
449 };
450
451 const uint8_t dst_a4_to_prgba8888_x10[] = {
452 0x88, 0x88, 0x88, 0x88, 0x11, 0x11, 0x11, 0x11,
453 0x99, 0x99, 0x99, 0x99, 0x22, 0x22, 0x22, 0x22,
454 0xaa, 0xaa, 0xaa, 0xaa, 0x33, 0x33, 0x33, 0x33,
455 0xbb, 0xbb, 0xbb, 0xbb, 0x44, 0x44, 0x44, 0x44,
456 0xcc, 0xcc, 0xcc, 0xcc, 0x55, 0x55, 0x55, 0x55
457 };
458 const uint8_t dst_a4_to_prgba8888_x15[] = {
459 0x88, 0x88, 0x88, 0x88, 0x11, 0x11, 0x11, 0x11,
460 0x99, 0x99, 0x99, 0x99, 0x22, 0x22, 0x22, 0x22,
461 0xaa, 0xaa, 0xaa, 0xaa, 0x33, 0x33, 0x33, 0x33,
462 0xbb, 0xbb, 0xbb, 0xbb, 0x44, 0x44, 0x44, 0x44,
463 0xcc, 0xcc, 0xcc, 0xcc, 0x55, 0x55, 0x55, 0x55,
464 0xdd, 0xdd, 0xdd, 0xdd, 0x66, 0x66, 0x66, 0x66,
465 0xee, 0xee, 0xee, 0xee, 0x77, 0x77, 0x77, 0x77,
466 0xff, 0xff, 0xff, 0xff
467 };
468
469 // Data for g8 testing
470 const uint8_t src_g8[] = { 0x88, 0x11, 0x99, 0x22, 0xaa, 0x33, 0xbb, 0x44, 0xcc, 0x55, 0xdd, 0x55, 0xee, 0x66, 0xff, 0x77 };
471
472 const uint8_t dst_g8_to_g1_x10[] = { 0x55, 0x01 };
473 const uint8_t dst_g8_to_g1_x15[] = { 0x55, 0x55 };
474 const uint8_t dst_g8_to_a1_x9[] = { 0x55, 0x01 };
475 const uint8_t dst_g8_to_a1_x15[] = { 0x55, 0x55 };
476
477 const uint8_t dst_g8_to_g2_x10[] = { 0x22, 0x62, 0x07};
478 const uint8_t dst_g8_to_g2_x15[] = { 0x22, 0x62, 0x77, 0x37 };
479 const uint8_t dst_g8_to_a2_x9[] = { 0x22, 0x62, 0x03 };
480 const uint8_t dst_g8_to_a2_x13[] = { 0x22, 0x62, 0x77, 0x03 };
481
482 const uint8_t dst_g8_to_g4_x10[] = { 0x18, 0x29, 0x3a, 0x4b, 0x5c };
483 const uint8_t dst_g8_to_g4_x15[] = { 0x18, 0x29, 0x3a, 0x4b, 0x5c, 0x5d, 0x6e, 0x0f };
484 const uint8_t dst_g8_to_a4_x9[] = { 0x18, 0x29, 0x3a, 0x4b, 0x0c };
485 const uint8_t dst_g8_to_a4_x13[] = { 0x18, 0x29, 0x3a, 0x4b, 0x5c, 0x5d, 0x0e };
486
487 const uint8_t dst_g8_to_rgb888_x10[] = {
488 0x88, 0x88, 0x88, 0x11, 0x11, 0x11, 0x99, 0x99,
489 0x99, 0x22, 0x22, 0x22, 0xaa, 0xaa, 0xaa, 0x33,
490 0x33, 0x33, 0xbb, 0xbb, 0xbb, 0x44, 0x44, 0x44,
491 0xcc, 0xcc, 0xcc, 0x55, 0x55, 0x55
492 };
493 const uint8_t dst_g8_to_rgb888_x15[] = {
494 0x88, 0x88, 0x88, 0x11, 0x11, 0x11, 0x99, 0x99,
495 0x99, 0x22, 0x22, 0x22, 0xaa, 0xaa, 0xaa, 0x33,
496 0x33, 0x33, 0xbb, 0xbb, 0xbb, 0x44, 0x44, 0x44,
497 0xcc, 0xcc, 0xcc, 0x55, 0x55, 0x55, 0xdd, 0xdd,
498 0xdd, 0x55, 0x55, 0x55, 0xee, 0xee, 0xee, 0x66,
499 0x66, 0x66, 0xff, 0xff, 0xff
500 };
501
502 const uint8_t dst_g8_to_rgba8888_x10[] = {
503 0x88, 0x88, 0x88, 0xff, 0x11, 0x11, 0x11, 0xff,
504 0x99, 0x99, 0x99, 0xff, 0x22, 0x22, 0x22, 0xff,
505 0xaa, 0xaa, 0xaa, 0xff, 0x33, 0x33, 0x33, 0xff,
506 0xbb, 0xbb, 0xbb, 0xff, 0x44, 0x44, 0x44, 0xff,
507 0xcc, 0xcc, 0xcc, 0xff, 0x55, 0x55, 0x55, 0xff
508 };
509 const uint8_t dst_g8_to_rgba8888_x15[] = {
510 0x88, 0x88, 0x88, 0xff, 0x11, 0x11, 0x11, 0xff,
511 0x99, 0x99, 0x99, 0xff, 0x22, 0x22, 0x22, 0xff,
512 0xaa, 0xaa, 0xaa, 0xff, 0x33, 0x33, 0x33, 0xff,
513 0xbb, 0xbb, 0xbb, 0xff, 0x44, 0x44, 0x44, 0xff,
514 0xcc, 0xcc, 0xcc, 0xff, 0x55, 0x55, 0x55, 0xff,
515 0xdd, 0xdd, 0xdd, 0xff, 0x55, 0x55, 0x55, 0xff,
516 0xee, 0xee, 0xee, 0xff, 0x66, 0x66, 0x66, 0xff,
517 0xff, 0xff, 0xff, 0xff
518 };
519
520 const uint8_t dst_g8_to_prgba8888_x10[] = {
521 0x88, 0x88, 0x88, 0xff, 0x11, 0x11, 0x11, 0xff,
522 0x99, 0x99, 0x99, 0xff, 0x22, 0x22, 0x22, 0xff,
523 0xaa, 0xaa, 0xaa, 0xff, 0x33, 0x33, 0x33, 0xff,
524 0xbb, 0xbb, 0xbb, 0xff, 0x44, 0x44, 0x44, 0xff,
525 0xcc, 0xcc, 0xcc, 0xff, 0x55, 0x55, 0x55, 0xff
526 };
527 const uint8_t dst_g8_to_prgba8888_x15[] = {
528 0x88, 0x88, 0x88, 0xff, 0x11, 0x11, 0x11, 0xff,
529 0x99, 0x99, 0x99, 0xff, 0x22, 0x22, 0x22, 0xff,
530 0xaa, 0xaa, 0xaa, 0xff, 0x33, 0x33, 0x33, 0xff,
531 0xbb, 0xbb, 0xbb, 0xff, 0x44, 0x44, 0x44, 0xff,
532 0xcc, 0xcc, 0xcc, 0xff, 0x55, 0x55, 0x55, 0xff,
533 0xdd, 0xdd, 0xdd, 0xff, 0x55, 0x55, 0x55, 0xff,
534 0xee, 0xee, 0xee, 0xff, 0x66, 0x66, 0x66, 0xff,
535 0xff, 0xff, 0xff, 0xff
536 };
537
538 // Data for a8 testing
539 const uint8_t src_a8[] = { 0x11, 0x99, 0x22, 0xaa, 0x33, 0xbb, 0x44, 0xcc, 0x55, 0xdd, 0x55, 0xee, 0x66, 0xff, 0x77, 0x88 };
540
541 const uint8_t dst_a8_to_g1_x10[] = { 0xaa, 0x02 };
542 const uint8_t dst_a8_to_g1_x15[] = { 0xaa, 0x2a };
543 const uint8_t dst_a8_to_a1_x9[] = { 0xaa, 0x00 };
544 const uint8_t dst_a8_to_a1_x15[] = { 0xaa, 0x2a };
545
546 const uint8_t dst_a8_to_g2_x10[] = { 0x88, 0xd8, 0x0d };
547 const uint8_t dst_a8_to_g2_x15[] = { 0x88, 0xd8, 0xdd, 0x1d };
548 const uint8_t dst_a8_to_a2_x9[] = { 0x88, 0xd8, 0x01 };
549 const uint8_t dst_a8_to_a2_x13[] = { 0x88, 0xd8, 0xdd, 0x01 };
550
551 const uint8_t dst_a8_to_g4_x10[] = { 0x91, 0xa2, 0xb3, 0xc4, 0xd5 };
552 const uint8_t dst_a8_to_g4_x15[] = { 0x91, 0xa2, 0xb3, 0xc4, 0xd5, 0xe5, 0xf6, 0x07 };
553 const uint8_t dst_a8_to_a4_x9[] = { 0x91, 0xa2, 0xb3, 0xc4, 0x05 };
554 const uint8_t dst_a8_to_a4_x13[] = { 0x91, 0xa2, 0xb3, 0xc4, 0xd5, 0xe5, 0x06 };
555
556 const uint8_t dst_a8_to_rgb888_x10[] = {
557 0x11, 0x11, 0x11, 0x99, 0x99, 0x99, 0x22, 0x22,
558 0x22, 0xaa, 0xaa, 0xaa, 0x33, 0x33, 0x33, 0xbb,
559 0xbb, 0xbb, 0x44, 0x44, 0x44, 0xcc, 0xcc, 0xcc,
560 0x55, 0x55, 0x55, 0xdd, 0xdd, 0xdd
561 };
562 const uint8_t dst_a8_to_rgb888_x15[] = {
563 0x11, 0x11, 0x11, 0x99, 0x99, 0x99, 0x22, 0x22,
564 0x22, 0xaa, 0xaa, 0xaa, 0x33, 0x33, 0x33, 0xbb,
565 0xbb, 0xbb, 0x44, 0x44, 0x44, 0xcc, 0xcc, 0xcc,
566 0x55, 0x55, 0x55, 0xdd, 0xdd, 0xdd, 0x55, 0x55,
567 0x55, 0xee, 0xee, 0xee, 0x66, 0x66, 0x66, 0xff,
568 0xff, 0xff, 0x77, 0x77, 0x77
569 };
570
571 const uint8_t dst_a8_to_rgba8888_x10[] = {
572 0xff, 0xff, 0xff, 0x11, 0xff, 0xff, 0xff, 0x99,
573 0xff, 0xff, 0xff, 0x22, 0xff, 0xff, 0xff, 0xaa,
574 0xff, 0xff, 0xff, 0x33, 0xff, 0xff, 0xff, 0xbb,
575 0xff, 0xff, 0xff, 0x44, 0xff, 0xff, 0xff, 0xcc,
576 0xff, 0xff, 0xff, 0x55, 0xff, 0xff, 0xff, 0xdd
577 };
578 const uint8_t dst_a8_to_rgba8888_x15[] = {
579 0xff, 0xff, 0xff, 0x11, 0xff, 0xff, 0xff, 0x99,
580 0xff, 0xff, 0xff, 0x22, 0xff, 0xff, 0xff, 0xaa,
581 0xff, 0xff, 0xff, 0x33, 0xff, 0xff, 0xff, 0xbb,
582 0xff, 0xff, 0xff, 0x44, 0xff, 0xff, 0xff, 0xcc,
583 0xff, 0xff, 0xff, 0x55, 0xff, 0xff, 0xff, 0xdd,
584 0xff, 0xff, 0xff, 0x55, 0xff, 0xff, 0xff, 0xee,
585 0xff, 0xff, 0xff, 0x66, 0xff, 0xff, 0xff, 0xff,
586 0xff, 0xff, 0xff, 0x77
587 };
588
589 const uint8_t dst_a8_to_prgba8888_x10[] = {
590 0x11, 0x11, 0x11, 0x11, 0x99, 0x99, 0x99, 0x99,
591 0x22, 0x22, 0x22, 0x22, 0xaa, 0xaa, 0xaa, 0xaa,
592 0x33, 0x33, 0x33, 0x33, 0xbb, 0xbb, 0xbb, 0xbb,
593 0x44, 0x44, 0x44, 0x44, 0xcc, 0xcc, 0xcc, 0xcc,
594 0x55, 0x55, 0x55, 0x55, 0xdd, 0xdd, 0xdd, 0xdd
595 };
596 const uint8_t dst_a8_to_prgba8888_x15[] = {
597 0x11, 0x11, 0x11, 0x11, 0x99, 0x99, 0x99, 0x99,
598 0x22, 0x22, 0x22, 0x22, 0xaa, 0xaa, 0xaa, 0xaa,
599 0x33, 0x33, 0x33, 0x33, 0xbb, 0xbb, 0xbb, 0xbb,
600 0x44, 0x44, 0x44, 0x44, 0xcc, 0xcc, 0xcc, 0xcc,
601 0x55, 0x55, 0x55, 0x55, 0xdd, 0xdd, 0xdd, 0xdd,
602 0x55, 0x55, 0x55, 0x55, 0xee, 0xee, 0xee, 0xee,
603 0x66, 0x66, 0x66, 0x66, 0xff, 0xff, 0xff, 0xff,
604 0x77, 0x77, 0x77, 0x77
605 };
606
607 // Data for rgb888 testing
608 const uint8_t src_rgb888[] = {
609 0x88, 0x88, 0x88, 0x11, 0x11, 0x11, 0x99, 0x99,
610 0x99, 0x22, 0x22, 0x22, 0xaa, 0xaa, 0xaa, 0x33,
611 0x33, 0x33, 0xbb, 0xbb, 0xbb, 0x44, 0x44, 0x44,
612 0xcc, 0xcc, 0xcc, 0x55, 0x55, 0x55, 0xdd, 0xdd,
613 0xdd, 0x66, 0x66, 0x66, 0xee, 0xee, 0xee, 0x77,
614 0x77, 0x77, 0xff, 0xff, 0xff, 0x77, 0x77, 0x77
615 };
616
617 const uint8_t dst_rgb888_to_g1_x10[] = { 0x55, 0x01 };
618 const uint8_t dst_rgb888_to_g1_x15[] = { 0x55, 0x55 };
619 const uint8_t dst_rgb888_to_a1_x9[] = { 0x55, 0x01 };
620 const uint8_t dst_rgb888_to_a1_x15[] = { 0x55, 0x55 };
621
622 const uint8_t dst_rgb888_to_g2_x10[] = { 0x22, 0x62, 0x07};
623 const uint8_t dst_rgb888_to_g2_x15[] = { 0x22, 0x62, 0x77, 0x37 };
624 const uint8_t dst_rgb888_to_a2_x9[] = { 0x22, 0x62, 0x03 };
625 const uint8_t dst_rgb888_to_a2_x13[] = { 0x22, 0x62, 0x77, 0x03 };
626
627 const uint8_t dst_rgb888_to_g4_x10[] = { 0x18, 0x29, 0x3a, 0x4b, 0x5c };
628 const uint8_t dst_rgb888_to_g4_x15[] = { 0x18, 0x29, 0x3a, 0x4b, 0x5c, 0x6d, 0x7e, 0x0f };
629 const uint8_t dst_rgb888_to_a4_x9[] = { 0x18, 0x29, 0x3a, 0x4b, 0x0c };
630 const uint8_t dst_rgb888_to_a4_x13[] = { 0x18, 0x29, 0x3a, 0x4b, 0x5c, 0x6d, 0x0e };
631
632 const uint8_t dst_rgb888_to_g8_x10[] = {
633 0x88, 0x11, 0x99, 0x22, 0xaa, 0x33, 0xbb, 0x44,
634 0xcc, 0x55
635 };
636 const uint8_t dst_rgb888_to_g8_x15[] = {
637 0x88, 0x11, 0x99, 0x22, 0xaa, 0x33, 0xbb, 0x44,
638 0xcc, 0x55, 0xdd, 0x66, 0xee, 0x77, 0xff
639 };
640 const uint8_t dst_rgb888_to_a8_x9[] = {
641 0x88, 0x11, 0x99, 0x22, 0xaa, 0x33, 0xbb, 0x44,
642 0xcc
643 };
644 const uint8_t dst_rgb888_to_a8_x13[] = {
645 0x88, 0x11, 0x99, 0x22, 0xaa, 0x33, 0xbb, 0x44,
646 0xcc, 0x55, 0xdd, 0x66, 0xee
647 };
648
649 const uint8_t dst_rgb888_to_rgba8888_x10[] = {
650 0x88, 0x88, 0x88, 0xff, 0x11, 0x11, 0x11, 0xff,
651 0x99, 0x99, 0x99, 0xff, 0x22, 0x22, 0x22, 0xff,
652 0xaa, 0xaa, 0xaa, 0xff, 0x33, 0x33, 0x33, 0xff,
653 0xbb, 0xbb, 0xbb, 0xff, 0x44, 0x44, 0x44, 0xff,
654 0xcc, 0xcc, 0xcc, 0xff, 0x55, 0x55, 0x55, 0xff
655 };
656 const uint8_t dst_rgb888_to_rgba8888_x15[] = {
657 0x88, 0x88, 0x88, 0xff, 0x11, 0x11, 0x11, 0xff,
658 0x99, 0x99, 0x99, 0xff, 0x22, 0x22, 0x22, 0xff,
659 0xaa, 0xaa, 0xaa, 0xff, 0x33, 0x33, 0x33, 0xff,
660 0xbb, 0xbb, 0xbb, 0xff, 0x44, 0x44, 0x44, 0xff,
661 0xcc, 0xcc, 0xcc, 0xff, 0x55, 0x55, 0x55, 0xff,
662 0xdd, 0xdd, 0xdd, 0xff, 0x66, 0x66, 0x66, 0xff,
663 0xee, 0xee, 0xee, 0xff, 0x77, 0x77, 0x77, 0xff,
664 0xff, 0xff, 0xff, 0xff
665 };
666
667 const uint8_t dst_rgb888_to_prgba8888_x10[] = {
668 0x88, 0x88, 0x88, 0xff, 0x11, 0x11, 0x11, 0xff,
669 0x99, 0x99, 0x99, 0xff, 0x22, 0x22, 0x22, 0xff,
670 0xaa, 0xaa, 0xaa, 0xff, 0x33, 0x33, 0x33, 0xff,
671 0xbb, 0xbb, 0xbb, 0xff, 0x44, 0x44, 0x44, 0xff,
672 0xcc, 0xcc, 0xcc, 0xff, 0x55, 0x55, 0x55, 0xff
673 };
674 const uint8_t dst_rgb888_to_prgba8888_x15[] = {
675 0x88, 0x88, 0x88, 0xff, 0x11, 0x11, 0x11, 0xff,
676 0x99, 0x99, 0x99, 0xff, 0x22, 0x22, 0x22, 0xff,
677 0xaa, 0xaa, 0xaa, 0xff, 0x33, 0x33, 0x33, 0xff,
678 0xbb, 0xbb, 0xbb, 0xff, 0x44, 0x44, 0x44, 0xff,
679 0xcc, 0xcc, 0xcc, 0xff, 0x55, 0x55, 0x55, 0xff,
680 0xdd, 0xdd, 0xdd, 0xff, 0x66, 0x66, 0x66, 0xff,
681 0xee, 0xee, 0xee, 0xff, 0x77, 0x77, 0x77, 0xff,
682 0xff, 0xff, 0xff, 0xff
683 };
684
685 // Data for rgba8888 testing
686 const uint8_t src_rgba8888[] = {
687 0x88, 0x88, 0x88, 0x11, 0x11, 0x11, 0x11, 0x88,
688 0x99, 0x99, 0x99, 0x22, 0x22, 0x22, 0x22, 0x99,
689 0xaa, 0xaa, 0xaa, 0x33, 0x33, 0x33, 0x33, 0xaa,
690 0xbb, 0xbb, 0xbb, 0x44, 0x44, 0x44, 0x44, 0xbb,
691 0xcc, 0xcc, 0xcc, 0x55, 0x55, 0x55, 0x55, 0xcc,
692 0xdd, 0xdd, 0xdd, 0x66, 0x66, 0x66, 0x66, 0xdd,
693 0xee, 0xee, 0xee, 0x77, 0x77, 0x77, 0x77, 0xee,
694 0xff, 0xff, 0xff, 0x11, 0x11, 0x11, 0x11, 0xff,
695 };
696
697 const uint8_t dst_rgba8888_to_g1_x10[] = { 0x55, 0x01 };
698 const uint8_t dst_rgba8888_to_g1_x15[] = { 0x55, 0x55 };
699 const uint8_t dst_rgba8888_to_a1_x9[] = { 0xaa, 0x00 };
700 const uint8_t dst_rgba8888_to_a1_x15[] = { 0xaa, 0x2a };
701
702 const uint8_t dst_rgba8888_to_g2_x10[] = { 0x22, 0x62, 0x07};
703 const uint8_t dst_rgba8888_to_g2_x15[] = { 0x22, 0x62, 0x77, 0x37 };
704 const uint8_t dst_rgba8888_to_a2_x9[] = { 0x88, 0x98, 0x01 };
705 const uint8_t dst_rgba8888_to_a2_x13[] = { 0x88, 0x98, 0xdd, 0x01 };
706
707 const uint8_t dst_rgba8888_to_g4_x10[] = { 0x18, 0x29, 0x3a, 0x4b, 0x5c };
708 const uint8_t dst_rgba8888_to_g4_x15[] = { 0x18, 0x29, 0x3a, 0x4b, 0x5c, 0x6d, 0x7e, 0x0f };
709 const uint8_t dst_rgba8888_to_a4_x9[] = { 0x81, 0x92, 0xa3, 0xb4, 0x05 };
710 const uint8_t dst_rgba8888_to_a4_x13[] = { 0x81, 0x92, 0xa3, 0xb4, 0xc5, 0xd6, 0x07 };
711
712 const uint8_t dst_rgba8888_to_g8_x10[] = {
713 0x88, 0x11, 0x99, 0x22, 0xaa, 0x33, 0xbb, 0x44,
714 0xcc, 0x55
715 };
716 const uint8_t dst_rgba8888_to_g8_x15[] = {
717 0x88, 0x11, 0x99, 0x22, 0xaa, 0x33, 0xbb, 0x44,
718 0xcc, 0x55, 0xdd, 0x66, 0xee, 0x77, 0xff
719 };
720 const uint8_t dst_rgba8888_to_a8_x9[] = {
721 0x11, 0x88, 0x22, 0x99, 0x33, 0xaa, 0x44, 0xbb,
722 0x55
723 };
724 const uint8_t dst_rgba8888_to_a8_x13[] = {
725 0x11, 0x88, 0x22, 0x99, 0x33, 0xaa, 0x44, 0xbb,
726 0x55, 0xcc, 0x66, 0xdd, 0x77
727 };
728
729 const uint8_t dst_rgba8888_to_rgb888_x15[] = {
730 0x88, 0x88, 0x88, 0x11, 0x11, 0x11, 0x99, 0x99,
731 0x99, 0x22, 0x22, 0x22, 0xaa, 0xaa, 0xaa, 0x33,
732 0x33, 0x33, 0xbb, 0xbb, 0xbb, 0x44, 0x44, 0x44,
733 0xcc, 0xcc, 0xcc, 0x55, 0x55, 0x55, 0xdd, 0xdd,
734 0xdd, 0x66, 0x66, 0x66, 0xee, 0xee, 0xee, 0x77,
735 0x77, 0x77, 0xff, 0xff, 0xff
736 };
737 const uint8_t dst_rgba8888_to_rgb888_x10[] = {
738 0x88, 0x88, 0x88, 0x11, 0x11, 0x11, 0x99, 0x99,
739 0x99, 0x22, 0x22, 0x22, 0xaa, 0xaa, 0xaa, 0x33,
740 0x33, 0x33, 0xbb, 0xbb, 0xbb, 0x44, 0x44, 0x44,
741 0xcc, 0xcc, 0xcc, 0x55, 0x55, 0x55
742 };
743
744 const uint8_t dst_rgba8888_to_prgba8888_x10[] = {
745 0x09, 0x09, 0x09, 0x11, 0x09, 0x09, 0x09, 0x88,
746 0x14, 0x14, 0x14, 0x22, 0x14, 0x14, 0x14, 0x99,
747 0x22, 0x22, 0x22, 0x33, 0x22, 0x22, 0x22, 0xaa,
748 0x31, 0x31, 0x31, 0x44, 0x31, 0x31, 0x31, 0xbb,
749 0x44, 0x44, 0x44, 0x55, 0x44, 0x44, 0x44, 0xcc
750 };
751 const uint8_t dst_rgba8888_to_prgba8888_x15[] = {
752 0x09, 0x09, 0x09, 0x11, 0x09, 0x09, 0x09, 0x88,
753 0x14, 0x14, 0x14, 0x22, 0x14, 0x14, 0x14, 0x99,
754 0x22, 0x22, 0x22, 0x33, 0x22, 0x22, 0x22, 0xaa,
755 0x31, 0x31, 0x31, 0x44, 0x31, 0x31, 0x31, 0xbb,
756 0x44, 0x44, 0x44, 0x55, 0x44, 0x44, 0x44, 0xcc,
757 0x58, 0x58, 0x58, 0x66, 0x58, 0x58, 0x58, 0xdd,
758 0x6f, 0x6f, 0x6f, 0x77, 0x6f, 0x6f, 0x6f, 0xee,
759 0x11, 0x11, 0x11, 0x11
760 };
761
762 // Data for prgba8888 testing
763 const uint8_t src_prgba8888[] = {
764 0x88, 0x88, 0x88, 0x88, 0x11, 0x11, 0x11, 0x00,
765 0x99, 0x99, 0x99, 0x99, 0x22, 0x22, 0x22, 0x00,
766 0xaa, 0xaa, 0xaa, 0xaa, 0x33, 0x33, 0x33, 0x00,
767 0xbb, 0xbb, 0xbb, 0xbb, 0x44, 0x44, 0x44, 0x00,
768 0xcc, 0xcc, 0xcc, 0xcc, 0x55, 0x55, 0x55, 0x00,
769 0xdd, 0xdd, 0xdd, 0xdd, 0x66, 0x66, 0x66, 0x00,
770 0xee, 0xee, 0xee, 0xee, 0x77, 0x77, 0x77, 0x00,
771 0xff, 0xff, 0xff, 0xff, 0x11, 0x11, 0x11, 0x00
772 };
773
774 const uint8_t dst_prgba8888_to_g1_x10[] = { 0x55, 0x01 };
775 const uint8_t dst_prgba8888_to_g1_x15[] = { 0x55, 0x55 };
776 const uint8_t dst_prgba8888_to_a1_x9[] = { 0x55, 0x01 };
777 const uint8_t dst_prgba8888_to_a1_x15[] = { 0x55, 0x55 };
778
779 const uint8_t dst_prgba8888_to_g2_x10[] = { 0x33, 0x33, 0x03 };
780 const uint8_t dst_prgba8888_to_g2_x15[] = { 0x33, 0x33, 0x33, 0x33 };
781 const uint8_t dst_prgba8888_to_a2_x9[] = { 0x22, 0x22, 0x03 };
782 const uint8_t dst_prgba8888_to_a2_x13[] = { 0x22, 0x22, 0x33, 0x03 };
783
784 const uint8_t dst_prgba8888_to_g4_x10[] = { 0x0f, 0x0f, 0x0f, 0x0f, 0x0f };
785 const uint8_t dst_prgba8888_to_g4_x15[] = { 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f };
786 const uint8_t dst_prgba8888_to_a4_x9[] = { 0x08, 0x09, 0x0a, 0x0b, 0x0c };
787 const uint8_t dst_prgba8888_to_a4_x13[] = { 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e };
788
789 const uint8_t dst_prgba8888_to_g8_x10[] = {
790 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00,
791 0xff, 0x00
792 };
793 const uint8_t dst_prgba8888_to_g8_x15[] = {
794 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00,
795 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff
796 };
797 const uint8_t dst_prgba8888_to_a8_x9[] = {
798 0x88, 0x00, 0x99, 0x00, 0xaa, 0x00, 0xbb, 0x00,
799 0xcc
800 };
801 const uint8_t dst_prgba8888_to_a8_x13[] = {
802 0x88, 0x00, 0x99, 0x00, 0xaa, 0x00, 0xbb, 0x00,
803 0xcc, 0x00, 0xdd, 0x00, 0xee
804 };
805
806 const uint8_t dst_prgba8888_to_rgb888_x10[] = {
807 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff,
808 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00,
809 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00,
810 0xff, 0xff, 0xff, 0x00, 0x00, 0x00
811 };
812 const uint8_t dst_prgba8888_to_rgb888_x15[] = {
813 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff,
814 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00,
815 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00,
816 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff,
817 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00,
818 0x00, 0x00, 0xff, 0xff, 0xff
819 };
820
821 const uint8_t dst_prgba8888_to_rgba8888_x10[] = {
822 0xff, 0xff, 0xff, 0x88, 0x00, 0x00, 0x00, 0x00,
823 0xff, 0xff, 0xff, 0x99, 0x00, 0x00, 0x00, 0x00,
824 0xff, 0xff, 0xff, 0xaa, 0x00, 0x00, 0x00, 0x00,
825 0xff, 0xff, 0xff, 0xbb, 0x00, 0x00, 0x00, 0x00,
826 0xff, 0xff, 0xff, 0xcc, 0x00, 0x00, 0x00, 0x00
827 };
828 const uint8_t dst_prgba8888_to_rgba8888_x15[] = {
829 0xff, 0xff, 0xff, 0x88, 0x00, 0x00, 0x00, 0x00,
830 0xff, 0xff, 0xff, 0x99, 0x00, 0x00, 0x00, 0x00,
831 0xff, 0xff, 0xff, 0xaa, 0x00, 0x00, 0x00, 0x00,
832 0xff, 0xff, 0xff, 0xbb, 0x00, 0x00, 0x00, 0x00,
833 0xff, 0xff, 0xff, 0xcc, 0x00, 0x00, 0x00, 0x00,
834 0xff, 0xff, 0xff, 0xdd, 0x00, 0x00, 0x00, 0x00,
835 0xff, 0xff, 0xff, 0xee, 0x00, 0x00, 0x00, 0x00,
836 0xff, 0xff, 0xff, 0xff
837 };
838 }
839
840 UTEST_BEGIN("runtime.mm", pixel)
841 void test_conversion(
842 const uint8_t *dst, size_t dst_size, mm::pixel_format_t dst_fmt,
843 const uint8_t *src, size_t src_size, mm::pixel_format_t src_fmt,
844 size_t pixels)
845 {
846 printf("Testing pixel conversion %s -> %s (%d pixels)...\n",
847 mm::pixel_format_name(src_fmt), mm::pixel_format_name(dst_fmt), int(pixels));
848
849 const mm::pixel_conversion_t conv = mm::pixel_convert_function(dst_fmt, src_fmt);
850 UTEST_ASSERT(conv != NULL);
851
852 ByteBuffer dbuf(dst_size);
853 ByteBuffer rbuf(dst_size);
854 ByteBuffer sbuf(src_size);
855
856 memcpy(rbuf.data(), dst, dst_size);
857 memcpy(sbuf.data(), src, src_size);
858
859 conv(dbuf.data(), sbuf.data(), pixels);
860
861 dbuf.dump("dbuf");
862 rbuf.dump("rbuf");
863
864 UTEST_ASSERT(!sbuf.corrupted());
865 UTEST_ASSERT(!dbuf.corrupted());
866 UTEST_ASSERT(memcmp(dbuf.data(), dst, dst_size) == 0);
867 }
868
869 #define TEST_CONV(dst, dst_fmt, src, src_fmt, pixels) \
870 test_conversion(dst, sizeof(dst)/sizeof(dst[0]), dst_fmt, src, sizeof(src)/sizeof(src[0]), src_fmt, pixels)
871
872 void test_g1_conversion()
873 {
874 #define TEST_FMT(buf, fmt, count) TEST_CONV(buf, fmt, src_g1, mm::PIXFMT_G1, count);
875 TEST_FMT(dst_g1_to_g2_x10, mm::PIXFMT_G2, 10);
876 TEST_FMT(dst_g1_to_g2_x15, mm::PIXFMT_G2, 15);
877 TEST_FMT(dst_g1_to_a2_x9, mm::PIXFMT_A2, 9);
878 TEST_FMT(dst_g1_to_a2_x15, mm::PIXFMT_A2, 15);
879
880 TEST_FMT(dst_g1_to_g4_x10, mm::PIXFMT_G4, 10);
881 TEST_FMT(dst_g1_to_g4_x15, mm::PIXFMT_G4, 15);
882 TEST_FMT(dst_g1_to_a4_x9, mm::PIXFMT_A4, 9);
883 TEST_FMT(dst_g1_to_a4_x15, mm::PIXFMT_A4, 15);
884
885 TEST_FMT(dst_g1_to_g8_x10, mm::PIXFMT_G8, 10);
886 TEST_FMT(dst_g1_to_g8_x15, mm::PIXFMT_G8, 15);
887 TEST_FMT(dst_g1_to_a8_x9, mm::PIXFMT_A8, 9);
888 TEST_FMT(dst_g1_to_a8_x14, mm::PIXFMT_A8, 14);
889
890 TEST_FMT(dst_g1_to_rgb888_x10, mm::PIXFMT_RGB888, 10);
891 TEST_FMT(dst_g1_to_rgb888_x15, mm::PIXFMT_RGB888, 15);
892
893 TEST_FMT(dst_g1_to_rgba8888_x10, mm::PIXFMT_RGBA8888, 10);
894 TEST_FMT(dst_g1_to_rgba8888_x15, mm::PIXFMT_RGBA8888, 15);
895
896 TEST_FMT(dst_g1_to_prgba8888_x10, mm::PIXFMT_PRGBA8888, 10);
897 TEST_FMT(dst_g1_to_prgba8888_x15, mm::PIXFMT_PRGBA8888, 15);
898 #undef TEST_FMT
899 }
900
901 void test_a1_conversion()
902 {
903 #define TEST_FMT(buf, fmt, count) TEST_CONV(buf, fmt, src_a1, mm::PIXFMT_A1, count);
904 TEST_FMT(dst_a1_to_g2_x10, mm::PIXFMT_G2, 10);
905 TEST_FMT(dst_a1_to_g2_x15, mm::PIXFMT_G2, 15);
906 TEST_FMT(dst_a1_to_a2_x9, mm::PIXFMT_A2, 9);
907 TEST_FMT(dst_a1_to_a2_x15, mm::PIXFMT_A2, 15);
908
909 TEST_FMT(dst_a1_to_g4_x10, mm::PIXFMT_G4, 10);
910 TEST_FMT(dst_a1_to_g4_x15, mm::PIXFMT_G4, 15);
911 TEST_FMT(dst_a1_to_a4_x9, mm::PIXFMT_A4, 9);
912 TEST_FMT(dst_a1_to_a4_x15, mm::PIXFMT_A4, 15);
913
914 TEST_FMT(dst_a1_to_g8_x10, mm::PIXFMT_G8, 10);
915 TEST_FMT(dst_a1_to_g8_x15, mm::PIXFMT_G8, 15);
916 TEST_FMT(dst_a1_to_a8_x9, mm::PIXFMT_A8, 9);
917 TEST_FMT(dst_a1_to_a8_x14, mm::PIXFMT_A8, 14);
918
919 TEST_FMT(dst_a1_to_rgb888_x10, mm::PIXFMT_RGB888, 10);
920 TEST_FMT(dst_a1_to_rgb888_x15, mm::PIXFMT_RGB888, 15);
921
922 TEST_FMT(dst_a1_to_rgba8888_x10, mm::PIXFMT_RGBA8888, 10);
923 TEST_FMT(dst_a1_to_rgba8888_x15, mm::PIXFMT_RGBA8888, 15);
924
925 TEST_FMT(dst_a1_to_prgba8888_x10, mm::PIXFMT_PRGBA8888, 10);
926 TEST_FMT(dst_a1_to_prgba8888_x15, mm::PIXFMT_PRGBA8888, 15);
927 #undef TEST_FMT
928 }
929
930 void test_g2_conversion()
931 {
932 #define TEST_FMT(buf, fmt, count) TEST_CONV(buf, fmt, src_g2, mm::PIXFMT_G2, count);
933 TEST_FMT(dst_g2_to_g1_x10, mm::PIXFMT_G1, 10);
934 TEST_FMT(dst_g2_to_g1_x15, mm::PIXFMT_G1, 15);
935 TEST_FMT(dst_g2_to_a1_x9, mm::PIXFMT_A1, 9);
936 TEST_FMT(dst_g2_to_a1_x15, mm::PIXFMT_A1, 15);
937
938 TEST_FMT(dst_g2_to_g4_x10, mm::PIXFMT_G4, 10);
939 TEST_FMT(dst_g2_to_g4_x15, mm::PIXFMT_G4, 15);
940 TEST_FMT(dst_g2_to_a4_x9, mm::PIXFMT_A4, 9);
941 TEST_FMT(dst_g2_to_a4_x15, mm::PIXFMT_A4, 15);
942
943 TEST_FMT(dst_g2_to_g8_x10, mm::PIXFMT_G8, 10);
944 TEST_FMT(dst_g2_to_g8_x15, mm::PIXFMT_G8, 15);
945 TEST_FMT(dst_g2_to_a8_x9, mm::PIXFMT_A8, 9);
946 TEST_FMT(dst_g2_to_a8_x14, mm::PIXFMT_A8, 14);
947
948 TEST_FMT(dst_g2_to_rgb888_x10, mm::PIXFMT_RGB888, 10);
949 TEST_FMT(dst_g2_to_rgb888_x15, mm::PIXFMT_RGB888, 15);
950
951 TEST_FMT(dst_g2_to_rgba8888_x10, mm::PIXFMT_RGBA8888, 10);
952 TEST_FMT(dst_g2_to_rgba8888_x15, mm::PIXFMT_RGBA8888, 15);
953
954 TEST_FMT(dst_g2_to_prgba8888_x10, mm::PIXFMT_PRGBA8888, 10);
955 TEST_FMT(dst_g2_to_prgba8888_x15, mm::PIXFMT_PRGBA8888, 15);
956 #undef TEST_FMT
957 }
958
959 void test_a2_conversion()
960 {
961 #define TEST_FMT(buf, fmt, count) TEST_CONV(buf, fmt, src_a2, mm::PIXFMT_A2, count);
962 TEST_FMT(dst_a2_to_g1_x10, mm::PIXFMT_G1, 10);
963 TEST_FMT(dst_a2_to_g1_x15, mm::PIXFMT_G1, 15);
964 TEST_FMT(dst_a2_to_a1_x9, mm::PIXFMT_A1, 9);
965 TEST_FMT(dst_a2_to_a1_x15, mm::PIXFMT_A1, 15);
966
967 TEST_FMT(dst_a2_to_g4_x10, mm::PIXFMT_G4, 10);
968 TEST_FMT(dst_a2_to_g4_x15, mm::PIXFMT_G4, 15);
969 TEST_FMT(dst_a2_to_a4_x9, mm::PIXFMT_A4, 9);
970 TEST_FMT(dst_a2_to_a4_x15, mm::PIXFMT_A4, 15);
971
972 TEST_FMT(dst_a2_to_g8_x10, mm::PIXFMT_G8, 10);
973 TEST_FMT(dst_a2_to_g8_x15, mm::PIXFMT_G8, 15);
974 TEST_FMT(dst_a2_to_a8_x9, mm::PIXFMT_A8, 9);
975 TEST_FMT(dst_a2_to_a8_x14, mm::PIXFMT_A8, 14);
976
977 TEST_FMT(dst_a2_to_rgb888_x10, mm::PIXFMT_RGB888, 10);
978 TEST_FMT(dst_a2_to_rgb888_x15, mm::PIXFMT_RGB888, 15);
979
980 TEST_FMT(dst_a2_to_rgba8888_x10, mm::PIXFMT_RGBA8888, 10);
981 TEST_FMT(dst_a2_to_rgba8888_x15, mm::PIXFMT_RGBA8888, 15);
982
983 TEST_FMT(dst_a2_to_prgba8888_x10, mm::PIXFMT_PRGBA8888, 10);
984 TEST_FMT(dst_a2_to_prgba8888_x15, mm::PIXFMT_PRGBA8888, 15);
985 #undef TEST_FMT
986 }
987
988 void test_g4_conversion()
989 {
990 #define TEST_FMT(buf, fmt, count) TEST_CONV(buf, fmt, src_g4, mm::PIXFMT_G4, count);
991 TEST_FMT(dst_g4_to_g1_x10, mm::PIXFMT_G1, 10);
992 TEST_FMT(dst_g4_to_g1_x15, mm::PIXFMT_G1, 15);
993 TEST_FMT(dst_g4_to_a1_x9, mm::PIXFMT_A1, 9);
994 TEST_FMT(dst_g4_to_a1_x15, mm::PIXFMT_A1, 15);
995
996 TEST_FMT(dst_g4_to_g2_x10, mm::PIXFMT_G2, 10);
997 TEST_FMT(dst_g4_to_g2_x15, mm::PIXFMT_G2, 15);
998 TEST_FMT(dst_g4_to_a2_x9, mm::PIXFMT_A2, 9);
999 TEST_FMT(dst_g4_to_a2_x13, mm::PIXFMT_A2, 13);
1000
1001 TEST_FMT(dst_g4_to_g8_x10, mm::PIXFMT_G8, 10);
1002 TEST_FMT(dst_g4_to_g8_x15, mm::PIXFMT_G8, 15);
1003 TEST_FMT(dst_g4_to_a8_x9, mm::PIXFMT_A8, 9);
1004 TEST_FMT(dst_g4_to_a8_x13, mm::PIXFMT_A8, 13);
1005
1006 TEST_FMT(dst_g4_to_rgb888_x10, mm::PIXFMT_RGB888, 10);
1007 TEST_FMT(dst_g4_to_rgb888_x15, mm::PIXFMT_RGB888, 15);
1008
1009 TEST_FMT(dst_g4_to_rgba8888_x10, mm::PIXFMT_RGBA8888, 10);
1010 TEST_FMT(dst_g4_to_rgba8888_x15, mm::PIXFMT_RGBA8888, 15);
1011
1012 TEST_FMT(dst_g4_to_prgba8888_x10, mm::PIXFMT_PRGBA8888, 10);
1013 TEST_FMT(dst_g4_to_prgba8888_x15, mm::PIXFMT_PRGBA8888, 15);
1014
1015 #undef TEST_FMT
1016 }
1017
1018 void test_a4_conversion()
1019 {
1020 #define TEST_FMT(buf, fmt, count) TEST_CONV(buf, fmt, src_a4, mm::PIXFMT_A4, count);
1021 TEST_FMT(dst_a4_to_g1_x10, mm::PIXFMT_G1, 10);
1022 TEST_FMT(dst_a4_to_g1_x15, mm::PIXFMT_G1, 15);
1023 TEST_FMT(dst_a4_to_a1_x9, mm::PIXFMT_A1, 9);
1024 TEST_FMT(dst_a4_to_a1_x14, mm::PIXFMT_A1, 14);
1025
1026 TEST_FMT(dst_a4_to_g2_x10, mm::PIXFMT_G2, 10);
1027 TEST_FMT(dst_a4_to_g2_x15, mm::PIXFMT_G2, 15);
1028 TEST_FMT(dst_a4_to_a2_x9, mm::PIXFMT_A2, 9);
1029 TEST_FMT(dst_a4_to_a2_x13, mm::PIXFMT_A2, 13);
1030
1031 TEST_FMT(dst_a4_to_g8_x10, mm::PIXFMT_G8, 10);
1032 TEST_FMT(dst_a4_to_g8_x15, mm::PIXFMT_G8, 15);
1033 TEST_FMT(dst_a4_to_a8_x9, mm::PIXFMT_A8, 9);
1034 TEST_FMT(dst_a4_to_a8_x13, mm::PIXFMT_A8, 13);
1035
1036 TEST_FMT(dst_a4_to_rgb888_x10, mm::PIXFMT_RGB888, 10);
1037 TEST_FMT(dst_a4_to_rgb888_x15, mm::PIXFMT_RGB888, 15);
1038
1039 TEST_FMT(dst_a4_to_rgba8888_x10, mm::PIXFMT_RGBA8888, 10);
1040 TEST_FMT(dst_a4_to_rgba8888_x15, mm::PIXFMT_RGBA8888, 15);
1041
1042 TEST_FMT(dst_a4_to_prgba8888_x10, mm::PIXFMT_PRGBA8888, 10);
1043 TEST_FMT(dst_a4_to_prgba8888_x15, mm::PIXFMT_PRGBA8888, 15);
1044
1045 #undef TEST_FMT
1046 }
1047
1048 void test_g8_conversion()
1049 {
1050 #define TEST_FMT(buf, fmt, count) TEST_CONV(buf, fmt, src_g8, mm::PIXFMT_G8, count);
1051 TEST_FMT(dst_g8_to_g1_x10, mm::PIXFMT_G1, 10);
1052 TEST_FMT(dst_g8_to_g1_x15, mm::PIXFMT_G1, 15);
1053 TEST_FMT(dst_g8_to_a1_x9, mm::PIXFMT_A1, 9);
1054 TEST_FMT(dst_g8_to_a1_x15, mm::PIXFMT_A1, 15);
1055
1056 TEST_FMT(dst_g8_to_g2_x10, mm::PIXFMT_G2, 10);
1057 TEST_FMT(dst_g8_to_g2_x15, mm::PIXFMT_G2, 15);
1058 TEST_FMT(dst_g8_to_a2_x9, mm::PIXFMT_A2, 9);
1059 TEST_FMT(dst_g8_to_a2_x13, mm::PIXFMT_A2, 13);
1060
1061 TEST_FMT(dst_g8_to_g4_x10, mm::PIXFMT_G4, 10);
1062 TEST_FMT(dst_g8_to_g4_x15, mm::PIXFMT_G4, 15);
1063 TEST_FMT(dst_g8_to_a4_x9, mm::PIXFMT_A4, 9);
1064 TEST_FMT(dst_g8_to_a4_x13, mm::PIXFMT_A4, 13);
1065
1066 TEST_FMT(dst_g8_to_rgb888_x10, mm::PIXFMT_RGB888, 10);
1067 TEST_FMT(dst_g8_to_rgb888_x15, mm::PIXFMT_RGB888, 15);
1068
1069 TEST_FMT(dst_g8_to_rgba8888_x10, mm::PIXFMT_RGBA8888, 10);
1070 TEST_FMT(dst_g8_to_rgba8888_x15, mm::PIXFMT_RGBA8888, 15);
1071
1072 TEST_FMT(dst_g8_to_prgba8888_x10, mm::PIXFMT_PRGBA8888, 10);
1073 TEST_FMT(dst_g8_to_prgba8888_x15, mm::PIXFMT_PRGBA8888, 15);
1074
1075 #undef TEST_FMT
1076 }
1077
1078 void test_a8_conversion()
1079 {
1080 #define TEST_FMT(buf, fmt, count) TEST_CONV(buf, fmt, src_a8, mm::PIXFMT_A8, count);
1081 TEST_FMT(dst_a8_to_g1_x10, mm::PIXFMT_G1, 10);
1082 TEST_FMT(dst_a8_to_g1_x15, mm::PIXFMT_G1, 15);
1083 TEST_FMT(dst_a8_to_a1_x9, mm::PIXFMT_A1, 9);
1084 TEST_FMT(dst_a8_to_a1_x15, mm::PIXFMT_A1, 15);
1085
1086 TEST_FMT(dst_a8_to_g2_x10, mm::PIXFMT_G2, 10);
1087 TEST_FMT(dst_a8_to_g2_x15, mm::PIXFMT_G2, 15);
1088 TEST_FMT(dst_a8_to_a2_x9, mm::PIXFMT_A2, 9);
1089 TEST_FMT(dst_a8_to_a2_x13, mm::PIXFMT_A2, 13);
1090
1091 TEST_FMT(dst_a8_to_g4_x10, mm::PIXFMT_G4, 10);
1092 TEST_FMT(dst_a8_to_g4_x15, mm::PIXFMT_G4, 15);
1093 TEST_FMT(dst_a8_to_a4_x9, mm::PIXFMT_A4, 9);
1094 TEST_FMT(dst_a8_to_a4_x13, mm::PIXFMT_A4, 13);
1095
1096 TEST_FMT(dst_a8_to_rgb888_x10, mm::PIXFMT_RGB888, 10);
1097 TEST_FMT(dst_a8_to_rgb888_x15, mm::PIXFMT_RGB888, 15);
1098
1099 TEST_FMT(dst_a8_to_rgba8888_x10, mm::PIXFMT_RGBA8888, 10);
1100 TEST_FMT(dst_a8_to_rgba8888_x15, mm::PIXFMT_RGBA8888, 15);
1101
1102 TEST_FMT(dst_a8_to_prgba8888_x10, mm::PIXFMT_PRGBA8888, 10);
1103 TEST_FMT(dst_a8_to_prgba8888_x15, mm::PIXFMT_PRGBA8888, 15);
1104
1105 #undef TEST_FMT
1106 }
1107
1108 void test_rgb888_conversion()
1109 {
1110 #define TEST_FMT(buf, fmt, count) TEST_CONV(buf, fmt, src_rgb888, mm::PIXFMT_RGB888, count);
1111 TEST_FMT(dst_rgb888_to_g1_x10, mm::PIXFMT_G1, 10);
1112 TEST_FMT(dst_rgb888_to_g1_x15, mm::PIXFMT_G1, 15);
1113 TEST_FMT(dst_rgb888_to_a1_x9, mm::PIXFMT_A1, 9);
1114 TEST_FMT(dst_rgb888_to_a1_x15, mm::PIXFMT_A1, 15);
1115
1116 TEST_FMT(dst_rgb888_to_g2_x10, mm::PIXFMT_G2, 10);
1117 TEST_FMT(dst_rgb888_to_g2_x15, mm::PIXFMT_G2, 15);
1118 TEST_FMT(dst_rgb888_to_a2_x9, mm::PIXFMT_A2, 9);
1119 TEST_FMT(dst_rgb888_to_a2_x13, mm::PIXFMT_A2, 13);
1120
1121 TEST_FMT(dst_rgb888_to_g4_x10, mm::PIXFMT_G4, 10);
1122 TEST_FMT(dst_rgb888_to_g4_x15, mm::PIXFMT_G4, 15);
1123 TEST_FMT(dst_rgb888_to_a4_x9, mm::PIXFMT_A4, 9);
1124 TEST_FMT(dst_rgb888_to_a4_x13, mm::PIXFMT_A4, 13);
1125
1126 TEST_FMT(dst_rgb888_to_g8_x10, mm::PIXFMT_G8, 10);
1127 TEST_FMT(dst_rgb888_to_g8_x15, mm::PIXFMT_G8, 15);
1128 TEST_FMT(dst_rgb888_to_a8_x9, mm::PIXFMT_A8, 9);
1129 TEST_FMT(dst_rgb888_to_a8_x13, mm::PIXFMT_A8, 13);
1130
1131 TEST_FMT(dst_rgb888_to_rgba8888_x10, mm::PIXFMT_RGBA8888, 10);
1132 TEST_FMT(dst_rgb888_to_rgba8888_x15, mm::PIXFMT_RGBA8888, 15);
1133
1134 TEST_FMT(dst_rgb888_to_prgba8888_x10, mm::PIXFMT_PRGBA8888, 10);
1135 TEST_FMT(dst_rgb888_to_prgba8888_x15, mm::PIXFMT_PRGBA8888, 15);
1136
1137 #undef TEST_FMT
1138 }
1139
1140 void test_rgba8888_conversion()
1141 {
1142 #define TEST_FMT(buf, fmt, count) TEST_CONV(buf, fmt, src_rgba8888, mm::PIXFMT_RGBA8888, count);
1143 TEST_FMT(dst_rgba8888_to_g1_x10, mm::PIXFMT_G1, 10);
1144 TEST_FMT(dst_rgba8888_to_g1_x15, mm::PIXFMT_G1, 15);
1145 TEST_FMT(dst_rgba8888_to_a1_x9, mm::PIXFMT_A1, 9);
1146 TEST_FMT(dst_rgba8888_to_a1_x15, mm::PIXFMT_A1, 15);
1147
1148 TEST_FMT(dst_rgba8888_to_g2_x10, mm::PIXFMT_G2, 10);
1149 TEST_FMT(dst_rgba8888_to_g2_x15, mm::PIXFMT_G2, 15);
1150 TEST_FMT(dst_rgba8888_to_a2_x9, mm::PIXFMT_A2, 9);
1151 TEST_FMT(dst_rgba8888_to_a2_x13, mm::PIXFMT_A2, 13);
1152
1153 TEST_FMT(dst_rgba8888_to_g4_x10, mm::PIXFMT_G4, 10);
1154 TEST_FMT(dst_rgba8888_to_g4_x15, mm::PIXFMT_G4, 15);
1155 TEST_FMT(dst_rgba8888_to_a4_x9, mm::PIXFMT_A4, 9);
1156 TEST_FMT(dst_rgba8888_to_a4_x13, mm::PIXFMT_A4, 13);
1157
1158 TEST_FMT(dst_rgba8888_to_g8_x10, mm::PIXFMT_G8, 10);
1159 TEST_FMT(dst_rgba8888_to_g8_x15, mm::PIXFMT_G8, 15);
1160 TEST_FMT(dst_rgba8888_to_a8_x9, mm::PIXFMT_A8, 9);
1161 TEST_FMT(dst_rgba8888_to_a8_x13, mm::PIXFMT_A8, 13);
1162
1163 TEST_FMT(dst_rgba8888_to_rgb888_x10, mm::PIXFMT_RGB888, 10);
1164 TEST_FMT(dst_rgba8888_to_rgb888_x15, mm::PIXFMT_RGB888, 15);
1165
1166 TEST_FMT(dst_rgba8888_to_prgba8888_x10, mm::PIXFMT_PRGBA8888, 10);
1167 TEST_FMT(dst_rgba8888_to_prgba8888_x15, mm::PIXFMT_PRGBA8888, 15);
1168
1169 #undef TEST_FMT
1170 }
1171
1172 void test_prgba8888_conversion()
1173 {
1174 #define TEST_FMT(buf, fmt, count) TEST_CONV(buf, fmt, src_prgba8888, mm::PIXFMT_PRGBA8888, count);
1175 TEST_FMT(dst_prgba8888_to_g1_x10, mm::PIXFMT_G1, 10);
1176 TEST_FMT(dst_prgba8888_to_g1_x15, mm::PIXFMT_G1, 15);
1177 TEST_FMT(dst_prgba8888_to_a1_x9, mm::PIXFMT_A1, 9);
1178 TEST_FMT(dst_prgba8888_to_a1_x15, mm::PIXFMT_A1, 15);
1179
1180 TEST_FMT(dst_prgba8888_to_g2_x10, mm::PIXFMT_G2, 10);
1181 TEST_FMT(dst_prgba8888_to_g2_x15, mm::PIXFMT_G2, 15);
1182 TEST_FMT(dst_prgba8888_to_a2_x9, mm::PIXFMT_A2, 9);
1183 TEST_FMT(dst_prgba8888_to_a2_x13, mm::PIXFMT_A2, 13);
1184
1185 TEST_FMT(dst_prgba8888_to_g4_x10, mm::PIXFMT_G4, 10);
1186 TEST_FMT(dst_prgba8888_to_g4_x15, mm::PIXFMT_G4, 15);
1187 TEST_FMT(dst_prgba8888_to_a4_x9, mm::PIXFMT_A4, 9);
1188 TEST_FMT(dst_prgba8888_to_a4_x13, mm::PIXFMT_A4, 13);
1189
1190 TEST_FMT(dst_prgba8888_to_g8_x10, mm::PIXFMT_G8, 10);
1191 TEST_FMT(dst_prgba8888_to_g8_x15, mm::PIXFMT_G8, 15);
1192 TEST_FMT(dst_prgba8888_to_a8_x9, mm::PIXFMT_A8, 9);
1193 TEST_FMT(dst_prgba8888_to_a8_x13, mm::PIXFMT_A8, 13);
1194
1195 TEST_FMT(dst_prgba8888_to_rgb888_x10, mm::PIXFMT_RGB888, 10);
1196 TEST_FMT(dst_prgba8888_to_rgb888_x15, mm::PIXFMT_RGB888, 15);
1197
1198 TEST_FMT(dst_prgba8888_to_rgba8888_x10, mm::PIXFMT_RGBA8888, 10);
1199 TEST_FMT(dst_prgba8888_to_rgba8888_x15, mm::PIXFMT_RGBA8888, 15);
1200
1201 #undef TEST_FMT
1202 }
1203
1204
1205 UTEST_MAIN
1206 {
1207 test_g1_conversion();
1208 test_a1_conversion();
1209 test_g2_conversion();
1210 test_a2_conversion();
1211 test_g4_conversion();
1212 test_a4_conversion();
1213 test_g8_conversion();
1214 test_a8_conversion();
1215 test_rgb888_conversion();
1216 test_rgba8888_conversion();
1217 test_prgba8888_conversion();
1218 }
1219 UTEST_END;
1220
1221
1222