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

Function store_ncimage

Source/astcenccli_image_load_store.cpp:2537–2568  ·  view source on GitHub ↗

See header for documentation. */

Source from the content-addressed store, hash-verified

2535
2536/* See header for documentation. */
2537bool store_ncimage(
2538 const astcenc_image* output_image,
2539 const char* filename,
2540 int y_flip
2541) {
2542 const char* eptr = strrchr(filename, '.');
2543 if (!eptr)
2544 {
2545 eptr = ".ktx"; // use KTX file format if we don't have an ending.
2546 }
2547
2548 // Scan through descriptors until a matching storer is found
2549 image_storer storer { nullptr };
2550 for (size_t i = 0; i < storer_descr_count; i++)
2551 {
2552 if (strcmp(eptr, storer_descs[i].ending1) == 0
2553 || strcmp(eptr, storer_descs[i].ending2) == 0)
2554 {
2555 storer = storer_descs[i].storer_func;
2556 break;
2557 }
2558 }
2559
2560 // Should never fail this, get_output_filename_enforced_bitness should have
2561 // acted as a preflight check
2562 if (!storer)
2563 {
2564 return false;
2565 }
2566
2567 return storer(output_image, filename, y_flip);
2568}
2569
2570/* ============================================================================
2571 ASTC compressed file loading

Callers 2

print_diagnostic_imagesFunction · 0.85
astcenc_mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected