| 269 | } |
| 270 | |
| 271 | void test_float(const char* file, float width_percent, float height_percent, stbir_datatype type, stbir_colorspace colorspace) |
| 272 | { |
| 273 | int w, h, n; |
| 274 | unsigned char* input_data = stbi_load(file, &w, &h, &n, 0); |
| 275 | |
| 276 | if (input_data == NULL) |
| 277 | return; |
| 278 | |
| 279 | int new_w = (int)(w * width_percent); |
| 280 | int new_h = (int)(h * height_percent); |
| 281 | |
| 282 | float* T_data = (float*)malloc(w * h * n * sizeof(float)); |
| 283 | convert_image_float(input_data, T_data, w * h * n); |
| 284 | |
| 285 | float* output_data = (float*)malloc(new_w * new_h * n * sizeof(float)); |
| 286 | |
| 287 | stbir_resize_float_generic(T_data, w, h, 0, output_data, new_w, new_h, 0, n, STBIR_ALPHA_CHANNEL_NONE, 0, STBIR_EDGE_CLAMP, STBIR_FILTER_CATMULLROM, colorspace, &g_context); |
| 288 | |
| 289 | free(T_data); |
| 290 | stbi_image_free(input_data); |
| 291 | |
| 292 | unsigned char* char_data = (unsigned char*)malloc(new_w * new_h * n * sizeof(char)); |
| 293 | convert_image_float(output_data, char_data, new_w * new_h * n); |
| 294 | |
| 295 | char output[200]; |
| 296 | sprintf(output, "test-output/type-%d-%d-%d-%d-%s", type, colorspace, new_w, new_h, file); |
| 297 | stbi_write_png(output, new_w, new_h, n, char_data, 0); |
| 298 | |
| 299 | free(char_data); |
| 300 | free(output_data); |
| 301 | } |
| 302 | |
| 303 | void test_channels(const char* file, float width_percent, float height_percent, int channels) |
| 304 | { |
no test coverage detected