diff options
author | Mattias Andrée <maandree@kth.se> | 2021-09-16 17:58:59 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2021-09-16 17:58:59 +0200 |
commit | a79fb47fd9ac05d21b6a930c79dd53ed39ad0c76 (patch) | |
tree | 7aad0f981d814988169244c9d6a2ccc871db8e65 /test.c | |
parent | m (diff) | |
download | libclut-a79fb47fd9ac05d21b6a930c79dd53ed39ad0c76.tar.gz libclut-a79fb47fd9ac05d21b6a930c79dd53ed39ad0c76.tar.bz2 libclut-a79fb47fd9ac05d21b6a930c79dd53ed39ad0c76.tar.xz |
Fix makefile, fix warnings, fix bugs, and otherwise improve code1.2.1
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'test.c')
-rw-r--r-- | test.c | 28 |
1 files changed, 21 insertions, 7 deletions
@@ -8,6 +8,11 @@ #include <string.h> #include <math.h> +#if defined(__GNUC__) +# pragma GCC diagnostic ignored "-Wunsuffixed-float-constants" +#endif + + struct clut { size_t red_size; size_t green_size; @@ -201,14 +206,14 @@ main(int argc, char *argv[]) param = 2; for (i = 0; i < 256; i++) { - double x = (double)i / 255; + double t = (double)i / 255; if (i % 255) { - x = 1 / x - 1; - x = log(x); - x = HALF - x / param; + t = 1 / t - 1; + t = log(t); + t = HALF - t / param; } t1.blue[i] = t1.green[i] = t1.red[i] = (uint16_t)((i << 8) | i); - t2.blue[i] = t2.green[i] = t2.red[i] = (uint16_t)(x * UINT16_MAX); + t2.blue[i] = t2.green[i] = t2.red[i] = (uint16_t)(t * UINT16_MAX); } libclut_sigmoid(&t1, UINT16_MAX, uint16_t, ¶m, ¶m, ¶m); t1.blue[0] = t1.green[0] = t1.red[0] = t2.red[0]; @@ -296,8 +301,17 @@ main(int argc, char *argv[]) goto rgb_conversion_done; } - libclut_convert_rgb_inplace(&t1, 1, double, M, trunc); /* TODO test */ - libclut_convert_rgb(&t1, 1, double, M, trunc, &t2); /* TODO test */ +#if defined(__GNUC__) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Waddress" +#endif + + libclut_convert_rgb_inplace(&d1, 1, double, M, trunc); /* TODO test */ + libclut_convert_rgb(&d1, 1, double, M, trunc, &d2); /* TODO test */ + +#if defined(__GNUC__) +# pragma GCC diagnostic pop +#endif if (libclut_model_get_rgb_conversion_matrix(&srgb, NULL, M, Minv)) { printf("libclut_model_get_rgb_conversion_matrix failed\n"), rc = 1; |