MCPcopy Create free account
hub / github.com/KhronosGroup/KTX-Software / unorm8x3ArrayToImage

Function unorm8x3ArrayToImage

lib/astc_codec.cpp:633–651  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

631}
632
633static astcenc_image*
634unorm8x3ArrayToImage(const uint8_t *data, uint32_t dim_x, uint32_t dim_y) {
635 astcenc_image *img = imageAllocate(8, dim_x, dim_y, 1);
636 assert(img);
637
638 for (uint32_t y = 0; y < dim_y; y++) {
639 uint8_t * data8 = static_cast<uint8_t *>(img->data[0]);
640 const uint8_t *src = data + 3 * dim_x * y;
641
642 for (uint32_t x = 0; x < dim_x; x++) {
643 data8[(4 * dim_x * y) + (4 * x) ] = src[3 * x ];
644 data8[(4 * dim_x * y) + (4 * x + 1)] = src[3 * x + 1];
645 data8[(4 * dim_x * y) + (4 * x + 2)] = src[3 * x + 2];
646 data8[(4 * dim_x * y) + (4 * x + 3)] = 255;
647 }
648 }
649
650 return img;
651}
652
653static astcenc_image*
654unorm8x4ArrayToImage(const uint8_t *data, uint32_t dim_x, uint32_t dim_y) {

Callers 1

Calls 2

imageAllocateFunction · 0.85
assertFunction · 0.85

Tested by

no test coverage detected