See header for documentation. */
| 195 | |
| 196 | /* See header for documentation. */ |
| 197 | astcenc_image_ptr astc_img_from_floatx4_array( |
| 198 | const float* data, |
| 199 | unsigned int dim_x, |
| 200 | unsigned int dim_y, |
| 201 | bool y_flip |
| 202 | ) { |
| 203 | auto img = alloc_image(16, dim_x, dim_y, 1); |
| 204 | |
| 205 | for (unsigned int y = 0; y < dim_y; y++) |
| 206 | { |
| 207 | uint16_t* data16 = static_cast<uint16_t*>(img->data[0]); |
| 208 | unsigned int y_src = y_flip ? (dim_y - y - 1) : y; |
| 209 | const float* src = data + 4 * dim_x * y_src; |
| 210 | |
| 211 | for (unsigned int x = 0; x < dim_x; x++) |
| 212 | { |
| 213 | vint4 colorf16 = float_to_float16(vfloat4( |
| 214 | src[4 * x ], |
| 215 | src[4 * x + 1], |
| 216 | src[4 * x + 2], |
| 217 | src[4 * x + 3] |
| 218 | )); |
| 219 | |
| 220 | data16[(4 * dim_x * y) + (4 * x )] = static_cast<uint16_t>(colorf16.lane<0>()); |
| 221 | data16[(4 * dim_x * y) + (4 * x + 1)] = static_cast<uint16_t>(colorf16.lane<1>()); |
| 222 | data16[(4 * dim_x * y) + (4 * x + 2)] = static_cast<uint16_t>(colorf16.lane<2>()); |
| 223 | data16[(4 * dim_x * y) + (4 * x + 3)] = static_cast<uint16_t>(colorf16.lane<3>()); |
| 224 | } |
| 225 | } |
| 226 | |
| 227 | return img; |
| 228 | } |
| 229 | |
| 230 | /* See header for documentation. */ |
| 231 | astcenc_image_ptr astc_img_from_unorm8x4_array( |
no test coverage detected