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

Function unorm8x4ArrayToImage

lib/astc_codec.cpp:653–671  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

651}
652
653static astcenc_image*
654unorm8x4ArrayToImage(const uint8_t *data, uint32_t dim_x, uint32_t dim_y) {
655 astcenc_image *img = imageAllocate(8, dim_x, dim_y, 1);
656 assert(img);
657
658 for (uint32_t y = 0; y < dim_y; y++) {
659 uint8_t * data8 = static_cast<uint8_t *>(img->data[0]);
660 const uint8_t *src = data + 4 * dim_x * y;
661
662 for (uint32_t x = 0; x < dim_x; x++) {
663 data8[(4 * dim_x * y) + (4 * x) ] = src[4 * x ];
664 data8[(4 * dim_x * y) + (4 * x + 1)] = src[4 * x + 1];
665 data8[(4 * dim_x * y) + (4 * x + 2)] = src[4 * x + 2];
666 data8[(4 * dim_x * y) + (4 * x + 3)] = src[4 * x + 3];
667 }
668 }
669
670 return img;
671}
672
673/**
674 * @memberof ktxTexture

Callers 1

Calls 2

imageAllocateFunction · 0.85
assertFunction · 0.85

Tested by

no test coverage detected