| 651 | } |
| 652 | |
| 653 | static astcenc_image* |
| 654 | unorm8x4ArrayToImage(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 |
no test coverage detected