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

Function unorm8x2ArrayToImage

lib/astc_codec.cpp:613–631  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

611}
612
613static astcenc_image*
614unorm8x2ArrayToImage(const uint8_t *data, uint32_t dim_x, uint32_t dim_y) {
615 astcenc_image *img = imageAllocate(8, dim_x, dim_y, 1);
616 assert(img);
617
618 for (uint32_t y = 0; y < dim_y; y++) {
619 uint8_t * data8 = static_cast<uint8_t *>(img->data[0]);
620 const uint8_t *src = data + 2 * dim_x * y;
621
622 for (uint32_t x = 0; x < dim_x; x++) {
623 data8[(4 * dim_x * y) + (4 * x) ] = src[2 * x ];
624 data8[(4 * dim_x * y) + (4 * x + 1)] = src[2 * x ];
625 data8[(4 * dim_x * y) + (4 * x + 2)] = src[2 * x ];
626 data8[(4 * dim_x * y) + (4 * x + 3)] = src[2 * x + 1];
627 }
628 }
629
630 return img;
631}
632
633static astcenc_image*
634unorm8x3ArrayToImage(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