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

Function astcenc_get_block_info

Source/astcenc_entry.cpp:1401–1517  ·  view source on GitHub ↗

See header for documentation. */

Source from the content-addressed store, hash-verified

1399
1400/* See header for documentation. */
1401astcenc_error astcenc_get_block_info(
1402 astcenc_context* ctxo,
1403 const uint8_t data[16],
1404 astcenc_block_info* info
1405) {
1406#if defined(ASTCENC_DECOMPRESS_ONLY)
1407 (void)ctxo;
1408 (void)data;
1409 (void)info;
1410 return ASTCENC_ERR_BAD_CONTEXT;
1411#else
1412 astcenc_contexti* ctx = &ctxo->context;
1413
1414 // Decode the compressed data into a symbolic form
1415 symbolic_compressed_block scb;
1416 physical_to_symbolic(*ctx->bsd, data, scb);
1417
1418 // Fetch the appropriate partition and decimation tables
1419 const block_size_descriptor& bsd = *ctx->bsd;
1420
1421 // Start from a clean slate
1422 memset(info, 0, sizeof(*info));
1423
1424 // Basic info we can always populate
1425 info->profile = ctx->config.profile;
1426
1427 info->block_x = ctx->config.block_x;
1428 info->block_y = ctx->config.block_y;
1429 info->block_z = ctx->config.block_z;
1430 info->texel_count = bsd.texel_count;
1431
1432 // Check for error blocks first
1433 info->is_error_block = scb.block_type == SYM_BTYPE_ERROR;
1434 if (info->is_error_block)
1435 {
1436 return ASTCENC_SUCCESS;
1437 }
1438
1439 // Check for constant color blocks second
1440 info->is_constant_block = scb.block_type == SYM_BTYPE_CONST_F16 ||
1441 scb.block_type == SYM_BTYPE_CONST_U16;
1442 if (info->is_constant_block)
1443 {
1444 return ASTCENC_SUCCESS;
1445 }
1446
1447 // Otherwise handle a full block ; known to be valid after conditions above have been checked
1448 unsigned int partition_count = scb.partition_count;
1449 const auto& pi = bsd.get_partition_info(partition_count, scb.partition_index);
1450
1451 const block_mode& bm = bsd.get_block_mode(scb.block_mode);
1452 const decimation_info& di = bsd.get_decimation_info(bm.decimation_mode);
1453
1454 info->weight_x = di.weight_x;
1455 info->weight_y = di.weight_y;
1456 info->weight_z = di.weight_z;
1457
1458 info->is_dual_plane_block = bm.is_dual_plane != 0;

Callers 1

print_diagnostic_imageFunction · 0.85

Calls 11

physical_to_symbolicFunction · 0.85
unpack_color_endpointsFunction · 0.85
lns_to_sf16Function · 0.85
unorm16_to_sf16Function · 0.85
unpack_weightsFunction · 0.85
get_color_quant_modeMethod · 0.80
get_weight_quant_modeMethod · 0.80
get_quant_levelFunction · 0.70
selectFunction · 0.70
storeFunction · 0.70
float16_to_floatFunction · 0.70

Tested by

no test coverage detected