See header for documentation. */
| 229 | |
| 230 | /* See header for documentation. */ |
| 231 | astcenc_image_ptr astc_img_from_unorm8x4_array( |
| 232 | const uint8_t* data, |
| 233 | unsigned int dim_x, |
| 234 | unsigned int dim_y, |
| 235 | bool y_flip |
| 236 | ) { |
| 237 | auto img = alloc_image(8, dim_x, dim_y, 1); |
| 238 | |
| 239 | for (unsigned int y = 0; y < dim_y; y++) |
| 240 | { |
| 241 | uint8_t* data8 = static_cast<uint8_t*>(img->data[0]); |
| 242 | unsigned int y_src = y_flip ? (dim_y - y - 1) : y; |
| 243 | const uint8_t* src = data + 4 * dim_x * y_src; |
| 244 | |
| 245 | for (unsigned int x = 0; x < dim_x; x++) |
| 246 | { |
| 247 | data8[(4 * dim_x * y) + (4 * x )] = src[4 * x ]; |
| 248 | data8[(4 * dim_x * y) + (4 * x + 1)] = src[4 * x + 1]; |
| 249 | data8[(4 * dim_x * y) + (4 * x + 2)] = src[4 * x + 2]; |
| 250 | data8[(4 * dim_x * y) + (4 * x + 3)] = src[4 * x + 3]; |
| 251 | } |
| 252 | } |
| 253 | |
| 254 | return img; |
| 255 | } |
| 256 | |
| 257 | /* See header for documentation. */ |
| 258 | std::vector<float> floatx4_array_from_astc_img( |
no test coverage detected