MCPcopy Create free account
hub / github.com/ARM-software/astc-encoder / generate_unpacked_quant

Function generate_unpacked_quant

Utils/astc_quant_generator.cpp:261–343  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

259}};
260
261void generate_unpacked_quant(
262 const quant_config& config,
263 std::set<unsigned int>& set
264) {
265 unsigned int levels = get_quant_level(config.quant);
266 unsigned int emitted = 0;
267
268 // Value has 1 trit and N bits
269 if (config.trits)
270 {
271 for (unsigned int D = 0; D < 3; D++)
272 {
273 unsigned int max_bits = 1 << config.bits;
274 for (unsigned int bits = 0; bits < max_bits; bits++)
275 {
276 unsigned int A = (bits & 1) * 0b111111111;
277 unsigned int B = 0;
278 unsigned int bit = bits;
279 for (const auto& mask_n: config.masks)
280 {
281 unsigned int bit_n = bit & 1;
282 bit >>= 1;
283 B += bit_n * mask_n;
284 }
285
286 unsigned int T = D * config.C + B;
287 T = T ^ A;
288 T = (A & 0x80) | (T >> 2);
289 set.insert(T);
290 }
291 }
292 }
293 // Value has 1 quint and N bits
294 else if (config.quints)
295 {
296 for (unsigned int D = 0; D < 5; D++)
297 {
298 unsigned int max_bits = 1 << config.bits;
299 for (unsigned int bits = 0; bits < max_bits; bits++)
300 {
301 unsigned int A = (bits & 1) * 0b111111111;
302 unsigned int B = 0;
303 unsigned int bit = bits;
304 for (const auto& mask_n: config.masks)
305 {
306 unsigned int bit_n = bit & 1;
307 bit >>= 1;
308 B += bit_n * mask_n;
309 }
310
311 unsigned int T = D * config.C + B;
312 T = T ^ A;
313 T = (A & 0x80) | (T >> 2);
314 set.insert(T);
315 }
316 }
317 }
318 // Value has N bits

Callers 1

mainFunction · 0.85

Calls 1

get_quant_levelFunction · 0.70

Tested by

no test coverage detected