From 5a271a70d1604fe4223747a5c4cc4e87704d3823 Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Thu, 2 Oct 2014 15:44:12 +0200 Subject: [PATCH] Add XYZ table generator --- util/xyztab.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 util/xyztab.c diff --git a/util/xyztab.c b/util/xyztab.c new file mode 100644 index 000000000..d6863ca43 --- /dev/null +++ b/util/xyztab.c @@ -0,0 +1,28 @@ +#include +#include +#include +#include + +int main(int argc, char **argv) +{ + printf("#include \n"); + printf("const float xyz_table[256] = {\n "); + for (int i=0; i<256; i++) { + float t = i/255.0f; + if (t > 0.04045f) { + t = powf(((t+0.055f) / 1.055f), 2.4f); + } else { + t/= 12.92f; + } + t*=100.0f; + + printf("%.6ff, ", t); + if (i==255) { + printf("\n"); + } else if ((i+1)%8==0) { + printf("\n "); + } + } + printf("};\n"); + return 0; +}